コンテンツへスキップ
メニュー
この質問にフラグが付けられました
1 返信
896 ビュー

Hi Guys,

I am experiencing weird issue with my Subscription & Recurring Invoices app.


So, I have set subscription for date of the next invoice to be on the 15th of each month, and due date - 10 DAYS (So it should be due on 25th of each month). 


Unfortunately, the invoices are being raised on 19th, and due date is always 29th.


Any ideas what could go wrong? Payment Terms are set to 10 days. 

アバター
破棄
最善の回答

Hi,

You can try this code for calculating the days

import datetime

def generate_invoice(subscription_start_date):
    # Calculate the next billing date (15th of the next month)
    next_billing_date = subscription_start_date.replace(day=15)
    if next_billing_date         next_billing_date += datetime.timedelta(days=30)

    # Calculate the due date (10 days after the billing date)
    due_date = next_billing_date + datetime.timedelta(days=10)

    # Generate the invoice
    invoice.write({
        "billing_date": next_billing_date,
        "due_date": due_date
        # Add other invoice details as needed
    })


Hope it helps

アバター
破棄