From 3e90b600cd6c6d50d7fb3fd94a3b6c90254bdb9e Mon Sep 17 00:00:00 2001 From: Berezi Date: Tue, 19 Nov 2024 14:00:11 +0100 Subject: [PATCH] [16.0][MIG] cleaning_database_operations: Migration to 16.0 --- cleaning_database_operations/README.rst | 11 +- cleaning_database_operations/__init__.py | 1 + cleaning_database_operations/__manifest__.py | 12 +- .../i18n/cleaning_database_operations.pot | 117 +++++++---- cleaning_database_operations/i18n/es.po | 179 +++++++++------- .../models/cleaning_database.py | 80 +++---- .../security/ir.model.access.csv | 2 + .../views/cleaning_database_view.xml | 195 ++++++++---------- .../wizards/__init__.py | 1 + .../cleaning_database_warning_wizard.py | 56 +++++ .../cleaning_database_warning_wizard_view.xml | 27 +++ .../odoo/addons/cleaning_database_operations | 1 + setup/cleaning_database_operations/setup.py | 6 + 13 files changed, 396 insertions(+), 292 deletions(-) create mode 100644 cleaning_database_operations/wizards/__init__.py create mode 100644 cleaning_database_operations/wizards/cleaning_database_warning_wizard.py create mode 100644 cleaning_database_operations/wizards/cleaning_database_warning_wizard_view.xml create mode 120000 setup/cleaning_database_operations/odoo/addons/cleaning_database_operations create mode 100644 setup/cleaning_database_operations/setup.py diff --git a/cleaning_database_operations/README.rst b/cleaning_database_operations/README.rst index 98eacd3345..542738fde8 100644 --- a/cleaning_database_operations/README.rst +++ b/cleaning_database_operations/README.rst @@ -6,10 +6,13 @@ Cleaning Database Operations ============================ -Cleaning all the database operations: Stock Move Lines, Stock Moves, Pickings, -Sale Orders, Sale Order Lines, Purchase Orders, Purchase Order Lines, -Account Moves, Account Move Lines, Account Move Reconcile, Stock Quants, -Stock Valuation Layers and Account Analytic Lines. +* Cleaning all the database operations of selected companies: + Stock Move Lines, Stock Moves, Pickings, Quants, Lots, + Valuation Layers, Sale Orders, Sale Order Lines, Purchase Orders, + Purchase Order Lines, Account Partial Reconcile, Account Moves, + Account Move Lines, Account Bank Statement, Account Payment Order and + Account Payment Line. +* Restart all sequences. Bug Tracker =========== diff --git a/cleaning_database_operations/__init__.py b/cleaning_database_operations/__init__.py index 0650744f6b..aee8895e7a 100644 --- a/cleaning_database_operations/__init__.py +++ b/cleaning_database_operations/__init__.py @@ -1 +1,2 @@ from . import models +from . import wizards diff --git a/cleaning_database_operations/__manifest__.py b/cleaning_database_operations/__manifest__.py index e9d1ebca15..92d89f8c21 100644 --- a/cleaning_database_operations/__manifest__.py +++ b/cleaning_database_operations/__manifest__.py @@ -1,9 +1,9 @@ -# Copyright 2023 Berezi Amubieta - AvanzOSC +# Copyright 2024 Berezi Amubieta - AvanzOSC # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). { "name": "Cleaning Database Operations", - "version": "14.0.1.1.0", - "category": "Custom", + "version": "16.0.1.0.0", + "category": "Generic Modules", "license": "AGPL-3", "author": "AvanzOSC", "website": "https://github.com/avanzosc/odoo-addons", @@ -12,16 +12,12 @@ "sale", "purchase", "account", - "analytic", - "mrp", - "purchase_order_shipping_method", "account_payment_order", - "stock_location_warehouse", - "account_asset_management", ], "data": [ "security/ir.model.access.csv", "views/cleaning_database_view.xml", + "wizards/cleaning_database_warning_wizard_view.xml", ], "installable": True, } diff --git a/cleaning_database_operations/i18n/cleaning_database_operations.pot b/cleaning_database_operations/i18n/cleaning_database_operations.pot index 53ac695187..fc272c704d 100644 --- a/cleaning_database_operations/i18n/cleaning_database_operations.pot +++ b/cleaning_database_operations/i18n/cleaning_database_operations.pot @@ -4,10 +4,10 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 14.0\n" +"Project-Id-Version: Odoo Server 16.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-05-16 09:59+0000\n" -"PO-Revision-Date: 2024-05-16 09:59+0000\n" +"POT-Creation-Date: 2024-11-28 12:53+0000\n" +"PO-Revision-Date: 2024-11-28 12:53+0000\n" "Last-Translator: \n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -15,16 +15,30 @@ msgstr "" "Content-Transfer-Encoding: \n" "Plural-Forms: \n" +#. module: cleaning_database_operations +#: model:ir.model.fields.selection,name:cleaning_database_operations.selection__cleaning_database_warning_wizard__object_to_delete__accounting +msgid "Accounting" +msgstr "" + #. module: cleaning_database_operations #: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view msgid "" -"Account Analytic Line, Account Partial Reconcile, Account Move Line, Account" -" Move, Account Payment Order." +"Accounting: Account Partial Reconcile, Account Move Line, Account Move, " +"Account Bank Statement, Account Payment Order, Account Payment Line." msgstr "" #. module: cleaning_database_operations -#: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view -msgid "Accounting:" +#. odoo-python +#: code:addons/cleaning_database_operations/wizards/cleaning_database_warning_wizard.py:0 +#, python-format +msgid "" +"Are you sure you want to delete the entire operation? This action will be " +"irreversible" +msgstr "" + +#. module: cleaning_database_operations +#: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_warning_wizard_view_form +msgid "Cancel" msgstr "" #. module: cleaning_database_operations @@ -46,13 +60,15 @@ msgid "Cleaning Database Operations" msgstr "" #. module: cleaning_database_operations -#: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view -msgid "Cleaning Lots" +#. odoo-python +#: code:addons/cleaning_database_operations/models/cleaning_database.py:0 +#, python-format +msgid "Cleaning Database Warning" msgstr "" #. module: cleaning_database_operations #: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view -msgid "Cleaning MRP Operations" +msgid "Cleaning Lots" msgstr "" #. module: cleaning_database_operations @@ -65,21 +81,11 @@ msgstr "" msgid "Cleaning Sale Operations" msgstr "" -#. module: cleaning_database_operations -#: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view -msgid "Cleaning Sequences" -msgstr "" - #. module: cleaning_database_operations #: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view msgid "Cleaning Stock Operations" msgstr "" -#. module: cleaning_database_operations -#: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view -msgid "Cleaning Transport Operations" -msgstr "" - #. module: cleaning_database_operations #: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view msgid "Cleaning Valuation Layers" @@ -93,21 +99,28 @@ msgstr "" #. module: cleaning_database_operations #: model:ir.model.fields,field_description:cleaning_database_operations.field_cleaning_database__create_uid +#: model:ir.model.fields,field_description:cleaning_database_operations.field_cleaning_database_warning_wizard__create_uid msgid "Created by" msgstr "" #. module: cleaning_database_operations #: model:ir.model.fields,field_description:cleaning_database_operations.field_cleaning_database__create_date +#: model:ir.model.fields,field_description:cleaning_database_operations.field_cleaning_database_warning_wizard__create_date msgid "Created on" msgstr "" #. module: cleaning_database_operations -#: code:addons/cleaning_database_operations/models/cleaning_database.py:0 +#. odoo-python #: code:addons/cleaning_database_operations/models/cleaning_database.py:0 #, python-format msgid "Creation date: {}" msgstr "" +#. module: cleaning_database_operations +#: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_warning_wizard_view_form +msgid "Delete" +msgstr "" + #. module: cleaning_database_operations #: model:ir.model.fields,field_description:cleaning_database_operations.field_cleaning_database__name msgid "Description" @@ -115,84 +128,94 @@ msgstr "" #. module: cleaning_database_operations #: model:ir.model.fields,field_description:cleaning_database_operations.field_cleaning_database__display_name +#: model:ir.model.fields,field_description:cleaning_database_operations.field_cleaning_database_warning_wizard__display_name msgid "Display Name" msgstr "" #. module: cleaning_database_operations #: model:ir.model.fields,field_description:cleaning_database_operations.field_cleaning_database__id +#: model:ir.model.fields,field_description:cleaning_database_operations.field_cleaning_database_warning_wizard__id msgid "ID" msgstr "" #. module: cleaning_database_operations #: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view -msgid "Inventory:" +msgid "" +"Inventory: Stock Move Line, Stock Move, Stock Picking, Stock Quant, Stock " +"Valuation Layer, Stock Production Lot." msgstr "" #. module: cleaning_database_operations #: model:ir.model.fields,field_description:cleaning_database_operations.field_cleaning_database____last_update +#: model:ir.model.fields,field_description:cleaning_database_operations.field_cleaning_database_warning_wizard____last_update msgid "Last Modified on" msgstr "" #. module: cleaning_database_operations #: model:ir.model.fields,field_description:cleaning_database_operations.field_cleaning_database__write_uid +#: model:ir.model.fields,field_description:cleaning_database_operations.field_cleaning_database_warning_wizard__write_uid msgid "Last Updated by" msgstr "" #. module: cleaning_database_operations #: model:ir.model.fields,field_description:cleaning_database_operations.field_cleaning_database__write_date +#: model:ir.model.fields,field_description:cleaning_database_operations.field_cleaning_database_warning_wizard__write_date msgid "Last Updated on" msgstr "" #. module: cleaning_database_operations -#: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view -msgid "MRP Workorder, MRP Production" +#: model:ir.model.fields.selection,name:cleaning_database_operations.selection__cleaning_database_warning_wizard__object_to_delete__lot +msgid "Lot" msgstr "" #. module: cleaning_database_operations -#: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view -msgid "Manufacturing:" +#: model:ir.model.fields.selection,name:cleaning_database_operations.selection__cleaning_database_warning_wizard__object_to_delete__purchase +msgid "Purchase" msgstr "" #. module: cleaning_database_operations #: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view -msgid "Others" +msgid "Purchases: Purchase Order Line, Purchase Order." msgstr "" #. module: cleaning_database_operations #: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view -msgid "Purchase Order Line, Purchase Order." +msgid "Reset Sequences" msgstr "" #. module: cleaning_database_operations -#: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view -msgid "Purchases:" +#: model:ir.model.fields.selection,name:cleaning_database_operations.selection__cleaning_database_warning_wizard__object_to_delete__sale +msgid "Sale" msgstr "" #. module: cleaning_database_operations #: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view -msgid "Reset sequences" +msgid "Sales: Sale Order Line, Sale Order." msgstr "" #. module: cleaning_database_operations -#: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view -msgid "Sale Order Line, Sale Order." +#: model:ir.model.fields.selection,name:cleaning_database_operations.selection__cleaning_database_warning_wizard__object_to_delete__sequences +msgid "Sequences" msgstr "" #. module: cleaning_database_operations #: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view -msgid "Sales:" +msgid "Squence: Reset sequences." msgstr "" #. module: cleaning_database_operations -#: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view -msgid "Squence" +#: model:ir.model.fields,field_description:cleaning_database_operations.field_cleaning_database_warning_wizard__object_to_delete +msgid "Status" msgstr "" #. module: cleaning_database_operations -#: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view -msgid "" -"Stock Move Line, Stock Move, Stock Picking, Stock Quant, Stock Valuation " -"Layer, Stock Inventory, Stock Production Lot." +#: model:ir.model.fields.selection,name:cleaning_database_operations.selection__cleaning_database_warning_wizard__object_to_delete__stock +msgid "Stock" +msgstr "" + +#. module: cleaning_database_operations +#: model:ir.model.fields,field_description:cleaning_database_operations.field_cleaning_database_warning_wizard__text +msgid "Text" msgstr "" #. module: cleaning_database_operations @@ -201,6 +224,16 @@ msgid "This will delete the following objects" msgstr "" #. module: cleaning_database_operations -#: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view -msgid "Transport Carrier Lines To Invoice" +#: model:ir.model.fields.selection,name:cleaning_database_operations.selection__cleaning_database_warning_wizard__object_to_delete__valuation +msgid "Valuation Layer" +msgstr "" + +#. module: cleaning_database_operations +#: model:ir.model,name:cleaning_database_operations.model_cleaning_database_warning_wizard +msgid "Wizard for warning when cleaning database operations" +msgstr "" + +#. module: cleaning_database_operations +#: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_warning_wizard_view_form +msgid "or" msgstr "" diff --git a/cleaning_database_operations/i18n/es.po b/cleaning_database_operations/i18n/es.po index 57a172fd12..92437a3445 100644 --- a/cleaning_database_operations/i18n/es.po +++ b/cleaning_database_operations/i18n/es.po @@ -4,10 +4,10 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 14.0\n" +"Project-Id-Version: Odoo Server 16.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-05-16 10:00+0000\n" -"PO-Revision-Date: 2024-05-16 10:00+0000\n" +"POT-Creation-Date: 2024-11-28 12:53+0000\n" +"PO-Revision-Date: 2024-11-28 12:53+0000\n" "Last-Translator: \n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -15,24 +15,38 @@ msgstr "" "Content-Transfer-Encoding: \n" "Plural-Forms: \n" +#. module: cleaning_database_operations +#: model:ir.model.fields.selection,name:cleaning_database_operations.selection__cleaning_database_warning_wizard__object_to_delete__accounting +msgid "Accounting" +msgstr "Contabilidad" + #. module: cleaning_database_operations #: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view msgid "" -"Account Analytic Line, Account Partial Reconcile, Account Move Line, Account" -" Move, Account Payment Order." +"Accounting: Account Partial Reconcile, Account Move Line, Account Move, " +"Account Bank Statement, Account Payment Order, Account Payment Line." msgstr "" -"Líneas analítica, Conciliación parcial, Apunte contable, Asiento contable, " -"Orden de pago." +"Contabilidad: Conciliación parcial, apunte contable, asiento contable, " +"extracto bancario, orden de pago, líneas de pago." #. module: cleaning_database_operations -#: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view -msgid "Accounting:" -msgstr "Contabilidad:" +#. odoo-python +#: code:addons/cleaning_database_operations/wizards/cleaning_database_warning_wizard.py:0 +#, python-format +msgid "" +"Are you sure you want to delete the entire operation? This action will be " +"irreversible" +msgstr "" +"¿Está seguro de que desea borrar toda la operativa? Esta acción será irreversible" +#. module: cleaning_database_operations +#: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_warning_wizard_view_form +msgid "Cancel" +msgstr "Cancelar" #. module: cleaning_database_operations #: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view msgid "Cleaning Accounting Operations" -msgstr "Borrado de facturación" +msgstr "Borrado de operaciones de contabilidad" #. module: cleaning_database_operations #: model:ir.actions.act_window,name:cleaning_database_operations.action_cleaning_database_view @@ -40,52 +54,44 @@ msgstr "Borrado de facturación" #: model:ir.ui.menu,name:cleaning_database_operations.menu_view_cleaning_database #: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view msgid "Cleaning Database" -msgstr "Limpieza base de datos" +msgstr "Limpieza en base de datos" #. module: cleaning_database_operations #: model:ir.model,name:cleaning_database_operations.model_cleaning_database msgid "Cleaning Database Operations" -msgstr "Operaciones de limpieza de base de dato" +msgstr "Limpieza de operaciones en base de datos" #. module: cleaning_database_operations -#: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view -msgid "Cleaning Lots" -msgstr "Borrar lotes" +#. odoo-python +#: code:addons/cleaning_database_operations/models/cleaning_database.py:0 +#, python-format +msgid "Cleaning Database Warning" +msgstr "Alerta borrado de base de datos" #. module: cleaning_database_operations #: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view -msgid "Cleaning MRP Operations" -msgstr "Borrado de fabricación" +msgid "Cleaning Lots" +msgstr "Borrado de lotes" #. module: cleaning_database_operations #: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view msgid "Cleaning Purchase Operations" -msgstr "Borrado de compras" +msgstr "Borrado de operaciones de compra" #. module: cleaning_database_operations #: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view msgid "Cleaning Sale Operations" -msgstr "Borrado de ventas" - -#. module: cleaning_database_operations -#: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view -msgid "Cleaning Sequences" -msgstr "Reiniciar secuencias" +msgstr "Borrado de operaciones de venta" #. module: cleaning_database_operations #: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view msgid "Cleaning Stock Operations" -msgstr "Borrado de inventario" - -#. module: cleaning_database_operations -#: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view -msgid "Cleaning Transport Operations" -msgstr "Borrado de transporte" +msgstr "Borrado de operaciones de stock" #. module: cleaning_database_operations #: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view msgid "Cleaning Valuation Layers" -msgstr "Borrado de valoración de inventario" +msgstr "Borrado de valoración de stock" #. module: cleaning_database_operations #: model:ir.model.fields,field_description:cleaning_database_operations.field_cleaning_database__company_ids @@ -95,20 +101,27 @@ msgstr "Compañías" #. module: cleaning_database_operations #: model:ir.model.fields,field_description:cleaning_database_operations.field_cleaning_database__create_uid +#: model:ir.model.fields,field_description:cleaning_database_operations.field_cleaning_database_warning_wizard__create_uid msgid "Created by" -msgstr "Creto por" +msgstr "Creado por" #. module: cleaning_database_operations #: model:ir.model.fields,field_description:cleaning_database_operations.field_cleaning_database__create_date +#: model:ir.model.fields,field_description:cleaning_database_operations.field_cleaning_database_warning_wizard__create_date msgid "Created on" msgstr "Creado el" #. module: cleaning_database_operations -#: code:addons/cleaning_database_operations/models/cleaning_database.py:0 +#. odoo-python #: code:addons/cleaning_database_operations/models/cleaning_database.py:0 #, python-format msgid "Creation date: {}" -msgstr "Fecha creación: {}" +msgstr "Fecha de creación: {}" + +#. module: cleaning_database_operations +#: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_warning_wizard_view_form +msgid "Delete" +msgstr "Borrar" #. module: cleaning_database_operations #: model:ir.model.fields,field_description:cleaning_database_operations.field_cleaning_database__name @@ -117,94 +130,114 @@ msgstr "Descripción" #. module: cleaning_database_operations #: model:ir.model.fields,field_description:cleaning_database_operations.field_cleaning_database__display_name +#: model:ir.model.fields,field_description:cleaning_database_operations.field_cleaning_database_warning_wizard__display_name msgid "Display Name" msgstr "Nombre mostrado" #. module: cleaning_database_operations #: model:ir.model.fields,field_description:cleaning_database_operations.field_cleaning_database__id +#: model:ir.model.fields,field_description:cleaning_database_operations.field_cleaning_database_warning_wizard__id msgid "ID" msgstr "" #. module: cleaning_database_operations #: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view -msgid "Inventory:" -msgstr "Inventario:" +msgid "" +"Inventory: Stock Move Line, Stock Move, Stock Picking, Stock Quant, Stock " +"Valuation Layer, Stock Production Lot." +msgstr "" +"Inventario: Movimiento de producto, movimiento de stock, albarán, stock, " +"valoración de stock, lote." #. module: cleaning_database_operations #: model:ir.model.fields,field_description:cleaning_database_operations.field_cleaning_database____last_update +#: model:ir.model.fields,field_description:cleaning_database_operations.field_cleaning_database_warning_wizard____last_update msgid "Last Modified on" -msgstr "Última modificación el" +msgstr "Modificado el" #. module: cleaning_database_operations #: model:ir.model.fields,field_description:cleaning_database_operations.field_cleaning_database__write_uid +#: model:ir.model.fields,field_description:cleaning_database_operations.field_cleaning_database_warning_wizard__write_uid msgid "Last Updated by" -msgstr "Última actualización por" +msgstr "Actualizado por" #. module: cleaning_database_operations #: model:ir.model.fields,field_description:cleaning_database_operations.field_cleaning_database__write_date +#: model:ir.model.fields,field_description:cleaning_database_operations.field_cleaning_database_warning_wizard__write_date msgid "Last Updated on" -msgstr "Última actualización el" +msgstr "Actualizado el" #. module: cleaning_database_operations -#: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view -msgid "MRP Workorder, MRP Production" -msgstr "Orden de trabajo, Orden de producción." +#: model:ir.model.fields.selection,name:cleaning_database_operations.selection__cleaning_database_warning_wizard__object_to_delete__lot +msgid "Lot" +msgstr "Lote" #. module: cleaning_database_operations -#: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view -msgid "Manufacturing:" -msgstr "Fabricación:" +#: model:ir.model.fields.selection,name:cleaning_database_operations.selection__cleaning_database_warning_wizard__object_to_delete__purchase +msgid "Purchase" +msgstr "Compra" #. module: cleaning_database_operations #: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view -msgid "Others" -msgstr "Otros:" +msgid "Purchases: Purchase Order Line, Purchase Order." +msgstr "Compras: Pedidos de compra, línea de compra." #. module: cleaning_database_operations #: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view -msgid "Purchase Order Line, Purchase Order." -msgstr "Líneas de pedido de compra, pedidos de compra." +msgid "Reset Sequences" +msgstr "Reiniciar secuencias" #. module: cleaning_database_operations -#: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view -msgid "Purchases:" -msgstr "Compras:" +#: model:ir.model.fields.selection,name:cleaning_database_operations.selection__cleaning_database_warning_wizard__object_to_delete__sale +msgid "Sale" +msgstr "Venta" #. module: cleaning_database_operations #: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view -msgid "Reset sequences" -msgstr "Reiniciar secuencias" +msgid "Sales: Sale Order Line, Sale Order." +msgstr "Ventas: Pedido de venta, línea de venta." #. module: cleaning_database_operations -#: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view -msgid "Sale Order Line, Sale Order." -msgstr "Líneas de pedido de venta, pedidos de venta." +#: model:ir.model.fields.selection,name:cleaning_database_operations.selection__cleaning_database_warning_wizard__object_to_delete__sequences +msgid "Sequences" +msgstr "Secuencias" #. module: cleaning_database_operations #: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view -msgid "Sales:" -msgstr "Ventas:" +msgid "Squence: Reset sequences." +msgstr "Secuencia: Reiniciar secuencias" #. module: cleaning_database_operations -#: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view -msgid "Squence" -msgstr "Secuencia" +#: model:ir.model.fields,field_description:cleaning_database_operations.field_cleaning_database_warning_wizard__object_to_delete +msgid "Status" +msgstr "Estado" #. module: cleaning_database_operations -#: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view -msgid "" -"Stock Move Line, Stock Move, Stock Picking, Stock Quant, Stock Valuation " -"Layer, Stock Inventory, Stock Production Lot." +#: model:ir.model.fields.selection,name:cleaning_database_operations.selection__cleaning_database_warning_wizard__object_to_delete__stock +msgid "Stock" msgstr "" -"Movimientos de Producto (Stock Move Line), Movimiento de existencias, Albaranes, Quants\n" -", Capa de valoración de stock, Inventario, Lote/Número de serie." + +#. module: cleaning_database_operations +#: model:ir.model.fields,field_description:cleaning_database_operations.field_cleaning_database_warning_wizard__text +msgid "Text" +msgstr "Texto" #. module: cleaning_database_operations #: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view msgid "This will delete the following objects" -msgstr "Esto borrará los siguientes objetos" +msgstr "Esto eliminará los siguientes objetos" #. module: cleaning_database_operations -#: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_form_view -msgid "Transport Carrier Lines To Invoice" -msgstr "Líneas de transporte a facturar." +#: model:ir.model.fields.selection,name:cleaning_database_operations.selection__cleaning_database_warning_wizard__object_to_delete__valuation +msgid "Valuation Layer" +msgstr "Valoración de inventario" + +#. module: cleaning_database_operations +#: model:ir.model,name:cleaning_database_operations.model_cleaning_database_warning_wizard +msgid "Wizard for warning when cleaning database operations" +msgstr "Asistente para alertar al limpiar las operaciones de la base de datos" + +#. module: cleaning_database_operations +#: model_terms:ir.ui.view,arch_db:cleaning_database_operations.cleaning_database_warning_wizard_view_form +msgid "or" +msgstr "o" diff --git a/cleaning_database_operations/models/cleaning_database.py b/cleaning_database_operations/models/cleaning_database.py index 089a6e38b1..7154f1eab7 100644 --- a/cleaning_database_operations/models/cleaning_database.py +++ b/cleaning_database_operations/models/cleaning_database.py @@ -1,4 +1,4 @@ -# Copyright 2023 Berezi Amubieta - AvanzOSC +# Copyright 2024 Berezi Amubieta - AvanzOSC # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). from odoo import _, api, fields, models @@ -17,6 +17,24 @@ class CleaningDatabase(models.Model): required=True, ) + def action_open_delete_warning(self): + wiz_obj = self.env["cleaning.database.warning.wizard"] + vals = {"active_id": self.id} + if "default_object_to_delete" in self.env.context: + vals.update({"object_to_delete": self.env.context["default_object_to_delete"]}) + wiz = wiz_obj.with_context(vals).create({}) + context = self.env.context.copy() + return { + "name": _("Cleaning Database Warning"), + "type": "ir.actions.act_window", + "res_model": "cleaning.database.warning.wizard", + "view_type": "form", + "view_mode": "form", + "res_id": wiz.id, + "target": "new", + "context": context, + } + def action_delete_stock_operations(self): self.env.cr.execute( "DELETE FROM stock_move_line WHERE company_id in %s", @@ -33,19 +51,15 @@ def action_delete_stock_operations(self): self.env.cr.execute( "DELETE FROM stock_quant " "WHERE company_id in %s OR lot_id in (select l.id " - " from stock_production_lot as l" + " from stock_lot as l" " where l.id = stock_quant.lot_id " " and l.company_id in %s)", [tuple(self.company_ids.ids), tuple(self.company_ids.ids)], ) - self.env.cr.execute( - "DELETE FROM stock_inventory WHERE company_id in %s", - [tuple(self.company_ids.ids)], - ) def action_delete_stock_production_lot(self): self.env.cr.execute( - "DELETE FROM stock_production_lot WHERE company_id in %s", + "DELETE FROM stock_lot WHERE company_id in %s", [tuple(self.company_ids.ids)], ) @@ -75,23 +89,11 @@ def action_delete_purchase_operations(self): [tuple(self.company_ids.ids)], ) - def action_delete_analytic_operations(self): - self.env.cr.execute( - "DELETE FROM account_analytic_line WHERE company_id in %s", - [tuple(self.company_ids.ids)], - ) + def action_delete_accounting_operations(self): self.env.cr.execute( "DELETE FROM account_partial_reconcile WHERE company_id in %s", [tuple(self.company_ids.ids)], ) - self.env.cr.execute( - "DELETE FROM account_payment_order WHERE company_id in %s", - [tuple(self.company_ids.ids)], - ) - self.env.cr.execute( - "DELETE FROM account_payment_line WHERE company_id in %s", - [tuple(self.company_ids.ids)], - ) self.env.cr.execute( "DELETE FROM account_move_line WHERE company_id in %s", [tuple(self.company_ids.ids)], @@ -105,37 +107,13 @@ def action_delete_analytic_operations(self): [tuple(self.company_ids.ids)], ) self.env.cr.execute( - "DELETE FROM account_asset_line WHERE company_id in %s", - [tuple(self.company_ids.ids)], - ) + "DELETE FROM account_payment_order WHERE company_id in %s", + [tuple(self.company_ids.ids)], + ) self.env.cr.execute( - "DELETE FROM account_asset WHERE company_id in %s", - [tuple(self.company_ids.ids)], - ) - self.env.cr.execute( - "DELETE FROM account_check_deposit WHERE company_id in %s", - [tuple(self.company_ids.ids)], - ) - - def action_delete_transport_operations(self): - self.env.cr.execute( - "DELETE FROM transport_carrier_lines_to_invoice WHERE company_id " "in %s", - [tuple(self.company_ids.ids)], - ) - - def action_delete_mrp_operations(self): - self.env.cr.execute( - "DELETE FROM mrp_workorder " - "WHERE production_id in (select p.id " - " from mrp_production as p " - " where p.id = mrp_workorder.production_id " - " and p.company_id in %s)", - [tuple(self.company_ids.ids)], - ) - self.env.cr.execute( - "DELETE FROM mrp_production WHERE company_id in %s", - [tuple(self.company_ids.ids)], - ) + "DELETE FROM account_payment_line WHERE company_id in %s", + [tuple(self.company_ids.ids)], + ) def action_delete_sequance_operations(self): sequences = self.env["ir.sequence"].search( @@ -149,6 +127,6 @@ def action_delete_sequance_operations(self): @api.model def create(self, values): - name = _("Creation date: {}".format(fields.Datetime.now())) + name = _('Creation date: {}').format(fields.Datetime.now()) values["name"] = name return super().create(values) diff --git a/cleaning_database_operations/security/ir.model.access.csv b/cleaning_database_operations/security/ir.model.access.csv index b36b55c322..01154b0cae 100644 --- a/cleaning_database_operations/security/ir.model.access.csv +++ b/cleaning_database_operations/security/ir.model.access.csv @@ -1,3 +1,5 @@ id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink "access_cleaning_database_user","cleaning_database user","model_cleaning_database","base.group_user",1,0,0,0 "access_cleaning_database_manager","cleaning_database manager","model_cleaning_database","base.group_partner_manager",1,1,1,1 +"access_cleaning_database_warning_wizard_user","cleaning_database_warning_wizard user","model_cleaning_database_warning_wizard","mrp.group_mrp_user",1,1,1,1 +"access_cleaning_database_warning_wizard_manager","cleaning_database_warning_wizard manager","model_cleaning_database_warning_wizard","mrp.group_mrp_manager",1,1,1,1 diff --git a/cleaning_database_operations/views/cleaning_database_view.xml b/cleaning_database_operations/views/cleaning_database_view.xml index 727c4047b4..d39c1f39f0 100644 --- a/cleaning_database_operations/views/cleaning_database_view.xml +++ b/cleaning_database_operations/views/cleaning_database_view.xml @@ -6,122 +6,89 @@ cleaning.database
-
-
-
-

