Odoo Help

0

How to inherit POS javascript for customization?

By
Mina
on 5/8/18, 6:53 AM 395 views

I need the basic skeleton to inherit point of sale javascript to add a new button in the POS screen.

1
jithesh
On 5/16/18, 9:32 AM

hello Mina

first write the qweb template

<?xml version="1.0" encoding="utf-8"?>
<odoo>
    <data>
        <template id="assets" inherit_id="point_of_sale.assets">
            <xpath expr="." position="inside">
                <script type="text/javascript" src="/pos_clear/static/src/js/models.js"></script>
            </xpath>
        </template>

    </data>
</odoo>

js part.........................................................................................................

odoo.define('pos_clear_orderline.pos', function (require) {
"use strict";

var screens = require('point_of_sale.screens');

    var OrderLineClear = screens.ActionButtonWidget.extend({
        template: 'OrderLineClear',
        button_click: function(){
         var order = self.pos.get_order();
             var lines = jQuery.extend(true, {}, order['orderlines']['models']);

     //looping through each line
             $.each(lines, function(k, line){
             console.log(line);
             line.set_quantity('remove');
        });

        },
    });
    screens.define_action_button({
        'name': 'OrderLine_Clear',
        'widget': OrderLineClear,
    });



});

Thank you @jithesh for your answer, it helped me a lot. I think what the code has done is getting the orders and clean it from the POS screen? am I right?

If I would like to extend the POS module to add new order I have the information about it (as a dictionary) what can I do to accomplish this task?

Thank you again

Mina
on 5/16/18, 1:55 PM

hi, mina

i think you got little bit

it just gettting the order from orderline and and clearing order all orderline in one click

you just learn backbonejs,underscore js,jq you will get the idea

Socius, jithesh
on 5/17/18, 3:22 AM

Thanks, a lot Jithesh for your help

Mina
on 5/17/18, 6:44 AM
1
Sunny Dev
On 5/9/18, 2:30 AM

Hello Mina,

see this answer this will help you for customization in POS

 https://www.odoo.com/forum/help-1/question/odoo10-posticket-add-fields-130193#answer-130233

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.

Register

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)

Stats

Asked: 5/8/18, 6:53 AM
Seen: 395 times
Last updated: 5/16/18, 9:36 AM