This question has been flagged
8 Replies
4133 Views

Is it possible to automatically create Invoice drafts via subscriptions in Odoo V16?


In V15 you can set within the subscription template what Odoo should do with the invoice. (Create a draft, send invoice automatically, etc.) As far as I see there is no such option in V16. Invoices are always automaticaly created, confirmed and sent. It seems that there is no chance for checking or editing those invoices.

I couldn't find any details in the documentation as it concerns only V15.

Any Advice?

thanks a lot


Avatar
Discard

According to Odoo this function has been removed. Strange...

https://github.com/odoo/odoo/issues/118858

People, please add your comment on Github and here why this absolutely needs to come back! Thanks y'all!

Author

Sehr geehrte/r AbsenderIn,

ich bin ab 19.06.2023 wieder für Sie erreichbar.

Für Anliegen zur Ihrem Projekt wenden Sie sich bitte an meinen Kollegen Robert Förster (robert@suppliot.eu).

In dringenden Fällen wenden Sie sich bitte an unseren Support - +43 1 774 03 92 – 400.

E-Mails werden nicht weitergeleitet.

vielen Dank und beste Grüße

Gottfried Brandi

Hello, I have exactly the same problem. Any solution?


No there is no solution yet, they will probably release it in a new version 17+.

According to Odoo this function has been removed.
See: https://github.com/odoo/odoo/issues/118858

People, please add your comment on Github and here why this absolutely needs to come back! Thanks y'all!

Best Answer

To ensure that all related invoices are consistently created in draft form, a recommended approach would be to clone the 'Sale Subscription: generate recurring invoices and payments' scheduled action and then deactivate the original one. Replace Python code with this snippet:


current_date = datetime.datetime.now()
search_domain = model.search([('is_batch', '=', False),
                         ('is_invoice_cron', '=', False),
                         ('is_subscription', '=', True),
                         ('subscription_management', '!=', 'upsell'),
                         ('state', 'in', ['sale', 'done']),
                         ('payment_exception', '=', False),
                         '&', '|', ('next_invoice_date', '
for subs in search_domain:
  try:
    account_move = subs._create_recurring_invoice()
    #log(str(account_move))
  except Exception as e:
    continue


This way, you can maintain control over the invoice creation process but all will be generated in draft state.




Avatar
Discard

This code doesn't seem to be complete

Best Answer

my case was to have this option for Creation invoices as manual for all subscriptions and solution is modification a scheduler

Sale Subscription: generate recurring invoices and payments

and replace a function with 

model._create_recurring_invoice(automatic=False)


Avatar
Discard

It's important to note that with the proposed modification, if the system encounters any draft invoices linked to a subscription, the scheduled task may cease to process subsequent subscriptions.

Best Answer

A work-around could be disable the scheduled action "Sale subscription: generate recurring ..." and create a new one calling to the button action on form "action_invoice_subsction()" only for active subscription with pending invoices.

This action creates the invoices in draft state.

I have not the code, but it's easy.

Avatar
Discard
Best Answer

Same problem here. 

Found a small workaround, where i set the invoice items to "Based on Delivered Quantities" (Per Invoice ITEM)

I would like some subscriptions to invoice automatically.. and some manual.. like we had it before.. (Per Customer/Subscription)


Avatar
Discard
Best Answer

I don't think that there is a real solution for the moment despite  work arounds that might be different depending on use cases. In top of all this it will add in the invoice, at each product line the period even if it does not mean anything in your case. Before it was only mentioned once at the bottom of the invoice. 

Avatar
Discard

Yes I wish I was in the Odoo offices to talk about this problem... No one @Odoo seems to care and thinks they are right.

Maybe we should post something on LinkedIn to try to find out who is the product owner and get in touch with him. Wondering if he saw the GitHub comments.

Best Answer

Unfortunately there is no "invoicing" tab in my database either. No invisible views as far as I can see...
Also when I check v16.2, on runbot.odoo.com there also no invoicing tab there.

This is very annoying as now some previously 'draft invoice' subscriptions are invoiced anyway and sent to the customer...
And some automatic invoices aren't even invoiced.

This is terrible.

Avatar
Discard
Best Answer

Hello,

I had the same issue. After reviewing the Odoo native code, i find out that they done major changes that make the draft invoice process impossible without modification. 

The workaround proposed by Ricardo on this topic doesn't fit because it's considering a lot of products as "non delivered" and so just make the next invoice date increment without creating any invoices. 

As it was mandatory for our activity i created a module that overwrite the new Odoo process and get back the ability to invoice in draft again. 

For those who want to implement the same solution, you can buy the fresh made module here : 

https://apps.odoo.com/apps/modules/16.0/beone_sub_draft_invoice/ 

To make it work you just need to edit the recurrence model (sale.temporal.recurrence) in Subscriptions > Configuration > Recurrence Period. 

Just tick the new checkbox "Draft Invoice" and all the subscriptions for that recurrence will be done in draft. 

So to manage two types (one that post automatically and the other in draft) you'll need to have 2 (for exemple) "Monthly" recurrence. One you name "Monthly Auto" with the checkbox unchecked and the other you name "Monthly Draft" with the checkbox checked. 


Avatar
Discard
Best Answer

To create a draft invoice, you need to set the "Invoice Policy" to "Create draft invoice" in the subscription template. This will ensure that a draft invoice is generated for each billing cycle of the subscription.

Here are the steps to configure this in Odoo V16:

  1. Go to the "Subscription" menu in the Odoo interface.

  2. Select the subscription template for which you want to set the invoicing settings.

  3. Click on the "Invoicing" tab.

  4. In the "Invoice Policy" field, select "Create draft invoice".

  5. Save the changes to the subscription template.


Avatar
Discard
Author

Thank you for your answer. Unfortunately there is no "invoicing" tab in my database. I also have checked if it is set invisible in Odoo Studio. I have uploaded a Screenshot in my initial post.