POS.js customize

Hi,

im facing a problem with my custom buttons in POS view… error is happening in the js, when i want a call a function in py
here is my code (this code is in pos.js in init function)

        this.wrapper.find('button.Calculate').on("click", function() {
                alert("test");
              me.frm.call({
                      method: "addons.addons.doctype.on_total_pricing_rule.on_total_pricing_rule.calculate_discount",
                      args: { args: me },
                      callback: function(r) {
                              alert("here");
                              if (!r.exc && r.message) {
                                      frappe.model.set_value(me.frm.doctype, me.frm.docname, "discount_amount", flt(r.message));

                              }
                      }
              });
        });

the test alert is shown… but after that i got this eror in my console
TypeError: ‘click’ called on an object that does not implement interface HTMLElement
any thought?

thanks,
bobby

@bobzz_zone try this

$(this.wrapper).find .....

i think that method is the real problem…
but i have no idea what i need to do… beacuse i think i need to invoice ajax function to get the data from python script
do you have any idea ?

@bobzz_zone, yes, you have a problem in frm.call the args can’t be the form, all variables need be passed as {'value1': 1, 'value2': frm.doc.value}