mirror of
https://github.com/OCA/manufacture.git
synced 2025-01-28 16:37:15 +02:00
[IMP] make an onchange for location_id, fix readme
This commit is contained in:
@@ -20,6 +20,9 @@ Usage
|
|||||||
To use this module, you need to:
|
To use this module, you need to:
|
||||||
|
|
||||||
#. Go to *Manufacturing > Bill of Materials*.
|
#. Go to *Manufacturing > Bill of Materials*.
|
||||||
|
#. Pick or create one of them.
|
||||||
|
#. You will see a new field to fill called "Location".
|
||||||
|
#. One the structure report *BOM > Print > BOM Structure* location field is present
|
||||||
|
|
||||||
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
|
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
|
||||||
:alt: Try me on Runbot
|
:alt: Try me on Runbot
|
||||||
@@ -45,6 +48,7 @@ Contributors
|
|||||||
------------
|
------------
|
||||||
|
|
||||||
* Lois Rilo <lois.rilo@eficent.com>
|
* Lois Rilo <lois.rilo@eficent.com>
|
||||||
|
* Mykhailo Panarin <m.panarin@mobilunity.com>
|
||||||
|
|
||||||
Do not contact contributors directly about support or help with technical
|
Do not contact contributors directly about support or help with technical
|
||||||
issues.
|
issues.
|
||||||
|
|||||||
@@ -1,24 +1,29 @@
|
|||||||
# Copyright 2017 Eficent Business and IT Consulting Services S.L.
|
# Copyright 2017 Eficent Business and IT Consulting Services S.L.
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
from odoo import fields, models
|
from odoo import api, fields, models
|
||||||
|
|
||||||
|
|
||||||
class MrpBom(models.Model):
|
class MrpBom(models.Model):
|
||||||
_inherit = "mrp.bom"
|
_inherit = "mrp.bom"
|
||||||
|
|
||||||
location_id = fields.Many2one(
|
location_id = fields.Many2one(
|
||||||
related='picking_type_id.default_location_dest_id',
|
string='Location',
|
||||||
readonly=True,
|
comodel_name='stock.location',
|
||||||
store=True,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@api.onchange('picking_type_id')
|
||||||
|
def _onchange_picking_type_id(self):
|
||||||
|
if (self.picking_type_id and
|
||||||
|
self.picking_type_id.default_location_src_id):
|
||||||
|
self.location_id = self.picking_type_id.default_location_src_id
|
||||||
|
|
||||||
|
|
||||||
class MrpBomLine(models.Model):
|
class MrpBomLine(models.Model):
|
||||||
_inherit = "mrp.bom.line"
|
_inherit = "mrp.bom.line"
|
||||||
|
|
||||||
location_id = fields.Many2one(
|
location_id = fields.Many2one(
|
||||||
related='bom_id.picking_type_id.default_location_src_id',
|
related='bom_id.location_id',
|
||||||
readonly=True,
|
readonly=True,
|
||||||
store=True,
|
store=True,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ from odoo import api, models
|
|||||||
|
|
||||||
|
|
||||||
class BomStructureReport(models.AbstractModel):
|
class BomStructureReport(models.AbstractModel):
|
||||||
_name = 'report.mrp.mrp_bom_structure_report'
|
_inherit = 'report.mrp.mrp_bom_structure_report'
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _get_child_vals(record, level, qty, uom):
|
def _get_child_vals(record, level, qty, uom):
|
||||||
|
|||||||
Reference in New Issue
Block a user