[FIX] website_crm_partner_assign: implemented_count

Fix onchange dependencies for implemented_count field of res.partner.
Use that field in the template and use t-esc instead of t-raw.
This commit is contained in:
Denis Vermylen
2017-03-21 16:43:36 +01:00
parent c9edb9dccb
commit b512c65181
2 changed files with 3 additions and 3 deletions
@@ -53,9 +53,9 @@ class ResPartner(models.Model):
implemented_count = fields.Integer(compute='_compute_implemented_partner_count', store=True)
@api.one
@api.depends('implemented_partner_ids')
@api.depends('implemented_partner_ids', 'implemented_partner_ids.website_published', 'implemented_partner_ids.active')
def _compute_implemented_partner_count(self):
self.implemented_count = len(self.implemented_partner_ids.filtered(lambda x: x.website_published))
self.implemented_count = len(self.implemented_partner_ids.filtered('website_published'))
@api.onchange('grade_id')
def _onchange_grade_id(self):
@@ -99,7 +99,7 @@
<div t-field="partner.website_short_description"/>
<t t-if="any([p.website_published for p in partner.implemented_partner_ids])">
<small><a t-attf-href="/partners/#{slug(partner)}#right_column">
<t t-raw="len([p for p in partner.implemented_partner_ids if p.website_published])"/> reference(s)
<t t-esc="partner.implemented_count"/> reference(s)
</a></small>
</t>
</div>