1 回答

TA貢獻1824條經驗 獲得超5個贊
我想出了一些臨時修復方案,但這不是解決方案:
好的,基本上我就是這么做的
PosBaseWidget.include({
init: function(parent, options) {
this._super(parent, options);
},
get_order_by_uid: function(uid) {
var orders = this.pos.get_order_list();
for (var i = 0; i < orders.length; i++) {
if (orders[i].uid === uid) {
// this.pos.get_order().token_number=Token;
return orders[i];
}
}
return undefined;
},
deleteorder_click_handler: function(event, $el) {
var self = this;
var order = this.pos.get_order();
if (!order) {
return;
} else if ( !order.is_empty() ){
this.gui.show_popup('confirm',{
'title': _t('Destroy Current Order ?'),
'body': _t('You will lose any data associated with the current order'),
confirm: function(){
self.pos.delete_current_order();
},
});
} else {
this.pos.delete_current_order();
}
},
renderElement: function(){
var self = this;
this._super();
this.$('.order-button.select-order').click(function(event){
});
this.$('.neworder-button').click(function(event){
self.neworder_click_handler(event,$(this));
});
this.$('.deleteorder-button').click(function(event){
if(Token == null )
{
self.deleteorder_click_handler(event,$(this));
}
else
{
self.neworder_click_handler(event,$(this));
this.pos.get_order().order_progress="In progress";
}
});
}
});
where
var PosBaseWidget = require('point_of_sale.BaseWidget');
var Token = Math.floor((Math.random() * 1000) + 1000);
令牌實際上在這里幫助為當前會話中的每個訂單分配隨機唯一編號,這只是對我的問題的臨時解決方案,并且還產生了一些新問題*例如“新訂單按鈕[+簽名按鈕]一鍵創建兩個訂單”。*
作為 odoo 的新手,對其 javascript 來說是陌生的(不是常規的 javascript )
我每天都在開發模塊來改進這一點。在找到對我的問題更持久的解決方案后將進行更新。非常感謝建議、提示、意見和建議。
添加回答
舉報