This question has been flagged
2 Replies
4410 Views

Hi Gurus

Could someone knowledgeable in JavaScript guide me on how to make bolean (check box) to enable or disable Point of sales from operating in offline mode in Odoo 8

Probably like disabling payment validation button if pos connection status is disconnected.

Thank you.

Avatar
Discard
Author Best Answer

Hi Party,

I sincerely appreciate your fast response. Please, where can I do the overidde or how to run the code you gave for the effect to take place?

Thank you again

This module has solved my worries.

https://www.odoo.com/apps/modules/10.0/pos_offline_restrict/

Avatar
Discard

Hello, You can create a separate module for this, or if you want to edit the existing code you can do it some what here : https://github.com/odoo/odoo/blob/8.0/addons/point_of_sale/static/src/js/screens.js#L1265

Actully my code was targeted the v10/v11 but i guess i should also work with 8.0 with some small changes. Thanks!

Hi Parth,
Thank you a lot.

Am having serious issue with pos receipt here. We made a custom code that make duplicate copies of pos receipt but when sent to thermal printer all the three copies comes on page but break into three sections.

My objective is to cut each page break automatically by the printer.

Thanks again

On Mon, Feb 26, 2018 at 8:27 AM, Parth Patel (pat) <pat@odoo.com> wrote:

Hello, You can create a separate module for this, or if you want to edit the existing code you can do it some what here : https://github.com/odoo/odoo/blob/8.0/addons/point_of_sale/static/src/js/screens.js#L1265

Actully my code was targeted the v10/v11 but i guess i should also work with 8.0 with some small changes. Thanks!



Sent by Tiny ERP Pvt Ltd using Odoo.


Hi Parth,
Thank you a lot.

Am having serious issue with pos receipt here. We made a custom code that make duplicate copies of pos receipt but when sent to thermal printer all the three copies comes on one paper sheet but break into three sections.

My objective is to cut each page break automatically by the printer.

Thanks again

On Mon, Feb 26, 2018 at 9:39 AM, Daniel Attah <netwaytech@gmail.com> wrote:
Hi Parth,
Thank you a lot.

Am having serious issue with pos receipt here. We made a custom code that make duplicate copies of pos receipt but when sent to thermal printer all the three copies comes on page but break into three sections.

My objective is to cut each page break automatically by the printer.

Thanks again

On Mon, Feb 26, 2018 at 8:27 AM, Parth Patel (pat) <pat@odoo.com> wrote:

Hello, You can create a separate module for this, or if you want to edit the existing code you can do it some what here : https://github.com/odoo/odoo/blob/8.0/addons/point_of_sale/static/src/js/screens.js#L1265

Actully my code was targeted the v10/v11 but i guess i should also work with 8.0 with some small changes. Thanks!



Sent by Tiny ERP Pvt Ltd using Odoo.



My suggestion would be to try to put this

https://github.com/odoo/odoo/blob/8.0/addons/point_of_sale/static/src/js/screens.js#L1346-L1348

code into loop (no of time you want the receipt).

I hope am not bothering you much.
Please help me with sample on what to do because I don't have knowledge of JavaScript. Thank you for your time.

On Feb 26, 2018 11:16 AM, "Parth Patel (pat)" <pat@odoo.com> wrote:

My suggestion would be to try to put this

https://github.com/odoo/odoo/blob/8.0/addons/point_of_sale/static/src/js/screens.js#L1346-L1348

code into loop (no of time you want the receipt).



Sent by Tiny ERP Pvt Ltd using Odoo.

Best Answer

Hello, Daniel John

POS Connection Status got refreshes when the order try to save on server. So, just for the first time, you won't be able to know that the connection is alive or not unless you create the method to check the connection with a server. 

For the immediate second order, you can override the order_validate method and check the connection like this :

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

var PaymentScreen = screens.PaymentScreenWidget.include({

validate_order: function(force_validation) {

        if (this.pos.get('synch').state === 'connected') {

            if (this.order_is_valid(force_validation)) {

    this.finalize_validation();

    }

        } else {

            // Throw Error        

        }

});

And yes, we can active/deactivate this condition with an extra field in POS Config.

Hope this helps you. Cheers!

Avatar
Discard