Files
tryton/modules/stock_consignment/account.py
T
Cédric Krier e18d53e99c Test if origin id is greater or equals to 0 before accessing the target record
Closes #13498
(grafted from 497490225779fc8dc210c9cee997cd5ce4b4381e)

--HG--
branch : 7.0
2024-09-09 12:46:16 +02:00

23 lines
725 B
Python

# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
from trytond.pool import Pool, PoolMeta
class InvoiceLine(metaclass=PoolMeta):
__name__ = 'account.invoice.line'
@property
def origin_name(self):
pool = Pool()
Move = pool.get('stock.move')
name = super(InvoiceLine, self).origin_name
if (isinstance(self.origin, Move)
and self.origin.id >= 0
and self.origin.shipment):
name = self.origin.shipment.rec_name
return name
@classmethod
def _get_origin(cls):
return super(InvoiceLine, cls)._get_origin() + ['stock.move']