跳至内容
菜单
此问题已终结

I have a serie of online courses that I want to sell by subcription, but I don't want them to be avaible immediatly, I want to unlock only one course access by month of subscription. Any idea on how to do it?

Here's Deepseek idea.

________________

Here’s how to implement gradual course access in Odoo 18, where subscribers unlock one new course per month of active subscription:

Method 1: Using Prerequisites + Subscription Duration Tracking

Step 1: Create Custom Fields

  1. Add a custom field to track subscription duration:
    • Field Name: subscription_months_paid (in res.partner or sale.subscription model).
    • Purpose: Counts how many months the client has paid.

Step 2: Automate Monthly Updates

  • Use a scheduled action to increment subscription_months_paid monthly for active subscriptions:
    python
    Copy
    # Scheduled Action Code Example
    for subscription in env['sale.subscription'].search([('state', '=', 'active')]):
        subscription.partner_id.subscription_months_paid += 1

Step 3: Set Course Prerequisites

  1. Course 1: No prerequisites (accessible immediately).
  2. Course 2: Add prerequisite:
    • Custom field subscription_months_paid >= 1.
  3. Course 3: Add prerequisite:
    • Custom field subscription_months_paid >= 2.

Step 4: Restrict Access

  • Use record rules to enforce access:
    xml
    Copy
    <record id="course_2_access_rule" model="ir.rule">
        <field name="domain_force">
            [('partner_id.subscription_months_paid', '>=', 1)]
        </field>
    </record>
    Run HTML

Method 2: Time-Based Unlocking (No Coding)

Step 1: Leverage Course Publication Dates

  1. Course 1: Publish immediately.
  2. Course 2: Set publication date to 30 days after subscription start.
    • Use a computed field or manual date entry.
  3. Course 3: Set publication date to 60 days after start.

Step 2: Automate with Expiration Dates

  • Use automated actions to publish courses based on subscription start date:
    python
    Copy
    # Example: Publish Course 2 after 30 days
    if (date.today() - subscription.start_date).days >= 30:
        course_2.is_published = True

Method 3: Membership Tiers (Alternative)

  1. Create 3 membership levels (e.g., Bronze/Silver/Gold).
  2. Assign courses to each tier:
    • Bronze (Month 1): Course 1.
    • Silver (Month 2): Course 1 + 2.
    • Gold (Month 3+): All courses.
  3. Use automated actions to upgrade memberships monthly.

Key Tools Needed

  • Odoo Studio (Custom Edition): To add custom fields/rules without coding.
  • Automated Actions: For time-based unlocks (base_automation module).
  • Developer Help: For complex logic (e.g., prorated access).

Testing & Validation

  1. Test Subscription Flow:
    • Simulate a subscription and verify courses unlock monthly.
  2. Monitor Access:
    • Check subscription_months_paid updates correctly.

Why This Works

  • Scalable: Add more courses by extending the month counter.
  • Flexible: Combine with payment failures (e.g., revoke access if unpaid).
  • Low-Code: Uses native Odoo features where possible.

For a no-code solution, Method 2 (Publication Dates) is simplest. For precision, Method 1 (Custom Fields) is ideal.

形象
丢弃
相关帖文 回复 查看 活动
0
3月 25
652
1
7月 25
1623
1
3月 25
679
1
6月 25
404
0
3月 25
618