Odoo POS Pop Ups

In odoo retailers will be mostly concentrating on POS because that minimizes their effort to more extreme,….

Now on developer side it is tough work to customize that pos.. since it is collaboration of js, jquery with python…  Some times head ache..😛:) ..

No problem now we will see how to create a pop up in odoo POS,,,,

For this you need some basic knowledge in

1) js, jquery

2)python

3)odoo qweb widgets

Now we are going to create a popup asking name to enter in pos….

create a module in odoo.. with init and openerp file…

Now normally on creation of wizard we used to create a form for pop right.. like that create one as below..

create model.py file with following code:

from openerp import api, fields, models
from openerp.osv import osv

class pos_model(models.Model):
_name = ‘pos.popup’

name=fields.Char(‘Name’,size=30,required=True)

def okay_refresh(self,cr,uid,ids,context=None):

return{

‘type’:’ir.actions.client’,

‘tag’:’reload’,

}

view.xml file has this:

<?xml version=”1.0″ encoding=”utf-8″?>
<openerp>
<data>
<record model=”ir.actions.act_window” id=”create_pop_up”>
<field name=”name”>Pop up</field>
<field name=”res_model”>pos.popup</field>
<field name=”view_mode”>form</field>
</record>

<record id=”create_pop_form” model=”ir.ui.view”>
<field name=”name”>Pop up</field>
<field name=”model”>pos.popup</field>
<field name=”type”>form</field>
<field name=”arch” type=”xml”>
<form string=”Pop up” version=”7.0″>

<br />
<h2>Enter the name:</h2>
<br /><br />
<label for=”name” style=”clear:left;text-align:right;padding-right:10px;float:left;padding-left:5em “/>
<field name=”name” nolable=”1″ style=”float:left;padding-left:5em “/><br /><br />

<br />
<br />

</form>
</field>
</record>

Now its turn for POS module change..

TO add button to POS.. create static–>src–>xml–>pop_up.xml

<?xml version=”1.0″ encoding=”UTF-8″?>
<template id=”payment_screen”>
<t t-extend=”PosWidget”>

<t t-jquery=”div.pos-branding” t-operation=”inner”>
<button class=”popup-misc” style=”position:absolute;left:300px; top:7px;width: 100px; height: 37px; font-size:15px;”>Name popup</button>
</t>
</t>

</template>

Now create a file static–>src–>js–>pos_pop.js

in that paste it

openerp.module_name = function(instance){

var module = instance.point_of_sale; 
var QWeb = instance.web.qweb;

module.PosWidget.include({
build_widgets: function(){
var self = this;
this._super();

this.$el.find(‘.popup-misc’).click(function(){
self.do_action({
type: ‘ir.actions.act_window’,
res_model: “pos.popup”,

views: [[false, ‘form’]],
target: ‘new’,
context: {},

});

});

}
});

};

create a file template.xml in that paste the following code

<openerp>
<data>

<template id=”assets_frontend” inherit_id=”web.assets_common”>
<xpath expr=”.” position=”inside”>

/module_name/static/src/js/pos_pop.js
</xpath>
</template>

</data>
</openerp>

This will add your js to odoo frond end..

Finally add all the xml files in _openerp__.py…

Thats it.. popup is now okay…. Ping me if you get any dout or any suggestions…

Thank you…:)

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s