Merge branch 'development' of http://103.74.223.20:8085/prakash.jain/cor-odoo into pawan_branch

This commit is contained in:
Pawan Kumar 2021-01-27 15:03:32 +05:30
commit 8e7b3b64b0
8 changed files with 46 additions and 12 deletions

View File

@ -29,7 +29,7 @@
'views/crm_view.xml',
'views/sale_views.xml',
'views/project_view.xml',
'views/project_hours_view.xml',
#'views/project_hours_view.xml',
'views/hr_employee_views.xml',
'views/hr_timesheet_templates.xml',
'views/analytic_view.xml',

View File

@ -58,7 +58,7 @@
<field name="name">project.consultant.hrs.report.graph</field>
<field name="model">project.consultant.hrs.report</field>
<field name="arch" type="xml">
<graph string="Consultant Allocation" type="bar" stacked="True" sample="1" disable_linking="1">
<graph string="Consultant Allocation" type="bar" stacked="False" sample="1" disable_linking="1">
<field name="project_id" type="row"/>
<field name="hours" type="measure"/>
</graph>
@ -74,6 +74,7 @@
<field name="context">{
'search_default_project': 1,
'search_default_consultant': 1,
'search_default_group_by_hours_type': 1,
}
</field>
</record>
@ -88,7 +89,7 @@
<button class="oe_stat_button" type="action" name="cor_custom.action_project_consultant_hrs_report"
icon="fa-tasks"
attrs="{'invisible':['|',('pricing_type','!=','employee_rate'),('project_type','!=','hours_in_consultant')]}"
string="View Allocation1" widget="statinfo">
string="View Allocation" widget="statinfo">
</button>
</div>
</field>

View File

@ -67,7 +67,7 @@
</field>
</record>
<record id="project_consul_hours_view_form" model="ir.ui.view">
<!--<record id="project_consul_hours_view_form" model="ir.ui.view">
<field name="name">Project Consul Hours</field>
<field name="model">project.project</field>
<field name="inherit_id" ref="project.edit_project"/>
@ -78,6 +78,6 @@
</button>
</div>
</field>
</record>
</record>-->
</odoo>

View File

@ -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',

View File

@ -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,17 +104,22 @@ 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 * pro.timesheet_hour) 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
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
--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' 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 +139,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,

View File

@ -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'}"/>

View File

@ -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,

View File

@ -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'}"/>