Odoo Help


Can we put 2 actions on one buttton ?

on 2/10/14, 5:18 AM 749 views

I try to add a button wich change state and duplicate the quotation :

def act_approve_quotation(self, cr, uid,id, ids, default= None, context=None):
    res = self.write(cr, uid, ids, {'state': 'x_approve_quotation'}, context=context)
    if not default:
        default = {}
    return super(complement_sale_order, self).copy_data(cr, uid, id, default, context=context), res

But he return this error :

Client Traceback (most recent call last):

File "/usr/lib/pymodules/python2.7/openerp/addons/web/http.py", line 204, in dispatch response["result"] = method(self, *self.params) File "/usr/lib/pymodules/python2.7/openerp/addons/web/controllers/main.py", line 1132, in call_button action = self._call_kw(req, model, method, args, {}) File "/usr/lib/pymodules/python2.7/openerp/addons/web/controllers/main.py", line 1120, in _call_kw return getattr(req.session.model(model), method)(args, **kwargs) File "/usr/lib/pymodules/python2.7/openerp/addons/web/session.py", line 42, in proxy result = self.proxy.execute_kw(self.session._db, self.session._uid, self.session._password, self.model, method, args, kw) File "/usr/lib/pymodules/python2.7/openerp/addons/web/session.py", line 30, in proxy_method result = self.session.send(self.service_name, method, *args) File "/usr/lib/pymodules/python2.7/openerp/addons/web/session.py", line 103, in send raise xmlrpclib.Fault(openerp.tools.ustr(e), formatted_info)

Server Traceback (most recent call last): File "/usr/lib/pymodules/python2.7/openerp/addons/web/session.py", line 89, in send return openerp.netsvc.dispatch_rpc(service_name, method, args) File "/usr/lib/pymodules/python2.7/openerp/netsvc.py", line 292, in dispatch_rpc result = ExportService.getService(service_name).dispatch(method, params) File "/usr/lib/pymodules/python2.7/openerp/service/web_services.py", line 626, in dispatch res = fn(db, uid, params) File "/usr/lib/pymodules/python2.7/openerp/osv/osv.py", line 190, in execute_kw return self.execute(db, uid, obj, method, *args, *kw or {}) File "/usr/lib/pymodules/python2.7/openerp/osv/osv.py", line 132, in wrapper return f(self, dbname, args, *kwargs) File "/usr/lib/pymodules/python2.7/openerp/osv/osv.py", line 199, in execute res = self.execute_cr(cr, uid, obj, method, args, *kw) File "/usr/lib/pymodules/python2.7/openerp/osv/osv.py", line 187, in execute_cr return getattr(object, method)(cr, uid, args, *kw) File "/usr/lib/pymodules/python2.7/openerp/addons/Complement/complement.py", line 41, in act_approve_quotation res = self.write(cr, uid, ids, {'state': 'x_approve_quotation'}, context=context) File "/usr/lib/pymodules/python2.7/openerp/addons/mail/mail_thread.py", line 280, in write initial = self.read(cr, uid, ids, tracked_fields.keys(), context=track_ctx) File "/usr/lib/pymodules/python2.7/openerp/osv/orm.py", line 3625, in read result = self._read_flat(cr, user, select, fields, context, load) File "/usr/lib/pymodules/python2.7/openerp/osv/orm.py", line 3677, in _read_flat cr.execute(query, [tuple(sub_ids)] + rule_params) File "/usr/lib/pymodules/python2.7/openerp/sql_db.py", line 161, in wrapper return f(self, args, *kwargs) File "/usr/lib/pymodules/python2.7/openerp/sql_db.py", line 226, in execute res = self._obj.execute(query, params) DataError: invalid input syntax for integer: "lang" LINE 1: ...rder.id FROM "sale_order" WHERE sale_order.id IN ('lang', 't... ^

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


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)


Asked: 2/10/14, 5:18 AM
Seen: 749 times
Last updated: 3/16/15, 8:10 AM