Skip to content

Commit

Permalink
[14.0][ADD] stock_production_lot_consumed_products: Lotes con nueva p…
Browse files Browse the repository at this point in the history
…estaña de lotes consumidos en la OF.
  • Loading branch information
alfredoavanzosc committed Jul 24, 2024
1 parent 1254311 commit 7e2c840
Show file tree
Hide file tree
Showing 10 changed files with 268 additions and 0 deletions.
30 changes: 30 additions & 0 deletions stock_production_lot_consumed_products/README.rst
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

======================================
Stock production lot consumed products
======================================

* In lots, new tab for show "OF Consumed products" with lots.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues
<https://github.com/avanzosc/odoo-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]>

Do not contact contributors directly about support or help with technical issues.

1 change: 1 addition & 0 deletions stock_production_lot_consumed_products/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
15 changes: 15 additions & 0 deletions stock_production_lot_consumed_products/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright 2023 Alfredo de la Fuente - AvanzOSC
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
{
"name": "Stock Production Lot Consumed Products",
"version": "14.0.1.0.0",
"author": "Avanzosc",
"category": "Inventory/Inventory",
"website": "https://github.com/avanzosc/odoo-addons",
"depends": ["stock", "mrp"],
"data": [
"views/stock_production_lot_views.xml",
],
"license": "AGPL-3",
"installable": True,
}
42 changes: 42 additions & 0 deletions stock_production_lot_consumed_products/i18n/en_US.po
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:
# * stock_production_lot_consumed_products
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0+e\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-06-28 10:59+0000\n"
"PO-Revision-Date: 2023-06-28 10:59+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: stock_production_lot_consumed_products
#: model:ir.model.fields,field_description:stock_production_lot_consumed_products.field_stock_production_lot__display_name
msgid "Display Name"
msgstr ""

#. module: stock_production_lot_consumed_products
#: model:ir.model.fields,field_description:stock_production_lot_consumed_products.field_stock_production_lot__id
msgid "ID"
msgstr ""

#. module: stock_production_lot_consumed_products
#: model:ir.model.fields,field_description:stock_production_lot_consumed_products.field_stock_production_lot____last_update
msgid "Last Modified on"
msgstr ""

#. module: stock_production_lot_consumed_products
#: model:ir.model,name:stock_production_lot_consumed_products.model_stock_production_lot
msgid "Lot/Serial"
msgstr ""

#. module: stock_production_lot_consumed_products
#: model:ir.model.fields,field_description:stock_production_lot_consumed_products.field_stock_production_lot__of_lots_ids
#: model_terms:ir.ui.view,arch_db:stock_production_lot_consumed_products.view_production_lot_form
msgid "OF Consumed products with lot"
msgstr ""
42 changes: 42 additions & 0 deletions stock_production_lot_consumed_products/i18n/es.po
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:
# * stock_production_lot_consumed_products
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0+e\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-06-28 11:00+0000\n"
"PO-Revision-Date: 2023-06-28 11:00+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: stock_production_lot_consumed_products
#: model:ir.model.fields,field_description:stock_production_lot_consumed_products.field_stock_production_lot__display_name
msgid "Display Name"
msgstr "Nombre mostrado"

#. module: stock_production_lot_consumed_products
#: model:ir.model.fields,field_description:stock_production_lot_consumed_products.field_stock_production_lot__id
msgid "ID"
msgstr ""

#. module: stock_production_lot_consumed_products
#: model:ir.model.fields,field_description:stock_production_lot_consumed_products.field_stock_production_lot____last_update
msgid "Last Modified on"
msgstr "Última modificación en"

#. module: stock_production_lot_consumed_products
#: model:ir.model,name:stock_production_lot_consumed_products.model_stock_production_lot
msgid "Lot/Serial"
msgstr "Lote/Número de serie"

