manage exception on sending invoices and show message
This commit is contained in:
parent
76b3cbaf8b
commit
85d9c361bc
42
aeat.py
42
aeat.py
|
@ -472,9 +472,12 @@ class SIIReport(Workflow, ModelSQL, ModelView):
|
|||
with self.company.tmp_ssl_credentials() as (crt, key):
|
||||
srv = service.bind_issued_invoices_service(
|
||||
crt, key, test=SII_TEST)
|
||||
res = srv.submit(
|
||||
headers, (line.invoice for line in self.lines),
|
||||
mapper=mapper)
|
||||
try:
|
||||
res = srv.submit(
|
||||
headers, (line.invoice for line in self.lines),
|
||||
mapper=mapper)
|
||||
except Exception as e:
|
||||
self.raise_user_error(str(e))
|
||||
|
||||
self._save_response(res)
|
||||
|
||||
|
@ -491,9 +494,12 @@ class SIIReport(Workflow, ModelSQL, ModelView):
|
|||
with self.company.tmp_ssl_credentials() as (crt, key):
|
||||
srv = service.bind_issued_invoices_service(
|
||||
crt, key, test=SII_TEST)
|
||||
res = srv.cancel(
|
||||
headers, (line.invoice for line in self.lines),
|
||||
mapper=mapper)
|
||||
try:
|
||||
res = srv.cancel(
|
||||
headers, (line.invoice for line in self.lines),
|
||||
mapper=mapper)
|
||||
except Exception as e:
|
||||
self.raise_user_error(str(e))
|
||||
|
||||
self._save_response(res)
|
||||
|
||||
|
@ -590,9 +596,12 @@ class SIIReport(Workflow, ModelSQL, ModelView):
|
|||
with self.company.tmp_ssl_credentials() as (crt, key):
|
||||
srv = service.bind_recieved_invoices_service(
|
||||
crt, key, test=SII_TEST)
|
||||
res = srv.submit(
|
||||
headers, (line.invoice for line in self.lines),
|
||||
mapper=mapper)
|
||||
try:
|
||||
res = srv.submit(
|
||||
headers, (line.invoice for line in self.lines),
|
||||
mapper=mapper)
|
||||
except Exception as e:
|
||||
self.raise_user_error(str(e))
|
||||
|
||||
self._save_response(res)
|
||||
|
||||
|
@ -609,9 +618,12 @@ class SIIReport(Workflow, ModelSQL, ModelView):
|
|||
with self.company.tmp_ssl_credentials() as (crt, key):
|
||||
srv = service.bind_recieved_invoices_service(
|
||||
crt, key, test=SII_TEST)
|
||||
res = srv.cancel(
|
||||
headers, (line.invoice for line in self.lines),
|
||||
mapper=mapper)
|
||||
try:
|
||||
res = srv.cancel(
|
||||
headers, (line.invoice for line in self.lines),
|
||||
mapper=mapper)
|
||||
except Exception as e:
|
||||
self.raise_user_error(str(e))
|
||||
|
||||
self._save_response(res)
|
||||
|
||||
|
@ -745,6 +757,12 @@ class SIIReportLine(ModelSQL, ModelView):
|
|||
identifier_type = fields.Function(
|
||||
fields.Selection(PARTY_IDENTIFIER_TYPE,
|
||||
'Identifier Type'), 'get_identifier_type')
|
||||
invoice_operation_key = fields.Function(
|
||||
fields.Selection(OPERATION_KEY, 'SII Operation Key'),
|
||||
'get_invoice_operation_key')
|
||||
|
||||
def get_invoice_operation_key(self, name):
|
||||
return self.invoice.sii_operation_key
|
||||
|
||||
def get_vat_code(self, name):
|
||||
return self.invoice.party.vat_code
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
<tree string="AEAT SII Issued Lines">
|
||||
<field name="report"/>
|
||||
<field name="invoice"/>
|
||||
<field name="invoice_operation_key"/>
|
||||
<field name="vat_code"/>
|
||||
<field name="identifier_type"/>
|
||||
<field name="state"/>
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
<tree string="AEAT SII Issued Lines" editable="bottom">
|
||||
<field name="report"/>
|
||||
<field name="invoice"/>
|
||||
<field name="invoice_operation_key"/>
|
||||
<field name="vat_code"/>
|
||||
<field name="identifier_type"/>
|
||||
<field name="state"/>
|
||||
|
|
Loading…
Reference in New Issue