summaryrefslogtreecommitdiff
path: root/addons/mrp/__init__.py
diff options
context:
space:
mode:
authorArnold Moyaux <arm@odoo.com>2018-06-27 10:19:18 +0200
committerArnold Moyaux <arm@odoo.com>2018-08-13 15:38:34 +0200
commit1e160dffd375ef5bb5ceb7ec34ee172944719b03 (patch)
treedd2b13ed7ecec5b1f786d72030719f771b5645bf /addons/mrp/__init__.py
parent177981b09f7a765021bfb87401b39875edf91584 (diff)
[IMP] stock, mrp: picking before and after manufacturing
Currently MRP do not handle multi locations for components. In order to be able to use both feature at the same time, we could: - Improve mrp in order to handle multiple stock.move.line for a componenet stock.move - Add a rule that allow to bring all the good from multiple location to a single location. (was already possible but it requires some configuration) This commit introduce a checkbox on the warehouse in order to automatically configure all the routes/rules/locations/picking_types,... necessary to bring all the components to a single location before running the manufacturing order. Technically it also refactor some stock_warehouse.py methods in order to easily override the picking_type, rules and routes creation. Thank to Hetashree Chauhan <hch@odoo.com> for his help. task_id: 27785
Diffstat (limited to 'addons/mrp/__init__.py')
-rw-r--r--addons/mrp/__init__.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/addons/mrp/__init__.py b/addons/mrp/__init__.py
index f17ad3dbaec..5879cc956c9 100644
--- a/addons/mrp/__init__.py
+++ b/addons/mrp/__init__.py
@@ -4,3 +4,15 @@
from . import models
from . import wizard
from . import report
+
+from odoo import api, SUPERUSER_ID
+
+def _create_warehouse_data(cr, registry):
+ """ This hook is used to add a default manufacture_pull_id, manufacture
+ picking_type on every warehouse. It is necessary if the mrp module is
+ installed after some warehouses were already created.
+ """
+ env = api.Environment(cr, SUPERUSER_ID, {})
+ warehouse_ids = env['stock.warehouse'].search([('manufacture_pull_id', '=', False)])
+ for warehouse_id in warehouse_ids:
+ warehouse_id.write({'manufacture_to_resupply': True})