Odoo Help

0

0
1 Answer
1
Avatar

Niyas Raphy

--Niyas Raphy--
24580
| 7 7 11
Wayanad, Kerala, India
--Niyas Raphy--

Odoo Techno Functionalist

Feel free to connect :  niyasraphyk@gmail.com

Twitter:https://twitter.com/niyasraphy
LinkedIn: https://www.linkedin.com/in/niyasraphy/
FB:https://www.facebook.com/niyasraphy123

Happy to help :)

Niyas Raphy
30/05/19 03.02

Hi,

You can load XML from  __manifest__.py file

'qweb': ['static/src/xml/*.xml'],


then, custom_pos.xml


<?xml version="1.0" encoding="utf-8"?>
<templates id="template" xml:space="preserve">
<t t-extend="PaymentScreenWidget">
<t t-jquery="t[t-if='widget.pos.config.module_account']" t-operation="after">
<div class='button js_custom_print'>
<i class='fa fa-print' /> Custom Print
</div>
</t>
</t>
</templates>

load JS :-
<?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/static/src/js/pos_test.js"/>
</xpath>
</template>
</data>
</odoo>

JS File:

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

var models = require('point_of_sale.models');
var core = require('web.core');
var screens = require('point_of_sale.screens');
var Widget = require('web.Widget');

var ajax = require('web.ajax');

var qweb = core.qweb;

screens.PaymentScreenWidget.include({
renderElement: function() {
var self = this;
this._super();
this.$('.js_custom_print').click(function(){
self.click_custom_print();
});
},
click_custom_print: function(){
var order = this.pos.get_order();
console.log("order")
// Render receipt screen and can print function

}
});

});

Thanks
4 Comments
LaoThai
30/05/19 03.10

Hi Niyas,

If my custom_pos.xml update like exaclty what you say, my custom button didnt show.

LaoThai
30/05/19 03.15

Hi Niyas,

I solve that problem, can you spend a little time to help me about this?

Niyas Raphy
30/05/19 10.34

yes tell me

LaoThai
30/05/19 10.45

My custom button will have exactly what "Print Receipt" button do ( in Validate screens ). So that, Can I write js code the same with that "Print Receipt" button?

Ask a Question
Writer
Keep Informed
1 follower(s)
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 eLearning platform and experience all Odoo Apps through learning videos, use cases and quizzes.

Test it now