Skip to Content
Menu
This question has been flagged
1 Reply
13008 Views

Error:

Odoo Server Error


Traceback (most recent call last):

  File "C:\Program Files (x86)\Odoo 13.0\server\odoo\http.py", line 624, in _handle_exception

    return super(JsonRequest, self)._handle_exception(exception)

  File "C:\Program Files (x86)\Odoo 13.0\server\odoo\http.py", line 310, in _handle_exception

    raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])

  File "C:\Program Files (x86)\Odoo 13.0\server\odoo\tools\pycompat.py", line 14, in reraise

    raise value

  File "C:\Program Files (x86)\Odoo 13.0\server\odoo\http.py", line 669, in dispatch

    result = self._call_function(**self.params)

  File "C:\Program Files (x86)\Odoo 13.0\server\odoo\http.py", line 350, in _call_function

    return checked_call(self.db, *args, **kwargs)

  File "C: \ Program Files (x86) \ Odoo 13.0 \ server \ odoo \ service \ model.py", line 94, in wrapper

    return f (dbname, * args, ** kwargs)

  File "C: \ Program Files (x86) \ Odoo 13.0 \ server \ odoo \ http.py", line 339, in checked_call

    result = self.endpoint (* a, ** kw)

  File "C: \ Program Files (x86) \ Odoo 13.0 \ server \ odoo \ http.py", line 915, in __call__

    return self.method (* args, ** kw)

  File "C: \ Program Files (x86) \ Odoo 13.0 \ server \ odoo \ http.py", line 515, in response_wrap

    response = f (* args, ** kw)

  File "C: \ Program Files (x86) \ Odoo 13.0 \ server \ odoo \ addons \ web \ controllers \ main.py", line 1326, in call_button

    action = self._call_kw (model, method, args, kwargs)

  File "C: \ Program Files (x86) \ Odoo 13.0 \ server \ odoo \ addons \ web \ controllers \ main.py", line 1314, in _call_kw

    return call_kw (request.env [model], method, args, kwargs)

  File "C: \ Program Files (x86) \ Odoo 13.0 \ server \ odoo \ api.py", line 387, in call_kw

    result = _call_kw_multi (method, model, args, kwargs)

  File "C: \ Program Files (x86) \ Odoo 13.0 \ server \ odoo \ api.py", line 374, in _call_kw_multi

    result = method (recs, * args, ** kwargs)

  File "c: \ program files (x86) \ odoo 13.0 \ server \ custom_addons \ salarycalc \ wizards \ pdf_report.py", line 21, in print_pdf_report

    return self.env.ref ('salarycalc.print_pdf_report'). report_action (self, data = data)

AttributeError: 'ir.ui.view' object has no attribute 'report_action'



this is my wizard py file


from odoo import fields , models , api 


class pdf_report (models.TransientModel):
_name = 'pdf.report'
employee_id = fields.Many2one ( 'hr.employee' , string = 'Employee' , ) date_from = fields.Date ( string = 'Date From' , ) date_to = fields.Date ( string = 'Date To' , ) def print_pdf_report ( self ): data = { 'model' : 'pdf.report'







,
'form' : self .read () [ 0 ] } selected_employee = data [ 'form' ] [ 'employee_id' ] [ 0 ] total_salary = self .env [ 'hr.attendance' ] .search ([( 'employee_id' , '=' , selected_employee) , ( 'check_in' , '> =' , self .date_from) , ( 'check_in' , '<=' , self .date_to)]) print (total_salary)




data [ 'docs' ] = total_salary
return self .env.ref ( ' salarycalc.print_pdf_report ' ) .report_action ( self , data = data)








# total_salary = self.env [' hr.attendance ']. search ([(' employee_id .id ',' = ', self.employee_id.id), (' check_in ','> = ', self.date_from), (' check_in ',' <= ', self.date_to)])
# print (total_salary )
# data = {
# 'model': 'pdf.report'
# 'employee_id': self.employee_id.ids,
# 'date_from': self.date_from,
# 'date_to': self.date_to,
# 'form ': self.read () [0]
#}
# # docids = [total_salary]
# return self.env.ref ('salarycalc.print_pdf_report'). report_action (self, data = data)


this is my wizard xml file


<? xml version = "1.0" encoding = "utf-8" ?> 
<odoo>
<record id = "create_pdf_report_form" model = "ir.ui.view" > <field name = "name" > pdf report </field> < field name = "model" > pdf.report </field> <field name = "type" > form </field> <field name = "arch" type = "xml" >






<group>
<group>
<field name="employee_id"/>
</group>
<group>
<field name="date_from"/>
</group>
<group>
<field name="date_to"/>
</group>
</group>
<footer>
<button name="print_pdf_report" string="Print" type="object" class= "oe_highlight" />
<button string = "Cancel" special = "cancel" />
</footer>
</form>
</field>
</record>
<record id = "salarycalc.create_pdf_report_wizard" model = "go. actions.act_window " > <field name =" name " > Pdf Report </field> <field name =" type " > ir.actions.act_window </field> <field name = "res_model" > pdf.report </field>




<field name = "view_mode" > form </field>
<field name = "view_id" ref = "create_pdf_report_form" />
<field name = "target" > new </field>
</record>
<menuitem id = "menu_report "
parent =" hr_payroll_community.menu_hr_payroll_community_root " name =" Reports " /> <menuitem id =" pdf_report " parent =" salarycalc.menu_report "name = "Pdf Report" action = "salarycalc.create_pdf_report_wizard"




/>
</odoo>
Avatar
Discard
Best Answer

Hi,

Please check,

https://www.odoo.com/documentation/13.0/reference/reports.html

Aswini iWesabe

Avatar
Discard