[FIX] sale: update_prices logic

The field show_update_pricelist, readonly, is not provided
to the server by the webclient, and therefore not updated on
new sale orders.

This fixes this problem and also reduces the recomputation by removing
the useless dependency on 'order_line' field.  The compute should
only be triggered on 'pricelist_id' field updates.

closes odoo/odoo#84105

X-original-commit: 365df4b1ed08f553397eab9619d369867162ed89
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
This commit is contained in:
Victor Feyens
2022-02-07 17:16:02 +00:00
parent cf0d1eb80a
commit 64101c8d15
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -551,7 +551,7 @@ class SaleOrder(models.Model):
}
}
@api.depends('pricelist_id', 'order_line')
@api.depends('pricelist_id')
def _compute_show_update_pricelist(self):
for order in self:
order.show_update_pricelist = order.order_line and order.pricelist_id and order._origin.pricelist_id != self.pricelist_id
+1 -1
View File
@@ -257,7 +257,7 @@
<label for="date_order" string="Order Date"/>
</div>
<field name="date_order" attrs="{'required': [('state', 'in', ['sale', 'done'])], 'invisible': [('state', 'in', ['draft', 'sent'])]}" nolabel="1"/>
<field name="show_update_pricelist" invisible="1"/>
<field name="show_update_pricelist" invisible="1" force_save="1"/>
<label for="pricelist_id" groups="product.group_product_pricelist"/>
<div groups="product.group_product_pricelist" class="o_row">
<field name="pricelist_id" options="{'no_open':True,'no_create': True}"/>