diff --git a/sale_input_barcode/__manifest__.py b/sale_input_barcode/__manifest__.py index 7e19210b2bbc..66a77f219621 100644 --- a/sale_input_barcode/__manifest__.py +++ b/sale_input_barcode/__manifest__.py @@ -14,9 +14,8 @@ "depends": [ "sale_management", "barcode_action", + "barcode", ], - "data": [ - "views/sale.xml", - ], + "data": ["views/sale.xml", "views/sale_input_settings_view.xml"], "demo": [], } diff --git a/sale_input_barcode/models/__init__.py b/sale_input_barcode/models/__init__.py index 8e4dc36757b1..0c4236223931 100644 --- a/sale_input_barcode/models/__init__.py +++ b/sale_input_barcode/models/__init__.py @@ -1,2 +1,3 @@ from . import product_barcode_line_mixin from . import sale_order +from . import res_config_settings diff --git a/sale_input_barcode/models/res_config_settings.py b/sale_input_barcode/models/res_config_settings.py new file mode 100644 index 000000000000..0c8c68920210 --- /dev/null +++ b/sale_input_barcode/models/res_config_settings.py @@ -0,0 +1,12 @@ +from odoo import fields, models + + +class ResConfigSettings(models.TransientModel): + + _inherit = "res.config.settings" + + sale_sol_creation_settings = fields.Boolean( + string="Increase quantity instead of creating a new line", + config_parameter="sale_input_barcode.sale_sol_creation_settings", + default=False, + ) diff --git a/sale_input_barcode/models/sale_order.py b/sale_input_barcode/models/sale_order.py index 6806790171f0..97a7facefec9 100644 --- a/sale_input_barcode/models/sale_order.py +++ b/sale_input_barcode/models/sale_order.py @@ -31,7 +31,16 @@ def process_barcode(self, barcode): product_order_line = self.order_line.filtered( lambda x: x.product_id.id == line_vals.get("product_id") )[:1] - if product_order_line: + + sale_sol_creation_settings = ( + self.env["ir.config_parameter"] + .sudo() + .get_param( + "sale_input_barcode.sale_sol_creation_settings", + ) + ) + + if product_order_line and sale_sol_creation_settings: product_order_line.product_uom_qty += 1 else: product_order_line = self.env["sale.order.line"].new(line_vals) diff --git a/sale_input_barcode/static/description/index.html b/sale_input_barcode/static/description/index.html index 9e300637687a..f670f6c7f5a7 100644 --- a/sale_input_barcode/static/description/index.html +++ b/sale_input_barcode/static/description/index.html @@ -8,10 +8,11 @@ /* :Author: David Goodger (goodger@python.org) -:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $ +:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $ :Copyright: This stylesheet has been placed in the public domain. Default cascading style sheet for the HTML output of Docutils. +Despite the name, some widely supported CSS2 features are used. See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to customize this style sheet. @@ -274,7 +275,7 @@ margin-left: 2em ; margin-right: 2em } -pre.code .ln { color: grey; } /* line numbers */ +pre.code .ln { color: gray; } /* line numbers */ pre.code, code { background-color: #eeeeee } pre.code .comment, code .comment { color: #5C6576 } pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold } @@ -300,7 +301,7 @@ span.pre { white-space: pre } -span.problematic { +span.problematic, pre.problematic { color: red } span.section-subtitle { @@ -422,7 +423,9 @@

Authors

Maintainers

This module is maintained by the OCA.

-Odoo Community Association + +Odoo Community Association +

OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.

diff --git a/sale_input_barcode/views/sale_input_settings_view.xml b/sale_input_barcode/views/sale_input_settings_view.xml new file mode 100644 index 000000000000..a9888b336879 --- /dev/null +++ b/sale_input_barcode/views/sale_input_settings_view.xml @@ -0,0 +1,23 @@ + + + res.config.settings.sale.input.barcode + res.config.settings + + + +
+ +
+
+
+ + + +
+
+
+