Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
7699 มุมมอง

Hi,

I am working with the Equipment module and the maintenance plan addon, and i nedd to make editable the field next_maintenance_date so when i set up a new preventive maintenance can specify a date, instead of letting the app set it.

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hi,

The field Next Preventive Maintenance in the model maintenance.equipment can be made as editable by either removing the compute function or by defining the inverse function for the field.

next_action_date = fields.Date(compute='_compute_next_maintenance',
string='Date of the next preventive maintenance', store=True)

 

In the above line, you can see a compute , you can remove it and make the field a required field if necessary.

next_action_date = fields.Date(string='Date of the next preventive maintenance')


Thanks

อวตาร
ละทิ้ง
ผู้เขียน

Hi, if remove the function, will the maintenance plan calculate the next maintenance date based on the period i had set to the equipment?

Because i need to make it editable to set the first date of maintenance, and then let the maintenance plan calculates by itself the future tasks,

Thanks!!

Then use the concept of the inverse for the compute field

ผู้เขียน

Hi Niyas,

I am not a Odoo developer, can you help me with the python function using the inverse method?

thnks

คำตอบที่ดีที่สุด

Hi,

change it in python code like >  'next_action_date' : fields.Date('Date of the next preventive maintenance')
this will be an editable date field
 

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
2
ก.ค. 18
3238
Tracking Maintenance Request แก้ไขแล้ว
2
ก.ย. 25
1901
1
ต.ค. 24
6563
2
ม.ค. 24
2137
2
ธ.ค. 23
2083