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

Record does not exist or has been deleted. (Record: ir.actions.report(1,), User: 1), i get this error when clicking the run manually button ,  i want to send mail with attachment as a pdf report, how can i solve this ?

report = self.env.ref(
'partner_ledger_automatic_send.action_report_send_partner_ledger').with_context(
partner_id=partner.id, company_id=company.id,
rec=record.id)
print(report, "report")
print(record, "record")
data_record = base64.b64encode(
report._render_qweb_pdf(record.id)[0])
print(data_record, "data_record")


it didn't print the data_record why?


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

To resolve this issue, you can try the following steps:

  1. Check the value of record.id and ensure that it is a valid ID of an existing record. Verify that the record is not deleted or missing.

  2. If you are passing the record.id from another part of the code, make sure that the value is retrieved correctly and that it corresponds to a valid record in the database.

  3. Ensure that the action_report_send_partner_ledger refers to a valid report action ID. Verify that the report action exists and is correctly defined in your codebase.

  4. Confirm that the report action referenced in self.env.ref() has the appropriate access rights for the current user. Ensure that the user executing the code has the necessary privileges to access and run the report.

Regarding the issue with data_record not being printed, it might be due to the previous error causing the execution to halt before reaching that print statement. The error message you mentioned could be raised when attempting to render the report using report._render_qweb_pdf(record.id)[0], which would prevent the subsequent lines of code from executing.

Make sure to address the "Record does not exist or has been deleted" error first. Once the issue is resolved, the code should continue executing, and you should see the data_record value printed as expected.

If the problem persists, consider checking the logs or enabling additional logging to gather more information about the error and its source.

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

I have same issue but I have no idea what it means. can any one explain in simple terms?

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

Hey, did you resolve this?
Please help me as well, I am facing the same error.

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 2 24
1929
1
thg 7 23
2298
1
thg 6 23
2781
1
thg 4 23
2359
1
thg 12 22
1814