add app _mrp_bom_loc

fix data
This commit is contained in:
guohuadeng
2018-07-25 01:36:34 +08:00
parent 14f363c28d
commit 509b0d959b
15 changed files with 397 additions and 0 deletions

View File

@@ -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
<https://github.com/OCA/manufacture/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 <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_.
Contributors
------------
* Lois Rilo <lois.rilo@eficent.com>
* Mykhailo Panarin <m.panarin@mobilunity.com>
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.

View File

@@ -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

View File

@@ -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,
}

View File

@@ -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 ""

View File

@@ -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

View File

@@ -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,
)

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

View File

@@ -0,0 +1,55 @@
<section class="oe_container">
<div class="oe_row oe_spaced" style="max-width: 800px;">
<div class="oe_span12">
<h2 class="oe_slogan">App MRP BOM Location for Manufacturing/Unbuild Order</h2>
<div class="oe_demo" style=" margin: 30px auto 0; padding: 0 15px 0 0; border:none; width: 96%;">
<p>This moduld allows user to . </p>
<h1>More Powerful addons:
<a class="btn btn-primary mb16" href="http://www.odoo.com/apps/modules/browse?author=Sunpop.cn">Supop.cn Odoo Addons</a>
</h1>
<br>
<h3>Lastest update: v11.0.7.27, 2018-07-27</h3>
<ul>
<li>1. ...</li>
</ul>
</div>
<div class="oe_demo oe_screenshot mt32">
<img src="banner.png" style="border:1px solid black"/>
<br/>
</div>
</div>
</div>
<section class="oe_container oe_dark">
<div class="oe_row oe_spaced text-center">
<div class="oe_span12">
<h2 class="oe_slogan">Technical Help & Support</h2>
</div>
<div class="col-md-12 pad0">
<div class="oe_mt16">
<p><h4>
For any type of technical help & support requests, Feel free to contact us</h4></p>
<a style="background: #002e5a none repeat scroll 0% 0%; color: rgb(255, 255, 255);position: relative; overflow: hidden;"
class="btn btn-warning btn-lg" rel="nofollow" href="mailto:guohuadeng@hotmail.com"><span
style="height: 354px; width: 354px; top: -147.433px; left: -6.93335px;" class="o_ripple"></span>
<i class="fa fa-envelope"></i> guohuadeng@hotmail.com</a>
<p><h4>
Via QQ: 300883</h4></p>
<a style="background: #002e5a none repeat scroll 0% 0%; color: rgb(255, 255, 255);position: relative; overflow: hidden;"
class="btn btn-warning btn-lg" rel="nofollow" href="mailto:300883@qq.com"><span
style="height: 354px; width: 354px; top: -147.433px; left: -6.93335px;" class="o_ripple"></span>
<i class="fa fa-envelope"></i> 300883@qq.com</a>
</div>
<div class="oe_mt16">
<p><h4>
Visit our website for more support.</h4></p>
<a style="background: #002e5a none repeat scroll 0% 0%; color: rgb(255, 255, 255);position: relative; overflow: hidden;"
class="btn btn-warning btn-lg" rel="nofollow" href="http://www.sunpop.cn" target="_blank"><span
style="height: 354px; width: 354px; top: -147.433px; left: -6.93335px;" class="o_ripple"></span>
<i class="fa fa-web"></i>http://www.sunpop.cn</a>
</div>
</div>
</div>
</section>

View File

@@ -0,0 +1,70 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2017 Eficent Business and IT Consulting Services S.L.
License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl-3.0) -->
<odoo>
<record id="mrp_bom_form_view" model="ir.ui.view">
<field name="name">mrp.bom.form - mrp_bom_location</field>
<field name="model">mrp.bom</field>
<field name="inherit_id" ref="mrp.mrp_bom_form_view"/>
<field name="arch" type="xml">
<field name="routing_id" position="before">
<field name="location_id"/>
</field>
<xpath expr="//field[@name='bom_line_ids']/tree/field[@name='product_qty']" position="after">
<field name="location_id"/>
</xpath>
</field>
</record>
<record id="mrp_bom_tree_view" model="ir.ui.view">
<field name="name">mrp.bom.tree - mrp_bom_location</field>
<field name="model">mrp.bom</field>
<field name="inherit_id" ref="mrp.mrp_bom_tree_view"/>
<field name="arch" type="xml">
<field name="product_id" position="after">
<field name="location_id"/>
</field>
</field>
</record>
<record id="view_mrp_bom_filter" model="ir.ui.view">
<field name="name">mrp.bom.select - mrp_bom_location</field>
<field name="model">mrp.bom</field>
<field name="inherit_id" ref="mrp.view_mrp_bom_filter"/>
<field name="arch" type="xml">
<field name="product_tmpl_id" position="after">
<field name="location_id" string="Location"/>
</field>
<group expand="0" position="inside">
<filter string="Location" context="{'group_by':'location_id'}"/>
</group>
</field>
</record>
<record id="mrp_bom_component_tree_view" model="ir.ui.view">
<field name="name">mrp.bom.component.tree - mrp_bom_location</field>
<field name="model">mrp.bom.line</field>
<field name="inherit_id" ref="mrp.mrp_bom_component_tree_view"/>
<field name="arch" type="xml">
<field name="product_id" position="before">
<field name="location_id"/>
</field>
</field>
</record>
<record id="view_mrp_bom_line_filter" model="ir.ui.view">
<field name="name">mrp.bom.line.select - mrp_bom_location</field>
<field name="model">mrp.bom.line</field>
<field name="inherit_id" ref="mrp.view_mrp_bom_line_filter"/>
<field name="arch" type="xml">
<field name="product_id" position="after">
<field name="location_id" string="Location"/>
</field>
<group expand="0" position="inside">
<filter string="Location" context="{'group_by':'location_id'}"/>
</group>
</field>
</record>
</odoo>

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="report_mrpbomstructure_location"
inherit_id="mrp.mrp_bom_structure_report">
<xpath expr="//thead/tr" position="inside">
<th>Location</th>
</xpath>
<xpath expr="//tbody/t/tr[1]" position="inside">
<td>
<span t-field="o.location_id.complete_name"/>
</td>
</xpath>
<xpath expr="//tbody/t/tr[2]" position="inside">
<td>
<span t-esc="l['location_name']"/>
</td>
</xpath>
</template>
</odoo>