Skip to content

Commit

Permalink
[ADD] l10n_ar_edi_ux: compatibility with module subchange
Browse files Browse the repository at this point in the history
Be able to auto complete the missing required EDI values when the
subchange is automatically created because of the use of financial plan

closes #181

X-original-commit: 1f958a3
Related: ingadhoc/account-payment#350
Signed-off-by: Ignacio Cainelli <ica@adhoc.com.ar>
Signed-off-by: Katherine Zaoral <kz@adhoc.com.ar>
  • Loading branch information
zaoral committed Feb 13, 2023
1 parent 1ddfa4b commit fbb8a0a
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions l10n_ar_edi_ux/wizards/account_payment_group_invoice_wizard.py
Expand Up @@ -27,4 +27,18 @@ def get_invoice_vals(self):
'l10n_ar_afip_asoc_period_end': self.l10n_ar_afip_asoc_period_end,
origin_doc: self.origin_invoice_id
})

# Si estamos creando una ND automatica con el modulo de account_payment_group_financial_surcharge entonces
# seteamos automaticamente los campos l10n_ar_afip_asoc_period_start / l10n_ar_afip_asoc_period_end que son
# necesarios para poder validar la ND electronica automatica. El periodo lo seteamos conforme a la fecha del
# dia que se esta validando el recibo de pago. Fecha Hasta (dicha fecha) Fecha Desde (dicha fecha - 1 mes)
if self.env.context.get('is_automatic_subcharge'):
journal = self.env['account.journal'].browse(invoice_vals.get('journal_id'))
if journal.l10n_ar_afip_ws: # Si soy diario electronico
period_date = fields.Date.context_today(self)
invoice_vals.update({
'l10n_ar_afip_asoc_period_start': fields.Date().subtract(period_date, months=1),
'l10n_ar_afip_asoc_period_end': period_date,
})

return invoice_vals

0 comments on commit fbb8a0a

Please sign in to comment.