[9.0][ADD] mrp_bom_location

This commit is contained in:
lreficent
2017-09-15 17:25:53 +02:00
committed by davidborromeo
parent 381026de97
commit da972a2feb
7 changed files with 196 additions and 0 deletions

View File

@@ -0,0 +1,62 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
: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.
Usage
=====
To use this module, you need to:
#. Go to *Manufacturing > Bill of Materials*.
.. 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/9.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>
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 @@
# -*- coding: utf-8 -*-
# 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

View File

@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Copyright 2017 Eficent Business and IT Consulting Services S.L.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "MRP BOM Location",
"summary": "Adds location field to Bill of Materials and its components.",
"version": "9.0.1.0.0",
"category": "Manufacture",
"website": "https://odoo-community.org/",
"author": "Eficent, Odoo Community Association (OCA)",
"license": "AGPL-3",
"application": False,
"installable": True,
"depends": [
"mrp",
],
"data": [
"views/mrp_view.xml",
],
}

View File

@@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
# 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

View File

@@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
# Copyright 2017 Eficent Business and IT Consulting Services S.L.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openerp import fields, models
class MrpBom(models.Model):
_inherit = "mrp.bom"
location_id = fields.Many2one(
comodel_name="stock.location", string="Location",
help="Set the preferred location for this BOM.",
domain=[('usage', '=', 'internal')])
class MrpBom(models.Model):
_inherit = "mrp.bom.line"
location_id = fields.Many2one(
comodel_name="stock.location", string="Location",
help="Location which it is expected to get the products from.",
domain=[('usage', '=', 'internal')])

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

View File

@@ -0,0 +1,81 @@
<?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">
<label for="routing_id" position="before">
<field name="location_id"/>
</label>
<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="date_start" position="before">
<field name="location_id"/>
</field>
</field>
</record>
<record id="mrp_bom_line_tree_view" model="ir.ui.view">
<field name="name">mrp.bom.tree - mrp_bom_location</field>
<field name="model">mrp.bom.line</field>
<field name="inherit_id" ref="mrp.mrp_bom_line_tree_view"/>
<field name="arch" type="xml">
<field name="date_start" 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>