diff --git a/maintenance_stock/README.rst b/maintenance_stock/README.rst new file mode 100644 index 000000000..e8e1c81aa --- /dev/null +++ b/maintenance_stock/README.rst @@ -0,0 +1,122 @@ +================= +Maintenance Stock +================= + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fmaintenance-lightgray.png?logo=github + :target: https://github.com/OCA/maintenance/tree/12.0/maintenance_stock + :alt: OCA/maintenance +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/maintenance-12-0/maintenance-12-0-maintenance_stock + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/240/12.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module extends the functionality of Odoo Maintenance module by allowing +link stock consumptions to maintenance requests. + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +Once installed, first you should enable consumptions for a certain equipment +and filling a default warehouse for the picking operations: + +.. figure:: https://raw.githubusercontent.com/OCA/maintenance/12.0/maintenance_stock/static/description/equipment.png + :alt: Kanban view + :width: 600 px + +Then, for every mainteance request of this equipment, *Picking List* button +allows us to make consumptions, that will be picking documents with their own +sequence: + +.. figure:: https://raw.githubusercontent.com/OCA/maintenance/12.0/maintenance_stock/static/description/request-1.png + :alt: Kanban view + :width: 600 px + +.. figure:: https://raw.githubusercontent.com/OCA/maintenance/12.0/maintenance_stock/static/description/pick-1.png + :alt: Kanban view + :width: 600 px + +By default, the origin location for this operations will be the stock location +for the default warehouse, and destination a new *Consumptions* location, that +will not compute for stock inventory, like e.g. partner locations: + +.. figure:: https://raw.githubusercontent.com/OCA/maintenance/12.0/maintenance_stock/static/description/move-line.png + :alt: Kanban view + :width: 600 px + +From both request and equipment forms these stock operations and *Product Moves* +are available. + +Return operations are also enabled, and will be linked to the request and +equipment as well: + +.. figure:: https://raw.githubusercontent.com/OCA/maintenance/12.0/maintenance_stock/static/description/pick-2.png + :alt: Kanban view + :width: 600 px + +Known issues / Roadmap +====================== + +* Product standard list. Enable defining product standard lists (at least, + product and quantity per line), and link them with equipments. Then, every + maintenance request could select one of them and automatically fill the + product and quantity list. + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Solvos + +Contributors +~~~~~~~~~~~~ + +* David Alonso + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +This module is part of the `OCA/maintenance `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/maintenance_stock/__init__.py b/maintenance_stock/__init__.py new file mode 100644 index 000000000..cc6b6354a --- /dev/null +++ b/maintenance_stock/__init__.py @@ -0,0 +1,2 @@ +from . import models +from .hooks import post_init_hook diff --git a/maintenance_stock/__manifest__.py b/maintenance_stock/__manifest__.py new file mode 100644 index 000000000..9dfee2e04 --- /dev/null +++ b/maintenance_stock/__manifest__.py @@ -0,0 +1,27 @@ +# © 2020 Solvos Consultoría Informática () +# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html +{ + "name": "Maintenance Stock", + "summary": "Links maintenance requests to stock", + "author": "Odoo Community Association (OCA), Solvos", + "license": "AGPL-3", + "version": "14.0.1.0.0", + "category": "Warehouse", + "website": "https://github.com/OCA/maintenance", + "depends": [ + "base_maintenance", + "stock", + ], + "data": [ + "views/maintenance_equipment_views.xml", + "views/maintenance_request_views.xml", + "views/stock_move_views.xml", + "views/stock_move_line_views.xml", + "views/stock_picking_views.xml", + ], + "demo": [ + "data/demo_maintenance_stock.xml", + ], + "post_init_hook": "post_init_hook", + "installable": True, +} diff --git a/maintenance_stock/data/demo_maintenance_stock.xml b/maintenance_stock/data/demo_maintenance_stock.xml new file mode 100644 index 000000000..15352810f --- /dev/null +++ b/maintenance_stock/data/demo_maintenance_stock.xml @@ -0,0 +1,150 @@ + + + + Inventory adjustment + inventory + + + + Maintenance Warehouse + + Main + one_step + ship_only + + + + + + + + TON_1234 + Toner + product + + 100.0 + 70.0 + + + + + + + + Inventory for Toner + + + + + + + + + 50.0 + + + + + + + + + + + + + + + + + Change toner + + + + 7 + + + + + + + 1.0 + + + + + + + + + + + + + + + + + + + + + diff --git a/maintenance_stock/hooks.py b/maintenance_stock/hooks.py new file mode 100644 index 000000000..0e5c1af60 --- /dev/null +++ b/maintenance_stock/hooks.py @@ -0,0 +1,24 @@ +# © 2020 Solvos Consultoría Informática () +# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html + +import logging + +from odoo import SUPERUSER_ID, api + + +def post_init_hook(cr, registry): + logging.getLogger("odoo.addons.maintenance_stock").info( + "Adding pending locations, sequences and pìcking types to " "current warehouses" + ) + + env = api.Environment(cr, SUPERUSER_ID, {}) + PickingType = env["stock.picking.type"] + for warehouse in env["stock.warehouse"].search([]): + warehouse._create_missing_locations(vals={}) + new_vals = warehouse._create_or_update_sequences_and_picking_types() + warehouse.write(new_vals) + # return picking type workaround for existing warehouses + if "cons_type_id" in new_vals: + PickingType.browse(new_vals["cons_type_id"]).write( + {"return_picking_type_id": warehouse.in_type_id.id} + ) diff --git a/maintenance_stock/i18n/es.po b/maintenance_stock/i18n/es.po new file mode 100644 index 000000000..4f9a0ad32 --- /dev/null +++ b/maintenance_stock/i18n/es.po @@ -0,0 +1,192 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * maintenance_stock +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2020-10-02 16:16+0000\n" +"Last-Translator: David Alonso (Solvos) \n" +"Language-Team: none\n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 3.10\n" + +#. module: maintenance_stock +#: model_terms:ir.ui.view,arch_db:maintenance_stock.equipment_request_view_form +#: model_terms:ir.ui.view,arch_db:maintenance_stock.hr_equipment_view_form +msgid "Picking list" +msgstr "Lista de albaranes" + +#. module: maintenance_stock +#: model_terms:ir.ui.view,arch_db:maintenance_stock.equipment_request_view_form +#: model_terms:ir.ui.view,arch_db:maintenance_stock.hr_equipment_view_form +msgid "Product Moves" +msgstr "Movimientos de producto" + +#. module: maintenance_stock +#: model_terms:ir.ui.view,arch_db:maintenance_stock.equipment_request_view_form +#: model_terms:ir.ui.view,arch_db:maintenance_stock.hr_equipment_view_form +msgid "Stock Moves" +msgstr "Movimientos de stock" + +#. module: maintenance_stock +#: model:ir.model.fields,field_description:maintenance_stock.field_maintenance_equipment__allow_consumptions +#: model:ir.model.fields,field_description:maintenance_stock.field_maintenance_request__allow_consumptions +#: model_terms:ir.ui.view,arch_db:maintenance_stock.hr_equipment_request_view_search +#: model_terms:ir.ui.view,arch_db:maintenance_stock.hr_equipment_view_search +msgid "Allow Consumptions" +msgstr "Permitir consumos" + +#. module: maintenance_stock +#: code:addons/maintenance_stock/models/stock_warehouse.py:42 +#: model:stock.picking.type,name:maintenance_stock.main_picking_type_cons +#, python-format +msgid "Consumption" +msgstr "Consumo" + +#. module: maintenance_stock +#: model:ir.model.fields,field_description:maintenance_stock.field_stock_warehouse__wh_cons_loc_id +msgid "Consumption Location" +msgstr "Ubicación de consumo" + +#. module: maintenance_stock +#: model:ir.model.fields,field_description:maintenance_stock.field_stock_warehouse__cons_type_id +msgid "Consumption Type" +msgstr "Tipo de consumo" + +#. module: maintenance_stock +#: code:addons/maintenance_stock/models/stock_warehouse.py:79 +#, python-format +msgid "Consumptions" +msgstr "Consumos" + +#. module: maintenance_stock +#: model_terms:ir.actions.act_window,help:maintenance_stock.stock_move_action +msgid "Create a new stock movement" +msgstr "Crear nuevo movimiento de stock" + +#. module: maintenance_stock +#: model:ir.model.fields,field_description:maintenance_stock.field_maintenance_equipment__default_consumption_warehouse_id +#: model:ir.model.fields,field_description:maintenance_stock.field_maintenance_request__default_consumption_warehouse_id +msgid "Default Consumption Warehouse" +msgstr "Almacén de consumo por defecto" + +#. module: maintenance_stock +#: model:ir.model.fields,field_description:maintenance_stock.field_stock_move__maintenance_equipment_id +#: model:ir.model.fields,field_description:maintenance_stock.field_stock_move_line__maintenance_equipment_id +#: model:ir.model.fields,field_description:maintenance_stock.field_stock_picking__maintenance_equipment_id +msgid "Equipment" +msgstr "Equipo" + +#. module: maintenance_stock +#: model:ir.model,name:maintenance_stock.model_maintenance_equipment +msgid "Maintenance Equipment" +msgstr "Equipo de mantenimiento" + +#. module: maintenance_stock +#: model_terms:ir.ui.view,arch_db:maintenance_stock.view_picking_form +msgid "Maintenance Info" +msgstr "Información de Mantenimiento" + +#. module: maintenance_stock +#: model:ir.model,name:maintenance_stock.model_maintenance_request +#: model:ir.model.fields,field_description:maintenance_stock.field_stock_move__maintenance_request_id +#: model:ir.model.fields,field_description:maintenance_stock.field_stock_move_line__maintenance_request_id +#: model:ir.model.fields,field_description:maintenance_stock.field_stock_picking__maintenance_request_id +msgid "Maintenance Request" +msgstr "Petición de mantenimiento" + +#. module: maintenance_stock +#: model_terms:ir.ui.view,arch_db:maintenance_stock.stock_move_line_view_search +#: model_terms:ir.ui.view,arch_db:maintenance_stock.view_move_search +#: model_terms:ir.ui.view,arch_db:maintenance_stock.view_picking_internal_search +msgid "Maintenance Request consumption" +msgstr "Consumo de la petición de mantenimiento" + +#. module: maintenance_stock +#: model:ir.model.fields,field_description:maintenance_stock.field_maintenance_request__stock_picking_ids +msgid "Picking list" +msgstr "Lista de albaranes" + +#. module: maintenance_stock +#: model:ir.actions.act_window,name:maintenance_stock.stock_move_line_action +#: model:ir.ui.menu,name:maintenance_stock.stock_move_line_menu +msgid "Product Moves" +msgstr "Movimientos de producto" + +#. module: maintenance_stock +#: model:ir.model,name:maintenance_stock.model_stock_move_line +msgid "Product Moves (Stock Move Line)" +msgstr "Movimientos de producto (línea de movimiento de stock)" + +#. module: maintenance_stock +#: code:addons/maintenance_stock/models/stock_warehouse.py:65 +#, python-format +msgid "Sequence consumption" +msgstr "Secuencia del consumo" + +#. module: maintenance_stock +#: model:ir.model,name:maintenance_stock.model_stock_move +msgid "Stock Move" +msgstr "Movimiento de stock" + +#. module: maintenance_stock +#: model:ir.actions.act_window,name:maintenance_stock.stock_move_action +#: model:ir.ui.menu,name:maintenance_stock.stock_move_menu +msgid "Stock Moves" +msgstr "Movimientos de stock" + +#. module: maintenance_stock +#: model:ir.model.fields,field_description:maintenance_stock.field_maintenance_equipment__stock_picking_ids +msgid "Stock Picking" +msgstr "Recolección de stock" + +#. module: maintenance_stock +#: model_terms:ir.actions.act_window,help:maintenance_stock.stock_move_line_action +msgid "There's no product move yet" +msgstr "Aún no hay ningún movimiento de producto" + +#. module: maintenance_stock +#: model_terms:ir.actions.act_window,help:maintenance_stock.stock_move_action +msgid "This menu gives you the full traceability of inventory\n" +" operations on a specific product. You can filter on the product\n" +" to see all the past or future movements for the product." +msgstr "" + +#. module: maintenance_stock +#: model_terms:ir.ui.view,arch_db:maintenance_stock.stock_move_line_view_search +msgid "To" +msgstr "Destino" + +#. module: maintenance_stock +#: model:product.product,name:maintenance_stock.product_toner +#: model:product.template,name:maintenance_stock.product_toner_product_template +msgid "Toner" +msgstr "Tóner" + +#. module: maintenance_stock +#: model:ir.model,name:maintenance_stock.model_stock_picking +msgid "Transfer" +msgstr "Trasferencia" + +#. module: maintenance_stock +#: model:product.product,uom_name:maintenance_stock.product_toner +#: model:product.template,uom_name:maintenance_stock.product_toner_product_template +msgid "Unit(s)" +msgstr "Unidad(es)" + +#. module: maintenance_stock +#: model:ir.model,name:maintenance_stock.model_stock_warehouse +msgid "Warehouse" +msgstr "Almacén" + +#. module: maintenance_stock +#: model:product.product,weight_uom_name:maintenance_stock.product_toner +#: model:product.template,weight_uom_name:maintenance_stock.product_toner_product_template +msgid "kg" +msgstr "kg" diff --git a/maintenance_stock/i18n/it.po b/maintenance_stock/i18n/it.po new file mode 100644 index 000000000..dbde84c61 --- /dev/null +++ b/maintenance_stock/i18n/it.po @@ -0,0 +1,196 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * maintenance_stock +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2023-05-18 13:32+0000\n" +"Last-Translator: Francesco Foresti \n" +"Language-Team: none\n" +"Language: it\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.16.4\n" + +#. module: maintenance_stock +#: model_terms:ir.ui.view,arch_db:maintenance_stock.equipment_request_view_form +#: model_terms:ir.ui.view,arch_db:maintenance_stock.hr_equipment_view_form +msgid "Picking list" +msgstr "Lista prelievo" + +#. module: maintenance_stock +#: model_terms:ir.ui.view,arch_db:maintenance_stock.equipment_request_view_form +#: model_terms:ir.ui.view,arch_db:maintenance_stock.hr_equipment_view_form +msgid "Product Moves" +msgstr "Movimento prodotto" + +#. module: maintenance_stock +#: model_terms:ir.ui.view,arch_db:maintenance_stock.equipment_request_view_form +#: model_terms:ir.ui.view,arch_db:maintenance_stock.hr_equipment_view_form +msgid "Stock Moves" +msgstr "Movimento di magazzino" + +#. module: maintenance_stock +#: model:ir.model.fields,field_description:maintenance_stock.field_maintenance_equipment__allow_consumptions +#: model:ir.model.fields,field_description:maintenance_stock.field_maintenance_request__allow_consumptions +#: model_terms:ir.ui.view,arch_db:maintenance_stock.hr_equipment_request_view_search +#: model_terms:ir.ui.view,arch_db:maintenance_stock.hr_equipment_view_search +msgid "Allow Consumptions" +msgstr "Consenti consumo" + +#. module: maintenance_stock +#: code:addons/maintenance_stock/models/stock_warehouse.py:42 +#: model:stock.picking.type,name:maintenance_stock.main_picking_type_cons +#, python-format +msgid "Consumption" +msgstr "Consumo" + +#. module: maintenance_stock +#: model:ir.model.fields,field_description:maintenance_stock.field_stock_warehouse__wh_cons_loc_id +msgid "Consumption Location" +msgstr "Ubicazione di consumo" + +#. module: maintenance_stock +#: model:ir.model.fields,field_description:maintenance_stock.field_stock_warehouse__cons_type_id +msgid "Consumption Type" +msgstr "Tipi di consumo" + +#. module: maintenance_stock +#: code:addons/maintenance_stock/models/stock_warehouse.py:79 +#, python-format +msgid "Consumptions" +msgstr "Consumi" + +#. module: maintenance_stock +#: model_terms:ir.actions.act_window,help:maintenance_stock.stock_move_action +msgid "Create a new stock movement" +msgstr "Crea un nuovo movimento di magazzino" + +#. module: maintenance_stock +#: model:ir.model.fields,field_description:maintenance_stock.field_maintenance_equipment__default_consumption_warehouse_id +#: model:ir.model.fields,field_description:maintenance_stock.field_maintenance_request__default_consumption_warehouse_id +msgid "Default Consumption Warehouse" +msgstr "Magazzino di consumo predefinito" + +#. module: maintenance_stock +#: model:ir.model.fields,field_description:maintenance_stock.field_stock_move__maintenance_equipment_id +#: model:ir.model.fields,field_description:maintenance_stock.field_stock_move_line__maintenance_equipment_id +#: model:ir.model.fields,field_description:maintenance_stock.field_stock_picking__maintenance_equipment_id +msgid "Equipment" +msgstr "Attrezzatura" + +#. module: maintenance_stock +#: model:ir.model,name:maintenance_stock.model_maintenance_equipment +msgid "Maintenance Equipment" +msgstr "Attrezzatura manutenzione" + +#. module: maintenance_stock +#: model_terms:ir.ui.view,arch_db:maintenance_stock.view_picking_form +msgid "Maintenance Info" +msgstr "Informazioni manutenzione" + +#. module: maintenance_stock +#: model:ir.model,name:maintenance_stock.model_maintenance_request +#: model:ir.model.fields,field_description:maintenance_stock.field_stock_move__maintenance_request_id +#: model:ir.model.fields,field_description:maintenance_stock.field_stock_move_line__maintenance_request_id +#: model:ir.model.fields,field_description:maintenance_stock.field_stock_picking__maintenance_request_id +msgid "Maintenance Request" +msgstr "Richiesta manutenzione" + +#. module: maintenance_stock +#: model_terms:ir.ui.view,arch_db:maintenance_stock.stock_move_line_view_search +#: model_terms:ir.ui.view,arch_db:maintenance_stock.view_move_search +#: model_terms:ir.ui.view,arch_db:maintenance_stock.view_picking_internal_search +msgid "Maintenance Request consumption" +msgstr "Consumo richiesta manutenzione" + +#. module: maintenance_stock +#: model:ir.model.fields,field_description:maintenance_stock.field_maintenance_request__stock_picking_ids +msgid "Picking list" +msgstr "Lista prelievo" + +#. module: maintenance_stock +#: model:ir.actions.act_window,name:maintenance_stock.stock_move_line_action +#: model:ir.ui.menu,name:maintenance_stock.stock_move_line_menu +msgid "Product Moves" +msgstr "Movimenti prodotto" + +#. module: maintenance_stock +#: model:ir.model,name:maintenance_stock.model_stock_move_line +msgid "Product Moves (Stock Move Line)" +msgstr "Movimenti prodotto (riga movimento di magazzino)" + +#. module: maintenance_stock +#: code:addons/maintenance_stock/models/stock_warehouse.py:65 +#, python-format +msgid "Sequence consumption" +msgstr "Sequenza di consumo" + +#. module: maintenance_stock +#: model:ir.model,name:maintenance_stock.model_stock_move +msgid "Stock Move" +msgstr "Movimento di magazzino" + +#. module: maintenance_stock +#: model:ir.actions.act_window,name:maintenance_stock.stock_move_action +#: model:ir.ui.menu,name:maintenance_stock.stock_move_menu +msgid "Stock Moves" +msgstr "Movimenti di magazzino" + +#. module: maintenance_stock +#: model:ir.model.fields,field_description:maintenance_stock.field_maintenance_equipment__stock_picking_ids +msgid "Stock Picking" +msgstr "Prelievo di magazzino" + +#. module: maintenance_stock +#: model_terms:ir.actions.act_window,help:maintenance_stock.stock_move_line_action +msgid "There's no product move yet" +msgstr "Non ci sono ancora movimenti di prodotto" + +#. module: maintenance_stock +#: model_terms:ir.actions.act_window,help:maintenance_stock.stock_move_action +msgid "This menu gives you the full traceability of inventory\n" +" operations on a specific product. You can filter on the product\n" +" to see all the past or future movements for the product." +msgstr "" +"Questo menu fornisce la completa tracciabilità delle operazioni\n" +" di magazzino per un prodotto specifico. Si può filtrare sul " +"prodotto\n" +" per visualizzare i movimenti passati o futuri del prodotto." + +#. module: maintenance_stock +#: model_terms:ir.ui.view,arch_db:maintenance_stock.stock_move_line_view_search +msgid "To" +msgstr "A" + +#. module: maintenance_stock +#: model:product.product,name:maintenance_stock.product_toner +#: model:product.template,name:maintenance_stock.product_toner_product_template +msgid "Toner" +msgstr "Inchiostro" + +#. module: maintenance_stock +#: model:ir.model,name:maintenance_stock.model_stock_picking +msgid "Transfer" +msgstr "Trasferimento" + +#. module: maintenance_stock +#: model:product.product,uom_name:maintenance_stock.product_toner +#: model:product.template,uom_name:maintenance_stock.product_toner_product_template +msgid "Unit(s)" +msgstr "Unità" + +#. module: maintenance_stock +#: model:ir.model,name:maintenance_stock.model_stock_warehouse +msgid "Warehouse" +msgstr "Magazzino" + +#. module: maintenance_stock +#: model:product.product,weight_uom_name:maintenance_stock.product_toner +#: model:product.template,weight_uom_name:maintenance_stock.product_toner_product_template +msgid "kg" +msgstr "kg" diff --git a/maintenance_stock/i18n/maintenance_stock.pot b/maintenance_stock/i18n/maintenance_stock.pot new file mode 100644 index 000000000..64c7547ae --- /dev/null +++ b/maintenance_stock/i18n/maintenance_stock.pot @@ -0,0 +1,190 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * maintenance_stock +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \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: maintenance_stock +#: model_terms:ir.ui.view,arch_db:maintenance_stock.equipment_request_view_form +#: model_terms:ir.ui.view,arch_db:maintenance_stock.hr_equipment_view_form +msgid "Picking list" +msgstr "" + +#. module: maintenance_stock +#: model_terms:ir.ui.view,arch_db:maintenance_stock.equipment_request_view_form +#: model_terms:ir.ui.view,arch_db:maintenance_stock.hr_equipment_view_form +msgid "Product Moves" +msgstr "" + +#. module: maintenance_stock +#: model_terms:ir.ui.view,arch_db:maintenance_stock.equipment_request_view_form +#: model_terms:ir.ui.view,arch_db:maintenance_stock.hr_equipment_view_form +msgid "Stock Moves" +msgstr "" + +#. module: maintenance_stock +#: model:ir.model.fields,field_description:maintenance_stock.field_maintenance_equipment__allow_consumptions +#: model:ir.model.fields,field_description:maintenance_stock.field_maintenance_request__allow_consumptions +#: model_terms:ir.ui.view,arch_db:maintenance_stock.hr_equipment_request_view_search +#: model_terms:ir.ui.view,arch_db:maintenance_stock.hr_equipment_view_search +msgid "Allow Consumptions" +msgstr "" + +#. module: maintenance_stock +#: code:addons/maintenance_stock/models/stock_warehouse.py:42 +#: model:stock.picking.type,name:maintenance_stock.main_picking_type_cons +#, python-format +msgid "Consumption" +msgstr "" + +#. module: maintenance_stock +#: model:ir.model.fields,field_description:maintenance_stock.field_stock_warehouse__wh_cons_loc_id +msgid "Consumption Location" +msgstr "" + +#. module: maintenance_stock +#: model:ir.model.fields,field_description:maintenance_stock.field_stock_warehouse__cons_type_id +msgid "Consumption Type" +msgstr "" + +#. module: maintenance_stock +#: code:addons/maintenance_stock/models/stock_warehouse.py:79 +#, python-format +msgid "Consumptions" +msgstr "" + +#. module: maintenance_stock +#: model_terms:ir.actions.act_window,help:maintenance_stock.stock_move_action +msgid "Create a new stock movement" +msgstr "" + +#. module: maintenance_stock +#: model:ir.model.fields,field_description:maintenance_stock.field_maintenance_equipment__default_consumption_warehouse_id +#: model:ir.model.fields,field_description:maintenance_stock.field_maintenance_request__default_consumption_warehouse_id +msgid "Default Consumption Warehouse" +msgstr "" + +#. module: maintenance_stock +#: model:ir.model.fields,field_description:maintenance_stock.field_stock_move__maintenance_equipment_id +#: model:ir.model.fields,field_description:maintenance_stock.field_stock_move_line__maintenance_equipment_id +#: model:ir.model.fields,field_description:maintenance_stock.field_stock_picking__maintenance_equipment_id +msgid "Equipment" +msgstr "" + +#. module: maintenance_stock +#: model:ir.model,name:maintenance_stock.model_maintenance_equipment +msgid "Maintenance Equipment" +msgstr "" + +#. module: maintenance_stock +#: model_terms:ir.ui.view,arch_db:maintenance_stock.view_picking_form +msgid "Maintenance Info" +msgstr "" + +#. module: maintenance_stock +#: model:ir.model,name:maintenance_stock.model_maintenance_request +#: model:ir.model.fields,field_description:maintenance_stock.field_stock_move__maintenance_request_id +#: model:ir.model.fields,field_description:maintenance_stock.field_stock_move_line__maintenance_request_id +#: model:ir.model.fields,field_description:maintenance_stock.field_stock_picking__maintenance_request_id +msgid "Maintenance Request" +msgstr "" + +#. module: maintenance_stock +#: model_terms:ir.ui.view,arch_db:maintenance_stock.stock_move_line_view_search +#: model_terms:ir.ui.view,arch_db:maintenance_stock.view_move_search +#: model_terms:ir.ui.view,arch_db:maintenance_stock.view_picking_internal_search +msgid "Maintenance Request consumption" +msgstr "" + +#. module: maintenance_stock +#: model:ir.model.fields,field_description:maintenance_stock.field_maintenance_request__stock_picking_ids +msgid "Picking list" +msgstr "" + +#. module: maintenance_stock +#: model:ir.actions.act_window,name:maintenance_stock.stock_move_line_action +#: model:ir.ui.menu,name:maintenance_stock.stock_move_line_menu +msgid "Product Moves" +msgstr "" + +#. module: maintenance_stock +#: model:ir.model,name:maintenance_stock.model_stock_move_line +msgid "Product Moves (Stock Move Line)" +msgstr "" + +#. module: maintenance_stock +#: code:addons/maintenance_stock/models/stock_warehouse.py:65 +#, python-format +msgid "Sequence consumption" +msgstr "" + +#. module: maintenance_stock +#: model:ir.model,name:maintenance_stock.model_stock_move +msgid "Stock Move" +msgstr "" + +#. module: maintenance_stock +#: model:ir.actions.act_window,name:maintenance_stock.stock_move_action +#: model:ir.ui.menu,name:maintenance_stock.stock_move_menu +msgid "Stock Moves" +msgstr "" + +#. module: maintenance_stock +#: model:ir.model.fields,field_description:maintenance_stock.field_maintenance_equipment__stock_picking_ids +msgid "Stock Picking" +msgstr "" + +#. module: maintenance_stock +#: model_terms:ir.actions.act_window,help:maintenance_stock.stock_move_line_action +msgid "There's no product move yet" +msgstr "" + +#. module: maintenance_stock +#: model_terms:ir.actions.act_window,help:maintenance_stock.stock_move_action +msgid "This menu gives you the full traceability of inventory\n" +" operations on a specific product. You can filter on the product\n" +" to see all the past or future movements for the product." +msgstr "" + +#. module: maintenance_stock +#: model_terms:ir.ui.view,arch_db:maintenance_stock.stock_move_line_view_search +msgid "To" +msgstr "" + +#. module: maintenance_stock +#: model:product.product,name:maintenance_stock.product_toner +#: model:product.template,name:maintenance_stock.product_toner_product_template +msgid "Toner" +msgstr "" + +#. module: maintenance_stock +#: model:ir.model,name:maintenance_stock.model_stock_picking +msgid "Transfer" +msgstr "" + +#. module: maintenance_stock +#: model:product.product,uom_name:maintenance_stock.product_toner +#: model:product.template,uom_name:maintenance_stock.product_toner_product_template +msgid "Unit(s)" +msgstr "" + +#. module: maintenance_stock +#: model:ir.model,name:maintenance_stock.model_stock_warehouse +msgid "Warehouse" +msgstr "" + +#. module: maintenance_stock +#: model:product.product,weight_uom_name:maintenance_stock.product_toner +#: model:product.template,weight_uom_name:maintenance_stock.product_toner_product_template +msgid "kg" +msgstr "" + diff --git a/maintenance_stock/i18n/pt_BR.po b/maintenance_stock/i18n/pt_BR.po new file mode 100644 index 000000000..cc0d56062 --- /dev/null +++ b/maintenance_stock/i18n/pt_BR.po @@ -0,0 +1,197 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * maintenance_stock +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2021-03-15 06:45+0000\n" +"Last-Translator: Marcel Savegnago \n" +"Language-Team: none\n" +"Language: pt_BR\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n > 1;\n" +"X-Generator: Weblate 4.3.2\n" + +#. module: maintenance_stock +#: model_terms:ir.ui.view,arch_db:maintenance_stock.equipment_request_view_form +#: model_terms:ir.ui.view,arch_db:maintenance_stock.hr_equipment_view_form +msgid "Picking list" +msgstr "Lista de escolha" + +#. module: maintenance_stock +#: model_terms:ir.ui.view,arch_db:maintenance_stock.equipment_request_view_form +#: model_terms:ir.ui.view,arch_db:maintenance_stock.hr_equipment_view_form +msgid "Product Moves" +msgstr "Movimentos do Produto" + +#. module: maintenance_stock +#: model_terms:ir.ui.view,arch_db:maintenance_stock.equipment_request_view_form +#: model_terms:ir.ui.view,arch_db:maintenance_stock.hr_equipment_view_form +msgid "Stock Moves" +msgstr "Movimentos de Ações" + +#. module: maintenance_stock +#: model:ir.model.fields,field_description:maintenance_stock.field_maintenance_equipment__allow_consumptions +#: model:ir.model.fields,field_description:maintenance_stock.field_maintenance_request__allow_consumptions +#: model_terms:ir.ui.view,arch_db:maintenance_stock.hr_equipment_request_view_search +#: model_terms:ir.ui.view,arch_db:maintenance_stock.hr_equipment_view_search +msgid "Allow Consumptions" +msgstr "Permitir Consumos" + +#. module: maintenance_stock +#: code:addons/maintenance_stock/models/stock_warehouse.py:42 +#: model:stock.picking.type,name:maintenance_stock.main_picking_type_cons +#, python-format +msgid "Consumption" +msgstr "Consumo" + +#. module: maintenance_stock +#: model:ir.model.fields,field_description:maintenance_stock.field_stock_warehouse__wh_cons_loc_id +msgid "Consumption Location" +msgstr "Localização de Consumo" + +#. module: maintenance_stock +#: model:ir.model.fields,field_description:maintenance_stock.field_stock_warehouse__cons_type_id +msgid "Consumption Type" +msgstr "Tipo de Consumo" + +#. module: maintenance_stock +#: code:addons/maintenance_stock/models/stock_warehouse.py:79 +#, python-format +msgid "Consumptions" +msgstr "Consumos" + +#. module: maintenance_stock +#: model_terms:ir.actions.act_window,help:maintenance_stock.stock_move_action +msgid "Create a new stock movement" +msgstr "Crie um novo movimento de ações" + +#. module: maintenance_stock +#: model:ir.model.fields,field_description:maintenance_stock.field_maintenance_equipment__default_consumption_warehouse_id +#: model:ir.model.fields,field_description:maintenance_stock.field_maintenance_request__default_consumption_warehouse_id +msgid "Default Consumption Warehouse" +msgstr "Armazém de Consumo Padrão" + +#. module: maintenance_stock +#: model:ir.model.fields,field_description:maintenance_stock.field_stock_move__maintenance_equipment_id +#: model:ir.model.fields,field_description:maintenance_stock.field_stock_move_line__maintenance_equipment_id +#: model:ir.model.fields,field_description:maintenance_stock.field_stock_picking__maintenance_equipment_id +msgid "Equipment" +msgstr "Equipamento" + +#. module: maintenance_stock +#: model:ir.model,name:maintenance_stock.model_maintenance_equipment +msgid "Maintenance Equipment" +msgstr "Equipamento de Manutenção" + +#. module: maintenance_stock +#: model_terms:ir.ui.view,arch_db:maintenance_stock.view_picking_form +msgid "Maintenance Info" +msgstr "Informações de Manutenção" + +#. module: maintenance_stock +#: model:ir.model,name:maintenance_stock.model_maintenance_request +#: model:ir.model.fields,field_description:maintenance_stock.field_stock_move__maintenance_request_id +#: model:ir.model.fields,field_description:maintenance_stock.field_stock_move_line__maintenance_request_id +#: model:ir.model.fields,field_description:maintenance_stock.field_stock_picking__maintenance_request_id +msgid "Maintenance Request" +msgstr "Requisição de Manutenção" + +#. module: maintenance_stock +#: model_terms:ir.ui.view,arch_db:maintenance_stock.stock_move_line_view_search +#: model_terms:ir.ui.view,arch_db:maintenance_stock.view_move_search +#: model_terms:ir.ui.view,arch_db:maintenance_stock.view_picking_internal_search +msgid "Maintenance Request consumption" +msgstr "Consumo de Requisição de Manutenção" + +#. module: maintenance_stock +#: model:ir.model.fields,field_description:maintenance_stock.field_maintenance_request__stock_picking_ids +msgid "Picking list" +msgstr "Lista de separação" + +#. module: maintenance_stock +#: model:ir.actions.act_window,name:maintenance_stock.stock_move_line_action +#: model:ir.ui.menu,name:maintenance_stock.stock_move_line_menu +msgid "Product Moves" +msgstr "Movimentos do Produto" + +#. module: maintenance_stock +#: model:ir.model,name:maintenance_stock.model_stock_move_line +msgid "Product Moves (Stock Move Line)" +msgstr "Movimentos do Produto (Linha do Movimento do Estoque)" + +#. module: maintenance_stock +#: code:addons/maintenance_stock/models/stock_warehouse.py:65 +#, python-format +msgid "Sequence consumption" +msgstr "Consumo de sequência" + +#. module: maintenance_stock +#: model:ir.model,name:maintenance_stock.model_stock_move +msgid "Stock Move" +msgstr "Movimento de Estoque" + +#. module: maintenance_stock +#: model:ir.actions.act_window,name:maintenance_stock.stock_move_action +#: model:ir.ui.menu,name:maintenance_stock.stock_move_menu +msgid "Stock Moves" +msgstr "Movimentos de Estoque" + +#. module: maintenance_stock +#: model:ir.model.fields,field_description:maintenance_stock.field_maintenance_equipment__stock_picking_ids +msgid "Stock Picking" +msgstr "Separação de Estoque" + +#. module: maintenance_stock +#: model_terms:ir.actions.act_window,help:maintenance_stock.stock_move_line_action +msgid "There's no product move yet" +msgstr "Ainda não há nenhum movimento do produto" + +#. module: maintenance_stock +#: model_terms:ir.actions.act_window,help:maintenance_stock.stock_move_action +msgid "This menu gives you the full traceability of inventory\n" +" operations on a specific product. You can filter on the product\n" +" to see all the past or future movements for the product." +msgstr "" +"Este menu oferece a você a rastreabilidade completa de operações\n" +" de inventário em um produto específico. Você pode filtrar o " +"produto\n" +" para ver todos as movimentações passadas ou futuras para o " +"produto." + +#. module: maintenance_stock +#: model_terms:ir.ui.view,arch_db:maintenance_stock.stock_move_line_view_search +msgid "To" +msgstr "Para" + +#. module: maintenance_stock +#: model:product.product,name:maintenance_stock.product_toner +#: model:product.template,name:maintenance_stock.product_toner_product_template +msgid "Toner" +msgstr "Toner" + +#. module: maintenance_stock +#: model:ir.model,name:maintenance_stock.model_stock_picking +msgid "Transfer" +msgstr "Transferir" + +#. module: maintenance_stock +#: model:product.product,uom_name:maintenance_stock.product_toner +#: model:product.template,uom_name:maintenance_stock.product_toner_product_template +msgid "Unit(s)" +msgstr "UN" + +#. module: maintenance_stock +#: model:ir.model,name:maintenance_stock.model_stock_warehouse +msgid "Warehouse" +msgstr "Armazém" + +#. module: maintenance_stock +#: model:product.product,weight_uom_name:maintenance_stock.product_toner +#: model:product.template,weight_uom_name:maintenance_stock.product_toner_product_template +msgid "kg" +msgstr "kg" diff --git a/maintenance_stock/models/__init__.py b/maintenance_stock/models/__init__.py new file mode 100644 index 000000000..6de126006 --- /dev/null +++ b/maintenance_stock/models/__init__.py @@ -0,0 +1,6 @@ +from . import maintenance_equipment +from . import maintenance_request +from . import stock_move +from . import stock_move_line +from . import stock_picking +from . import stock_warehouse diff --git a/maintenance_stock/models/maintenance_equipment.py b/maintenance_stock/models/maintenance_equipment.py new file mode 100644 index 000000000..c6f5ba43d --- /dev/null +++ b/maintenance_stock/models/maintenance_equipment.py @@ -0,0 +1,65 @@ +# © 2020 Solvos Consultoría Informática () +# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html +from odoo import api, fields, models + + +class MaintenanceEquipment(models.Model): + _inherit = "maintenance.equipment" + + allow_consumptions = fields.Boolean( + groups="stock.group_stock_user", + ) + default_consumption_warehouse_id = fields.Many2one( + string="Default Consumption Warehouse", + comodel_name="stock.warehouse", + groups="stock.group_stock_user", + ) + + @api.onchange("allow_consumptions") + def _onchange_allow_consumptions(self): + if not self.allow_consumptions: + self.default_consumption_warehouse_id = False + + def action_view_stock_picking_ids(self): + self.ensure_one() + action = self.env["ir.actions.act_window"]._for_xml_id( + "stock.action_picking_tree_all" + ) + action["domain"] = [("maintenance_equipment_id", "=", self.id)] + action["context"] = { + "show_maintenance_request_id": True, + } + return action + + def action_view_stock_move_ids(self): + self.ensure_one() + action = self.env["ir.actions.act_window"]._for_xml_id( + "stock.stock_move_action" + ) + action["domain"] = [("maintenance_equipment_id", "=", self.id)] + return action + + def action_view_stock_move_line_ids(self): + self.ensure_one() + action = self.env["ir.actions.act_window"]._for_xml_id( + "stock.stock_move_line_action" + ) + action["domain"] = [("maintenance_equipment_id", "=", self.id)] + + # TODO Grouping by destination allows separating consumptions + # and returns. Look for a better system and remove this + show_groupby_to = ( + len( + self.env["stock.move.line"] + .search([("maintenance_equipment_id", "=", self.id)]) + .mapped("location_dest_id") + ) + > 1 + ) + + action["context"] = { + "search_default_done": 1, + "search_default_groupby_location_dest_id": show_groupby_to, + "search_default_groupby_product_id": 1, + } + return action diff --git a/maintenance_stock/models/maintenance_request.py b/maintenance_stock/models/maintenance_request.py new file mode 100644 index 000000000..79848e4cf --- /dev/null +++ b/maintenance_stock/models/maintenance_request.py @@ -0,0 +1,68 @@ +# © 2020 Solvos Consultoría Informática () +# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html +from odoo import fields, models + + +class MaintenanceRequest(models.Model): + _inherit = "maintenance.request" + + allow_consumptions = fields.Boolean( + related="equipment_id.allow_consumptions", + store=True, + groups="stock.group_stock_user", + ) + default_consumption_warehouse_id = fields.Many2one( + related="equipment_id.default_consumption_warehouse_id", + groups="stock.group_stock_user", + ) + stock_picking_ids = fields.One2many( + string="Picking list", + comodel_name="stock.picking", + inverse_name="maintenance_request_id", + groups="stock.group_stock_user", + ) + + def action_view_stock_picking_ids(self): + self.ensure_one() + action = self.env["ir.actions.act_window"]._for_xml_id( + "stock.stock_picking_action_picking_type" + ) + action["domain"] = [("maintenance_request_id", "=", self.id)] + action["context"] = { + "default_picking_type_id": self.default_consumption_warehouse_id.cons_type_id.id, + "default_maintenance_request_id": self.id, + } + return action + + def action_view_stock_move_ids(self): + self.ensure_one() + action = self.env["ir.actions.act_window"]._for_xml_id( + "stock.stock_move_action" + ) + action["domain"] = [("maintenance_request_id", "=", self.id)] + return action + + def action_view_stock_move_line_ids(self): + self.ensure_one() + action = self.env["ir.actions.act_window"]._for_xml_id( + "stock.stock_move_line_action" + ) + action["domain"] = [("maintenance_request_id", "=", self.id)] + + # TODO Grouping by destination allows separating consumptions + # and returns. Look for a better system and remove this + show_groupby_to = ( + len( + self.env["stock.move.line"] + .search([("maintenance_request_id", "=", self.id)]) + .mapped("location_dest_id") + ) + > 1 + ) + + action["context"] = { + "search_default_done": 1, + "search_default_groupby_location_dest_id": show_groupby_to, + "search_default_groupby_product_id": 1, + } + return action diff --git a/maintenance_stock/models/stock_move.py b/maintenance_stock/models/stock_move.py new file mode 100644 index 000000000..e074b1057 --- /dev/null +++ b/maintenance_stock/models/stock_move.py @@ -0,0 +1,16 @@ +# © 2020 Solvos Consultoría Informática () +# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html +from odoo import fields, models + + +class StockMove(models.Model): + _inherit = "stock.move" + + maintenance_request_id = fields.Many2one( + comodel_name="maintenance.request", + related="picking_id.maintenance_request_id", + ) + maintenance_equipment_id = fields.Many2one( + comodel_name="maintenance.equipment", + related="picking_id.maintenance_equipment_id", + ) diff --git a/maintenance_stock/models/stock_move_line.py b/maintenance_stock/models/stock_move_line.py new file mode 100644 index 000000000..daedb865b --- /dev/null +++ b/maintenance_stock/models/stock_move_line.py @@ -0,0 +1,16 @@ +# © 2020 Solvos Consultoría Informática () +# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html +from odoo import fields, models + + +class StockMoveLine(models.Model): + _inherit = "stock.move.line" + + maintenance_request_id = fields.Many2one( + comodel_name="maintenance.request", + related="picking_id.maintenance_request_id", + ) + maintenance_equipment_id = fields.Many2one( + comodel_name="maintenance.equipment", + related="picking_id.maintenance_equipment_id", + ) diff --git a/maintenance_stock/models/stock_picking.py b/maintenance_stock/models/stock_picking.py new file mode 100644 index 000000000..a4b065dcc --- /dev/null +++ b/maintenance_stock/models/stock_picking.py @@ -0,0 +1,17 @@ +# © 2020 Solvos Consultoría Informática () +# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html +from odoo import fields, models + + +class StockPicking(models.Model): + _inherit = "stock.picking" + + maintenance_request_id = fields.Many2one( + comodel_name="maintenance.request", + index=True, + ) + maintenance_equipment_id = fields.Many2one( + comodel_name="maintenance.equipment", + related="maintenance_request_id.equipment_id", + store=True, + ) diff --git a/maintenance_stock/models/stock_warehouse.py b/maintenance_stock/models/stock_warehouse.py new file mode 100644 index 000000000..287b65779 --- /dev/null +++ b/maintenance_stock/models/stock_warehouse.py @@ -0,0 +1,82 @@ +# © 2020 Solvos Consultoría Informática () +# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html +from odoo import _, fields, models + + +class StockWarehouse(models.Model): + _inherit = "stock.warehouse" + + wh_cons_loc_id = fields.Many2one( + "stock.location", "Consumption Location", domain=[("usage", "=", "inventory")] + ) + cons_type_id = fields.Many2one("stock.picking.type", "Consumption Type") + + def _create_or_update_sequences_and_picking_types(self): + warehouse_data = super()._create_or_update_sequences_and_picking_types() + PickingType = self.env["stock.picking.type"] + + # TODO when is called for an existing warehouse (e.g. during the + # module installation in_type_id is not accesible). Temporary + # solved with a hook + if "cons_type_id" in warehouse_data: + PickingType.browse(warehouse_data["cons_type_id"]).write( + { + "return_picking_type_id": warehouse_data.get("in_type_id", False), + } + ) + return warehouse_data + + def _update_name_and_code(self, new_name=False, new_code=False): + for warehouse in self: + sequence_data = warehouse._get_sequence_values() + warehouse.cons_type_id.sequence_id.write(sequence_data["cons_type_id"]) + + def _get_picking_type_create_values(self, max_sequence): + data, max_sequence_new = super()._get_picking_type_create_values(max_sequence) + return ( + { + **data, + "cons_type_id": { + "name": _("Consumption"), + "code": "outgoing", + "use_create_lots": False, + "use_existing_lots": True, + "default_location_src_id": self.lot_stock_id.id, + "default_location_dest_id": self.wh_cons_loc_id.id, + "sequence_code": max_sequence_new, + "barcode": self.code.replace(" ", "").upper() + "-CONS", + "company_id": self.company_id.id or self.env.company.id, + }, + }, + max_sequence_new + 1, + ) + + def _get_picking_type_update_values(self): + data = super()._get_picking_type_update_values() + return {**data, "cons_type_id": {}} + + def _get_sequence_values(self): + data = super()._get_sequence_values() + return { + **data, + "cons_type_id": { + "name": self.name + " " + _("Sequence consumption"), + "prefix": self.code + "/CONS/", + "padding": 5, + "company_id": self.company_id.id, + }, + } + + def _get_locations_values(self, vals, code=False): + sub_locations = super()._get_locations_values(vals, code) + code = vals.get("code") or self.code + code = code.replace(" ", "").upper() + company_id = vals.get("company_id", self.company_id.id) + return { + **sub_locations, + "wh_cons_loc_id": { + "name": _("Consumptions"), + "usage": "inventory", + "barcode": self._valid_barcode(code + "-CONS", company_id), + }, + } diff --git a/maintenance_stock/readme/CONTRIBUTORS.rst b/maintenance_stock/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..423455dfe --- /dev/null +++ b/maintenance_stock/readme/CONTRIBUTORS.rst @@ -0,0 +1 @@ +* David Alonso diff --git a/maintenance_stock/readme/DESCRIPTION.rst b/maintenance_stock/readme/DESCRIPTION.rst new file mode 100644 index 000000000..2b7b355bf --- /dev/null +++ b/maintenance_stock/readme/DESCRIPTION.rst @@ -0,0 +1,2 @@ +This module extends the functionality of Odoo Maintenance module by allowing +link stock consumptions to maintenance requests. diff --git a/maintenance_stock/readme/ROADMAP.rst b/maintenance_stock/readme/ROADMAP.rst new file mode 100644 index 000000000..9b1044215 --- /dev/null +++ b/maintenance_stock/readme/ROADMAP.rst @@ -0,0 +1,4 @@ +* Product standard list. Enable defining product standard lists (at least, + product and quantity per line), and link them with equipments. Then, every + maintenance request could select one of them and automatically fill the + product and quantity list. diff --git a/maintenance_stock/readme/USAGE.rst b/maintenance_stock/readme/USAGE.rst new file mode 100644 index 000000000..40d6530da --- /dev/null +++ b/maintenance_stock/readme/USAGE.rst @@ -0,0 +1,36 @@ +Once installed, first you should enable consumptions for a certain equipment +and filling a default warehouse for the picking operations: + +.. figure:: ../static/description/equipment.png + :alt: Kanban view + :width: 600 px + +Then, for every mainteance request of this equipment, *Picking List* button +allows us to make consumptions, that will be picking documents with their own +sequence: + +.. figure:: ../static/description/request-1.png + :alt: Kanban view + :width: 600 px + +.. figure:: ../static/description/pick-1.png + :alt: Kanban view + :width: 600 px + +By default, the origin location for this operations will be the stock location +for the default warehouse, and destination a new *Consumptions* location, that +will not compute for stock inventory, like e.g. partner locations: + +.. figure:: ../static/description/move-line.png + :alt: Kanban view + :width: 600 px + +From both request and equipment forms these stock operations and *Product Moves* +are available. + +Return operations are also enabled, and will be linked to the request and +equipment as well: + +.. figure:: ../static/description/pick-2.png + :alt: Kanban view + :width: 600 px diff --git a/maintenance_stock/static/description/equipment.png b/maintenance_stock/static/description/equipment.png new file mode 100644 index 000000000..2c3358e0f Binary files /dev/null and b/maintenance_stock/static/description/equipment.png differ diff --git a/maintenance_stock/static/description/icon.png b/maintenance_stock/static/description/icon.png new file mode 100644 index 000000000..3a0328b51 Binary files /dev/null and b/maintenance_stock/static/description/icon.png differ diff --git a/maintenance_stock/static/description/index.html b/maintenance_stock/static/description/index.html new file mode 100644 index 000000000..2375b69d1 --- /dev/null +++ b/maintenance_stock/static/description/index.html @@ -0,0 +1,461 @@ + + + + + + +Maintenance Stock + + + +
+

