Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
5853 Lượt xem

I create a custom invoice report, the invoice is printed successfully using print menu.
i changed print button code like this

def invoice_print(self):
    """ Print the invoice and mark it as sent, so that we can see more
        easily the next step of the workflow
    """
    self.ensure_one()
    self.sent = True
    return self.env['report'].get_action(self, 'custom_invoice_report.custom_invoice_report_template')

i changed default template id to custom template id

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hello 

This error is usually seen when you dont define report tag in xml

<report
id="report_payment_receipt"
string="Payment Receipt"
model="account.invoice"
report_type="qweb-pdf"
file="account_payment_receipt.report_payment"
name="account_payment_receipt.report_payment"
/>

Here is a sample for that report tag

Ảnh đại diện
Huỷ bỏ
Tác giả

I already defined report tag correctly.The sale thing works in sale report

The model referred in report tag should be the model in which you defined the button

Tác giả

yes. both are same. Here is my report tag

<report

id="account.account_invoices"

model="account.invoice"

string="Invoice report"

report_type="qweb-pdf"

name="custom_invoice_report.custom_invoice_template"

file="custom_invoice_report.custom_invoice_template"

/>

Hi,

in your xml you defined template name as "custom_invoice_template".

and in py you called template name with "custom_invoice_report_template"

Tác giả

Hi amal ,Thanks for comment.Actually the problem is in default invoice attachment_use=true.

so in my custom tag must use attachment_use=False. Other wise it shows that error

Bài viết liên quan Trả lời Lượt xem Hoạt động
3
thg 12 19
7345
1
thg 3 22
2514
2
thg 6 25
1986
4
thg 5 24
6070
1
thg 5 23
3856