Merge branch 'pawan_branch' into 'development'
Pawan branch See merge request prakash.jain/cor-odoo!80
This commit is contained in:
commit
ee81abf3d4
|
@ -124,15 +124,14 @@ class AccountAnalyticLine(models.Model):
|
|||
value = super(AccountAnalyticLine, self).create(vals)
|
||||
if value and value.project_id:
|
||||
value.project_id._onchange_calculate_timesheet_hours()
|
||||
value.project_id._compute_calc()
|
||||
return value
|
||||
|
||||
|
||||
def write(self, vals):
|
||||
print('AAAAAAAAAA', self)
|
||||
if vals.get('unit_amount') == 0.0:
|
||||
raise ValidationError(_("Your can not fill 0.0 hour entry"))
|
||||
|
||||
value = super(AccountAnalyticLine, self).write(vals)
|
||||
print('BBBBBBBBBBBBB', self, vals)
|
||||
res = super(AccountAnalyticLine, self).write(vals)
|
||||
if self.project_id:
|
||||
self.project_id._onchange_calculate_timesheet_hours()
|
||||
return value
|
||||
return res
|
||||
|
|
|
@ -76,10 +76,8 @@ class Project(models.Model):
|
|||
GROUP BY project_id, employee_id''',
|
||||
{'project_id': self._origin.id})
|
||||
res = self._cr.fetchall()
|
||||
print('RESSSSSSSSSS', res)
|
||||
if res:
|
||||
for rec in res:
|
||||
print('RECCCCCCCCCCCCCCCC', rec)
|
||||
self.consultant_timesheet_hrs.create({'project_id': rec[0],
|
||||
'employee_id': rec[1],
|
||||
'timesheet_hour': rec[2]})
|
||||
|
@ -92,6 +90,9 @@ class Project(models.Model):
|
|||
for rec in record.sale_line_employee_ids:
|
||||
consultant_cost = consultant_cost + rec.consultant_cost
|
||||
hour = hour + rec.budgeted_qty
|
||||
if record.pricing_type == 'fixed_rate':
|
||||
for rec in record.consultant_timesheet_hrs:
|
||||
consultant_cost = consultant_cost + rec.consultant_cost
|
||||
record.consultant_cost = consultant_cost
|
||||
record.budgeted_hours = hour
|
||||
total_exp = record.consultant_cost + record.expenses_amt
|
||||
|
@ -105,6 +106,7 @@ class Project(models.Model):
|
|||
if record.project_type == 'hours_no_limit' and record.budgeted_hours2 > 0.0:
|
||||
record.hourly_rate = (record.budgeted_revenue / record.budgeted_hours2)
|
||||
|
||||
|
||||
@api.depends('manager_per', 'hour_distribution')
|
||||
def compute_percentage_hours(self):
|
||||
for record in self:
|
||||
|
@ -154,18 +156,14 @@ class Project(models.Model):
|
|||
for val in self:
|
||||
val.consultant_timesheet_hrs = False
|
||||
if val._origin.id:
|
||||
print('SSSSSSSSSSSSSSSSSSSS', val._origin.id)
|
||||
self._cr.execute('''SELECT project_id, employee_id, SUM(unit_amount) FROM account_analytic_line where project_id = 149
|
||||
GROUP BY project_id, employee_id''')
|
||||
res = self._cr.fetchone()
|
||||
print('TTTTTTTTTTTTTT', res)
|
||||
if res:
|
||||
create_timesheet = val.consultant_timesheet_hrs.create({'project_id': res[0],
|
||||
'employee_id': res[1],
|
||||
'timesheet_hour': res[2]})
|
||||
print('RRRRRRRRRRRRRRRRRRR', create_timesheet)
|
||||
for rec in create_timesheet:
|
||||
print('vvvvvvvvvvvv', rec)
|
||||
else:
|
||||
val.consultant_timesheet_hrs = False
|
||||
# val.consultant_timesheet_hrs = False
|
||||
|
@ -192,17 +190,6 @@ class ProjectConsultantTimesheetHrs(models.Model):
|
|||
else:
|
||||
val.consultant_cost = 0.0
|
||||
|
||||
"""def _compute_timesheet_hour(self):
|
||||
print('QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ')
|
||||
for val in self:
|
||||
if val.project_id._origin.id:
|
||||
self._cr.execute('''SELECT project_id, employee_id, SUM(unit_amount) FROM account_analytic_line
|
||||
where project_id = %(project_id)s
|
||||
GROUP BY project_id, employee_id''',
|
||||
{'project_id': val.project_id._origin.id})
|
||||
res = self._cr.fetchone()
|
||||
print('99999999999999999999999999999999999', res)"""
|
||||
|
||||
|
||||
class InheritProjectProductEmployeeMap(models.Model):
|
||||
_inherit = 'project.sale.line.employee.map'
|
||||
|
|
|
@ -52,8 +52,8 @@
|
|||
attrs="{'invisible': ['|',('project_type','!=','hours_in_consultant'),('pricing_type','=','fixed_rate')]}"/>
|
||||
<field name="manager_per" attrs="{'invisible': [('hour_distribution','!=','Percentage')]}"/>
|
||||
<field name="employee_per" attrs="{'invisible': [('hour_distribution','!=','Percentage')]}"/>
|
||||
<field name="expenses_per" attrs="{'invisible': [('pricing_type','=','fixed_rate')]}"/>
|
||||
<field name="expenses_amt" attrs="{'invisible': [('pricing_type','=','fixed_rate')]}"/>
|
||||
<field name="expenses_per"/>
|
||||
<field name="expenses_amt"/>
|
||||
<div class="o_td_label"
|
||||
attrs="{'invisible': ['|', '|', ('allow_timesheets', '=', False), ('sale_order_id', '!=', False), '&', ('pricing_type', '!=', 'fixed_rate'), ('bill_type', '!=', 'customer_task')]}">
|
||||
<label for="timesheet_product_id" string="Default Service"
|
||||
|
|
Loading…
Reference in New Issue