Odoo 销售员订单限制
Odoo Salesperson Orders restrict
我希望销售人员只能看到他创建的订单,而不是每个订单我想将其限制为他创建的记录
'''
<record model="ir.module.category" id="module_category_flexipharmacy">
<field name="name">Flexipharmacy</field>
<field name="description">Select if salesperson or owner.</field>
</record>
<record id="group_flexipharmacy_salesperson" model="res.groups">
<field name="name">Salesperson</field>
<field name="category_id" ref="module_category_flexipharmacy"/>
</record>
<record model="ir.rule" id="salesperson_view">
<field name="name">Salesperson own order</field>
<field name="model_id" ref="model_pos_order"/>
<field name="domain_force">[('user_id', '=', 'user.id')]</field>
<field name="groups" eval="[(4, ref('group_flexipharmacy_salesperson'))]"/>
</record>
'''
现在执行此操作后,我的 pos 订单中没有任何记录都被隐藏了
这是 python 部分中的“user_id”:-
user_id = fields.Many2one( comodel_name='res.users', string='Salesperson', help="Person who uses the cash register. It can be a reliever, a student or an interim employee.", default=lambda self: self.env.uid, states={'done': [('readonly', True)], 'invoiced': [('readonly', True)]}, )
<record model="ir.rule" id="salesperson_view">
<field name="name">Salesperson own order</field>
<field name="model_id" ref="model_pos_order"/>
<field name="domain_force">[('user_id', '=', user.id)]</field>
<field name="groups" eval="[(4, ref('group_flexipharmacy_salesperson'))]"/>
</record>
我希望销售人员只能看到他创建的订单,而不是每个订单我想将其限制为他创建的记录
'''
<record model="ir.module.category" id="module_category_flexipharmacy">
<field name="name">Flexipharmacy</field>
<field name="description">Select if salesperson or owner.</field>
</record>
<record id="group_flexipharmacy_salesperson" model="res.groups">
<field name="name">Salesperson</field>
<field name="category_id" ref="module_category_flexipharmacy"/>
</record>
<record model="ir.rule" id="salesperson_view">
<field name="name">Salesperson own order</field>
<field name="model_id" ref="model_pos_order"/>
<field name="domain_force">[('user_id', '=', 'user.id')]</field>
<field name="groups" eval="[(4, ref('group_flexipharmacy_salesperson'))]"/>
</record>
'''
现在执行此操作后,我的 pos 订单中没有任何记录都被隐藏了
这是 python 部分中的“user_id”:-
user_id = fields.Many2one( comodel_name='res.users', string='Salesperson', help="Person who uses the cash register. It can be a reliever, a student or an interim employee.", default=lambda self: self.env.uid, states={'done': [('readonly', True)], 'invoiced': [('readonly', True)]}, )
<record model="ir.rule" id="salesperson_view">
<field name="name">Salesperson own order</field>
<field name="model_id" ref="model_pos_order"/>
<field name="domain_force">[('user_id', '=', user.id)]</field>
<field name="groups" eval="[(4, ref('group_flexipharmacy_salesperson'))]"/>
</record>