For example, how do we aggregate the records of invoices from account.move and records of expenses from hr.expense to a new different model model.new.
The goal is to be able to access these records and create report tables/charts...
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
For example, how do we aggregate the records of invoices from account.move and records of expenses from hr.expense to a new different model model.new.
The goal is to be able to access these records and create report tables/charts...
Thanks Niyas Raphy for the support, the video answered it but one need to make some edit for newer Odoo version. Here is my working test code.
product_id = fields.Many2one('product.product')
invoice_date = fields.Date()
@api.model
def init(self):
tools.drop_view_if_exists(self.env.cr, 'cashflow_actual')
self.env.cr.execute(""" CREATE OR REPLACE VIEW cashflow_actual AS (
SELECT row_number() OVER () AS id, aml.product_id, am.invoice_date
FROM account_move_line aml
LEFT JOIN account_move am ON (am.id = aml.move_id)
)
""")
Hi,
You can go through this video, which explains about the db view: Create Model/DB View Using Query In Odoo || Combine Multiple Model Into One Model
Thanks
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 | |
---|---|---|---|---|
|
3
thg 8 25
|
2597 | ||
|
1
thg 5 25
|
2633 | ||
|
1
thg 4 25
|
3622 | ||
|
1
thg 4 25
|
4488 | ||
|
1
thg 4 25
|
1954 |