From 66ada530ef52f8a894994e7eaa93edd257db20b0 Mon Sep 17 00:00:00 2001 From: sudhir-erpharbor Date: Fri, 11 Oct 2019 16:57:21 +0530 Subject: [PATCH] [MIG] Migrated the module mrp_bom_location to v13. --- mrp_bom_location/README.rst | 9 +++--- mrp_bom_location/__manifest__.py | 13 +++----- mrp_bom_location/models/mrp_bom.py | 15 +++------- mrp_bom_location/readme/CONTRIBUTORS.rst | 1 + mrp_bom_location/report/bom_structure.py | 30 +++++++++++-------- .../static/description/index.html | 5 ++-- .../views/report_mrpbomstructure.xml | 6 ++-- 7 files changed, 37 insertions(+), 42 deletions(-) diff --git a/mrp_bom_location/README.rst b/mrp_bom_location/README.rst index 2a208bf5c..d4acd356d 100644 --- a/mrp_bom_location/README.rst +++ b/mrp_bom_location/README.rst @@ -14,13 +14,13 @@ MRP BOM Location :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fmanufacture-lightgray.png?logo=github - :target: https://github.com/OCA/manufacture/tree/12.0/mrp_bom_location + :target: https://github.com/OCA/manufacture/tree/13.0/mrp_bom_location :alt: OCA/manufacture .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/manufacture-12-0/manufacture-12-0-mrp_bom_location + :target: https://translation.odoo-community.org/projects/manufacture-13-0/manufacture-13-0-mrp_bom_location :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/129/12.0 + :target: https://runbot.odoo-community.org/runbot/129/13.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -68,6 +68,7 @@ Contributors * Lois Rilo * Mykhailo Panarin * Saran Limpajitkutaporn +* Sudhir Arya Maintainers ~~~~~~~~~~~ @@ -82,6 +83,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use. -This module is part of the `OCA/manufacture `_ project on GitHub. +This module is part of the `OCA/manufacture `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/mrp_bom_location/__manifest__.py b/mrp_bom_location/__manifest__.py index 44932a7ae..5c09a04ca 100644 --- a/mrp_bom_location/__manifest__.py +++ b/mrp_bom_location/__manifest__.py @@ -3,18 +3,13 @@ { "name": "MRP BOM Location", "summary": "Adds location field to Bill of Materials and its components.", - "version": "12.0.1.0.1", + "version": "13.0.1.0.1", "category": "Manufacture", "website": "https://github.com/OCA/manufacture", "author": "Eficent, Odoo Community Association (OCA)", "license": "AGPL-3", "application": False, - "depends": [ - "mrp", - ], - "data": [ - "views/mrp_view.xml", - "views/report_mrpbomstructure.xml", - ], - "installable": True + "depends": ["mrp"], + "data": ["views/mrp_view.xml", "views/report_mrpbomstructure.xml"], + "installable": True, } diff --git a/mrp_bom_location/models/mrp_bom.py b/mrp_bom_location/models/mrp_bom.py index 4672ffb8b..20f653b50 100644 --- a/mrp_bom_location/models/mrp_bom.py +++ b/mrp_bom_location/models/mrp_bom.py @@ -7,22 +7,15 @@ from odoo import api, fields, models class MrpBom(models.Model): _inherit = "mrp.bom" - location_id = fields.Many2one( - string='Location', - comodel_name='stock.location', - ) + location_id = fields.Many2one(string="Location", comodel_name="stock.location") - @api.onchange('picking_type_id') + @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): + 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): _inherit = "mrp.bom.line" - location_id = fields.Many2one( - related='bom_id.location_id', - store=True, - ) + location_id = fields.Many2one(related="bom_id.location_id", store=True) diff --git a/mrp_bom_location/readme/CONTRIBUTORS.rst b/mrp_bom_location/readme/CONTRIBUTORS.rst index ec5efe6d3..c4af6085b 100644 --- a/mrp_bom_location/readme/CONTRIBUTORS.rst +++ b/mrp_bom_location/readme/CONTRIBUTORS.rst @@ -1,3 +1,4 @@ * Lois Rilo * Mykhailo Panarin * Saran Limpajitkutaporn +* Sudhir Arya diff --git a/mrp_bom_location/report/bom_structure.py b/mrp_bom_location/report/bom_structure.py index e541aeb45..29893df4d 100644 --- a/mrp_bom_location/report/bom_structure.py +++ b/mrp_bom_location/report/bom_structure.py @@ -6,28 +6,32 @@ from odoo import api, models class BomStructureReport(models.AbstractModel): - _inherit = 'report.mrp.report_bom_structure' + _inherit = "report.mrp.report_bom_structure" @api.model def _get_bom_lines(self, bom, bom_quantity, product, line_id, level): res = super(BomStructureReport, self)._get_bom_lines( - bom, bom_quantity, product, line_id, level) - line_ids = self.env['mrp.bom.line'].search([('bom_id', '=', bom.id)]) + bom, bom_quantity, product, line_id, level + ) + line_ids = self.env["mrp.bom.line"].search([("bom_id", "=", bom.id)]) for line in res[0]: line_id = line_ids.filtered( - lambda l: l.location_id and l.id == line['line_id']) - line['location_id'] = line_id.location_id or '' + lambda l: l.location_id and l.id == line["line_id"] + ) + line["location_id"] = line_id.location_id or "" return res @api.model - def _get_pdf_line(self, bom_id, product_id=False, qty=1, - child_bom_ids=None, unfolded=False): + def _get_pdf_line( + self, bom_id, product_id=False, qty=1, child_bom_ids=None, unfolded=False + ): res = super(BomStructureReport, self)._get_pdf_line( - bom_id, product_id, qty, child_bom_ids, unfolded) - line_ids = self.env['mrp.bom.line'].search([('bom_id', '=', bom_id)]) - for line in res['lines']: + bom_id, product_id, qty, child_bom_ids, unfolded + ) + line_ids = self.env["mrp.bom.line"].search([("bom_id", "=", bom_id)]) + for line in res["lines"]: line_id = line_ids.filtered( - lambda l: l.location_id and - l.product_id.display_name == line['name']) - line['location_name'] = line_id.location_id.complete_name or '' + lambda l: l.location_id and l.product_id.display_name == line["name"] + ) + line["location_name"] = line_id.location_id.complete_name or "" return res diff --git a/mrp_bom_location/static/description/index.html b/mrp_bom_location/static/description/index.html index 15ae78a39..a29b6d561 100644 --- a/mrp_bom_location/static/description/index.html +++ b/mrp_bom_location/static/description/index.html @@ -367,7 +367,7 @@ ul.auto-toc { !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Beta License: AGPL-3 OCA/manufacture Translate me on Weblate Try me on Runbot

+

Beta License: AGPL-3 OCA/manufacture Translate me on Weblate Try me on Runbot

This module adds the location field to the Bill of Materials and its components. This may be useful to distinguish between different BoMs for the same product or to highlight the preferred locations to fetch the components from.

The location appears in the BOM Structure Report.

Table of contents

@@ -415,6 +415,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
  • Lois Rilo <lois.rilo@eficent.com>
  • Mykhailo Panarin <m.panarin@mobilunity.com>
  • Saran Limpajitkutaporn <saranl@ecosoft.co.th>
  • +
  • Sudhir Arya <sudhir@erpharbor.com>
  • @@ -424,7 +425,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome

    OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.

    -

    This module is part of the OCA/manufacture project on GitHub.

    +

    This module is part of the OCA/manufacture project on GitHub.

    You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

    diff --git a/mrp_bom_location/views/report_mrpbomstructure.xml b/mrp_bom_location/views/report_mrpbomstructure.xml index 546644023..6eba4914f 100644 --- a/mrp_bom_location/views/report_mrpbomstructure.xml +++ b/mrp_bom_location/views/report_mrpbomstructure.xml @@ -2,10 +2,10 @@