From f33369d0fc94be109fd6d72e4127ca7c5524eaf8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20-=20Le=20Filament?= <remi@le-filament.com> Date: Tue, 15 Apr 2025 11:31:51 +0200 Subject: [PATCH] [ADD] order on margin on products --- README.md | 2 ++ __manifest__.py | 2 +- models/product_template.py | 8 ++++++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index ca0a7bc..fad77ec 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ ## Description - rend configurable par produit la possibilité d'éditer le prix depuis un devis +- stocke les champs ajoutés par le module product_standard_margin (pour pouvoir ordonner +les listes sur ces champs) ## Exemple diff --git a/__manifest__.py b/__manifest__.py index 03def7a..f0d1d6c 100644 --- a/__manifest__.py +++ b/__manifest__.py @@ -5,7 +5,7 @@ "website": "https://le-filament.com", "version": "16.0.1.0.0", "license": "AGPL-3", - "depends": ["sale_margin", "product"], + "depends": ["sale_margin", "product_standard_margin"], "data": [ # views "views/sale_order_view.xml", diff --git a/models/product_template.py b/models/product_template.py index eef7801..cae048f 100644 --- a/models/product_template.py +++ b/models/product_template.py @@ -3,8 +3,6 @@ from odoo import fields, models -# modify product to add a boolean to allow price to be modified - class ProductTemplate(models.Model): _inherit = "product.template" @@ -17,6 +15,12 @@ class ProductTemplate(models.Model): "Le prix d'achat peut être édité depuis un devis.", default=False ) + # Change computed margin fields to stored + list_price_vat_excl = fields.Float(store=True) + standard_margin = fields.Float(store=True) + standard_margin_rate = fields.Float(store=True) + standard_markup_rate = fields.Float(store=True) + # ------------------------------------------------------ # SQL Constraints # ------------------------------------------------------ -- GitLab