Consultant allocation pivot view added
This commit is contained in:
parent
dd60cde243
commit
200e70edd1
|
@ -262,7 +262,9 @@ class Project(models.Model):
|
|||
def action_view_custom_project_consultant_hrs_report(self):
|
||||
action = self.env["ir.actions.actions"]._for_xml_id("cor_custom.action_project_consultant_hrs_report")
|
||||
action['context'] = {'search_default_project_id': self.id, 'search_default_project': 1,
|
||||
'search_default_consultant': 1, 'search_default_group_by_hours_type': 1,
|
||||
'search_default_consultant': 1,
|
||||
#'search_default_sdate': 1,
|
||||
#'search_default_group_by_hours_type': 1,
|
||||
'default_res_model': 'project.consultant.hrs.report'}
|
||||
return action
|
||||
|
||||
|
|
|
@ -1,6 +1,20 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
|
||||
<record id="view_project_consultant_hrs_report_pivot" model="ir.ui.view">
|
||||
<field name="name">project.consultant.hrs.report.pivot</field>
|
||||
<field name="model">project.consultant.hrs.report</field>
|
||||
<field name="arch" type="xml">
|
||||
<pivot string="Consultant Analysis" disable_linking="True" sample="1">
|
||||
<field name="project_id" type="row"/>
|
||||
<field name="hours" type="measure"/>
|
||||
<field name="start_date" type="col"/>
|
||||
<field name="hours_type" type="col"/>
|
||||
<field name="percentage" type="measure"/>
|
||||
</pivot>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_project_consultant_hrs_report_form" model="ir.ui.view">
|
||||
<field name="name">project.consultant.hrs.report.form</field>
|
||||
<field name="model">project.consultant.hrs.report</field>
|
||||
|
@ -45,7 +59,7 @@
|
|||
<group expand="0" string="Group By">
|
||||
<filter string="Project" name="project" domain="[]" context="{'group_by':'project_id'}"/>
|
||||
<filter string="Consultant" name="consultant" domain="[]" context="{'group_by':'employee_id'}"/>
|
||||
<filter string="Start Date" name="sdate" domain="[]" context="{'group_by':'start_date'}"/>
|
||||
<filter string="Start Date" name="sdate" domain="[]" context="{'group_by':'start_date:month'}"/>
|
||||
<filter string="End Date" name="edate" domain="[]" context="{'group_by':'end_date'}"/>
|
||||
<filter string="Hours type" name="group_by_hours_type" context="{'group_by':'hours_type'}"/>
|
||||
<!--<filter string="Time" name="ptime" domain="[]" context="{'group_by':'ptime'}"/>-->
|
||||
|
@ -88,14 +102,9 @@
|
|||
<field name="name">Consultant Allocation</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">project.consultant.hrs.report</field>
|
||||
<field name="view_mode">tree,calendar,graph</field>
|
||||
<field name="view_mode">pivot,tree,calendar,graph</field>
|
||||
<field name="search_view_id" ref="view_project_consultant_hrs_report_search"/>
|
||||
<field name="context">{
|
||||
'search_default_project': 1,
|
||||
'search_default_consultant': 1,
|
||||
'search_default_group_by_hours_type': 1,
|
||||
'default_res_model': 'project.consultant.hrs.report'
|
||||
}
|
||||
<field name="context">{'search_default_project': 1, 'search_default_consultant': 1, 'default_res_model': 'project.consultant.hrs.report'}
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
|
|
@ -20,11 +20,13 @@ class ProjectMultiBudgetAssign(models.TransientModel):
|
|||
res_id = self._context.get('active_id')
|
||||
record = self.env['project.project'].browse(res_id)
|
||||
lines = []
|
||||
emp_id = []
|
||||
for rec in record.sale_line_employee_ids:
|
||||
cons = {}
|
||||
all_cons = self.env['project.consultant.hrs'].search([('employee_id','=',rec.employee_id.id),('project_id','=',rec.project_id.id)])
|
||||
all_per = [v.percentage for v in all_cons]
|
||||
if sum(all_per) < 100:
|
||||
if sum(all_per) < 100 and (rec.employee_id and rec.employee_id.id not in emp_id):
|
||||
emp_id.append(rec.employee_id.id)
|
||||
cons.update({'employee_id': rec.employee_id.id, 'emp_map_id':rec.id, 'project_id':res_id})
|
||||
lines.append((0, 0, cons))
|
||||
if record and (not record.pricing_type == 'employee_rate' or not record.project_type == 'hours_in_consultant'):
|
||||
|
|
Loading…
Reference in New Issue