Merge branch 'development' of http://103.74.223.20:8085/prakash.jain/cor-odoo into pawan_branch
This commit is contained in:
commit
50908feb58
|
@ -17,6 +17,7 @@ class PlanningShift(models.Model):
|
|||
|
||||
project_id = fields.Many2one('project.project', string="Project", domain="[('company_id', '=', company_id), ('allow_forecast', '=', True)]", check_company=True)
|
||||
budgeted_hours = fields.Float("Budgeted hours", default=0, compute='_compute_budgeted_hours', store=True)
|
||||
rem_all_hours = fields.Float("Remaining Allocated hours", default=0, compute='_compute_budgeted_hours', store=True)
|
||||
task_id = fields.Many2one('project.task', string="Task", domain="[('company_id', '=', company_id), ('project_id', '=', project_id)]", check_company=True)
|
||||
|
||||
_sql_constraints = [
|
||||
|
@ -27,6 +28,8 @@ class PlanningShift(models.Model):
|
|||
def read_group(self, domain, fields, groupby, offset=0, limit=None, orderby=False, lazy=True):
|
||||
if 'budgeted_hours' in fields:
|
||||
fields.remove('budgeted_hours')
|
||||
if 'rem_all_hours' in fields:
|
||||
fields.remove('rem_all_hours')
|
||||
return super(PlanningShift, self).read_group(domain, fields, groupby, offset, limit, orderby, lazy)
|
||||
|
||||
|
||||
|
@ -36,12 +39,22 @@ class PlanningShift(models.Model):
|
|||
if slot.project_id and slot.employee_id:
|
||||
if slot.project_id.project_type == 'hours_no_limit':
|
||||
slot.budgeted_hours = slot.project_id.budgeted_hours
|
||||
#print("slot.project_id.project_type", slot.project_id.project_type)
|
||||
rec = slot.search([('project_id','=',slot.project_id.id)])
|
||||
all_hours = 0
|
||||
for r in rec:
|
||||
all_hours += r.allocated_hours
|
||||
slot.rem_all_hours = slot.budgeted_hours - all_hours
|
||||
if slot.project_id.project_type == 'hours_in_consultant':
|
||||
cons = self.env['project.sale.line.employee.map'].search([('employee_id','=',slot.employee_id.id),('project_id','=',slot.project_id.id)], limit=1)
|
||||
slot.budgeted_hours = cons and cons.budgeted_qty or 0
|
||||
rec = slot.search([('employee_id', '=', slot.employee_id.id),('project_id', '=', slot.project_id.id)])
|
||||
all_hours = 0
|
||||
for r in rec:
|
||||
all_hours += r.allocated_hours
|
||||
slot.rem_all_hours = slot.budgeted_hours - all_hours
|
||||
else:
|
||||
slot.budgeted_hours = 0
|
||||
slot.rem_all_hours = 0
|
||||
|
||||
@api.onchange('task_id')
|
||||
def _onchange_task_id(self):
|
||||
|
|
|
@ -11,8 +11,9 @@
|
|||
<field name="project_id"/> <!-- optional="hide" -->
|
||||
<field name="task_id"/>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='employee_id']" position="after">
|
||||
<xpath expr="//field[@name='allocated_hours']" position="after">
|
||||
<field name="budgeted_hours"/>
|
||||
<field name="rem_all_hours"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
@ -28,6 +29,7 @@
|
|||
</xpath>
|
||||
<xpath expr="//field[@name='employee_id']" position="after">
|
||||
<field name="budgeted_hours"/>
|
||||
<field name="rem_all_hours"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
|
|
@ -46,7 +46,7 @@ class BudgetAmtAnalysis(models.Model):
|
|||
PRO.create_date AS create_date,
|
||||
PRO.partner_id AS partner_id,
|
||||
'Actual Revenue' as amount_type,
|
||||
sum(AAL.amount * -1) + pro.total_expenses AS revenue
|
||||
pro.total_expenses AS 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
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
<record id="project_budget_amt_report_view_action" model="ir.actions.act_window">
|
||||
<field name="name">Projects Revenue Acutal Vs Budget</field>
|
||||
<field name="res_model">project.budget.amt.report</field>
|
||||
<field name="view_mode">pivot,graph</field>
|
||||
<field name="view_mode">graph,pivot</field>
|
||||
<field name="search_view_id" ref="project_budget_amt_report_view_search"/>
|
||||
<field name="context">{'search_default_group_by_project': 1,'search_default_group_by_amount_type': 1}</field>
|
||||
</record>
|
||||
|
|
|
@ -14,7 +14,7 @@ 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)
|
||||
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='Consultant', readonly=True)
|
||||
hours_type = fields.Char(string="Hours Type", readonly=True)
|
||||
hours = fields.Float("Hours", digits=(16, 2), readonly=True, group_operator="sum")
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
<field name="name">Projects Hours Acutal Vs Budget</field>
|
||||
<!--<field name="name">Projects Revenue Acutal Vs Budget</field>-->
|
||||
<field name="res_model">project.budget.hrs.report</field>
|
||||
<field name="view_mode">pivot,graph</field>
|
||||
<field name="view_mode">graph,pivot</field>
|
||||
<field name="search_view_id" ref="project_budget_hrs_report_view_search"/>
|
||||
<field name="context">{'search_default_group_by_project': 1,'search_default_group_by_hours_type': 1}</field>
|
||||
</record>
|
||||
|
|
Loading…
Reference in New Issue