I would like the admin to be the only one able to change product price
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Kế toán
- Tồn kho
- PoS
- Project
- MRP
Câu hỏi này đã bị gắn cờ
Hi Paceli,
You can follow these steps to achieve the desired functionality:
- Create a new compute field to check if the user has Sales Manager rights:
user_has_group_sale_manager = fields.Boolean(compute='_compute_user_has_group_sale_manager')
@api.depends_context('uid')
def _compute_user_has_group_sale_manager(self):
user_has_group_sale_manager = self.env.user.has_group('sales_team.group_sale_manager')
for sales in self:
sales.user_has_group_sale_manager = user_has_group_sale_manager
- Inherit the sale order form view:
<record id="view_order_form" model="ir.ui.view">
<field name="name">sale.order.form.view.for.unit.price</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='price_unit']" position="before">
<field name="user_has_group_sale_manager" invisible="1"/>
</xpath>
<xpath expr="//page[@name='order_lines']//field[@name='order_line']//tree//field[@name='price_unit']" position="attributes">
<attribute name="readonly">not user_has_group_sale_manager</attribute>
</xpath>
</field>
</record>
- Upgrade or install the custom module and check if this achieves the required functionality.
Bạn có hứng thú với cuộc thảo luận không? Đừng chỉ đọc, hãy tham gia nhé!
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng kýBài viết liên quan | Trả lời | Lượt xem | Hoạt động | |
---|---|---|---|---|
|
0
thg 3 15
|
3436 | ||
|
0
thg 7 23
|
1674 | ||
|
0
thg 2 23
|
1438 | ||
|
1
thg 4 25
|
2047 | ||
|
3
thg 2 25
|
1690 |