From a118dc71410a7c1bac15c1c8cc573391d8021fad Mon Sep 17 00:00:00 2001 From: Maxime Chambreuil Date: Wed, 27 Mar 2019 12:47:02 -0600 Subject: [PATCH] [FIX] agreement: Issue #290 --- agreement/models/agreement_appendix.py | 2 +- agreement/models/agreement_clause.py | 2 +- agreement/models/agreement_recital.py | 2 +- agreement/models/agreement_section.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/agreement/models/agreement_appendix.py b/agreement/models/agreement_appendix.py index 8699d579..03ff8337 100644 --- a/agreement/models/agreement_appendix.py +++ b/agreement/models/agreement_appendix.py @@ -51,7 +51,7 @@ class AgreementAppendix(models.Model): @api.onchange('field_id') def onchange_sub_object_id(self): - if self.field_id: + if self.field_id and self.field_id.relation: self.sub_object_id = self.env['ir.model'].search( [('model', '=', self.field_id.relation)])[0] diff --git a/agreement/models/agreement_clause.py b/agreement/models/agreement_clause.py index 00651f98..fd3e979d 100644 --- a/agreement/models/agreement_clause.py +++ b/agreement/models/agreement_clause.py @@ -60,7 +60,7 @@ class AgreementClause(models.Model): @api.onchange('field_id') def onchange_sub_object_id(self): - if self.field_id: + if self.field_id and self.field_id.relation: self.sub_object_id = self.env['ir.model'].search( [('model', '=', self.field_id.relation)])[0] diff --git a/agreement/models/agreement_recital.py b/agreement/models/agreement_recital.py index c466f45d..ea424310 100644 --- a/agreement/models/agreement_recital.py +++ b/agreement/models/agreement_recital.py @@ -52,7 +52,7 @@ class AgreementRecital(models.Model): @api.onchange('field_id') def onchange_sub_object_id(self): - if self.field_id: + if self.field_id and self.field_id.relation: self.sub_object_id = self.env['ir.model'].search( [('model', '=', self.field_id.relation)])[0] diff --git a/agreement/models/agreement_section.py b/agreement/models/agreement_section.py index 2ee345c6..fe8e46d7 100644 --- a/agreement/models/agreement_section.py +++ b/agreement/models/agreement_section.py @@ -51,7 +51,7 @@ class AgreementSection(models.Model): @api.onchange('field_id') def onchange_sub_object_id(self): - if self.field_id: + if self.field_id and self.field_id.relation: self.sub_object_id = self.env['ir.model'].search( [('model', '=', self.field_id.relation)])[0]