mirror of
https://github.com/bringout/oca-ocb-crm.git
synced 2026-04-22 20:52:08 +02:00
Initial commit: Crm packages
This commit is contained in:
commit
21a345b5b9
654 changed files with 418312 additions and 0 deletions
32
odoo-bringout-oca-ocb-crm/crm/models/ir_config_parameter.py
Normal file
32
odoo-bringout-oca-ocb-crm/crm/models/ir_config_parameter.py
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import api, models
|
||||
from odoo.addons.base.models.ir_model import MODULE_UNINSTALL_FLAG
|
||||
|
||||
|
||||
class IrConfigParameter(models.Model):
|
||||
_inherit = 'ir.config_parameter'
|
||||
|
||||
def write(self, vals):
|
||||
result = super(IrConfigParameter, self).write(vals)
|
||||
if any(record.key == "crm.pls_fields" for record in self):
|
||||
self.env.flush_all()
|
||||
self.env.registry.setup_models(self.env.cr)
|
||||
return result
|
||||
|
||||
@api.model_create_multi
|
||||
def create(self, vals_list):
|
||||
records = super(IrConfigParameter, self).create(vals_list)
|
||||
if any(record.key == "crm.pls_fields" for record in records):
|
||||
self.env.flush_all()
|
||||
self.env.registry.setup_models(self.env.cr)
|
||||
return records
|
||||
|
||||
def unlink(self):
|
||||
pls_emptied = any(record.key == "crm.pls_fields" for record in self)
|
||||
result = super(IrConfigParameter, self).unlink()
|
||||
if pls_emptied and not self._context.get(MODULE_UNINSTALL_FLAG):
|
||||
self.env.flush_all()
|
||||
self.env.registry.setup_models(self.env.cr)
|
||||
return result
|
||||
Loading…
Add table
Add a link
Reference in a new issue