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

I want to add Chatter on my hr,attendance. But when I inherit mail and hr.attendance it get error .Please help me

 py file 

_inherit = ['hr.attendance','mail.thread']

xml file

<record id="view_attendance_form_inherit" model="ir.ui.view">
<field name="name">hr.attendance.form.inherit</field>
<field name="model">hr.attendance</field>
<field name="inherit_id" ref="hr_attendance.view_attendance_form"/>
<field name="arch" type="xml">

<xpath expr="//field[@name='name']" position="replace">
<field name="check_day" />
<field name="checkin" />
<field name="checkout" />
</xpath>
<xpath expr="//field[@name='employee_id']" position="replace">
<field name="employee_id" on_change="onchange_employee_id(employee_id)" string="Employee Name"/>
<field name="employee_code" string="Employee Code"/>
</xpath>

<xpath expr="//field[@name='action_desc']" position="replace">
<field name="department_id"/>
<field name="job_id"/>
<field name="late_sign_in"/>
<field name="early_sign_out"/>
<field name="all_day_leave"/>
<field name="half_day_leave"/>
<field name="edit" invisible="1"/>
<field name="work_location_id" invisible="1"/>
</xpath>
<xpath expr="//field[@name='action']" position="replace">
</xpath>
<xpath expr="//form[@string='Employee attendances']/sheet" position="after">
<div class="oe_chatter">
<field name="message_follower_ids" widget="mail_followers"/>
<field name="message_ids" widget="mail_thread"/>
</div>
</xpath>

</field>
</record>

error

Error context:

View `view_hr_attendance_filter`

File "/home/peneil/Desktop/hr_projects/tpt_yeeshin/hr_presentation/openerp/addons/base/ir/ir_ui_view.py", line 381, in raise_view_error
    raise AttributeError(message)
AttributeError: Field `work_location_id` does not exist
Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi

Please try this for inherit

_name = 'hr.attendance'
_inherit = ['hr.attendance','mail.thread']

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

If I not inherit 'mail.thread' there is no error. But I want to use chatter on hr_attendance. Original hr_attendance is not inherit mail.thread.

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

Hi, Hkawn 


As per the above error seems like "work_location_id" field is not present inside "hr.attendence" model that's why you are getting this error.
Kindly define this field by inheriting the "hr.attendence" model. After that restart your Odoo server and upgrade the module.


Thanks.
Ashish Singh (Team Lead)
Webkul Software Private Limited

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
3
thg 10 23
5836
2
thg 1 23
5186
Datetime in python Đã xử lý
7
thg 6 21
24529
11
thg 9 19
38304
0
thg 5 16
3827