Atik Agewan(OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-product-test-yml-aag into 
lp:openobject-addons.

Requested reviews:
  OpenERP Core Team (openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-product-test-yml-aag/+merge/86941



   Hello,
  
     Product: add yml to cover pricelist functionality as bellowe.
             - Discount in more qty.
             - Discount in end of year.
             - Discount for special customer
             - Discount on special product.
             - Add pricelistfor suppliers.
             

   Thanks,
    Atik

-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-product-test-yml-aag/+merge/86941
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-product-test-yml-aag.
=== modified file 'product/__openerp__.py'
--- product/__openerp__.py	2011-12-19 16:54:40 +0000
+++ product/__openerp__.py	2011-12-27 11:03:26 +0000
@@ -61,7 +61,10 @@
         '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',

=== added file 'product/test/product_price_list.yml'
--- product/test/product_price_list.yml	1970-01-01 00:00:00 +0000
+++ product/test/product_price_list.yml	2011-12-27 11:03:26 +0000
@@ -0,0 +1,114 @@
+-
+  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: 5
+    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")
+    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()
+    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"
+-
+  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: 4
+    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,ref("base.res_partner_desertic_hispafuentes"))])
+    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"
+-
+  Now I create new pricelist for end of yearto give 30% discount.
+-
+  !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
+-
+  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
+    min_quantity: 1
+    sequence: 2
+    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,ref("base.res_partner_desertic_hispafuentes"))])
+    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})
+    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.
+-
+  !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: 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 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()
+    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 10 qty product.
+-
+  !record {model: product.supplierinfo, id: supplierinfo5}:
+    pricelist_ids:
+      -  min_quantity: 10
+         price: 200
+    

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to