Skip to content

Commit

Permalink
[FIX] delivery_auto_refresh: avoid singleton
Browse files Browse the repository at this point in the history
If there were more than one delivery line, we'd get a singleton error
when trying to refresh due to the need of taking the discount of the
former lines.

TT35025
  • Loading branch information
chienandalu committed Mar 10, 2022
1 parent 401c5c6 commit 50ced50
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion delivery_auto_refresh/models/sale_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def write(self, vals):
for order in self:
delivery_line = order.order_line.filtered("is_delivery")
order.with_context(
delivery_discount=delivery_line.discount,
delivery_discount=delivery_line[-1:].discount,
)._auto_refresh_delivery()
return res

Expand Down

0 comments on commit 50ced50

Please sign in to comment.