-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[16.0][ADD] mrp_bom_ref_calculate: Automatic calculation of the BoM r…
…eference.
- Loading branch information
1 parent
c969fd1
commit be17141
Showing
15 changed files
with
373 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg | ||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html | ||
:alt: License: AGPL-3 | ||
|
||
===================== | ||
Mrp bom ref calculate | ||
===================== | ||
|
||
* In BoM new field "Ref. Note". The BoM reference is now calculated as follows: | ||
|
||
BoM reference = concatenate( | ||
product_id.default_code or product_tmplate_id.default_code, version, "Ref. Note" | ||
) | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues | ||
<https://github.com/avanzosc/mrp-addons/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. | ||
|
||
Do not contact contributors directly about support or help with technical issues. | ||
|
||
Credits | ||
======= | ||
|
||
Contributors | ||
------------ | ||
|
||
* Ana Juaristi <anajuaristi@avanzosc.es> | ||
* Alfredo de la Fuente <alfredodelafuente@avanzosc.es> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Copyright 2024 Alfredo de la Fuente - AvanzOSC | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). | ||
{ | ||
"name": "Mrp BoM Ref Calculate", | ||
"version": "16.0.1.0.0", | ||
"category": "Manufacturing", | ||
"website": "https://github.com/avanzosc/mrp-addons", | ||
"author": "AvanzOSC", | ||
"license": "AGPL-3", | ||
"depends": ["mrp", "mrp_bom_version"], | ||
"data": [ | ||
"views/mrp_bom_views.xml", | ||
"views/mrp_production_views.xml", | ||
], | ||
"installable": True, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * mrp_bom_ref_calculate | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 16.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2024-11-28 08:09+0000\n" | ||
"PO-Revision-Date: 2024-11-28 08:09+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: mrp_bom_ref_calculate | ||
#: model:ir.model,name:mrp_bom_ref_calculate.model_mrp_bom | ||
msgid "Bill of Material" | ||
msgstr "Llista de material" | ||
|
||
#. module: mrp_bom_ref_calculate | ||
#: model:ir.model.fields,field_description:mrp_bom_ref_calculate.field_mrp_production__bom_ref | ||
#: model_terms:ir.ui.view,arch_db:mrp_bom_ref_calculate.view_mrp_production_filter | ||
msgid "BoM Reference" | ||
msgstr "" | ||
|
||
#. module: mrp_bom_ref_calculate | ||
#: model:ir.model,name:mrp_bom_ref_calculate.model_mrp_production | ||
msgid "Production Order" | ||
msgstr "Ordre de producció" | ||
|
||
#. module: mrp_bom_ref_calculate | ||
#: model:ir.model.fields,field_description:mrp_bom_ref_calculate.field_mrp_bom__ref_note | ||
msgid "Ref. Note" | ||
msgstr "" | ||
|
||
#. module: mrp_bom_ref_calculate | ||
#: model:ir.model.fields,field_description:mrp_bom_ref_calculate.field_mrp_bom__code | ||
msgid "Reference" | ||
msgstr "Referència" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * mrp_bom_ref_calculate | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 16.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2024-11-28 08:09+0000\n" | ||
"PO-Revision-Date: 2024-11-28 08:09+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: mrp_bom_ref_calculate | ||
#: model:ir.model,name:mrp_bom_ref_calculate.model_mrp_bom | ||
msgid "Bill of Material" | ||
msgstr "" | ||
|
||
#. module: mrp_bom_ref_calculate | ||
#: model:ir.model.fields,field_description:mrp_bom_ref_calculate.field_mrp_production__bom_ref | ||
#: model_terms:ir.ui.view,arch_db:mrp_bom_ref_calculate.view_mrp_production_filter | ||
msgid "BoM Reference" | ||
msgstr "" | ||
|
||
#. module: mrp_bom_ref_calculate | ||
#: model:ir.model,name:mrp_bom_ref_calculate.model_mrp_production | ||
msgid "Production Order" | ||
msgstr "" | ||
|
||
#. module: mrp_bom_ref_calculate | ||
#: model:ir.model.fields,field_description:mrp_bom_ref_calculate.field_mrp_bom__ref_note | ||
msgid "Ref. Note" | ||
msgstr "" | ||
|
||
#. module: mrp_bom_ref_calculate | ||
#: model:ir.model.fields,field_description:mrp_bom_ref_calculate.field_mrp_bom__code | ||
msgid "Reference" | ||
msgstr "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * mrp_bom_ref_calculate | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 16.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2024-11-28 08:10+0000\n" | ||
"PO-Revision-Date: 2024-11-28 08:10+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: mrp_bom_ref_calculate | ||
#: model:ir.model,name:mrp_bom_ref_calculate.model_mrp_bom | ||
msgid "Bill of Material" | ||
msgstr "Lista de materiales" | ||
|
||
#. module: mrp_bom_ref_calculate | ||
#: model:ir.model.fields,field_description:mrp_bom_ref_calculate.field_mrp_production__bom_ref | ||
#: model_terms:ir.ui.view,arch_db:mrp_bom_ref_calculate.view_mrp_production_filter | ||
msgid "BoM Reference" | ||
msgstr "Referencia LdM" | ||
|
||
#. module: mrp_bom_ref_calculate | ||
#: model:ir.model,name:mrp_bom_ref_calculate.model_mrp_production | ||
msgid "Production Order" | ||
msgstr "Orden de producción" | ||
|
||
#. module: mrp_bom_ref_calculate | ||
#: model:ir.model.fields,field_description:mrp_bom_ref_calculate.field_mrp_bom__ref_note | ||
msgid "Ref. Note" | ||
msgstr "Ref. Nota" | ||
|
||
#. module: mrp_bom_ref_calculate | ||
#: model:ir.model.fields,field_description:mrp_bom_ref_calculate.field_mrp_bom__code | ||
msgid "Reference" | ||
msgstr "Referencia" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * mrp_bom_ref_calculate | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 16.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2024-11-28 08:10+0000\n" | ||
"PO-Revision-Date: 2024-11-28 08:10+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: mrp_bom_ref_calculate | ||
#: model:ir.model,name:mrp_bom_ref_calculate.model_mrp_bom | ||
msgid "Bill of Material" | ||
msgstr "Nomenclature" | ||
|
||
#. module: mrp_bom_ref_calculate | ||
#: model:ir.model.fields,field_description:mrp_bom_ref_calculate.field_mrp_production__bom_ref | ||
#: model_terms:ir.ui.view,arch_db:mrp_bom_ref_calculate.view_mrp_production_filter | ||
msgid "BoM Reference" | ||
msgstr "" | ||
|
||
#. module: mrp_bom_ref_calculate | ||
#: model:ir.model,name:mrp_bom_ref_calculate.model_mrp_production | ||
msgid "Production Order" | ||
msgstr "Ordre de production" | ||
|
||
#. module: mrp_bom_ref_calculate | ||
#: model:ir.model.fields,field_description:mrp_bom_ref_calculate.field_mrp_bom__ref_note | ||
msgid "Ref. Note" | ||
msgstr "" | ||
|
||
#. module: mrp_bom_ref_calculate | ||
#: model:ir.model.fields,field_description:mrp_bom_ref_calculate.field_mrp_bom__code | ||
msgid "Reference" | ||
msgstr "Référence" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * mrp_bom_ref_calculate | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 16.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2024-11-28 08:09+0000\n" | ||
"PO-Revision-Date: 2024-11-28 08:09+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: mrp_bom_ref_calculate | ||
#: model:ir.model,name:mrp_bom_ref_calculate.model_mrp_bom | ||
msgid "Bill of Material" | ||
msgstr "" | ||
|
||
#. module: mrp_bom_ref_calculate | ||
#: model:ir.model.fields,field_description:mrp_bom_ref_calculate.field_mrp_production__bom_ref | ||
#: model_terms:ir.ui.view,arch_db:mrp_bom_ref_calculate.view_mrp_production_filter | ||
msgid "BoM Reference" | ||
msgstr "" | ||
|
||
#. module: mrp_bom_ref_calculate | ||
#: model:ir.model,name:mrp_bom_ref_calculate.model_mrp_production | ||
msgid "Production Order" | ||
msgstr "" | ||
|
||
#. module: mrp_bom_ref_calculate | ||
#: model:ir.model.fields,field_description:mrp_bom_ref_calculate.field_mrp_bom__ref_note | ||
msgid "Ref. Note" | ||
msgstr "" | ||
|
||
#. module: mrp_bom_ref_calculate | ||
#: model:ir.model.fields,field_description:mrp_bom_ref_calculate.field_mrp_bom__code | ||
msgid "Reference" | ||
msgstr "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
from . import mrp_bom | ||
from . import mrp_production |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Copyright 2024 Alfredo de la Fuente - AvanzOSC | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). | ||
from odoo import api, fields, models | ||
|
||
|
||
class MrpBom(models.Model): | ||
_inherit = "mrp.bom" | ||
|
||
ref_note = fields.Char(string="Ref. Note") | ||
code = fields.Char(compute="_compute_code", store=True, copy=False) | ||
|
||
@api.depends( | ||
"product_tmpl_id", | ||
"product_tmpl_id.default_code", | ||
"product_id", | ||
"product_id.default_code", | ||
"version", | ||
"ref_note", | ||
) | ||
def _compute_code(self): | ||
for bom in self: | ||
default_code = ( | ||
bom.product_id.default_code | ||
if bom.product_id and bom.product_id.default_code | ||
else "" | ||
) | ||
if ( | ||
not default_code | ||
and bom.product_tmpl_id | ||
and bom.product_tmpl_id.default_code | ||
): | ||
default_code = bom.product_tmpl_id.default_code | ||
code = default_code | ||
if bom.version: | ||
code += str(bom.version) | ||
if bom.ref_note: | ||
code += str(bom.ref_note) | ||
bom.code = code |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Copyright 2024 Alfredo de la Fuente - AvanzOSC | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). | ||
from odoo import fields, models | ||
|
||
|
||
class MrpProduction(models.Model): | ||
_inherit = "mrp.production" | ||
|
||
bom_ref = fields.Char(string="BoM Reference", related="bom_id.code", store=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<odoo> | ||
<record id="mrp_bom_form_view" 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"> | ||
<field name="code" position="attributes"> | ||
<attribute name="readonly">1</attribute> | ||
</field> | ||
<field name="code" position="before"> | ||
<field name="ref_note" /> | ||
</field> | ||
</field> | ||
</record> | ||
</odoo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<odoo> | ||
<record id="mrp_production_form_view" model="ir.ui.view"> | ||
<field name="model">mrp.production</field> | ||
<field name="inherit_id" ref="mrp.mrp_production_form_view" /> | ||
<field name="arch" type="xml"> | ||
<div name="bom_div" position="after"> | ||
<label for="bom_ref" name="bom_ref" /> | ||
<div class="o_row" name="bom_ref"> | ||
<field name="bom_ref" /> | ||
</div> | ||
</div> | ||
</field> | ||
</record> | ||
|
||
<record id="mrp_production_tree_view" model="ir.ui.view"> | ||
<field name="model">mrp.production</field> | ||
<field name="inherit_id" ref="mrp.mrp_production_tree_view" /> | ||
<field name="arch" type="xml"> | ||
<field name="bom_id" position="after"> | ||
<field name="bom_ref" readonly="1" optional="show" /> | ||
</field> | ||
</field> | ||
</record> | ||
|
||
<record id="view_mrp_production_filter" model="ir.ui.view"> | ||
<field name="model">mrp.production</field> | ||
<field name="inherit_id" ref="mrp.view_mrp_production_filter" /> | ||
<field name="arch" type="xml"> | ||
<field name="origin" position="after"> | ||
<field name="bom_ref" /> | ||
</field> | ||
<filter name="procurement_group_id" position="after"> | ||
<filter | ||
string="BoM Reference" | ||
name="group-bom-ref" | ||
domain="[]" | ||
context="{'group_by': 'bom_ref'}" | ||
/> | ||
</filter> | ||
</field> | ||
</record> | ||
</odoo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../../mrp_bom_ref_calculate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
) |