Maintenance Stock

+ + +

Beta License: AGPL-3 OCA/maintenance Translate me on Weblate Try me on Runbot

+

This module extends the functionality of Odoo Maintenance module by allowing +link stock consumptions to maintenance requests.

+

Table of contents

+ +
+

Usage

+

Once installed, first you should enable consumptions for a certain equipment +and filling a default warehouse for the picking operations:

+
+Kanban view +
+

Then, for every mainteance request of this equipment, Picking List button +allows us to make consumptions, that will be picking documents with their own +sequence:

+
+Kanban view +
+
+Kanban view +
+

By default, the origin location for this operations will be the stock location +for the default warehouse, and destination a new Consumptions location, that +will not compute for stock inventory, like e.g. partner locations:

+
+Kanban view +
+

From both request and equipment forms these stock operations and Product Moves +are available.

+

Return operations are also enabled, and will be linked to the request and +equipment as well:

+
+Kanban view +
+
+
+

Known issues / Roadmap

+
    +
  • Product standard list. Enable defining product standard lists (at least, +product and quantity per line), and link them with equipments. Then, every +maintenance request could select one of them and automatically fill the +product and quantity list.
  • +
+
+
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +feedback.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • Solvos
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use.

+

This module is part of the OCA/maintenance project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/maintenance_stock/static/description/move-line.png b/maintenance_stock/static/description/move-line.png new file mode 100644 index 000000000..cf43e23df Binary files /dev/null and b/maintenance_stock/static/description/move-line.png differ diff --git a/maintenance_stock/static/description/pick-1.png b/maintenance_stock/static/description/pick-1.png new file mode 100644 index 000000000..4aa8a8fb7 Binary files /dev/null and b/maintenance_stock/static/description/pick-1.png differ diff --git a/maintenance_stock/static/description/pick-2.png b/maintenance_stock/static/description/pick-2.png new file mode 100644 index 000000000..4bf866c81 Binary files /dev/null and b/maintenance_stock/static/description/pick-2.png differ diff --git a/maintenance_stock/static/description/request-1.png b/maintenance_stock/static/description/request-1.png new file mode 100644 index 000000000..2bcc84722 Binary files /dev/null and b/maintenance_stock/static/description/request-1.png differ diff --git a/maintenance_stock/static/img/toner.png b/maintenance_stock/static/img/toner.png new file mode 100644 index 000000000..0a545967f Binary files /dev/null and b/maintenance_stock/static/img/toner.png differ diff --git a/maintenance_stock/tests/__init__.py b/maintenance_stock/tests/__init__.py new file mode 100644 index 000000000..5f7397844 --- /dev/null +++ b/maintenance_stock/tests/__init__.py @@ -0,0 +1 @@ +from . import test_maintenance_stock diff --git a/maintenance_stock/tests/test_maintenance_stock.py b/maintenance_stock/tests/test_maintenance_stock.py new file mode 100644 index 000000000..2c6d0acaa --- /dev/null +++ b/maintenance_stock/tests/test_maintenance_stock.py @@ -0,0 +1,147 @@ +# © 2020 Solvos Consultoría Informática () +# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html +import odoo.tests.common as test_common +from odoo.tests.common import Form + + +class TestMaintenanceStock(test_common.TransactionCase): + def setUp(self): + super().setUp() + self.maintenance_warehouse = self.env["stock.warehouse"].create( + { + "name": "Test warehouse", + "code": "TEST", + } + ) + + self.product1 = self.env["product.product"].create( + { + "default_code": "TESTOPROD", + "name": "Test prod", + "type": "product", + "uom_id": self.env.ref("uom.product_uom_unit").id, + "uom_po_id": self.env.ref("uom.product_uom_unit").id, + } + ) + + self.equipment_1 = self.env["maintenance.equipment"].create( + { + "name": "Test equipment", + "allow_consumptions": True, + "default_consumption_warehouse_id": self.maintenance_warehouse.id, + } + ) + self.request_1 = self.env["maintenance.request"].create( + { + "name": "Test request", + "user_id": self.env.ref("base.user_demo").id, + "owner_user_id": self.env.ref("base.user_admin").id, + "equipment_id": self.equipment_1.id, + "stage_id": self.env.ref("maintenance.stage_1").id, + "maintenance_team_id": self.env.ref( + "maintenance.equipment_team_maintenance" + ).id, + } + ) + + def test_warehouse(self): + self.assertTrue(self.maintenance_warehouse.wh_cons_loc_id) + + self.assertTrue(self.maintenance_warehouse.cons_type_id) + self.assertEqual(self.maintenance_warehouse.cons_type_id.code, "outgoing") + self.assertEqual( + self.maintenance_warehouse.cons_type_id.default_location_src_id, + self.maintenance_warehouse.lot_stock_id, + ) + self.assertEqual( + self.maintenance_warehouse.cons_type_id.default_location_dest_id, + self.maintenance_warehouse.wh_cons_loc_id, + ) + self.assertEqual( + self.maintenance_warehouse.cons_type_id.barcode, + self.maintenance_warehouse.code.replace(" ", "").upper() + "-CONS", + ) + self.assertEqual( + self.maintenance_warehouse.cons_type_id.sequence_id.prefix, + self.maintenance_warehouse.code + "/CONS/", + ) + self.assertEqual( + self.maintenance_warehouse.cons_type_id.return_picking_type_id, + self.maintenance_warehouse.in_type_id, + ) + + def test_equipment(self): + self.assertTrue(self.equipment_1.default_consumption_warehouse_id) + self.equipment_1.allow_consumptions = False + self.equipment_1._onchange_allow_consumptions() + self.assertFalse(self.equipment_1.default_consumption_warehouse_id) + + action1 = self.equipment_1.action_view_stock_picking_ids() + self.assertEqual(action1["domain"][0][2], self.equipment_1.id) + self.assertTrue(action1["context"]["show_maintenance_request_id"]) + + action2 = self.equipment_1.action_view_stock_move_ids() + self.assertEqual(action2["domain"][0][2], self.equipment_1.id) + + action3 = self.equipment_1.action_view_stock_move_line_ids() + self.assertEqual(action3["domain"][0][2], self.equipment_1.id) + self.assertFalse(action3["context"]["search_default_groupby_location_dest_id"]) + + def test_request(self): + action1 = self.request_1.action_view_stock_picking_ids() + self.assertEqual(action1["domain"][0][2], self.request_1.id) + self.assertEqual( + action1["context"]["default_picking_type_id"], + self.request_1.default_consumption_warehouse_id.cons_type_id.id, + ) + self.assertEqual( + action1["context"]["default_maintenance_request_id"], self.request_1.id + ) + + action2 = self.request_1.action_view_stock_move_ids() + self.assertEqual(action2["domain"][0][2], self.request_1.id) + + action3 = self.request_1.action_view_stock_move_line_ids() + self.assertEqual(action3["domain"][0][2], self.request_1.id) + self.assertFalse(action3["context"]["search_default_groupby_location_dest_id"]) + + def test_picking(self): + self.assertEqual(len(self.request_1.stock_picking_ids), 0) + location_id = self.maintenance_warehouse.lot_stock_id + location_dest_id = self.maintenance_warehouse.wh_cons_loc_id + picking_type_id = self.maintenance_warehouse.cons_type_id + self.env["stock.quant"].create( + { + "product_id": self.product1.id, + "location_id": location_id.id, + "quantity": 5, + } + ) + picking_form = Form(self.env["stock.picking"]) + picking_form.picking_type_id = picking_type_id + picking_form.location_id = location_id + picking_form.location_dest_id = location_dest_id + with picking_form.move_ids_without_package.new() as move: + move.product_id = self.product1 + move.product_uom_qty = 5.0 + picking = picking_form.save() + picking.write({"maintenance_request_id": self.request_1.id}) + self.assertEqual(len(self.request_1.stock_picking_ids), 1) + stock_quant_obj = self.env["stock.quant"] + domain_from = [ + ("product_id", "=", self.product1.id), + ("location_id", "=", self.maintenance_warehouse.lot_stock_id.id), + ] + domain_to = [ + ("product_id", "=", self.product1.id), + ("location_id", "=", self.maintenance_warehouse.wh_cons_loc_id.id), + ] + self.assertEqual(stock_quant_obj.search(domain_from).quantity, 5) + self.assertEqual(stock_quant_obj.search(domain_to).quantity, 0) + + picking.action_confirm() + picking.action_assign() + picking.move_line_ids.write({"qty_done": 5.0}) + picking.button_validate() + self.assertEqual(stock_quant_obj.search(domain_from).quantity, 0) + self.assertEqual(stock_quant_obj.search(domain_to).quantity, 5) diff --git a/maintenance_stock/views/maintenance_equipment_views.xml b/maintenance_stock/views/maintenance_equipment_views.xml new file mode 100644 index 000000000..ea038aabd --- /dev/null +++ b/maintenance_stock/views/maintenance_equipment_views.xml @@ -0,0 +1,82 @@ + + + + + maintenance.equipment + + + + + + + + + + + + maintenance.equipment + + + + + + + + + + maintenance.equipment + + + + + + + + + + + + + + + + diff --git a/maintenance_stock/views/maintenance_request_views.xml b/maintenance_stock/views/maintenance_request_views.xml new file mode 100644 index 000000000..9e799be68 --- /dev/null +++ b/maintenance_stock/views/maintenance_request_views.xml @@ -0,0 +1,75 @@ + + + + + maintenance.request + + + + + + + + + + + + maintenance.request + + + + + + + + + + maintenance.request + + + + + + + + + + + + + diff --git a/maintenance_stock/views/stock_move_line_views.xml b/maintenance_stock/views/stock_move_line_views.xml new file mode 100644 index 000000000..e9f502417 --- /dev/null +++ b/maintenance_stock/views/stock_move_line_views.xml @@ -0,0 +1,87 @@ + + + + + stock.move.line + + + + + + + + + + + + + + + + + + stock.move.line + + + + + + + + + + stock.move.line + + + + + + + + + + + Product Moves + stock.move.line + ir.actions.act_window + tree,kanban,pivot,form + + [('maintenance_request_id', '!=', False)] + { + 'search_default_done': 1, + 'search_default_groupby_product_id': 1, + 'show_maintenance_request_id': True, + } + +

+ There's no product move yet +

+
+
+ + + +
diff --git a/maintenance_stock/views/stock_move_views.xml b/maintenance_stock/views/stock_move_views.xml new file mode 100644 index 000000000..07b2f5511 --- /dev/null +++ b/maintenance_stock/views/stock_move_views.xml @@ -0,0 +1,84 @@ + + + + + stock.move + + + + + + + + + + + + + + + stock.move + + + + + + + + + + stock.move + + + + + + + + + + Stock Moves + stock.move + ir.actions.act_window + form + + + [('maintenance_request_id', '!=', False)] + { + 'search_default_done': 1, + 'search_default_groupby_location_id': 1, + 'show_maintenance_request_id': True, + } + +

+ Create a new stock movement +

+ This menu gives you the full traceability of inventory + operations on a specific product. You can filter on the product + to see all the past or future movements for the product. +

+
+
+ + + +
diff --git a/maintenance_stock/views/stock_picking_views.xml b/maintenance_stock/views/stock_picking_views.xml new file mode 100644 index 000000000..5a482bc61 --- /dev/null +++ b/maintenance_stock/views/stock_picking_views.xml @@ -0,0 +1,59 @@ + + + + + stock.picking + + + + + + + + + + + + + + + stock.picking + + + + + + + + + + stock.picking + + + + + + + + + + + + + + + + + + diff --git a/setup/maintenance_stock/odoo/addons/maintenance_stock b/setup/maintenance_stock/odoo/addons/maintenance_stock new file mode 120000 index 000000000..8e802a318 --- /dev/null +++ b/setup/maintenance_stock/odoo/addons/maintenance_stock @@ -0,0 +1 @@ +../../../../maintenance_stock \ No newline at end of file diff --git a/setup/maintenance_stock/setup.py b/setup/maintenance_stock/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/maintenance_stock/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)