diff --git a/crm_last_dates/models/res_partner.py b/crm_last_dates/models/res_partner.py index cfdb319..4edd18d 100644 --- a/crm_last_dates/models/res_partner.py +++ b/crm_last_dates/models/res_partner.py @@ -17,20 +17,26 @@ class ResPartner(models.Model): store=True, ) - @api.depends("commercial_partner_id", "opportunity_ids") + @api.depends("commercial_partner_id", "opportunity_ids", "child_ids") def _compute_last_lead_date(self): for partner in self: - lead_dates = partner.mapped("opportunity_ids.create_date") + lead_dates = partner.mapped("opportunity_ids.create_date") + partner.mapped( + "child_ids.opportunity_ids.create_date" + ) partner.last_lead_date = max(lead_dates) if lead_dates else False - @api.depends("commercial_partner_id", "meeting_ids") + @api.depends("commercial_partner_id", "meeting_ids", "child_ids") def _compute_last_meeting_date(self): for partner in self: - meeting_dates = partner.mapped("meeting_ids.create_date") + meeting_dates = partner.mapped("meeting_ids.create_date") + partner.mapped( + "child_ids.meeting_ids.create_date" + ) partner.last_meeting_date = max(meeting_dates) if meeting_dates else False - @api.depends("commercial_partner_id", "invoice_ids") + @api.depends("commercial_partner_id", "invoice_ids", "child_ids") def _compute_last_invoice_date(self): for partner in self: - invoice_dates = partner.mapped("invoice_ids.create_date") + invoice_dates = partner.mapped("invoice_ids.create_date") + partner.mapped( + "child_ids.invoice_ids.create_date" + ) partner.last_invoice_date = max(invoice_dates) if invoice_dates else False diff --git a/crm_last_dates/views/res_partner_view.xml b/crm_last_dates/views/res_partner_view.xml index faac8a7..fbc15a8 100644 --- a/crm_last_dates/views/res_partner_view.xml +++ b/crm_last_dates/views/res_partner_view.xml @@ -27,4 +27,39 @@ + + + CRM Last Dates + + code + + + + +