This commit is contained in:
2026-04-02 12:46:42 +02:00
parent 613b679908
commit 0d5cf7dffc
4 changed files with 47 additions and 39 deletions

View File

@@ -2,7 +2,7 @@
<office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:rpt="http://openoffice.org/2005/report" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:drawooo="http://openoffice.org/2010/draw" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:css3t="http://www.w3.org/TR/css3-text/" xmlns:officeooo="http://openoffice.org/2009/office" office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text">
<office:meta>
<dc:title>Provisional Invoice</dc:title>
<dc:title>Invoice</dc:title>
<meta:initial-creator>willen</meta:initial-creator>
@@ -3866,7 +3866,7 @@
<table:table-row table:style-name="Tableau3.1">
<table:table-cell table:style-name="Tableau3.A1" office:value-type="string">
<text:p text:style-name="P22"/>
<text:p text:style-name="P22">Provisional Invoice</text:p>
<text:p text:style-name="P22">Invoice</text:p>
</table:table-cell>
<table:table-cell table:style-name="Tableau3.A1" office:value-type="string">
<text:p text:style-name="P22"/>
@@ -3932,7 +3932,7 @@
<table:table-cell table:style-name="Tableau5.A1" office:value-type="string">
<text:p text:style-name="P26">QUANTITY: <text:placeholder text:placeholder-type="text">&lt;format_number(invoice.report_lbs, invoice.party.lang) if invoice.report_lbs != &apos;&apos; else &apos;&apos;&gt;</text:placeholder><text:s/>LBS (<text:placeholder text:placeholder-type="text">&lt;format_number(invoice.report_net, invoice.party.lang) if invoice.report_net != &apos;&apos; else &apos;&apos;&gt;</text:placeholder> <text:placeholder text:placeholder-type="text">&lt;invoice.report_weight_unit_upper&gt;</text:placeholder>)</text:p>
<text:p text:style-name="P26"/>
<text:p text:style-name="P21"><text:placeholder text:placeholder-type="text">&lt;invoice.report_description_upper or invoice.report_product_description&gt;</text:placeholder><text:s/>CROP <text:placeholder text:placeholder-type="text">&lt;invoice.report_crop_name&gt;</text:placeholder></text:p>
<text:p text:style-name="P21"><text:placeholder text:placeholder-type="text">&lt;invoice.report_description_upper or invoice.report_product_description&gt;</text:placeholder><text:placeholder text:placeholder-type="text">&lt;&apos; CROP &apos; + invoice.report_crop_name if invoice.report_crop_name else &apos;&apos;&gt;</text:placeholder></text:p>
<text:p text:style-name="P21"><text:placeholder text:placeholder-type="text">&lt;invoice.report_attributes_name&gt;</text:placeholder></text:p>
<text:p text:style-name="P26"><text:placeholder text:placeholder-type="text">&lt;for each=&quot;block in invoice.report_trade_blocks&quot;&gt;</text:placeholder></text:p>
<text:p text:style-name="P26"><text:placeholder text:placeholder-type="text">&lt;block[0]&gt;</text:placeholder></text:p>
@@ -3943,7 +3943,7 @@
<text:p text:style-name="P18"/>
<text:p text:style-name="P32"><text:placeholder text:placeholder-type="text">&lt;invoice.report_incoterm&gt;</text:placeholder></text:p>
<text:p text:style-name="P29"><text:span text:style-name="T1">ALL DETAILS AND SPECIFICATIONS AS PER</text:span> <text:span text:style-name="T3">BENEFICIARY </text:span></text:p>
<text:p text:style-name="P26">PROFORMA INVOICE NO. <text:placeholder text:placeholder-type="text">&lt;invoice.report_proforma_invoice_number&gt;</text:placeholder><text:s/>DATED <text:placeholder text:placeholder-type="text">&lt;format_date(invoice.report_proforma_invoice_date, invoice.party.lang) if invoice.report_proforma_invoice_date else &apos;&apos;&gt;</text:placeholder>.</text:p>
<text:p text:style-name="P26"/>
<text:p text:style-name="P26"/>
<text:p text:style-name="P12"/>
</table:table-cell>

