Skip to content

Commit

Permalink
Merge PR #1346 into 16.0
Browse files Browse the repository at this point in the history
Signed-off-by pedrobaeza
  • Loading branch information
OCA-git-bot committed Sep 16, 2024
2 parents 58519ad + 7768143 commit f82cd63
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions account_payment_order/models/account_payment.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,15 @@ def _compute_payment_line_date(self):
for item in self:
item.payment_line_date = item.payment_line_ids[:1].date

@api.depends("payment_line_ids")
def _compute_partner_bank_id(self):
# Force the payment line bank account. The grouping function has already
# assured that there's no more than one bank account in the group
order_pays = self.filtered("payment_line_ids")
for pay in order_pays:
pay.partner_bank_id = pay.payment_line_ids.partner_bank_id
return super(AccountPayment, self - order_pays)._compute_partner_bank_id()

@api.constrains("payment_method_line_id")
def _check_payment_method_line_id(self):
for pay in self:
Expand Down
1 change: 1 addition & 0 deletions account_payment_order/tests/test_payment_order_outbound.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ def order_creation(self, date_prefered):
order.payment_line_ids.partner_bank_id.action_unarchive()
self.assertFalse(order.partner_banks_archive_msg)
order.draft2open()
self.assertEqual(order.payment_ids[0].partner_bank_id, self.partner.bank_ids)
order.open2generated()
order.generated2uploaded()
self.assertEqual(order.move_ids[0].date, order.payment_ids[0].date)
Expand Down

0 comments on commit f82cd63

Please sign in to comment.