From 17254d0b75d1fb0c7a7de348f1aefd7bb50d4d8b Mon Sep 17 00:00:00 2001 From: Ronald Portier Date: Wed, 10 Oct 2018 11:52:11 +0200 Subject: [PATCH] [FIX] partner_multi_relation. Fix crash when exporting all fields. Exporting all fields crashed with message: 'Exception: You can not export the column ID of model res.partner.relation.type.selection, because the table res_partner_relation_type_selection is not an ordinary table.' --- .../models/res_partner_relation_all.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/partner_multi_relation/models/res_partner_relation_all.py b/partner_multi_relation/models/res_partner_relation_all.py index d989e2fe8..f44e4cfb9 100644 --- a/partner_multi_relation/models/res_partner_relation_all.py +++ b/partner_multi_relation/models/res_partner_relation_all.py @@ -455,3 +455,16 @@ CREATE OR REPLACE VIEW %%(table)s AS base_resource = rec.get_base_resource() rec.unlink_resource(base_resource) return True + + @api.model + def fields_get(self, allfields=None, attributes=None): + """Set type_selection_id field to not exportable. + + Trying to export type_selection_id would result in a crash + as it does not refer to a real table. + """ + result = super(ResPartnerRelationAll, self).fields_get( + allfields=allfields, attributes=attributes) + if 'type_selection_id' in result: + result['type_selection_id']['exportable'] = False + return result