Fix: Campo product a Many2One
This commit is contained in:
@@ -1,8 +1,13 @@
|
||||
from django.test import TestCase
|
||||
from ..models import Sale, SaleLine
|
||||
from ..models import Product, Sale, SaleLine
|
||||
|
||||
|
||||
class ConfiaoTest(TestCase):
|
||||
def setUp(self):
|
||||
self.product = Product()
|
||||
self.product.name = "Pepino"
|
||||
self.product.price = 5000
|
||||
self.product.save()
|
||||
|
||||
def test_create_sale(self):
|
||||
sale = Sale()
|
||||
@@ -23,7 +28,7 @@ class ConfiaoTest(TestCase):
|
||||
|
||||
line = SaleLine()
|
||||
line.sale = sale
|
||||
line.product = 'papaya'
|
||||
line.product = self.product
|
||||
line.quantity = 2
|
||||
line.unit_price = 2500
|
||||
line.amount = 5000
|
||||
@@ -40,14 +45,14 @@ class ConfiaoTest(TestCase):
|
||||
|
||||
line1 = SaleLine()
|
||||
line1.sale = sale
|
||||
line1.product = 'papaya'
|
||||
line1.product = self.product
|
||||
line1.quantity = 2
|
||||
line1.unit_price = 2500
|
||||
line1.amount = 5000
|
||||
|
||||
line2 = SaleLine()
|
||||
line2.sale = sale
|
||||
line2.product = 'papaya'
|
||||
line2.product = self.product
|
||||
line2.quantity = 2
|
||||
line2.unit_price = 2500
|
||||
line2.amount = 5000
|
||||
|
||||
Reference in New Issue
Block a user