I have added a computational field through the odoo studio feature. It triggers (works) for the new records, but does not work for the old (previously created) records. Here is my code,
for record in self:
record ['x_studio_debug'] = "test"
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
I have added a computational field through the odoo studio feature. It triggers (works) for the new records, but does not work for the old (previously created) records. Here is my code,
for record in self:
record ['x_studio_debug'] = "test"
I had the same and solved it by creating an action that run through all the old records and made the update.
-
Kindly can you explain further? where did you create the action ? can you explain the action code too...
Go to debug mode.
Go to Setting -> Technical -> Server actions.
Create a server action. Select the correct model and Action to do = Execute Puthon code.
Then enter your code, and save. And then you press: Set contextual action.
When you the go into a record you want to update, or in list view you select the records you want to update, you find your server action in the Action on the top of the list.
Be aware that the python code have a different syntax than in your field. My code looked like this:
record ['x_studio_sum_weight'] = record.quantity * record.x_studio_field_LXlvk
You should find good instruction videos on You Tube on how to create server actions.
It Works !!!! Thanks, your answer was really helpful. Thanks again Lars !!!! :)
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign up