Skip to content

Commit

Permalink
Merge pull request #323 from EstebanMonge/15.0
Browse files Browse the repository at this point in the history
15.0
  • Loading branch information
EstebanMonge authored Oct 26, 2022
2 parents 930c93c + ec81f1e commit fe19071
Showing 1 changed file with 29 additions and 4 deletions.
33 changes: 29 additions & 4 deletions cr_electronic_invoice/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,7 @@ def load_xml_data(self):
def get_invoice_sequence(self):
tipo_documento = self.tipo_documento
sequence = False
no_sequence_message = "This journal doesn't have the sequence configure for documents of type: " + tipo_documento + ". Please consider to configure the sequence and reset the invoice to draft."

if self.move_type == 'out_invoice':
# tipo de identificación
Expand All @@ -435,13 +436,37 @@ def get_invoice_sequence(self):
tipo_documento = 'TE'
self.tipo_documento = 'TE'
if tipo_documento == 'FE':
sequence = self.journal_id.FE_sequence_id.next_by_id()
if self.journal_id.FE_sequence_id:
sequence = self.journal_id.FE_sequence_id.next_by_id()
else:
self.state_tributacion = "na"
self.message_post(
subject=_('Warning'),
body=no_sequence_message)
elif tipo_documento == 'TE':
sequence = self.journal_id.TE_sequence_id.next_by_id()
if self.journal_id.TE_sequence_id:
sequence = self.journal_id.TE_sequence_id.next_by_id()
else:
self.state_tributacion = "na"
self.message_post(
subject=_('Warning'),
body=no_sequence_message)
elif tipo_documento == 'ND':
sequence = self.journal_id.ND_sequence_id.next_by_id()
if self.journal_id.ND_sequence_id:
sequence = self.journal_id.ND_sequence_id.next_by_id()
else:
self.state_tributacion = "na"
self.message_post(
subject=_('Warning'),
body=no_sequence_message)
elif tipo_documento == 'FEE':
sequence = self.journal_id.FEE_sequence_id.next_by_id()
if self.journal_id.FEE_sequence_id:
sequence = self.journal_id.FEE_sequence_id.next_by_id()
else:
self.state_tributacion = "na"
self.message_post(
subject=_('Warning'),
body=no_sequence_message)
else:
raise UserError('Tipo documento "%s" es inválido para una factura', tipo_documento)

Expand Down

0 comments on commit fe19071

Please sign in to comment.