DN/CN commission
This commit is contained in:
@@ -732,9 +732,6 @@ class Invoice(metaclass=PoolMeta):
|
||||
'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
|
||||
|
||||
@@ -7469,6 +7469,21 @@ class PurchaseTradeTestCase(ModuleTestCase):
|
||||
|
||||
self.assertEqual(invoice.report_commission_note_total_display, '79.37')
|
||||
|
||||
def test_invoice_commission_note_uses_signed_invoice_adjustment(self):
|
||||
'commission note ignores the unsigned full fee amount'
|
||||
Invoice = Pool().get('account.invoice')
|
||||
|
||||
fee = Mock()
|
||||
fee.get_amount.return_value = Decimal('24329.40')
|
||||
invoice = Invoice()
|
||||
invoice.total_amount = Decimal('-24.60')
|
||||
invoice.lines = [Mock(type='line', fee=fee)]
|
||||
|
||||
self.assertEqual(invoice.report_commission_note_title, 'Credit Note')
|
||||
self.assertEqual(invoice.report_commission_due_label, 'TOTAL DUE TO US')
|
||||
self.assertEqual(invoice.report_commission_note_total_display, '24.60')
|
||||
fee.get_amount.assert_not_called()
|
||||
|
||||
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