Move cost price to product level instead of template
issue6515 review41321002
This commit is contained in:
1 parent
e933e0bbf8
commit
10104768b1
3 files changed
+26
-32
No files matched your search
@@ -32,28 +32,27 @@ Create products::
|
||||
|
||||
>>> ProductUom = Model.get('product.uom')
|
||||
>>> ProductTemplate = Model.get('product.template')
|
||||
>>> Product = Model.get('product.product')
|
||||
>>> unit, = ProductUom.find([('name', '=', 'Unit')])
|
||||
>>> product = Product()
|
||||
|
||||
>>> template = ProductTemplate()
|
||||
>>> template.name = 'Product'
|
||||
>>> template.default_uom = unit
|
||||
>>> template.type = 'goods'
|
||||
>>> template.list_price = Decimal('20')
|
||||
>>> template.cost_price = Decimal('8')
|
||||
>>> product, = template.products
|
||||
>>> product.cost_price = Decimal('8')
|
||||
>>> template.save()
|
||||
>>> product.template = template
|
||||
>>> product.save()
|
||||
>>> carrier_product = Product()
|
||||
>>> product, = template.products
|
||||
|
||||
>>> carrier_template = ProductTemplate()
|
||||
>>> carrier_template.name = 'Carrier Product'
|
||||
>>> carrier_template.default_uom = unit
|
||||
>>> carrier_template.type = 'service'
|
||||
>>> carrier_template.list_price = Decimal('5')
|
||||
>>> carrier_template.cost_price = Decimal('3')
|
||||
>>> carrier_product, = carrier_template.products
|
||||
>>> carrier_product.cost_price = Decimal('3')
|
||||
>>> carrier_template.save()
|
||||
>>> carrier_product.template = carrier_template
|
||||
>>> carrier_product.save()
|
||||
>>> carrier_product, = carrier_template.products
|
||||
|
||||
Create carrier::
|
||||
|
||||
|
||||
@@ -63,15 +63,13 @@ Create products::
|
||||
|
||||
>>> ProductUom = Model.get('product.uom')
|
||||
>>> ProductTemplate = Model.get('product.template')
|
||||
>>> Product = Model.get('product.product')
|
||||
>>> unit, = ProductUom.find([('name', '=', 'Unit')])
|
||||
>>> product = Product()
|
||||
|
||||
>>> template = ProductTemplate()
|
||||
>>> template.name = 'Product'
|
||||
>>> template.default_uom = unit
|
||||
>>> template.type = 'goods'
|
||||
>>> template.list_price = Decimal('20')
|
||||
>>> template.cost_price = Decimal('8')
|
||||
>>> template.account_expense = expense
|
||||
>>> template.account_revenue = revenue
|
||||
>>> template.account_stock = stock
|
||||
@@ -82,28 +80,26 @@ Create products::
|
||||
>>> template.account_journal_stock_supplier = stock_journal
|
||||
>>> template.account_journal_stock_customer = stock_journal
|
||||
>>> template.account_journal_stock_lost_found = stock_journal
|
||||
>>> product, = template.products
|
||||
>>> product.cost_price = Decimal('8')
|
||||
>>> template.save()
|
||||
>>> product.template = template
|
||||
>>> product.save()
|
||||
>>> template_average, = ProductTemplate.duplicate([template])
|
||||
>>> template_average.cost_price_method = 'average'
|
||||
>>> template_average.save()
|
||||
>>> product_average, = Product.duplicate([product], {
|
||||
... 'template': template_average.id,
|
||||
>>> product, = template.products
|
||||
>>> template_average, = template.duplicate({
|
||||
... 'cost_price_method': 'average',
|
||||
... })
|
||||
>>> product_average, = template_average.products
|
||||
|
||||
>>> carrier_product = Product()
|
||||
>>> carrier_template = ProductTemplate()
|
||||
>>> carrier_template.name = 'Carrier Product'
|
||||
>>> carrier_template.default_uom = unit
|
||||
>>> carrier_template.type = 'service'
|
||||
>>> carrier_template.list_price = Decimal('5')
|
||||
>>> carrier_template.cost_price = Decimal('3')
|
||||
>>> carrier_template.account_expense = expense
|
||||
>>> carrier_template.account_revenue = revenue
|
||||
>>> carrier_product, = carrier_template.products
|
||||
>>> carrier_product.cost_price = Decimal('3')
|
||||
>>> carrier_template.save()
|
||||
>>> carrier_product.template = carrier_template
|
||||
>>> carrier_product.save()
|
||||
>>> carrier_product, = carrier_template.products
|
||||
|
||||
Create carrier::
|
||||
|
||||
|
||||
@@ -71,15 +71,13 @@ Create product::
|
||||
>>> ProductUom = Model.get('product.uom')
|
||||
>>> unit, = ProductUom.find([('name', '=', 'Unit')])
|
||||
>>> ProductTemplate = Model.get('product.template')
|
||||
>>> Product = Model.get('product.product')
|
||||
>>> product = Product()
|
||||
|
||||
>>> template = ProductTemplate()
|
||||
>>> template.name = 'product'
|
||||
>>> template.default_uom = unit
|
||||
>>> template.type = 'goods'
|
||||
>>> template.purchasable = True
|
||||
>>> template.list_price = Decimal('10')
|
||||
>>> template.cost_price = Decimal('5')
|
||||
>>> template.cost_price_method = 'average'
|
||||
>>> template.account_expense = expense
|
||||
>>> template.account_revenue = revenue
|
||||
@@ -92,21 +90,22 @@ Create product::
|
||||
>>> template.account_journal_stock_supplier = stock_journal
|
||||
>>> template.account_journal_stock_customer = stock_journal
|
||||
>>> template.account_journal_stock_lost_found = stock_journal
|
||||
>>> product, = template.products
|
||||
>>> product.cost_price = Decimal('5')
|
||||
>>> template.save()
|
||||
>>> product.template = template
|
||||
>>> product.save()
|
||||
>>> carrier_product = Product()
|
||||
>>> product, = template.products
|
||||
|
||||
>>> carrier_template = ProductTemplate()
|
||||
>>> carrier_template.name = 'Carrier Product'
|
||||
>>> carrier_template.default_uom = unit
|
||||
>>> carrier_template.type = 'service'
|
||||
>>> carrier_template.list_price = Decimal('5')
|
||||
>>> carrier_template.cost_price = Decimal('3')
|
||||
>>> carrier_template.account_expense = expense
|
||||
>>> carrier_template.account_revenue = revenue
|
||||
>>> carrier_product, = carrier_template.products
|
||||
>>> carrier_product.cost_price = Decimal('3')
|
||||
>>> carrier_template.save()
|
||||
>>> carrier_product.template = carrier_template
|
||||
>>> carrier_product.save()
|
||||
>>> carrier_product, = carrier_template.products
|
||||
|
||||
Create carrier::
|
||||
|
||||
|
||||
Reference in new issue
Block a user