Bug premium sale
This commit is contained in:
@@ -2164,6 +2164,22 @@ class PurchaseTradeTestCase(ModuleTestCase):
|
||||
|
||||
self.assertEqual(line.get_premium('premium'), Decimal('10.2500'))
|
||||
|
||||
def test_sale_line_premium_price_falls_back_to_decomposition(self):
|
||||
'sale line premium price works when the function field is not loaded'
|
||||
class LineWithoutPremium:
|
||||
premium_decomposition = [
|
||||
Mock(base_amount=Decimal('7.25')),
|
||||
Mock(base_amount=Decimal('-1.00')),
|
||||
]
|
||||
|
||||
get_premium = sale_module.SaleLine.get_premium
|
||||
|
||||
line = LineWithoutPremium()
|
||||
|
||||
self.assertEqual(
|
||||
sale_module.SaleLine._get_premium_price(line),
|
||||
Decimal('6.2500'))
|
||||
|
||||
def test_purchase_and_sale_line_premium_fields_are_readonly_totals(self):
|
||||
'line premium fields are readonly totals from premium decomposition'
|
||||
PurchaseLine = Pool().get('purchase.line')
|
||||
|
||||
Reference in New Issue
Block a user