New version of eradicate_quick_create that use web_m2x_options
This commit is contained in:
@@ -1 +1 @@
|
|||||||
from . import model
|
from .hooks import web_m2x_options_create
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
{
|
{
|
||||||
'name': 'Eradicate Quick Create',
|
'name': 'Eradicate Quick Create',
|
||||||
'version': '12.0.1.0.0',
|
'version': '12.0.2.0.0',
|
||||||
'category': 'Tools',
|
'category': 'Tools',
|
||||||
'license': 'AGPL-3',
|
'license': 'AGPL-3',
|
||||||
'summary': 'Disable quick create on all objects',
|
'summary': 'Disable quick create on all objects',
|
||||||
@@ -13,10 +13,13 @@ Eradicate Quick Create
|
|||||||
|
|
||||||
Disable quick create on all objects of Odoo.
|
Disable quick create on all objects of Odoo.
|
||||||
|
|
||||||
|
This new version of the module uses the module *web_m2x_options* from the OCA *web* project instead of the module *base_optional_quick_create* from the OCA project *server-ux*.
|
||||||
|
|
||||||
This module has been written by Alexis de Lattre from Akretion <alexis.delattre@akretion.com>.
|
This module has been written by Alexis de Lattre from Akretion <alexis.delattre@akretion.com>.
|
||||||
""",
|
""",
|
||||||
'author': 'Akretion',
|
'author': 'Akretion',
|
||||||
'website': 'http://www.akretion.com',
|
'website': 'http://www.akretion.com',
|
||||||
'depends': ['base_optional_quick_create'],
|
'depends': ['web_m2x_options'],
|
||||||
|
'post_init_hook': 'web_m2x_options_create',
|
||||||
'installable': True,
|
'installable': True,
|
||||||
}
|
}
|
||||||
|
|||||||
19
eradicate_quick_create/hooks.py
Normal file
19
eradicate_quick_create/hooks.py
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
# Copyright 2019 Akretion France
|
||||||
|
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
|
from odoo import SUPERUSER_ID
|
||||||
|
from odoo.api import Environment
|
||||||
|
|
||||||
|
|
||||||
|
def web_m2x_options_create(cr, registry):
|
||||||
|
env = Environment(cr, SUPERUSER_ID, {})
|
||||||
|
config_parameter = env['ir.config_parameter'].search(
|
||||||
|
[('key', '=', 'web_m2x_options.create')])
|
||||||
|
if config_parameter and config_parameter.value != 'False':
|
||||||
|
config_parameter.value = 'False'
|
||||||
|
else:
|
||||||
|
env['ir.config_parameter'].create({
|
||||||
|
'key': 'web_m2x_options.create',
|
||||||
|
'value': 'False',
|
||||||
|
})
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
# Copyright 2014-2019 Akretion France (http://www.akretion.com)
|
|
||||||
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
|
||||||
|
|
||||||
from odoo import api, fields, models
|
|
||||||
|
|
||||||
|
|
||||||
class IrModel(models.Model):
|
|
||||||
_inherit = 'ir.model'
|
|
||||||
|
|
||||||
@api.model_cr
|
|
||||||
def init(self):
|
|
||||||
'''Activate 'avoid_quick_create' on all existing models'''
|
|
||||||
self._cr.execute(
|
|
||||||
"UPDATE ir_model SET avoid_quick_create=true "
|
|
||||||
"WHERE avoid_quick_create is not true")
|
|
||||||
return True
|
|
||||||
|
|
||||||
avoid_quick_create = fields.Boolean(default=True)
|
|
||||||
Reference in New Issue
Block a user