| 1 | import { SaleOrderLineProductField } from '@sale/js/sale_product_field'; |
| 2 | import { patch } from '@web/core/utils/patch'; |
| 3 | |
| 4 | patch(SaleOrderLineProductField.prototype, { |
| 5 | _getAdditionalDialogProps() { |
| 6 | const props = super._getAdditionalDialogProps(); |
| 7 | |
| 8 | const isOptionalLine = this.env.shouldCollapse(this.props.record, 'is_optional'); |
| 9 | props.options = { |
| 10 | showQuantity: !isOptionalLine, |
| 11 | showPrice: !isOptionalLine, |
| 12 | }; |
| 13 | |
| 14 | return props; |
| 15 | }, |
| 16 | |
| 17 | _prepareNewLineData(line, product) { |
| 18 | const data = super._prepareNewLineData(line, product); |
| 19 | if (this.env.shouldCollapse(line, 'is_optional')) { |
| 20 | data.quantity = 0; |
| 21 | } |
| 22 | return data; |
| 23 | } |
| 24 | }); |