From f67e5d8ccce28b6a5d51d358b4c1bd179d6420ad Mon Sep 17 00:00:00 2001 From: laurentbarontini Date: Fri, 27 Mar 2026 08:12:03 +0100 Subject: [PATCH] 27.03.26 --- modules/account_invoice/invoice_ict.fodt | 4 +-- .../account_invoice/invoice_ict_final.fodt | 33 +++++++++---------- modules/purchase_trade/invoice.py | 30 ++++++++++++++++- 3 files changed, 47 insertions(+), 20 deletions(-) diff --git a/modules/account_invoice/invoice_ict.fodt b/modules/account_invoice/invoice_ict.fodt index 0442043..f8b8dc6 100644 --- a/modules/account_invoice/invoice_ict.fodt +++ b/modules/account_invoice/invoice_ict.fodt @@ -4011,7 +4011,7 @@ At <invoice.report_rate_currency_upper><invoice.report_rate_value>PER <invoice.report_rate_unit_upper>(<invoice.report_rate_price_words>) <invoice.report_rate_pricing_text> - FREIGHT VALUE: <invoice.currency.symbol if invoice.currency else 'USD'><format_number(invoice.freight_amount, invoice.party.lang) if hasattr(invoice, 'freight_amount') else ''> + FREIGHT VALUE: <invoice.report_freight_currency_symbol><format_number(invoice.report_freight_amount, invoice.party.lang) if invoice.report_freight_amount != '' else ''> WE CERTIFY THAT THE MERCHANDISE IS OF <invoice.report_origin or ''>ORIGIN L/C NUMBER @@ -4100,4 +4100,4 @@ - \ No newline at end of file + diff --git a/modules/account_invoice/invoice_ict_final.fodt b/modules/account_invoice/invoice_ict_final.fodt index abec9fe..9e0c79d 100644 --- a/modules/account_invoice/invoice_ict_final.fodt +++ b/modules/account_invoice/invoice_ict_final.fodt @@ -5,30 +5,30 @@ Final Invoice willen 2018-12-09T16:20:00 - 2026-03-27T07:47:28.825000000 + 2026-03-27T08:01:16.333000000 2007-08-28T18:19:00 LibreOffice/7.6.0.3$Windows_X86_64 LibreOffice_project/69edd8b8ebc41d00b4de3915dc82f8f0fc3b6265 - PT3H13M1S - 12 + PT3H13M14S + 13 - 8114 + 9437 0 27264 - 13187 + 13242 true false view2 - 10739 - 13841 + 10084 + 16424 0 - 8114 + 9437 27263 - 21299 + 22677 0 0 false @@ -101,7 +101,7 @@ false false false - 663327 + 665618 84510 false false @@ -172,7 +172,7 @@ - + @@ -747,7 +747,7 @@ - + @@ -3930,7 +3930,6 @@ </for> - <invoice.report_incoterm> ALL DETAILS AND SPECIFICATIONS AS PER BENEFICIARY PROFORMA INVOICE NO. <invoice.report_proforma_invoice_number>DATED <format_date(invoice.report_proforma_invoice_date, invoice.party.lang) if invoice.report_proforma_invoice_date else ''>. @@ -4005,16 +4004,16 @@ At <invoice.report_rate_currency_upper><invoice.report_rate_value>PER <invoice.report_rate_unit_upper>(<invoice.report_rate_price_words>) <invoice.report_rate_pricing_text> - - FREIGHT VALUE: <invoice.currency.symbol if invoice.currency else 'USD'><format_number(invoice.freight_amount, invoice.party.lang) if hasattr(invoice, 'freight_amount') else ''> + + FREIGHT VALUE: <invoice.report_freight_currency_symbol><format_number(invoice.report_freight_amount, invoice.party.lang) if invoice.report_freight_amount != '' else ''> WE CERTIFY THAT THE MERCHANDISE IS OF <invoice.report_origin or ''>ORIGIN L/C NUMBER - <format_currency(invoice.total_amount, invoice.party.lang, invoice.currency)> - + <format_currency(invoice.total_amount, invoice.party.lang, invoice.currency)> + diff --git a/modules/purchase_trade/invoice.py b/modules/purchase_trade/invoice.py index 2eb7349..ea11701 100644 --- a/modules/purchase_trade/invoice.py +++ b/modules/purchase_trade/invoice.py @@ -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'