Skip to content

Commit

Permalink
[FIX] account_ux: fecha de vencimiento en facturas
Browse files Browse the repository at this point in the history
Ticket: 63079
Si la factura no tiene término de pago y la misma tiene fecha de vencimiento anterior al día de hoy y la factura no tiene fecha entonces cuando se publica la factura, la fecha de vencimiento tiene que coincidir con la fecha de hoy.

closes #421

Signed-off-by: Ignacio Cainelli <ica@adhoc.com.ar>
  • Loading branch information
pablohmontenegro authored and ica-adhoc committed Jul 8, 2023
1 parent 9cfa39d commit 7eb324b
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions account_ux/models/account_move.py
Expand Up @@ -124,11 +124,12 @@ def get_accounting_rate(company_currency, amount, amount_currency, currency):
amount_residual = self.env['account.move.line'].browse(item['id']).amount_residual
item['amount'] = move.currency_id.round(amount_residual * rate)

@api.depends('journal_id', 'statement_line_id')
def _compute_currency_id(self):
""" Si la factura tenía currency_id no queremos cambiarla si cambia el diario """
for invoice in self:
if invoice.currency_id:
continue
else:
super(AccountMove, invoice)._compute_currency_id()
@api.depends('invoice_date')
def _compute_invoice_date_due(self):
""" Si la factura no tiene término de pago y la misma tiene fecha de vencimiento anterior al día de hoy y la factura no tiene fecha entonces cuando se publica la factura, la fecha de vencimiento tiene que coincidir con la fecha de hoy. """
invoices_with_old_data_due = self.filtered(lambda x: x.invoice_date and not x.invoice_payment_term_id and (not x.invoice_date_due or x.invoice_date_due < x.invoice_date))
invoices = self - invoices_with_old_data_due
for inv in invoices_with_old_data_due:
if inv.invoice_date:
inv.invoice_date_due = inv.invoice_date
return super(AccountMove, invoices)._compute_invoice_date_due()

0 comments on commit 7eb324b

Please sign in to comment.