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.
I declared an onchange function for a one2many field. What I want is to get the current value of the that field at the moment of the onchange. I did this:
<field name="meetings" required="1" nolabel="1"
<field name="name" />
<field name="begin_date" />
<field name="end_date" />
I think it would be enough, but in the Python code, the variable meetings is giving me only the altered fields. For example, if I change only the begin_date, the variable meetings only returns the begin_date of one record and I can't get the rest of the records.
I need them because I want to know which is the earliest beginning date (comparing the begin_date of all the records) and the latest ending date (comparing the end_date of all the records). But to know that, I need to get all the current records of meetings, including even those which aren't stored in the database yet.
Can anyone help me, please?
can you please share what is the code of your onchange_meetings method?
In order to solve your issue, we need the id of the instance on which your are calling the onchange method.
I believe the signature of your method would be:
def onchange_meetings(self, cr, uid, id, meetings, context=None)
Then, if we have the id of the current record, we can loop over all the meetings and find the earliest begin_date and the oldest end_date.
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 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/24/14, 8:02 AM|
|Seen: 718 times|
|Last updated: 3/16/15, 8:10 AM|