details: https://code.tryton.org/tryton/commit/22868f1f9df6
branch: 7.0
user: Cédric Krier <[email protected]>
date: Tue Jan 27 12:01:42 2026 +0100
description:
Test if origin id is greater or equals to 0 before accessing the target
record name
Closes #13498
(grafted from ca37026b228e56df6ed3455005a6bcd23a5665f0)
diffstat:
modules/account_invoice/invoice.py | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diffs (13 lines):
diff -r 00a2b81b3de5 -r 22868f1f9df6 modules/account_invoice/invoice.py
--- a/modules/account_invoice/invoice.py Mon Jan 19 12:30:41 2026 +0100
+++ b/modules/account_invoice/invoice.py Tue Jan 27 12:01:42 2026 +0100
@@ -2456,7 +2456,8 @@
def origin_name(self):
if isinstance(self.origin, self.__class__) and self.origin.id >= 0:
return self.origin.invoice.rec_name
- return self.origin.rec_name if self.origin else None
+ if self.origin and self.origin.id >= 0:
+ return self.origin.rec_name
@classmethod
def default_taxes_deductible_rate(cls):