Ir al contenido
Menú
Se marcó esta pregunta
1 Responder
4033 Vistas

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
Descartar
Mejor respuesta

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
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
0
nov 24
1009
0
ene 25
1009
1
abr 24
1285
1
oct 20
4289
0
mar 15
5078