POS add some rules

Hi,

i wanted to add some discount rules on POS … but i cant manage how i can do it…
i see from standard pricing rules there is sciprt like :
this.frm.call({
method: “addons.addons.doctype.on_total_pricing_rule.on_total_pricing_rule.calculate_discount”,
args: { args: this },
callback: function(r) {
if (!r.exc && r.message) {
me.discount_amount=r.message;
refresh_field(“discount_amount”);
}
}
});
**that my version of code

but i confused where should i put those codes

i cant use hooks because there is no save state in POS… so i cant update the value on validate… i should do it on change…

Thanks

@bobzz_zone POS is a non standard form view. But adding more events on standard triggers qty etc should work.

@rmehta can you give me some example?

i need add event on grand total is being updated…or i want to add some simple buttons beside pay buttons…

Thanks

You will have to hack into pos.js. I don’t think thats designed to be extensible as of now.

@bobzz_zone could some of your discount functionality be done via Customer Group and Pricing Rules?

@System19 i want to set discount based on grand total… and i cant use current pricing rule…
@rmehta can you give some snapshot to add some buttons ?

Thanks