def monthly_attendance_pdf_report(self):
days_of_month = self.get_days_of_month(self.date_from, self.date_to)
datas = self.monthly_all_employee_attendance_generate()
employees_attendances = datas.get('attendance_details', [])
company = self.company
grouped_attendance_details = defaultdict(list)
for attendance in employees_attendances:
department = attendance.get('department', 'No Department')
grouped_attendance_details[department].append(attendance)
company_data = {
'company_name': company.name,
'company_street': company.street or '',
'company_street2': company.street2 or '',
'company_city': company.city or '',
'company_country': company.country_id.name or '',
'date_from': self.date_from.strftime('%B - %Y'),
'date_to': self.date_to.strftime('%Y-%m-%d'),
}
return self.env.ref('module_name.action_monthly_attendance_pdf_report').report_action(None, data={'attendance_details': grouped_attendance_details, 'days_of_month': days_of_month, 'company_data': company_data})
<report
id="action_monthly_attendance_pdf_report"
model="monthly.employee.attendance.wizard"
string="monthly_attendance_report"
report_type="qweb-pdf"
name="module_name.report_monthly_all_emp_attendance"
file="module_name.report_monthly_all_emp_attendance"
paperformat="module_name.corporate_standard_attendance_format"
print_report_name="monthly_attendance_Report"
/>
I use this code but shows errorreturn self.env.ref('hr_reports.action_monthly_attendance_pdf_report').report_action(None, data={'attendance_details': grouped_attendance_details, 'days_of_month': days_of_month, 'company_data': company_data}) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/arjun/odoo_dev/odoo19/odoo/odoo/orm/environments.py", line 166, in ref res_model, res_id = self['ir.model.data']._xmlid_to_res_model_res_id( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/arjun/odoo_dev/odoo19/odoo/odoo/addons/base/models/ir_model.py", line 2232, in _xmlid_to_res_model_res_id return self._xmlid_lookup(xmlid) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/arjun/odoo_dev/odoo19/odoo/odoo/tools/cache.py", line 98, in lookup return self.lookup(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/arjun/odoo_dev/odoo19/odoo/odoo/tools/cache.py", line 155, in lookup value = self.method(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/arjun/odoo_dev/odoo19/odoo/odoo/addons/base/models/ir_model.py", line 2225, in _xmlid_lookup raise ValueError('External ID not found in the system: %s' % xmlid) ValueError: External ID not found in the system: hr_reports.action_monthly_attendance_pdf_report
Why it shows this error in odoo19 ?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- 会計
- 在庫
- PoS
- Project
- MRP
この質問にフラグが付けられました
Hi,
The error occurs because Odoo cannot find the XML ID hr_reports.action_monthly_attendance_pdf_report.
You defined the report in your custom module, not hr_reports.
The correct reference is module_name.action_monthly_attendance_pdf_report.
Ensure the <report> XML is included in the data section of __manifest__.py.
Use self.env.ref('module_name.action_monthly_attendance_pdf_report') in your method.
Make sure the module is installed and the XML file is loaded.
Update the module
After these steps, Odoo will find the XML ID and generate the report without error.
Hope it helps.
Hello,
Thanks for your comment.
But my module name is hr_reports so hr_reports.action_monthly_attendance_pdf_report
in below i given code again
class MonthlyAllEmployeeAttendanceShow(models.TransientModel):
_name = 'monthly.employee.attendance.wizard'
def monthly_attendance_pdf_report(self):
days_of_month = self.get_days_of_month(self.date_from, self.date_to)
datas = self.monthly_all_employee_attendance_generate()
employees_attendances = datas.get('attendance_details', [])
company = self.company
grouped_attendance_details = defaultdict(list)
for attendance in employees_attendances:
department = attendance.get('department', 'No Department')
grouped_attendance_details[department].append(attendance)
company_data = {
'company_name': company.name,
'company_street': company.street or '',
'company_street2': company.street2 or '',
'company_city': company.city or '',
'company_country': company.country_id.name or '',
'date_from': self.date_from.strftime('%B - %Y'),
'date_to': self.date_to.strftime('%Y-%m-%d'),
}
return self.env.ref('hr_reports.action_monthly_attendance_pdf_report').report_action(None, data={'attendance_details': grouped_attendance_details, 'days_of_month': days_of_month, 'company_data': company_data})
report.xml
<report
id="action_monthly_attendance_pdf_report"
model="monthly.employee.attendance.wizard"
string="monthly_attendance_report"
report_type="qweb-pdf"
name="hr_reports.report_monthly_all_emp_attendance"
file="hr_reports.report_monthly_all_emp_attendance"
paperformat="hr_reports.corporate_standard_attendance_format"
print_report_name="monthly_attendance_Report"
/>
template file
some portion code
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<template id="report_monthly_all_emp_attendance">
<t t-call="web.html_container">
<t t-call="web.internal_layout">
<div class="page" style="padding-top:10px;">
<div class="row">
<div class="col-xs-12">
<div class="company-info text-center" style="line-height: 1;">
<p style="line-height: 0.5;">
<b>
<t t-esc="company_data['company_name']"/>
</b>
</p>
<p style="line-height: 0.5;">
<t t-esc="company_data['company_street']"/>,
<t t-esc="company_data['company_street2']"/>,
<t t-esc="company_data['company_city']"/>,
<t t-esc="company_data['company_country']"/>
</p>
<p style="line-height: 0.5;">
<b>Attendance for the month of:</b>
<t t-esc="company_data['date_from']"/>
</p>
</div>
so where is the probem?
in my menifest file all file I added
関連投稿 | 返信 | ビュー | 活動 | |
---|---|---|---|---|
|
2
8月 25
|
3113 | ||
|
1
7月 25
|
1314 | ||
|
1
8月 25
|
1152 | ||
|
0
5月 25
|
1732 | ||
|
2
4月 25
|
3923 |