Skip to Content
Menu
This question has been flagged
4 Replies
2170 Views

Clean install of Odoo 14 Enterprise edition. Utilizing the expiration date upon product receipt along with lot control. 


When the user presses "validate"  I want Odoo to take whatever date is entered in the Exipiration_date field and write it to the stock.production.lot table. 


I am have this working via an automated action but I dont know how to write to a model other than the one the trigger is set upon.  

I want to update the "removal_date" field in stock.production.lot using the product_id, name, and company_id fields.  I believe I need the syntax on how to do this in python.

Avatar
Discard
Author

This feels a lot closer but I get this error upon trying to preform the transaction.  Im sure its a data type mismatch but not sure how to handle that in Odoo

ValueError: time data 'record.expiration_date' does not match format '%Y-%m-%d %H:%M:%S'
Author

I solved this by Ray's idea but I had to use python code to make it work properly. 1 line

record['removal_date']=record.expiration_date

Odd. I tested again at v14 and it works fine for me, but your solution is fine also.

Best Answer

It would probably be easier, since the LOT doesn't yet exist, to wait for it to be created - listening for update where expiration_date is set after VALIDATE is clicked.

Some thing like this:





Avatar
Discard