- -

+
+

This will delete the following objects

+

Sales: Sale Order Line, Sale Order.

+

+

- - -
-

This will delete the following objects

-

Sales:

-

Sale Order Line, Sale Order.

-

-

-
- - - - - - - - -
+ + + + + + diff --git a/cleaning_database_operations/wizards/__init__.py b/cleaning_database_operations/wizards/__init__.py new file mode 100644 index 0000000000..2929000501 --- /dev/null +++ b/cleaning_database_operations/wizards/__init__.py @@ -0,0 +1 @@ +from . import cleaning_database_warning_wizard diff --git a/cleaning_database_operations/wizards/cleaning_database_warning_wizard.py b/cleaning_database_operations/wizards/cleaning_database_warning_wizard.py new file mode 100644 index 0000000000..ed864c58ce --- /dev/null +++ b/cleaning_database_operations/wizards/cleaning_database_warning_wizard.py @@ -0,0 +1,56 @@ +# Copyright 2023 Berezi Amubieta - AvanzOSC +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). +from odoo import _, api, fields, models + + +class CleaningDatabaseWarningWizard(models.TransientModel): + _name = "cleaning.database.warning.wizard" + _description = "Wizard for warning when cleaning database operations" + + text = fields.Text( + string="Text", + ) + object_to_delete = fields.Selection( + selection=[ + ("stock", "Stock"), + ("lot", "Lot"), + ("valuation", "Valuation Layer"), + ("sale", "Sale"), + ("purchase", "Purchase"), + ("accounting", "Accounting"), + ("sequences", "Sequences"), + ], + string="Status", + required=True, + ) + + @api.model + def default_get(self, fields_list): + res = super(CleaningDatabaseWarningWizard, self).default_get(fields_list) + if "object_to_delete" in self.env.context: + res.update({ + "object_to_delete": self.env.context["object_to_delete"], + "text": _("Are you sure you want to delete the entire " + "operation? This action will be irreversible") + }) + return res + + def continue_with_cleaning_database(self): + self.ensure_one() + cleaning_database = self.env["cleaning.database"].browse( + self.env.context.get("active_id") + ) + if self.object_to_delete == "sale": + return cleaning_database.action_delete_sale_operations() + elif self.object_to_delete == "purchase": + return cleaning_database.action_delete_purchase_operations() + elif self.object_to_delete == "stock": + return cleaning_database.action_delete_stock_operations() + elif self.object_to_delete == "lot": + return cleaning_database.action_delete_stock_production_lot() + elif self.object_to_delete == "valuation": + return cleaning_database.action_delete_stock_valuation_operations() + elif self.object_to_delete == "accounting": + return cleaning_database.action_delete_accounting_operations() + elif self.object_to_delete == "sequences": + return cleaning_database.action_delete_sequance_operations() diff --git a/cleaning_database_operations/wizards/cleaning_database_warning_wizard_view.xml b/cleaning_database_operations/wizards/cleaning_database_warning_wizard_view.xml new file mode 100644 index 0000000000..2f609325d2 --- /dev/null +++ b/cleaning_database_operations/wizards/cleaning_database_warning_wizard_view.xml @@ -0,0 +1,27 @@ + + + + cleaning.database.warning.wizard.form + cleaning.database.warning.wizard + +
+ + + + + + + +
+
+
+
diff --git a/setup/cleaning_database_operations/odoo/addons/cleaning_database_operations b/setup/cleaning_database_operations/odoo/addons/cleaning_database_operations new file mode 120000 index 0000000000..5788e83095 --- /dev/null +++ b/setup/cleaning_database_operations/odoo/addons/cleaning_database_operations @@ -0,0 +1 @@ +../../../../cleaning_database_operations \ No newline at end of file diff --git a/setup/cleaning_database_operations/setup.py b/setup/cleaning_database_operations/setup.py new file mode 100644 index 0000000000..28c57bb640 --- /dev/null +++ b/setup/cleaning_database_operations/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)