project sub project related issue fixed

This commit is contained in:
root 2022-09-30 19:52:34 +05:30
parent 54da864d9d
commit 14847875e8
2 changed files with 22 additions and 10 deletions

View File

@ -9,12 +9,21 @@ class Project(models.Model):
def action_view_allocation_custom_report3(self):
action = self.env["ir.actions.actions"]._for_xml_id("project_report.project_revenue_custom_report3_action")
action['context'] = {'search_default_project_id': self.id,
'search_default_project': 1,
'search_default_group_employee': 1,
'search_default_group_enddate': 1,
#'default_res_model': 'project.revenue.custom.report3'
}
if self.is_sub_project and self.parent_project:
action['context'] = {'search_default_project_id': self.parent_project.id,
'search_default_group_sub_project': 1,
'search_default_group_employee': 1,
'search_default_group_enddate': 1,
# 'default_res_model': 'project.revenue.custom.report3'
}
else:
action['context'] = {'search_default_project_id': self.id,
'search_default_project': 1,
'search_default_group_employee': 1,
'search_default_group_enddate': 1,
# 'default_res_model': 'project.revenue.custom.report3'
}
print(action['context'])
return action

View File

@ -255,7 +255,8 @@ SELECT
((AAL.unit_amount * pro_data.pro_hourly_rate) - (AAL.amount * -1))/NULLIF((AAL.unit_amount * pro_data.pro_hourly_rate),0) AS profit_per
FROM pro_data
left join account_analytic_line AAL on AAL.project_id=pro_data.pproject_id
WHERE pro_data.pricing_type='employee_rate' and pro_data.project_type='hours_no_limit' and COALESCE(pro_data.is_sub_project, FALSE) = False
WHERE pro_data.pricing_type='employee_rate' and pro_data.project_type='hours_no_limit'
--and COALESCE(pro_data.is_sub_project, FALSE) = False
group by
pro_data.pro_sdate,
pro_data.pro_edate,
@ -430,8 +431,10 @@ SELECT
0 as budgeted_hours,
0 as overall_hourly_rate,
AAL.unit_amount as unit_amount,
0 as pro_hourly_rate,
coalesce(((AAL.amount * -1)/NULLIF(AAL.unit_amount, 0)), cons_data1.cons_timesheet_cost) as timesheet_cost,
COALESCE(cons_data1.cons_hourly_cost, 0) as pro_hourly_rate,
case when cons_data1.cons_timesheet_cost is null then ((AAL.amount * -1)/NULLIF(AAL.unit_amount, 0)) else cons_data1.cons_timesheet_cost
end as timesheet_cost,
--coalesce(((AAL.amount * -1)/NULLIF(AAL.unit_amount, 0)), cons_data1.cons_timesheet_cost) as timesheet_cost,
(AAL.unit_amount * COALESCE(cons_data1.cons_hourly_cost, 0)) as actual_revenue,
case when cons_data1.cons_timesheet_cost is null then (AAL.amount * -1) else (AAL.unit_amount * cons_data1.cons_timesheet_cost)
end as actual_cost,
@ -449,7 +452,7 @@ SELECT
and AAL.end_datetime --at time zone 'utc' at time zone (select tz from res_partner where id=3)
<= cons_data1.end_date::date + '23:59:59'::time AT TIME ZONE 'UTC'
where pro_data.pricing_type='employee_rate' and pro_data.project_type='hours_in_consultant'
and COALESCE(pro_data.is_sub_project, FALSE) = False
--and COALESCE(pro_data.is_sub_project, FALSE) = False
group by
pro_data.pproject_id,
AAL.employee_id,