|
@ -170,6 +170,46 @@ class Agreement(models.Model): |
|
|
company_contact_email = fields.Char( |
|
|
company_contact_email = fields.Char( |
|
|
related="company_contact_id.email", string="Email" |
|
|
related="company_contact_id.email", string="Email" |
|
|
) |
|
|
) |
|
|
|
|
|
use_parties_content = fields.Boolean( |
|
|
|
|
|
string="Use parties content", |
|
|
|
|
|
help="Use custom content for parties") |
|
|
|
|
|
|
|
|
|
|
|
def _get_default_parties(self): |
|
|
|
|
|
deftext = """ |
|
|
|
|
|
<h3>Company Information</h3> |
|
|
|
|
|
<p> |
|
|
|
|
|
${object.company_partner_id.name or ''}.<br> |
|
|
|
|
|
${object.company_partner_id.street or ''} <br> |
|
|
|
|
|
${object.company_partner_id.state_id.code or ''} |
|
|
|
|
|
${object.company_partner_id.zip or ''} |
|
|
|
|
|
${object.company_partner_id.city or ''}<br> |
|
|
|
|
|
${object.company_partner_id.country_id.name or ''}.<br><br> |
|
|
|
|
|
Represented by <b>${object.company_contact_id.name or ''}.</b> |
|
|
|
|
|
</p> |
|
|
|
|
|
<p></p> |
|
|
|
|
|
<h3>Partner Information</h3> |
|
|
|
|
|
<p> |
|
|
|
|
|
${object.partner_id.name or ''}.<br> |
|
|
|
|
|
${object.partner_id.street or ''} <br> |
|
|
|
|
|
${object.partner_id.state_id.code or ''} |
|
|
|
|
|
${object.partner_id.zip or ''} ${object.partner_id.city or ''}<br> |
|
|
|
|
|
${object.partner_id.country_id.name or ''}.<br><br> |
|
|
|
|
|
Represented by <b>${object.partner_contact_id.name or ''}.</b> |
|
|
|
|
|
</p> |
|
|
|
|
|
""" |
|
|
|
|
|
return deftext |
|
|
|
|
|
|
|
|
|
|
|
parties = fields.Html( |
|
|
|
|
|
string="Parties", |
|
|
|
|
|
track_visibility="onchange", |
|
|
|
|
|
default=_get_default_parties, |
|
|
|
|
|
help="Parties of the agreement", |
|
|
|
|
|
) |
|
|
|
|
|
dynamic_parties = fields.Html( |
|
|
|
|
|
compute="_compute_dynamic_parties", |
|
|
|
|
|
string="Dynamic Parties", |
|
|
|
|
|
help="Compute dynamic parties", |
|
|
|
|
|
) |
|
|
agreement_type_id = fields.Many2one( |
|
|
agreement_type_id = fields.Many2one( |
|
|
"agreement.type", |
|
|
"agreement.type", |
|
|
string="Agreement Type", |
|
|
string="Agreement Type", |
|
@ -308,6 +348,18 @@ class Agreement(models.Model): |
|
|
) |
|
|
) |
|
|
agreement.dynamic_description = description |
|
|
agreement.dynamic_description = description |
|
|
|
|
|
|
|
|
|
|
|
@api.multi |
|
|
|
|
|
def _compute_dynamic_parties(self): |
|
|
|
|
|
MailTemplates = self.env["mail.template"] |
|
|
|
|
|
for agreement in self: |
|
|
|
|
|
lang = agreement.partner_id.lang or "en_US" |
|
|
|
|
|
parties = MailTemplates.with_context( |
|
|
|
|
|
lang=lang |
|
|
|
|
|
)._render_template( |
|
|
|
|
|
agreement.parties, "agreement", agreement.id |
|
|
|
|
|
) |
|
|
|
|
|
agreement.dynamic_parties = parties |
|
|
|
|
|
|
|
|
@api.multi |
|
|
@api.multi |
|
|
def _compute_dynamic_special_terms(self): |
|
|
def _compute_dynamic_special_terms(self): |
|
|
MailTemplates = self.env["mail.template"] |
|
|
MailTemplates = self.env["mail.template"] |
|
|