Skip to content

Commit

Permalink
Merge PR #160 into 16.0
Browse files Browse the repository at this point in the history
Signed-off-by legalsylvain
  • Loading branch information
github-grap-bot committed Nov 15, 2024
2 parents 0cd2b20 + 0e753dd commit c628da3
Show file tree
Hide file tree
Showing 12 changed files with 148 additions and 0 deletions.
Empty file added product_label_mrp/README.rst
Empty file.
1 change: 1 addition & 0 deletions product_label_mrp/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
24 changes: 24 additions & 0 deletions product_label_mrp/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Copyright (C) 2024 - Today: GRAP (http://www.grap.coop)
# @author: Quentin DUPONT ([email protected])
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
"name": "Product Labels MRP",
"summary": "Adds labels in MRP BoMs",
"version": "16.0.1.0.0",
"category": "Product",
"author": "GRAP",
"maintainers": ["quentinDupont"],
"developpment_status": "Production/Stable",
"website": "https://github.com/grap/grap-odoo-business",
"license": "AGPL-3",
"depends": [
"mrp",
# GRAP
"product_label",
],
"data": [
"views/view_mrp_bom.xml",
],
"installable": True,
"auto-install": True,
}
26 changes: 26 additions & 0 deletions product_label_mrp/i18n/fr.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * product_label_mrp
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-07-11 14:19+0000\n"
"PO-Revision-Date: 2024-07-11 14:19+0000\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: product_label_mrp
#: model:ir.model,name:product_label_mrp.model_mrp_bom
msgid "Bill of Material"
msgstr "Nomenclature"

#. module: product_label_mrp
#: model:ir.model,name:product_label_mrp.model_mrp_bom_line
msgid "Bill of Material Line"
msgstr "Ligne de nomenclature"
2 changes: 2 additions & 0 deletions product_label_mrp/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import mrp_bom
from . import mrp_bom_line
15 changes: 15 additions & 0 deletions product_label_mrp/models/mrp_bom.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright (C) 2024 - Today: GRAP (http://www.grap.coop)
# @author: Quentin DUPONT ([email protected])
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from odoo import fields, models


class MrpBom(models.Model):
_inherit = "mrp.bom"

product_label_ids = fields.Many2many(
string="Product labels",
related="product_tmpl_id.label_ids",
readonly=False,
)
15 changes: 15 additions & 0 deletions product_label_mrp/models/mrp_bom_line.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright (C) 2024 - Today: GRAP (http://www.grap.coop)
# @author: Quentin DUPONT ([email protected])
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from odoo import fields, models


class MrpBomLine(models.Model):
_inherit = "mrp.bom.line"

product_label_ids = fields.Many2many(
comodel_name="product.label",
related="product_id.label_ids",
string="Labels on product",
)
1 change: 1 addition & 0 deletions product_label_mrp/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Quentin DUPONT
1 change: 1 addition & 0 deletions product_label_mrp/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Adds related products labels on MRP BoMs and BoMs lines.
56 changes: 56 additions & 0 deletions product_label_mrp/views/view_mrp_bom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (C) 2022 - Today: GRAP (http://www.grap.coop)
@author: Quentin DUPONT ([email protected])
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
-->
<odoo>

<!-- ************************************************************ -->
<!-- MRP Bill of Materials - Form -->
<!-- ************************************************************ -->

<record id="view_mrp_bom_form" model="ir.ui.view">
<field name="model">mrp.bom</field>
<field name="inherit_id" ref="mrp.mrp_bom_form_view" />
<field name="arch" type="xml">
<!-- BoM -->
<xpath expr="//field[@name='product_id']" position="after">
<field name="product_label_ids" widget="many2many_tags"/>
</xpath>
<!-- BoM Lines -->
<xpath expr="//field[@name='bom_line_ids']/tree/field[@name='product_qty']" position="after">
<field name="product_label_ids" widget="many2many_tags"/>
</xpath>
</field>
</record>

<!-- ************************************************************ -->
<!-- MRP Bill of Materials - Tree -->
<!-- ************************************************************ -->

<record id="view_mrp_bom_tree" model="ir.ui.view">
<field name="model">mrp.bom</field>
<field name="inherit_id" ref="mrp.mrp_bom_tree_view" />
<field name="arch" type="xml">
<xpath expr="//field[@name='product_qty']" position="before">
<field name="product_label_ids" widget="many2many_tags"/>
</xpath>
</field>
</record>

<!-- ************************************************************ -->
<!-- MRP Bill of Materials - Search -->
<!-- ************************************************************ -->

<record id="view_mrp_bom_search" model="ir.ui.view">
<field name="model">mrp.bom</field>
<field name="inherit_id" ref="mrp.view_mrp_bom_filter" />
<field name="arch" type="xml">
<xpath expr="//field[@name='product_tmpl_id']" position="after">
<field name="product_label_ids"/>
</xpath>
</field>
</record>

</odoo>
1 change: 1 addition & 0 deletions setup/product_label_mrp/odoo/addons/product_label_mrp
6 changes: 6 additions & 0 deletions setup/product_label_mrp/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)

0 comments on commit c628da3

Please sign in to comment.