Zum Inhalt springen
Odoo Menü
  • Anmelden
  • Jetzt gratis testen
  • Apps
    Finanzen
    • Buchhaltung
    • Rechnungsstellung
    • Spesenabrechnung
    • Tabellenkalkulation (BI)
    • Dokumente
    • E-Signatur
    Vertrieb
    • CRM
    • Vertrieb
    • Kassensystem – Shop
    • Kassensystem – Restaurant
    • Abonnements
    • Vermietung
    Websites
    • Website-Builder
    • E-Commerce
    • Blog
    • Forum
    • Livechat
    • E-Learning
    Lieferkette
    • Lager
    • Fertigung
    • PLM
    • Einkauf
    • Wartung
    • Qualität
    Personalwesen
    • Mitarbeiter
    • Personalbeschaffung
    • Abwesenheiten
    • Mitarbeiterbeurteilung
    • Personalempfehlungen
    • Fuhrpark
    Marketing
    • Social Marketing
    • E-Mail-Marketing
    • SMS-Marketing
    • Veranstaltungen
    • Marketing-Automatisierung
    • Umfragen
    Dienstleistungen
    • Projekte
    • Zeiterfassung
    • Außendienst
    • Kundendienst
    • Planung
    • Termine
    Produktivität
    • Dialog
    • Genehmigungen
    • IoT
    • VoIP
    • Wissensdatenbank
    • WhatsApp
    Apps von Drittanbietern Odoo Studio Odoo Cloud-Plattform
  • Branchen
    Einzelhandel
    • Buchladen
    • Kleidergeschäft
    • Möbelhaus
    • Lebensmittelgeschäft
    • Baumarkt
    • Spielwarengeschäft
    Essen & Gastgewerbe
    • Bar und Kneipe
    • Restaurant
    • Fast Food
    • Gästehaus
    • Getränkehändler
    • Hotel
    Immobilien
    • Immobilienagentur
    • Architekturbüro
    • Baugewerbe
    • Immobilienverwaltung
    • Gartenarbeit
    • Eigentümervereinigung
    Beratung
    • Buchhaltungsfirma
    • Odoo-Partner
    • Marketingagentur
    • Anwaltskanzlei
    • Talentakquise
    • Prüfung & Zertifizierung
    Fertigung
    • Textil
    • Metall
    • Möbel
    • Speisen
    • Brauerei
    • Firmengeschenke
    Gesundheit & Fitness
    • Sportklub
    • Brillengeschäft
    • Fitnessstudio
    • Therapeut
    • Apotheke
    • Friseursalon
    Handel
    • Handyman
    • IT-Hardware & -Support
    • Solarenergiesysteme
    • Schuster
    • Reinigungsdienstleistungen
    • HLK-Dienstleistungen
    Sonstiges
    • Gemeinnützige Organisation
    • Umweltschutzagentur
    • Plakatwandvermietung
    • Fotostudio
    • Fahrrad-Leasing
    • Software-Händler
    Alle Branchen ansehen
  • Community
    Lernen
    • Tutorials
    • Dokumentation
    • Zertifizierungen
    • Schulung
    • Blog
    • Podcast
    Bildung fördern
    • Bildungsprogramm
    • Scale-Up! Planspiel
    • Odoo besuchen
    Software anfragen
    • Herunterladen
    • Editionen vergleichen
    • Releases
    Zusammenarbeiten
    • Github
    • Forum
    • Veranstaltungen
    • Übersetzungen
    • Partner werden
    • Dienstleistungen für Partner
    • Buchhaltungsfirma registrieren
    Services anfragen
    • Partner finden
    • Buchhalter finden
    • Einen Experten treffen
    • Implementierungsservices
    • Kundenreferenzen
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Eine Demo erhalten
  • Preiskalkulation
  • Hilfe

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Buchhaltung
  • Lager
  • PoS
  • Projekte
  • MRP
All apps
Sie müssen registriert sein, um mit der Community zu interagieren.
Alle Beiträge Personen Abzeichen
Stichwörter (Alle anzeigen)
odoo accounting v14 pos v15
Über dieses Forum
Sie müssen registriert sein, um mit der Community zu interagieren.
Alle Beiträge Personen Abzeichen
Stichwörter (Alle anzeigen)
odoo accounting v14 pos v15
Über dieses Forum
Hilfe

