【发布时间】:2020-11-04 13:53:15
【问题描述】:
我想修改这个“减号按钮”,这样如果用户点击生成令牌,这个按钮就会被该订单禁用 简单来说,为他/她的订单生成令牌的用户不能删除他们当前的令牌。UI of POS with added widget
【问题讨论】:
标签: javascript odoo-13 point-of-sale
我想修改这个“减号按钮”,这样如果用户点击生成令牌,这个按钮就会被该订单禁用 简单来说,为他/她的订单生成令牌的用户不能删除他们当前的令牌。UI of POS with added widget
【问题讨论】:
标签: javascript odoo-13 point-of-sale
我想出了一些临时修复,但它不是解决方案:
好吧,基本上我做到了
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);
token 实际上在这里帮助为当前会话中的每个订单分配随机唯一编号 这只是对我的问题的临时修复,它还出现了一些新问题*例如“新订单按钮 [+ 签名按钮] 一键创建两个订单”。 *
对 odoo 来说是新手,对它的 javascript 来说是陌生的(不是普通的 javascript)
我每天都在开发模块以改进这一点。会更新 在为我的问题找到更持久的解决方案之后。建议、提示、意见和 非常感谢您的建议。
【讨论】: