Skip to content

Commit

Permalink
[ADD] l10n_uy_edi: automatic addendum on second page
Browse files Browse the repository at this point in the history
Task: 31632
  • Loading branch information
mem-adhoc committed Aug 25, 2023
1 parent 361f6d8 commit a128a70
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions l10n_uy_edi/models/l10n_uy_cfe.py
Original file line number Diff line number Diff line change
Expand Up @@ -1182,8 +1182,20 @@ def action_l10n_uy_get_pdf(self):
'serieCfe': document_number[0],
'numeroCfe': document_number[1],
}
#En caso de que el cliente quiera imprimir el reporte secundario
report_params = safe_eval.safe_eval(self.company_id.l10n_uy_report_params or '[]')

# En caso de que el contenido de las adendas sea mayor a 799 caracteres, la adenda se imprimira en
# la segunda pagina de forma automatica, caso contrario, el cliente podra elegir el tipo de reporte que quiera
# Si no elige ningun tipo de reporte, se imprimira el default de uruware
records = self.env['l10n.uy.adenda'].sudo().search([('apply_on', '=', 'all') or ('apply_on', '=', 'account.move')])
caract = 0
for rec in records:
caract += len(rec.content)
if caract > 799:
report_params = [['adenda'],['true']]
else:
#En caso de que el cliente quiera imprimir el reporte secundario
report_params = safe_eval.safe_eval(self.company_id.l10n_uy_report_params or '[]')

if report_params:
nombreParametros = report_params[0]
valoresParametros = report_params[1]
Expand Down

0 comments on commit a128a70

Please sign in to comment.