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

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


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

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

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
3
thg 2 24
18117
1
thg 7 25
443
Search a message Đã xử lý
1
thg 2 25
1226
0
thg 9 23
2172
2
thg 6 23
3961