Skip to content

Commit a5d3aa1

Browse files
committed
[FIX] account_cashbox: validate session only for draft payments
Restrict cashbox session validation in action_post to payments in the 'draft' state. This prevents a UserError when _compute_state triggers action_post to move an in_process payment to paid after its original session has already been closed. closes #960 Signed-off-by: Filoquin adhoc <maq@adhoc.com.ar>
1 parent 3a4d9da commit a5d3aa1

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

account_cashbox/models/account_payment.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def _create_paired_internal_transfer_payment(self):
5454
super(AccountPayment, self.with_context(paired_transfer=True))._create_paired_internal_transfer_payment()
5555

5656
def action_post(self):
57-
for rec in self:
57+
for rec in self.filtered(lambda x: x.state == "draft"):
5858
if not rec.cashbox_session_id and rec.requiere_account_cashbox_session:
5959
rec._compute_cashbox_session_id()
6060
elif rec.cashbox_session_id and rec.cashbox_session_id.state != "opened":

0 commit comments

Comments
 (0)