Skip to content

Commit

Permalink
[FIX] fill date instead off maturity date on account move line generated
Browse files Browse the repository at this point in the history
  • Loading branch information
vrenaville authored and gfcapalbo committed Jan 17, 2023
1 parent d656497 commit beeb619
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions account_payment_order/models/account_payment_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,11 +351,16 @@ def _prepare_move(self, bank_lines=None):
def _prepare_move_line_offsetting_account(
self, amount_company_currency, amount_payment_currency,
bank_lines):
vals = {}
if self.payment_type == 'outbound':
name = _('Payment order %s') % self.name
else:
name = _('Debit order %s') % self.name
date_maturity = bank_lines[0].date
if self.payment_mode_id.offsetting_account == 'bank_account':
vals.update({'date': bank_lines[0].date})
else:
vals.update({'date_maturity': bank_lines[0].date})

if self.payment_mode_id.offsetting_account == 'bank_account':
account_id = self.journal_id.default_debit_account_id.id
elif self.payment_mode_id.offsetting_account == 'transfer_account':
Expand All @@ -368,16 +373,15 @@ def _prepare_move_line_offsetting_account(
# we have different partners in the grouped move
partner_id = False
break
vals = {
vals.update({
'name': name,
'partner_id': partner_id,
'account_id': account_id,
'credit': (self.payment_type == 'outbound' and
amount_company_currency or 0.0),
'debit': (self.payment_type == 'inbound' and
amount_company_currency or 0.0),
'date_maturity': date_maturity,
}
})
if bank_lines[0].currency_id != bank_lines[0].company_currency_id:
sign = self.payment_type == 'outbound' and -1 or 1
vals.update({
Expand Down Expand Up @@ -412,6 +416,7 @@ def _prepare_move_line_partner_account(self, bank_line):
'debit': (self.payment_type == 'outbound' and
bank_line.amount_company_currency or 0.0),
}

if bank_line.currency_id != bank_line.company_currency_id:
sign = self.payment_type == 'inbound' and -1 or 1
vals.update({
Expand Down

0 comments on commit beeb619

Please sign in to comment.