Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -45,6 +45,15 @@
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")

Check warning on line 52 in account_payment_order/models/account_payment.py

View check run for this annotation

Codecov / codecov/patch

account_payment_order/models/account_payment.py#L52

Added line #L52 was not covered by tests
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()

Check warning on line 55 in account_payment_order/models/account_payment.py

View check run for this annotation

Codecov / codecov/patch

account_payment_order/models/account_payment.py#L54-L55

Added lines #L54 - L55 were not covered by tests

def update_payment_reference(self):
view = self.env.ref("account_payment_order.account_payment_update_view_form")
return {
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 @@ -203,6 +203,7 @@ def order_creation(self, date_prefered):
line_created_due.create_payment_lines()
self.assertGreater(len(order.payment_line_ids), 0)
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
Loading