I have created a model having a boolean field name configure_ok , when it is true a new page shows in product notebook page in which you can add a number of products. I have calculated the total cost of the products and want to update that cost to the sales price of product when field 'configure_ok' is true. But when 'configure_ok' is false the sale price should be as usual. I have tried lots of ways but cant get through it. So anyone have some idea then plese help me with the sample code. Thank you!!!
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ờ
2
Trả lời
3531
Lượt xem
Thanks Anatole ,
But its not the answer i am looking for i am asking to update the sales price of product in general information.
I have tried all of these but it always shows error. I have tried onchange, depends both but it not worked. If you have another idea please provide me. Thanks.
Hello,
I am not sure if this work but you can try :
configure_ok = fields.Boolean(string ="...", compute="_comp_total_price")
@api.depends('configure_ok')
def _comp_total_price(self):
if self.configure_ok:
self.total_price = # update price
You can also look for @api.onchange to do what you want.
I hope it help, good luck !
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 | |
---|---|---|---|---|
Chatter in models
Đã xử lý
|
|
1
thg 3 22
|
2532 | |
|
2
thg 1 21
|
4405 | ||
|
0
thg 3 24
|
1206 | ||
How to delete a website?
Đã xử lý
|
|
5
thg 9 24
|
52040 | |
|
1
thg 6 22
|
2925 |
Please share your code you are working on.
configure_ok = fields.Boolean(string='Can be Configured') this is the boolean field and its position in the xml view:<xpath expr="//label[@for='purchase_ok']" position="after">
<div name="options">
<field name = "configure_ok"/>
<label for = "configure_ok"/>
</div>
</xpath>
I have total field also that calculate the total price of the products by multiplying the sales price with the required quantity. I want to update this total price to sales price for this specific product pack only. How can i do that.