Protect report attribute getters from null invoices

Invoice will be null for query reports if the invoice is not found
This commit is contained in:
Daniel Möller 2017-06-28 15:06:52 +02:00
parent 679b9b342c
commit 070729ff05
1 changed files with 6 additions and 2 deletions

View File

@ -775,10 +775,14 @@ class SIIReportLine(ModelSQL, ModelView):
'Identifier Type'), 'get_identifier_type')
def get_vat_code(self, name):
return self.invoice.party.vat_code
return (
self.invoice.party.vat_code
if self.invoice and self.invoice.party else None)
def get_identifier_type(self, name):
return self.invoice.party.sii_identifier_type
return (
self.invoice.party.sii_identifier_type
if self.invoice and self.invoice.party else None)
@staticmethod
def default_company():