Custom code: odoo19 pdf report ValueError: External ID not found in the system

Abonnieren

Erhalten Sie eine Benachrichtigung, wenn es eine Aktivität zu diesem Beitrag gibt

Diese Frage wurde gekennzeichnet
odooodoo19pdf reports
3 Antworten
1113 Ansichten
Avatar
Arjun Baidya

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 error

 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})
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  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 ?

0
Avatar
Verwerfen
Avatar
Codesphere Tech
Beste Antwort

Hello Arjun,
Reference from Odoo 19 default:

<record id="action_account_original_vendor_bill" model="ir.actions.report">

            <field name="name">Original Bills</field>

            <field name="model">account.move</field>

            <field name="binding_model_id" ref="model_account_move"/>

            <field name="report_type">qweb-pdf</field>

            <field name="report_name">account.report_original_vendor_bill</field>

            <field name="report_file">account.report_original_vendor_bill</field>

            <field name="attachment">'original_vendor_bill.pdf'</field>

            <field name="attachment_use">True</field>

            <field name="domain" eval="[('move_type', 'in', ('in_invoice', 'in_refund', 'in_receipt')), ('message_main_attachment_id', '!=', False)]"/>

        </record>

Hope it is helpful.

0
Avatar
Verwerfen
Avatar
Marvin Accuweb.Cloud
Beste Antwort


Hi @Arjun Baidya,

The error appears because Odoo cannot find the report record in its internal database (ir.model.data). This usually means the report XML file wasn’t properly loaded during installation or update.

Please check the following points:

  1. Ensure your report definition is properly wrapped within <odoo> and </odoo> tags.
  2. Confirm that your report XML file (for example, report_monthly_attendance.xml) is included inside the data section of your module’s manifest file, not under demo.
  3. After updating the manifest, upgrade your module using the Odoo update command to reload all XML files and register the report again.
  4. You can also upgrade it from the Odoo interface by going to Apps → Upgrade hr_reports.
  5. If the issue continues, open the Odoo shell and check whether the report ID exists in the system. If it’s missing, that means the XML file still hasn’t been loaded correctly.

Once the XML file is properly loaded and the module has been upgraded, Odoo will be able to locate hr_reports.action_monthly_attendance_pdf_report, and the PDF report will generate without any issue.




0
Avatar
Verwerfen
Avatar
Cybrosys Techno Solutions Pvt.Ltd
Beste Antwort

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.

0
Avatar
Verwerfen
Arjun Baidya
Autor

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

Diskutieren Sie gerne? Treten Sie bei, statt nur zu lesen!

Erstellen Sie heute ein Konto, um exklusive Funktionen zu nutzen und mit unserer tollen Community zu interagieren!

Registrieren
Verknüpfte Beiträge Antworten Ansichten Aktivität
Odoo 19 online: images won´t print on pdf reports
ImageList odoo19 Online pdf reports
Avatar
Avatar
Avatar
2
Okt. 25
512
SOC 1 Report
odoo
Avatar
Avatar
2
Nov. 25
293
邮箱无法正常使用
odoo
Avatar
Avatar
1
Nov. 25
2245
Return Process in Odoo 19 EE
deliveryorder returns return_products odoo odoo19
Avatar
Avatar
1
Nov. 25
224
How do I go about this error? I am trying to uninstall a module
odoo
Avatar
Avatar
1
Nov. 25
3482
Community
  • Tutorials
  • Dokumentation
  • Forum
Open Source
  • Herunterladen
  • Github
  • Runbot
  • Übersetzungen
Dienstleistungen
  • Odoo.sh-Hosting
  • Support
  • Upgrade
  • Individuelle Entwicklungen
  • Bildung
  • Buchhalter finden
  • Partner finden
  • Partner werden
Über uns
  • Unsere Firma
  • Markenwerte
  • Kontakt
  • Karriere
  • Veranstaltungen
  • Podcast
  • Blog
  • Kunden
  • Rechtliches • Datenschutz
  • Sicherheit
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo ist eine Suite von Open-Source-Betriebsanwendungen, die alle Bedürfnisse Ihres Unternehmens abdecken: CRM, E-Commerce, Buchhaltung, Lager, Kassensystem, Projektmanagement etc.

Das einzigartige Wertversprechen von Odoo ist, dass es gleichzeitig sehr einfach zu bedienen und voll integriert ist.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now