Hello,
Actually i would like create an automated action through which i make some update on the database.
What i want to do concretely is when an update is done on a table "stock.pack.operation" i want to check first if the value a specific field "qty_done" inside that table has the value 0 or not.
If the value isn't 0, then update another table "stock.change.product.qty" in field "new_quantity" with that value of "qty_done" which is different than 0.
So i tried to do this through an automated action which calls a server action and execute very short and simple Python Code as following:
if record.qty_done != 0.0 :
stock.change.product.qty.new_quantity=record.qty_done
I fully understand that the code is missing how to make the link between the two tables "stock.pack.operation" and "stock.change.product.qty" through the field "product_id" for the actual record (since i have no clue about how to do that from inside Python code. and also i don't know how to access a specific table and modify its fields values through Python code) :
Can anybody please guides me on how to access and make database update from inside Python code ?
Thank you very much in advance.
P.S : I am using the community SaaS Online version of odoo (I believe the latest one).
Look how automated action works: https://learnopenerp.blogspot.com/2020/05/how-to-create-scheduled-action-in-odoo.html