From 3c9c086b9c3a0eff41681e17b47dd951de42cc15 Mon Sep 17 00:00:00 2001 From: eLBati Date: Sat, 4 Jan 2025 08:56:43 +0100 Subject: [PATCH 1/2] FIX subscription_oca in multi company + allow to invoice with recurring_next_date before today --- subscription_oca/models/sale_subscription.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/subscription_oca/models/sale_subscription.py b/subscription_oca/models/sale_subscription.py index 6845706840..8225ab4d39 100644 --- a/subscription_oca/models/sale_subscription.py +++ b/subscription_oca/models/sale_subscription.py @@ -139,10 +139,11 @@ def _read_group_stage_ids(self, stages, domain, order): def cron_subscription_management(self): today = date.today() - for subscription in self.search([]): + for subscription in self.search([], order="recurring_next_date asc"): + subscription = subscription.with_company(subscription.company_id) if subscription.in_progress: if ( - subscription.recurring_next_date == today + subscription.recurring_next_date <= today and subscription.sale_subscription_line_ids ): try: @@ -150,11 +151,11 @@ def cron_subscription_management(self): except Exception: logger.exception("Error on subscription invoice generate") if not subscription.recurring_rule_boundary: - if subscription.date == today: + if subscription.date <= today: subscription.action_close_subscription() else: - if subscription.date_start == today: + if subscription.date_start <= today: subscription.action_start_subscription() subscription.generate_invoice() From ecd0cbca27165a4ecd36f7b1d283b7eccbc959a8 Mon Sep 17 00:00:00 2001 From: eLBati Date: Sat, 4 Jan 2025 08:57:39 +0100 Subject: [PATCH 2/2] IMP subscription_oca search view --- .../views/sale_subscription_views.xml | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/subscription_oca/views/sale_subscription_views.xml b/subscription_oca/views/sale_subscription_views.xml index 9a7dafa0a9..912aab2eb7 100644 --- a/subscription_oca/views/sale_subscription_views.xml +++ b/subscription_oca/views/sale_subscription_views.xml @@ -371,11 +371,50 @@ + + + + + + + + + + + + + + +