def test_sale_copy_items(): trans = transaction_factory() prod = product_factory(items=True) assert prod.items.exists() pos = TransactionPosition(type='sale', transaction=trans, product=prod) pos.save() assert set(pos.items.all()) == set(prod.items.all())
def test_sale_copy_tax_rate(): trans = transaction_factory() pos = TransactionPosition(type='sale', transaction=trans, product=product_factory()) pos.save() assert pos.value == pos.product.price assert pos.tax_rate == pos.product.tax_rate
def test_tax_calculation_no_tax(): trans = transaction_factory() pos = TransactionPosition(type='sale', tax_rate=Decimal('0.00'), value=Decimal('1.19'), transaction=trans, product=product_factory()) pos.save() assert pos.tax_value == Decimal('0.00')