[FIX] sale_management: lines reset on template change

The removal of existing order lines on template update was unexpectedly
lost in recent code changes.

This commit brings back the old expected behavior.

closes odoo/odoo#82868

Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
This commit is contained in:
Victor Feyens
2022-01-17 12:17:24 +00:00
parent a4d5999471
commit 515362a044
+4 -1
View File
@@ -87,13 +87,16 @@ class SaleOrder(models.Model):
def _onchange_sale_order_template_id(self):
sale_order_template = self.sale_order_template_id.with_context(lang=self.partner_id.lang)
self.order_line = [
order_lines_data = [fields.Command.clear()]
order_lines_data += [
fields.Command.create(
self._compute_line_data_for_template_change(line)
)
for line in sale_order_template.sale_order_template_line_ids
]
self.order_line = order_lines_data
option_lines_data = [fields.Command.clear()]
option_lines_data += [
fields.Command.create(