Skip to content
Snippets Groups Projects
Commit 84e32d39 authored by Nicolas Martinelli's avatar Nicolas Martinelli
Browse files

[FIX] mrp: correct Raw Materials Location

- Create a BOM with a rounting
- On the routing, set a location
- Create a MO with the BOM

The 'Raw Materials Location' is set on the location on the picking type
although in practice, the location of the routing will be used:

https://github.com/odoo/odoo/blob/f65bdd17308d6fa5f984dd23f0b345cd92c977cb/addons/mrp/models/mrp_production.py#L457-L460



This is confusing for end users.

We improve the onchange mechanism to set the location which will be
used. We also rename 'Production Location' since it is confusing for the
users.

opw-2116760

closes odoo/odoo#39660

Signed-off-by: default avatarNicolas Martinelli (nim) <nim@odoo.com>
parent 5df3f662
No related branches found
No related tags found
No related merge requests found
......@@ -2290,6 +2290,7 @@ msgstr ""
#. module: mrp
#: model:ir.model.fields,field_description:mrp.field_mrp_production_location_src_id
#: model:ir.model.fields,field_description:mrp.field_mrp_routing_location_id
msgid "Raw Materials Location"
msgstr ""
......
......@@ -301,14 +301,14 @@ class MrpProduction(models.Model):
self.product_uom_id = self.product_id.uom_id.id
return {'domain': {'product_uom_id': [('category_id', '=', self.product_id.uom_id.category_id.id)]}}
@api.onchange('picking_type_id')
@api.onchange('picking_type_id', 'routing_id')
def onchange_picking_type(self):
location = self.env.ref('stock.stock_location_stock')
try:
location.check_access_rule('read')
except (AttributeError, AccessError):
location = self.env['stock.warehouse'].search([('company_id', '=', self.env.user.company_id.id)], limit=1).lot_stock_id
self.location_src_id = self.picking_type_id.default_location_src_id.id or location.id
self.location_src_id = self.routing_id.location_id.id or self.picking_type_id.default_location_src_id.id or location.id
self.location_dest_id = self.picking_type_id.default_location_dest_id.id or location.id
@api.multi
......
......@@ -21,7 +21,7 @@ class MrpRouting(models.Model):
'mrp.routing.workcenter', 'routing_id', 'Operations',
copy=True, oldname='workcenter_lines')
location_id = fields.Many2one(
'stock.location', 'Production Location',
'stock.location', 'Raw Materials Location',
help="Keep empty if you produce at the location where you find the raw materials. "
"Set a location if you produce at a fixed location. This can be a partner location "
"if you subcontract the manufacturing operations.")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment