[IMP] point_of_sale: adding a security pin field on users, and checking it when changing the cashier with very basic GUI
Conflicts: addons/point_of_sale/point_of_sale_view.xml addons/point_of_sale/res_users.py addons/point_of_sale/res_users_view.xml addons/point_of_sale/static/src/js/models.js
This commit is contained in:
committed by
Frédéric van der Essen
parent
54cff9e0ec
commit
a7616b809c
@@ -10,6 +10,7 @@ class res_users(osv.osv):
|
||||
_inherit = 'res.users'
|
||||
_columns = {
|
||||
'barcode' : fields.char('Barcode', help="BarCode", oldname='ean13'),
|
||||
'pos_security_pin': fields.char('Security PIN',size=32, help='A Security PIN used to protect sensible functionality in the Point of Sale'),
|
||||
'pos_config' : fields.many2one('pos.config', 'Default Point of Sale', domain=[('state', '=', 'active')]),
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
<group>
|
||||
<field name="pos_config" />
|
||||
<field name="barcode" />
|
||||
<field name="pos_security_pin" />
|
||||
<button name="%(action_edit_ean)d" type="action" string="Set a Custom EAN" class="oe_edit_only" />
|
||||
</group>
|
||||
</page>
|
||||
|
||||
@@ -166,7 +166,7 @@ function openerp_pos_models(instance, module){ //module is instance.point_of_sal
|
||||
}
|
||||
},{
|
||||
model: 'res.users',
|
||||
fields: ['name','barcode'],
|
||||
fields: ['name','pos_security_pin','barcode'],
|
||||
domain: null,
|
||||
loaded: function(self,users){ self.users = users; },
|
||||
},{
|
||||
|
||||
@@ -605,12 +605,32 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa
|
||||
'message': _t('Change Cashier'),
|
||||
list: list,
|
||||
confirm: function(cashier){
|
||||
this.pos.cashier = cashier;
|
||||
self.renderElement();
|
||||
self.set_cashier(cashier);
|
||||
},
|
||||
});
|
||||
|
||||
},
|
||||
set_cashier: function(cashier){
|
||||
var self = this;
|
||||
if (cashier.pos_security_pin) {
|
||||
this.pos_widget.screen_selector.show_popup('password',{
|
||||
'message': _t('Password'),
|
||||
confirm: function(password) {
|
||||
if (password === cashier.pos_security_pin) {
|
||||
self.pos.cashier = cashier;
|
||||
self.renderElement();
|
||||
} else {
|
||||
this.pos_widget.screen_selector.show_popup('error',{
|
||||
'message':_t('Password Incorrect'),
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
} else {
|
||||
this.pos.cashier = cashier;
|
||||
this.renderElement();
|
||||
}
|
||||
},
|
||||
get_name: function(){
|
||||
var user = this.pos.cashier || this.pos.user;
|
||||
if(user){
|
||||
|
||||
Reference in New Issue
Block a user