Skip to content
Extraits de code Groupes Projets
Valider 847293b0 rédigé par Benjamin - Le Filament's avatar Benjamin - Le Filament
Parcourir les fichiers

[update] add field for blocking update + track visibility on prices

parent a466fd6e
Branches
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -11,6 +11,7 @@
"depends": ["purchase"],
"data": [
"security/ir.model.access.csv",
"views/product_product.xml",
"views/product_product_update_log.xml",
"wizard/import_provider_product_wizard.xml",
],
......
# Copyright 2022 Le Filament (<http://www.le-filament.com>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import product_product
from . import product_product_update_log
# Copyright 2021 Le Filament (<http://www.le-filament.com>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import fields, models
class ProductProduct(models.Model):
_inherit = "product.product"
lst_price = fields.Float(track_visibility="always")
standard_price = fields.Float(track_visibility="always")
is_updated_price = fields.Boolean("Bloquer la mise à jour", default=False)
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<data>
<!-- Form View -->
<record id="product_normal_form_view_inherited" model="ir.ui.view">
<field name="name">product.product.inherited.form</field>
<field name="model">product.product</field>
<field name="inherit_id" ref="product.product_normal_form_view" />
<field name="arch" type="xml">
<xpath expr="//field[@name='company_id']" position="before">
<field name="is_updated_price" widget="boolean_toggle" />
</xpath>
</field>
</record>
<!-- Tree View -->
<record id="product_normal_tree_view_inherited" model="ir.ui.view">
<field name="name">product.product.inherited.tree</field>
<field name="model">product.product</field>
<field name="inherit_id" ref="product.product_product_tree_view" />
<field name="arch" type="xml">
<xpath expr="//field[@name='barcode']" position="before">
<field name="is_updated_price" widget="boolean_toggle" />
</xpath>
</field>
</record>
</data>
</odoo>
......@@ -92,7 +92,7 @@ class ImportProviderProductWizard(models.TransientModel):
)
if len(product) > 1:
log["same_code"] += 1
elif product:
elif product and not product.is_updated_price:
values = {}
for column in column_field[1:]:
if row[column[1] - 1]:
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter