first commit

This commit is contained in:
root
2026-03-14 09:42:12 +00:00
commit 0adbd20c2c
10991 changed files with 1646955 additions and 0 deletions

View File

@@ -0,0 +1,49 @@
# 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.model import fields
from trytond.pool import Pool, PoolMeta
from .common import IncotermMixin
class Invoice(metaclass=PoolMeta):
__name__ = 'account.invoice'
incoterms = fields.Function(fields.Char("Incoterms"), 'get_incoterms')
def get_incoterms(self, name):
return '; '.join(set(filter(None,
(l.incoterm_name for l in self.lines))))
class InvoiceLine(metaclass=PoolMeta):
__name__ = 'account.invoice.line'
@property
def incoterm_name(self):
pool = Pool()
try:
SaleLine = pool.get('sale.line')
except KeyError:
SaleLine = None
try:
PurchaseLine = pool.get('purchase.line')
except KeyError:
PurchaseLine = None
names = {
move.shipment.incoterm_name
for move in self.stock_moves
if (move.state != 'cancelled'
and isinstance(move.shipment, IncotermMixin)
and move.shipment.incoterm_name)}
if not names:
if (SaleLine
and isinstance(self.origin, SaleLine)
and isinstance(self.origin.sale, IncotermMixin)):
names.add(self.origin.sale.incoterm_name)
elif (PurchaseLine
and isinstance(self.origin, PurchaseLine)
and isinstance(self.origin.purchase, IncotermMixin)):
names.add(self.origin.purchase.incoterm_name)
return ', '.join(filter(None, names))