Move cost price to product level instead of template
issue6515 review41321002
This commit is contained in:
1 parent
e023c632cf
commit
8113764d44
1 file changed
+9
-13
@@ -51,55 +51,51 @@ Create products::
|
||||
|
||||
>>> ProductUom = Model.get('product.uom')
|
||||
>>> ProductTemplate = Model.get('product.template')
|
||||
>>> Product = Model.get('product.product')
|
||||
>>> unit, = ProductUom.find([('name', '=', 'Unit')])
|
||||
>>> kg, = ProductUom.find([('name', '=', 'Kilogram')])
|
||||
|
||||
>>> product1 = Product()
|
||||
>>> template = ProductTemplate()
|
||||
>>> template.name = 'Product'
|
||||
>>> template.default_uom = unit
|
||||
>>> template.type = 'goods'
|
||||
>>> template.list_price = Decimal('300')
|
||||
>>> template.cost_price = Decimal('80')
|
||||
>>> template.cost_price_method = 'average'
|
||||
>>> template.account_expense = expense
|
||||
>>> template.account_revenue = revenue
|
||||
>>> template.weight_uom = kg
|
||||
>>> template.weight = 20
|
||||
>>> product1, = template.products
|
||||
>>> product1.cost_price = Decimal('80')
|
||||
>>> template.save()
|
||||
>>> product1.template = template
|
||||
>>> product1.save()
|
||||
>>> product1, = template.products
|
||||
|
||||
>>> product2 = Product()
|
||||
>>> template = ProductTemplate()
|
||||
>>> template.name = 'Product'
|
||||
>>> template.default_uom = unit
|
||||
>>> template.type = 'goods'
|
||||
>>> template.list_price = Decimal('200')
|
||||
>>> template.cost_price = Decimal('50')
|
||||
>>> template.cost_price_method = 'average'
|
||||
>>> template.account_expense = expense
|
||||
>>> template.account_revenue = revenue
|
||||
>>> template.weight_uom = kg
|
||||
>>> template.weight = 10
|
||||
>>> product2, = template.products
|
||||
>>> product2.cost_price = Decimal('50')
|
||||
>>> template.save()
|
||||
>>> product2.template = template
|
||||
>>> product2.save()
|
||||
>>> product2, = template.products
|
||||
|
||||
>>> product_landed_cost = Product()
|
||||
>>> template = ProductTemplate()
|
||||
>>> template.name = 'Landed Cost'
|
||||
>>> template.default_uom = unit
|
||||
>>> template.type = 'service'
|
||||
>>> template.landed_cost = True
|
||||
>>> template.list_price = Decimal('10')
|
||||
>>> template.cost_price = Decimal('10')
|
||||
>>> template.account_expense = expense
|
||||
>>> template.account_revenue = revenue
|
||||
>>> product_landed_cost, = template.products
|
||||
>>> product_landed_cost.cost_price = Decimal('10')
|
||||
>>> template.save()
|
||||
>>> product_landed_cost.template = template
|
||||
>>> product_landed_cost.save()
|
||||
>>> product_landed_cost, = template.products
|
||||
|
||||
Get stock locations::
|
||||
|
||||
|
||||
Reference in new issue
Block a user