Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
1 Beantwoorden
5366 Weergaven

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


Avatar
Annuleer
Beste antwoord

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

Avatar
Annuleer
Gerelateerde posts Antwoorden Weergaven Activiteit
3
feb. 24
18069
1
jul. 25
368
1
feb. 25
1198
0
sep. 23
2140
2
jun. 23
3893