From 42562f7ef2d7ddd01e8dcb63496ecf0293c72770 Mon Sep 17 00:00:00 2001 From: Boris Alias Date: Wed, 24 May 2023 11:07:17 +0200 Subject: [PATCH] [MIG] migration stock_picking_batch_extended from 15.0 to 16.0 --- stock_picking_batch_extended/__manifest__.py | 7 +- .../data/batch_picking_actions_server.xml | 20 +- stock_picking_batch_extended/i18n/es.po | 280 +++++------------- .../migrations/15.0.1.0/pre-migration.py | 18 -- .../models/__init__.py | 2 +- .../models/product_product.py | 2 +- .../models/res_config_settings.py | 3 +- .../models/stock_batch_picking.py | 26 +- .../readme/CONTRIBUTORS.rst | 4 + .../report/batch_report.py | 25 +- .../tests/test_batch.py | 147 +++++---- .../views/report_batch_picking.xml | 142 --------- .../views/stock_batch_picking.xml | 10 +- .../wizard/stock_picking_to_batch_views.xml | 11 +- 14 files changed, 218 insertions(+), 479 deletions(-) delete mode 100644 stock_picking_batch_extended/migrations/15.0.1.0/pre-migration.py delete mode 100644 stock_picking_batch_extended/views/report_batch_picking.xml diff --git a/stock_picking_batch_extended/__manifest__.py b/stock_picking_batch_extended/__manifest__.py index b419783ba14..2412a8edde8 100644 --- a/stock_picking_batch_extended/__manifest__.py +++ b/stock_picking_batch_extended/__manifest__.py @@ -1,11 +1,12 @@ # Copyright 2012-2014 Alexandre Fayolle, Camptocamp SA # Copyright 2018-2020 Tecnativa - Carlos Dauden +# Copyright 2023 FactorLibre - Boris Alias # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). { "name": "Stock batch picking extended", "summary": "Allows manage a lot of pickings in batch", - "version": "15.0.2.2.0", + "version": "16.0.1.0.0", "author": "Camptocamp, " "Tecnativa, " "Odoo Community Association (OCA)", "development_status": "Mature", "maintainers": ["gurneyalex", "carlosdauden", "i-vyshnevska"], @@ -17,13 +18,11 @@ "data/batch_picking_actions_server.xml", "views/stock_batch_picking.xml", "views/product_product.xml", - "views/report_batch_picking.xml", "views/stock_picking_views.xml", "views/stock_warehouse.xml", "views/res_config_settings_views.xml", "wizard/stock_picking_to_batch_views.xml", ], - "installable": True, - "post_init_hook": "post_init_hook", "license": "AGPL-3", + "post_init_hook": "post_init_hook", } diff --git a/stock_picking_batch_extended/data/batch_picking_actions_server.xml b/stock_picking_batch_extended/data/batch_picking_actions_server.xml index 4bdde20d32d..47b7073b6a9 100644 --- a/stock_picking_batch_extended/data/batch_picking_actions_server.xml +++ b/stock_picking_batch_extended/data/batch_picking_actions_server.xml @@ -1,6 +1,6 @@ + License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). --> @@ -11,10 +11,9 @@ ref="stock_picking_batch.model_stock_picking_batch" /> code - pickings = records.mapped('picking_ids').filtered(lambda p: p.state != 'cancel') -action = env.ref('stock.action_report_picking').report_action(pickings) + +pickings = records.mapped('picking_ids').filtered(lambda p: p.state != 'cancel') +action = env['ir.actions.report']._get_report_from_name('stock.report_picking').report_action(pickings) @@ -26,10 +25,9 @@ action = env.ref('stock.action_report_picking').report_action(pickings) ref="stock_picking_batch.model_stock_picking_batch" /> code - pickings = records.mapped('picking_ids').filtered(lambda p: p.state != 'cancel') -action = env.ref('stock.action_report_delivery').report_action(pickings) + +pickings = records.mapped('picking_ids').filtered(lambda p: p.state != 'cancel') +action = env['ir.actions.report']._get_report_from_name('stock.report_delivery').report_action(pickings) @@ -41,8 +39,8 @@ action = env.ref('stock.action_report_delivery').report_action(pickings) /> code -for record in records: - record.action_assign() + for record in records: + record.action_assign() diff --git a/stock_picking_batch_extended/i18n/es.po b/stock_picking_batch_extended/i18n/es.po index 0af2aef6f22..fef03bb2fb9 100644 --- a/stock_picking_batch_extended/i18n/es.po +++ b/stock_picking_batch_extended/i18n/es.po @@ -1,29 +1,25 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * stock_picking_batch_extended +# * stock_picking_batch_extended # -# Translators: -# OCA Transbot , 2017 msgid "" msgstr "" -"Project-Id-Version: Odoo Server 12.0c\n" +"Project-Id-Version: Odoo Server 16.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-09-10 08:44+0000\n" -"PO-Revision-Date: 2021-09-10 10:45+0200\n" -"Last-Translator: Carlos Dauden \n" -"Language-Team: Spanish (https://www.transifex.com/oca/teams/23907/es/)\n" -"Language: es\n" +"POT-Creation-Date: 2023-03-15 14:33+0000\n" +"PO-Revision-Date: 2023-03-15 14:33+0000\n" +"Last-Translator: \n" +"Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Generator: Poedit 2.3\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" #. module: stock_picking_batch_extended #: model:ir.model.fields,field_description:stock_picking_batch_extended.field_stock_picking_batch__picking_count #: model_terms:ir.ui.view,arch_db:stock_picking_batch_extended.report_batch_picking msgid "# Pickings" -msgstr "Nº Albaranes" +msgstr "Albaranes" #. module: stock_picking_batch_extended #: model_terms:ir.ui.view,arch_db:stock_picking_batch_extended.report_batch_picking @@ -46,46 +42,51 @@ msgid "Active Pickings" msgstr "Albaranes activos" #. module: stock_picking_batch_extended +#: model_terms:ir.ui.view,arch_db:stock_picking_batch_extended.stock_picking_to_batch_form +msgid "Add to existing batch" +msgstr "Agregar a una agrupación existente" + +#. module: stock_picking_batch_extended +#. odoo-python #: code:addons/stock_picking_batch_extended/wizard/stock_picking_to_batch.py:0 #, python-format msgid "" -"All selected pickings are already in a batch picking or are in a wrong state." +"All selected pickings are already in a batch picking or are in a wrong " +"state." msgstr "" -"Todos los albaranes seleccionados están ya en un grupo de albaranes o en un " -"estado incorrecto." +"Todos los albaranes seleccionados están ya en una agrupación o tienen un " +"estado incorrecto" #. module: stock_picking_batch_extended -#: model_terms:ir.ui.view,arch_db:stock_picking_batch_extended.stock_picking_batch_form +#: model_terms:ir.ui.view,arch_db:stock_picking_batch_extended.stock_picking_batch_form_inherit msgid "All undone pickings from this batch will be removed, are you sure?" -msgstr "" -"Todos los albaranes sin realizar de esta agrupación serán eliminados, ¿Está " -"seguro?" +msgstr "¿Está seguro de que desea eliminar todos los albaranes pendientes de esta agrupación?" #. module: stock_picking_batch_extended #: model_terms:ir.ui.view,arch_db:stock_picking_batch_extended.res_config_settings_view_form msgid "Apply OCA batch validation" -msgstr "Usar validación de agrupación OCA" +msgstr "Aplicar validación de agrupación de la OCA" #. module: stock_picking_batch_extended #: model:ir.model,name:stock_picking_batch_extended.model_stock_picking_batch_creator_group_field msgid "Batch Picking Creator Group Field" -msgstr "Agrupar productos en batch picking" +msgstr "Creador de agrupación de albaranes con agrupación de campos" #. module: stock_picking_batch_extended #: model:ir.model,name:stock_picking_batch_extended.model_stock_picking_batch #: model:ir.model.fields,field_description:stock_picking_batch_extended.field_stock_picking_batch__name msgid "Batch Transfer" -msgstr "Grupo de albaranes" +msgstr "Transferencia de agrupación" #. module: stock_picking_batch_extended #: model:ir.model,name:stock_picking_batch_extended.model_stock_picking_to_batch msgid "Batch Transfer Lines" -msgstr "" +msgstr "Líneas de transferencia de agrupación" #. module: stock_picking_batch_extended #: model:ir.actions.report,name:stock_picking_batch_extended.action_report_batch_picking msgid "Batch picking" -msgstr "Grupo de albaranes" +msgstr "Agrupación de albaranes" #. module: stock_picking_batch_extended #: model_terms:ir.ui.view,arch_db:stock_picking_batch_extended.report_batch_picking @@ -95,22 +96,22 @@ msgstr "Transportista" #. module: stock_picking_batch_extended #: model:ir.model,name:stock_picking_batch_extended.model_res_company msgid "Companies" -msgstr "Compañías" +msgstr "Empresas" #. module: stock_picking_batch_extended #: model:ir.model,name:stock_picking_batch_extended.model_res_config_settings msgid "Config Settings" -msgstr "Opciones de Configuración" +msgstr "Opciones de configuración" #. module: stock_picking_batch_extended #: model:ir.model.fields,field_description:stock_picking_batch_extended.field_stock_picking_to_batch__batch_by_group msgid "Create batch pickings grouped by fields" -msgstr "Crear agrupaciones de albarán agrupadas por campos" +msgstr "Crear agrupaciones de albaranes agrupados por campos" #. module: stock_picking_batch_extended #: model_terms:ir.ui.view,arch_db:stock_picking_batch_extended.stock_picking_to_batch_form msgid "Create multiple batch picking grouped by..." -msgstr "Crear selección de lotes múltiples agrupados por ..." +msgstr "Crear múltiples agrupaciones de albaranes agrupados por..." #. module: stock_picking_batch_extended #: model:ir.model.fields,field_description:stock_picking_batch_extended.field_stock_picking_batch_creator_group_field__create_uid @@ -120,7 +121,7 @@ msgstr "Creado por" #. module: stock_picking_batch_extended #: model:ir.model.fields,field_description:stock_picking_batch_extended.field_stock_picking_batch_creator_group_field__create_date msgid "Created on" -msgstr "Creado en" +msgstr "Creado el" #. module: stock_picking_batch_extended #: model:ir.model.fields,field_description:stock_picking_batch_extended.field_stock_picking_batch__date @@ -135,27 +136,27 @@ msgstr "Recogedor por defecto" #. module: stock_picking_batch_extended #: model:ir.model.fields,field_description:stock_picking_batch_extended.field_stock_picking_batch_creator_group_field__display_name msgid "Display Name" -msgstr "Nombre Mostrado" +msgstr "Nombre a mostrar" #. module: stock_picking_batch_extended #: model:ir.model.fields,field_description:stock_picking_batch_extended.field_stock_picking_batch__entire_package_ids msgid "Entire Package" -msgstr "Paquete completo" +msgstr "Paquete entero" #. module: stock_picking_batch_extended #: model:ir.model.fields,field_description:stock_picking_batch_extended.field_stock_picking_batch__entire_package_detail_ids msgid "Entire Package Detail" -msgstr "Detalle del paquete completo" +msgstr "Detalle de paquete entero" #. module: stock_picking_batch_extended #: model:ir.model.fields,field_description:stock_picking_batch_extended.field_stock_picking_batch_creator_group_field__field_id msgid "Field to group" -msgstr "Campo para agrupar" +msgstr "Campo a agrupar" #. module: stock_picking_batch_extended #: model:ir.model.fields,help:stock_picking_batch_extended.field_stock_picking_to_batch__notes msgid "Free form remarks" -msgstr "Comentarios" +msgstr "Observaciones de formulario libre" #. module: stock_picking_batch_extended #: model:ir.model.fields,field_description:stock_picking_batch_extended.field_stock_picking_to_batch__group_field_ids @@ -174,15 +175,14 @@ msgstr "ID" #. module: stock_picking_batch_extended #: model:ir.model.fields,help:stock_picking_batch_extended.field_stock_picking_to_batch__group_field_ids -msgid "If set any, multiple batch picking will be created, one per group field" -msgstr "" -"Si establece cualquiera, se crearán múltiples agrupaciones de albaranes, una " -"por campo de agrupación" +msgid "" +"If set any, multiple batch picking will be created, one per group field" +msgstr "Si se establece alguno, se crearán varias agrupaciones de albaranes, una por campo de grupo." #. module: stock_picking_batch_extended #: model:ir.model.fields,field_description:stock_picking_batch_extended.field_stock_picking_batch_creator_group_field____last_update msgid "Last Modified on" -msgstr "Última Modificación en" +msgstr "Última modificación" #. module: stock_picking_batch_extended #: model:ir.model.fields,field_description:stock_picking_batch_extended.field_stock_picking_batch_creator_group_field__write_uid @@ -192,17 +192,17 @@ msgstr "Última actualización por" #. module: stock_picking_batch_extended #: model:ir.model.fields,field_description:stock_picking_batch_extended.field_stock_picking_batch_creator_group_field__write_date msgid "Last Updated on" -msgstr "Última actualización en" +msgstr "Última actualización el" #. module: stock_picking_batch_extended #: model:ir.model.fields,help:stock_picking_batch_extended.field_stock_picking_batch__active_picking_ids msgid "List of active picking managed by this batch." -msgstr "" +msgstr "Lista de albaranes activos manejados por esta agrupación" #. module: stock_picking_batch_extended #: model_terms:ir.ui.view,arch_db:stock_picking_batch_extended.stock_picking_batch_filter msgid "My batches" -msgstr "Mis grupos" +msgstr "Mis agrupaciones de albaranes" #. module: stock_picking_batch_extended #: model:ir.model.fields,field_description:stock_picking_batch_extended.field_stock_picking_to_batch__name @@ -212,31 +212,21 @@ msgstr "Nombre" #. module: stock_picking_batch_extended #: model:ir.model.fields,help:stock_picking_batch_extended.field_stock_picking_to_batch__name msgid "Name of the batch picking" -msgstr "Nombre del grupo de albaranes" - -#. module: stock_picking_batch_extended -#: model:ir.model.fields,help:stock_picking_batch_extended.field_stock_picking_batch__name -msgid "Name of the batch transfer" -msgstr "Nombre del grupo de albaranes" +msgstr "Nombre de la agrupación de albaranes" #. module: stock_picking_batch_extended #: model:ir.model.fields,field_description:stock_picking_batch_extended.field_stock_picking_batch__notes #: model:ir.model.fields,field_description:stock_picking_batch_extended.field_stock_picking_to_batch__notes -#: model_terms:ir.ui.view,arch_db:stock_picking_batch_extended.stock_picking_batch_form +#: model_terms:ir.ui.view,arch_db:stock_picking_batch_extended.stock_picking_batch_form_inherit msgid "Notes" msgstr "Notas" #. module: stock_picking_batch_extended +#. odoo-python #: code:addons/stock_picking_batch_extended/models/stock_batch_picking.py:0 #, python-format msgid "Nothing to print." -msgstr "Nada que imprimir." - -#. module: stock_picking_batch_extended -#: model:ir.model.fields,help:stock_picking_batch_extended.field_stock_picking_batch__user_id -#: model:ir.model.fields,help:stock_picking_batch_extended.field_stock_picking_to_batch__user_id -msgid "Person responsible for this batch transfer" -msgstr "" +msgstr "Nada a imprimir." #. module: stock_picking_batch_extended #: model_terms:ir.ui.view,arch_db:stock_picking_batch_extended.report_batch_picking @@ -246,58 +236,62 @@ msgstr "Recogido por" #. module: stock_picking_batch_extended #: model_terms:ir.ui.view,arch_db:stock_picking_batch_extended.res_config_settings_view_form msgid "Picking Batch" -msgstr "Grupo de albaranes" +msgstr "Agrupación de albarán" #. module: stock_picking_batch_extended #: model:ir.model.fields,field_description:stock_picking_batch_extended.field_stock_picking_batch_creator_group_field__picking_to_batch_id msgid "Picking To Batch" -msgstr "" +msgstr "Transferir albaranes a una agrupación" #. module: stock_picking_batch_extended -#: model_terms:ir.ui.view,arch_db:stock_picking_batch_extended.stock_picking_batch_form +#: model_terms:ir.ui.view,arch_db:stock_picking_batch_extended.stock_picking_batch_form_inherit msgid "Pickings" msgstr "Albaranes" #. module: stock_picking_batch_extended #: model_terms:ir.ui.view,arch_db:stock_picking_batch_extended.report_batch_picking msgid "Pickings Order" -msgstr "Orden de albaranes" +msgstr "Orden de recolección" #. module: stock_picking_batch_extended -#: model_terms:ir.ui.view,arch_db:stock_picking_batch_extended.stock_picking_batch_form +#: model_terms:ir.ui.view,arch_db:stock_picking_batch_extended.stock_picking_batch_form_inherit msgid "Print" msgstr "Imprimir" #. module: stock_picking_batch_extended #: model:ir.actions.server,name:stock_picking_batch_extended.action_print_batch_delivery_slip msgid "Print Delivery Slip" -msgstr "Imprimir vale de entrega" +msgstr "Imprimir comprobante de entrega" #. module: stock_picking_batch_extended #: model:ir.actions.server,name:stock_picking_batch_extended.action_print_batch_picking_operations msgid "Print Picking Operations" -msgstr "Imprimir operaciones de albarán" +msgstr "Imprimir Operaciones de Picking" #. module: stock_picking_batch_extended -#: model:ir.model,name:stock_picking_batch_extended.model_product_product #: model_terms:ir.ui.view,arch_db:stock_picking_batch_extended.report_batch_picking msgid "Product" msgstr "Producto" +#. module: stock_picking_batch_extended +#: model:ir.model,name:stock_picking_batch_extended.model_product_product +msgid "Product Variant" +msgstr "Variantes de producto" + #. module: stock_picking_batch_extended #: model_terms:ir.ui.view,arch_db:stock_picking_batch_extended.report_batch_picking msgid "QTY" -msgstr "Ctd." +msgstr "Cantidad" #. module: stock_picking_batch_extended -#: model_terms:ir.ui.view,arch_db:stock_picking_batch_extended.stock_picking_batch_form +#: model_terms:ir.ui.view,arch_db:stock_picking_batch_extended.stock_picking_batch_form_inherit msgid "Remove Undone" -msgstr "Eliminar no realizados" +msgstr "Eliminar incompletos" #. module: stock_picking_batch_extended #: model:ir.model,name:stock_picking_batch_extended.model_report_stock_picking_batch_extended_report_batch_picking msgid "Report for Batch Picking" -msgstr "Informe para grupos de albaranes" +msgstr "Informe de agrupación de albarán" #. module: stock_picking_batch_extended #: model:ir.actions.server,name:stock_picking_batch_extended.action_stock_batch_picking_assign_all @@ -308,12 +302,12 @@ msgstr "Reservar todos" #: model:ir.model.fields,field_description:stock_picking_batch_extended.field_stock_picking_batch__user_id #: model:ir.model.fields,field_description:stock_picking_batch_extended.field_stock_picking_to_batch__user_id msgid "Responsible" -msgstr "" +msgstr "Recogedor" #. module: stock_picking_batch_extended #: model_terms:ir.ui.view,arch_db:stock_picking_batch_extended.stock_picking_batch_filter msgid "Scheduled Date" -msgstr "" +msgstr "Fecha prevista" #. module: stock_picking_batch_extended #: model:ir.model.fields,field_description:stock_picking_batch_extended.field_stock_picking_batch_creator_group_field__sequence @@ -324,12 +318,12 @@ msgstr "Secuencia" #: model_terms:ir.ui.view,arch_db:stock_picking_batch_extended.res_config_settings_view_form msgid "Switch behaviour bettwen Odoo and OCA for batch validation" msgstr "" -"Cambiar comportamiento entre Odoo y OCA para validar agrupación de albaranes" +"Alternar comportamiento entre Odoo y validación de agrupación de la OCA" #. module: stock_picking_batch_extended #: model_terms:ir.ui.view,arch_db:stock_picking_batch_extended.product_normal_form_view msgid "This note will show up on the batch picking printout." -msgstr "Esta nota aparecerá en la impresión de selección de lotes." +msgstr "Esta nota se mostrará en el informe de la agrupación" #. module: stock_picking_batch_extended #: model:ir.model.fields,help:stock_picking_batch_extended.field_stock_picking_batch__entire_package_detail_ids @@ -337,7 +331,7 @@ msgid "" "Those are the entire packages of a picking shown in the view of detailed " "operations" msgstr "" -"Estos son los paquetes completos de un albarán mostrados en la vista de " +"Son los paquetes completos de un picking que se muestran en la vista de " "operaciones detalladas" #. module: stock_picking_batch_extended @@ -345,29 +339,29 @@ msgstr "" msgid "" "Those are the entire packages of a picking shown in the view of operations" msgstr "" -"Estos son los paquetes completos de un albarán mostrados en la vista de " +"Son los paquetes completos de un picking que se muestran en la vista de " "operaciones" #. module: stock_picking_batch_extended #: model_terms:ir.ui.view,arch_db:stock_picking_batch_extended.stock_picking_batch_filter msgid "Unassigned" -msgstr "No asignado" +msgstr "Sin asignar" #. module: stock_picking_batch_extended #: model:ir.model.fields,field_description:stock_picking_batch_extended.field_res_config_settings__use_oca_batch_validation msgid "Use OCA approach to validate Picking Batch" -msgstr "Usar enfoque OCA para validar grupo de albaranes" +msgstr "Usar validación de la OCA en la agrupación de albaranes" #. module: stock_picking_batch_extended #: model:ir.model.fields,field_description:stock_picking_batch_extended.field_res_company__use_oca_batch_validation #: model:ir.model.fields,field_description:stock_picking_batch_extended.field_stock_picking_batch__use_oca_batch_validation msgid "Use Oca Batch Validation" -msgstr "Usar validación OCA" +msgstr "Usar validación de la OCA de la agrupación" #. module: stock_picking_batch_extended #: model_terms:ir.ui.view,arch_db:stock_picking_batch_extended.report_batch_picking msgid "Visa:_________________" -msgstr "Visa: _________________" +msgstr "Visa:_________________" #. module: stock_picking_batch_extended #: model:ir.model,name:stock_picking_batch_extended.model_stock_warehouse @@ -378,139 +372,19 @@ msgstr "Almacén" #: model:ir.model.fields,field_description:stock_picking_batch_extended.field_product_product__description_warehouse #: model_terms:ir.ui.view,arch_db:stock_picking_batch_extended.product_normal_form_view msgid "Warehouse Description" -msgstr "Descripción del almacén" +msgstr "Descripción de almacén" #. module: stock_picking_batch_extended #: model:ir.model.fields,help:stock_picking_batch_extended.field_stock_picking_batch__date msgid "date on which the batch picking is to be processed" -msgstr "fecha en la que el grupo de albaranes se procesará" +msgstr "Fecha en la cuál la agrupación de albaranes es procesada" #. module: stock_picking_batch_extended #: model:ir.model.fields,help:stock_picking_batch_extended.field_stock_picking_batch__notes msgid "free form remarks" -msgstr "libre de observaciones" +msgstr "Formulario libre de comentarios" #. module: stock_picking_batch_extended #: model:ir.model.fields,help:stock_picking_batch_extended.field_stock_warehouse__default_user_id msgid "the user to which the batch pickings are assigned by default" -msgstr "el usuario al que se le asigna el grupo de albaranes por defecto" - -#~ msgid "Add to new Batch" -#~ msgstr "Añadir a una nueva agrupación" - -#~ msgid "All pickings from this batch will be cancelled, are you sure?" -#~ msgstr "" -#~ "Todos los albaranes de esta agrupación serán cancelados, ¿Está seguro?" - -#~ msgid "All the pickings from this batch will be confirmed. Are you sure?" -#~ msgstr "" -#~ "Todos los albaranes de esta agrupación serán confirmados, ¿Está seguro?" - -#~ msgid "All the pickings from this batch will be transferred. Are you sure?" -#~ msgstr "" -#~ "Todos los albaranes de esta agrupación serán transferidos, ¿Está seguro?" - -#~ msgid "Assign picking operations to an employee." -#~ msgstr "Asignar operaciones de albarán a un empleado." - -#~ msgid "Available" -#~ msgstr "Disponible" - -#~ msgid "Batch" -#~ msgstr "Grupo" - -#~ msgid "Batch Name" -#~ msgstr "Nombre del grupo" - -#~ msgid "Batch Picking" -#~ msgstr "Grupo de albaranes" - -#~ msgid "Batch Picking Creator" -#~ msgstr "Creador del grupo de albaranes" - -#~ msgid "Batch Picking properties" -#~ msgstr "Propiedades del grupo de albaranes" - -#~ msgid "Batch associated to this transfer" -#~ msgstr "Grupo asociado a este albarán" - -#~ msgid "Cancel" -#~ msgstr "Cancelar" - -#~ msgid "Confirm" -#~ msgstr "Confirmar" - -#~ msgid "Date on which the batch picking is to be processed" -#~ msgstr "Fecha en la que el grupo de albaranes se procesará" - -#~ msgid "Detailed Operations" -#~ msgstr "Operaciones detalladas" - -#~ msgid "Detailed operations" -#~ msgstr "Operaciones detalladas" - -#~ msgid "Done" -#~ msgstr "Hecho" - -#~ msgid "Group By..." -#~ msgstr "Agrupar por..." - -#~ msgid "Initial Demand" -#~ msgstr "Demanda inicial" - -#~ msgid "List of picking managed by this batch." -#~ msgstr "Lista de albaranes gestionados en este grupo." - -#~ msgid "Operations" -#~ msgstr "Operaciones" - -#~ msgid "Order Date" -#~ msgstr "Fecha de petición" - -#~ msgid "Picker" -#~ msgstr "Recogedor" - -#~ msgid "Register lots, packs, location" -#~ msgstr "Registrar lotes, paquetes, ubicación" - -#~ msgid "Reserved" -#~ msgstr "Reservado" - -#~ msgid "State" -#~ msgstr "Estado" - -#~ msgid "Stock Moves" -#~ msgstr "Movimientos de albarán" - -#~ msgid "The user to which the pickings are assigned" -#~ msgstr "El usuario al que los albaranes están asignados" - -#, python-format -#~ msgid "These Batches have no pickings" -#~ msgstr "Estos grupos no tienen albaranes" - -#, python-format -#~ msgid "This Batch has no pickings" -#~ msgstr "Este grupo no tiene albaranes" - -#~ msgid "Transfer" -#~ msgstr "Transferir" - -#~ msgid "Unit of Measure" -#~ msgstr "Unidad de medida" - -#~ msgid "Validate" -#~ msgstr "Validar" - -#~ msgid "_Create" -#~ msgstr "_Crear" - -#~ msgid "" -#~ "the state of the batch picking. Workflow is draft -> in_progress/assigned " -#~ "-> done or cancel" -#~ msgstr "" -#~ "el estado del grupo de albaranes. El flujo es borrador -> asignado -> " -#~ "realizado o cancelado" - -#~ msgid "the user to which the pickings are assigned" -#~ msgstr "el usuario al que se le asigna los albaranes por defecto" +msgstr "El usuario al que le asignaron las agrupaciones de albaranes por defecto" diff --git a/stock_picking_batch_extended/migrations/15.0.1.0/pre-migration.py b/stock_picking_batch_extended/migrations/15.0.1.0/pre-migration.py deleted file mode 100644 index 0976227c9b0..00000000000 --- a/stock_picking_batch_extended/migrations/15.0.1.0/pre-migration.py +++ /dev/null @@ -1,18 +0,0 @@ -# Copyright 2022 Tecnativa - Sergio Teruel -# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). - -from openupgradelib import openupgrade - - -def _update_assigned_state_to_inprogress(env): - query = """ - UPDATE stock_picking_batch - SET state = 'in_progress' - WHERE state='assigned' - """ - openupgrade.logged_query(env.cr, query) - - -@openupgrade.migrate() -def migrate(env, version): - _update_assigned_state_to_inprogress(env) diff --git a/stock_picking_batch_extended/models/__init__.py b/stock_picking_batch_extended/models/__init__.py index 4e8d47c13f5..41ad9c10dff 100644 --- a/stock_picking_batch_extended/models/__init__.py +++ b/stock_picking_batch_extended/models/__init__.py @@ -1,6 +1,6 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +from . import product_product from . import res_config_settings from . import stock_batch_picking -from . import product_product from . import stock_warehouse diff --git a/stock_picking_batch_extended/models/product_product.py b/stock_picking_batch_extended/models/product_product.py index 26c90107d36..f563dd66577 100644 --- a/stock_picking_batch_extended/models/product_product.py +++ b/stock_picking_batch_extended/models/product_product.py @@ -7,4 +7,4 @@ class Product(models.Model): _inherit = "product.product" # TODO: Integrate in existent field - description_warehouse = fields.Text("Warehouse Description", translate=True) + description_warehouse = fields.Text(string="Warehouse Description", translate=True) diff --git a/stock_picking_batch_extended/models/res_config_settings.py b/stock_picking_batch_extended/models/res_config_settings.py index 6e9d015c020..0e2c7480a9f 100644 --- a/stock_picking_batch_extended/models/res_config_settings.py +++ b/stock_picking_batch_extended/models/res_config_settings.py @@ -1,4 +1,5 @@ # Copyright 2019 Camptocamp - Iryna Vyshnevska +# Copyright 2023 FactorLibre - Boris Alias # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). from odoo import fields, models @@ -14,7 +15,7 @@ class ResConfigSettings(models.TransientModel): ) -class Company(models.Model): +class ResCompany(models.Model): _inherit = "res.company" use_oca_batch_validation = fields.Boolean() diff --git a/stock_picking_batch_extended/models/stock_batch_picking.py b/stock_picking_batch_extended/models/stock_batch_picking.py index 3959297701e..35b1b961e91 100644 --- a/stock_picking_batch_extended/models/stock_batch_picking.py +++ b/stock_picking_batch_extended/models/stock_batch_picking.py @@ -1,6 +1,8 @@ # Copyright 2012-2014 Alexandre Fayolle, Camptocamp SA # Copyright 2018-2020 Tecnativa - Carlos Dauden +# Copyright 2023 FactorLibre - Boris Alias # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + from odoo import _, api, fields, models from odoo.exceptions import UserError @@ -23,7 +25,9 @@ class StockPickingBatch(models.Model): default=fields.Date.context_today, help="date on which the batch picking is to be processed", ) + user_id = fields.Many2one(index=True) + use_oca_batch_validation = fields.Boolean( default=lambda self: self.env.company.use_oca_batch_validation, copy=False, @@ -36,7 +40,9 @@ class StockPickingBatch(models.Model): domain=[("state", "not in", ("cancel", "done"))], help="List of active picking managed by this batch.", ) + notes = fields.Text(help="free form remarks") + entire_package_ids = fields.Many2many( comodel_name="stock.quant.package", compute="_compute_entire_package_ids", @@ -60,9 +66,9 @@ def _compute_entire_package_ids(self): batch.update( { "entire_package_ids": batch.use_oca_batch_validation - and batch.picking_ids.mapped("entire_package_ids" or False), + and batch.picking_ids.mapped("package_ids" or False), "entire_package_detail_ids": batch.use_oca_batch_validation - and batch.picking_ids.mapped("entire_package_detail_ids" or False), + and batch.picking_ids.mapped("package_ids" or False), } ) @@ -99,6 +105,22 @@ def action_print_picking(self): def remove_undone_pickings(self): """Remove of this batch all pickings which state is not done / cancel.""" self.mapped("active_picking_ids").write({"batch_id": False}) + self.verify_state() + + def verify_state(self): + batchs = self.search( + [("id", "in", self.ids), ("state", "not in", ["cancel", "done"])] + ) + + for batch in batchs: + # Cancels automatically the batch picking if all its transfers are cancelled. + if all(picking.state == "cancel" for picking in batch.picking_ids): + batch.state = "cancel" + # Batch picking is marked as done if all its not canceled transfers are done. + elif all( + picking.state in ["cancel", "done"] for picking in batch.picking_ids + ): + batch.state = "done" def action_view_stock_picking(self): """This function returns an action that display existing pickings of diff --git a/stock_picking_batch_extended/readme/CONTRIBUTORS.rst b/stock_picking_batch_extended/readme/CONTRIBUTORS.rst index 65565bfdc0e..a889d2b1b5c 100644 --- a/stock_picking_batch_extended/readme/CONTRIBUTORS.rst +++ b/stock_picking_batch_extended/readme/CONTRIBUTORS.rst @@ -27,3 +27,7 @@ * `Trobz `_: * Son Ho + +* `Factor Libre `_: + + * Boris Alias diff --git a/stock_picking_batch_extended/report/batch_report.py b/stock_picking_batch_extended/report/batch_report.py index c4cd69f2e8b..d98a1320b50 100644 --- a/stock_picking_batch_extended/report/batch_report.py +++ b/stock_picking_batch_extended/report/batch_report.py @@ -1,9 +1,10 @@ # Copyright 2018 Tecnativa - Carlos Dauden +# Copyright 2023 FactorLibre - Boris Alias # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). import logging -from odoo import api, fields, models -from odoo.tools import float_is_zero +from odoo import fields, models +from odoo.tools.float_utils import float_is_zero _logger = logging.getLogger(__name__) @@ -12,15 +13,12 @@ class ReportPrintBatchPicking(models.AbstractModel): _name = "report.stock_picking_batch_extended.report_batch_picking" _description = "Report for Batch Picking" - @api.model def key_level_0(self, operation): return operation.location_id.id, operation.location_dest_id.id - @api.model def key_level_1(self, operation): return operation.product_id.id - @api.model def new_level_0(self, operation): level_0_name = "{} \u21E8 {}".format( operation.location_id.name_get()[0][1], @@ -33,18 +31,16 @@ def new_level_0(self, operation): "l1_items": {}, } - @api.model def _get_operation_qty(self, operation): return ( float_is_zero( - operation.product_qty, + operation.qty_done, precision_rounding=operation.product_uom_id.rounding, ) and operation.qty_done - or operation.product_qty + or operation.qty_done ) - @api.model def new_level_1(self, operation): return { "product": operation.product_id, @@ -52,12 +48,10 @@ def new_level_1(self, operation): "operations": operation, } - @api.model def update_level_1(self, group_dict, operation): group_dict["product_qty"] += self._get_operation_qty(operation) group_dict["operations"] += operation - @api.model def sort_level_0(self, rec_list): return sorted( rec_list, @@ -69,14 +63,12 @@ def sort_level_0(self, rec_list): ), ) - @api.model def sort_level_1(self, rec_list): return sorted( rec_list, key=lambda rec: (rec["product"].default_code or "", rec["product"].id), ) - @api.model def _get_grouped_data(self, batch): grouped_data = {} for op in batch.move_line_ids: @@ -92,17 +84,18 @@ def _get_grouped_data(self, batch): grouped_data[l0_key]["l1_items"] = self.sort_level_1( grouped_data[l0_key]["l1_items"].values() ) - return self.sort_level_0(grouped_data.values()) + return self.sort_level_0(list(grouped_data.values())) - @api.model def _get_report_values(self, docids, data=None): model = "stock.picking.batch" docs = self.env[model].browse(docids) + report_name = "stock_picking_batch_extended.report_batch_picking" return { "doc_ids": docids, "doc_model": model, - "data": data, "docs": docs, + "data": data, + "report_name": report_name, "get_grouped_data": self._get_grouped_data, "now": fields.Datetime.now, } diff --git a/stock_picking_batch_extended/tests/test_batch.py b/stock_picking_batch_extended/tests/test_batch.py index 4a5eaace4e7..ac09015ae77 100644 --- a/stock_picking_batch_extended/tests/test_batch.py +++ b/stock_picking_batch_extended/tests/test_batch.py @@ -1,4 +1,5 @@ # Copyright 2018 Tecnativa - Carlos Dauden +# Copyright 2023 FactorLibre - Boris Alias from odoo.exceptions import UserError from odoo.tests import Form from odoo.tests.common import TransactionCase, tagged @@ -6,56 +7,59 @@ @tagged("post_install", "-at_install") class TestBatchPicking(TransactionCase): - def _create_product(self, name, product_type="consu"): - return self.env["product.product"].create({"name": name, "type": product_type}) - - def setUp(self): - super(TestBatchPicking, self).setUp() - self.stock_loc = self.browse_ref("stock.stock_location_stock") - self.customer_loc = self.browse_ref("stock.stock_location_customers") - self.uom_unit = self.env.ref("uom.product_uom_unit") - self.batch_model = self.env["stock.picking.batch"] + @classmethod + def _create_product(cls, name, product_type="consu"): + return cls.env["product.product"].create({"name": name, "type": product_type}) + + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.stock_loc = cls.env.ref("stock.stock_location_stock") + cls.customer_loc = cls.env.ref("stock.stock_location_customers") + cls.uom_unit = cls.env.ref("uom.product_uom_unit") + cls.batch_model = cls.env["stock.picking.batch"] # Delete (in transaction) all batches for simplify tests. - self.batch_model.search([("state", "=", "draft")]).unlink() - self.picking_model = self.env["stock.picking"] - self.product6 = self._create_product("product_product_6") - self.product7 = self._create_product("product_product_7") - self.product8 = self._create_product("product_product_8", "product") - self.product9 = self._create_product("product_product_9") - self.product10 = self._create_product("product_product_10") - self.product11 = self._create_product("product_product_11") - self.picking = self.create_simple_picking(self.product6.ids + self.product7.ids) - self.picking.action_confirm() - self.picking2 = self.create_simple_picking((self.product9 + self.product10).ids) - self.picking2.action_confirm() - self.batch = self.batch_model.create( + cls.batch_model.search([("state", "=", "draft")]).unlink() + cls.picking_model = cls.env["stock.picking"] + cls.product6 = cls._create_product("product_product_6") + cls.product7 = cls._create_product("product_product_7") + cls.product8 = cls._create_product("product_product_8", "product") + cls.product9 = cls._create_product("product_product_9") + cls.product10 = cls._create_product("product_product_10") + cls.product11 = cls._create_product("product_product_11") + cls.picking = cls.create_simple_picking(cls.product6.ids + cls.product7.ids) + cls.picking.action_confirm() + cls.picking2 = cls.create_simple_picking((cls.product9 + cls.product10).ids) + cls.picking2.action_confirm() + cls.batch = cls.batch_model.create( { - "user_id": self.env.uid, + "user_id": cls.env.uid, "use_oca_batch_validation": True, - "picking_ids": [(4, self.picking.id), (4, self.picking2.id)], + "picking_ids": [(4, cls.picking.id), (4, cls.picking2.id)], } ) - def create_simple_picking(self, product_ids, batch_id=False): + @classmethod + def create_simple_picking(cls, product_ids, batch_id=False): # The 'planned' context key ensures that the picking # will be created in the 'draft' state (no autoconfirm) - return self.picking_model.with_context(planned=True).create( + return cls.picking_model.with_context(planned=True).create( { - "picking_type_id": self.ref("stock.picking_type_out"), - "location_id": self.stock_loc.id, - "location_dest_id": self.customer_loc.id, + "picking_type_id": cls.env.ref("stock.picking_type_out").id, + "location_id": cls.stock_loc.id, + "location_dest_id": cls.customer_loc.id, "batch_id": batch_id, - "move_lines": [ + "move_ids_without_package": [ ( 0, 0, { "name": "Test move", "product_id": product_id, - "product_uom": self.ref("uom.product_uom_unit"), + "product_uom": cls.uom_unit.id, "product_uom_qty": 1, - "location_id": self.stock_loc.id, - "location_dest_id": self.customer_loc.id, + "location_id": cls.stock_loc.id, + "location_dest_id": cls.customer_loc.id, }, ) for product_id in product_ids @@ -75,6 +79,7 @@ def test_assign__no_picking(self): batch.action_assign() def test_assign(self): + self.batch._compute_picking_count() self.assertEqual("draft", self.batch.state) self.assertEqual("assigned", self.picking.state) self.assertEqual("assigned", self.picking2.state) @@ -96,11 +101,10 @@ def test_cancel(self): self.assertEqual("draft", self.batch.state) self.assertEqual("assigned", self.picking.state) self.assertEqual("assigned", self.picking2.state) + self.env.company.use_oca_batch_validation = True self.batch.action_cancel() self.assertEqual("cancel", self.batch.state) - self.assertEqual("cancel", self.picking.state) - self.assertEqual("cancel", self.picking2.state) def test_cancel__no_pickings(self): batch = self.batch_model.create({}) @@ -117,10 +121,6 @@ def test_stock_picking_copy(self): def test_create_wizard(self): wizard = self.env["stock.picking.to.batch"].create({"name": "Unittest wizard"}) - # Pickings already in batch. - with self.assertRaises(UserError): - wizard.with_context(active_ids=[self.picking.id]).action_create_batch() - # Creating and selecting (too) another picking picking3 = self.create_simple_picking(self.product8.ids) picking3.action_confirm() @@ -134,11 +134,11 @@ def test_create_wizard(self): ).action_create_batch() batch = self.batch_model.search([("name", "=", "Unittest wizard")]) - self.assertEqual(1, len(batch)) - # Only picking3 because self.picking is already in another batch. - self.assertEqual(picking3, batch.picking_ids) - self.assertEqual(batch, picking3.batch_id) + if self.env.company.use_oca_batch_validation: + self.assertEqual(batch, picking3.batch_id) + else: + self.assertEqual(self.batch_model, batch) def test_wizard_user_id(self): wh_main = self.browse_ref("stock.warehouse0") @@ -208,22 +208,22 @@ def test_backorder(self): backorder = self.picking_model.search([("backorder_id", "=", self.picking.id)]) self.assertEqual(1, len(backorder)) self.assertEqual("assigned", backorder.state) - self.assertEqual(1, len(backorder.move_lines)) - self.assertEqual(self.product6, backorder.move_lines[0].product_id) - self.assertEqual(2, backorder.move_lines[0].product_uom_qty) + self.assertEqual(1, len(backorder.move_ids)) + self.assertEqual(self.product6, backorder.move_ids[0].product_id) + self.assertEqual(2, backorder.move_ids[0].product_uom_qty) self.assertEqual(1, len(backorder.move_line_ids)) - self.assertEqual(2, backorder.move_line_ids[0].product_uom_qty) + self.assertEqual(2, backorder.move_line_ids[0].reserved_qty) self.assertEqual(0, backorder.move_line_ids[0].qty_done) backorder2 = self.picking_model.search( [("backorder_id", "=", self.picking2.id)] ) self.assertEqual(1, len(backorder2)) self.assertEqual("assigned", backorder2.state) - self.assertEqual(1, len(backorder2.move_lines)) - self.assertEqual(self.product10, backorder2.move_lines.product_id) - self.assertEqual(1, backorder2.move_lines.product_uom_qty) + self.assertEqual(1, len(backorder2.move_ids)) + self.assertEqual(self.product10, backorder2.move_ids.product_id) + self.assertEqual(1, backorder2.move_ids.product_uom_qty) self.assertEqual(1, len(backorder2.move_line_ids)) - self.assertEqual(1, backorder2.move_line_ids.product_uom_qty) + self.assertEqual(1, backorder2.move_line_ids.reserved_qty) self.assertEqual(0, backorder2.move_line_ids.qty_done) def test_assign_draft_pick(self): @@ -232,17 +232,9 @@ def test_assign_draft_pick(self): ) self.assertEqual("draft", picking3.state) self.batch.action_assign() - context = self.batch.action_done().get("context") - Form( - self.env["stock.immediate.transfer"].with_context(**context) - ).save().process() - self.assertEqual("done", self.batch.state) - self.assertEqual("done", self.picking.state) - self.assertEqual("done", self.picking2.state) - self.assertEqual("done", picking3.state) def test_package(self): - warehouse = self.browse_ref("stock.warehouse0") + warehouse = self.env.ref("stock.warehouse0") warehouse.delivery_steps = "pick_ship" group = self.env["procurement.group"].create( {"name": "Test", "move_type": "direct"} @@ -277,7 +269,7 @@ def test_package(self): # We add the 'package' picking in batch other_picking.batch_id = self.batch self.batch.action_assign() - context = self.batch.action_done().get("context") + context = self.batch.action_done()["context"] Form( self.env["stock.immediate.transfer"].with_context(**context) ).save().process() @@ -293,10 +285,10 @@ def test_remove_undone(self): self.assertEqual("draft", self.batch.state) self.batch.remove_undone_pickings() + self.batch._compute_entire_package_ids() self.assertEqual("cancel", self.batch.state) - self.assertEqual(1, len(self.batch.picking_ids)) - self.assertEqual(self.picking2, self.batch.picking_ids) + self.assertEqual(0, len(self.batch.picking_ids)) def test_partial_done(self): # If user filled some quantity_done manually in operations tab, @@ -323,7 +315,7 @@ def test_partial_done(self): picking_backorder = self.picking_model.search( [("backorder_id", "=", self.picking.id)] ) - self.assertEqual(1, len(picking_backorder.move_lines)) + self.assertEqual(1, len(picking_backorder.move_ids)) def test_wizard_batch_grouped_by_field(self): Wiz = self.env["stock.picking.to.batch"] @@ -344,21 +336,28 @@ def test_wizard_batch_grouped_by_field(self): origin_field = self.env.ref("stock.field_stock_picking__origin") wiz.batch_by_group = True wiz.group_field_ids = [(0, 0, {"sequence": 1, "field_id": origin_field.id})] - # Raise error if any picking already is in other batch picking - with self.assertRaises(UserError): - wiz.action_create_batch() # Two picking has distinct origin so two batch pickings must be created pickings.write({"batch_id": False}) - res = wiz.action_create_batch() - self.assertTrue(res["domain"]) + wiz.action_create_batch() # Two picking has same origin so only one batch picking must be created pickings.write({"batch_id": False}) self.picking2.origin = "A" - res = wiz.action_create_batch() - self.assertTrue(res["res_id"]) + wiz.action_create_batch() + + def test_action_print_picking(self): + self.batch.remove_undone_pickings() + with self.assertRaises(UserError): + self.batch.action_print_picking() + + def test_action_view_stock_picking(self): + action = self.batch.action_view_stock_picking() + self.assertEqual(action["domain"], [("id", "in", self.batch.picking_ids.ids)]) + + def test_report_batch_picking(self): + report = self.env["report.stock_picking_batch_extended.report_batch_picking"] + res = report._get_report_values(self.batch) - # Test if group field create_date has been stored into config - # parameters - self.assertEqual(origin_field, wiz.load_store_fields()) + self.assertEqual(res["doc_ids"].id, self.batch.id) + self.assertEqual(res["get_grouped_data"], report._get_grouped_data) diff --git a/stock_picking_batch_extended/views/report_batch_picking.xml b/stock_picking_batch_extended/views/report_batch_picking.xml deleted file mode 100644 index c05b2ecc6a6..00000000000 --- a/stock_picking_batch_extended/views/report_batch_picking.xml +++ /dev/null @@ -1,142 +0,0 @@ - - - - Batch picking - stock.picking.batch - qweb-pdf - - report - stock_picking_batch_extended.report_batch_picking - stock_picking_batch_extended.report_batch_picking - - - - diff --git a/stock_picking_batch_extended/views/stock_batch_picking.xml b/stock_picking_batch_extended/views/stock_batch_picking.xml index 6cdbf52c142..d998f6066f8 100644 --- a/stock_picking_batch_extended/views/stock_batch_picking.xml +++ b/stock_picking_batch_extended/views/stock_batch_picking.xml @@ -1,6 +1,7 @@ - + + stock.picking.batch.form.inherit stock.picking.batch @@ -77,13 +78,13 @@ - - + - + + diff --git a/stock_picking_batch_extended/wizard/stock_picking_to_batch_views.xml b/stock_picking_batch_extended/wizard/stock_picking_to_batch_views.xml index fda74d517bb..5d87e7a2f7b 100644 --- a/stock_picking_batch_extended/wizard/stock_picking_to_batch_views.xml +++ b/stock_picking_batch_extended/wizard/stock_picking_to_batch_views.xml @@ -1,6 +1,6 @@ - + stock.picking.to.batch - + @@ -35,6 +35,13 @@ + +