Commission CN/DN
This commit is contained in:
@@ -3851,10 +3851,10 @@
|
||||
</table:table-row>
|
||||
</table:table>
|
||||
<text:p text:style-name="P9" loext:marker-style-name="T5"/>
|
||||
<text:p text:style-name="P14" loext:marker-style-name="T5"><text:placeholder text:placeholder-type="text"><for each="line in invoice.report_positive_rate_lines.splitlines()"></text:placeholder><text:span text:style-name="T5">Your commission: </text:span><text:placeholder text:placeholder-type="text"><line></text:placeholder><text:placeholder text:placeholder-type="text"></for></text:placeholder><text:span text:style-name="T5"/></text:p>
|
||||
<text:p text:style-name="P14" loext:marker-style-name="T5"><text:span text:style-name="T5">Your commission: </text:span><text:placeholder text:placeholder-type="text"><invoice.report_commission_adjustment_rate_line></text:placeholder><text:span text:style-name="T5"/></text:p>
|
||||
<text:p text:style-name="P9" loext:marker-style-name="T5"/>
|
||||
<text:p text:style-name="P9" loext:marker-style-name="T5"/>
|
||||
<text:p text:style-name="P14" loext:marker-style-name="T5"><text:placeholder text:placeholder-type="text"><for each="tax in invoice.taxes"></text:placeholder><text:span text:style-name="T5">VAT </text:span><text:placeholder text:placeholder-type="text"><tax.description or '0%'></text:placeholder><text:span text:style-name="T5"> RATE</text:span><text:placeholder text:placeholder-type="text"></for></text:placeholder><text:span text:style-name="T5"/></text:p>
|
||||
<text:p text:style-name="P14" loext:marker-style-name="T5"><text:placeholder text:placeholder-type="text"><invoice.report_commission_tax_rate_line></text:placeholder><text:span text:style-name="T5"/></text:p>
|
||||
<text:p text:style-name="P9" loext:marker-style-name="T5"/>
|
||||
</table:table-cell>
|
||||
<table:table-cell table:style-name="Tableau6.A1" table:number-columns-spanned="2" office:value-type="string">
|
||||
@@ -3870,7 +3870,7 @@
|
||||
<text:p text:style-name="P15" loext:marker-style-name="T11"><text:span text:style-name="T7"><text:placeholder text:placeholder-type="text"><invoice.currency.name></text:placeholder></text:span><text:span text:style-name="T7"/></text:p>
|
||||
</table:table-cell>
|
||||
<table:table-cell table:style-name="Tableau6.A1" office:value-type="string">
|
||||
<text:p text:style-name="P16" loext:marker-style-name="T11"><text:span text:style-name="T7"><text:placeholder text:placeholder-type="text"><format_currency(invoice.total_amount, invoice.party.lang, invoice.currency)></text:placeholder></text:span><text:span text:style-name="T7"/></text:p>
|
||||
<text:p text:style-name="P16" loext:marker-style-name="T11"><text:span text:style-name="T7"><text:placeholder text:placeholder-type="text"><format_number(invoice.total_amount, invoice.party.lang, digits=invoice.currency.digits)></text:placeholder></text:span><text:span text:style-name="T7"/></text:p>
|
||||
</table:table-cell>
|
||||
</table:table-row>
|
||||
</table:table>
|
||||
|
||||
@@ -532,6 +532,49 @@ class Invoice(metaclass=PoolMeta):
|
||||
totals['difference'], totals['unit'])
|
||||
return self._format_report_quantity_display(lbs)
|
||||
|
||||
@property
|
||||
def report_commission_adjustment_rate_line(self):
|
||||
fee = self._get_report_commission_fee()
|
||||
if not fee:
|
||||
return self.report_commission_rate_line
|
||||
|
||||
mode = getattr(fee, 'mode', None)
|
||||
price = getattr(fee, 'price', None) or 0
|
||||
if mode in {'pprice', 'rate', 'pcost'}:
|
||||
kind = self._get_report_commission_kind() or 'sale'
|
||||
return ' '.join(part for part in [
|
||||
self._format_report_number(price, digits='0.0000'),
|
||||
'% on',
|
||||
kind,
|
||||
'amount',
|
||||
self._get_report_commission_base_amount_display_for(kind),
|
||||
self._get_report_commission_currency_name_for(kind),
|
||||
] if part)
|
||||
|
||||
if (getattr(fee, 'enable_linked_currency', False)
|
||||
and getattr(fee, 'linked_price', None) is not None):
|
||||
price = fee.linked_price
|
||||
currency = getattr(fee, 'linked_currency', None)
|
||||
unit = getattr(fee, 'linked_unit', None)
|
||||
else:
|
||||
currency = getattr(fee, 'currency', None)
|
||||
unit = getattr(fee, 'unit', None)
|
||||
price_text = self._format_report_number(price, digits='0.0000')
|
||||
currency_text = self._report_record_name(currency)
|
||||
unit_text = self._report_record_name(unit)
|
||||
if currency_text and unit_text:
|
||||
return '%s %s / %s' % (price_text, currency_text, unit_text)
|
||||
return ' '.join(part for part in [
|
||||
price_text, currency_text or unit_text,
|
||||
] if part)
|
||||
|
||||
@property
|
||||
def report_commission_tax_rate_line(self):
|
||||
for tax in getattr(self, 'taxes', []) or []:
|
||||
description = getattr(tax, 'description', None) or '0%'
|
||||
return 'VAT %s RATE' % description
|
||||
return 'VAT 0% RATE'
|
||||
|
||||
@property
|
||||
def report_commission_address(self):
|
||||
trade = self._get_report_commission_trade()
|
||||
|
||||
@@ -5481,6 +5481,9 @@ class PurchaseTradeTestCase(ModuleTestCase):
|
||||
get_current_quantity_converted=lambda state=0, unit=None: Decimal('397'))
|
||||
fee = SimpleNamespace(
|
||||
enable_linked_currency=False,
|
||||
mode='perqt',
|
||||
price=Decimal('7.85719'),
|
||||
currency=SimpleNamespace(rec_name='USD'),
|
||||
unit=unit,
|
||||
sale_line=SimpleNamespace(sale=SimpleNamespace()),
|
||||
line=None,
|
||||
@@ -5497,6 +5500,10 @@ class PurchaseTradeTestCase(ModuleTestCase):
|
||||
self.assertEqual(
|
||||
invoice.report_commission_weight_difference_display, '3.00')
|
||||
self.assertEqual(invoice.report_commission_adjustment_unit_upper, 'MT')
|
||||
self.assertEqual(
|
||||
invoice.report_commission_adjustment_rate_line,
|
||||
'7.8572 USD / MT')
|
||||
self.assertEqual(invoice.report_commission_tax_rate_line, 'VAT 0% RATE')
|
||||
|
||||
def test_fee_delete_detects_generated_ordered_purchase(self):
|
||||
'ordered fee deletion targets only its generated service purchase'
|
||||
|
||||
Reference in New Issue
Block a user