예제 #1
0
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())
예제 #2
0
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
예제 #3
0
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')