admin管理员组文章数量:1399347
I make some user option and I want to read it from POS screen in version 18
this is my code
class PosSession(models.Model):
_inherit = 'pos.session'
def _load_pos_data(self, data):
res = super(PosSession, self)._load_pos_data(data)
res['hide_product_information'] = self.env.user.hide_product_information
return res
and I want to read it from JavaScript level from the product screen with this code
patch(ProductScreen.prototype, {
async onProductInfoClick(product) {
// here
}
})
Please can any one help me in this,
I make some user option and I want to read it from POS screen in version 18
this is my code
class PosSession(models.Model):
_inherit = 'pos.session'
def _load_pos_data(self, data):
res = super(PosSession, self)._load_pos_data(data)
res['hide_product_information'] = self.env.user.hide_product_information
return res
and I want to read it from JavaScript level from the product screen with this code
patch(ProductScreen.prototype, {
async onProductInfoClick(product) {
// here
}
})
Please can any one help me in this,
Share Improve this question edited Mar 27 at 7:44 Stefan - brox IT-Solutions 2,2856 silver badges16 bronze badges asked Mar 27 at 1:44 ahmed mohamadyahmed mohamady 3601 gold badge7 silver badges30 bronze badges1 Answer
Reset to default 0I think I found the solution
To make the 'hide_product_information' field accessible on the Product screen, you can use the following approach:
class ResUsers(models.Model):
_inherit = 'res.users'
hide_product_information = fields.Boolean()
@api.model
def _load_pos_data_fields(self, config_id):
res = super()._load_pos_data_fields(config_id)
res += ['hide_product_information']
return res
After restarting the server, you can access the 'hide_product_information' field using:
this.pos.config.current_user_id.hide_product_information
Thanks & Regards, for every one.
本文标签: javascriptHow to get the session data in POS screen in odoo 18Stack Overflow
版权声明:本文标题:javascript - How to get the session data in POS screen in odoo 18 - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744117041a2591562.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论