Community mailing list archives

community@mail.odoo.com

Re: Getting field in javascript

by
Mohamed Mtloob
- 01/28/2015 08:24:36
Dear sir

use "ir.cron" job under your condition i think it may help you ...

Thanks

On Wed, Jan 28, 2015 at 3:19 PM, Mohamed Magdy <moh.magdy40@gmail.com> wrote:
Dear Heba,

It will be nice if you format the text in your email, so that we can read it easily.
I reformatted it to make it easier for others to help.

I am working on odoo 8 and I want to get the value of  model field in javascript code to do certain action when this field has certain value.

I tried the following idea but it doesn’t work:

var model = new instance.web.Model("survey.user_input");

model.call("get_state", {context: new instance.web.CompoundContext()}).then(function(result) { alert(result)});

and in the field survey.user_input I created the following function

def get_state(self, cr, uid, automatic=False, context=None):

        user_input_ids = self.search(cr, uid, [],context=context)

        id = len(user_input_ids)-1

        survey_obj = self.browse(cr, uid, id, context=context)

        return {'state': survey_obj.state}

How can this be performed?

Thanks in advance.

 

_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe


_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe




--
Thanks
Mohamed Mtloob
Team Leader.Odoo Developer @ Techorg CO
skype:mohamed.mtloob
whatsapp(020111366018,201025420653)
Linkedin