Skip to content

Commit

Permalink
[16.0][MIG] product_label_mrp
Browse files Browse the repository at this point in the history
  • Loading branch information
quentinDupont committed Jul 11, 2024
1 parent 3f1a180 commit cf7f2f1
Show file tree
Hide file tree
Showing 19 changed files with 170 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",
"product",
# OCA
"product_label",
],
"data": [
"views/view_mrp_bom.xml",
],
"installable": 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",
)
10 changes: 10 additions & 0 deletions product_label_mrp/readme/CONFIGURE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
* Go to "Setting > Technical > Parameters > Labels"

.. figure:: ../static/description/product_label_kanban.png

* Edit or create a Label

.. figure:: ../static/description/product_label_form.png

If "Display on Reports" is checked, label will be displayed on reports
by other glue modules, available in the same repository: ``product_label_account``, ``product_label_sale``, ...
3 changes: 3 additions & 0 deletions product_label_mrp/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* Julien WESTE
* Sylvain LE GAL (https://www.twitter.com/legalsylvain)
* Quentin DUPONT
2 changes: 2 additions & 0 deletions product_label_mrp/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This module extends the functionality of Product module to support labels
on products.
5 changes: 5 additions & 0 deletions product_label_mrp/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
* Go to your product form

.. figure:: ../static/description/product_template_form.png

* Set one or many labels and save.
1 change: 1 addition & 0 deletions product_label_mrp/static/description/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Adds labels in BoMs : link BoM labels with Product labels, and permits to see labels on bom lines products.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,
)
3 changes: 3 additions & 0 deletions test-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@


git+https://github.com/grap/grap-odoo-business@refs/pull/159/head#subdirectory=setup/product_label

0 comments on commit cf7f2f1

Please sign in to comment.