#. module: stock_production_lot_consumed_products
#: model:ir.model.fields,field_description:stock_production_lot_consumed_products.field_stock_production_lot__of_lots_ids
#: model_terms:ir.ui.view,arch_db:stock_production_lot_consumed_products.view_production_lot_form
msgid "OF Consumed products with lot"
msgstr "OF Productos consumidos con lote"
42 changes: 42 additions & 0 deletions stock_production_lot_consumed_products/i18n/it.po
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:
# * stock_production_lot_consumed_products
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0+e\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-06-28 11:00+0000\n"
"PO-Revision-Date: 2023-06-28 11:00+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: stock_production_lot_consumed_products
#: model:ir.model.fields,field_description:stock_production_lot_consumed_products.field_stock_production_lot__display_name
msgid "Display Name"
msgstr "Nome visualizzato"

#. module: stock_production_lot_consumed_products
#: model:ir.model.fields,field_description:stock_production_lot_consumed_products.field_stock_production_lot__id
msgid "ID"
msgstr ""

#. module: stock_production_lot_consumed_products
#: model:ir.model.fields,field_description:stock_production_lot_consumed_products.field_stock_production_lot____last_update
msgid "Last Modified on"
msgstr "Ultima modifica il"

#. module: stock_production_lot_consumed_products
#: model:ir.model,name:stock_production_lot_consumed_products.model_stock_production_lot
msgid "Lot/Serial"
msgstr "Lotto/Serie"

#. module: stock_production_lot_consumed_products
#: model:ir.model.fields,field_description:stock_production_lot_consumed_products.field_stock_production_lot__of_lots_ids
#: model_terms:ir.ui.view,arch_db:stock_production_lot_consumed_products.view_production_lot_form
msgid "OF Consumed products with lot"
msgstr ""
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:
# * stock_production_lot_consumed_products
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0+e\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-06-28 10:59+0000\n"
"PO-Revision-Date: 2023-06-28 10:59+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: stock_production_lot_consumed_products
#: model:ir.model.fields,field_description:stock_production_lot_consumed_products.field_stock_production_lot__display_name
msgid "Display Name"
msgstr ""

#. module: stock_production_lot_consumed_products
#: model:ir.model.fields,field_description:stock_production_lot_consumed_products.field_stock_production_lot__id
msgid "ID"
msgstr ""

#. module: stock_production_lot_consumed_products
#: model:ir.model.fields,field_description:stock_production_lot_consumed_products.field_stock_production_lot____last_update
msgid "Last Modified on"
msgstr ""

#. module: stock_production_lot_consumed_products
#: model:ir.model,name:stock_production_lot_consumed_products.model_stock_production_lot
msgid "Lot/Serial"
msgstr ""

#. module: stock_production_lot_consumed_products
#: model:ir.model.fields,field_description:stock_production_lot_consumed_products.field_stock_production_lot__of_lots_ids
#: model_terms:ir.ui.view,arch_db:stock_production_lot_consumed_products.view_production_lot_form
msgid "OF Consumed products with lot"
msgstr ""
1 change: 1 addition & 0 deletions stock_production_lot_consumed_products/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import stock_production_lot
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Copyright 2023 Alfredo de la Fuente - AvanzOSC
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import fields, models


class StockProductionLot(models.Model):
_inherit = "stock.production.lot"

of_lots_ids = fields.Many2many(
string="OF Consumed products with lot",
comodel_name="stock.move.line",
compute="_compute_of_lots_ids",
)

def _compute_of_lots_ids(self):
for lot in self:
move_lines = self.env["stock.move.line"]
cond = [("lot_producing_id", "=", lot.id)]
production = self.env["mrp.production"].search(cond)
if production:
components = production.move_raw_ids.filtered(
lambda x: x.state == "done"
)
for component in components:
for line in component.move_line_ids.filtered(lambda z: z.lot_id):
if line not in move_lines:
move_lines += line
lot.of_lots_ids = (
[(6, 0, [])] if not move_lines else [(6, 0, move_lines.ids)]
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="view_production_lot_form" model="ir.ui.view">
<field name="model">stock.production.lot</field>
<field name="inherit_id" ref="stock.view_production_lot_form" />
<field name="arch" type="xml">
<page name="description" position="after">
<page
name="of_consumed_products"
string="OF Consumed products with lot"
>
<field name="of_lots_ids" nolabel="1">
<tree>
<field name="product_id" />
<field name="lot_id" />
<field name="qty_done" />
</tree>
</field>
</page>
</page>
</field>
</record>
</odoo>

0 comments on commit 7e2c840

Please sign in to comment.