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

How to override a function in POS odoo 8?

By
NhuVanTran
on 5/12/15, 4:38 AM 642 views

Hi all,

I want to override a function in POS, which was writen by JS. So, I create __init__.py and __openerp__.py with 'depends ' : ['point_of_sale']. Next, I created my_module.js in /static/src/js

Via link : https://www.odoo.com/forum/help-1/question/how-can-i-extend-a-js-web-module-64

So, In my my_module.js, I wrote

openerp.my_module = function(instance){
var module = instance.sample // loading the namespace of the 'sample' module module.PosWidget.include({ start : function(){ console.log('Hello!'); // HERE IS MY CODE }, }); };

In "HERE IS MY CODE", in wrote whole original code and modify function "self.$('.deleteorder-button').click(function(){ }) as an alert().

self.$('.deleteorder-button').click(function(){
alert("HELLO");
});

It means : when I click butotn delete order in POS, I will get an alert("HELLO")

Where is my wrong? Can any one help me, please?

Thanks,

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

1 follower(s)

Stats

Asked: 5/12/15, 4:38 AM
Seen: 642 times
Last updated: 5/12/15, 4:41 AM