File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -13,8 +13,13 @@ def action_paid(self):
1313 self .env ["ir.config_parameter" ].sudo ().get_param ("sale.automatic_invoice" )
1414 )
1515 for order in self .filtered (lambda so : so .state in ("draft" , "sent" )):
16- tx = order .sudo ().transaction_ids ._get_last ()
17- if tx and tx .state == "pending" :
16+ txs = order .sudo ().transaction_ids .filtered (
17+ lambda t : t .state in ("draft" , "pending" )
18+ )
19+ tx = txs ._get_last ()
20+ if not tx :
21+ tx = txs .sorted ()[:1 ]
22+ if tx :
1823 tx ._set_done ()
1924 # Prevent to generate a new payment for marking the invoice as paid.
2025 # This will disable the send_payment_succeeded_for_order_mail,
Original file line number Diff line number Diff line change 1+ from . import test_action_paid
Original file line number Diff line number Diff line change 1111 type =" object"
1212 class =" oe_highlight"
1313 string =" Paid"
14- invisible =" state != ' sent'"
14+ invisible =" state not in ('draft', ' sent') "
1515 />
1616 </button >
1717 </field >
You can’t perform that action at this time.
0 commit comments