[MIG] base_force_record_noupdate: Migration to 17.0
parent
251723a4d1
commit
16b011fcb2
|
@ -1,11 +1,8 @@
|
||||||
from . import models
|
from . import models
|
||||||
|
|
||||||
|
|
||||||
def post_init_hook(cr, registry):
|
def post_init_hook(env):
|
||||||
"""Configure a list of models having ``force_noupdate`` set by default"""
|
"""Configure a list of models having ``force_noupdate`` set by default"""
|
||||||
from odoo import SUPERUSER_ID, api
|
|
||||||
|
|
||||||
env = api.Environment(cr, SUPERUSER_ID, {})
|
|
||||||
mods = env["ir.model"].sudo()
|
mods = env["ir.model"].sudo()
|
||||||
for model_name in [
|
for model_name in [
|
||||||
"res.lang",
|
"res.lang",
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
"author": "Camtocamp, Odoo Community Association (OCA)",
|
"author": "Camtocamp, Odoo Community Association (OCA)",
|
||||||
"website": "https://github.com/OCA/server-tools",
|
"website": "https://github.com/OCA/server-tools",
|
||||||
"category": "Hidden",
|
"category": "Hidden",
|
||||||
"version": "16.0.1.0.0",
|
"version": "17.0.1.0.0",
|
||||||
"license": "AGPL-3",
|
"license": "AGPL-3",
|
||||||
"depends": ["base"],
|
"depends": ["base"],
|
||||||
"data": ["views/ir_model.xml"],
|
"data": ["views/ir_model.xml"],
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html)
|
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html)
|
||||||
|
|
||||||
from odoo import api, fields, models
|
from odoo import api, fields, models
|
||||||
from odoo.tools.cache import ormcache
|
from odoo.tools import ormcache
|
||||||
|
|
||||||
|
|
||||||
class Model(models.Model):
|
class IrModel(models.Model):
|
||||||
_inherit = "ir.model"
|
_inherit = "ir.model"
|
||||||
|
|
||||||
force_noupdate = fields.Boolean("Force No-Update")
|
force_noupdate = fields.Boolean("Force No-Update")
|
||||||
|
@ -13,20 +13,20 @@ class Model(models.Model):
|
||||||
@api.model_create_multi
|
@api.model_create_multi
|
||||||
def create(self, vals_list):
|
def create(self, vals_list):
|
||||||
mods = super().create(vals_list)
|
mods = super().create(vals_list)
|
||||||
type(self)._get_noupdate_model_ids.clear_cache(self.browse())
|
self.env.registry.clear_cache()
|
||||||
self._propagate_noupdate_to_model_data()
|
self._propagate_noupdate_to_model_data()
|
||||||
return mods
|
return mods
|
||||||
|
|
||||||
def write(self, vals):
|
def write(self, vals):
|
||||||
res = super().write(vals)
|
res = super().write(vals)
|
||||||
if "force_noupdate" in vals:
|
if "force_noupdate" in vals:
|
||||||
type(self)._get_noupdate_model_ids.clear_cache(self.browse())
|
self.env.registry.clear_cache()
|
||||||
self._propagate_noupdate_to_model_data()
|
self._propagate_noupdate_to_model_data()
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def unlink(self):
|
def unlink(self):
|
||||||
res = super().unlink()
|
res = super().unlink()
|
||||||
type(self)._get_noupdate_model_ids.clear_cache(self.browse())
|
self.env.registry.clear_cache()
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def _get_noupdate_models(self):
|
def _get_noupdate_models(self):
|
||||||
|
|
Loading…
Reference in New Issue