diff --git a/addons/stock/static/src/widgets/generate_serial.js b/addons/stock/static/src/widgets/generate_serial.js index 7ddbf48546a..bd33e074a92 100644 --- a/addons/stock/static/src/widgets/generate_serial.js +++ b/addons/stock/static/src/widgets/generate_serial.js @@ -20,6 +20,7 @@ export class GenerateDialog extends Component { this.nextSerial = useRef('nextSerial'); this.nextSerialCount = useRef('nextSerialCount'); + this.keepLines = useRef('keepLines'); this.lots = useRef('lots'); this.orm = useService("orm"); onMounted(() => { @@ -51,11 +52,18 @@ export class GenerateDialog extends Component { }) ); } + if (!this.keepLines.el.checked) { + await lines._applyCommands(lines._currentIds.map((currentId) => [ + x2ManyCommands.DELETE, + currentId, + ])); + } lines.records.push(...newlines); lines._commands.push(...newlines.map((record) => [ x2ManyCommands.CREATE, record._virtualId, ])); + lines._currentIds.push(...newlines.map((record) => record._virtualId)); await lines._onUpdate(); this.props.close(); } diff --git a/addons/stock/static/src/widgets/lots_dialog.xml b/addons/stock/static/src/widgets/lots_dialog.xml index c026a838719..c3df258dfb1 100644 --- a/addons/stock/static/src/widgets/lots_dialog.xml +++ b/addons/stock/static/src/widgets/lots_dialog.xml @@ -31,6 +31,16 @@ +
+
+ +
+
+
+ +
+
+
@@ -47,6 +57,16 @@ class="o_input" t-ref="lots" id="next_serial_0" type="text"/> +
+
+ +
+
+
+
+ +
+