Skip to content

Commit

Permalink
[IMP] mrp_usability: Change condition to show "Check Availability" an…
Browse files Browse the repository at this point in the history
…d "Unreserve" buttons.
  • Loading branch information
alfredoavanzosc authored and oihane committed Jan 9, 2025
1 parent eb29742 commit 557a56b
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 35 deletions.
6 changes: 5 additions & 1 deletion mrp_usability/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,14 @@
Manufacturing Usability
=======================

* The buttons that are in the tree view of the work order, put them also in the form view.
* The buttons that are in the tree view of the work order, put them also in the
form view.
* Link from Production to Work Orders.
* In manufacturing order form new tab "Move Lines", and new field "Finished Move
lines".
* Show "Unreserve" button, only if there is a reserved component.
* Show "Check Availabitiy", only if some component is not reserved, or partially
reserved.

Bug Tracker
===========
Expand Down
2 changes: 1 addition & 1 deletion mrp_usability/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
{
"name": "Manufacturing Usability",
"version": "16.0.1.1.0",
"version": "16.0.1.2.0",
"author": "AvanzOSC",
"website": "https://github.com/avanzosc/mrp-addons",
"category": "Hidden",
Expand Down
4 changes: 2 additions & 2 deletions mrp_usability/i18n/ca_ES.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-10-14 06:21+0000\n"
"PO-Revision-Date: 2024-10-14 06:21+0000\n"
"POT-Creation-Date: 2024-12-19 06:14+0000\n"
"PO-Revision-Date: 2024-12-19 06:14+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
Expand Down
4 changes: 2 additions & 2 deletions mrp_usability/i18n/en_GB.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-10-14 06:21+0000\n"
"PO-Revision-Date: 2024-10-14 06:21+0000\n"
"POT-Creation-Date: 2024-12-19 06:15+0000\n"
"PO-Revision-Date: 2024-12-19 06:15+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
Expand Down
31 changes: 18 additions & 13 deletions mrp_usability/i18n/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-09-05 07:42+0000\n"
"PO-Revision-Date: 2023-09-05 07:42+0000\n"
"POT-Creation-Date: 2024-12-19 06:15+0000\n"
"PO-Revision-Date: 2024-12-19 06:15+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
Expand All @@ -30,6 +30,17 @@ msgstr "Bloquear"
msgid "Done"
msgstr "Hecho"

#. module: mrp_usability
#: model:ir.model.fields,field_description:mrp_usability.field_mrp_production__finished_move_line_ids
msgid "Finished Product"
msgstr "Producto terminado"

#. module: mrp_usability
#: model:ir.model.fields,field_description:mrp_usability.field_mrp_production__move_line_ids
#: model_terms:ir.ui.view,arch_db:mrp_usability.mrp_production_form_view
msgid "Move Lines"
msgstr "Operaciones detalladas"

#. module: mrp_usability
#: model_terms:ir.ui.view,arch_db:mrp_usability.mrp_production_workorder_form_view_inherit
msgid "Pause"
Expand All @@ -45,23 +56,17 @@ msgstr "Orden de producción"
msgid "Start"
msgstr "Iniciar"

#. module: mrp_usability
#: model_terms:ir.ui.view,arch_db:mrp_usability.mrp_production_form_view
msgid "Total Reserved"
msgstr ""

#. module: mrp_usability
#: model_terms:ir.ui.view,arch_db:mrp_usability.mrp_production_workorder_form_view_inherit
msgid "Unblock"
msgstr "Desbloquear"

#. module: mrp_usability
#. odoo-python
#: code:addons/mrp_usability/models/mrp_production.py:0
#: code:addons/temp-addons/mrp_usability/models/mrp_production.py:0
#: model_terms:ir.ui.view,arch_db:mrp_usability.mrp_production_form_view
#, python-format
msgid "Work Orders"
msgstr "Órdenes de Trabajo"

#. module: mrp_usability
#: model:ir.model.fields,field_description:mrp_usability.field_mrp_production__move_line_ids
#: model_terms:ir.ui.view,arch_db:mrp_usability.mrp_production_form_view
msgid "Move Lines"
msgstr "Operaciones detalladas"

4 changes: 2 additions & 2 deletions mrp_usability/i18n/fr.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-10-14 06:22+0000\n"
"PO-Revision-Date: 2024-10-14 06:22+0000\n"
"POT-Creation-Date: 2024-12-19 06:15+0000\n"
"PO-Revision-Date: 2024-12-19 06:15+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
Expand Down
31 changes: 18 additions & 13 deletions mrp_usability/i18n/mrp_usability.pot
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-09-05 07:42+0000\n"
"PO-Revision-Date: 2023-09-05 07:42+0000\n"
"POT-Creation-Date: 2024-12-19 06:14+0000\n"
"PO-Revision-Date: 2024-12-19 06:14+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
Expand All @@ -30,6 +30,17 @@ msgstr ""
msgid "Done"
msgstr ""

#. module: mrp_usability
#: model:ir.model.fields,field_description:mrp_usability.field_mrp_production__finished_move_line_ids
msgid "Finished Product"
msgstr ""

#. module: mrp_usability
#: model:ir.model.fields,field_description:mrp_usability.field_mrp_production__move_line_ids
#: model_terms:ir.ui.view,arch_db:mrp_usability.mrp_production_form_view
msgid "Move Lines"
msgstr ""

#. module: mrp_usability
#: model_terms:ir.ui.view,arch_db:mrp_usability.mrp_production_workorder_form_view_inherit
msgid "Pause"
Expand All @@ -46,22 +57,16 @@ msgid "Start"
msgstr ""

#. module: mrp_usability
#: model_terms:ir.ui.view,arch_db:mrp_usability.mrp_production_workorder_form_view_inherit
msgid "Unblock"
#: model_terms:ir.ui.view,arch_db:mrp_usability.mrp_production_form_view
msgid "Total Reserved"
msgstr ""

#. module: mrp_usability
#. odoo-python
#: code:addons/mrp_usability/models/mrp_production.py:0
#: code:addons/temp-addons/mrp_usability/models/mrp_production.py:0
#: model_terms:ir.ui.view,arch_db:mrp_usability.mrp_production_form_view
#, python-format
msgid "Work Orders"
#: model_terms:ir.ui.view,arch_db:mrp_usability.mrp_production_workorder_form_view_inherit
msgid "Unblock"
msgstr ""

#. module: mrp_usability
#: model:ir.model.fields,field_description:mrp_usability.field_mrp_production__move_line_ids
#: model_terms:ir.ui.view,arch_db:mrp_usability.mrp_production_form_view
msgid "Move Lines"
msgid "Work Orders"
msgstr ""

17 changes: 16 additions & 1 deletion mrp_usability/models/mrp_production.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
import ast

from odoo import fields, models
from odoo import api, fields, models
from odoo.models import expression
from odoo.tools.safe_eval import safe_eval

Expand Down Expand Up @@ -34,6 +34,21 @@ def _compute_workorder_count(self):
],
)

@api.depends("move_raw_ids", "state", "move_raw_ids.product_uom_qty")
def _compute_unreserve_visible(self):
result = super()._compute_unreserve_visible()
for production in self:
production.reserve_visible = any(
[
x.state in ("confirmed", "partially_available")
for x in production.move_raw_ids
]
)
production.unreserve_visible = any(
[x.state == "assigned" for x in production.move_raw_ids]
)
return result

def action_view_workorder(self):
self.ensure_one()
action = self.env["ir.actions.act_window"]._for_xml_id("mrp.mrp_workorder_todo")
Expand Down

0 comments on commit 557a56b

Please sign in to comment.