Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[13.0][IMP] account_payment_order - move date should be bank line date when offsetting_account is bank_account #805

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
5 changes: 5 additions & 0 deletions account_payment_order/models/account_payment_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,7 @@ def generated2uploaded(self):
return True

def _prepare_move(self, bank_lines=None):
move_date = False
if self.payment_type == "outbound":
ref = _("Payment order %s") % self.name
else:
Expand All @@ -424,6 +425,8 @@ def _prepare_move(self, bank_lines=None):
ref += " - " + bank_lines.name
if self.payment_mode_id.offsetting_account == "bank_account":
journal_id = self.journal_id.id
if bank_lines:
move_date = bank_lines[0].date
elif self.payment_mode_id.offsetting_account == "transfer_account":
journal_id = self.payment_mode_id.transfer_journal_id.id
vals = {
Expand All @@ -432,6 +435,8 @@ def _prepare_move(self, bank_lines=None):
"payment_order_id": self.id,
"line_ids": [],
}
if move_date:
vals.update({"date": move_date})
total_company_currency = total_payment_currency = 0
for bline in bank_lines:
total_company_currency += bline.amount_company_currency
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 @@ -146,6 +146,7 @@ def order_creation(self, date_prefered):
order.draft2open()
order.open2generated()
order.generated2uploaded()
self.assertEqual(order.move_ids[0].date, order.bank_line_ids[0].date)
order.action_done()
self.assertEqual(order.state, "done")

Expand Down