[IMP] product:Improve end of years pricelist for 30% discount

bzr revid: aag@tinyerp.com-20111227101741-nkz0v743h72d8ikg
This commit is contained in:
Atik Agewan (OpenERP) 2011-12-27 15:47:41 +05:30
parent 1bdd2d28cd
commit b19ec1a096
1 changed files with 26 additions and 23 deletions

View File

@ -18,7 +18,7 @@
ctx = context.copy()
ctx.update({'pricelist': ref("product.list0"), 'quantity': 5})
product_price = product_obj.browse(cr, uid, ref("product_product_pc1"), context=ctx).price
assert new_price[0] == product_price,"10% discount is given on sale price of 5 qty product"
assert new_price[0] == product_price,"10% discount is not given on sale price of 5 qty product"
-
For special product pricelist,I make new rule in "Default Public Pricelist Version" if special product than give 20% Discount.
-
@ -40,38 +40,41 @@
ctx = context.copy()
ctx.update({'pricelist': ref("product.list0"), 'quantity': 1})
product_price = product_obj.browse(cr, uid, ref("product_product_pc2"), context=ctx).price
assert new_price[0] == product_price,"20% discount is given on sale price of special product product"
assert new_price[0] == product_price,"20% discount is not given on sale price of special product"
-
Now I deactivate the old pricelist version.
Now I create new pricelist for end of yearto give 30% discount.
-
!python {model: product.pricelist.version}: |
price_obj = self.pool.get("product.pricelist")
self.write(cr, uid, ref("ver0"), {"active":False})
!record {model: product.pricelist, id: product_price_list_end_year}:
name: End of Years Price List
type: sale
version_id:
- name: End of Years Price List Version
items_id:
- name: End of Years Price List Version Rule
min_quantity: 1
base: 1
price_discount: -0.30
-
I create new "End of Years Price List Version" for end of year.
For end of year pricelist,I make new rule in "Default Public Pricelist Version" to give 30% discount.
-
!record {model: product.pricelist.version, id: product_price_version_end_year}:
name: End of Years Price List Version
pricelist_id: list0
date_start: !eval "'%s-12-01' %(datetime.now().year)"
date_end: !eval "'%s-12-31' %(datetime.now().year)"
-
Make new rule in "End of Years Price List Version" 100 Rs off on product.
-
!record {model: product.pricelist.item, id: product_price_version_end_year_rule}:
name: End of Years Price List Version Rule
!record {model: product.pricelist.item, id: pricelist_rules_for_end_year1}:
name: End of Years Price List Version Rule - Public Pricelist
min_quantity: 1
sequence: 1
base: 2
price_version_id: product.product_price_version_end_year
price_surcharge: 50
sequence: 2
base: -1
price_version_id: product.ver0
base_pricelist_id: product_price_list_end_year
-
I check sale price of PC1 is 350 on end of years by discount.
I check 30% discount is given on sale price of product at end of year.
-
!python {model: product.pricelist}: |
result = self.price_get_multi(cr, uid, [ref("product.list0")], [(ref("product_product_pc1") ,5,ref("base.res_partner_desertic_hispafuentes"))])
new_price = result[ref("product_product_pc1")].values()
assert new_price[0] == 350,"PC1 sale price is not 350 with Discount on end of year."
product_obj = self.pool.get("product.product")
ctx = context.copy()
ctx.update({'pricelist': ref("product.product_price_list_end_year"), 'quantity': 1})
product_price = product_obj.browse(cr, uid, ref("product_product_pc1"), context=ctx).price
assert new_price[0] == product_price,"30% discount is not given on sale price of product at end of year"
-
Now I new pricelist for "Agrolait" customer.
-