If applied, this commit will solve the 'external id not found' issue while the user had deleted the 'Logistics' dashboard and then install or upgrade the spreadsheet modules. Steps to produce: - Open the 'Logistics' dashboard from Spreadsheet > Configuration > Dashboards. - Delete all 'Spreadsheet' from Logistics. - Now delete the 'Logistics' dashboard from the action. - Install or Upgrade modules that are using that dashboard like spreadsheet_dashboard_stock, spreadsheet_dashboard_purchase, etc. sentry - 4083977216 see - https://tinyurl.com/2az3tqtv closes odoo/odoo#120528 X-original-commit: 9b295f5e478fc7b9a888ca07de267f0537fb02ae Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com> Signed-off-by: Parth Solanki (paso) <paso@odoo.com>
34 lines
1.2 KiB
Python
34 lines
1.2 KiB
Python
from odoo.tests.common import TransactionCase
|
|
from odoo.exceptions import UserError
|
|
|
|
|
|
class TestSpreadsheetDashboard(TransactionCase):
|
|
def test_create_with_default_values(self):
|
|
group = self.env["spreadsheet.dashboard.group"].create(
|
|
{"name": "a group"}
|
|
)
|
|
dashboard = self.env["spreadsheet.dashboard"].create(
|
|
{
|
|
"name": "a dashboard",
|
|
"dashboard_group_id": group.id,
|
|
}
|
|
)
|
|
self.assertEqual(dashboard.group_ids, self.env.ref("base.group_user"))
|
|
self.assertEqual(
|
|
dashboard.spreadsheet_data,
|
|
'{"version": 1, "sheets": [{"id": "sheet1", "name": "Sheet1"}]}',
|
|
)
|
|
|
|
def test_unlink_prevent_spreadsheet_group(self):
|
|
group = self.env["spreadsheet.dashboard.group"].create(
|
|
{"name": "a_group"}
|
|
)
|
|
self.env['ir.model.data'].create({
|
|
'name': group.name,
|
|
'module': 'spreadsheet_dashboard',
|
|
'model': group._name,
|
|
'res_id': group.id,
|
|
})
|
|
with self.assertRaises(UserError, msg="You cannot delete a_group as it is used in another module"):
|
|
group.unlink()
|