Before this commit:
* Install any module that creates a SQL view and another that extends
this view.
e.g.: sale and pos_sale for `report.all.channels.sales`.
* Uninstall the module that extended the SQL view.
e.g.: uninstall pos_sale.
* Try to access the view from the web client -> Traceback, table not
found.
This happens because when reloading the registry, postgres drops the sql
view and it must be re-initialized.
After this commit:
We solve this issue by calculating all missing tables/views during the
uninstallation process, and re-initializing all of them right before
reloading the registry.
Also remove sql-view hacks in the modules `sale` and `sale_margin`.
Fixes #23528, #23529, #23530
25 lines
774 B
Python
25 lines
774 B
Python
# -*- coding: utf-8 -*-
|
|
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
|
|
|
from . import models
|
|
from . import controllers
|
|
from . import report
|
|
from . import wizard
|
|
|
|
from functools import partial
|
|
import odoo
|
|
from odoo import api, SUPERUSER_ID
|
|
|
|
|
|
def uninstall_hook(cr, registry):
|
|
def update_dashboard_graph_model(dbname):
|
|
db_registry = odoo.modules.registry.Registry.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))
|