Sub project alias changed

This commit is contained in:
projectsodoo 2021-02-25 10:30:25 +05:30
parent d155133125
commit 4c4f5d94a6
2 changed files with 13 additions and 13 deletions

View File

@ -39,10 +39,10 @@ class BudgetAmtAnalysis(models.Model):
tools.drop_view_if_exists(self._cr, self._table)
self._cr.execute("""
CREATE OR REPLACE VIEW %s AS (
SELECT ROW_NUMBER() OVER() as id, project_id, parent_project, start_date, end_date, timesheet_date, partner_id, employee_id, amount_type, pricing_type, project_type, revenue from (
SELECT ROW_NUMBER() OVER() as id, project_id, parentproject as parent_project, start_date, end_date, timesheet_date, partner_id, employee_id, amount_type, pricing_type, project_type, revenue from (
SELECT
pro.id AS project_id,
(select project_id from project_subproject_rel as par where pro.id=par.id limit 1) as parent_project,
(select project_id from project_subproject_rel as par where pro.id=par.id limit 1) as parentproject,
pro.date_start AS start_date,
pro.date AS end_date,
pro.partner_id AS partner_id,
@ -58,7 +58,7 @@ class BudgetAmtAnalysis(models.Model):
union
SELECT
pro.id AS project_id,
(select project_id from project_subproject_rel as par where pro.id=par.id limit 1) as parent_project,
(select project_id from project_subproject_rel as par where pro.id=par.id limit 1) as parentproject,
pro.date_start AS start_date,
pro.date AS end_date,
pro.partner_id AS partner_id,
@ -77,7 +77,7 @@ class BudgetAmtAnalysis(models.Model):
union
SELECT
pro.id AS project_id,
(select project_id from project_subproject_rel as par where pro.id=par.id limit 1) as parent_project,
(select project_id from project_subproject_rel as par where pro.id=par.id limit 1) as parentproject,
pro.date_start AS start_date,
pro.date AS end_date,
pro.partner_id AS partner_id,
@ -93,7 +93,7 @@ class BudgetAmtAnalysis(models.Model):
union
SELECT
pro.id AS project_id,
(select project_id from project_subproject_rel as par where pro.id=par.id limit 1) as parent_project,
(select project_id from project_subproject_rel as par where pro.id=par.id limit 1) as parentproject,
pro.date_start AS start_date,
pro.date AS end_date,
pro.partner_id AS partner_id,
@ -116,7 +116,7 @@ class BudgetAmtAnalysis(models.Model):
union
SELECT
pro.id AS project_id,
(select project_id from project_subproject_rel as par where pro.id=par.id limit 1) as parent_project,
(select project_id from project_subproject_rel as par where pro.id=par.id limit 1) as parentproject,
pro.date_start AS start_date,
pro.date AS end_date,
pro.partner_id AS partner_id,
@ -137,7 +137,7 @@ class BudgetAmtAnalysis(models.Model):
union
SELECT
pro.id AS project_id,
(select project_id from project_subproject_rel as par where pro.id=par.id limit 1) as parent_project,
(select project_id from project_subproject_rel as par where pro.id=par.id limit 1) as parentproject,
pro.date_start AS start_date,
pro.date AS end_date,
pro.partner_id AS partner_id,

View File

@ -49,7 +49,7 @@ class BudgetHrsAnalysis(models.Model):
SELECT
ROW_NUMBER() OVER() as id,
project_id,
parent_project,
parentproject as parent_project,
startdate as start_date,
enddate as end_date,
pricing_type as pricing_type,
@ -60,7 +60,7 @@ class BudgetHrsAnalysis(models.Model):
hours from (
SELECT
pro.id AS project_id,
(select project_id from project_subproject_rel as par where pro.id=par.id limit 1) as parent_project,
(select project_id from project_subproject_rel as par where pro.id=par.id limit 1) as parentproject,
pro_emp.employee_id AS employee_id,
date_start AS startdate,
date AS enddate,
@ -76,7 +76,7 @@ class BudgetHrsAnalysis(models.Model):
Union all
SELECT
pro.id AS project_id,
(select project_id from project_subproject_rel as par where pro.id=par.id limit 1) as parent_project,
(select project_id from project_subproject_rel as par where pro.id=par.id limit 1) as parentproject,
null::int AS employee_id,
date_start AS startdate,
date AS enddate,
@ -92,7 +92,7 @@ class BudgetHrsAnalysis(models.Model):
Union all
SELECT
pro.id AS project_id,
(select project_id from project_subproject_rel as par where pro.id=par.id limit 1) as parent_project,
(select project_id from project_subproject_rel as par where pro.id=par.id limit 1) as parentproject,
AAL.employee_id AS employee_id,
coalesce(pro.date_start, (select min(al.start_datetime::date) from account_analytic_line as al where pro.id=al.project_id)) AS startdate,
(select max(al.end_datetime::date) from account_analytic_line as al) as enddate,
@ -109,7 +109,7 @@ class BudgetHrsAnalysis(models.Model):
Union all
SELECT
pro.id AS project_id,
(select project_id from project_subproject_rel as par where pro.id=par.id limit 1) as parent_project,
(select project_id from project_subproject_rel as par where pro.id=par.id limit 1) as parentproject,
AAL.employee_id AS employee_id,
coalesce(pro.date_start, (select min(al.start_datetime::date) from account_analytic_line as al where pro.id=al.project_id)) AS startdate,
(select max(al.end_datetime::date) from account_analytic_line as al) as enddate,
@ -125,7 +125,7 @@ class BudgetHrsAnalysis(models.Model):
Union all
SELECT
pro.id AS project_id,
(select project_id from project_subproject_rel as par where pro.id=par.id limit 1) as parent_project,
(select project_id from project_subproject_rel as par where pro.id=par.id limit 1) as parentproject,
AAL.employee_id AS employee_id,
pro.date_start AS startdate,
(select max(al.end_datetime::date) from account_analytic_line as al) as enddate,