margin-right: 4px;
}
-.pos .control-button.highlight{
- background: #6EC89B;
- border: solid 1px #6EC89B;
- color: white;
+.pos .control-button.highlight,
+.pos .button.highlight {
+ background: #6EC89B !important;
+ border: solid 1px #6EC89B !important;
+ color: white !important;
}
.pos .control-button:active {
background: #7F82AC;
this.receipt_type = 'receipt'; // 'receipt' || 'invoice'
this.temporary = attributes.temporary || false;
this.sequence_number = this.pos.pos_session.sequence_number++;
+ this.to_invoice = false;
return this;
},
is_empty: function(){
}
}
},
+ set_to_invoice: function(to_invoice) {
+ this.to_invoice = to_invoice;
+ },
+ is_to_invoice: function(){
+ return this.to_invoice;
+ },
// remove all the paymentlines with zero money in it
clean_empty_paymentlines: function() {
var lines = this.get('paymentLines').models;
});
return methods;
},
+ click_invoice: function(){
+ var order = this.pos.get_order();
+ order.set_to_invoice(!order.is_to_invoice());
+ if (order.is_to_invoice()) {
+ this.$('.js_invoice').addClass('highlight');
+ } else {
+ this.$('.js_invoice').removeClass('highlight');
+ }
+ },
renderElement: function() {
var self = this;
this._super();
});
this.$('.js_invoice').click(function(){
- self.validate_order({invoice: true});
+ self.click_invoice();
});
},
},
// Check if the order is paid, then sends it to the backend,
// and complete the sale process
- validate_order: function(options) {
+ validate_order: function() {
var self = this;
- options = options || {};
var order = this.pos.get_order();
this.pos.proxy.open_cashbox();
}
- if (options.invoice) {
+ if (order.is_to_invoice()) {
var invoiced = this.pos.push_and_invoice_order(order);
this.invoicing = true;
invoiced.fail(function(error){
self.invoicing = false;
if (error === 'error-no-client') {
- self.pos_widget.screen_selector.set_current_screen('clientlist');
+ self.pos_widget.screen_selector.show_popup('confirm',{
+ message: _t('Please select the Customer'),
+ comment: _t('You need to select the customer before you can invoice an order.'),
+ confirm: function(){
+ self.pos_widget.screen_selector.set_current_screen('clientlist');
+ },
+ });
} else {
self.pos_widget.screen_selector.show_popup('error-invoice-transfer');
}