mirror of
https://github.com/guohuadeng/app-odoo.git
synced 2025-02-23 04:11:36 +02:00
add app _mrp_bom_loc
fix data
This commit is contained in:
69
app_mrp_bom_location/README.rst
Normal file
69
app_mrp_bom_location/README.rst
Normal 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.
|
||||||
5
app_mrp_bom_location/__init__.py
Normal file
5
app_mrp_bom_location/__init__.py
Normal 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
|
||||||
54
app_mrp_bom_location/__manifest__.py
Normal file
54
app_mrp_bom_location/__manifest__.py
Normal 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,
|
||||||
|
}
|
||||||
39
app_mrp_bom_location/i18n/mrp_bom_location.pot
Normal file
39
app_mrp_bom_location/i18n/mrp_bom_location.pot
Normal 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 ""
|
||||||
|
|
||||||
6
app_mrp_bom_location/models/__init__.py
Normal file
6
app_mrp_bom_location/models/__init__.py
Normal 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
|
||||||
29
app_mrp_bom_location/models/mrp_bom.py
Normal file
29
app_mrp_bom_location/models/mrp_bom.py
Normal 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,
|
||||||
|
)
|
||||||
15
app_mrp_bom_location/models/mrp_production.py
Normal file
15
app_mrp_bom_location/models/mrp_production.py
Normal 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
|
||||||
|
|
||||||
15
app_mrp_bom_location/models/mrp_unbuild.py
Normal file
15
app_mrp_bom_location/models/mrp_unbuild.py
Normal 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
|
||||||
|
|
||||||
4
app_mrp_bom_location/report/__init__.py
Normal file
4
app_mrp_bom_location/report/__init__.py
Normal 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
|
||||||
16
app_mrp_bom_location/report/bom_structure.py
Normal file
16
app_mrp_bom_location/report/bom_structure.py
Normal 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
|
||||||
BIN
app_mrp_bom_location/static/description/banner.png
Normal file
BIN
app_mrp_bom_location/static/description/banner.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 80 KiB |
BIN
app_mrp_bom_location/static/description/icon.png
Normal file
BIN
app_mrp_bom_location/static/description/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 78 KiB |
55
app_mrp_bom_location/static/description/index.html
Normal file
55
app_mrp_bom_location/static/description/index.html
Normal 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>
|
||||||
|
|
||||||
70
app_mrp_bom_location/views/mrp_view.xml
Normal file
70
app_mrp_bom_location/views/mrp_view.xml
Normal 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>
|
||||||
20
app_mrp_bom_location/views/report_mrpbomstructure.xml
Normal file
20
app_mrp_bom_location/views/report_mrpbomstructure.xml
Normal 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>
|
||||||
Reference in New Issue
Block a user