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

Requested reviews:
  Atik Agewan(OpenERP) (aag-openerp)
  Ujjvala Collins (OpenERP) (uco-openerp)
  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 13:30:32 +0000
@@ -61,7 +61,11 @@
         'partner_view.xml',
         'process/product_process.xml'
     ],
-    'test':['test/product_report.yml','test/product_test.yml'],
+    'test':['test/product_test.yml',
+            'test/product_price_list.yml',
+            'test/product_report.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 13:30:32 +0000
@@ -0,0 +1,122 @@
+-
+  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
+    min_quantity: 5
+    sequence: 5
+    base: 1
+    price_version_id: product.ver0
+    price_discount: -0.10
+-
+  !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)])
+    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"
+-
+  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
+    min_quantity: 1
+    product_id: product.product_product_pc2
+    sequence: 4
+    base: 1
+    price_version_id: product.ver0
+    price_discount: -0.20
+-
+  !python {model: product.pricelist}: |
+    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()
+    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"
+-
+  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
+    min_quantity: 1
+    categ_id: product.cat1
+    sequence: 3
+    base: 1
+    price_version_id: product.ver0
+    price_discount: -0.25
+-
+  !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."
+-
+  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
+    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
+-
+  !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
+-
+  !python {model: product.pricelist}: |
+    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()
+    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"
+-
+  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
+    type: sale
+    version_id:
+      -  name: Special Customer Price List Version
+         items_id:
+           -  name: Special Customer Price List Version Rule
+              min_quantity: 1
+              base: 1
+              price_discount: -0.40
+-
+  !record {model: res.partner, id: base.res_partner_agrolait}:
+    property_product_pricelist: special_customer_price_list1
+-
+  !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"))])
+    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 "
+-
+  I add supplier pricelist.
+-
+  !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