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

hello everyone i haved been added an filed called employee_id, it gets the record id as the employee id computed field, it worked well when any of depending fields change but i need to run the function on all old date not while creating a new employee or i change the dependens

here is the method

@api.one
@api.depends('name')
def _compute_employee_id(self):
    for rec in self:
        rec.employee_id = rec.id
    pass

employee_id = fields.Char('Employee ID',compute='_compute_employee_id',store=True)

any help will be appreciated


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

Hi,

To update old records, you need to create server action to update value of field based on some calculation.

See: https://www.odoo.com/forum/help-1/question/how-to-code-server-action-for-updating-extended-fields-on-odoo11-account-invoice-137463

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
How to search by odoo computed field? แก้ไขแล้ว
3
ก.พ. 24
18126
1
ก.ค. 25
454
Search a message แก้ไขแล้ว
1
ก.พ. 25
1229
0
ก.ย. 23
2172
2
มิ.ย. 23
3966