[IMP] point_of_sale: add a configuration option to enable invoicing from the Point of Sale (enabled by default)
bzr revid: fva@openerp.com-20130411122250-aju5cl91wduj2bj0
This commit is contained in:
@@ -63,6 +63,7 @@ class pos_config(osv.osv):
|
||||
'iface_electronic_scale' : fields.boolean('Electronic Scale Interface'),
|
||||
'iface_vkeyboard' : fields.boolean('Virtual KeyBoard Interface'),
|
||||
'iface_print_via_proxy' : fields.boolean('Print via Proxy'),
|
||||
'iface_invoicing': fields.boolean('Invoicing',help='Enables invoice generation from the Point of Sale'),
|
||||
|
||||
'state' : fields.selection(POS_CONFIG_STATE, 'Status', required=True, readonly=True),
|
||||
'sequence_id' : fields.many2one('ir.sequence', 'Order IDs Sequence', readonly=True,
|
||||
@@ -121,6 +122,7 @@ class pos_config(osv.osv):
|
||||
'shop_id': _default_shop,
|
||||
'journal_id': _default_sale_journal,
|
||||
'group_by' : True,
|
||||
'iface_invoicing': True,
|
||||
}
|
||||
|
||||
def set_active(self, cr, uid, ids, context=None):
|
||||
|
||||
@@ -790,6 +790,7 @@
|
||||
<field name="iface_self_checkout" />
|
||||
<field name="iface_cashdrawer" />
|
||||
<field name="iface_payment_terminal" />
|
||||
<field name="iface_invoicing" />
|
||||
</group>
|
||||
<group>
|
||||
<field name="iface_electronic_scale" />
|
||||
|
||||
@@ -160,7 +160,7 @@ function openerp_pos_models(instance, module){ //module is instance.point_of_sal
|
||||
['name','journal_ids','shop_id','journal_id',
|
||||
'iface_self_checkout', 'iface_led', 'iface_cashdrawer',
|
||||
'iface_payment_terminal', 'iface_electronic_scale', 'iface_barscan', 'iface_vkeyboard',
|
||||
'iface_print_via_proxy','iface_cashdrawer','state','sequence_id','session_ids'],
|
||||
'iface_print_via_proxy','iface_cashdrawer','iface_invoicing','state','sequence_id','session_ids'],
|
||||
[['id','=', self.get('pos_session').config_id[0]]]
|
||||
);
|
||||
}).then(function(configs){
|
||||
@@ -171,6 +171,7 @@ function openerp_pos_models(instance, module){ //module is instance.point_of_sal
|
||||
self.iface_vkeyboard = !!pos_config.iface_vkeyboard;
|
||||
self.iface_self_checkout = !!pos_config.iface_self_checkout;
|
||||
self.iface_cashdrawer = !!pos_config.iface_cashdrawer;
|
||||
self.iface_invoicing = !!pos_config.iface_invoicing;
|
||||
|
||||
return self.fetch('sale.shop',[],[['id','=',pos_config.shop_id[0]]]);
|
||||
}).then(function(shops){
|
||||
|
||||
@@ -843,7 +843,9 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa
|
||||
//
|
||||
// But since the print dialog also blocks the other asynchronous calls, the
|
||||
// button enabling in the setTimeout() is blocked until the printing dialog is
|
||||
// closed. But this is not reliable ... if the timeout is too slow it doesn't work
|
||||
// closed. But the timeout has to be big enough or else it doesn't work
|
||||
// 2 seconds is the same as the default timeout for sending orders and so the dialog
|
||||
// should have appeared before the timeout... so yeah that's not ultra reliable.
|
||||
|
||||
finish_button.set_disabled(true);
|
||||
setTimeout(function(){
|
||||
@@ -898,7 +900,7 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa
|
||||
|
||||
this.set_numpad_state(this.pos_widget.numpad.state);
|
||||
|
||||
this.back_button = this.add_action_button({
|
||||
this.add_action_button({
|
||||
label: 'Back',
|
||||
icon: '/point_of_sale/static/src/img/icons/png48/go-previous.png',
|
||||
click: function(){
|
||||
@@ -906,7 +908,7 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa
|
||||
},
|
||||
});
|
||||
|
||||
this.validate_button = this.add_action_button({
|
||||
this.add_action_button({
|
||||
label: 'Validate',
|
||||
name: 'validation',
|
||||
icon: '/point_of_sale/static/src/img/icons/png48/validate.png',
|
||||
@@ -914,15 +916,17 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa
|
||||
self.validateCurrentOrder();
|
||||
},
|
||||
});
|
||||
|
||||
this.invoice_button = this.add_action_button({
|
||||
label: 'Invoice',
|
||||
name: 'invoice',
|
||||
icon: '/point_of_sale/static/src/img/icons/png48/invoice.png',
|
||||
click: function(){
|
||||
self.validateCurrentOrder({invoice: true});
|
||||
},
|
||||
});
|
||||
|
||||
if(this.pos.iface_invoicing){
|
||||
this.add_action_button({
|
||||
label: 'Invoice',
|
||||
name: 'invoice',
|
||||
icon: '/point_of_sale/static/src/img/icons/png48/invoice.png',
|
||||
click: function(){
|
||||
self.validateCurrentOrder({invoice: true});
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
this.updatePaymentSummary();
|
||||
this.line_refocus();this
|
||||
|
||||
Reference in New Issue
Block a user