[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:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user