[FIX] delivery: discount pricelist bug

If user created pricelist which applied discount on fixed prize delivery
and set the discount visibilty to be shown in sale order, the discount
would be applied twice. Due to stable version limitation, the visibility
of discount on sale order for pricelist discount for delivery is removed.

opw-3517879

closes odoo/odoo#154663

X-original-commit: f96ce5102aea5651710bb5bf50903b1c1d4f101e
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
Signed-off-by: anko-odoo <anko@odoo.com>
This commit is contained in:
Anita (anko)
2024-02-20 10:22:14 +00:00
parent 964ea6a821
commit 9fb2d415e8
2 changed files with 6 additions and 0 deletions
@@ -46,3 +46,8 @@ class SaleOrderLine(models.Model):
undeletable_lines = super()._check_line_unlink()
return undeletable_lines.filtered(lambda line: not line.is_delivery)
def _compute_pricelist_item_id(self):
delivery_lines = self.filtered('is_delivery')
super(SaleOrderLine, self - delivery_lines)._compute_pricelist_item_id()
delivery_lines.pricelist_item_id = False
@@ -168,6 +168,7 @@ class TestDeliveryCost(common.TransactionCase):
'applied_on': '0_product_variant',
'product_id': self.normal_delivery.product_id.id,
})],
'discount_policy': 'without_discount',
})
# Create sales order with Normal Delivery Charges