-
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.
Merge branch '16.0' into 16.0-mig-mrp_production_deconstruction
- Loading branch information
Showing
320 changed files
with
9,717 additions
and
58 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
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,30 @@ | ||
.. 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 component change | ||
======================== | ||
|
||
* In Manufacturing/Products new menu "Mass component change in BoMs" for | ||
allows to change massively one component by another on a list of BoMs. | ||
|
||
|
||
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 <[email protected]> | ||
* Alfredo de la Fuente <[email protected]> |
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 | ||
# Copyright 2014 Daniel Campos - AvanzOSC | ||
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html | ||
{ | ||
"name": "MRP BoM component massive change", | ||
"version": "16.0.1.0.0", | ||
"category": "Manufacturing/Manufacturing", | ||
"author": "OdooMRP team, " "AvanzOSC, " "Serv. Tecnol. Avanzados - Pedro M. Baeza", | ||
"license": "AGPL-3", | ||
"website": "https://github.com/avanzosc/mrp-addons", | ||
"depends": [ | ||
"mrp", | ||
], | ||
"data": ["views/mrp_bom_change_view.xml", "security/ir.model.access.csv"], | ||
"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,124 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * mrp_bom_component_change | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 16.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2024-06-06 06:33+0000\n" | ||
"PO-Revision-Date: 2024-06-06 06:33+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_component_change | ||
#. odoo-python | ||
#: code:addons/mrp_bom_component_change/models/mrp_bom_change.py:0 | ||
#, python-format | ||
msgid "Bill of Material" | ||
msgstr "Lista de Materiales" | ||
|
||
#. module: mrp_bom_component_change | ||
#: model:ir.model.fields,field_description:mrp_bom_component_change.field_mrp_bom_change__bom_ids | ||
#: model_terms:ir.ui.view,arch_db:mrp_bom_component_change.mrp_bom_change_form_view | ||
msgid "BoMs" | ||
msgstr "LdMs" | ||
|
||
#. module: mrp_bom_component_change | ||
#: model_terms:ir.ui.view,arch_db:mrp_bom_component_change.mrp_bom_change_form_view | ||
msgid "Change Component" | ||
msgstr "Cambiar componente" | ||
|
||
#. module: mrp_bom_component_change | ||
#: model:ir.model.fields,field_description:mrp_bom_component_change.field_mrp_bom_change__date | ||
msgid "Change Date" | ||
msgstr "Fecha del cambio" | ||
|
||
#. module: mrp_bom_component_change | ||
#: model:ir.model.fields,field_description:mrp_bom_component_change.field_mrp_bom_change__user | ||
msgid "Changed By" | ||
msgstr "Cambiado por" | ||
|
||
#. module: mrp_bom_component_change | ||
#: model:ir.model.fields,field_description:mrp_bom_component_change.field_mrp_bom_change__create_uid | ||
msgid "Created by" | ||
msgstr "Creado por" | ||
|
||
#. module: mrp_bom_component_change | ||
#: model:ir.model.fields,field_description:mrp_bom_component_change.field_mrp_bom_change__create_date | ||
msgid "Created on" | ||
msgstr "Creado el" | ||
|
||
#. module: mrp_bom_component_change | ||
#: model:ir.model.fields,field_description:mrp_bom_component_change.field_mrp_bom_change__display_name | ||
msgid "Display Name" | ||
msgstr "" | ||
|
||
#. module: mrp_bom_component_change | ||
#: model:ir.model.fields,field_description:mrp_bom_component_change.field_mrp_bom_change__id | ||
msgid "ID" | ||
msgstr "ID" | ||
|
||
#. module: mrp_bom_component_change | ||
#: model:ir.model.fields,field_description:mrp_bom_component_change.field_mrp_bom_change____last_update | ||
msgid "Last Modified on" | ||
msgstr "Última modificación el" | ||
|
||
#. module: mrp_bom_component_change | ||
#: model:ir.model.fields,field_description:mrp_bom_component_change.field_mrp_bom_change__write_uid | ||
msgid "Last Updated by" | ||
msgstr "Última actualización por" | ||
|
||
#. module: mrp_bom_component_change | ||
#: model:ir.model.fields,field_description:mrp_bom_component_change.field_mrp_bom_change__write_date | ||
msgid "Last Updated on" | ||
msgstr "Última actualización el" | ||
|
||
#. module: mrp_bom_component_change | ||
#: model:ir.actions.act_window,name:mrp_bom_component_change.action_bom_change_view | ||
#: model:ir.ui.menu,name:mrp_bom_component_change.mrp_bom_change_menu | ||
msgid "Mass component change in BoMs" | ||
msgstr "Cambio masivo componente en LdMs" | ||
|
||
#. module: mrp_bom_component_change | ||
#: model:ir.model,name:mrp_bom_component_change.model_mrp_bom_change | ||
msgid "Mrp BoM Component Change" | ||
msgstr "Mrp Cambio componente LdM" | ||
|
||
#. module: mrp_bom_component_change | ||
#: model:ir.model.fields,field_description:mrp_bom_component_change.field_mrp_bom_change__name | ||
msgid "Name" | ||
msgstr "Nombre" | ||
|
||
#. module: mrp_bom_component_change | ||
#: model:ir.model.fields,field_description:mrp_bom_component_change.field_mrp_bom_change__new_component_id | ||
msgid "New Component" | ||
msgstr "Nuevo componente" | ||
|
||
#. module: mrp_bom_component_change | ||
#. odoo-python | ||
#: code:addons/mrp_bom_component_change/models/mrp_bom_change.py:0 | ||
#, python-format | ||
msgid "Not Components selected!" | ||
msgstr "¡No componentes seleccionados!" | ||
|
||
#. module: mrp_bom_component_change | ||
#: model:ir.model.fields,field_description:mrp_bom_component_change.field_mrp_bom_change__old_component_id | ||
msgid "Old Component" | ||
msgstr "Componente viejo" | ||
|
||
#. module: mrp_bom_component_change | ||
#: model:ir.model.fields,field_description:mrp_bom_component_change.field_mrp_bom_change__reason | ||
msgid "Reason" | ||
msgstr "Razón" | ||
|
||
#. module: mrp_bom_component_change | ||
#. odoo-python | ||
#: code:addons/mrp_bom_component_change/models/mrp_bom_change.py:0 | ||
#, python-format | ||
msgid "There isn't any BoM for selected component" | ||
msgstr "No hay ninguna LdM para el componente seleccionado" |
124 changes: 124 additions & 0 deletions
124
mrp_bom_component_change/i18n/mrp_bom_component_change.pot
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,124 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * mrp_bom_component_change | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 16.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2024-06-06 06:33+0000\n" | ||
"PO-Revision-Date: 2024-06-06 06:33+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_component_change | ||
#. odoo-python | ||
#: code:addons/mrp_bom_component_change/models/mrp_bom_change.py:0 | ||
#, python-format | ||
msgid "Bill of Material" | ||
msgstr "" | ||
|
||
#. module: mrp_bom_component_change | ||
#: model:ir.model.fields,field_description:mrp_bom_component_change.field_mrp_bom_change__bom_ids | ||
#: model_terms:ir.ui.view,arch_db:mrp_bom_component_change.mrp_bom_change_form_view | ||
msgid "BoMs" | ||
msgstr "" | ||
|
||
#. module: mrp_bom_component_change | ||
#: model_terms:ir.ui.view,arch_db:mrp_bom_component_change.mrp_bom_change_form_view | ||
msgid "Change Component" | ||
msgstr "" | ||
|
||
#. module: mrp_bom_component_change | ||
#: model:ir.model.fields,field_description:mrp_bom_component_change.field_mrp_bom_change__date | ||
msgid "Change Date" | ||
msgstr "" | ||
|
||
#. module: mrp_bom_component_change | ||
#: model:ir.model.fields,field_description:mrp_bom_component_change.field_mrp_bom_change__user | ||
msgid "Changed By" | ||
msgstr "" | ||
|
||
#. module: mrp_bom_component_change | ||
#: model:ir.model.fields,field_description:mrp_bom_component_change.field_mrp_bom_change__create_uid | ||
msgid "Created by" | ||
msgstr "" | ||
|
||
#. module: mrp_bom_component_change | ||
#: model:ir.model.fields,field_description:mrp_bom_component_change.field_mrp_bom_change__create_date | ||
msgid "Created on" | ||
msgstr "" | ||
|
||
#. module: mrp_bom_component_change | ||
#: model:ir.model.fields,field_description:mrp_bom_component_change.field_mrp_bom_change__display_name | ||
msgid "Display Name" | ||
msgstr "" | ||
|
||
#. module: mrp_bom_component_change | ||
#: model:ir.model.fields,field_description:mrp_bom_component_change.field_mrp_bom_change__id | ||
msgid "ID" | ||
msgstr "" | ||
|
||
#. module: mrp_bom_component_change | ||
#: model:ir.model.fields,field_description:mrp_bom_component_change.field_mrp_bom_change____last_update | ||
msgid "Last Modified on" | ||
msgstr "" | ||
|
||
#. module: mrp_bom_component_change | ||
#: model:ir.model.fields,field_description:mrp_bom_component_change.field_mrp_bom_change__write_uid | ||
msgid "Last Updated by" | ||
msgstr "" | ||
|
||
#. module: mrp_bom_component_change | ||
#: model:ir.model.fields,field_description:mrp_bom_component_change.field_mrp_bom_change__write_date | ||
msgid "Last Updated on" | ||
msgstr "" | ||
|
||
#. module: mrp_bom_component_change | ||
#: model:ir.actions.act_window,name:mrp_bom_component_change.action_bom_change_view | ||
#: model:ir.ui.menu,name:mrp_bom_component_change.mrp_bom_change_menu | ||
msgid "Mass component change in BoMs" | ||
msgstr "" | ||
|
||
#. module: mrp_bom_component_change | ||
#: model:ir.model,name:mrp_bom_component_change.model_mrp_bom_change | ||
msgid "Mrp BoM Component Change" | ||
msgstr "" | ||
|
||
#. module: mrp_bom_component_change | ||
#: model:ir.model.fields,field_description:mrp_bom_component_change.field_mrp_bom_change__name | ||
msgid "Name" | ||
msgstr "" | ||
|
||
#. module: mrp_bom_component_change | ||
#: model:ir.model.fields,field_description:mrp_bom_component_change.field_mrp_bom_change__new_component_id | ||
msgid "New Component" | ||
msgstr "" | ||
|
||
#. module: mrp_bom_component_change | ||
#. odoo-python | ||
#: code:addons/mrp_bom_component_change/models/mrp_bom_change.py:0 | ||
#, python-format | ||
msgid "Not Components selected!" | ||
msgstr "" | ||
|
||
#. module: mrp_bom_component_change | ||
#: model:ir.model.fields,field_description:mrp_bom_component_change.field_mrp_bom_change__old_component_id | ||
msgid "Old Component" | ||
msgstr "" | ||
|
||
#. module: mrp_bom_component_change | ||
#: model:ir.model.fields,field_description:mrp_bom_component_change.field_mrp_bom_change__reason | ||
msgid "Reason" | ||
msgstr "" | ||
|
||
#. module: mrp_bom_component_change | ||
#. odoo-python | ||
#: code:addons/mrp_bom_component_change/models/mrp_bom_change.py:0 | ||
#, python-format | ||
msgid "There isn't any BoM for selected component" | ||
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 @@ | ||
from . import mrp_bom_change |
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,74 @@ | ||
# Copyright 2024 Alfredo de la Fuente - AvanzOSC | ||
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html | ||
from odoo import _, api, fields, models | ||
from odoo.exceptions import ValidationError | ||
|
||
|
||
class MrpBomChange(models.Model): | ||
_name = "mrp.bom.change" | ||
_description = "Mrp BoM Component Change" | ||
|
||
@api.depends("old_component_id") | ||
def _compute_bom_ids(self): | ||
bom_obj = self.env["mrp.bom"] | ||
for change in self: | ||
boms = bom_obj | ||
change.bom_ids = [(6, 0, [])] | ||
if change.old_component_id: | ||
for bom in bom_obj.search([]): | ||
bom_lines = bom.bom_line_ids.filtered( | ||
lambda x: x.product_id.id == self.old_component_id.id | ||
) | ||
if bom_lines and bom not in boms: | ||
boms += bom | ||
change.bom_ids = [(6, 0, boms.ids)] | ||
|
||
name = fields.Char(required=True, copy=False) | ||
new_component_id = fields.Many2one( | ||
string="New Component", comodel_name="product.product", required=True | ||
) | ||
old_component_id = fields.Many2one( | ||
string="Old Component", comodel_name="product.product", required=True | ||
) | ||
bom_ids = fields.Many2many( | ||
string="BoMs", | ||
comodel_name="mrp.bom", | ||
relation="rel_mrp_bom_change", | ||
column1="bom_change_id", | ||
column2="bom_id", | ||
copy=False, | ||
store=True, | ||
readonly=True, | ||
compute="_compute_bom_ids", | ||
) | ||
date = fields.Date(string="Change Date", readonly=True) | ||
user = fields.Many2one(string="Changed By", comodel_name="res.users", readonly=True) | ||
reason = fields.Char() | ||
|
||
def do_component_change(self): | ||
self.ensure_one() | ||
if not self.old_component_id or not self.new_component_id: | ||
raise ValidationError(_("Not Components selected!")) | ||
if not self.bom_ids: | ||
raise ValidationError(_("There isn't any BoM for selected component")) | ||
for bom in self.bom_ids: | ||
bom_lines = bom.bom_line_ids.filtered( | ||
lambda x: x.product_id.id == self.old_component_id.id | ||
) | ||
values, bom_lines = self._get_new_component(bom_lines) | ||
# add product_tmpl_id in case of mrp_product_variants are installed | ||
if hasattr(bom_lines, "product_tmpl_id"): | ||
values["product_tmpl_id"] = self.new_component_id.product_tmpl_id.id | ||
bom_lines.write(values) | ||
self.write({"date": fields.Date.context_today(self), "user": self.env.user.id}) | ||
return { | ||
"name": _("Bill of Material"), | ||
"view_mode": "tree,form", | ||
"res_model": "mrp.bom", | ||
"type": "ir.actions.act_window", | ||
"domain": [("id", "in", self.bom_ids.mapped("id"))], | ||
} | ||
|
||
def _get_new_component(self, bom_lines): | ||
values = {"product_id": self.new_component_id.id} | ||
return values, bom_lines |
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,3 @@ | ||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink | ||
access_mrp_bom_change,mrp.bom.change,model_mrp_bom_change,mrp.group_mrp_user,1,0,0,0 | ||
access_mrp_bom_change_manager,mrp.bom.change.manager,model_mrp_bom_change,mrp.group_mrp_manager,1,1,1,1 |
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 test_mrp_bom_component_change |
Oops, something went wrong.