This commit is contained in:
2026-03-27 08:12:03 +01:00
parent 2bf02e687c
commit f67e5d8ccc
3 changed files with 47 additions and 20 deletions

View File

@@ -1,6 +1,6 @@
from decimal import Decimal
from trytond.pool import PoolMeta
from trytond.pool import Pool, PoolMeta
class Invoice(metaclass=PoolMeta):
@@ -46,6 +46,18 @@ class Invoice(metaclass=PoolMeta):
return lot
return line.lots[0]
def _get_report_freight_fee(self):
pool = Pool()
Fee = pool.get('fee.fee')
shipment = self._get_report_shipment()
if not shipment:
return None
fees = Fee.search([
('shipment_in', '=', shipment.id),
('product.name', '=', 'Maritime freight'),
], limit=1)
return fees[0] if fees else None
def _get_report_shipment(self):
lot = self._get_report_lot()
if not lot:
@@ -316,6 +328,22 @@ class Invoice(metaclass=PoolMeta):
return shipment.number or ''
return ''
@property
def report_freight_amount(self):
fee = self._get_report_freight_fee()
if fee:
return fee.get_amount()
return ''
@property
def report_freight_currency_symbol(self):
fee = self._get_report_freight_fee()
if fee and fee.currency:
return fee.currency.symbol or ''
if self.currency:
return self.currency.symbol or ''
return 'USD'
class InvoiceLine(metaclass=PoolMeta):
__name__ = 'account.invoice.line'