Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
how to fetch the value of my current fields as my default value when creating new records.
let say in my product model i have existing value of my fields which is field1 = 5 and field2 = 10 period Jan 1- 7, 2014.
what I want to achieve is on the next period dated Jan 8 - 14, 2014 or the next enter of the new inventory record for product1 else product2. I want to fetch previous value of field1 and field2 as the default value of my new field1 and field2.
currently i have custom product and inventory modules and 2 reserve fields in inventory module but Im stuck. I dont know how to implement. is very complicated because that 2 fields always been change, my Idea is to update that fields but I think I cant go back to my previous reports after created the new inventory records for the specific product because the value is changed.
anybody here who can give Idea on how to do it and best way to implement this?.
This for custom weekly period monitoring inventory to my custom product
Thanks for reading
Hi Philip , while creating the record for the period jan 8 -14 2014 for a specific product , you can check whether there is any record has been created previously for the product.
If created then you can get the value from that record order by date descending and get the values for field 1 and field2 from that record else the value for field 1 and field 2 will be empty in case this is a new record for the product
Let us take the example of Class A
1) In create method, check the class if already any record exists order by id or not
2) if records exists, then browse the value from searched record and update it to your newly creating record.
3) if record does not exist, then you can give your own values to the fields.
Is this Clear
About This Community
This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 11/5/14, 11:01 AM|
|Seen: 904 times|
|Last updated: 3/16/15, 8:10 AM|