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

Hello,

I'm trying to replace driver_id related to res.partner in a driver_id field related to hr.employee using :

    driver_id = fields.Many2one('hr.employee', string="Driver", store=True, ondelete="cascade")

The problem is when I do this i receive the KeyError: plan_to_change_car

This happens because plan_to_change_car is related to driver_id. How can I do? If I create a new field driver_id and I disabled the driver_id related to res.partner I received the same KeyError.

I tried also to write in hr.employee this field

   driver_ids= fields.One2many('fleet.vehicle', 'employee_id', string='Driver')

But nothing.

Thank you in advance

Ảnh đại diện
Huỷ bỏ

Why don't you just define a partner for this or other employee?

Tác giả

Sorry I don't understand. What do you mean?

Tác giả

I want to create drivers for trucks, so the drivers are employee of the company...

For each employe fill field: Contact Information/Address

Mofifications in the python code will not be needed

Tác giả

Still not understanding what do you mean?

The drivers are employee and ... partners ... of the company

Câu trả lời hay nhất

Hello Michele,

You need to create plan_to_change_car Boolean fields in hr.employee object

then replace/change driver_id res.partner to hr.employee etc...


Regards,




Email:   odoo@aktivsoftware.com

Skype: kalpeshmaheshwari

   



Ảnh đại diện
Huỷ bỏ
Tác giả

Thank you, i will try! :)

plan_to_change_car has to be only a boolean or it has to be related?

Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 1 20
2711
0
thg 4 25
720
4
thg 5 24
12745
1
thg 4 24
3358
0
thg 11 23
2059