[FIX] pos_sale: prevent crash of modified quotation with settled order
Current behavior: When a quotation is modified and the order is settled in the same time, you get an error when trying to pay for the order. Steps to reproduce: - Create a quotation with 3 lines - Settle the order in the PoS - Modify the quotation (remove one line) - Go back to PoS, and try to pay for the order opw-3614770 closes odoo/odoo#147499 X-original-commit: 7e48111a9678c5acf8188796824f2cb9b4f1af9d Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com> Signed-off-by: Robin Engels (roen) <roen@odoo.com>
This commit is contained in:
@@ -134,5 +134,7 @@ class PosOrderLine(models.Model):
|
||||
if vals.get('sale_order_origin_id', False):
|
||||
vals['sale_order_origin_id'] = vals['sale_order_origin_id']['id']
|
||||
if vals.get('sale_order_line_id', False):
|
||||
vals['sale_order_line_id'] = vals['sale_order_line_id']['id']
|
||||
#We need to make sure the order line has not been deleted while the order was being handled in the PoS
|
||||
order_line = self.env['sale.order.line'].search([('id', '=', vals['sale_order_line_id']['id'])], limit=1)
|
||||
vals['sale_order_line_id'] = order_line.id if order_line else False
|
||||
return result
|
||||
|
||||
Reference in New Issue
Block a user