İçereği Atla
Menü
Bu soru işaretlendi
3 Cevaplar
2483 Görünümler

Hi,

I would like to override "_prepare_invoice_line" method of src/enterprise/sale_subscription/models/sale_order.py  to hide the periode message ininvoice detail lines

I tried to create a new class in my addon module and use inheritance but it seems not to work properly.

Someone could help me?

Avatar
Vazgeç
En İyi Yanıt

WARNING: This is an approach, not necessarily a complete solution. Your Odoo Digital Advisor or Odoo Partner can help you if you don't have the skills to do this yourself.


One option is to create an Automation Rule that overrides the function that Odoo uses to add the period description with the start and end date. This function relies on the recurring_invoice field on the subscription order line.

This approach creates a new sale order line with the same name and since we are not providing a value for the recurring_invoice field, we can recalculate the description on the copy and assign the result (which won't have the period text) back to the original.


for record in records:
    if record.sale_line_ids:
        sol = record.sale_line_ids[0]
        sol_duplicate = sol.new({'order_id': sol.order_id.id,'name': sol.name})._prepare_invoice_line()
        record['name'] = sol_duplicate.get('name', record.name)
Avatar
Vazgeç
Üretici En İyi Yanıt

Many Tks

Avatar
Vazgeç

Hi Richard,
Did you manage to get this working? If so, could you please share how you achieved it if possible?
I've been trying to do something similar, but instead of removing the invoice period, I'm trying to change the period and invoice a month ahead. Just can't seem to get it working.

Many thanks,
Richard A

En İyi Yanıt

Hi,

In order to hide or change the period message of invoices of subscriptions, you must inherit and override the _prepare_invoice_data(odoo v14) method of sale.subscription model. The field narration of subscription invoices must be set to null.

Regards 

Avatar
Vazgeç
İlgili Gönderiler Cevaplar Görünümler Aktivite
2
May 25
2270
0
Mar 25
1102
1
Eki 24
1820
1
Eki 24
12718
2
Ağu 23
43188