I need to show the product cost on the order line so that product unit price can be adjusted during the sales order creation. In what way I can achieve it in odoo 15.
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ờ
You can do it by adding the cost(Any name you want to give) field in the sale order line by inheriting the 'sale.order.line'.
And write onchnage on the product_id field i.e. When a product is changed product
field data is automatically added in the field you defined.
Hello, Sidharth Soman
I hope you are doing great.
You can add cost(Any name you want to give) field in the sale order line by inherit the 'sale.order.line'. And write onchnage on the product i.e. When product is changed product cost will automatically added in the field you defined(Here it is cost).
Find codein Comment.
I hope this will help you.
Thanks & Regards,
Email: odoo@aktivsoftware.com
Skype: kalpeshmaheshwari
--> (.py) Inherit sale order line
class SaleOrderLine(models.Model):
_inherit = 'sale.order.line'
cost = fields.Float()
@api.onchange('product_id')
def onchange_product(self):
self.cost = self.product_id.standard_price
--> (xml) Put that field in view of order line.
<odoo>
<record id="sale_order_inherit_form" model="ir.ui.view">
<field name="name">sale.order.inherit.form</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form" />
<field name="arch" type="xml">
<xpath expr="//page[@name='order_lines']//tree//field[@name='name']" position="after">
<field name="cost"/>
</xpath>
</field>
</record>
</odoo>
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 | |
---|---|---|---|---|
|
1
thg 5 22
|
1971 | ||
|
1
thg 9 25
|
2336 | ||
|
1
thg 6 25
|
2371 | ||
|
3
thg 7 25
|
3844 | ||
|
1
thg 5 25
|
1965 |
First of all, thank you. Is there any way we con do this without writing code.