minor fix

This commit is contained in:
Wilson Gomez 2023-12-06 10:44:34 -05:00
parent b8f6e099ce
commit edf5e069f2
1 changed files with 18 additions and 18 deletions

View File

@ -515,24 +515,24 @@ class Order(Workflow, ModelSQL, ModelView):
def process_invoice(self, invoice):
Invoice = Pool().get('account.invoice')
if invoice.state == 'draft':
Invoice.validate_invoice([invoice])
if invoice.state == 'validated':
try:
if invoice.electronic_state != 'authorized':
Invoice.submit([invoice])
invoice.save()
except Exception as e:
print('WARNING: Invoice dont sending to DIAN', e)
try:
if invoice.invoice_type == 'P' or (
invoice.electronic_state in ('authorized', 'accepted')
and invoice.state == 'validated'):
Invoice.post([invoice])
except Exception as e:
print('WARNING: invoice dont posted to DIAN', e)
Invoice.process_invoice([invoice])
print('Processed invoice...', invoice.number, invoice.electronic_state)
self.save()
# if invoice.state == 'draft':
# Invoice.validate_invoice([invoice])
# if invoice.state == 'validated':
# try:
# if invoice.electronic_state != 'authorized':
# Invoice.submit([invoice])
# except Exception as e:
# print('WARNING: Invoice dont sending to DIAN', e)
# try:
# if invoice.invoice_type == 'P' or (
# invoice.electronic_state in ('authorized', 'accepted')
# and invoice.state == 'validated'):
# Invoice.post([invoice])
# except Exception as e:
# print('WARNING: invoice dont posted to DIAN', e)
# self.save()
def set_number(self):
pool = Pool()
@ -568,7 +568,7 @@ class Order(Workflow, ModelSQL, ModelView):
payment_term = self.payment_term.id
_line = self.get_line_order(type='copago_product')
_lines.append(_line)
operation_type = 'SS-RECAUDO'
operation_type = '10'
else:
operation_type = '10'
party = self.customer