Skip to content

Commit

Permalink
Simple implementation of subscription trial period
Browse files Browse the repository at this point in the history
  • Loading branch information
tarteo committed Mar 27, 2024
1 parent 5526da3 commit 0276ea1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions argocd_sale/models/subscription.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ def _invoice_paid_hook(self):
free_period = subscription._get_free_period()
if free_period:
subscription.recurring_next_date = fields.Datetime.today() + free_period
subscription.action_start_subscription()
lines = subscription.sale_subscription_line_ids.filtered(
lambda l: l.product_id.application_template_id
)
Expand Down
3 changes: 3 additions & 0 deletions argocd_sale/tests/test_grace_period.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ def setUpClass(cls):
cls.env["ir.config_parameter"].set_param(
"argocd_sale.grace_period_tag_id", cls.disable_odoo_tag.id
)
cls.env["ir.config_parameter"].set_param(
"argocd_sale.subscription_free_period_type", "" # Disable free period
)

def _create_and_prepare_sub(self, last_date_invoiced, create_invoice=True):
sub = self.env["sale.subscription"].create(
Expand Down

0 comments on commit 0276ea1

Please sign in to comment.