Skip to content

Commit

Permalink
[16.0][IMP] mrp_cleaning_database_operations: Cleaning all the MRP op…
Browse files Browse the repository at this point in the history
…erations: MRP Production and MRP Workorder.
  • Loading branch information
Berezi committed Nov 19, 2024
1 parent cc1bb49 commit 7bb1332
Show file tree
Hide file tree
Showing 10 changed files with 162 additions and 0 deletions.
28 changes: 28 additions & 0 deletions mrp_cleaning_database_operations/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3

================================
MRP Cleaning Database Operations
================================

Cleaning all the MRP operations: MRP Production and MRP Workorder.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues
<https://github.com/avanzosc/mrp-addons/issues>`_. In case of trouble,
please check there if your issue has already been reported. If you spotted
it first, help us smash it by providing detailed and welcomed feedback.

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

Credits
=======

Contributors
------------

* Berezi Amubieta <bereziamubieta@avanzosc.es>
* Ana Juaristi <anajuaristi@avanzosc.es>
1 change: 1 addition & 0 deletions mrp_cleaning_database_operations/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
19 changes: 19 additions & 0 deletions mrp_cleaning_database_operations/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright 2024 Berezi Amubieta - AvanzOSC
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
{
"name": "MRP Cleaning Database Operations",
"version": "16.0.1.0.0",
"category": "Manufacture",
"license": "AGPL-3",
"author": "AvanzOSC",
"website": "https://github.com/avanzosc/mrp-addons",
"depends": [
"cleaning_database_operations",
"mrp",
],
"data": [
"views/cleaning_database_view.xml",
],
"installable": True,
"auto_install": True,
}
31 changes: 31 additions & 0 deletions mrp_cleaning_database_operations/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * mrp_cleaning_database_operations
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-11-19 14:47+0000\n"
"PO-Revision-Date: 2024-11-19 14:47+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: mrp_cleaning_database_operations
#: model:ir.model,name:mrp_cleaning_database_operations.model_cleaning_database
msgid "Cleaning Database Operations"
msgstr "Limpieza de operaciones en base de datos"

#. module: mrp_cleaning_database_operations
#: model_terms:ir.ui.view,arch_db:mrp_cleaning_database_operations.cleaning_database_form_view
msgid "Cleaning MRP Operations"
msgstr "Limpieza de operaciones de fabricación"

#. module: mrp_cleaning_database_operations
#: model_terms:ir.ui.view,arch_db:mrp_cleaning_database_operations.cleaning_database_form_view
msgid "Manufacturing: MRP Workorder, MRP Production."
msgstr "Fabricación: Orden de tranbajo, orden de producción."
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * mrp_cleaning_database_operations
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-11-19 14:47+0000\n"
"PO-Revision-Date: 2024-11-19 14:47+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: mrp_cleaning_database_operations
#: model:ir.model,name:mrp_cleaning_database_operations.model_cleaning_database
msgid "Cleaning Database Operations"
msgstr ""

#. module: mrp_cleaning_database_operations
#: model_terms:ir.ui.view,arch_db:mrp_cleaning_database_operations.cleaning_database_form_view
msgid "Cleaning MRP Operations"
msgstr ""

#. module: mrp_cleaning_database_operations
#: model_terms:ir.ui.view,arch_db:mrp_cleaning_database_operations.cleaning_database_form_view
msgid "Manufacturing: MRP Workorder, MRP Production."
msgstr ""
1 change: 1 addition & 0 deletions mrp_cleaning_database_operations/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import cleaning_database
21 changes: 21 additions & 0 deletions mrp_cleaning_database_operations/models/cleaning_database.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2024 Berezi Amubieta - AvanzOSC
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import models


class CleaningDatabase(models.Model):
_inherit = "cleaning.database"

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)],
)
23 changes: 23 additions & 0 deletions mrp_cleaning_database_operations/views/cleaning_database_view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="cleaning_database_form_view" model="ir.ui.view">
<field name="model">cleaning.database</field>
<field
name="inherit_id"
ref="cleaning_database_operations.cleaning_database_form_view"
/>
<field name="arch" type="xml">
<button name="action_delete_accounting_operations" position="after">
<p>Manufacturing: MRP Workorder, MRP Production.</p>
<p>
<button
name="action_delete_mrp_operations"
type="object"
string="Cleaning MRP Operations"
class="oe_highlight"
/>
</p>
</button>
</field>
</record>
</odoo>
6 changes: 6 additions & 0 deletions setup/mrp_cleaning_database_operations/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)

0 comments on commit 7bb1332

Please sign in to comment.