Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie

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?

Awatar
Odrzuć
Najlepsza odpowiedź

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)
Awatar
Odrzuć
Autor Najlepsza odpowiedź

Many Tks

Awatar
Odrzuć

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

Najlepsza odpowiedź

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 

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
2
maj 25
2287
0
mar 25
1103
1
paź 24
1821
1
paź 24
12730
2
sie 23
43196