Browse Source
Merge pull request #293 from ursais/11.0-fix-issue-290
[FIX] agreement: Issue #290
pull/317/head
Maxime Chambreuil
6 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with
65 additions and
40 deletions
-
agreement/models/agreement.py
-
agreement/models/agreement_appendix.py
-
agreement/models/agreement_clause.py
-
agreement/models/agreement_recital.py
-
agreement/models/agreement_section.py
|
|
@ -334,15 +334,20 @@ class Agreement(models.Model): |
|
|
|
for record in self: |
|
|
|
record.total_company_mrc = amount_total |
|
|
|
|
|
|
|
@api.onchange('field_id') |
|
|
|
def onchange_sub_object_id(self): |
|
|
|
if self.field_id: |
|
|
|
@api.onchange('field_id', 'sub_model_object_field_id', 'default_value') |
|
|
|
def onchange_copyvalue(self): |
|
|
|
self.sub_object_id = False |
|
|
|
self.copyvalue = False |
|
|
|
self.sub_object_id = False |
|
|
|
if self.field_id and not self.field_id.relation: |
|
|
|
self.copyvalue = "${object.%s or %s}" % \ |
|
|
|
(self.field_id.name, |
|
|
|
self.default_value or '\'\'') |
|
|
|
self.sub_model_object_field_id = False |
|
|
|
if self.field_id and self.field_id.relation: |
|
|
|
self.sub_object_id = self.env['ir.model'].search( |
|
|
|
[('model', '=', self.field_id.relation)])[0] |
|
|
|
|
|
|
|
@api.onchange('sub_model_object_field_id', 'default_value') |
|
|
|
def onchange_copyvalue(self): |
|
|
|
if self.sub_model_object_field_id or self.default_value: |
|
|
|
if self.sub_model_object_field_id: |
|
|
|
self.copyvalue = "${object.%s.%s or %s}" %\ |
|
|
|
(self.field_id.name, |
|
|
|
self.sub_model_object_field_id.name, |
|
|
|
|
|
@ -49,15 +49,20 @@ class AgreementAppendix(models.Model): |
|
|
|
help="""Final placeholder expression, to be copy-pasted in the desired |
|
|
|
template field.""") |
|
|
|
|
|
|
|
@api.onchange('field_id') |
|
|
|
def onchange_sub_object_id(self): |
|
|
|
if self.field_id: |
|
|
|
@api.onchange('field_id', 'sub_model_object_field_id', 'default_value') |
|
|
|
def onchange_copyvalue(self): |
|
|
|
self.sub_object_id = False |
|
|
|
self.copyvalue = False |
|
|
|
self.sub_object_id = False |
|
|
|
if self.field_id and not self.field_id.relation: |
|
|
|
self.copyvalue = "${object.%s or %s}" % \ |
|
|
|
(self.field_id.name, |
|
|
|
self.default_value or '\'\'') |
|
|
|
self.sub_model_object_field_id = False |
|
|
|
if self.field_id and self.field_id.relation: |
|
|
|
self.sub_object_id = self.env['ir.model'].search( |
|
|
|
[('model', '=', self.field_id.relation)])[0] |
|
|
|
|
|
|
|
@api.onchange('sub_model_object_field_id', 'default_value') |
|
|
|
def onchange_copyvalue(self): |
|
|
|
if self.sub_model_object_field_id or self.default_value: |
|
|
|
if self.sub_model_object_field_id: |
|
|
|
self.copyvalue = "${object.%s.%s or %s}" %\ |
|
|
|
(self.field_id.name, |
|
|
|
self.sub_model_object_field_id.name, |
|
|
|
|
|
@ -58,15 +58,20 @@ class AgreementClause(models.Model): |
|
|
|
help="""Final placeholder expression, to be copy-pasted in the desired |
|
|
|
template field.""") |
|
|
|
|
|
|
|
@api.onchange('field_id') |
|
|
|
def onchange_sub_object_id(self): |
|
|
|
if self.field_id: |
|
|
|
@api.onchange('field_id', 'sub_model_object_field_id', 'default_value') |
|
|
|
def onchange_copyvalue(self): |
|
|
|
self.sub_object_id = False |
|
|
|
self.copyvalue = False |
|
|
|
self.sub_object_id = False |
|
|
|
if self.field_id and not self.field_id.relation: |
|
|
|
self.copyvalue = "${object.%s or %s}" % \ |
|
|
|
(self.field_id.name, |
|
|
|
self.default_value or '\'\'') |
|
|
|
self.sub_model_object_field_id = False |
|
|
|
if self.field_id and self.field_id.relation: |
|
|
|
self.sub_object_id = self.env['ir.model'].search( |
|
|
|
[('model', '=', self.field_id.relation)])[0] |
|
|
|
|
|
|
|
@api.onchange('sub_model_object_field_id', 'default_value') |
|
|
|
def onchange_copyvalue(self): |
|
|
|
if self.sub_model_object_field_id or self.default_value: |
|
|
|
if self.sub_model_object_field_id: |
|
|
|
self.copyvalue = "${object.%s.%s or %s}" %\ |
|
|
|
(self.field_id.name, |
|
|
|
self.sub_model_object_field_id.name, |
|
|
|
|
|
@ -50,15 +50,20 @@ class AgreementRecital(models.Model): |
|
|
|
help="""Final placeholder expression, to be copy-pasted in the desired |
|
|
|
template field.""") |
|
|
|
|
|
|
|
@api.onchange('field_id') |
|
|
|
def onchange_sub_object_id(self): |
|
|
|
if self.field_id: |
|
|
|
@api.onchange('field_id', 'sub_model_object_field_id', 'default_value') |
|
|
|
def onchange_copyvalue(self): |
|
|
|
self.sub_object_id = False |
|
|
|
self.copyvalue = False |
|
|
|
self.sub_object_id = False |
|
|
|
if self.field_id and not self.field_id.relation: |
|
|
|
self.copyvalue = "${object.%s or %s}" % \ |
|
|
|
(self.field_id.name, |
|
|
|
self.default_value or '\'\'') |
|
|
|
self.sub_model_object_field_id = False |
|
|
|
if self.field_id and self.field_id.relation: |
|
|
|
self.sub_object_id = self.env['ir.model'].search( |
|
|
|
[('model', '=', self.field_id.relation)])[0] |
|
|
|
|
|
|
|
@api.onchange('sub_model_object_field_id', 'default_value') |
|
|
|
def onchange_copyvalue(self): |
|
|
|
if self.sub_model_object_field_id or self.default_value: |
|
|
|
if self.sub_model_object_field_id: |
|
|
|
self.copyvalue = "${object.%s.%s or %s}" %\ |
|
|
|
(self.field_id.name, |
|
|
|
self.sub_model_object_field_id.name, |
|
|
|
|
|
@ -49,15 +49,20 @@ class AgreementSection(models.Model): |
|
|
|
help="""Final placeholder expression, to be copy-pasted in the desired |
|
|
|
template field.""") |
|
|
|
|
|
|
|
@api.onchange('field_id') |
|
|
|
def onchange_sub_object_id(self): |
|
|
|
if self.field_id: |
|
|
|
@api.onchange('field_id', 'sub_model_object_field_id', 'default_value') |
|
|
|
def onchange_copyvalue(self): |
|
|
|
self.sub_object_id = False |
|
|
|
self.copyvalue = False |
|
|
|
self.sub_object_id = False |
|
|
|
if self.field_id and not self.field_id.relation: |
|
|
|
self.copyvalue = "${object.%s or %s}" % \ |
|
|
|
(self.field_id.name, |
|
|
|
self.default_value or '\'\'') |
|
|
|
self.sub_model_object_field_id = False |
|
|
|
if self.field_id and self.field_id.relation: |
|
|
|
self.sub_object_id = self.env['ir.model'].search( |
|
|
|
[('model', '=', self.field_id.relation)])[0] |
|
|
|
|
|
|
|
@api.onchange('sub_model_object_field_id', 'default_value') |
|
|
|
def onchange_copyvalue(self): |
|
|
|
if self.sub_model_object_field_id or self.default_value: |
|
|
|
if self.sub_model_object_field_id: |
|
|
|
self.copyvalue = "${object.%s.%s or %s}" %\ |
|
|
|
(self.field_id.name, |
|
|
|
self.sub_model_object_field_id.name, |
|
|
|