View File

@@ -2,7 +2,7 @@
<office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:rpt="http://openoffice.org/2005/report" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:drawooo="http://openoffice.org/2010/draw" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:css3t="http://www.w3.org/TR/css3-text/" xmlns:officeooo="http://openoffice.org/2009/office" office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text">
<office:meta>
<dc:title>Final Invoice</dc:title>
<dc:title>Credit / Debit Note</dc:title>
<meta:initial-creator>willen</meta:initial-creator>
<meta:creation-date>2018-12-09T16:20:00</meta:creation-date>
<dc:date>2026-03-27T08:01:16.333000000</dc:date>
@@ -3852,7 +3852,7 @@
<table:table-row table:style-name="Tableau3.1">
<table:table-cell table:style-name="Tableau3.A1" office:value-type="string">
<text:p text:style-name="P23"/>
<text:p text:style-name="P23">Final Invoice</text:p>
<text:p text:style-name="P23"><text:placeholder text:placeholder-type="text">&lt;invoice.report_note_title&gt;</text:placeholder></text:p>
</table:table-cell>
<table:table-cell table:style-name="Tableau3.A1" office:value-type="string">
<text:p text:style-name="P23"/>
@@ -3916,23 +3916,19 @@
<text:p text:style-name="P26">Goods description</text:p>
</table:table-cell>
<table:table-cell table:style-name="Tableau5.A1" office:value-type="string">
<text:p text:style-name="P27"><text:placeholder text:placeholder-type="text">&lt;for each=&quot;line in invoice.lines&quot;&gt;</text:placeholder></text:p>
<text:p text:style-name="P28"><text:placeholder text:placeholder-type="text">&lt;if test=&quot;line.type == &apos;line&apos;&quot;&gt;</text:placeholder></text:p>
<text:p text:style-name="P22"><text:placeholder text:placeholder-type="text">&lt;if test=&quot;line.report_description_upper&quot;&gt;</text:placeholder></text:p>
<text:p text:style-name="P22"><text:placeholder text:placeholder-type="text">&lt;line.report_description_upper&gt;</text:placeholder></text:p>
<text:p text:style-name="P22"><text:placeholder text:placeholder-type="text">&lt;/if&gt;</text:placeholder></text:p>
<text:p text:style-name="P27">QUANTITY <text:placeholder text:placeholder-type="text">&lt;format_number(line.report_lbs, invoice.party.lang) if line.report_lbs != &apos;&apos; else &apos;&apos;&gt;</text:placeholder><text:s/>LBS (<text:placeholder text:placeholder-type="text">&lt;format_number(line.report_net, invoice.party.lang) if line.report_net != &apos;&apos; else &apos;&apos;&gt;</text:placeholder> MTS)</text:p>
<text:p text:style-name="P21"><text:placeholder text:placeholder-type="text">&lt;line.report_product_description or line.product_name or &apos;&apos;&gt;</text:placeholder><text:s/>CROP <text:placeholder text:placeholder-type="text">&lt;line.report_crop_name&gt;</text:placeholder></text:p>
<text:p text:style-name="P21"><text:placeholder text:placeholder-type="text">&lt;line.report_attributes_name&gt;</text:placeholder></text:p>
<text:p text:style-name="P18">At <text:placeholder text:placeholder-type="text">&lt;line.report_rate_currency_upper&gt;</text:placeholder><text:s/><text:placeholder text:placeholder-type="text">&lt;line.report_rate_value&gt;</text:placeholder><text:s/>PER <text:placeholder text:placeholder-type="text">&lt;line.report_rate_unit_upper&gt;</text:placeholder><text:s/>(<text:placeholder text:placeholder-type="text">&lt;line.report_rate_price_words&gt;</text:placeholder>) <text:placeholder text:placeholder-type="text">&lt;line.report_rate_pricing_text&gt;</text:placeholder></text:p>
<text:p text:style-name="P27">QUANTITY: <text:placeholder text:placeholder-type="text">&lt;format_number(invoice.report_lbs, invoice.party.lang) if invoice.report_lbs != &apos;&apos; else &apos;&apos;&gt;</text:placeholder><text:s/>LBS (<text:placeholder text:placeholder-type="text">&lt;format_number(invoice.report_net, invoice.party.lang) if invoice.report_net != &apos;&apos; else &apos;&apos;&gt;</text:placeholder> <text:placeholder text:placeholder-type="text">&lt;invoice.report_weight_unit_upper&gt;</text:placeholder>)</text:p>
<text:p text:style-name="P27"/>
<text:p text:style-name="P21"><text:placeholder text:placeholder-type="text">&lt;invoice.report_description_upper or invoice.report_product_description&gt;</text:placeholder><text:placeholder text:placeholder-type="text">&lt;&apos; CROP &apos; + invoice.report_crop_name if invoice.report_crop_name else &apos;&apos;&gt;</text:placeholder></text:p>
<text:p text:style-name="P21"><text:placeholder text:placeholder-type="text">&lt;invoice.report_attributes_name&gt;</text:placeholder></text:p>
<text:p text:style-name="P27"><text:placeholder text:placeholder-type="text">&lt;for each=&quot;block in invoice.report_trade_blocks&quot;&gt;</text:placeholder></text:p>
<text:p text:style-name="P27"><text:placeholder text:placeholder-type="text">&lt;block[0]&gt;</text:placeholder></text:p>
<text:p text:style-name="P18">At <text:placeholder text:placeholder-type="text">&lt;block[1]&gt;</text:placeholder></text:p>
<text:p text:style-name="P18"/>
<text:p text:style-name="P21"><text:placeholder text:placeholder-type="text">&lt;/if&gt;</text:placeholder></text:p>
<text:p text:style-name="P18"/>
<text:p text:style-name="P21"><text:placeholder text:placeholder-type="text">&lt;/for&gt;</text:placeholder></text:p>
<text:p text:style-name="P27"><text:placeholder text:placeholder-type="text">&lt;/for&gt;</text:placeholder></text:p>
<text:p text:style-name="P21"/>
<text:p text:style-name="P34"><text:placeholder text:placeholder-type="text">&lt;invoice.report_incoterm&gt;</text:placeholder></text:p>
<text:p text:style-name="P31"><text:span text:style-name="T1">ALL DETAILS AND SPECIFICATIONS AS PER</text:span> <text:span text:style-name="T3">BENEFICIARY </text:span></text:p>
<text:p text:style-name="P27">PROFORMA INVOICE NO. <text:placeholder text:placeholder-type="text">&lt;invoice.report_proforma_invoice_number&gt;</text:placeholder><text:s/>DATED <text:placeholder text:placeholder-type="text">&lt;format_date(invoice.report_proforma_invoice_date, invoice.party.lang) if invoice.report_proforma_invoice_date else &apos;&apos;&gt;</text:placeholder>.</text:p>
<text:p text:style-name="P27"/>
<text:p text:style-name="P27"/>
<text:p text:style-name="P12"/>
</table:table-cell>
@@ -3946,10 +3942,10 @@
<text:p text:style-name="P15"><text:s text:c="19"/>BALES</text:p>
</table:table-cell>
<table:table-cell table:style-name="Tableau6.A1" office:value-type="string">
<text:p text:style-name="P43"><text:s text:c="13"/>Gross KGS</text:p>
<text:p text:style-name="P43"><text:s text:c="13"/>Gross <text:placeholder text:placeholder-type="text">&lt;invoice.report_weight_unit_upper&gt;</text:placeholder></text:p>
</table:table-cell>
<table:table-cell table:style-name="Tableau6.A1" office:value-type="string">
<text:p text:style-name="P15"><text:s text:c="13"/>NET KGS</text:p>
<text:p text:style-name="P15"><text:s text:c="13"/>NET <text:placeholder text:placeholder-type="text">&lt;invoice.report_weight_unit_upper&gt;</text:placeholder></text:p>
</table:table-cell>
<table:table-cell table:style-name="Tableau6.A1" office:value-type="string">
<text:p text:style-name="P43"><text:s text:c="10"/></text:p>

