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

get function from controller in openerp using javascript

By
lam a bao
on 1/20/14, 10:10 PM 998 views

Hi everyone

I have code javascript:

openerp.cnd_quotations = function(instance) {
instance.cnd_quotations = instance.cnd_quotations || {};
var _t = instance.web._t;
instance.web.GetDataCutProduct.include({
    do_getdata_cut:function(){
        var self=this
        self.rpc('/cnd_quotations/_getdataproductCutByIdSales',{}).then(function(result){
            alert(result)
        })
    }
});

}

I want to get data from function "_getdataproductCutByIdSales" in controllers of openerp.But error : "Exception happened during processing of request from ('127.0.0.1', 28244)"

Code controllers :

      import logging
      import openerp
      from openerp.modules.registry import RegistryManager
     _logger = logging.getLogger(__name__)
     class Controller(openerp.addons.web.http.Controller):
     _cp_path = '/cnd_quotations'
   @openerp.addons.web.http.jsonrequest
  def _getdataproductCutByIdSales(self,req,dbname):
    resgister=RegistryManager.get(dbname)
    with resgister.cursor() as cr:
        cp=resgister.get('cvs.quotations')
        cpc=resgister.get('cvs.quotations.cutproduct')
        config={
            {
                "class1": "foo",
                "title": "Random Title",
                "items": [
                            { "name": "foo", "tags": {"bar": "baz", "qux": "quux"} },
                            { "name": "Lorem", "tags": {
                                "ipsum": "dolor",
                                "sit": "amet",
                                "consectetur": "adipiscing",
                                "elit": "Sed",
                                "hendrerit": "ullamcorper",
                                "ante": "id",
                                "vestibulum": "Lorem",
                                "ipsum": "dolor",
                                "sit": "amet"
                                }
                            }
                        ]
            }
        }
        return config

Can you help me ?

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

0 follower(s)

Stats

Asked: 1/20/14, 10:10 PM
Seen: 998 times
Last updated: 3/16/15, 8:10 AM