Commssion DN/CN
This commit is contained in:
@@ -3746,7 +3746,7 @@
|
||||
<table:table-column table:style-name="Tableau2.B"/>
|
||||
<table:table-row table:style-name="Tableau2.1">
|
||||
<table:table-cell table:style-name="Tableau2.A1" office:value-type="string">
|
||||
<text:p text:style-name="P14" loext:marker-style-name="T9"><text:span text:style-name="T9"><text:placeholder text:placeholder-type="text"><invoice.report_note_title.upper()></text:placeholder> N. <text:placeholder text:placeholder-type="text"><invoice.number></text:placeholder></text:span><text:span text:style-name="T9"/></text:p>
|
||||
<text:p text:style-name="P14" loext:marker-style-name="T9"><text:span text:style-name="T9"><text:placeholder text:placeholder-type="text"><invoice.report_commission_note_title.upper()></text:placeholder> N. <text:placeholder text:placeholder-type="text"><invoice.number></text:placeholder></text:span><text:span text:style-name="T9"/></text:p>
|
||||
<text:p text:style-name="P11" loext:marker-style-name="T9"/>
|
||||
<text:p text:style-name="P11" loext:marker-style-name="T9"/>
|
||||
<text:p text:style-name="P14" loext:marker-style-name="T7"><text:span text:style-name="T7">INVOICE N. <text:placeholder text:placeholder-type="text"><invoice.reference or invoice.report_proforma_invoice_number or ''></text:placeholder></text:span><text:span text:style-name="T7"/></text:p>
|
||||
@@ -3864,13 +3864,13 @@
|
||||
</table:table-row>
|
||||
<table:table-row table:style-name="Tableau6.1">
|
||||
<table:table-cell table:style-name="Tableau6.A1" office:value-type="string">
|
||||
<text:p text:style-name="P14" loext:marker-style-name="T11"><text:span text:style-name="T7">TOTAL DUE TO YOU</text:span><text:span text:style-name="T7"/></text:p>
|
||||
<text:p text:style-name="P14" loext:marker-style-name="T11"><text:span text:style-name="T7"><text:placeholder text:placeholder-type="text"><invoice.report_commission_due_label></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="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_number(invoice.total_amount, invoice.party.lang, digits=invoice.currency.digits)></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"><invoice.report_commission_note_total_display></text:placeholder></text:span><text:span text:style-name="T7"/></text:p>
|
||||
</table:table-cell>
|
||||
</table:table-row>
|
||||
</table:table>
|
||||
|
||||
@@ -731,6 +731,33 @@ class Invoice(metaclass=PoolMeta):
|
||||
return self._get_report_commission_value(
|
||||
'report_commission_total_display')
|
||||
|
||||
def _get_report_commission_amount(self):
|
||||
fee = self._get_report_commission_fee()
|
||||
if fee and hasattr(fee, 'get_amount'):
|
||||
return fee.get_amount()
|
||||
return self.total_amount or 0
|
||||
|
||||
@property
|
||||
def report_commission_note_title(self):
|
||||
amount = Decimal(str(self._get_report_commission_amount() or 0))
|
||||
if amount < 0:
|
||||
return 'Credit Note'
|
||||
return 'Debit Note'
|
||||
|
||||
@property
|
||||
def report_commission_due_label(self):
|
||||
amount = Decimal(str(self._get_report_commission_amount() or 0))
|
||||
if amount < 0:
|
||||
return 'TOTAL DUE TO US'
|
||||
return 'TOTAL DUE TO YOU'
|
||||
|
||||
@property
|
||||
def report_commission_note_total_display(self):
|
||||
amount = self._get_report_commission_amount()
|
||||
return self._format_report_number(
|
||||
abs(Decimal(str(amount or 0))), digits='0.01',
|
||||
strip_trailing_zeros=False)
|
||||
|
||||
def _get_report_commission_address_for(self, kind):
|
||||
trade = self._get_report_commission_trade_for(kind)
|
||||
return getattr(trade, 'report_address', '') or ''
|
||||
|
||||
@@ -7446,6 +7446,29 @@ class PurchaseTradeTestCase(ModuleTestCase):
|
||||
debit.total_amount = Decimal('-10')
|
||||
self.assertEqual(debit.report_note_title, 'Debit Note')
|
||||
|
||||
def test_invoice_commission_note_uses_company_to_broker_direction(self):
|
||||
'commission note title follows company to broker correction direction'
|
||||
Invoice = Pool().get('account.invoice')
|
||||
|
||||
credit = Invoice()
|
||||
credit.total_amount = Decimal('-79.37')
|
||||
self.assertEqual(credit.report_commission_note_title, 'Credit Note')
|
||||
self.assertEqual(credit.report_commission_due_label, 'TOTAL DUE TO US')
|
||||
|
||||
debit = Invoice()
|
||||
debit.total_amount = Decimal('79.37')
|
||||
self.assertEqual(debit.report_commission_note_title, 'Debit Note')
|
||||
self.assertEqual(debit.report_commission_due_label, 'TOTAL DUE TO YOU')
|
||||
|
||||
def test_invoice_commission_note_total_is_absolute(self):
|
||||
'commission note total is displayed without the accounting sign'
|
||||
Invoice = Pool().get('account.invoice')
|
||||
|
||||
invoice = Invoice()
|
||||
invoice.total_amount = Decimal('-79.37')
|
||||
|
||||
self.assertEqual(invoice.report_commission_note_total_display, '79.37')
|
||||
|
||||
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')
|
||||
|
||||
Reference in New Issue
Block a user