padding
This commit is contained in:
@@ -9,6 +9,7 @@ from trytond.pool import Pool
|
||||
from trytond.tests.test_tryton import ModuleTestCase, with_transaction
|
||||
from trytond.exceptions import UserError
|
||||
from trytond.modules.purchase_trade import valuation as valuation_module
|
||||
from trytond.modules.purchase_trade import lot as lot_module
|
||||
from trytond.modules.purchase_trade.service import ContractFactory
|
||||
|
||||
|
||||
@@ -2148,5 +2149,25 @@ class PurchaseTradeTestCase(ModuleTestCase):
|
||||
|
||||
self.assertIs(invoice_line.invoice, sale_invoice)
|
||||
|
||||
def test_lot_invoice_sale_padding_is_split_per_lot(self):
|
||||
'sale provisional padding is split equally across selected lots'
|
||||
lots = [Mock(id=1), Mock(id=2)]
|
||||
|
||||
self.assertEqual(
|
||||
lot_module.LotInvoice._split_sale_padding(Decimal('1000'), lots),
|
||||
{1: Decimal('500'), 2: Decimal('500')})
|
||||
|
||||
@with_transaction()
|
||||
def test_invoice_line_included_padding_reads_sale_lot_padding(self):
|
||||
'invoice line exposes the sale provisional padding stored on the lot'
|
||||
InvoiceLine = Pool().get('account.invoice.line')
|
||||
line = InvoiceLine()
|
||||
line.lot = Mock(sale_invoice_padding=Decimal('500'))
|
||||
line.invoice_type = 'out'
|
||||
line.description = 'Pro forma'
|
||||
line.quantity = Decimal('10500')
|
||||
|
||||
self.assertEqual(line.get_included_padding(None), Decimal('500'))
|
||||
|
||||
|
||||
del ModuleTestCase
|
||||
|
||||
Reference in New Issue
Block a user