From 8eb5c53e45bae4926dd49d670a62c6d913ab4e49 Mon Sep 17 00:00:00 2001 From: Julien Ortet <julien@le-filament.com> Date: Wed, 7 Aug 2024 10:23:57 +0200 Subject: [PATCH] [UPD] add mulch multiplier --- models/product_category.py | 4 ---- models/product_template.py | 3 ++- views/product_template_views.xml | 9 +++------ 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/models/product_category.py b/models/product_category.py index 28593e3..c2330f9 100644 --- a/models/product_category.py +++ b/models/product_category.py @@ -12,10 +12,6 @@ class ProductCategory(models.Model): # ------------------------------------------------------ symbol = fields.Char("Symbole") accessory_label = fields.Char("Nom de l'accessoire associƩ") - mulch_quantity_multiplier = fields.Integer( - "Multiplicateur paillage", - default=1 - ) # ------------------------------------------------------ # SQL Constraints diff --git a/models/product_template.py b/models/product_template.py index d991d84..b67b60f 100644 --- a/models/product_template.py +++ b/models/product_template.py @@ -14,7 +14,8 @@ class ProductTemplate(models.Model): related="categ_id.accessory_label", readonly=True ) mulch_quantity_multiplier = fields.Integer( - related="categ_id.mulch_quantity_multiplier", readonly=True + "Multiplicateur paillage", + default=1 ) # ------------------------------------------------------ diff --git a/views/product_template_views.xml b/views/product_template_views.xml index 104603e..31b5080 100644 --- a/views/product_template_views.xml +++ b/views/product_template_views.xml @@ -10,12 +10,6 @@ <field name="symbol" /> <field name="accessory_label" /> <field name="name" /> - - <t t-if="record.name == 'Paillage'"> - <div> - <field name="mulch_quantity_multiplier" /> - </div> - </t> </field> </field> </record> @@ -48,6 +42,9 @@ </tbody> </table> </xpath> + <field name="categ_id" position="after"> + <field name="mulch_quantity_multiplier" attrs="{'invisible': [('categ_id', '!=', %(product_category_mulch)d)]}"/> + </field> </field> </record> -- GitLab