diff --git a/app_mrp_bom_location/README.rst b/app_mrp_bom_location/README.rst new file mode 100644 index 00000000..2179a654 --- /dev/null +++ b/app_mrp_bom_location/README.rst @@ -0,0 +1,69 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: https://www.gnu.org/licenses/agpl + :alt: License: AGPL-3 + +================ +MRP BOM Location +================ + +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. + + +Usage +===== + +To use this module, you need to: + +#. 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 + :alt: Try me on Runbot + :target: https://runbot.odoo-community.org/runbot/129/11.0 + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues +`_. In case of trouble, please +check there if your issue has already been reported. If you spotted it first, +help us smash it by providing detailed and welcomed feedback. + +Credits +======= + +Images +------ + +* Odoo Community Association: `Icon `_. + +Contributors +------------ + +* Lois Rilo +* Mykhailo Panarin + +Do not contact contributors directly about support or help with technical +issues. + +Maintainer +---------- + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +This module is maintained by the OCA. + +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. + +To contribute to this module, please visit https://odoo-community.org. diff --git a/app_mrp_bom_location/__init__.py b/app_mrp_bom_location/__init__.py new file mode 100644 index 00000000..347b23ce --- /dev/null +++ b/app_mrp_bom_location/__init__.py @@ -0,0 +1,5 @@ +# Copyright 2017 Eficent Business and IT Consulting Services S.L. +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import models +from . import report diff --git a/app_mrp_bom_location/__manifest__.py b/app_mrp_bom_location/__manifest__.py new file mode 100644 index 00000000..62fa62b9 --- /dev/null +++ b/app_mrp_bom_location/__manifest__.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- + +# Created on 2017-11-05 +# author: 广州尚鹏,http://www.sunpop.cn +# email: 300883@qq.com +# resource of Sunpop +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +# Odoo在线中文用户手册(长期更新) +# http://www.sunpop.cn/documentation/user/10.0/zh_CN/index.html + +# Odoo10离线中文用户手册下载 +# http://www.sunpop.cn/odoo10_user_manual_document_offline/ +# Odoo10离线开发手册下载-含python教程,jquery参考,Jinja2模板,PostgresSQL参考(odoo开发必备) +# http://www.sunpop.cn/odoo10_developer_document_offline/ +# description: +{ + 'name': 'MRP BOM Location for Manufacturing/Unbuild Order', + 'version': '11.0.7.24', + 'author': 'Sunpop.cn', + 'category': 'Manufacturing', + 'website': 'http://www.sunpop.cn', + 'license': 'LGPL-3', + 'sequence': 2, + 'summary': 'Adds location field to Bill of Materials and its components. Done for Manufacturing/Unbuild Order', + 'description': """ + 模块开发模板,目录结构与文件定义。 + """, + 'price': 0.00, + 'currency': 'EUR', + 'depends': ['mrp'], + 'images': ['static/description/banner.png'], + 'data': [ + "views/mrp_view.xml", + "views/report_mrpbomstructure.xml", + ], + 'demo': [ + ], + 'test': [ + ], + 'css': [ + ], + 'qweb': [ + ], + 'js': [ + ], + 'images': [ + ], + 'post_load': None, + 'post_init_hook': None, + 'installable': True, + 'application': True, + 'auto_install': False, +} diff --git a/app_mrp_bom_location/i18n/mrp_bom_location.pot b/app_mrp_bom_location/i18n/mrp_bom_location.pot new file mode 100644 index 00000000..71decec9 --- /dev/null +++ b/app_mrp_bom_location/i18n/mrp_bom_location.pot @@ -0,0 +1,39 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * app_mrp_bom_location +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 11.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: app_mrp_bom_location +#: model:ir.model,name:app_mrp_bom_location.model_mrp_bom +msgid "Bill of Material" +msgstr "" + +#. module: app_mrp_bom_location +#: model:ir.model.fields,field_description:app_mrp_bom_location.field_mrp_bom_line_location_id +#: model:ir.model.fields,field_description:app_mrp_bom_location.field_app_mrp_bom_location_id +#: model:ir.ui.view,arch_db:app_mrp_bom_location.report_mrpbomstructure_location +#: model:ir.ui.view,arch_db:app_mrp_bom_location.view_mrp_bom_filter +#: model:ir.ui.view,arch_db:app_mrp_bom_location.view_mrp_bom_line_filter +msgid "Location" +msgstr "" + +#. module: app_mrp_bom_location +#: model:ir.model,name:app_mrp_bom_location.model_mrp_bom_line +msgid "mrp.bom.line" +msgstr "" + +#. module: app_mrp_bom_location +#: model:ir.model,name:app_mrp_bom_location.model_report_mrp_mrp_bom_structure_report +msgid "report.mrp.mrp_bom_structure_report" +msgstr "" + diff --git a/app_mrp_bom_location/models/__init__.py b/app_mrp_bom_location/models/__init__.py new file mode 100644 index 00000000..6d4ebce1 --- /dev/null +++ b/app_mrp_bom_location/models/__init__.py @@ -0,0 +1,6 @@ +# Copyright 2017 Eficent Business and IT Consulting Services S.L. +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import mrp_bom +from . import mrp_production +from . import mrp_unbuild diff --git a/app_mrp_bom_location/models/mrp_bom.py b/app_mrp_bom_location/models/mrp_bom.py new file mode 100644 index 00000000..10a3ae7f --- /dev/null +++ b/app_mrp_bom_location/models/mrp_bom.py @@ -0,0 +1,29 @@ +# Copyright 2017 Eficent Business and IT Consulting Services S.L. +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import api, fields, models + + +class MrpBom(models.Model): + _inherit = "mrp.bom" + + location_id = fields.Many2one( + string='Location', + comodel_name='stock.location', + ) + + @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): + _inherit = "mrp.bom.line" + + location_id = fields.Many2one( + related='bom_id.location_id', + readonly=True, + store=True, + ) diff --git a/app_mrp_bom_location/models/mrp_production.py b/app_mrp_bom_location/models/mrp_production.py new file mode 100644 index 00000000..9bcbc555 --- /dev/null +++ b/app_mrp_bom_location/models/mrp_production.py @@ -0,0 +1,15 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from odoo import api, fields, models, _ + +class MrpProduction(models.Model): + """ Manufacturing Orders """ + _inherit = 'mrp.production' + + @api.onchange('bom_id') + def onchange_bom_id(self): + if self.bom_id.location_id: + self.location_src_id = self.bom_id.location_id + self.location_dest_id = self.bom_id.location_id + diff --git a/app_mrp_bom_location/models/mrp_unbuild.py b/app_mrp_bom_location/models/mrp_unbuild.py new file mode 100644 index 00000000..47def3b8 --- /dev/null +++ b/app_mrp_bom_location/models/mrp_unbuild.py @@ -0,0 +1,15 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from odoo import api, fields, models, _ + + +class MrpUnbuild(models.Model): + _inherit = "mrp.unbuild" + + @api.onchange('bom_id') + def onchange_bom_id(self): + if self.bom_id.location_id: + self.location_id = self.bom_id.location_id + self.location_dest_id = self.bom_id.location_id + diff --git a/app_mrp_bom_location/report/__init__.py b/app_mrp_bom_location/report/__init__.py new file mode 100644 index 00000000..9956baed --- /dev/null +++ b/app_mrp_bom_location/report/__init__.py @@ -0,0 +1,4 @@ +# Copyright 2017 Eficent Business and IT Consulting Services S.L. +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import bom_structure diff --git a/app_mrp_bom_location/report/bom_structure.py b/app_mrp_bom_location/report/bom_structure.py new file mode 100644 index 00000000..91376c27 --- /dev/null +++ b/app_mrp_bom_location/report/bom_structure.py @@ -0,0 +1,16 @@ +# © 2017 Eficent Business and IT Consulting Services S.L. +# (http://www.eficent.com) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from odoo import api, models + + +class BomStructureReport(models.AbstractModel): + _inherit = 'report.mrp.mrp_bom_structure_report' + + @api.model + def _get_child_vals(self, record, level, qty, uom): + res = super(BomStructureReport, self)._get_child_vals( + record, level, qty, uom) + res['location_name'] = record.location_id.complete_name or '' + return res diff --git a/app_mrp_bom_location/static/description/banner.png b/app_mrp_bom_location/static/description/banner.png new file mode 100644 index 00000000..3f004c03 Binary files /dev/null and b/app_mrp_bom_location/static/description/banner.png differ diff --git a/app_mrp_bom_location/static/description/icon.png b/app_mrp_bom_location/static/description/icon.png new file mode 100644 index 00000000..4c57f611 Binary files /dev/null and b/app_mrp_bom_location/static/description/icon.png differ diff --git a/app_mrp_bom_location/static/description/index.html b/app_mrp_bom_location/static/description/index.html new file mode 100644 index 00000000..51551c53 --- /dev/null +++ b/app_mrp_bom_location/static/description/index.html @@ -0,0 +1,55 @@ +
+
+
+

