Fee qt state
This commit is contained in:
@@ -1923,12 +1923,7 @@ class Line(sequence_ordered(), ModelSQL, ModelView):
|
||||
elif fee.mode == 'ppack':
|
||||
invoice_line.quantity = fee.quantity
|
||||
else:
|
||||
state_id = 0
|
||||
LotQtType = Pool().get('lot.qt.type')
|
||||
lqt = LotQtType.search([('name','=','BL')])
|
||||
if lqt:
|
||||
state_id = lqt[0].id
|
||||
invoice_line.quantity = fee.get_fee_lots_qt(state_id)
|
||||
invoice_line.quantity = fee.get_fee_lots_qt()
|
||||
|
||||
if getattr(fee, 'state', None) != 'invoiced':
|
||||
return [invoice_line]
|
||||
|
||||
@@ -2712,8 +2712,6 @@ class PurchaseTradeTestCase(ModuleTestCase):
|
||||
reversal_line = Mock()
|
||||
fee_model = Mock()
|
||||
fee_model.search.return_value = [fee]
|
||||
lqt_model = Mock()
|
||||
lqt_model.search.return_value = []
|
||||
invoice_line_model = Mock()
|
||||
invoice_line_model.copy.return_value = [reversal_line]
|
||||
|
||||
@@ -2724,7 +2722,6 @@ class PurchaseTradeTestCase(ModuleTestCase):
|
||||
return_value=previous_line):
|
||||
PoolMock.return_value.get.side_effect = lambda name: {
|
||||
'fee.fee': fee_model,
|
||||
'lot.qt.type': lqt_model,
|
||||
'account.invoice.line': invoice_line_model,
|
||||
}[name]
|
||||
|
||||
@@ -2733,6 +2730,7 @@ class PurchaseTradeTestCase(ModuleTestCase):
|
||||
self.assertEqual(result, [reversal_line, invoice_line])
|
||||
self.assertEqual(invoice_line.fee, fee)
|
||||
self.assertEqual(invoice_line.quantity, Decimal('12'))
|
||||
fee.get_fee_lots_qt.assert_called_once_with()
|
||||
invoice_line_model.copy.assert_called_once_with(
|
||||
[previous_line], default={
|
||||
'invoice': None,
|
||||
@@ -2759,8 +2757,6 @@ class PurchaseTradeTestCase(ModuleTestCase):
|
||||
invoice=Mock(party=Mock()))
|
||||
fee_model = Mock()
|
||||
fee_model.search.return_value = [fee]
|
||||
lqt_model = Mock()
|
||||
lqt_model.search.return_value = []
|
||||
|
||||
with patch(
|
||||
'trytond.modules.purchase.purchase.Pool'
|
||||
@@ -2769,11 +2765,11 @@ class PurchaseTradeTestCase(ModuleTestCase):
|
||||
return_value=previous_line):
|
||||
PoolMock.return_value.get.side_effect = lambda name: {
|
||||
'fee.fee': fee_model,
|
||||
'lot.qt.type': lqt_model,
|
||||
}[name]
|
||||
|
||||
self.assertEqual(
|
||||
line._get_service_fee_invoice_lines(invoice_line, lot), [])
|
||||
fee.get_fee_lots_qt.assert_called_once_with()
|
||||
|
||||
def test_purchase_service_percent_price_fee_invoice_uses_amount_line(self):
|
||||
'% price service fee invoice uses a single amount line'
|
||||
|
||||
Reference in New Issue
Block a user