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>
21 lines
789 B
Python
21 lines
789 B
Python
from odoo import fields, models, api, _
|
|
from odoo.exceptions import UserError
|
|
|
|
|
|
class SpreadsheetDashboardGroup(models.Model):
|
|
_name = 'spreadsheet.dashboard.group'
|
|
_description = 'Group of dashboards'
|
|
_order = 'sequence'
|
|
|
|
name = fields.Char(required=True, translate=True)
|
|
dashboard_ids = fields.One2many('spreadsheet.dashboard', 'dashboard_group_id')
|
|
sequence = fields.Integer()
|
|
|
|
@api.ondelete(at_uninstall=False)
|
|
def _unlink_except_spreadsheet_data(self):
|
|
external_ids = self.get_external_id()
|
|
for group in self:
|
|
external_id = external_ids[group.id]
|
|
if external_id and not external_id.startswith('__export__'):
|
|
raise UserError(_("You cannot delete %s as it is used in another module.", group.name))
|