-
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] product_last_mrp_info: In products new fields: "Last Manu…
…facturing Order", and "Last Manufacturing Order Date". (#389) Co-authored-by: Ana Juaristi <ajuaristio@gmail.com>
- Loading branch information
1 parent
196bab7
commit 1a7a10c
Showing
10 changed files
with
193 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,28 @@ | ||
.. 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 | ||
|
||
===================== | ||
Product last mrp info | ||
===================== | ||
|
||
* In products new fields: "Last Manufacturing Order", and | ||
"Last Manufacturing Order Date". | ||
|
||
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 <ajuaristio@gmail.com> | ||
* 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,3 @@ | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
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 - See http://www.gnu.org/licenses/agpl-3.0.html | ||
{ | ||
"name": "Product Last MRP Info", | ||
"version": "16.0.1.0.0", | ||
"license": "AGPL-3", | ||
"category": "Manufacturing", | ||
"author": "Avanzosc", | ||
"website": "https://github.com/avanzosc/mrp-addons", | ||
"depends": [ | ||
"product", | ||
"mrp", | ||
], | ||
"data": ["views/product_product_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,36 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * product_last_mrp_info | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 16.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2024-05-16 11:00+0000\n" | ||
"PO-Revision-Date: 2024-05-16 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: product_last_mrp_info | ||
#: model:ir.model.fields,field_description:product_last_mrp_info.field_product_product__last_mrp_id | ||
msgid "Last Manufacturing Order" | ||
msgstr "Última OF" | ||
|
||
#. module: product_last_mrp_info | ||
#: model:ir.model.fields,field_description:product_last_mrp_info.field_product_product__last_mrp_date | ||
msgid "Last Manufacturing Order Date" | ||
msgstr "Última fecha OF" | ||
|
||
#. module: product_last_mrp_info | ||
#: model_terms:ir.ui.view,arch_db:product_last_mrp_info.product_normal_form_view | ||
msgid "MRP" | ||
msgstr "MRP" | ||
|
||
#. module: product_last_mrp_info | ||
#: model:ir.model,name:product_last_mrp_info.model_product_product | ||
msgid "Product Variant" | ||
msgstr "Variante de producto" |
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,36 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * product_last_mrp_info | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 16.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2024-05-16 11:00+0000\n" | ||
"PO-Revision-Date: 2024-05-16 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: product_last_mrp_info | ||
#: model:ir.model.fields,field_description:product_last_mrp_info.field_product_product__last_mrp_id | ||
msgid "Last Manufacturing Order" | ||
msgstr "" | ||
|
||
#. module: product_last_mrp_info | ||
#: model:ir.model.fields,field_description:product_last_mrp_info.field_product_product__last_mrp_date | ||
msgid "Last Manufacturing Order Date" | ||
msgstr "" | ||
|
||
#. module: product_last_mrp_info | ||
#: model_terms:ir.ui.view,arch_db:product_last_mrp_info.product_normal_form_view | ||
msgid "MRP" | ||
msgstr "" | ||
|
||
#. module: product_last_mrp_info | ||
#: model:ir.model,name:product_last_mrp_info.model_product_product | ||
msgid "Product Variant" | ||
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 product_product |
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,29 @@ | ||
# Copyright 2024 Alfredo de la Fuente - AvanzOSC | ||
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html | ||
from odoo import fields, models | ||
|
||
|
||
class ProductProduct(models.Model): | ||
_inherit = "product.product" | ||
|
||
last_mrp_id = fields.Many2one( | ||
string="Last Manufacturing Order", | ||
comodel_name="mrp.production", | ||
compute="_compute_last_mrp_info", | ||
) | ||
last_mrp_date = fields.Datetime( | ||
string="Last Manufacturing Order Date", compute="_compute_last_mrp_info" | ||
) | ||
|
||
def _compute_last_mrp_info(self): | ||
for product in self: | ||
production = self.env["mrp.production"].search( | ||
[("product_id", "=", product.id), ("state", "=", "done")], | ||
limit=1, | ||
order="date_finished desc", | ||
) | ||
product._get_last_mrp_info(production) | ||
|
||
def _get_last_mrp_info(self, production): | ||
self.last_mrp_id = production.id | ||
self.last_mrp_date = production.date_finished |
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,37 @@ | ||
<odoo> | ||
<record id="product_normal_form_view" model="ir.ui.view"> | ||
<field name="model">product.product</field> | ||
<field name="inherit_id" ref="product.product_normal_form_view" /> | ||
<field name="arch" type="xml"> | ||
<page name="inventory" position="after"> | ||
<page | ||
string="MRP" | ||
name="page-mrp" | ||
groups="mrp.group_mrp_user" | ||
attrs="{'invisible':[('type', '=', 'service')]}" | ||
> | ||
<group name="group-mrp"> | ||
<field name="last_mrp_id" /> | ||
<field name="last_mrp_date" /> | ||
</group> | ||
</page> | ||
</page> | ||
</field> | ||
</record> | ||
|
||
<record id="product_product_tree_view" model="ir.ui.view"> | ||
<field name="model">product.product</field> | ||
<field name="inherit_id" ref="product.product_product_tree_view" /> | ||
<field name="arch" type="xml"> | ||
<field name="standard_price" position="before"> | ||
<field name="last_mrp_id" optional="show" groups="mrp.group_mrp_user" /> | ||
<field | ||
name="last_mrp_date" | ||
optional="show" | ||
widget="date" | ||
groups="mrp.group_mrp_user" | ||
/> | ||
</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 @@ | ||
../../../../product_last_mrp_info |
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, | ||
) |