Skip to content

Commit

Permalink
[ADD] mrp_production_deconstruction_reader: New field "Reader" in det…
Browse files Browse the repository at this point in the history
…ailed operations of MOs.
  • Loading branch information
alfredoavanzosc committed Jul 4, 2024
1 parent 5399b94 commit c047ac0
Show file tree
Hide file tree
Showing 11 changed files with 262 additions and 0 deletions.
29 changes: 29 additions & 0 deletions mrp_production_deconstruction_reader/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
.. 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 production deconstruction reader
====================================

* In detailed operations of manufacturing orders new field "Reader", to read
with a reader the "product", or "product lot", separated by a space.

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
------------

* Alfredo de la Fuente <alfredodelafuente@avanzosc.es>
* Ana Juaristi <anajuaristi@avanzosc.es>
1 change: 1 addition & 0 deletions mrp_production_deconstruction_reader/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
14 changes: 14 additions & 0 deletions mrp_production_deconstruction_reader/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright 2024 Alfredo de la Fuente - AvanzOSC
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
{
"name": "Mrp Production Deconstruction Reader",
"version": "16.0.1.0.0",
"author": "Avanzosc",
"website": "https://github.com/avanzosc/mrp-addons",
"category": "Manufacturing/Manufacturing",
"license": "AGPL-3",
"depends": ["stock_move_line_product_lot_reader", "mrp_production_deconstruction"],
"data": ["views/mrp_production_views.xml"],
"installable": True,
"auto_install": True,
}
33 changes: 33 additions & 0 deletions mrp_production_deconstruction_reader/i18n/ca_ES.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * mrp_production_deconstruction_reader
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-07-04 07:55+0000\n"
"PO-Revision-Date: 2024-07-04 07:55+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_production_deconstruction_reader
#: model:ir.model,name:mrp_production_deconstruction_reader.model_stock_move_line
msgid "Product Moves (Stock Move Line)"
msgstr "Moviment del producte (línia de moviment d'estoc)"

#. module: mrp_production_deconstruction_reader
#: model:ir.model.fields,field_description:mrp_production_deconstruction_reader.field_stock_move_line__reader
msgid "Reader"
msgstr ""

#. module: mrp_production_deconstruction_reader
#. odoo-python
#: code:addons/mrp_production_deconstruction_reader/models/stock_move_line.py:0
#, python-format
msgid "Reader product: %(product)s, not found in operations."
msgstr ""
33 changes: 33 additions & 0 deletions mrp_production_deconstruction_reader/i18n/en_GB.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * mrp_production_deconstruction_reader
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-07-04 07:55+0000\n"
"PO-Revision-Date: 2024-07-04 07:55+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_production_deconstruction_reader
#: model:ir.model,name:mrp_production_deconstruction_reader.model_stock_move_line
msgid "Product Moves (Stock Move Line)"
msgstr ""

#. module: mrp_production_deconstruction_reader
#: model:ir.model.fields,field_description:mrp_production_deconstruction_reader.field_stock_move_line__reader
msgid "Reader"
msgstr ""

#. module: mrp_production_deconstruction_reader
#. odoo-python
#: code:addons/mrp_production_deconstruction_reader/models/stock_move_line.py:0
#, python-format
msgid "Reader product: %(product)s, not found in operations."
msgstr ""
33 changes: 33 additions & 0 deletions mrp_production_deconstruction_reader/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * mrp_production_deconstruction_reader
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-07-04 07:56+0000\n"
"PO-Revision-Date: 2024-07-04 07:56+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_production_deconstruction_reader
#: model:ir.model,name:mrp_production_deconstruction_reader.model_stock_move_line
msgid "Product Moves (Stock Move Line)"
msgstr "Movimientos productos (Stock Move Line)"

#. module: mrp_production_deconstruction_reader
#: model:ir.model.fields,field_description:mrp_production_deconstruction_reader.field_stock_move_line__reader
msgid "Reader"
msgstr "Lector"

#. module: mrp_production_deconstruction_reader
#. odoo-python
#: code:addons/mrp_production_deconstruction_reader/models/stock_move_line.py:0
#, python-format
msgid "Reader product: %(product)s, not found in operations."
msgstr "Producto leido: %(product)s, no encontrado en operaciones."
33 changes: 33 additions & 0 deletions mrp_production_deconstruction_reader/i18n/fr.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * mrp_production_deconstruction_reader
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-07-04 07:56+0000\n"
"PO-Revision-Date: 2024-07-04 07:56+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_production_deconstruction_reader
#: model:ir.model,name:mrp_production_deconstruction_reader.model_stock_move_line
msgid "Product Moves (Stock Move Line)"
msgstr "Mouvements de stock"

#. module: mrp_production_deconstruction_reader
#: model:ir.model.fields,field_description:mrp_production_deconstruction_reader.field_stock_move_line__reader
msgid "Reader"
msgstr ""

#. module: mrp_production_deconstruction_reader
#. odoo-python
#: code:addons/mrp_production_deconstruction_reader/models/stock_move_line.py:0
#, python-format
msgid "Reader product: %(product)s, not found in operations."
msgstr ""
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * mrp_production_deconstruction_reader
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-07-04 07:55+0000\n"
"PO-Revision-Date: 2024-07-04 07:55+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_production_deconstruction_reader
#: model:ir.model,name:mrp_production_deconstruction_reader.model_stock_move_line
msgid "Product Moves (Stock Move Line)"
msgstr ""

#. module: mrp_production_deconstruction_reader
#: model:ir.model.fields,field_description:mrp_production_deconstruction_reader.field_stock_move_line__reader
msgid "Reader"
msgstr ""

#. module: mrp_production_deconstruction_reader
#. odoo-python
#: code:addons/mrp_production_deconstruction_reader/models/stock_move_line.py:0
#, python-format
msgid "Reader product: %(product)s, not found in operations."
msgstr ""
1 change: 1 addition & 0 deletions mrp_production_deconstruction_reader/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import stock_move_line
30 changes: 30 additions & 0 deletions mrp_production_deconstruction_reader/models/stock_move_line.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# 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
from odoo.exceptions import ValidationError


class StockMoveLine(models.Model):
_inherit = "stock.move.line"

reader = fields.Char(copy=False)

@api.onchange("reader")
def onchange_reader(self):
result = super().onchange_reader()
if (
self.reader
and self.product_id
and "from_mrp_production" in self.env.context
and self.env.context.get("from_mrp_production", False)
):
stock_move = self.production_id.move_raw_ids.filtered(
lambda x: x.product_id == self.product_id
)
if not stock_move:
message = _("Reader product: %(product)s, not found in operations.") % {
"product": self.product_id.name,
}
raise ValidationError(message)
self.move_id = stock_move.id
return result
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?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_production_deconstruction.mrp_production_form_view"
/>
<field name="arch" type="xml">
<xpath
expr="//tree[@name='mrp_move_lines']/field[@name='product_id']"
position="before"
>
<field
name="reader"
attrs="{'readonly': [('state', '=', 'done')]}"
context="{'from_mrp_production':True}"
/>
</xpath>
</field>
</record>
</odoo>

0 comments on commit c047ac0

Please sign in to comment.