From 5df6fbcbbf561bb651f93db51d3b1fe5613f2530 Mon Sep 17 00:00:00 2001 From: Sylvain LE GAL Date: Fri, 26 Apr 2024 11:48:05 +0200 Subject: [PATCH 1/4] [REF] product_print_category : remove obsolete options --- product_print_category/i18n/fr.po | 35 ------------------- .../wizard/product_print_wizard.py | 25 +------------ .../wizard/view_product_print_wizard.xml | 9 ----- 3 files changed, 1 insertion(+), 68 deletions(-) diff --git a/product_print_category/i18n/fr.po b/product_print_category/i18n/fr.po index 257be2a9..27b1dc03 100644 --- a/product_print_category/i18n/fr.po +++ b/product_print_category/i18n/fr.po @@ -192,26 +192,6 @@ msgstr "Imprimer les produits obsolètes" msgid "Print Products" msgstr "Imprimer les articles" -#. module: product_print_category -#: model:ir.model.fields,field_description:product_print_category.field_product_print_wizard__option_print_barcode -msgid "Print barcode" -msgstr "Imprimer les codes barres" - -#. module: product_print_category -#: model:ir.model.fields,field_description:product_print_category.field_product_print_wizard__option_print_barcode_digits -msgid "Print barcode digits" -msgstr "Imprimer les chiffres du code-barre" - -#. module: product_print_category -#: model:ir.model.fields,help:product_print_category.field_product_print_wizard__option_print_barcode_digits -msgid "Print barcode digits if barcode exists" -msgstr "Imprime les chiffres du code-barre s'il y en a un" - -#. module: product_print_category -#: model:ir.model.fields,help:product_print_category.field_product_print_wizard__option_print_barcode -msgid "Print barcode if it exists" -msgstr "Imprimer les codes barres s'ils existent" - #. module: product_print_category #: model_terms:ir.ui.view,arch_db:product_print_category.view_product_print_category_form msgid "Print category name" @@ -228,16 +208,6 @@ msgstr "Options d'impression" msgid "Print options should be configured on Product Variants" msgstr "" -#. module: product_print_category -#: model:ir.model.fields,field_description:product_print_category.field_product_print_wizard__option_print_code -msgid "Print product code" -msgstr "Imprimer les codes internes" - -#. module: product_print_category -#: model:ir.model.fields,help:product_print_category.field_product_print_wizard__option_print_code -msgid "Print product code even if there is a barcode" -msgstr "Imprimer le code même s'il y a un code-barre" - #. module: product_print_category #: model:ir.model,name:product_print_category.model_product_product #: model:ir.model.fields,field_description:product_print_category.field_product_print_category__product_ids @@ -315,11 +285,6 @@ msgstr "" msgid "Wizard line for printing products" msgstr "" -#. module: product_print_category -#: model_terms:ir.ui.view,arch_db:product_print_category.view_product_print_wizard_form -msgid "🔧 Choose options" -msgstr "🔧 Choisir les options" - #. module: product_print_category #: model_terms:ir.ui.view,arch_db:product_print_category.view_product_print_wizard_form msgid "🖨️ Choose Products to print" diff --git a/product_print_category/wizard/product_print_wizard.py b/product_print_category/wizard/product_print_wizard.py index 83ea9ab0..0ca7e303 100644 --- a/product_print_category/wizard/product_print_wizard.py +++ b/product_print_category/wizard/product_print_wizard.py @@ -18,24 +18,6 @@ class ProductPrintWizard(models.TransientModel): default=lambda s: s._default_line_ids(), ) - option_print_code = fields.Boolean( - string="Print product code", - help="Print product code even if there is a barcode", - default=False, - ) - - option_print_barcode = fields.Boolean( - string="Print barcode", - help="Print barcode if it exists", - default=True, - ) - - option_print_barcode_digits = fields.Boolean( - string="Print barcode digits", - help="Print barcode digits if barcode exists", - default=False, - ) - @api.model def _default_line_ids(self): lines_vals = [] @@ -93,12 +75,7 @@ def print_report(self): @api.multi def _prepare_data(self): - return { - "line_data": [x.id for x in self.line_ids], - "option_print_code": self.option_print_code, - "option_print_barcode": self.option_print_barcode, - "option_print_barcode_digits": self.option_print_barcode_digits, - } + return {"line_data": [x.id for x in self.line_ids]} @api.multi def _prepare_product_data(self): diff --git a/product_print_category/wizard/view_product_print_wizard.xml b/product_print_category/wizard/view_product_print_wizard.xml index e58ef68b..6bef3a32 100644 --- a/product_print_category/wizard/view_product_print_wizard.xml +++ b/product_print_category/wizard/view_product_print_wizard.xml @@ -12,15 +12,6 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). product.print.wizard
-
-
🔧 Choose options

-

🖨️ Choose Products to print

🖨️ Choose Products to print
-
From 5f3c47245b2c6063c74c6e3f510d0cc340ac9fc5 Mon Sep 17 00:00:00 2001 From: Sylvain LE GAL Date: Fri, 17 May 2024 15:50:26 +0200 Subject: [PATCH 3/4] [FIX] Do not write to_print value if it didn't changed --- product_print_category/report/report_pricetag.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/product_print_category/report/report_pricetag.py b/product_print_category/report/report_pricetag.py index b8308729..e7341f9f 100644 --- a/product_print_category/report/report_pricetag.py +++ b/product_print_category/report/report_pricetag.py @@ -14,7 +14,9 @@ def _get_report_values(self, docids, data=None): # mark the selected products as Up To Date if print succeed line_obj = self.env["product.print.wizard.line"] lines = line_obj.browse([int(x) for x in data["line_data"]]) - lines.mapped("product_id").write({"to_print": False}) + lines.mapped("product_id").filtered(lambda x: x.to_print).write( + {"to_print": False} + ) return docargs @api.model From 5b03b7c124f2bc9e9dee84155e36a3011c45d6c8 Mon Sep 17 00:00:00 2001 From: Sylvain LE GAL Date: Fri, 17 May 2024 22:36:08 +0200 Subject: [PATCH 4/4] [REV] change category on wizard should change category on product --- product_print_category/wizard/product_print_wizard.py | 5 +++++ product_print_category/wizard/view_product_print_wizard.xml | 3 +++ 2 files changed, 8 insertions(+) diff --git a/product_print_category/wizard/product_print_wizard.py b/product_print_category/wizard/product_print_wizard.py index 0ca7e303..a0cffb21 100644 --- a/product_print_category/wizard/product_print_wizard.py +++ b/product_print_category/wizard/product_print_wizard.py @@ -68,6 +68,11 @@ def _default_line_ids(self): @api.multi def print_report(self): self.ensure_one() + # Apply print category changes, if required + for line in self.line_ids: + if line.product_id.print_category_id != line.print_category_id: + line.product_id.print_category_id = line.print_category_id + data = self._prepare_data() return self.env.ref("product_print_category.pricetag").report_action( self, data=data diff --git a/product_print_category/wizard/view_product_print_wizard.xml b/product_print_category/wizard/view_product_print_wizard.xml index 8c428711..6bef3a32 100644 --- a/product_print_category/wizard/view_product_print_wizard.xml +++ b/product_print_category/wizard/view_product_print_wizard.xml @@ -14,6 +14,9 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

🖨️ Choose Products to print
+