Adapt product price list and remove unit price to compute price list
From changeset product_price_list 5a23012
This commit is contained in:
parent
ba0e125275
commit
abd26ca523
|
@ -60,10 +60,10 @@ class Template(metaclass=PoolMeta):
|
|||
user.company.currency, prices[template.id],
|
||||
currency, round=False)
|
||||
if price_list:
|
||||
product = None
|
||||
price_list_category = (template.price_list_category and
|
||||
template.price_list_category.id or None)
|
||||
prices[template.id] = price_list.compute(customer, None,
|
||||
prices[template.id], quantity,
|
||||
prices[template.id] = price_list.compute(product, quantity,
|
||||
uom or template.default_uom, pattern={
|
||||
'price_list_category': price_list_category,
|
||||
})
|
||||
|
|
|
@ -22,7 +22,7 @@ Imports::
|
|||
|
||||
Install account_invoice::
|
||||
|
||||
>>> config = activate_modules('sale_pos_template_quantities')
|
||||
>>> config = activate_modules(['sale_pos_template_quantities', 'product_price_list_formula'])
|
||||
|
||||
Create company::
|
||||
|
||||
|
@ -75,6 +75,12 @@ Create account category::
|
|||
>>> account_category.customer_taxes.append(tax)
|
||||
>>> account_category.save()
|
||||
|
||||
Create Price List Category::
|
||||
|
||||
>>> PriceListCategory = Model.get('product.price_list.category')
|
||||
>>> price_list_category = PriceListCategory(name='Default')
|
||||
>>> price_list_category.save()
|
||||
|
||||
Create product::
|
||||
|
||||
>>> ProductUom = Model.get('product.uom')
|
||||
|
@ -88,6 +94,7 @@ Create product::
|
|||
>>> template.list_price = Decimal('10')
|
||||
>>> template.cost_price_method = 'fixed'
|
||||
>>> template.account_category = account_category
|
||||
>>> template.price_list_category = price_list_category
|
||||
>>> attributes = Attribute.find()
|
||||
>>> for attribute in attributes:
|
||||
... template.attributes.append(attribute)
|
||||
|
@ -101,15 +108,16 @@ Create payment term::
|
|||
|
||||
Create Product Price List::
|
||||
|
||||
>>> ProductPriceList = Model.get('product.price_list')
|
||||
>>> product_price_list = ProductPriceList()
|
||||
>>> product_price_list.name = 'Price List'
|
||||
>>> product_price_list.company = company
|
||||
>>> product_price_list.save()
|
||||
>>> PriceList = Model.get('product.price_list')
|
||||
>>> price_list = PriceList(name='Default')
|
||||
>>> price_list_line = price_list.lines.new()
|
||||
>>> price_list_line.formula = 'product.list_price_used'
|
||||
>>> price_list_line.price_list_category = price_list_category
|
||||
>>> price_list.save()
|
||||
|
||||
Create Sale Shop::
|
||||
|
||||
>>> shop = create_shop(payment_term, product_price_list)
|
||||
>>> shop = create_shop(payment_term, price_list)
|
||||
>>> shop.save()
|
||||
|
||||
Save Sale Shop User::
|
||||
|
@ -130,6 +138,7 @@ Create a sale::
|
|||
>>> sale.payment_term = payment_term
|
||||
>>> sale_line = sale.lines.new()
|
||||
>>> sale_line.template = template
|
||||
>>> sale_line.quantity = 2.0
|
||||
>>> sale.save()
|
||||
>>> sale.reload()
|
||||
>>> line_template = sale.lines[0]
|
||||
|
|
|
@ -7,5 +7,6 @@ depends:
|
|||
product_price_list_price_category
|
||||
extras_depend:
|
||||
product_raw_variant
|
||||
product_price_list_formula
|
||||
xml:
|
||||
sale.xml
|
||||
|
|
Loading…
Reference in New Issue