product_sale_price_from_pricelist: don't update list_price when last_purchase_price_compute_type == manual_update. Add fields to tree product view

This commit is contained in:
Luis 2025-11-28 09:46:37 +01:00
parent 969cc9e9f5
commit 7df39dbda8
2 changed files with 15 additions and 2 deletions

View file

@ -115,6 +115,7 @@ class ProductTemplate(models.Model):
def action_update_list_price(self): def action_update_list_price(self):
for template in self: for template in self:
if template.last_purchase_price_compute_type != "manual_update":
template.list_price = template.list_price_theoritical template.list_price = template.list_price_theoritical
template.last_purchase_price_updated = False template.last_purchase_price_updated = False

View file

@ -28,6 +28,18 @@
</field> </field>
</record> </record>
<record id="product_view_inherit_tree_price_auto" model="ir.ui.view">
<field name="name">product.template.tree.price.automatic</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_tree_view"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='list_price']" position="after">
<field name="list_price_theoritical" optional="hide"/>
<field name="last_purchase_price_received" optional="hide"/>
</xpath>
</field>
</record>
<record id="res_config_settings_view_form_pricelists" model="ir.ui.view"> <record id="res_config_settings_view_form_pricelists" model="ir.ui.view">
<field name="name">product.print.supermarket.res.config.settings.form</field> <field name="name">product.print.supermarket.res.config.settings.form</field>
<field name="model">res.config.settings</field> <field name="model">res.config.settings</field>