Merge branch 'development' of http://103.74.223.20:8085/prakash.jain/cor-odoo into pawan_branch
This commit is contained in:
commit
871d3c34c3
|
@ -14,7 +14,7 @@ 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)
|
||||
partner_id = fields.Many2one('res.partner', string='Client', readonly=True)
|
||||
employee_id = fields.Many2one('hr.employee', string='Employee', readonly=True)
|
||||
#employee_id = fields.Many2one('hr.employee', string='Employee', readonly=True)
|
||||
budgeted_revenue = fields.Float("Budgeted Revenue", digits=(16, 2), readonly=True, group_operator="sum")
|
||||
actual_revenue = fields.Float("Actual Revenue", digits=(16, 2), readonly=True, group_operator="sum")
|
||||
|
||||
|
@ -27,15 +27,14 @@ class BudgetAmtAnalysis(models.Model):
|
|||
row_number() OVER() AS id,
|
||||
PRO.id AS project_id,
|
||||
PRO.partner_id AS partner_id,
|
||||
AAL.employee_id AS employee_id,
|
||||
PRO.budgeted_revenue AS budgeted_revenue,
|
||||
SO.amount_total AS actual_revenue
|
||||
FROM project_project PRO
|
||||
LEFT JOIN sale_order SO ON PRO.sale_order_id = SO.id
|
||||
LEFT JOIN account_analytic_account AA ON PRO.analytic_account_id = AA.id
|
||||
LEFT JOIN account_analytic_line AAL ON AAL.account_id = AA.id and AAL.project_id = PRO.id
|
||||
WHERE PRO.active = 't' AND PRO.allow_timesheets = 't'
|
||||
group by Pro.id, PRO.partner_id, AAL.employee_id, Pro.budgeted_revenue, so.amount_total
|
||||
WHERE PRO.active = 't'
|
||||
group by Pro.id, PRO.partner_id, Pro.budgeted_revenue, so.amount_total
|
||||
)""" % (self._table,))
|
||||
|
||||
|
||||
|
|
|
@ -33,11 +33,11 @@
|
|||
<search string="Budget Analysis">
|
||||
<field name="project_id"/>
|
||||
<field name="partner_id" filter_domain="[('partner_id', 'child_of', self)]"/>
|
||||
<field name="employee_id"/>
|
||||
<!--<field name="employee_id"/>-->
|
||||
<group expand="1" string="Group By">
|
||||
<filter string="Project" name="group_by_project" context="{'group_by':'project_id'}"/>
|
||||
<filter string="Customer" name="group_by_partner_id" context="{'group_by':'partner_id'}"/>
|
||||
<filter string="Consultant" name="group_by_employee_id" context="{'group_by':'employee_id'}"/>
|
||||
<!--<filter string="Consultant" name="group_by_employee_id" context="{'group_by':'employee_id'}"/>-->
|
||||
</group>
|
||||
</search>
|
||||
</field>
|
||||
|
|
|
@ -23,18 +23,22 @@ 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,
|
||||
SELECT row_number() OVER() AS id,
|
||||
PRO.id AS project_id,
|
||||
PRO.partner_id AS partner_id,
|
||||
AAL.employee_id AS employee_id,
|
||||
PRO.budgeted_hours AS budgeted_hours,
|
||||
CASE
|
||||
WHEN Pro_emp.id is null THEN Pro.budgeted_hours
|
||||
ELSE Pro_emp.budgeted_qty
|
||||
END AS budgeted_hours,
|
||||
sum(AAL.unit_amount) AS actual_hours
|
||||
FROM project_project PRO
|
||||
LEFT JOIN account_analytic_account AA ON PRO.analytic_account_id = AA.id
|
||||
LEFT JOIN account_analytic_line AAL ON AAL.account_id = AA.id and AAL.project_id = PRO.id
|
||||
--WHERE AAL.amount < 0.0 AND AAL.project_id IS NOT NULL AND
|
||||
Where PRO.active = 't' AND PRO.allow_timesheets = 't'
|
||||
group by Pro.id, PRO.partner_id, AAL.employee_id, AAL.unit_amount,PRO.budgeted_hours
|
||||
Left JOIN project_sale_line_employee_map Pro_emp ON Pro_emp.project_id = Pro.id
|
||||
LEFT JOIN account_analytic_account AA ON Pro.analytic_account_id = AA.id
|
||||
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'
|
||||
group by Pro.id, Pro_emp.id, PRO.partner_id, AAL.employee_id, AAL.unit_amount
|
||||
)""" % (self._table,))
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue