Skip to Content
Menu
This question has been flagged

I'd like my clients to buy a subscription that allow them to access a certain number of times to my weekly event, eg. they can access the weekly event only 2 times per month.

Any ideas on how to implement that?

For reference, here's what Deepseek imagine:

_____________________

Yes! You can configure your Odoo subscription product to issue a fixed number of time-limited coupons that expire with the subscription and cannot be rolled over. Here’s how to set it up:

Step 1: Create a Subscription Product

  1. Go to Sales > Products and create a new product.
  2. Enable Subscription:
    • Set the billing cycle (e.g., monthly).
    • Under Subscription Plan, define the duration (e.g., 30 days).

Step 2: Configure Coupons with Subscription-Based Expiry

Option A: Automated Coupons via Loyalty Program

  1. Create a Loyalty Program:
    • Navigate to Sales > Loyalty > Programs.
    • Select "Coupons" as the program type.
    • Set "Generate coupons automatically" for subscriptions.
  2. Link Coupons to Subscription:
    • Use a custom field on coupon.coupon to track the linked subscription:
      python
      Copy
      subscription_id = fields.Many2one('sale.subscription', string="Linked Subscription")
    • Set coupon expiry date = subscription end date:
      python
      Copy
      # Scheduled action (runs daily)
      for sub in env['sale.subscription'].search([('state', '=', 'active')]):
          coupons = env['coupon.coupon'].search([('subscription_id', '=', sub.id)])
          coupons.write({'expiry_date': sub.end_date})  # Coupons expire with subscription

Option B: Generate Coupons on Subscription Renewal

  1. Create a Coupon Template:
    • Go to Sales > Coupons and define:
      • Validity: Dynamic (set expiry = subscription end date).
      • Usage Limit: 1 per coupon (to prevent reuse).
  2. Automate Coupon Creation:
    • Trigger coupon generation when subscriptions renew:
      python
      Copy
      def generate_subscription_coupons(self):
          for sub in self:
              for _ in range(sub.coupon_quantity):  # E.g., 3 coupons/month
                  env['coupon.coupon'].create({
                      'program_id': sub.coupon_program_id.id,
                      'expiry_date': sub.end_date,
                      'subscription_id': sub.id
                  })

Step 3: Enforce "Use-It-or-Lose-It" Rules

  1. Prevent Rollover:
    • Add a constraint to delete unused coupons at subscription renewal:
      python
      Copy
      # Scheduled action (runs on subscription renewal)
      expired_subs = env['sale.subscription'].search([('end_date', '<', fields.Date.today())])
      env['coupon.coupon'].search([('subscription_id', 'in', expired_subs.ids)]).unlink()
  2. Restrict Redemption:
    • Use server actions to validate coupon usage:
      python
      Copy
      def validate_coupon(self):
          if self.subscription_id.state != 'active':
              raise UserError("Coupon expired with subscription!")

Step 4: Notify Customers

  • Email Templates:
    • Send coupons automatically via Sales > Configuration > Email Templates.
    • Include warnings like:
      "Your 3 monthly coupons expire on {subscription.end_date}. Unused coupons will not roll over."

Key Features

  • Time-Limited Coupons: Expire with the subscription.
  • No Accumulation: Unused coupons are destroyed on renewal.
  • Flexible Redemption: Coupons can be exchanged for specific products (configure in Coupon Program).

Testing Scenario

  1. A client subscribes for 1 month and receives 3 coupons.
  2. They use 2 coupons; the 3rd expires when the subscription ends.
  3. On renewal, they get 3 new coupons (previous unused coupons are deleted).

Why This Works

  • Tight Coupon-Subscription Binding: Coupons are tied to the subscription’s lifecycle.
  • Automated Cleanup: Cron jobs enforce expiration rules.
  • Transparency: Customers see coupon validity upfront.

For advanced workflows (e.g., prorated coupons), consider custom development. Otherwise, this setup works out-of-the-box with minor configurations.



Avatar
Discard
Best Answer

Implementing a subscription-based model in Odoo to issue a fixed number of time-limited coupons that expire with the subscription period involves several steps. Here's how to set this up:

  1. Understanding Odoo's Default Behavior:
    By default, Odoo's subscription module allows for recurring billing but doesn't natively support issuing a predefined number of event access coupons that expire with each subscription cycle.
  2. Configuring Subscription Products:
    • Create the Subscription Product:
      Navigate to SalesProductsProducts.
      Create a new product, e.g., "Event Access Subscription."
      Set the Product Type to Service.
      Under the Sales tab, enable Subscription Product and define the subscription template (e.g., monthly).
  3. Managing Coupon Distribution:
    To issue a fixed number of coupons per subscription period:
    • Manual Distribution:
      At the start of each subscription cycle, manually generate and send a set number of event access coupons to the subscriber.
    • Automated Distribution:
      Develop a custom automation that triggers upon subscription renewal to generate and email the predefined number of coupons to the subscriber.
  4. Setting Coupon Validity:
    Ensure that each coupon is valid only within the subscription period:
    • When generating coupons, set their expiration date to align with the end of the current subscription cycle.​
    • This ensures unused coupons do not roll over to the next period.​
  5. Utilizing Third-Party Modules:
    To enhance functionality, consider integrating third-party modules:
    • Sale Coupon Limit Module:
      This module allows you to configure limits on the number of times a promotion can be applied per customer, ensuring subscribers cannot exceed their allotted event accesses.
    • Sale Coupon Validity Notification Module:
      This module notifies users when a coupon becomes invalid, aiding in managing coupon expirations effectively.
  6. Custom Development:
    Given the specific nature of this requirement, custom development may be necessary:
    • Automate Coupon Generation and Distribution:
      Develop a scheduled action that automatically generates the specified number of coupons at the beginning of each subscription period and emails them to the subscriber.
    • Track Coupon Usage:
      Implement a system to monitor and restrict the usage of coupons to prevent exceeding the allowed number per period.

At Wan Buffer Services, we specialize in customizing Odoo to fit unique business models. If you require assistance in implementing this subscription-based coupon system.

Avatar
Discard
Author

Thank you for your answer. How much would it cost to for a customized development? I have several functionalities in mind I'd like to have in Odoo (check my other posts).

Related Posts Replies Views Activity
0
Mar 25
851
0
Jul 23
1564
1
May 24
1698
0
Mar 25
714
0
Mar 25
888