I'd like to know if there is a way that I could compute a boolean field to be true when a certain field of another model has the value of 0. Does anyone know how could this be done?. The exercise would be a boolean set in the sale.order object that depends on the behaviour of the amount_residual of the invoice of the respective sale, when the residual is equal 0, the boolean in sale.order should be set to true meaning that the sale has been closed.
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ờ
1
Trả lời
2793
Lượt xem
You can trigger to compute by the relations between the models by the Many2many field.
@api.depends(invoice_ids.amount_residual)
def _compute_bool(self):
...
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 6 22
|
3264 | ||
|
5
thg 3 24
|
18599 | ||
|
1
thg 1 25
|
3858 | ||
|
0
thg 5 22
|
2033 | ||
Odoo SH Change The Config File
Đã xử lý
|
|
1
thg 5 24
|
23610 |
As your first attempt, it can be:
When `amount_residual = 0`, you can search of its linked SO, via searching self.id in `invoice_ids` field of sale.order, if it exists in any you can set your boolean `is_closed = True`.
But search for better solution too I know there will be!
why do you need to wait for a flag? you can directly check the amount_residual is zero and set the sale to clossed.