diff --git a/stock_barcodes/models/stock_barcodes_option.py b/stock_barcodes/models/stock_barcodes_option.py
index 9cbced01973b..0f28adb6d30a 100644
--- a/stock_barcodes/models/stock_barcodes_option.py
+++ b/stock_barcodes/models/stock_barcodes_option.py
@@ -84,6 +84,10 @@ class StockBarcodesOptionGroup(models.Model):
keep_screen_values = fields.Boolean(
help="If checked the wizard values are kept until the pending move is completed",
)
+ accumulate_read_quantity = fields.Boolean(
+ help="If checked quantity will be accumulated to the existing record instead of "
+ "overwrite it with the new quantity value",
+ )
def get_option_value(self, field_name, attribute):
option = self.option_ids.filtered(lambda op: op.field_name == field_name)[:1]
diff --git a/stock_barcodes/views/stock_barcodes_option_view.xml b/stock_barcodes/views/stock_barcodes_option_view.xml
index cec63626f930..b9319f596668 100644
--- a/stock_barcodes/views/stock_barcodes_option_view.xml
+++ b/stock_barcodes/views/stock_barcodes_option_view.xml
@@ -35,6 +35,7 @@
+
diff --git a/stock_barcodes/wizard/stock_barcodes_read_inventory.py b/stock_barcodes/wizard/stock_barcodes_read_inventory.py
index 15d94d91db8c..e474796ff554 100644
--- a/stock_barcodes/wizard/stock_barcodes_read_inventory.py
+++ b/stock_barcodes/wizard/stock_barcodes_read_inventory.py
@@ -61,7 +61,6 @@ def _inventory_quant_domain(self):
"<=",
fields.Date.context_today(self).strftime("%Y-%m-%d"),
),
- ("inventory_quantity_set", "=", True),
("product_id", "=", self.product_id.id),
("location_id", "=", self.location_id.id),
("lot_id", "=", self.lot_id.id),
@@ -78,7 +77,10 @@ def _add_inventory_quant(self):
):
self._serial_tracking_message_fail()
return False
- quant.inventory_quantity = self.product_qty
+ if self.option_group_id.accumulate_read_quantity:
+ quant.inventory_quantity += self.product_qty
+ else:
+ quant.inventory_quantity = self.product_qty
else:
if self.product_id.tracking == "serial" and self.product_qty != 1:
self._serial_tracking_message_fail()