Odoo Help

Welcome!

This community 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.

0

how to fetch the value of my current fields as my default value when creating new records?.

By
philip
on 11/5/14, 11:01 AM 698 views

Hi all,

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

any suggestion here?

philip
on 11/6/14, 5:22 AM

hello world, any updates here?

philip
on 11/13/14, 8:24 AM

Hi odoo community please help me, need your help to figure it out what has to be done this?

philip
on 11/13/14, 8:10 PM
0

Maniganda

--Maniganda--
1038
| 5 7 7
Bangalore, India
--Maniganda--
Maniganda
On 11/13/14, 10:41 PM

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

steps:

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
 

could you please give an simple example, I am new in odoo7 thanks for the response

philip
on 11/13/14, 11:10 PM

sir can I have your personal email address

philip
on 11/13/14, 11:11 PM

Sir I am very thankful if you give a simple understandable code sample or working code. thanks for your kind

philip
on 11/13/14, 11:17 PM

update please

philip
on 11/14/14, 11:55 AM

Updated the answer

Maniganda
on 11/16/14, 11:37 PM

yes clear very, if you could give us simple working code much better, other also can benefit. Thanks

philip
on 11/17/14, 12:55 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 11/5/14, 11:01 AM
Seen: 698 times
Last updated: 3/16/15, 8:10 AM