diff --git a/models/partner.py b/models/partner.py index c501bd0..b0f6e70 100644 --- a/models/partner.py +++ b/models/partner.py @@ -53,6 +53,15 @@ class partner(models.Model): partner.relationshipPartner_count = len(partner.relationshipPartner_ids) except Exception: partner.relationshipPartner_count = 0 + + def _compute_recurring_donation_count(self): + # The current user may not have access rights for donations + for partner in self: + try: + partner.recurring_donation_count=self.env['donation.donation'].search_count(['&',('recurring_template','!=',''),('partner_id','=',int(partner.id))]) + + except Exception: + partner.recurring_donation_count = 0 qualifier_ids = fields.One2many( 'opendons_qualifier.partnerqualifier', @@ -119,6 +128,12 @@ class partner(models.Model): string="# of phone", readonly=True ) + recurring_donation_count = fields.Integer( + compute='_compute_recurring_donation_count', + string="# of recurring donation", + readonly=True + ) + key=fields.Integer( compute='_compute_key', string="Key", diff --git a/views/partner.xml b/views/partner.xml index 0c3faab..74e4828 100644 --- a/views/partner.xml +++ b/views/partner.xml @@ -38,6 +38,15 @@ {'search_default_partner_id': active_id} + + Recurring_donation + donation.donation + tree,form,graph + {'default_recurring_template': 'active', 'recurring_view': True,'partner_id': active_id} + [('recurring_template', '!=', False)] + + + opendons.res.partner.form res.partner @@ -86,11 +95,14 @@ + + - - - -