[WIP] stock: added supply_method 'None'
authorQuentin (OpenERP) <qdp-launchpad@openerp.com>
Fri, 12 Jul 2013 16:31:24 +0000 (18:31 +0200)
committerQuentin (OpenERP) <qdp-launchpad@openerp.com>
Fri, 12 Jul 2013 16:31:24 +0000 (18:31 +0200)
bzr revid: qdp-launchpad@openerp.com-20130712163124-w3eac1coevpqfp9q

addons/procurement/procurement.py
addons/stock/procurement.py
addons/stock/stock.py

index 3964103..e8a693b 100644 (file)
@@ -77,7 +77,7 @@ class procurement_rule(osv.osv):
             help="This field will fill the packing origin and the name of its moves"),
         'group_id': fields.many2one('procurement.group', 'Procurement Group'),
         'action': fields.selection(selection=lambda s, cr, uid, context=None: s._get_action(cr, uid, context=context),
-            string='Action', required=True)
+            string='Action', required=True),
     }
 
 
index 6b68fdf..f5557b2 100644 (file)
@@ -55,11 +55,11 @@ class procurement_order(osv.osv):
         return self.pool.get('procurement.rule').search(cr, uid, domain, context=context)
 
     def _find_suitable_rule(self, cr, uid, procurement, context=None):
-        res = super(procurement_order, self)._find_suitable_rule(cr, uid, procurement, context=context)
+        rule_id = super(procurement_order, self)._find_suitable_rule(cr, uid, procurement, context=context)
         if not res:
-            res = self._search_suitable_rule(cr, uid, procurement, [('action', '=', 'move'), ('location_id', '=', procurement.location_id.id)], context=context)
-            res = res and res[0] or False
-        return res
+            rule_id = self._search_suitable_rule(cr, uid, procurement, [('action', '=', 'move'), ('location_id', '=', procurement.location_id.id)], context=context)
+            rule_id = rule_id and rule_id[0] or False
+        return rule_id
 
     def _run_move_create(self, cr, uid, procurement, context=None):
         return {
index 7f06c56..c49fc6c 100644 (file)
@@ -2514,7 +2514,7 @@ class product_template(osv.osv):
     _inherit = "product.template"
     _columns = {
         'type': fields.selection([('product', 'Stockable Product'), ('consu', 'Consumable'), ('service', 'Service')], 'Product Type', required=True, help="Consumable: Will not imply stock management for this product. \nStockable product: Will imply stock management for this product."),
-        'supply_method': fields.selection([('produce', 'Manufacture'), ('buy', 'Buy')], 'Supply Method', required=True, help="Manufacture: When procuring the product, a manufacturing order or a task will be generated, depending on the product type. \nBuy: When procuring the product, a purchase order will be generated."),
+        'supply_method': fields.selection([('produce', 'Manufacture'), ('buy', 'Buy'), ('wait', 'None')], 'Supply Method', required=True, help="Manufacture: When procuring the product, a manufacturing order or a task will be generated, depending on the product type. \nBuy: When procuring the product, a purchase order will be generated."),
     }
     _defaults = {
         'supply_method': 'buy',