Hello!
Did you ever find yourself to be in a place where you got an external module to work but it is taking way too much of time to activate / or get installed?
what to do in this situation ?
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,
If the module is adding any stored compute field to any of the existing model, which has a huge data, this issue will be happening, it is the time taken for computing and storing the value.
To confirm if this is what happening with you, you can check and see the odoo log, it will be something like "Storing value............" in the log.
In order to speed up this, you have to add the field to the db table from the auto_init and set the needed value for the field.
Example:
def _auto_init(self):
"""
Create column to stop ORM from computing it himself (too slow)
"""
if not column_exists(self.env.cr, 'sale_order_line', 'is_service'):
create_column(self.env.cr, 'sale_order_line', 'is_service', 'bool')
self.env.cr.execute("""
UPDATE sale_order_line line
SET is_service = (pt.type = 'service')
FROM product_product pp
LEFT JOIN product_template pt ON pt.id = pp.product_tmpl_id
WHERE pp.id = line.product_id
""")
return super()._auto_init()
Thanks
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 | |
---|---|---|---|---|
|
2
thg 7 20
|
4352 | ||
|
1
thg 1 20
|
2872 | ||
Creating module problem
Đã xử lý
|
|
1
thg 12 19
|
3126 | |
|
0
thg 2 16
|
4376 | ||
|
2
thg 3 15
|
8443 |