跳至內容
選單
此問題已被標幟
3 回覆
2509 瀏覽次數

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?

頭像
捨棄
最佳答案

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)
頭像
捨棄
作者 最佳答案

Many Tks

頭像
捨棄

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

最佳答案

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 

頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
2
5月 25
2348
0
3月 25
1116
1
10月 24
1850
1
10月 24
12788
2
8月 23
43282