@@ -950,20 +950,7 @@
-
- product.normal.form.mrp.inherit
- product.product
-
-
-
- False
-
-
-
- Here should come some help about manufacturing routes
-
-
-
+
diff --git a/addons/mrp/procurement.py b/addons/mrp/procurement.py
index be19980ff24..4971d849227 100644
--- a/addons/mrp/procurement.py
+++ b/addons/mrp/procurement.py
@@ -44,9 +44,8 @@ class procurement_order(osv.osv):
rule_id = super(procurement_order, self)._find_suitable_rule(cr, uid, procurement, context=context)
if not rule_id:
#if there isn't any specific procurement.rule defined for the product, we try to directly supply it from a supplier
- if procurement.product_id.supply_method == 'manufacture':
- rule_id = self._search_suitable_rule(cr, uid, procurement, [('action', '=', 'manufacture'), ('location_id', '=', procurement.location_id.id)], context=context)
- rule_id = rule_id and rule_id[0] or False
+ rule_id = self._search_suitable_rule(cr, uid, procurement, [('action', '=', 'manufacture'), ('location_id', '=', procurement.location_id.id)], context=context)
+ rule_id = rule_id and rule_id[0] or False
return rule_id
def _run(self, cr, uid, procurement, context=None):
@@ -92,7 +91,7 @@ class procurement_order(osv.osv):
def get_phantom_bom_id(self, cr, uid, ids, context=None):
for procurement in self.browse(cr, uid, ids, context=context):
- if procurement.move_dest_id and procurement.move_dest_id.product_id.supply_method=='produce':
+ if procurement.move_dest_id:
phantom_bom_id = self.pool.get('mrp.bom').search(cr, uid, [
('product_id', '=', procurement.move_dest_id.product_id.id),
('bom_id', '=', False),
diff --git a/addons/mrp/stock.py b/addons/mrp/stock.py
index 476d8d00410..dc331f79f81 100644
--- a/addons/mrp/stock.py
+++ b/addons/mrp/stock.py
@@ -41,57 +41,57 @@ class StockMove(osv.osv):
procurement_obj = self.pool.get('procurement.order')
product_obj = self.pool.get('product.product')
processed_ids = [move.id]
- if move.product_id.supply_method == 'produce':
- bis = bom_obj.search(cr, uid, [
- ('product_id','=',move.product_id.id),
- ('bom_id','=',False),
- ('type','=','phantom')])
- if bis:
- factor = move.product_qty
- bom_point = bom_obj.browse(cr, uid, bis[0], context=context)
- res = bom_obj._bom_explode(cr, uid, bom_point, factor, [])
- state = 'confirmed'
- if move.state == 'assigned':
- state = 'assigned'
- for line in res[0]:
- valdef = {
- 'picking_id': move.picking_id.id,
- 'product_id': line['product_id'],
- 'product_uom': line['product_uom'],
- 'product_qty': line['product_qty'],
- 'product_uos': line['product_uos'],
- 'product_uos_qty': line['product_uos_qty'],
- 'move_dest_id': move.id,
- 'state': state,
- 'name': line['name'],
- 'procurements': [],
- }
- mid = move_obj.copy(cr, uid, move.id, default=valdef)
- processed_ids.append(mid)
- prodobj = product_obj.browse(cr, uid, line['product_id'], context=context)
- proc_id = procurement_obj.create(cr, uid, {
- 'name': (move.picking_id.origin or ''),
- 'origin': (move.picking_id.origin or ''),
- 'date_planned': move.date,
- 'product_id': line['product_id'],
- 'product_qty': line['product_qty'],
- 'product_uom': line['product_uom'],
- 'product_uos_qty': line['product_uos'] and line['product_uos_qty'] or False,
- 'product_uos': line['product_uos'],
- 'location_id': move.location_id.id,
- 'procure_method': prodobj.procure_method,
- 'move_id': mid,
- })
- procurement_obj.signal_button_confirm(cr, uid, [proc_id])
-
- move_obj.write(cr, uid, [move.id], {
- 'location_dest_id': move.location_id.id, # dummy move for the kit
- 'picking_id': False,
- 'state': 'confirmed'
+
+ bis = bom_obj.search(cr, uid, [
+ ('product_id','=',move.product_id.id),
+ ('bom_id','=',False),
+ ('type','=','phantom')])
+ if bis:
+ factor = move.product_qty
+ bom_point = bom_obj.browse(cr, uid, bis[0], context=context)
+ res = bom_obj._bom_explode(cr, uid, bom_point, factor, [])
+ state = 'confirmed'
+ if move.state == 'assigned':
+ state = 'assigned'
+ for line in res[0]:
+ valdef = {
+ 'picking_id': move.picking_id.id,
+ 'product_id': line['product_id'],
+ 'product_uom': line['product_uom'],
+ 'product_qty': line['product_qty'],
+ 'product_uos': line['product_uos'],
+ 'product_uos_qty': line['product_uos_qty'],
+ 'move_dest_id': move.id,
+ 'state': state,
+ 'name': line['name'],
+ 'procurements': [],
+ }
+ mid = move_obj.copy(cr, uid, move.id, default=valdef)
+ processed_ids.append(mid)
+ prodobj = product_obj.browse(cr, uid, line['product_id'], context=context)
+ proc_id = procurement_obj.create(cr, uid, {
+ 'name': (move.picking_id.origin or ''),
+ 'origin': (move.picking_id.origin or ''),
+ 'date_planned': move.date,
+ 'product_id': line['product_id'],
+ 'product_qty': line['product_qty'],
+ 'product_uom': line['product_uom'],
+ 'product_uos_qty': line['product_uos'] and line['product_uos_qty'] or False,
+ 'product_uos': line['product_uos'],
+ 'location_id': move.location_id.id,
+ 'procure_method': prodobj.procure_method,
+ 'move_id': mid,
})
- procurement_ids = procurement_obj.search(cr, uid, [('move_id','=',move.id)], context)
- procurement_obj.signal_button_confirm(cr, uid, procurement_ids)
- procurement_obj.signal_button_wait_done(cr, uid, procurement_ids)
+ procurement_obj.signal_button_confirm(cr, uid, [proc_id])
+
+ move_obj.write(cr, uid, [move.id], {
+ 'location_dest_id': move.location_id.id, # dummy move for the kit
+ 'picking_id': False,
+ 'state': 'confirmed'
+ })
+ procurement_ids = procurement_obj.search(cr, uid, [('move_id','=',move.id)], context)
+ procurement_obj.signal_button_confirm(cr, uid, procurement_ids)
+ procurement_obj.signal_button_wait_done(cr, uid, procurement_ids)
return processed_ids
def action_consume(self, cr, uid, ids, product_qty, location_id=False, context=None):
diff --git a/addons/multi_company/multi_company_demo.xml b/addons/multi_company/multi_company_demo.xml
index c772a8fd67d..bf543df58c2 100644
--- a/addons/multi_company/multi_company_demo.xml
+++ b/addons/multi_company/multi_company_demo.xml
@@ -150,7 +150,6 @@
ODOO
- produce
35.0
10.0
diff --git a/addons/product_expiry/product_expiry_demo.xml b/addons/product_expiry/product_expiry_demo.xml
index b644671a215..ce586587ff2 100644
--- a/addons/product_expiry/product_expiry_demo.xml
+++ b/addons/product_expiry/product_expiry_demo.xml
@@ -2,7 +2,6 @@
- buy
7.0
5.0
@@ -32,7 +31,6 @@
- buy
8.0
6.0
@@ -62,7 +60,6 @@
- buy
8.0
6.0
@@ -92,7 +89,6 @@
- buy
8.0
6.0
diff --git a/addons/project_mrp/project_mrp_view.xml b/addons/project_mrp/project_mrp_view.xml
index 302225a24ec..ebd212fbd48 100644
--- a/addons/project_mrp/project_mrp_view.xml
+++ b/addons/project_mrp/project_mrp_view.xml
@@ -41,16 +41,6 @@
-
- product.normal.form.project_mrp.inherit
- product.product
-
-
-
- False
-
-
-
diff --git a/addons/project_timesheet/test/worktask_entry_to_timesheetline_entry.yml b/addons/project_timesheet/test/worktask_entry_to_timesheetline_entry.yml
index 2d95eb89d71..a78a7e040b5 100644
--- a/addons/project_timesheet/test/worktask_entry_to_timesheetline_entry.yml
+++ b/addons/project_timesheet/test/worktask_entry_to_timesheetline_entry.yml
@@ -16,7 +16,6 @@
mes_type: fixed
name: HR Manager
standard_price: 1.0
- supply_method: buy
type: service
uom_id: product.product_uom_hour
uom_po_id: product.product_uom_hour
diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py
index 3b0f638263d..f9fa7e96964 100644
--- a/addons/purchase/purchase.py
+++ b/addons/purchase/purchase.py
@@ -1122,9 +1122,8 @@ class procurement_order(osv.osv):
rule_id = super(procurement_order, self)._find_suitable_rule(cr, uid, procurement, context=context)
if not rule_id:
#if there isn't any specific procurement.rule defined for the product, we try to directly supply it from a supplier
- if procurement.product_id.supply_method == 'buy' and self._check_supplier_info(cr, uid, [procurement.id], context=context):
- rule_id = self._search_suitable_rule(cr, uid, procurement, [('action', '=', 'buy'), ('location_id', '=', procurement.location_id.id)], context=context)
- rule_id = rule_id and rule_id[0] or False
+ rule_id = self._search_suitable_rule(cr, uid, procurement, [('action', '=', 'buy'), ('location_id', '=', procurement.location_id.id)], context=context)
+ rule_id = rule_id and rule_id[0] or False
return rule_id
def _run(self, cr, uid, procurement, context=None):
diff --git a/addons/purchase/purchase_data.xml b/addons/purchase/purchase_data.xml
index 01b2e750424..280f503a431 100644
--- a/addons/purchase/purchase_data.xml
+++ b/addons/purchase/purchase_data.xml
@@ -67,14 +67,20 @@
+
+ Buy
+ 5
+
+
- Buy to refill stock
+ Buy to stock
buy
+
diff --git a/addons/purchase/purchase_view.xml b/addons/purchase/purchase_view.xml
index cb8e6b66913..5e520537d79 100644
--- a/addons/purchase/purchase_view.xml
+++ b/addons/purchase/purchase_view.xml
@@ -573,18 +573,6 @@
-
- product.normal.form.procurement.help.inherit
- product.product
-
-
-
-
- Procurement help
-
-
-
-
product.search.purchase.form
product.product
diff --git a/addons/purchase/test/process/run_scheduler.yml b/addons/purchase/test/process/run_scheduler.yml
index b743ede864e..268c8a3b263 100644
--- a/addons/purchase/test/process/run_scheduler.yml
+++ b/addons/purchase/test/process/run_scheduler.yml
@@ -1,14 +1,18 @@
-
In order to test the scheduler to generate RFQ, I create a new product
-
- !record {model: product.product, id: scheduler_product}:
- name: scheduler prod
- type: product
- supply_method: buy
- seller_ids:
- - delay: 1
- name: base.res_partner_2
- min_qty: 5.0
+ !record {model: product.product, id: scheduler_product}:
+ name: scheduler prod
+ type: product
+ seller_ids:
+ - delay: 1
+ name: base.res_partner_2
+ min_qty: 5.0
+-
+ Add Buy route
+-
+ !python {model: product.product, id: scheduler_product}: |
+ self.write(cr, uid, [ref("scheduler_product")], {"route_ids": [(4, ref("purchase.route_warehouse0_buy"))]})
-
I create a procurement order.
-
diff --git a/addons/purchase_requisition/purchase_requisition_view.xml b/addons/purchase_requisition/purchase_requisition_view.xml
index 298a16e9fb6..c620142112a 100644
--- a/addons/purchase_requisition/purchase_requisition_view.xml
+++ b/addons/purchase_requisition/purchase_requisition_view.xml
@@ -197,7 +197,7 @@
product.product
-
+
diff --git a/addons/sale/sale.py b/addons/sale/sale.py
index 497b99ef1b8..9576c023830 100644
--- a/addons/sale/sale.py
+++ b/addons/sale/sale.py
@@ -640,9 +640,13 @@ class sale_order(osv.osv):
def _get_date_planned(self, cr, uid, order, line, start_date, context=None):
date_planned = datetime.strptime(start_date, DEFAULT_SERVER_DATETIME_FORMAT) + relativedelta(days=line.delay or 0.0)
- date_planned = (date_planned - timedelta(days=order.company_id.security_lead)).strftime(DEFAULT_SERVER_DATETIME_FORMAT)
return date_planned
+ def _prepare_procurement_group(self, cr, uid, order, context=None):
+ return {
+ 'name': order.name, 'partner_id': order.partner_shipping_id.id,
+ }
+
def action_ship_create(self, cr, uid, ids, context=None):
"""Create the required procurements to supply sales order lines, also connecting
the procurements to appropriate stock moves in order to bring the goods to the
@@ -657,9 +661,9 @@ class sale_order(osv.osv):
procurement_obj = self.pool.get('procurement.order')
for order in self.browse(cr, uid, ids, context=context):
proc_ids = []
- group_id = self.pool.get("procurement.group").create(cr, uid, {
- 'name': order.name, 'partner_id': order.partner_shipping_id.id, 'move_type': order.picking_policy
- }, context=context)
+ vals = self._prepare_procurement_group(cr, uid, order, context=context)
+ group_id = self.pool.get("procurement.group").create(cr, uid, vals, context=context)
+
order.write({'procurement_group_id': group_id}, context=context)
for line in order.order_line:
if (line.state == 'done') or not line.product_id:
diff --git a/addons/sale/sale_demo.xml b/addons/sale/sale_demo.xml
index 8f1c72b49a5..d80242c7e74 100644
--- a/addons/sale/sale_demo.xml
+++ b/addons/sale/sale_demo.xml
@@ -325,7 +325,6 @@ Thanks!
service
150.0
100.0
- produce
diff --git a/addons/sale_mrp/sale_mrp.py b/addons/sale_mrp/sale_mrp.py
index 77a35972638..8522e884b1f 100644
--- a/addons/sale_mrp/sale_mrp.py
+++ b/addons/sale_mrp/sale_mrp.py
@@ -64,9 +64,9 @@ class mrp_production(osv.osv):
if parent_move_line:
move = move_obj.browse(cr, uid, parent_move_line)
if field_name == 'name':
- res[production.id] = move.sale_line_id and move.sale_line_id.order_id.name or False
+ res[production.id] = move.procurement_id and move.procurement_id.sale_line_id and move.procurement_id.sale_line_id.order_id.name or False
if field_name == 'client_order_ref':
- res[production.id] = move.sale_line_id and move.sale_line_id.order_id.client_order_ref or False
+ res[production.id] = move.procurement_id and move.procurement_id.sale_line_id and move.procurement_id.sale_line_id.order_id.client_order_ref or False
return res
_columns = {
diff --git a/addons/sale_mrp/test/sale_mrp.yml b/addons/sale_mrp/test/sale_mrp.yml
index d326e20be35..8fdba51b00a 100644
--- a/addons/sale_mrp/test/sale_mrp.yml
+++ b/addons/sale_mrp/test/sale_mrp.yml
@@ -19,7 +19,6 @@
mes_type: fixed
name: Slider Mobile
standard_price: 189.0
- supply_method: produce
type: product
uom_id: product.product_uom_unit
uom_po_id: product.product_uom_unit
@@ -38,10 +37,14 @@
min_qty: 2.0
qty: 5.0
standard_price: 189.0
- supply_method: produce
type: product
uom_id: product.product_uom_unit
uom_po_id: product.product_uom_unit
+-
+ I add the routes manufacture and mto to the product
+-
+ !python {model: product.product, id: scheduler_product}: |
+ self.write(cr, uid, [ref("product_product_slidermobile0")], {"route_ids": [(4, ref("mrp.route_warehouse0_manufacture")), (4, ref("stock.route_warehouse0_mto"))]})
-
I create a Bill of Material record for Slider Mobile
-
@@ -97,7 +100,7 @@
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so0"))
proc_ids = self.search(cr, uid, [('origin','=',so.name)])
- self.signal_button_check(cr, uid, proc_ids)
+ self.run(cr, uid, proc_ids)
-
I verify that a procurement state is "running"
-
@@ -105,14 +108,14 @@
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so0"))
proc_ids = self.search(cr, uid, [('origin','=',so.name) and ('state','=','running')])
- assert proc_ids, 'Procurement is not in the running state!'
+ assert len(proc_ids) == 2, 'Not both procurements are in the running state!'
-
I verify that a manufacturing order has been generated, and that its name and reference are correct
-
!python {model: sale.order}: |
mnf_obj = self.pool.get('mrp.production')
so = self.browse(cr, uid, ref("sale_order_so0"))
- mnf_id = mnf_obj.search(cr, uid, [('origin','=',so.name)])
+ mnf_id = mnf_obj.search(cr, uid, [('origin','like',so.name)])
assert mnf_id, 'Manufacturing order has not been generated'
mo = mnf_obj.browse(cr, uid, mnf_id)[0]
assert mo.sale_name == so.name, 'Wrong Name for the Manufacturing Order. Expected %s, Got %s' % (so.name, mo.name)
diff --git a/addons/sale_stock/sale_stock.py b/addons/sale_stock/sale_stock.py
index 97cc5056c51..13350b37148 100644
--- a/addons/sale_stock/sale_stock.py
+++ b/addons/sale_stock/sale_stock.py
@@ -246,6 +246,17 @@ class sale_order(osv.osv):
return finished
elif mode == 'canceled':
return canceled
+
+
+ def _get_date_planned(self, cr, uid, order, line, start_date, context=None):
+ date_planned = super(sale_order, self)._get_date_planned(cr, uid, order, line, start_date, context=context)
+ date_planned = (date_planned - timedelta(days=order.company_id.security_lead)).strftime(DEFAULT_SERVER_DATETIME_FORMAT)
+ return date_planned
+
+ def _prepare_procurement_group(self, cr, uid, order, context=None):
+ res = super(sale_order, self)._prepare_procurement_group(cr, uid, order, context=None)
+ res.update({'move_type': order.picking_policy})
+ return res
def action_ship_end(self, cr, uid, ids, context=None):
diff --git a/addons/sale_stock_location/sale_stock_location_view.xml b/addons/sale_stock_location/sale_stock_location_view.xml
index de643a2f917..c63e7ad6a22 100644
--- a/addons/sale_stock_location/sale_stock_location_view.xml
+++ b/addons/sale_stock_location/sale_stock_location_view.xml
@@ -41,7 +41,7 @@
stock.location.route.form
-
+
stock.location.route
diff --git a/addons/stock/procurement.py b/addons/stock/procurement.py
index fbc1fb69f83..4d82721330c 100644
--- a/addons/stock/procurement.py
+++ b/addons/stock/procurement.py
@@ -40,14 +40,29 @@ class procurement_rule(osv.osv):
result = super(procurement_rule, self)._get_action(cr, uid, context=context)
return result + [('move', 'Move From Another Location')]
+ def _get_rules(self, cr, uid, ids, context=None):
+ res = []
+ for route in self.browse(cr, uid, ids):
+ res += [x.id for x in route.pull_ids]
+ return res
+
_columns = {
'location_id': fields.many2one('stock.location', 'Destination Location'),
'location_src_id': fields.many2one('stock.location', 'Source Location',
help="Source location is action=move"),
+ 'route_id': fields.many2one('stock.location.route', 'Route',
+ help="If route_id is False, the rule is global"),
+ 'procure_method': fields.selection([('make_to_stock','Make to Stock'),('make_to_order','Make to Order')], 'Procure Method', required=True, help="'Make to Stock': When needed, take from the stock or wait until re-supplying. 'Make to Order': When needed, purchase or produce for the procurement request."),
+ 'route_sequence': fields.related('route_id', 'sequence', string='Route Sequence', store={'stock.location.route': (_get_rules, ['sequence'], 10)}),
+ 'sequence': fields.integer('Sequence'),
'picking_type_id': fields.many2one('stock.picking.type', 'Picking Type',
help="Picking Type determines the way the picking should be shown in the view, reports, ...")
}
+ _defaults = {
+ 'procure_method': 'make_to_stock',
+ }
+
class procurement_order(osv.osv):
_inherit = "procurement.order"
_columns = {
@@ -57,13 +72,18 @@ class procurement_order(osv.osv):
}
def _search_suitable_rule(self, cr, uid, procurement, domain, context=None):
- '''method overwritten in stock_location that is used to search the best suitable rule'''
- return self.pool.get('procurement.rule').search(cr, uid, domain, context=context)
+ '''we try to first find a rule among the ones defined on the procurement order group and if none is found, we try on the routes defined for the product, and finally we fallback on the default behavior'''
+ route_ids = [x.id for x in procurement.product_id.route_ids]
+ res = self.pool.get('procurement.rule').search(cr, uid, domain + [('route_id', 'in', route_ids)], order = 'route_sequence, sequence', context=context)
+ if not res:
+ res = self.pool.get('procurement.rule').search(cr, uid, domain + [('route_id', '=', False)], order='sequence', context=context)
+ return res
+
def _find_suitable_rule(self, cr, uid, procurement, context=None):
rule_id = super(procurement_order, self)._find_suitable_rule(cr, uid, procurement, context=context)
if not rule_id:
- rule_id = self._search_suitable_rule(cr, uid, procurement, [('location_id', '=', procurement.location_id.id)], context=context) #action=move
+ rule_id = self._search_suitable_rule(cr, uid, procurement, [('location_id', 'child_of', procurement.location_id.id)], context=context) #action=move
rule_id = rule_id and rule_id[0] or False
return rule_id
@@ -88,6 +108,7 @@ class procurement_order(osv.osv):
'move_dest_id': procurement.move_dest_id and procurement.move_dest_id.id or False,
'procurement_id': procurement.id,
'rule_id': procurement.rule_id.id,
+ 'procure_method': procurement.rule_id.procure_method,
'origin': procurement.origin,
'picking_type_id': procurement.rule_id.picking_type_id.id,
}
@@ -203,12 +224,9 @@ class procurement_order(osv.osv):
continue
product = product_obj.browse(cr, uid, [product_read['id']], context=context)[0]
- if product.supply_method == 'buy':
- location_id = warehouse.lot_stock_id.id
- elif product.supply_method == 'produce':
- location_id = warehouse.lot_stock_id.id
- else:
- continue
+
+ location_id = warehouse.lot_stock_id.id
+
proc_id = proc_obj.create(cr, uid,
self._prepare_automatic_op_procurement(cr, uid, product, warehouse, location_id, context=context),
context=context)
diff --git a/addons/stock/procurement_demo.xml b/addons/stock/procurement_demo.xml
index 2f7eca86d55..e0cd40ae2eb 100644
--- a/addons/stock/procurement_demo.xml
+++ b/addons/stock/procurement_demo.xml
@@ -1,29 +1,17 @@
-
-
- produce
-
-
-
- produce
-
-
product
- produce
product
- produce
product
- produce
@@ -68,7 +56,6 @@
product
- produce
@@ -77,12 +64,10 @@
product
- produce
product
- produce
@@ -115,7 +100,6 @@
product
- produce
@@ -166,9 +150,6 @@
product
-
- produce
-
product
diff --git a/addons/stock/product.py b/addons/stock/product.py
index 80143cf5e88..c3dca08f0e2 100644
--- a/addons/stock/product.py
+++ b/addons/stock/product.py
@@ -211,6 +211,8 @@ class product_product(osv.osv):
'location_id': fields.dummy(string='Location', relation='stock.location', type='many2one'),
'warehouse_id': fields.dummy(string='Warehouse', relation='stock.warehouse', type='many2one'),
'orderpoint_ids': fields.one2many('stock.warehouse.orderpoint', 'product_id', 'Minimum Stock Rules'),
+ 'route_ids': fields.many2many('stock.location.route', 'stock_location_route_product', 'product_id', 'route_id', 'Routes',
+ help="Depending on the modules installed, this will allow you to define the route of the product: whether it will be bought, manufactured, MTO/MTS,..."),
}
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
diff --git a/addons/stock/stock.py b/addons/stock/stock.py
index 82b91d8f66c..6bb2d471291 100644
--- a/addons/stock/stock.py
+++ b/addons/stock/stock.py
@@ -33,6 +33,8 @@ import openerp.addons.decimal_precision as dp
import logging
_logger = logging.getLogger(__name__)
+
+
#----------------------------------------------------------
# Incoterms
#----------------------------------------------------------
@@ -123,6 +125,28 @@ class stock_location(osv.osv):
def get_removal_strategy(self, cr, uid, location, product, context=None):
return None
+
+#----------------------------------------------------------
+# Routes
+#----------------------------------------------------------
+
+class stock_location_route(osv.osv):
+ _name = 'stock.location.route'
+ _description = "Inventory Routes"
+ _order = 'sequence'
+
+ _columns = {
+ 'name': fields.char('Route Name', required=True),
+ 'sequence': fields.integer('Sequence'),
+ 'pull_ids': fields.one2many('procurement.rule', 'route_id', 'Pull Rules'),
+ }
+
+ _defaults = {
+ 'sequence': lambda self,cr,uid,ctx: 0,
+ }
+
+
+
#----------------------------------------------------------
# Quants
#----------------------------------------------------------
@@ -2290,14 +2314,7 @@ class stock_warehouse_orderpoint(osv.osv):
})
return super(stock_warehouse_orderpoint, self).copy(cr, uid, id, default, context=context)
-class product_template(osv.osv):
- _inherit = "product.template"
- _columns = {
- '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',
- }
+
class stock_picking_type(osv.osv):
_name = "stock.picking.type"
diff --git a/addons/stock/stock_data.xml b/addons/stock/stock_data.xml
index 1fd0f864ef3..3ee22485f7b 100644
--- a/addons/stock/stock_data.xml
+++ b/addons/stock/stock_data.xml
@@ -158,15 +158,30 @@ watch your stock valuation, and track production lots upstream and downstream (b
-->
- Stock > Customer
+ Stock → Customer
+ move
+
+
+
+ make_to_stock
+
+
+
+
+ MTO
+ 10
+
+
+
+ Stock → Customer
move
+ make_to_order
+
-
-
diff --git a/addons/stock/stock_view.xml b/addons/stock/stock_view.xml
index 928d6b2ca21..6c51e11591e 100644
--- a/addons/stock/stock_view.xml
+++ b/addons/stock/stock_view.xml
@@ -1485,10 +1485,14 @@
+
+
+
+
@@ -1602,7 +1606,7 @@
-
+
@@ -1635,8 +1639,8 @@
-
-
+
+
@@ -1801,5 +1805,22 @@
stock.quant.package
+
+
+
+
+ stock.location.route.form
+ stock.location.route
+
+
+
+
+
diff --git a/addons/stock_complex_routes/stock_complex_routes.xml b/addons/stock_complex_routes/stock_complex_routes.xml
index 496a0144c37..a7ae56d9a48 100644
--- a/addons/stock_complex_routes/stock_complex_routes.xml
+++ b/addons/stock_complex_routes/stock_complex_routes.xml
@@ -24,6 +24,7 @@
Drop Shipping
3
+
diff --git a/addons/stock_location/stock_location.py b/addons/stock_location/stock_location.py
index 46ecd325f52..e269563e9d0 100644
--- a/addons/stock_location/stock_location.py
+++ b/addons/stock_location/stock_location.py
@@ -25,21 +25,17 @@ from dateutil.relativedelta import relativedelta
from openerp.tools.translate import _
class stock_location_route(osv.osv):
- _name = 'stock.location.route'
+ _inherit = 'stock.location.route'
_description = "Inventory Routes"
- _order = 'sequence'
_columns = {
- 'name': fields.char('Route Name', required=True),
- 'sequence': fields.integer('Sequence'),
- 'pull_ids': fields.one2many('procurement.rule', 'route_id', 'Pull Rules'),
'push_ids': fields.one2many('stock.location.path', 'route_id', 'Push Rules'),
'product_selectable': fields.boolean('Selectable on Product'),
'product_categ_selectable': fields.boolean('Selectable on Product Category'),
'warehouse_selectable': fields.boolean('Selectable on Warehouse'),
}
_defaults = {
- 'sequence': lambda self,cr,uid,ctx: 0,
+ 'product_selectable': True
}
class stock_warehouse(osv.osv):
@@ -115,33 +111,18 @@ class stock_location_path(osv.osv):
class procurement_rule(osv.osv):
_inherit = 'procurement.rule'
-
- def _get_rules(self, cr, uid, ids, context=None):
- res = []
- for route in self.browse(cr, uid, ids):
- res += [x.id for x in route.pull_ids]
- return res
_columns = {
- 'route_id': fields.many2one('stock.location.route', 'Route',
- help="If route_id is False, the rule is global"),
'delay': fields.integer('Number of Hours'),
- 'procure_method': fields.selection([('make_to_stock','Make to Stock'),('make_to_order','Make to Order')], 'Procure Method', required=True, help="'Make to Stock': When needed, take from the stock or wait until re-supplying. 'Make to Order': When needed, purchase or produce for the procurement request."),
'partner_address_id': fields.many2one('res.partner', 'Partner Address'),
-
- 'route_sequence': fields.related('route_id', 'sequence', string='Route Sequence', store={'stock.location.route': (_get_rules, ['sequence'], 10)}),
- 'sequence': fields.integer('Sequence'),
'propagate': fields.boolean('Propagate cancel and split', help='If checked, when the previous move of the move (which was generated by a next procurement) is cancelled or split, the move generated by this move will too'),
}
_defaults = {
- 'procure_method': 'make_to_stock',
'propagate': True,
'delay': 0,
}
-
-
class procurement_order(osv.osv):
_inherit = 'procurement.order'
_columns = {
@@ -157,7 +138,6 @@ class procurement_order(osv.osv):
newdate = (datetime.strptime(procurement.date_planned, '%Y-%m-%d %H:%M:%S') - relativedelta(days=procurement.rule_id.delay or 0)).strftime('%Y-%m-%d %H:%M:%S')
d.update({
'date': newdate,
- 'procure_method': procurement.rule_id.procure_method or 'make_to_stock',
'propagate': procurement.rule_id.propagate,
})
return d
diff --git a/addons/stock_location/stock_location_data.xml b/addons/stock_location/stock_location_data.xml
index 042f9571f3f..e46d4863227 100644
--- a/addons/stock_location/stock_location_data.xml
+++ b/addons/stock_location/stock_location_data.xml
@@ -25,44 +25,45 @@
Sale: Ship only
20
+
- Stock → output
+ Stock → customer
move
-
+
make_to_stock
-
- Output → Customer
+
+
+
- Stock → output
+ Stock → Customer
move
-
+
make_to_order
-
+
@@ -71,6 +72,8 @@
9
+
+
@@ -87,13 +90,18 @@
Sale: Pack + Ship
15
+
+
+ MTO pack
+ 10
+
- Stock → Pack
+ Stock → Output
move
-
+
make_to_stock
@@ -109,25 +117,15 @@
-
-
- Pack → Output
- move
-
-
- make_to_order
-
-
-
- Stock → pack
+ Stock → Output MTO
move
-
+
make_to_order
-
+
@@ -137,30 +135,20 @@
Sale: Pick + Pack + Ship
20
+
- Stock → Pick
+ Stock → Pack
move
-
+
make_to_stock
-
-
-
- Pick → Pack
- move
-
-
- make_to_order
-
-
-
-
+
Output → Customer
move
@@ -181,14 +169,18 @@
+
+ MTO pick
+ 10
+
-
- Stock → Pick
+
+ Stock → Pack MTO
move
-
+
make_to_order
-
+
diff --git a/addons/stock_location/stock_location_view.xml b/addons/stock_location/stock_location_view.xml
index cfd5a858d82..12ed7b1b289 100644
--- a/addons/stock_location/stock_location_view.xml
+++ b/addons/stock_location/stock_location_view.xml
@@ -6,17 +6,12 @@
stock.procurement.rule.inherit.form
procurement.rule
-
-
-
-
-
@@ -166,33 +161,28 @@
-
+
-
+
stock.location.route.form
stock.location.route
-
+
-
+
+
+
+
diff --git a/addons/stock_location/test/stock_location_push_flow.yml b/addons/stock_location/test/stock_location_push_flow.yml
index 0d9c71acd48..283d07210a6 100644
--- a/addons/stock_location/test/stock_location_push_flow.yml
+++ b/addons/stock_location/test/stock_location_push_flow.yml
@@ -47,7 +47,6 @@
name: res_partner_microlinktechnologies0
min_qty: 5.0
route_ids: [stock_location_route_push]
- supply_method: buy
type: product
uom_id: product.product_uom_unit
uom_po_id: product.product_uom_unit
diff --git a/addons/stock_multi_warehouse/__openerp__.py b/addons/stock_multi_warehouse/__openerp__.py
index a93893300a8..cc607168fa8 100644
--- a/addons/stock_multi_warehouse/__openerp__.py
+++ b/addons/stock_multi_warehouse/__openerp__.py
@@ -33,9 +33,9 @@ It creates 3 warehouses
'author': 'OpenERP SA',
'images': [],
'depends': ['stock_complex_routes'],
- 'data': ['stock_multi_warehouse.yml'],
+ 'data': [],
'demo': [
-
+ 'stock_multi_warehouse.yml'
],
'installable': True,
'test': [
diff --git a/addons/stock_multi_warehouse/stock_multi_warehouse.yml b/addons/stock_multi_warehouse/stock_multi_warehouse.yml
index aea7a0e1e7f..0b1c5ad8ae7 100644
--- a/addons/stock_multi_warehouse/stock_multi_warehouse.yml
+++ b/addons/stock_multi_warehouse/stock_multi_warehouse.yml
@@ -1,3 +1,6 @@
+-
+ !context
+ noupdate: 0
-
Create Two Customers
-
@@ -180,6 +183,8 @@
-
!record {model: stock.location.route, id: route_wh_panama_main_ship}:
name: Ship main panama
+ warehouse_selectable: True
+ product_selectable: False
pull_ids:
- invoice_state: none
location_id: location_panama_main_output
@@ -200,6 +205,8 @@
-
!record {model: stock.location.route, id: route_wh_panama_santiago_ship}:
name: Ship panama santiago
+ warehouse_selectable: True
+ product_selectable: False
pull_ids:
- invoice_state: none
location_id: location_panama_santiago_output
@@ -215,7 +222,8 @@
picking_type_id: picking_type_santiago_out
procure_method: make_to_order
action: move
-
+-
+ Add routes to warehouses
-
!python {model: stock.warehouse}: |
self.write(cr, uid, [ref('wh_panama_main')], {'route_id': ref('route_wh_panama_main_ship')}, context=context)