Skip to content
Snippets Groups Projects
Commit a8c12e1f authored by Goffin Simon's avatar Goffin Simon
Browse files

[FIX] sale: Updating dashboard_graph_model when uninstalling Sales

Uninstalling Sales with CRM still installed lead to an error
when clicking on CRM app because the dashboard_graph_model was not
updated for each crm.team record.

opw:748099
parent b1f738d1
Branches
Tags
No related merge requests found
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from functools import partial
import openerp
from openerp import api, SUPERUSER_ID
import models
import report
import wizard
def uninstall_hook(cr, registry):
def update_dashboard_graph_model(dbname):
db_registry = openerp.modules.registry.RegistryManager.new(dbname)
with api.Environment.manage(), db_registry.cursor() as cr:
env = api.Environment(cr, SUPERUSER_ID, {})
if 'crm.team' in env:
recs = env['crm.team'].search([])
for rec in recs:
rec._onchange_team_type()
cr.after("commit", partial(update_dashboard_graph_model, cr.dbname))
\ No newline at end of file
......@@ -65,6 +65,7 @@ The Dashboard for the Sales Manager will include
'data/sale_demo.xml',
'data/product_product_demo.xml',
],
'uninstall_hook': "uninstall_hook",
'css': ['static/src/css/sale.css'],
'installable': True,
'auto_install': False,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment