Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
1450 มุมมอง

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

    }

}) 


how can I do this 



อวตาร
ละทิ้ง
ผู้เขียน

thanks it's working

คำตอบที่ดีที่สุด

Hello Ahmed,


Hope you're doing well.


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


Let me know if you need further clarification!


Thanks & Regards,

Baldev Bharvadiya

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
มี.ค. 24
5489
1
ก.ค. 23
2687
Can't close POS session แก้ไขแล้ว
1
ธ.ค. 22
3658
12
ก.ย. 21
25579
1
พ.ค. 17
4213