View File

@@ -167,9 +167,6 @@ class Invoice(metaclass=PoolMeta):
@property
def report_quantity_lines(self):
sale = self._get_report_sale()
if sale and getattr(sale, 'report_quantity_lines', None):
return sale.report_quantity_lines
details = []
for line in self._get_report_invoice_lines():
quantity = getattr(line, 'report_net', '')
@@ -193,9 +190,6 @@ class Invoice(metaclass=PoolMeta):
@property
def report_trade_blocks(self):
sale = self._get_report_sale()
if sale and getattr(sale, 'report_trade_blocks', None):
return sale.report_trade_blocks
blocks = []
quantity_lines = self.report_quantity_lines.splitlines()
rate_lines = self.report_rate_lines.splitlines()
@@ -241,9 +235,6 @@ class Invoice(metaclass=PoolMeta):
@property
def report_rate_lines(self):
sale = self._get_report_sale()
if sale and getattr(sale, 'report_price_lines', None):
return sale.report_price_lines
details = []
for line in self._get_report_invoice_lines():
currency = getattr(line, 'report_rate_currency_upper', '') or ''
@@ -309,9 +300,6 @@ class Invoice(metaclass=PoolMeta):
@property
def report_gross(self):
sale = self._get_report_sale()
if sale and sale.report_gross != '':
return sale.report_gross
if self.lines:
return sum(
Decimal(str(getattr(line, 'quantity', 0) or 0))
@@ -326,9 +314,6 @@ class Invoice(metaclass=PoolMeta):
@property
def report_net(self):
trade = self._get_report_trade()
if trade and getattr(trade, 'report_net', '') != '':
return trade.report_net
if self.lines:
return sum(
Decimal(str(getattr(line, 'quantity', 0) or 0))
@@ -352,15 +337,19 @@ class Invoice(metaclass=PoolMeta):
@property
def report_weight_unit_upper(self):
sale = self._get_report_sale()
if sale and getattr(sale, 'report_quantity_unit_upper', None):
return sale.report_quantity_unit_upper
line = self._get_report_trade_line() or self._get_report_invoice_line()
unit = getattr(line, 'unit', None) if line else None
if unit and unit.rec_name:
return unit.rec_name.upper()
return 'KGS'
@property
def report_note_title(self):
total = Decimal(str(self.total_amount or 0))
if total < 0:
return 'Debit Note'
return 'Credit Note'
@property
def report_bl_date(self):
shipment = self._get_report_shipment()

View File

@@ -310,5 +310,28 @@ class PurchaseTradeTestCase(ModuleTestCase):
'USC 8.3000 PER POUND (EIGHT USC AND THIRTY CENTS) ON ICE Cotton #2 MARCH 2026',
)])
def test_invoice_report_note_title_uses_total_amount_sign(self):
'final invoice title switches between credit and debit note'
Invoice = Pool().get('account.invoice')
credit = Invoice()
credit.total_amount = Decimal('10')
self.assertEqual(credit.report_note_title, 'Credit Note')
debit = Invoice()
debit.total_amount = Decimal('-10')
self.assertEqual(debit.report_note_title, 'Debit Note')
def test_invoice_report_net_sums_signed_invoice_lines(self):
'invoice report net uses the signed differential from invoice lines'
Invoice = Pool().get('account.invoice')
line_a = Mock(type='line', quantity=Decimal('1000'))
line_b = Mock(type='line', quantity=Decimal('-200'))
invoice = Invoice()
invoice.lines = [line_a, line_b]
self.assertEqual(invoice.report_net, Decimal('800'))
del ModuleTestCase