Report updated subproject
This commit is contained in:
parent
d725038710
commit
e606053a76
|
@ -10,7 +10,7 @@
|
|||
'author': "SunArc Technologies",
|
||||
'website': "http://www.sunarctechnologies.com",
|
||||
'depends': [
|
||||
'cor_custom'
|
||||
'cor_custom','sub_project'
|
||||
],
|
||||
'data': [
|
||||
'security/ir.model.access.csv',
|
||||
|
|
|
@ -13,6 +13,8 @@ class BudgetAmtAnalysis(models.Model):
|
|||
|
||||
#analytic_account_id = fields.Many2one('account.analytic.account', string='Analytic Account', readonly=True)
|
||||
project_id = fields.Many2one('project.project', string='Project', readonly=True)
|
||||
is_sub_project = fields.Boolean("Is Sub Project", readonly=True)
|
||||
parent_project = fields.Many2one('project.project', string='Parent Project', readonly=True)
|
||||
partner_id = fields.Many2one('res.partner', string='Client', readonly=True)
|
||||
amount_type = fields.Char(string="Amount Type")
|
||||
revenue = fields.Float("Revenue", digits=(16, 2), readonly=True, group_operator="sum")
|
||||
|
@ -36,9 +38,11 @@ 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, 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, is_sub_project, 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,
|
||||
pro.is_sub_project as is_sub_project,
|
||||
pro.parent_project as parent_project,
|
||||
pro.date_start AS start_date,
|
||||
pro.date AS end_date,
|
||||
pro.partner_id AS partner_id,
|
||||
|
@ -54,6 +58,8 @@ class BudgetAmtAnalysis(models.Model):
|
|||
union
|
||||
SELECT
|
||||
pro.id AS project_id,
|
||||
pro.is_sub_project as is_sub_project,
|
||||
pro.parent_project as parent_project,
|
||||
pro.date_start AS start_date,
|
||||
pro.date AS end_date,
|
||||
pro.partner_id AS partner_id,
|
||||
|
@ -71,6 +77,8 @@ class BudgetAmtAnalysis(models.Model):
|
|||
union
|
||||
SELECT
|
||||
pro.id AS project_id,
|
||||
pro.is_sub_project as is_sub_project,
|
||||
pro.parent_project as parent_project,
|
||||
pro.date_start AS start_date,
|
||||
pro.date AS end_date,
|
||||
pro.partner_id AS partner_id,
|
||||
|
@ -79,13 +87,15 @@ class BudgetAmtAnalysis(models.Model):
|
|||
pro.pricing_type as pricing_type,
|
||||
pro.project_type as project_type,
|
||||
null::date AS timesheet_date,
|
||||
pro.budgeted_hours2 AS revenue
|
||||
pro.budgeted_revenue AS revenue
|
||||
FROM project_project pro
|
||||
--Left JOIN project_sale_line_employee_map pro_emp ON pro_emp.project_id = pro.id
|
||||
WHERE PRO.active = 't' and pro.pricing_type = 'employee_rate' and pro.project_type = 'hours_no_limit'
|
||||
union
|
||||
SELECT
|
||||
pro.id AS project_id,
|
||||
pro.is_sub_project as is_sub_project,
|
||||
pro.parent_project as parent_project,
|
||||
pro.date_start AS start_date,
|
||||
pro.date AS end_date,
|
||||
pro.partner_id AS partner_id,
|
||||
|
@ -94,7 +104,8 @@ class BudgetAmtAnalysis(models.Model):
|
|||
pro.pricing_type as pricing_type,
|
||||
pro.project_type as project_type,
|
||||
null::date AS timesheet_date,
|
||||
(AAL.unit_amount) AS revenue
|
||||
(pro.hourly_rate * sum(AAL.unit_amount)) AS revenue
|
||||
--(AAL.unit_amount) AS revenue
|
||||
--(AAL.unit_amount * pro_emp.price_unit) AS revenue
|
||||
FROM project_project PRO
|
||||
--Left JOIN project_sale_line_employee_map pro_emp ON pro_emp.project_id = pro.id
|
||||
|
@ -102,9 +113,12 @@ class BudgetAmtAnalysis(models.Model):
|
|||
LEFT JOIN account_analytic_line AAL ON AAL.account_id = AA.id and AAL.project_id = PRO.id
|
||||
--and AAL.employee_id = pro_emp.employee_id
|
||||
WHERE PRO.active = 't' and PRO.pricing_type = 'employee_rate' and PRO.project_type = 'hours_no_limit'
|
||||
group by pro.id
|
||||
union
|
||||
SELECT
|
||||
pro.id AS project_id,
|
||||
pro.is_sub_project as is_sub_project,
|
||||
pro.parent_project as parent_project,
|
||||
pro.date_start AS start_date,
|
||||
pro.date AS end_date,
|
||||
pro.partner_id AS partner_id,
|
||||
|
@ -124,6 +138,8 @@ class BudgetAmtAnalysis(models.Model):
|
|||
union
|
||||
SELECT
|
||||
pro.id AS project_id,
|
||||
pro.is_sub_project as is_sub_project,
|
||||
pro.parent_project as parent_project,
|
||||
pro.date_start AS start_date,
|
||||
pro.date AS end_date,
|
||||
pro.partner_id AS partner_id,
|
||||
|
|
|
@ -38,6 +38,8 @@
|
|||
<field name="timesheet_date" optional="hide"/>
|
||||
<field name="amount_type"/>
|
||||
<field name="revenue"/>
|
||||
<field name="is_sub_project" optional="hide"/>
|
||||
<field name="parent_project" optional="hide"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
@ -58,6 +60,7 @@
|
|||
<filter string="Fixed rate" name="fixed" domain="[('pricing_type','=','fixed_rate')]"/>
|
||||
<filter string="Hours are budgeted according to a consultant" name="fixed" domain="[('project_type','=','hours_in_consultant')]"/>
|
||||
<filter string="Total hours are budgeted without division to consultant" name="limit" domain="[('project_type','=','hours_no_limit')]"/>
|
||||
<filter string="Sub Project" name="subproject" domain="[('is_sub_project','=',True)]"/>
|
||||
<group expand="1" string="Group By">
|
||||
<filter string="Project" name="group_by_project" context="{'group_by':'project_id'}"/>
|
||||
<filter string="Client" name="group_by_partner_id" context="{'group_by':'partner_id'}"/>
|
||||
|
|
|
@ -13,6 +13,8 @@ class BudgetHrsAnalysis(models.Model):
|
|||
|
||||
#analytic_account_id = fields.Many2one('account.analytic.account', string='Analytic Account', readonly=True)
|
||||
project_id = fields.Many2one('project.project', string='Project', readonly=True)
|
||||
is_sub_project = fields.Boolean("Is Sub Project", readonly=True)
|
||||
parent_project = fields.Many2one('project.project', string='Parent Project', readonly=True)
|
||||
start_date = fields.Date(string='Start Date', readonly=True)
|
||||
end_date = fields.Date(string='End Date', readonly=True)
|
||||
partner_id = fields.Many2one('res.partner', string='Client', readonly=True)
|
||||
|
@ -43,10 +45,12 @@ class BudgetHrsAnalysis(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, start_date, end_date, timesheet_date, pricing_type, project_type, partner_id, employee_id, hours_type,
|
||||
SELECT ROW_NUMBER() OVER() as id, project_id, is_sub_project, parent_project, start_date, end_date, timesheet_date, pricing_type, project_type, partner_id, employee_id, hours_type,
|
||||
hours from (
|
||||
SELECT
|
||||
pro.id AS project_id,
|
||||
pro.is_sub_project as is_sub_project,
|
||||
pro.parent_project as parent_project,
|
||||
pro.date_start AS start_date,
|
||||
pro.date AS end_date,
|
||||
pro.pricing_type as pricing_type,
|
||||
|
@ -65,6 +69,8 @@ class BudgetHrsAnalysis(models.Model):
|
|||
Union
|
||||
SELECT
|
||||
pro.id AS project_id,
|
||||
pro.is_sub_project as is_sub_project,
|
||||
pro.parent_project as parent_project,
|
||||
pro.date_start AS start_date,
|
||||
pro.date AS end_date,
|
||||
pro.pricing_type as pricing_type,
|
||||
|
@ -83,6 +89,8 @@ class BudgetHrsAnalysis(models.Model):
|
|||
Union
|
||||
SELECT
|
||||
pro.id AS project_id,
|
||||
pro.is_sub_project as is_sub_project,
|
||||
pro.parent_project as parent_project,
|
||||
pro.date_start AS start_date,
|
||||
pro.date AS end_date,
|
||||
pro.pricing_type as pricing_type,
|
||||
|
@ -102,6 +110,8 @@ class BudgetHrsAnalysis(models.Model):
|
|||
Union
|
||||
SELECT
|
||||
pro.id AS project_id,
|
||||
pro.is_sub_project as is_sub_project,
|
||||
pro.parent_project as parent_project,
|
||||
pro.date_start AS start_date,
|
||||
pro.date AS end_date,
|
||||
pro.pricing_type as pricing_type,
|
||||
|
|
|
@ -37,6 +37,8 @@
|
|||
<field name="timesheet_date" optional="hide"/>
|
||||
<field name="hours_type"/>
|
||||
<field name="hours"/>
|
||||
<field name="is_sub_project" optional="hide"/>
|
||||
<field name="parent_project" optional="hide"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
@ -56,6 +58,7 @@
|
|||
<filter string="Fixed rate" name="fixed" domain="[('pricing_type','=','fixed_rate')]"/>
|
||||
<filter string="Hours are budgeted according to a consultant" name="cons" domain="[('project_type','=','hours_in_consultant')]"/>
|
||||
<filter string="Total hours are budgeted without division to consultant" name="limit" domain="[('project_type','=','hours_no_limit')]"/>
|
||||
<filter string="Sub Project" name="subproject" domain="[('is_sub_project','=',True)]"/>
|
||||
<group expand="1" string="Group By">
|
||||
<filter string="Project" name="group_by_project" context="{'group_by':'project_id'}"/>
|
||||
<filter string="Client" name="group_by_partner_id" context="{'group_by':'partner_id'}"/>
|
||||
|
|
Loading…
Reference in New Issue