Ich hoffe, Sie könnten mir helfen, ich benutze bereits odoo. V8, nun arbeite ich über Point of Sale-Modul, und ich tring, einige Methoden zum Drucken erben, war alles bis gut, wenn ich validate_order neu definieren bekomme ich diesen Fehler auf Client-Seite:Client ODOO Fehler: QWeb ist nicht definiert
`Funktion openerp_tpv_screens (zB Modul) {:
Uncaught ReferenceError: QWeb is not defined
dies mein Code ist, wie ich validate_order Methode neu zu definieren var Qweb = instance.web.qweb; var _t = instance.web._t;
module.PaymentScreenWidget=module.PaymentScreenWidget.extend({
validate_order: function(options) {
var self = this;
options = options || {};
var currentOrder = this.pos.get('selectedOrder');
if(currentOrder.get('orderLines').models.length === 0){
this.pos_widget.screen_selector.show_popup('error',{
'message': _t('Empty Order'),
'comment': _t('There must be at least one product in your order before it can be validated'),
});
return;
}
var plines = currentOrder.get('paymentLines').models;
for (var i = 0; i < plines.length; i++) {
if (plines[i].get_type() === 'bank' && plines[i].get_amount() < 0) {
this.pos_widget.screen_selector.show_popup('error',{
'message': _t('Negative Bank Payment'),
'comment': _t('You cannot have a negative amount in a Bank payment. Use a cash payment method to return money to the customer.'),
});
return;
}
}
if(!this.is_paid()){
return;
}
// The exact amount must be paid if there is no cash payment method defined.
if (Math.abs(currentOrder.getTotalTaxIncluded() - currentOrder.getPaidTotal()) > 0.00001) {
var cash = false;
for (var i = 0; i < this.pos.cashregisters.length; i++) {
cash = cash || (this.pos.cashregisters[i].journal.type === 'cash');
}
if (!cash) {
this.pos_widget.screen_selector.show_popup('error',{
message: _t('Cannot return change without a cash payment method'),
comment: _t('There is no cash payment method available in this point of sale to handle the change.\n\n Please pay the exact amount or add a cash payment method in the point of sale configuration'),
});
return;
}
}
if (this.pos.config.iface_cashdrawer) {
this.pos.proxy.open_cashbox();
}
if(options.invoice){
// deactivate the validation button while we try to send the order
this.pos_widget.action_bar.set_button_disabled('validation',true);
this.pos_widget.action_bar.set_button_disabled('invoice',true);
this.pos_widget.action_bar.set_button_disabled('invoice_03',true);
var invoiced = this.pos.push_and_invoice_order(currentOrder);
invoiced.fail(function(error){
if(error === 'error-no-client' || error === 'error-generic-client'){
self.pos_widget.screen_selector.show_popup('error',{
message: _t('An anonymous order cannot be invoiced'),
comment: _t('Please select a client for this order. This can be done by clicking the order tab'),
});
}else if(error === 'error-no-generic-client'){
self.pos_widget.screen_selector.show_popup('error',{
message: _t('An anonymous order cannot be invoiced'),
comment: _t('No se debe seleccionar un Cliente Genérico.'),
});
}else{
self.pos_widget.screen_selector.show_popup('error',{
message: _t('The order could not be sent'),
comment: _t('Check your internet connection and try again.'),
});
}
self.pos_widget.action_bar.set_button_disabled('validation',false);
self.pos_widget.action_bar.set_button_disabled('invoice',false);
self.pos_widget.action_bar.set_button_disabled('invoice_03',false);
});
invoiced.done(function(){
self.pos_widget.action_bar.set_button_disabled('validation',false);
self.pos_widget.action_bar.set_button_disabled('invoice',false);
self.pos_widget.action_bar.set_button_disabled('invoice_03',false);
self.pos.get('selectedOrder').destroy();
});
}else{
this.pos.push_order(currentOrder)
if(this.pos.config.iface_print_via_proxy){
var receipt = currentOrder.export_for_printing();
this.pos.proxy.print_receipt(QWeb.render('XmlReceipt',{
receipt: receipt, widget: self,
}));
this.pos.get('selectedOrder').destroy(); //finish order and go back to scan screen
}else{
this.pos_widget.screen_selector.set_current_screen(this.next_screen);
}
}
// hide onscreen (iOS) keyboard
setTimeout(function(){
document.activeElement.blur();
$("input").blur();
},250);
},
}); `
die spezifische Zeile, die mir den Fehler geben ist:
this.pos.proxy.print_receipt(QWeb.render('XmlReceipt',{ receipt: receipt, widget: self, }));
Qweb ist nicht definiert ist der Fehler aber ich tat es: var Qweb = instance.web.qweb;
Danke für Ihre Zeit.
Ich definiere keine neue Vorlage, die Vorlage, die diese Funktion versucht zu benennen, existierte bereits, ich füge einfach eine neue Schaltfläche und einige Validierungen in diese Funktion ein, sogar a ändere nicht die Zeile wo 'QWeb.render' ist. –
Sie haben die Vorlage geändert, indem Sie sie geerbt oder in der Basis geändert haben? –
Wie ich sage: "Ich verwende oder definiere keine Vorlagen, ich überschreibe einfach .js Dateien. –