App MRP BOM Location for Manufacturing/Unbuild Order

+
+

This moduld allows user to .

+

More Powerful addons: + Supop.cn Odoo Addons +

+
+

Lastest update: v11.0.7.27, 2018-07-27

+
    +
  • 1. ...
  • +
+
+ +
+ +
+
+
+
+ +
+
+
+

Technical Help & Support

+
+
+
+

+ For any type of technical help & support requests, Feel free to contact us

+ + guohuadeng@hotmail.com +

+ Via QQ: 300883

+ + 300883@qq.com +
+
+

+ Visit our website for more support.

+ + http://www.sunpop.cn +
+
+
+
+ diff --git a/app_mrp_bom_location/views/mrp_view.xml b/app_mrp_bom_location/views/mrp_view.xml new file mode 100644 index 00000000..7cec665a --- /dev/null +++ b/app_mrp_bom_location/views/mrp_view.xml @@ -0,0 +1,70 @@ + + + + + + mrp.bom.form - mrp_bom_location + mrp.bom + + + + + + + + + + + + + mrp.bom.tree - mrp_bom_location + mrp.bom + + + + + + + + + + mrp.bom.select - mrp_bom_location + mrp.bom + + + + + + + + + + + + + mrp.bom.component.tree - mrp_bom_location + mrp.bom.line + + + + + + + + + + mrp.bom.line.select - mrp_bom_location + mrp.bom.line + + + + + + + + + + + + diff --git a/app_mrp_bom_location/views/report_mrpbomstructure.xml b/app_mrp_bom_location/views/report_mrpbomstructure.xml new file mode 100644 index 00000000..be2a75a6 --- /dev/null +++ b/app_mrp_bom_location/views/report_mrpbomstructure.xml @@ -0,0 +1,20 @@ + + + +