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

[IMP] l10n_uy_reports: F2181 show error rejected inv #82

Open
wants to merge 2 commits into
base: 15.0
Choose a base branch
from
Open
Show file tree
Hide file tree
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
5 changes: 3 additions & 2 deletions l10n_uy_edi/models/l10n_uy_cfe.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,8 +333,9 @@ def _l10n_uy_get_cfe_receptor(self):
if receptor_required:
if not self.partner_id.l10n_latam_identification_type_id and not self.partner_id.l10n_latam_identification_type_id.l10n_uy_dgi_code:
raise UserError(_('The partner of the CFE need to have a Uruguayan Identification Type'))
if tipo_doc == 0:
raise UserError(_('Debe indicar un tipo de documento Uruguayo para poder facturar a este cliente'))

if tipo_doc == 0:
raise UserError(_('Debe indicar un tipo de documento Uruguayo para poder facturar a este cliente'))

if cond_e_fact_expo or cond_e_fact or (cond_e_ticket and receptor_required):
if not all([self.partner_id.street, self.partner_id.city, self.partner_id.state_id, self.partner_id.country_id, self.partner_id.vat]):
Expand Down
16 changes: 14 additions & 2 deletions l10n_uy_reports/wizards/form_report_wiz.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,30 @@ def _get_invoices(self):

* Solo debemos tomar en cuenta los cfe que tengan un partner con numero de identificacion, los que no no tenemos
que tomarlos en cuenta ni enviar nada.
* Solo tomar en cuenta los aceptados, el resto no
"""
self.ensure_one()
domain = [
('company_id', '=', self.company_id.id), ('state', '=', 'posted'),
'|', ('l10n_uy_cfe_state', 'in', ['accepted']), ('move_type', 'like', 'in_'),
('date', '>=', self.date_from), ('date', '<', self.date_to),
('partner_id.vat', '!=', False),
('l10n_latam_document_type_id.code', '!=', '0'),
('l10n_latam_document_type_id.code', '!=', False)
]
res = self.env['account.move'].search(domain, order='invoice_date asc, name asc, id asc')

# Solo tomar en cuenta los comprobantes aceptados por DGI, si hay comprobantes que estan en estado posteado en
# Odoo y que estan en estado DGI rechazado o cancelado no debemos informarlos en el formulario, solo debemos
# informar aquellos cuyo estado haya sido aceptado por DGI. Le avisamos al cliente con un warning asi pueda
# revisar y aplicar las acciones necesarias sobre esos comprobantes.
not_accepted = res.filtered(lambda x: x.l10n_uy_cfe_state != 'accepted')
if not_accepted:
raise UserError(_(
'No se puede generar el formulario ya que tiene facturas validadas en Odoo que no estan aceptadas por'
'DGI') + '.\n -' + '\n - '.join(not_accepted.mapped('display_name')))

# TODO KZ pending revision de lado de producto: aca tenemos que ver si tambien tomamos en cuenta o no los
# comprobantes aceptados/rechazados comercialmente por el receptor del documento.

return res

def _search_tax(self, tax_name, tax_type):
Expand Down