Community mailing list archives

community@mail.odoo.com

how can i filter pos.order by the current user?

by
omar
- 09/24/2016 06:50:06
I added the following 3 fields on 'pos.order'      
pv_user=fields.Many2one("pos.config",compute="get_pv_use" ,  readonly=True,required=True)
pv_name=fields.Many2one("pos.config",compute="get_pv_name",  readonly=True, required=True)
pv_u_p=fields.Boolean(readonly=True,compute="get_pv_use", store=True, required=True)

the first field to get the point of sale for order,  the second field to get the point of sale for the current user, and the third field is of type boolean take the value 'True' if the 1st field = 2nd field or 2nd field = None and the value 'false' if not  
Here functions
@api.one
    def get_pv_name(self):
        self.pv_name=self.session_id.config_id.id
 

@api.one
    def get_pv_use(self):
        use=self.env['res.users']
        use_o=use.search([('id','=',self.env.user.id)])
        if use_o:
            for u in use_o:
                self.pv_user=u.pos_config.id
                if (self.env.user.id==self.user_id.id or self.pv_user==self.pv_name):
                    self.pv_u_p=True
                if (self.env.user.id==self.user_id.id and self.pv_user!=self.pv_name):
                    self.pv_u_p=False
                if (not self.env.user.pos_config):
                    self.pv_u_p=True



how I can filter the tree of 'pos.order' field with the 3rd field is true       domain=[('pv_u_p','=', True)]  ???????