Correct comments + add unit test

This commit is contained in:
Matthieu Dietrich
2014-10-08 11:16:51 +02:00
parent e3b3c5d806
commit d8be2f47c4
4 changed files with 43 additions and 9 deletions

View File

@@ -20,7 +20,7 @@
##############################################################################
{'name': 'Order point generator',
'summary': 'Configuration of order point in mass',
'summary': 'Mass configuration of stock order points',
'version': '1.0',
'author': 'Camptocamp',
'category': 'Warehouse',
@@ -32,7 +32,7 @@
Order point generator
=====================
Add a wizard to configure massively order points for multiple products.
Add a wizard to configure order points for multiple products in one go.
Contributors
------------
@@ -41,12 +41,11 @@ Contributors
* Matthieu Dietrich <matthieu.dietrich@camptocamp.com>
""",
'website': 'http://www.openerp.com',
'demo': [],
'data': ["wizard/orderpoint_generator_view.xml",
"security/ir.model.access.csv",
],
'test': [],
'test': ['test/orderpoint_generator.yml'],
'installable': True,
'auto_install': False,
}

View File

@@ -62,7 +62,7 @@ class BaseProductConfigTemplate():
product_ids = [product_ids]
# not using self.copy_data(cr, uid, template_br.id, context=context)
# as copy data will not work in all case and may retrieve erronus value
# as copy data will not work in all case and may return erroneous value
model_obj = self._get_model()

View File

@@ -28,13 +28,13 @@ from base_product_config_template import BaseProductConfigTemplate
class OrderpointTemplate(BaseProductConfigTemplate, Model):
""" Template for orderpoints
Here we use same model as stock.warhouse.orderpoint but set product_id
Here we use same model as stock.warehouse.orderpoint but set product_id
as non mandatory as we cannot remove it. This field will be ignored.
This has the advantage to ensure orderpoint and orderpoint template have
same fields.
This has the advantage the advantage of ensuring that the order point
and the order point template have the same fields.
_table is redifined to separate templates from orderpoints
_table is redefined to separate templates from orderpoints
"""
_name = 'stock.warehouse.orderpoint.template'

View File

@@ -0,0 +1,35 @@
-
To test the orderpoint generator, I first create a template to apply.
-
I check that no orderpoint was created for the product
-
!python {model: stock.warehouse.orderpoint}: |
orderpoint_ids = self.search(cr, uid, [('product_id','=', ref('product.product_product_32')),
('name', '=', 'OP/000445')])
assert len(orderpoint_ids) == 0, 'Orderpoint already created for product'
-
I create the template
-
!record {model: stock.warehouse.orderpoint.template, id: stock_warehouse_orderpoint_template_op0}:
company_id: base.main_company
location_id: stock.stock_location_stock
logic: max
name: OP/000445
product_max_qty: 15.0
product_min_qty: 5.0
product_uom: product.product_uom_unit
qty_multiple: 1
warehouse_id: stock.warehouse0
-
I apply the template to a product.
-
!python {model: stock.warehouse.orderpoint.generator}: |
wizard = self.create(cr, uid, {'orderpoint_template_id': [(6, 0, [ref('stock_warehouse_orderpoint_template_op0')])]})
self.action_configure(cr, uid, wizard, context={'active_ids': [ref('product.product_product_32')]})
-
I check that a new orderpoint was created for the product
-
!python {model: stock.warehouse.orderpoint}: |
orderpoint_ids = self.search(cr, uid, [('product_id','=', ref('product.product_product_32')),
('name', '=', 'OP/000445')])
assert len(orderpoint_ids) > 0, 'Orderpoint not created for product'