Skip to Content
Menu
This question has been flagged

I have some Customer arrangements where I bill a subset of Customers the same amount each month, on the same date.

I use the same reference each time - with the month name appended:

GH-338478 - January


Avatar
Discard
Best Answer

Odoo has a Subscription App that supports this, and many other features, like allowing your Customers to start, adjust, setup payment for and stop their subscription(s) via your website.

See https://www.odoo.com/app/subscriptions-features for details.


An alternative may be a Server Action following a similar approach to this:


for record in records:
date_of_next_invoice = record.invoice_date + dateutil.relativedelta.relativedelta(months=1)
if record.ref and ' - ' in record.ref:
new_ref = record.ref.partition(' - ')[0] + ' - ' + date_of_next_invoice.strftime("%B")
else:
new_ref = record.ref
new_invoice = record.copy()
new_invoice.write({
'ref': new_ref,
'invoice_date': record.invoice_date + dateutil.relativedelta.relativedelta(months=1),
'date': record.date + dateutil.relativedelta.relativedelta(months=1),
'invoice_payment_term_id': record.invoice_payment_term_id and record.invoice_payment_term_id.id,
'invoice_date_due': record.invoice_date_due and record.invoice_date_due + dateutil.relativedelta.relativedelta(months=1),
})
if ' - ' in new_ref:
new_invoice.action_post()


Be sure to click CREATE CONTEXTUAL ACTION so this shows up in the list of Customer Invoices:


Then, each month, filter the Invoices you want to have copied, and run the Server Action:


Note: This is an approach, not a robust solution for every Use Case, your Odoo Consultant or Odoo Partner can help you if you need support to get this working in your environment.  It has been quickly tested with v14 but there may be cases where it doesn't work correctly.

Avatar
Discard
Related Posts Replies Views Activity
0
Nov 24
68
1
Apr 24
247
1
Oct 20
3334
0
Mar 15
4031
2
Dec 24
73