diff --git a/modules/account_invoice/invoice_ict.fodt b/modules/account_invoice/invoice_ict.fodt
index 3b0fbf7..eb3c297 100644
--- a/modules/account_invoice/invoice_ict.fodt
+++ b/modules/account_invoice/invoice_ict.fodt
@@ -4,17 +4,17 @@
Provisional Invoice
willen
- 2018-12-09T16:20:00
- 2026-03-26T20:52:14.851000000
- 2007-08-28T18:19:00
- LibreOffice/7.6.0.3$Windows_X86_64 LibreOffice_project/69edd8b8ebc41d00b4de3915dc82f8f0fc3b6265
- PT3H14M56S
- 6
-
+
+
+ LibreOffice/7.6.0.3$Windows_X86_64 LibreOffice_project/69edd8b8ebc41d00b4de3915dc82f8f0fc3b6265
+ PT3H15M31S
+ 7
+
+ 2026-03-27T07:14:46.578000000
- 16316
+ 7673
0
27264
13187
@@ -23,12 +23,12 @@
view2
- 18336
- 21340
+ 14314
+ 13411
0
- 16316
+ 7673
27263
- 29501
+ 20858
0
0
false
@@ -101,11 +101,11 @@
false
false
false
- 215514
+ 233971
84510
false
false
- false
+ true
true
true
false
@@ -114,7 +114,7 @@
false
true
true
- false
+ true
false
false
false
@@ -131,6 +131,7 @@
0
false
true
+ true
false
false
0
@@ -172,7 +173,7 @@
-
+
@@ -277,6 +278,23 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -300,6 +318,7 @@
+
@@ -396,6 +415,9 @@
+
+
+
@@ -733,10 +755,14 @@
-
+
+
+
+
+
-
+
@@ -764,7 +790,7 @@
-
+
@@ -3903,7 +3929,7 @@
QUANTITY: <format_number(invoice.report_lbs, invoice.party.lang) if invoice.report_lbs != '' else ''>LBS (<format_number(invoice.report_net, invoice.party.lang) if invoice.report_net != '' else ''> MTS)
<invoice.report_description_upper or invoice.report_product_description>CROP <invoice.report_crop_name>
<invoice.report_attributes_name>
-
+ 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>
<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 ''>.
@@ -3977,7 +4003,7 @@
- At <format_currency(invoice.lines[0].unit_price, invoice.party.lang, invoice.currency, digits=invoice.lines[0].__class__.unit_price.digits[1]) if invoice.lines else ''>PER LB
+ 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 ''>
@@ -3995,6 +4021,7 @@
+
NET LANDED WEIGHTS, ACTUAL TARE, NO FRANCHISE
@@ -4005,7 +4032,7 @@
<for each="tax in invoice.taxes">
V.A.T. <tax.description or ''>RATE
- </for>
+ </for>
@@ -4068,4 +4095,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 50ad70f..bf33374 100644
--- a/modules/account_invoice/invoice_ict_final.fodt
+++ b/modules/account_invoice/invoice_ict_final.fodt
@@ -5,16 +5,16 @@
Final Invoice
willen
2018-12-09T16:20:00
- 2026-03-26T21:00:24.650000000
+ 2026-03-27T07:13:52.204000000
2007-08-28T18:19:00
LibreOffice/7.6.0.3$Windows_X86_64 LibreOffice_project/69edd8b8ebc41d00b4de3915dc82f8f0fc3b6265
- PT3H10M43S
- 9
+ PT3H11M47S
+ 10
-
+
- 5292
+ 8378
0
27264
13187
@@ -23,12 +23,12 @@
view2
- 10084
- 8031
+ 14314
+ 15132
0
- 5292
+ 8378
27263
- 18477
+ 21564
0
0
false
@@ -101,7 +101,7 @@
false
false
false
- 567430
+ 577515
84510
false
false
@@ -172,7 +172,7 @@
-
+
@@ -741,10 +741,18 @@
-
+
+
+
+
+
+
+
+
+
-
+
@@ -3917,6 +3925,7 @@
<line.report_product_description or line.product_name or ''>CROP <line.report_crop_name>
<line.report_attributes_name>
</if>
+ At <line.report_rate_currency_upper><line.report_rate_value>PER <line.report_rate_unit_upper>(<line.report_rate_price_words>) <line.report_rate_pricing_text>
</for>
<invoice.report_incoterm>
ALL DETAILS AND SPECIFICATIONS AS PER BENEFICIARY
@@ -3991,11 +4000,11 @@
- At <format_currency(invoice.lines[0].unit_price, invoice.party.lang, invoice.currency, digits=invoice.lines[0].__class__.unit_price.digits[1]) if invoice.lines else ''>PER LB
+ 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.currency.symbol if invoice.currency else 'USD'><format_number(invoice.freight_amount, invoice.party.lang) if hasattr(invoice, 'freight_amount') else ''>
- WE CERTIFY THAT THE MERCHANDISE IS OF <invoice.report_origin or ''>ORIGIN
+ WE CERTIFY THAT THE MERCHANDISE IS OF <invoice.report_origin or ''>ORIGIN
L/C NUMBER <invoice.reference or ''>
diff --git a/modules/purchase_trade/invoice.py b/modules/purchase_trade/invoice.py
index 63471f8..2eb7349 100644
--- a/modules/purchase_trade/invoice.py
+++ b/modules/purchase_trade/invoice.py
@@ -6,6 +6,12 @@ from trytond.pool import PoolMeta
class Invoice(metaclass=PoolMeta):
__name__ = 'account.invoice'
+ def _get_report_invoice_line(self):
+ for line in self.lines or []:
+ if getattr(line, 'type', None) == 'line':
+ return line
+ return self.lines[0] if self.lines else None
+
def _get_report_purchase(self):
purchases = list(self.purchases or [])
return purchases[0] if purchases else None
@@ -128,6 +134,41 @@ class Invoice(metaclass=PoolMeta):
return trade.report_price
return ''
+ @property
+ def report_rate_currency_upper(self):
+ line = self._get_report_invoice_line()
+ if line:
+ return line.report_rate_currency_upper
+ return ''
+
+ @property
+ def report_rate_value(self):
+ line = self._get_report_invoice_line()
+ if line:
+ return line.report_rate_value
+ return ''
+
+ @property
+ def report_rate_unit_upper(self):
+ line = self._get_report_invoice_line()
+ if line:
+ return line.report_rate_unit_upper
+ return ''
+
+ @property
+ def report_rate_price_words(self):
+ line = self._get_report_invoice_line()
+ if line:
+ return line.report_rate_price_words
+ return self.report_price or ''
+
+ @property
+ def report_rate_pricing_text(self):
+ line = self._get_report_invoice_line()
+ if line:
+ return line.report_rate_pricing_text
+ return ''
+
@property
def report_payment_date(self):
trade = self._get_report_trade()
@@ -165,7 +206,7 @@ class Invoice(metaclass=PoolMeta):
line = self._get_report_trade_line()
if line and line.lots:
return sum(
- lot.get_current_gross_quantity_converted()
+ lot.get_current_gross_quantity()
for lot in line.lots if lot.lot_type == 'physic'
)
return ''
@@ -178,7 +219,7 @@ class Invoice(metaclass=PoolMeta):
line = self._get_report_trade_line()
if line and line.lots:
return sum(
- lot.get_current_quantity_converted()
+ lot.get_current_quantity()
for lot in line.lots if lot.lot_type == 'physic'
)
if self.lines:
@@ -190,7 +231,7 @@ class Invoice(metaclass=PoolMeta):
net = self.report_net
if net == '':
return ''
- return Decimal(net) * Decimal('2.20462')
+ return round(Decimal(net) * Decimal('2204.62'),2)
@property
def report_bl_date(self):
@@ -285,6 +326,9 @@ class InvoiceLine(metaclass=PoolMeta):
return None
return getattr(origin, 'sale', None) or getattr(origin, 'purchase', None)
+ def _get_report_trade_line(self):
+ return getattr(self, 'origin', None)
+
@property
def report_product_description(self):
if self.product:
@@ -298,6 +342,38 @@ class InvoiceLine(metaclass=PoolMeta):
def report_description_upper(self):
return (self.description or '').upper()
+ @property
+ def report_rate_currency_upper(self):
+ origin = self._get_report_trade_line()
+ currency = getattr(origin, 'linked_currency', None) or self.currency
+ if currency and currency.rec_name:
+ return currency.rec_name.upper()
+ return ''
+
+ @property
+ def report_rate_value(self):
+ return self.unit_price if self.unit_price is not None else ''
+
+ @property
+ def report_rate_unit_upper(self):
+ origin = self._get_report_trade_line()
+ unit = getattr(origin, 'linked_unit', None) or self.unit
+ if unit and unit.rec_name:
+ return unit.rec_name.upper()
+ return ''
+
+ @property
+ def report_rate_price_words(self):
+ trade = self._get_report_trade()
+ if trade and getattr(trade, 'report_price', None):
+ return trade.report_price
+ return ''
+
+ @property
+ def report_rate_pricing_text(self):
+ origin = self._get_report_trade_line()
+ return getattr(origin, 'get_pricing_text', '') or ''
+
@property
def report_crop_name(self):
trade = self._get_report_trade()
diff --git a/modules/purchase_trade/sale.py b/modules/purchase_trade/sale.py
index 7877f9c..f479236 100755
--- a/modules/purchase_trade/sale.py
+++ b/modules/purchase_trade/sale.py
@@ -214,19 +214,19 @@ class Lot(metaclass=PoolMeta):
if self.sale_line:
return self.sale_line.sale.id
-class Sale(metaclass=PoolMeta):
- __name__ = 'sale.sale'
-
- btb = fields.Many2One('back.to.back',"Back to back")
- bank_accounts = fields.Function(
- fields.Many2Many('bank.account', None, None, "Bank Accounts"),
- 'on_change_with_bank_accounts')
- bank_account = fields.Many2One(
- 'bank.account', "Bank Account",
- domain=[('id', 'in', Eval('bank_accounts', []))],
- depends=['bank_accounts'])
- from_location = fields.Many2One('stock.location', 'From location', required=True,domain=[('type', "!=", 'customer')])
- to_location = fields.Many2One('stock.location', 'To location', required=True,domain=[('type', "!=", 'supplier')])
+class Sale(metaclass=PoolMeta):
+ __name__ = 'sale.sale'
+
+ btb = fields.Many2One('back.to.back',"Back to back")
+ bank_accounts = fields.Function(
+ fields.Many2Many('bank.account', None, None, "Bank Accounts"),
+ 'on_change_with_bank_accounts')
+ bank_account = fields.Many2One(
+ 'bank.account', "Bank Account",
+ domain=[('id', 'in', Eval('bank_accounts', []))],
+ depends=['bank_accounts'])
+ from_location = fields.Many2One('stock.location', 'From location', required=True,domain=[('type', "!=", 'customer')])
+ to_location = fields.Many2One('stock.location', 'To location', required=True,domain=[('type', "!=", 'supplier')])
shipment_out = fields.Many2One('stock.shipment.out','Sales')
#pnl = fields.One2Many('valuation.valuation', 'sale', 'Pnl')
pnl = fields.One2Many('valuation.valuation.dyn', 'r_sale', 'Pnl',states={'invisible': ~Eval('group_pnl'),})
@@ -256,47 +256,47 @@ class Sale(metaclass=PoolMeta):
trader = fields.Many2One('party.party',"Trader")
operator = fields.Many2One('party.party',"Operator")
our_reference = fields.Char("Our Reference")
- company_visible = fields.Function(
- fields.Boolean("Visible"), 'on_change_with_company_visible')
- lc_date = fields.Date("LC date")
- product_origin = fields.Char("Origin")
-
- @fields.depends('company', '_parent_company.party')
- def on_change_with_company_visible(self, name=None):
- return bool(
- self.company and self.company.party
- and self.company.party.name == 'MELYA')
-
- def _get_default_bank_account(self):
- if not self.party or not self.party.bank_accounts:
- return None
- party_bank_accounts = list(self.party.bank_accounts)
- if self.currency:
- for account in party_bank_accounts:
- if account.currency == self.currency:
- return account
- return party_bank_accounts[0]
-
- @fields.depends('party', '_parent_party.bank_accounts')
- def on_change_with_bank_accounts(self, name=None):
- if self.party and self.party.bank_accounts:
- return [account.id for account in self.party.bank_accounts]
- return []
-
- @fields.depends(
- 'company', 'party', 'invoice_party', 'shipment_party', 'warehouse',
- 'payment_term', 'lines', 'bank_account', '_parent_party.bank_accounts')
- def on_change_party(self):
- super().on_change_party()
- self.bank_account = self._get_default_bank_account()
-
- @fields.depends('party', 'currency', '_parent_party.bank_accounts')
- def on_change_currency(self):
- self.bank_account = self._get_default_bank_account()
-
- @classmethod
- def default_wb(cls):
- WB = Pool().get('purchase.weight.basis')
+ company_visible = fields.Function(
+ fields.Boolean("Visible"), 'on_change_with_company_visible')
+ lc_date = fields.Date("LC date")
+ product_origin = fields.Char("Origin")
+
+ @fields.depends('company', '_parent_company.party')
+ def on_change_with_company_visible(self, name=None):
+ return bool(
+ self.company and self.company.party
+ and self.company.party.name == 'MELYA')
+
+ def _get_default_bank_account(self):
+ if not self.party or not self.party.bank_accounts:
+ return None
+ party_bank_accounts = list(self.party.bank_accounts)
+ if self.currency:
+ for account in party_bank_accounts:
+ if account.currency == self.currency:
+ return account
+ return party_bank_accounts[0]
+
+ @fields.depends('party', '_parent_party.bank_accounts')
+ def on_change_with_bank_accounts(self, name=None):
+ if self.party and self.party.bank_accounts:
+ return [account.id for account in self.party.bank_accounts]
+ return []
+
+ @fields.depends(
+ 'company', 'party', 'invoice_party', 'shipment_party', 'warehouse',
+ 'payment_term', 'lines', 'bank_account', '_parent_party.bank_accounts')
+ def on_change_party(self):
+ super().on_change_party()
+ self.bank_account = self._get_default_bank_account()
+
+ @fields.depends('party', 'currency', '_parent_party.bank_accounts')
+ def on_change_currency(self):
+ self.bank_account = self._get_default_bank_account()
+
+ @classmethod
+ def default_wb(cls):
+ WB = Pool().get('purchase.weight.basis')
wb = WB.search(['id','>',0])
if wb:
return wb[0].id
@@ -333,14 +333,14 @@ class Sale(metaclass=PoolMeta):
@property
def report_gross(self):
if self.lines:
- return sum([l.get_current_gross_quantity_converted() for l in self.lines[0].lots if l.lot_type == 'physic'])
+ return sum([l.get_current_gross_quantity() for l in self.lines[0].lots if l.lot_type == 'physic'])
else:
return ''
@property
def report_net(self):
if self.lines:
- return sum([l.get_current_quantity_converted() for l in self.lines[0].lots if l.lot_type == 'physic'])
+ return sum([l.get_current_quantity() for l in self.lines[0].lots if l.lot_type == 'physic'])
else:
return ''