Browse Source

[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.'
pull/640/head
Ronald Portier 6 years ago
parent
commit
17254d0b75
  1. 13
      partner_multi_relation/models/res_partner_relation_all.py

13
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() base_resource = rec.get_base_resource()
rec.unlink_resource(base_resource) rec.unlink_resource(base_resource)
return True 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
Loading…
Cancel
Save