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

[ADD] l10n_uy_edi: automatic addendum on second page #138

Open
wants to merge 1 commit into
base: 16.0
Choose a base branch
from
Open
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
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