[FIX] point_of_sale: fix traceback in pos_order studio
Current behavior: If you try to edit the form view of pos.order in studio, you get a traceback. Steps to reproduce: - Install point_of_sale - Go to PoS order - Click on studio - Click on the button to edit the form view - You get a traceback opw-3008565 closes odoo/odoo#103838 X-original-commit: b616cad62a66aaaf8bfc7c79dbafd87174b9a1f6 Signed-off-by: Trinh Jacky (trj) <trj@odoo.com>
This commit is contained in:
@@ -366,6 +366,8 @@ class PosOrder(models.Model):
|
||||
@api.onchange('payment_ids', 'lines')
|
||||
def _onchange_amount_all(self):
|
||||
for order in self:
|
||||
if not order.pricelist_id.currency_id:
|
||||
raise UserError(_("You can't: create a pos order from the backend interface, or unset the pricelist, or create a pos.order in a python test with Form tool, or edit the form view in studio if no PoS order exist"))
|
||||
currency = order.pricelist_id.currency_id
|
||||
order.amount_paid = sum(payment.amount for payment in order.payment_ids)
|
||||
order.amount_return = sum(payment.amount < 0 and payment.amount or 0 for payment in order.payment_ids)
|
||||
|
||||
Reference in New Issue
Block a user