Test if the line's origin is an instance of ModelStorage before accessing the record name
Closes #15072 (grafted from c51729392ebd3af4327e55dd7f1c195163f5b1cf) --HG-- branch : 8.0
This commit is contained in:
1 parent
6d3956ff5f
commit
6ff3f7701f
1 file changed
+3
-3
@@ -18,8 +18,8 @@ from stdnum import iso7064, iso11649
|
||||
from trytond import backend, config
|
||||
from trytond.i18n import gettext
|
||||
from trytond.model import (
|
||||
ChatMixin, DeactivableMixin, Index, MatchMixin, ModelSQL, ModelView,
|
||||
Unique, Workflow, dualmethod, fields, sequence_ordered)
|
||||
ChatMixin, DeactivableMixin, Index, MatchMixin, ModelSQL, ModelStorage,
|
||||
ModelView, Unique, Workflow, dualmethod, fields, sequence_ordered)
|
||||
from trytond.model.exceptions import AccessError
|
||||
from trytond.modules.account.exceptions import AccountMissing
|
||||
from trytond.modules.account.tax import TaxableMixin
|
||||
@@ -2794,7 +2794,7 @@ class InvoiceLine(sequence_ordered(), ModelSQL, ModelView, TaxableMixin):
|
||||
def origin_name(self):
|
||||
if isinstance(self.origin, self.__class__) and self.origin.id >= 0:
|
||||
return self.origin.invoice.rec_name
|
||||
if self.origin and self.origin.id >= 0:
|
||||
if isinstance(self.origin, ModelStorage) and self.origin.id >= 0:
|
||||
return self.origin.rec_name
|
||||
|
||||
@classmethod
|
||||
|
||||
Reference in new issue
Block a user