Odoo Help

0

Update field with button

By
mehdi
on 5/8/15, 10:51 AM 444 views

I have a problem when i update field1 with the vale of field2 from button in the same form


<field name="field1" />

<field name="field2" />

<button name="button1" type="object" />


def button1(self, cr, uid, ids, context=None):

...

return self.write(cr, uid, ids, {'field1': field2}, context=context)


_columns = { 

'field1': fields.integer('Field1'),

'field2': fields.integer('Field2'),

}

field2 is an undefined variable(in python), so you need to assign the value to it by browsing the record

Atchuthan - Technical Consultant, Sodexis Inc
on 5/12/15, 8:18 AM
0
mehdi
On 5/11/15, 3:58 AM

def button1(self, cr, uid, ids, context=None):

field2 = self.browse(cr, uid, ids[0], context=context).field2

return self.write(cr, uid, ids, {'field1': field2}, context=context)

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

Question tools

1 follower(s)

Stats

Asked: 5/8/15, 10:51 AM
Seen: 444 times
Last updated: 5/12/15, 8:18 AM