From 5cd6e683b5feb11d6687f96d4a5042b3bbfeca95 Mon Sep 17 00:00:00 2001 From: "Atik Agewan (OpenERP)" Date: Mon, 26 Dec 2011 14:50:53 +0530 Subject: [PATCH 01/17] [IMP] product:Add new yml file for pricelist operation- more qty, End of years bzr revid: aag@tinyerp.com-20111226092053-4ouqk07g9kwud8fn --- addons/product/__openerp__.py | 5 +- addons/product/test/product_price_list.yml | 55 ++++++++++++++++++++++ 2 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 addons/product/test/product_price_list.yml diff --git a/addons/product/__openerp__.py b/addons/product/__openerp__.py index 81ec3a0ae64..67f8589b474 100644 --- a/addons/product/__openerp__.py +++ b/addons/product/__openerp__.py @@ -61,7 +61,10 @@ Print product labels with barcode. 'partner_view.xml', 'process/product_process.xml' ], - 'test':['test/product_report.yml','test/product_test.yml'], + 'test':['test/product_report.yml', + 'test/product_test.yml', + 'test/product_price_list.yml'], + 'installable': True, 'active': False, 'certificate': '0068861431437', diff --git a/addons/product/test/product_price_list.yml b/addons/product/test/product_price_list.yml new file mode 100644 index 00000000000..42f8b6a3733 --- /dev/null +++ b/addons/product/test/product_price_list.yml @@ -0,0 +1,55 @@ +- + In order to test product pricelist,first I check PC1 sale price is 450. +- + !python {model: product.product}: | + prd_brw = self.browse(cr, uid, ref("product_product_pc1")) + assert prd_brw.list_price == 450,"PC1 sale price is not 450" +- + Make new rule in "Default Public Pricelist Version" if product qty is more than 4 Discount 50 Rs per qty. +- + !record {model: product.pricelist.item, id: pricelist_rules_for_more_qty1}: + name: Default Public Pricelist for More Qty + min_quantity: 5 + sequence: 1 + base: 2 + price_version_id: product.ver0 + price_surcharge: 100 +- + I check sale price of PC1 is 400 by discount. +- + !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] == 400,"PC1 sale price is not 400 with Discount." +- + Now I deactivate the old pricelist version. +- + !python {model: product.pricelist.version}: | + price_obj = self.pool.get("product.pricelist") + self.write(cr, uid, ref("ver0"), {"active":False}) +- + I create new "End of Years Price List Version" for end of year. +- + !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 + min_quantity: 1 + sequence: 1 + base: 2 + price_version_id: product.product_price_version_end_year + price_surcharge: 50 +- + I check sale price of PC1 is 350 on end of years by discount. +- + !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." + From 694dde198c63e343cf27cd5e737143422c70bee5 Mon Sep 17 00:00:00 2001 From: "Atik Agewan (OpenERP)" Date: Mon, 26 Dec 2011 16:05:20 +0530 Subject: [PATCH 02/17] [IMP] product:Add pricelist for special products bzr revid: aag@tinyerp.com-20111226103520-lv7d47r3hh8gbfo2 --- addons/product/test/product_price_list.yml | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/addons/product/test/product_price_list.yml b/addons/product/test/product_price_list.yml index 42f8b6a3733..8d58ec8cc07 100644 --- a/addons/product/test/product_price_list.yml +++ b/addons/product/test/product_price_list.yml @@ -21,6 +21,30 @@ 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] == 400,"PC1 sale price is not 400 with Discount." +- + For special product pricelist, first I check "PC2" sale price is 750. +- + !python {model: product.product}: | + prd_brw = self.browse(cr, uid, ref("product_product_pc2")) + assert prd_brw.list_price == 750,"PC2 sale price is not 750" +- + Make new rule in "Default Public Pricelist Version" if product is "PC2" than 30 Rs off on sale price of product . +- + !record {model: product.pricelist.item, id: pricelist_rules_for_pc2}: + name: Default Public Pricelist for PC2 + min_quantity: 1 + product_id: product.product_product_pc2 + sequence: 1 + base: 2 + price_version_id: product.ver0 + price_surcharge: 220 +- + I check sale price of PC2 is 720 by discount. +- + !python {model: product.pricelist}: | + result = self.price_get_multi(cr, uid, [ref("product.list0")], [(ref("product_product_pc2") ,5,ref("base.res_partner_desertic_hispafuentes"))]) + new_price = result[ref("product_product_pc2")].values() + assert new_price[0] == 720,"PC1 sale price is not 720 with Discount." - Now I deactivate the old pricelist version. - From 2a30dd7a5e750326a78afcdba257f914a572046f Mon Sep 17 00:00:00 2001 From: "Atik Agewan (OpenERP)" Date: Mon, 26 Dec 2011 17:59:41 +0530 Subject: [PATCH 03/17] [IMP] product:Add pricelist for special customer bzr revid: aag@tinyerp.com-20111226122941-hkmiogsdpmiem9cf --- addons/product/test/product_price_list.yml | 33 +++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/addons/product/test/product_price_list.yml b/addons/product/test/product_price_list.yml index 8d58ec8cc07..8d10e09b4fa 100644 --- a/addons/product/test/product_price_list.yml +++ b/addons/product/test/product_price_list.yml @@ -76,4 +76,35 @@ 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." - +- + Now I new pricelist for "Agrolait" customer. +- + !record {model: product.pricelist, id: agrolait_price_list1}: + name: Price List For Agrolait + type: sale + version_id: + - name: Agrolait Price List Version + items_id: + - name: Agrolait Price List Version Rule + min_quantity: 1 + base: 2 + price_surcharge: 100 +- + Now I check "PC4" public price is 1200. +- + !python {model: product.product}: | + prd_brw = self.browse(cr, uid, ref("product_product_pc4")) + assert prd_brw.list_price == 1200,"PC2 sale price is not 1200" +- + I assing "Price List For Agrolait" to Agrolait. +- + !record {model: res.partner, id: base.res_partner_agrolait}: + property_product_pricelist: agrolait_price_list1 +- + I check sale price of PC4 is 900 for "Agrolait" customer. +- + !python {model: product.pricelist}: | + result = self.price_get_multi(cr, uid, [ref("product.agrolait_price_list1")], [(ref("product_product_pc4") ,5,ref("base.res_partner_agrolait"))]) + new_price = result[ref("product_product_pc4")].values() + assert new_price[0] == 900,"PC4 sale price is not 900 with Discount." + From 4f50131337d8052c35422d4d08fb91225790dcf6 Mon Sep 17 00:00:00 2001 From: "Atik Agewan (OpenERP)" Date: Mon, 26 Dec 2011 18:06:35 +0530 Subject: [PATCH 04/17] [IMP] product:Add pricelist for supplier bzr revid: aag@tinyerp.com-20111226123635-aptz5sgkq0p1zbe3 --- addons/product/test/product_price_list.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/addons/product/test/product_price_list.yml b/addons/product/test/product_price_list.yml index 8d10e09b4fa..8fcf0a61ccc 100644 --- a/addons/product/test/product_price_list.yml +++ b/addons/product/test/product_price_list.yml @@ -107,4 +107,11 @@ result = self.price_get_multi(cr, uid, [ref("product.agrolait_price_list1")], [(ref("product_product_pc4") ,5,ref("base.res_partner_agrolait"))]) new_price = result[ref("product_product_pc4")].values() assert new_price[0] == 900,"PC4 sale price is not 900 with Discount." +- + I add supplier pricelist for product "PC1" for 10 Qty. +- + !record {model: product.supplierinfo, id: supplierinfo5}: + pricelist_ids: + - min_quantity: 10 + price: 200 From bd59b7d5c75d3c565944cbcc9eb1f77ad6c8300b Mon Sep 17 00:00:00 2001 From: "Atik Agewan (OpenERP)" Date: Mon, 26 Dec 2011 18:57:51 +0530 Subject: [PATCH 05/17] [IMP] product:Optimize code for more qty price list bzr revid: aag@tinyerp.com-20111226132751-5ltpmo3dlnzlh0vq --- addons/product/test/product_price_list.yml | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/addons/product/test/product_price_list.yml b/addons/product/test/product_price_list.yml index 8fcf0a61ccc..6589e19344b 100644 --- a/addons/product/test/product_price_list.yml +++ b/addons/product/test/product_price_list.yml @@ -1,26 +1,23 @@ - - In order to test product pricelist,first I check PC1 sale price is 450. -- - !python {model: product.product}: | - prd_brw = self.browse(cr, uid, ref("product_product_pc1")) - assert prd_brw.list_price == 450,"PC1 sale price is not 450" -- - Make new rule in "Default Public Pricelist Version" if product qty is more than 4 Discount 50 Rs per qty. + In order to test product pricelist, I make new rule in "Default Public Pricelist Version" if product qty >= 5 than give discount 10% per qty. - !record {model: product.pricelist.item, id: pricelist_rules_for_more_qty1}: name: Default Public Pricelist for More Qty min_quantity: 5 sequence: 1 - base: 2 + base: 1 price_version_id: product.ver0 - price_surcharge: 100 + price_discount: -0.10 - - I check sale price of PC1 is 400 by discount. + I check 10% discount is given on sale price of "PC1". - !python {model: product.pricelist}: | + product_obj = self.pool.get("product.product") 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] == 400,"PC1 sale price is not 400 with Discount." + old_price = product_obj.browse(cr, uid,ref("product_product_pc1")).list_price + discount = old_price * 0.10 + assert new_price[0] == old_price - discount,"10% discount is given on sale price of PC1" - For special product pricelist, first I check "PC2" sale price is 750. - From 3c89ce51c3f6e654a1d0f6702bed8d887aa965b1 Mon Sep 17 00:00:00 2001 From: "Atik Agewan (OpenERP)" Date: Tue, 27 Dec 2011 14:27:25 +0530 Subject: [PATCH 06/17] [IMP] product:Imp more qty product pricelist for 10% bzr revid: aag@tinyerp.com-20111227085725-xnrpr4z13qcp85w9 --- addons/product/test/product_price_list.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/addons/product/test/product_price_list.yml b/addons/product/test/product_price_list.yml index 6589e19344b..6dd83a3bc45 100644 --- a/addons/product/test/product_price_list.yml +++ b/addons/product/test/product_price_list.yml @@ -9,15 +9,16 @@ price_version_id: product.ver0 price_discount: -0.10 - - I check 10% discount is given on sale price of "PC1". + I check 10% discount is given on sale price of 5 qty product. - !python {model: product.pricelist}: | product_obj = self.pool.get("product.product") 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() - old_price = product_obj.browse(cr, uid,ref("product_product_pc1")).list_price - discount = old_price * 0.10 - assert new_price[0] == old_price - discount,"10% discount is given on sale price of PC1" + 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" - For special product pricelist, first I check "PC2" sale price is 750. - From 1bdd2d28cde830f5edd35e39f999418fcd174042 Mon Sep 17 00:00:00 2001 From: "Atik Agewan (OpenERP)" Date: Tue, 27 Dec 2011 14:43:37 +0530 Subject: [PATCH 07/17] [IMP] product:Improve special pricelist for 20% discount bzr revid: aag@tinyerp.com-20111227091337-pe1dcipjvpwpcl3b --- addons/product/test/product_price_list.yml | 24 ++++++++++------------ 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/addons/product/test/product_price_list.yml b/addons/product/test/product_price_list.yml index 6dd83a3bc45..85ce153f012 100644 --- a/addons/product/test/product_price_list.yml +++ b/addons/product/test/product_price_list.yml @@ -4,7 +4,7 @@ !record {model: product.pricelist.item, id: pricelist_rules_for_more_qty1}: name: Default Public Pricelist for More Qty min_quantity: 5 - sequence: 1 + sequence: 5 base: 1 price_version_id: product.ver0 price_discount: -0.10 @@ -20,29 +20,27 @@ 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" - - For special product pricelist, first I check "PC2" sale price is 750. -- - !python {model: product.product}: | - prd_brw = self.browse(cr, uid, ref("product_product_pc2")) - assert prd_brw.list_price == 750,"PC2 sale price is not 750" -- - Make new rule in "Default Public Pricelist Version" if product is "PC2" than 30 Rs off on sale price of product . + For special product pricelist,I make new rule in "Default Public Pricelist Version" if special product than give 20% Discount. - !record {model: product.pricelist.item, id: pricelist_rules_for_pc2}: name: Default Public Pricelist for PC2 min_quantity: 1 product_id: product.product_product_pc2 - sequence: 1 - base: 2 + sequence: 4 + base: 1 price_version_id: product.ver0 - price_surcharge: 220 + price_discount: -0.20 - - I check sale price of PC2 is 720 by discount. + I check 20% discount is given on sale price of special product. - !python {model: product.pricelist}: | result = self.price_get_multi(cr, uid, [ref("product.list0")], [(ref("product_product_pc2") ,5,ref("base.res_partner_desertic_hispafuentes"))]) + product_obj = self.pool.get("product.product") new_price = result[ref("product_product_pc2")].values() - assert new_price[0] == 720,"PC1 sale price is not 720 with Discount." + 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" - Now I deactivate the old pricelist version. - From b19ec1a096169ecde90bcee39cc24c1b04e9627b Mon Sep 17 00:00:00 2001 From: "Atik Agewan (OpenERP)" Date: Tue, 27 Dec 2011 15:47:41 +0530 Subject: [PATCH 08/17] [IMP] product:Improve end of years pricelist for 30% discount bzr revid: aag@tinyerp.com-20111227101741-nkz0v743h72d8ikg --- addons/product/test/product_price_list.yml | 49 ++++++++++++---------- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/addons/product/test/product_price_list.yml b/addons/product/test/product_price_list.yml index 85ce153f012..50968c22993 100644 --- a/addons/product/test/product_price_list.yml +++ b/addons/product/test/product_price_list.yml @@ -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. - From fe224ed0bc35914f4e9d39b5672affa2a778901e Mon Sep 17 00:00:00 2001 From: "Atik Agewan (OpenERP)" Date: Tue, 27 Dec 2011 16:16:08 +0530 Subject: [PATCH 09/17] [IMP] product:Improve customer pricelist for 40% discount bzr revid: aag@tinyerp.com-20111227104608-4uivelyagzumng1n --- addons/product/test/product_price_list.yml | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/addons/product/test/product_price_list.yml b/addons/product/test/product_price_list.yml index 50968c22993..31be32d398e 100644 --- a/addons/product/test/product_price_list.yml +++ b/addons/product/test/product_price_list.yml @@ -76,7 +76,7 @@ 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. + Now I creat new pricelist for "Agrolait" customer to give 40% discount. - !record {model: product.pricelist, id: agrolait_price_list1}: name: Price List For Agrolait @@ -86,28 +86,26 @@ items_id: - name: Agrolait Price List Version Rule min_quantity: 1 - base: 2 - price_surcharge: 100 -- - Now I check "PC4" public price is 1200. -- - !python {model: product.product}: | - prd_brw = self.browse(cr, uid, ref("product_product_pc4")) - assert prd_brw.list_price == 1200,"PC2 sale price is not 1200" + base: 1 + price_discount: -0.40 - I assing "Price List For Agrolait" to Agrolait. - !record {model: res.partner, id: base.res_partner_agrolait}: property_product_pricelist: agrolait_price_list1 - - I check sale price of PC4 is 900 for "Agrolait" customer. + I check 40% discount is given on sale price of product for "Agrolait" customer . - !python {model: product.pricelist}: | result = self.price_get_multi(cr, uid, [ref("product.agrolait_price_list1")], [(ref("product_product_pc4") ,5,ref("base.res_partner_agrolait"))]) + product_obj = self.pool.get("product.product") new_price = result[ref("product_product_pc4")].values() - assert new_price[0] == 900,"PC4 sale price is not 900 with Discount." + ctx = context.copy() + ctx.update({'pricelist': ref("product.agrolait_price_list1"), 'quantity': 1}) + product_price = product_obj.browse(cr, uid, ref("product_product_pc4"), context=ctx).price + assert new_price[0] == product_price,"40% discount is not given on sale price of product for Agrolait customer " - - I add supplier pricelist for product "PC1" for 10 Qty. + I add supplier pricelist for 10 qty product. - !record {model: product.supplierinfo, id: supplierinfo5}: pricelist_ids: From 96afba49bee207a6a26ab7f465a14c08ed2628a1 Mon Sep 17 00:00:00 2001 From: "Atik Agewan (OpenERP)" Date: Tue, 27 Dec 2011 16:22:58 +0530 Subject: [PATCH 10/17] [IMP] product:improve string bzr revid: aag@tinyerp.com-20111227105258-hj90d6o3pl8g1sq4 --- addons/product/test/product_price_list.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/product/test/product_price_list.yml b/addons/product/test/product_price_list.yml index 31be32d398e..773d8aa2a0b 100644 --- a/addons/product/test/product_price_list.yml +++ b/addons/product/test/product_price_list.yml @@ -76,7 +76,7 @@ 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 creat new pricelist for "Agrolait" customer to give 40% discount. + Now I create new pricelist for "Agrolait" customer to give 40% discount. - !record {model: product.pricelist, id: agrolait_price_list1}: name: Price List For Agrolait From 07b505211729e44bed874c67a71b6af352ce1c8f Mon Sep 17 00:00:00 2001 From: "Atik Agewan (OpenERP)" Date: Tue, 27 Dec 2011 17:52:15 +0530 Subject: [PATCH 11/17] [IMP] product:Optimize code bzr revid: aag@tinyerp.com-20111227122215-0nhphhqqf2oi3p4a --- addons/product/__openerp__.py | 7 ++++--- addons/product/test/product_price_list.yml | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/addons/product/__openerp__.py b/addons/product/__openerp__.py index 67f8589b474..e056e8b1264 100644 --- a/addons/product/__openerp__.py +++ b/addons/product/__openerp__.py @@ -61,9 +61,10 @@ Print product labels with barcode. 'partner_view.xml', 'process/product_process.xml' ], - 'test':['test/product_report.yml', - 'test/product_test.yml', - 'test/product_price_list.yml'], + 'test':['test/product_test.yml', + 'test/product_price_list.yml', + 'test/product_report.yml'], + 'installable': True, 'active': False, diff --git a/addons/product/test/product_price_list.yml b/addons/product/test/product_price_list.yml index 773d8aa2a0b..d47304e1b8e 100644 --- a/addons/product/test/product_price_list.yml +++ b/addons/product/test/product_price_list.yml @@ -13,7 +13,7 @@ - !python {model: product.pricelist}: | product_obj = self.pool.get("product.product") - result = self.price_get_multi(cr, uid, [ref("product.list0")], [(ref("product_product_pc1") ,5,ref("base.res_partner_desertic_hispafuentes"))]) + result = self.price_get_multi(cr, uid, [ref("product.list0")], [(ref("product_product_pc1") ,5,False)]) new_price = result[ref("product_product_pc1")].values() ctx = context.copy() ctx.update({'pricelist': ref("product.list0"), 'quantity': 5}) @@ -34,7 +34,7 @@ I check 20% discount is given on sale price of special product. - !python {model: product.pricelist}: | - result = self.price_get_multi(cr, uid, [ref("product.list0")], [(ref("product_product_pc2") ,5,ref("base.res_partner_desertic_hispafuentes"))]) + result = self.price_get_multi(cr, uid, [ref("product.list0")], [(ref("product_product_pc2") ,5,False)]) product_obj = self.pool.get("product.product") new_price = result[ref("product_product_pc2")].values() ctx = context.copy() @@ -68,7 +68,7 @@ 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"))]) + result = self.price_get_multi(cr, uid, [ref("product.list0")], [(ref("product_product_pc1") ,5,False)]) new_price = result[ref("product_product_pc1")].values() product_obj = self.pool.get("product.product") ctx = context.copy() From 5a5f1793e8f91e22b8026a67ed75183e9da3b917 Mon Sep 17 00:00:00 2001 From: "Atik Agewan (OpenERP)" Date: Tue, 27 Dec 2011 17:55:21 +0530 Subject: [PATCH 12/17] [IMP] product:change pricelist bzr revid: aag@tinyerp.com-20111227122521-bnkkl7eeyr3xz8od --- addons/product/test/product_price_list.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/product/test/product_price_list.yml b/addons/product/test/product_price_list.yml index d47304e1b8e..33cd1e9fd33 100644 --- a/addons/product/test/product_price_list.yml +++ b/addons/product/test/product_price_list.yml @@ -72,7 +72,7 @@ new_price = result[ref("product_product_pc1")].values() product_obj = self.pool.get("product.product") ctx = context.copy() - ctx.update({'pricelist': ref("product.product_price_list_end_year"), 'quantity': 1}) + ctx.update({'pricelist': ref("product.list0"), '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" - From fda056cc05564cbf26aa8f742c27f7ce6bd2a29e Mon Sep 17 00:00:00 2001 From: "Atik Agewan (OpenERP)" Date: Tue, 27 Dec 2011 18:03:03 +0530 Subject: [PATCH 13/17] [IMP] product: changes done in pricelist for special customer bzr revid: aag@tinyerp.com-20111227123303-r5b1mpvcc6osf4ts --- addons/product/test/product_price_list.yml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/addons/product/test/product_price_list.yml b/addons/product/test/product_price_list.yml index 33cd1e9fd33..ee643f9523f 100644 --- a/addons/product/test/product_price_list.yml +++ b/addons/product/test/product_price_list.yml @@ -76,34 +76,34 @@ 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 create new pricelist for "Agrolait" customer to give 40% discount. + Now I create new pricelist for special customer to give 40% discount. - - !record {model: product.pricelist, id: agrolait_price_list1}: - name: Price List For Agrolait + !record {model: product.pricelist, id: special_customer_price_list1}: + name: Price List For Special Customer type: sale version_id: - - name: Agrolait Price List Version + - name: Special Customer Price List Version items_id: - - name: Agrolait Price List Version Rule + - name: Special Customer Price List Version Rule min_quantity: 1 base: 1 price_discount: -0.40 - - I assing "Price List For Agrolait" to Agrolait. + I assing "Price List For Special Customer" to customer. - !record {model: res.partner, id: base.res_partner_agrolait}: - property_product_pricelist: agrolait_price_list1 + property_product_pricelist: special_customer_price_list1 - - I check 40% discount is given on sale price of product for "Agrolait" customer . + I check 40% discount is given on sale price of product for special customer. - !python {model: product.pricelist}: | - result = self.price_get_multi(cr, uid, [ref("product.agrolait_price_list1")], [(ref("product_product_pc4") ,5,ref("base.res_partner_agrolait"))]) + result = self.price_get_multi(cr, uid, [ref("product.special_customer_price_list1")], [(ref("product_product_pc4") ,5,ref("base.res_partner_agrolait"))]) product_obj = self.pool.get("product.product") new_price = result[ref("product_product_pc4")].values() ctx = context.copy() - ctx.update({'pricelist': ref("product.agrolait_price_list1"), 'quantity': 1}) + ctx.update({'pricelist': ref("product.special_customer_price_list1"), 'quantity': 1}) product_price = product_obj.browse(cr, uid, ref("product_product_pc4"), context=ctx).price - assert new_price[0] == product_price,"40% discount is not given on sale price of product for Agrolait customer " + assert new_price[0] == product_price,"40% discount is not given on sale price of product for special customer " - I add supplier pricelist for 10 qty product. - From 867270b78abb3e63a60b0e61d4f2c5385dd6bca2 Mon Sep 17 00:00:00 2001 From: "Atik Agewan (OpenERP)" Date: Tue, 27 Dec 2011 18:30:01 +0530 Subject: [PATCH 14/17] [IMP] product:special product category pricelist is added bzr revid: aag@tinyerp.com-20111227130001-8rm8chyikfrndx11 --- addons/product/test/product_price_list.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/addons/product/test/product_price_list.yml b/addons/product/test/product_price_list.yml index ee643f9523f..8606c92ad6b 100644 --- a/addons/product/test/product_price_list.yml +++ b/addons/product/test/product_price_list.yml @@ -41,6 +41,28 @@ 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 not given on sale price of special product" +- + For special product category pricelist,I make new rule in "Default Public Pricelist Version" if special category than give 25% Discount. +- + !record {model: product.pricelist.item, id: pricelist_rules_category_1}: + name: Default Public Pricelist for Category + min_quantity: 1 + categ_id: product.cat1 + sequence: 3 + base: 1 + price_version_id: product.ver0 + price_discount: -0.25 +- + I check 25% discount is given on sale price of special category product. +- + !python {model: product.pricelist}: | + result = self.price_get_multi(cr, uid, [ref("product.list0")], [(ref("product_product_fan2") ,5,False)]) + product_obj = self.pool.get("product.product") + new_price = result[ref("product_product_fan2")].values() + ctx = context.copy() + ctx.update({'pricelist': ref("product.list0"), 'quantity': 1}) + product_price = product_obj.browse(cr, uid, ref("product_product_fan2"), context=ctx).price + assert new_price[0] == product_price,"25% discount is not given on sale price of special category product." - Now I create new pricelist for end of yearto give 30% discount. - From dc1fa506cade037b9c1b06ee2e72edf5ce2b3d90 Mon Sep 17 00:00:00 2001 From: "Atik Agewan (OpenERP)" Date: Tue, 27 Dec 2011 18:46:07 +0530 Subject: [PATCH 15/17] [IMP] product: Improve string bzr revid: aag@tinyerp.com-20111227131607-a3jqrj9w5bl2k2c1 --- addons/product/test/product_price_list.yml | 26 +++++----------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/addons/product/test/product_price_list.yml b/addons/product/test/product_price_list.yml index 8606c92ad6b..9566d9c295b 100644 --- a/addons/product/test/product_price_list.yml +++ b/addons/product/test/product_price_list.yml @@ -1,5 +1,5 @@ - - In order to test product pricelist, I make new rule in "Default Public Pricelist Version" if product qty >= 5 than give discount 10% per qty. + I create a price list rule for more qty product and check whether it gives the correct price or not. - !record {model: product.pricelist.item, id: pricelist_rules_for_more_qty1}: name: Default Public Pricelist for More Qty @@ -8,8 +8,6 @@ base: 1 price_version_id: product.ver0 price_discount: -0.10 -- - I check 10% discount is given on sale price of 5 qty product. - !python {model: product.pricelist}: | product_obj = self.pool.get("product.product") @@ -20,7 +18,7 @@ product_price = product_obj.browse(cr, uid, ref("product_product_pc1"), context=ctx).price 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. + I create a price list rule for a specific product and check whether it gives the correct price or not. - !record {model: product.pricelist.item, id: pricelist_rules_for_pc2}: name: Default Public Pricelist for PC2 @@ -30,8 +28,6 @@ base: 1 price_version_id: product.ver0 price_discount: -0.20 -- - I check 20% discount is given on sale price of special product. - !python {model: product.pricelist}: | result = self.price_get_multi(cr, uid, [ref("product.list0")], [(ref("product_product_pc2") ,5,False)]) @@ -42,7 +38,7 @@ product_price = product_obj.browse(cr, uid, ref("product_product_pc2"), context=ctx).price assert new_price[0] == product_price,"20% discount is not given on sale price of special product" - - For special product category pricelist,I make new rule in "Default Public Pricelist Version" if special category than give 25% Discount. + I create a price list rule for a specific category and check whether it gives the correct price or not. - !record {model: product.pricelist.item, id: pricelist_rules_category_1}: name: Default Public Pricelist for Category @@ -52,8 +48,6 @@ base: 1 price_version_id: product.ver0 price_discount: -0.25 -- - I check 25% discount is given on sale price of special category product. - !python {model: product.pricelist}: | result = self.price_get_multi(cr, uid, [ref("product.list0")], [(ref("product_product_fan2") ,5,False)]) @@ -64,7 +58,7 @@ product_price = product_obj.browse(cr, uid, ref("product_product_fan2"), context=ctx).price assert new_price[0] == product_price,"25% discount is not given on sale price of special category product." - - Now I create new pricelist for end of yearto give 30% discount. + I create a price list for end of year and check whether it gives the correct price or not. - !record {model: product.pricelist, id: product_price_list_end_year}: name: End of Years Price List @@ -76,8 +70,6 @@ min_quantity: 1 base: 1 price_discount: -0.30 -- - For end of year pricelist,I make new rule in "Default Public Pricelist Version" to give 30% discount. - !record {model: product.pricelist.item, id: pricelist_rules_for_end_year1}: name: End of Years Price List Version Rule - Public Pricelist @@ -86,8 +78,6 @@ base: -1 price_version_id: product.ver0 base_pricelist_id: product_price_list_end_year -- - 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,False)]) @@ -98,7 +88,7 @@ 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 create new pricelist for special customer to give 40% discount. + I create a price list for special customer and check whether it gives the correct price or not. - !record {model: product.pricelist, id: special_customer_price_list1}: name: Price List For Special Customer @@ -110,13 +100,9 @@ min_quantity: 1 base: 1 price_discount: -0.40 -- - I assing "Price List For Special Customer" to customer. - !record {model: res.partner, id: base.res_partner_agrolait}: property_product_pricelist: special_customer_price_list1 -- - I check 40% discount is given on sale price of product for special customer. - !python {model: product.pricelist}: | result = self.price_get_multi(cr, uid, [ref("product.special_customer_price_list1")], [(ref("product_product_pc4") ,5,ref("base.res_partner_agrolait"))]) @@ -127,7 +113,7 @@ product_price = product_obj.browse(cr, uid, ref("product_product_pc4"), context=ctx).price assert new_price[0] == product_price,"40% discount is not given on sale price of product for special customer " - - I add supplier pricelist for 10 qty product. + I add supplier pricelist. - !record {model: product.supplierinfo, id: supplierinfo5}: pricelist_ids: From 63e7a6465e968e21ce00ef67f028865e87d56034 Mon Sep 17 00:00:00 2001 From: "Ujjvala Collins (OpenERP)" Date: Wed, 28 Dec 2011 12:30:31 +0530 Subject: [PATCH 16/17] [IMP] product: Improved yml for pricelist. bzr revid: uco@tinyerp.com-20111228070031-6hgd7pc2iluo6kqr --- addons/product/test/product_price_list.yml | 42 ++++++++++++++-------- 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/addons/product/test/product_price_list.yml b/addons/product/test/product_price_list.yml index 9566d9c295b..446e8adc6d6 100644 --- a/addons/product/test/product_price_list.yml +++ b/addons/product/test/product_price_list.yml @@ -1,5 +1,7 @@ - - I create a price list rule for more qty product and check whether it gives the correct price or not. + In order to check the calculation of price of the products according to selected pricelist, +- + I create a pricelist rule for giving discount on some quantities of product. - !record {model: product.pricelist.item, id: pricelist_rules_for_more_qty1}: name: Default Public Pricelist for More Qty @@ -8,6 +10,8 @@ base: 1 price_version_id: product.ver0 price_discount: -0.10 +- + I check whether the product consumes the price, based on the given quantities, correctly or not. - !python {model: product.pricelist}: | product_obj = self.pool.get("product.product") @@ -16,9 +20,9 @@ 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 not given on sale price of 5 qty product" + assert new_price[0] == product_price,"Discount is not given on price of the product." - - I create a price list rule for a specific product and check whether it gives the correct price or not. + I create a pricelist rule to give discount for a specific product. - !record {model: product.pricelist.item, id: pricelist_rules_for_pc2}: name: Default Public Pricelist for PC2 @@ -28,17 +32,19 @@ base: 1 price_version_id: product.ver0 price_discount: -0.20 +- + I check whether the selected product is having the price correctly or not. - !python {model: product.pricelist}: | - result = self.price_get_multi(cr, uid, [ref("product.list0")], [(ref("product_product_pc2") ,5,False)]) + result = self.price_get_multi(cr, uid, [ref("product.list0")], [(ref("product_product_pc2"),1,False)]) product_obj = self.pool.get("product.product") new_price = result[ref("product_product_pc2")].values() 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 not given on sale price of special product" + assert new_price[0] == product_price,"Discount is not given on price of the special product." - - I create a price list rule for a specific category and check whether it gives the correct price or not. + I create a pricelist rule to give discount for a specific category of products. - !record {model: product.pricelist.item, id: pricelist_rules_category_1}: name: Default Public Pricelist for Category @@ -48,17 +54,19 @@ base: 1 price_version_id: product.ver0 price_discount: -0.25 +- + I check whether the price of products of selected product category is correctly set or not. - !python {model: product.pricelist}: | - result = self.price_get_multi(cr, uid, [ref("product.list0")], [(ref("product_product_fan2") ,5,False)]) + result = self.price_get_multi(cr, uid, [ref("product.list0")], [(ref("product_product_fan2"),1,False)]) product_obj = self.pool.get("product.product") new_price = result[ref("product_product_fan2")].values() ctx = context.copy() ctx.update({'pricelist': ref("product.list0"), 'quantity': 1}) product_price = product_obj.browse(cr, uid, ref("product_product_fan2"), context=ctx).price - assert new_price[0] == product_price,"25% discount is not given on sale price of special category product." + assert new_price[0] == product_price,"Discount is not given on price of the special category of products." - - I create a price list for end of year and check whether it gives the correct price or not. + I create a pricelist to give the discount at the end of year. - !record {model: product.pricelist, id: product_price_list_end_year}: name: End of Years Price List @@ -78,17 +86,19 @@ base: -1 price_version_id: product.ver0 base_pricelist_id: product_price_list_end_year +- + Now, I check that the end of the year pricelist rule is applied on products. - !python {model: product.pricelist}: | - result = self.price_get_multi(cr, uid, [ref("product.list0")], [(ref("product_product_pc1") ,5,False)]) + result = self.price_get_multi(cr, uid, [ref("product.list0")], [(ref("product_product_pc1"),1,False)]) new_price = result[ref("product_product_pc1")].values() product_obj = self.pool.get("product.product") ctx = context.copy() ctx.update({'pricelist': ref("product.list0"), '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" + assert new_price[0] == product_price,"Discount is not given on price of product at the end of the year." - - I create a price list for special customer and check whether it gives the correct price or not. + I create a pricelist for special customers by which they can get discount on products. - !record {model: product.pricelist, id: special_customer_price_list1}: name: Price List For Special Customer @@ -103,17 +113,19 @@ - !record {model: res.partner, id: base.res_partner_agrolait}: property_product_pricelist: special_customer_price_list1 +- + I check that the customer is getting the discount according to the pricelist. - !python {model: product.pricelist}: | - result = self.price_get_multi(cr, uid, [ref("product.special_customer_price_list1")], [(ref("product_product_pc4") ,5,ref("base.res_partner_agrolait"))]) + result = self.price_get_multi(cr, uid, [ref("product.special_customer_price_list1")], [(ref("product_product_pc4"),1,ref("base.res_partner_agrolait"))]) product_obj = self.pool.get("product.product") new_price = result[ref("product_product_pc4")].values() ctx = context.copy() ctx.update({'pricelist': ref("product.special_customer_price_list1"), 'quantity': 1}) product_price = product_obj.browse(cr, uid, ref("product_product_pc4"), context=ctx).price - assert new_price[0] == product_price,"40% discount is not given on sale price of product for special customer " + assert new_price[0] == product_price,"Discount is not given to special customer." - - I add supplier pricelist. + I set the supplier pricelist for a product to get the discount at the time of purchase. - !record {model: product.supplierinfo, id: supplierinfo5}: pricelist_ids: From 9f2513187068b61588f857e55b16d48ba3ecc153 Mon Sep 17 00:00:00 2001 From: "Ujjvala Collins (OpenERP)" Date: Wed, 28 Dec 2011 14:19:12 +0530 Subject: [PATCH 17/17] [IMP] product: Some more improvements. bzr revid: uco@tinyerp.com-20111228084912-bn67ngyu6950u108 --- addons/product/test/product_price_list.yml | 42 +++++++++------------- 1 file changed, 17 insertions(+), 25 deletions(-) diff --git a/addons/product/test/product_price_list.yml b/addons/product/test/product_price_list.yml index 446e8adc6d6..d773f6f01ba 100644 --- a/addons/product/test/product_price_list.yml +++ b/addons/product/test/product_price_list.yml @@ -3,23 +3,19 @@ - I create a pricelist rule for giving discount on some quantities of product. - - !record {model: product.pricelist.item, id: pricelist_rules_for_more_qty1}: + !record {model: product.pricelist.item, id: item0}: name: Default Public Pricelist for More Qty - min_quantity: 5 - sequence: 5 - base: 1 - price_version_id: product.ver0 + min_quantity: 15 price_discount: -0.10 - I check whether the product consumes the price, based on the given quantities, correctly or not. - !python {model: product.pricelist}: | product_obj = self.pool.get("product.product") - result = self.price_get_multi(cr, uid, [ref("product.list0")], [(ref("product_product_pc1") ,5,False)]) + result = self.price_get_multi(cr, uid, [ref("product.list0")], [(ref("product_product_pc1"),15,False)]) new_price = result[ref("product_product_pc1")].values() - 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 + context.update({'pricelist': ref("product.list0"), 'quantity': 15}) + product_price = product_obj.browse(cr, uid, ref("product_product_pc1"), context=context).price assert new_price[0] == product_price,"Discount is not given on price of the product." - I create a pricelist rule to give discount for a specific product. @@ -29,7 +25,7 @@ min_quantity: 1 product_id: product.product_product_pc2 sequence: 4 - base: 1 + base: !eval (ref('product.list_price')) price_version_id: product.ver0 price_discount: -0.20 - @@ -39,9 +35,8 @@ result = self.price_get_multi(cr, uid, [ref("product.list0")], [(ref("product_product_pc2"),1,False)]) product_obj = self.pool.get("product.product") new_price = result[ref("product_product_pc2")].values() - 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 + context.update({'pricelist': ref("product.list0"), 'quantity': 1}) + product_price = product_obj.browse(cr, uid, ref("product_product_pc2"), context=context).price assert new_price[0] == product_price,"Discount is not given on price of the special product." - I create a pricelist rule to give discount for a specific category of products. @@ -51,7 +46,7 @@ min_quantity: 1 categ_id: product.cat1 sequence: 3 - base: 1 + base: !eval (ref('product.list_price')) price_version_id: product.ver0 price_discount: -0.25 - @@ -61,9 +56,8 @@ result = self.price_get_multi(cr, uid, [ref("product.list0")], [(ref("product_product_fan2"),1,False)]) product_obj = self.pool.get("product.product") new_price = result[ref("product_product_fan2")].values() - ctx = context.copy() - ctx.update({'pricelist': ref("product.list0"), 'quantity': 1}) - product_price = product_obj.browse(cr, uid, ref("product_product_fan2"), context=ctx).price + context.update({'pricelist': ref("product.list0"), 'quantity': 1}) + product_price = product_obj.browse(cr, uid, ref("product_product_fan2"), context=context).price assert new_price[0] == product_price,"Discount is not given on price of the special category of products." - I create a pricelist to give the discount at the end of year. @@ -76,7 +70,7 @@ items_id: - name: End of Years Price List Version Rule min_quantity: 1 - base: 1 + base: !eval (ref('product.list_price')) price_discount: -0.30 - !record {model: product.pricelist.item, id: pricelist_rules_for_end_year1}: @@ -93,9 +87,8 @@ result = self.price_get_multi(cr, uid, [ref("product.list0")], [(ref("product_product_pc1"),1,False)]) new_price = result[ref("product_product_pc1")].values() product_obj = self.pool.get("product.product") - ctx = context.copy() - ctx.update({'pricelist': ref("product.list0"), 'quantity': 1}) - product_price = product_obj.browse(cr, uid, ref("product_product_pc1"), context=ctx).price + context.update({'pricelist': ref("product.list0"), 'quantity': 1}) + product_price = product_obj.browse(cr, uid, ref("product_product_pc1"), context=context).price assert new_price[0] == product_price,"Discount is not given on price of product at the end of the year." - I create a pricelist for special customers by which they can get discount on products. @@ -108,7 +101,7 @@ items_id: - name: Special Customer Price List Version Rule min_quantity: 1 - base: 1 + base: !eval (ref('product.list_price')) price_discount: -0.40 - !record {model: res.partner, id: base.res_partner_agrolait}: @@ -120,9 +113,8 @@ result = self.price_get_multi(cr, uid, [ref("product.special_customer_price_list1")], [(ref("product_product_pc4"),1,ref("base.res_partner_agrolait"))]) product_obj = self.pool.get("product.product") new_price = result[ref("product_product_pc4")].values() - ctx = context.copy() - ctx.update({'pricelist': ref("product.special_customer_price_list1"), 'quantity': 1}) - product_price = product_obj.browse(cr, uid, ref("product_product_pc4"), context=ctx).price + context.update({'pricelist': ref("product.special_customer_price_list1"), 'quantity': 1}) + product_price = product_obj.browse(cr, uid, ref("product_product_pc4"), context=context).price assert new_price[0] == product_price,"Discount is not given to special customer." - I set the supplier pricelist for a product to get the discount at the time of purchase.