Merge branch 'pawan_branch' into 'development'

add feedback changes

See merge request prakash.jain/cor-odoo!57
This commit is contained in:
pawan.sharma 2021-01-06 09:17:08 -08:00
commit 64ed9ae4d4
2 changed files with 16 additions and 17 deletions

View File

@ -46,11 +46,10 @@ class Project(models.Model):
expenses_per = fields.Float(string='Expenses (%)', digits=(16, 2))
expenses_amt = fields.Float(string='Expenses Amount', digits=(16, 2))
cost = fields.Float("Total Revenue", compute='onchange_compute_values', store=True)
consultant_cost = fields.Float("Consultant Cost", compute='onchange_compute_values', store=True)
consultant_cost = fields.Float("Actual Cost", compute='onchange_compute_values', store=True)
other_expenses = fields.Float(string='Other Expenses', related='expenses_amt')
total_expenses = fields.Float(string='Total Expenses', digits=(16, 2), compute='_compute_calc', store=True)
hourly_rate = fields.Float("Hourly rate", compute='onchange_compute_values', store=True)
hourly_rate2 = fields.Float("Hourly rate")
hourly_rate = fields.Float("Hourly Rate", compute='onchange_compute_values', store=True)
budgeted_hour_week = fields.Float("Budgeted Hours(per week)", compute='onchange_compute_values', store=True)
profit_amt = fields.Float(string='Profit Amount', digits=(16, 2), compute='_compute_calc', store=True)
profit_per = fields.Float(string='Porfit Percentage', digits=(16, 2), compute='_compute_calc', store=True)
@ -58,8 +57,8 @@ class Project(models.Model):
('Manual', 'Manual'),
('Percentage', 'Percentage'),
], string="Hours Distribution", default="Manual")
manager_per = fields.Float(string='Manager Percentage', digits=(16, 2))
employee_per = fields.Float(string='Employee Percentage', digits=(16, 2), compute='compute_percentage_hours', store=True)
manager_per = fields.Float(string='Manager %', digits=(16, 2))
employee_per = fields.Float(string='Employee %', digits=(16, 2), compute='compute_percentage_hours', store=True)
manager_hour = fields.Float(string='Manager Hour')
employee_hour = fields.Float(string='Employee Hour')
@ -96,7 +95,7 @@ class Project(models.Model):
if record.profit_amt > 0 and record.budgeted_revenue > 0:
record.profit_per = (record.profit_amt / record.budgeted_revenue) * 100
@api.depends('sale_line_employee_ids', 'hourly_rate2', 'budgeted_hours')
@api.depends('sale_line_employee_ids', 'budgeted_hours')
def onchange_compute_values(self):
for record in self:
hour = 0.0
@ -111,11 +110,13 @@ class Project(models.Model):
if record.project_type == 'hours_in_consultant':
record.cost = cost
record.budgeted_hours = hour
if hour > 0.0:
record.hourly_rate = (cost / hour)
else:
record.cost = record.budgeted_hours * record.hourly_rate2
record.cost = record.budgeted_hours * record.hourly_rate
if record.budgeted_hours > 0.0:
record.hourly_rate = (record.budgeted_revenue / record.budgeted_hours)
record.consultant_cost = consultant_cost
if hour > 0.0:
record.hourly_rate = (cost / hour)
record.budgeted_hour_week = budgeted_hour_week
@ -143,12 +144,12 @@ class InheritProjectProductEmployeeMap(models.Model):
currency_id = fields.Many2one('res.currency', string="Currency", compute='_compute_price_unit', store=True,
readonly=False)
sale_line_id = fields.Many2one('sale.order.line', "Service", domain=[('is_service', '=', True)])
cost = fields.Float("Timesheet Cost", compute='_compute_total_cost', default=0.0, store=True)
consultant_cost = fields.Float("Total", compute='_compute_total_cost')
cost = fields.Float("Cost", compute='_compute_total_cost', default=0.0, store=True)
consultant_cost = fields.Float("Actual Cost", compute='_compute_total_cost')
hour_distribution = fields.Selection(related='project_id.hour_distribution')
role = fields.Selection([('Manager', 'Manager'),
('Employee', 'Employee'), ], string=" ", default="Employee")
('Employee', 'Employee'), ], string="Role", default="Employee")
distribution_per = fields.Float("%")
def _compute_timesheet_hour(self):

View File

@ -72,7 +72,7 @@
<field name="hour_distribution" invisible="1"/>
<field name="employee_id" options="{'no_create': True}" string="Consultant Name"/>
<field name="role"
attrs="{'invisible': [('hour_distribution','!=','Percentage')], 'required': [('hour_distribution','=','Percentage')]}"/>
attrs="{'required': [('hour_distribution','=','Percentage')]}"/>
<field name="distribution_per"
attrs="{'invisible': [('hour_distribution','!=','Percentage')], 'required': [('hour_distribution','=','Percentage')]}"/>
<!--<field name="sale_line_id" options="{'no_create': True}"
@ -99,7 +99,7 @@
</field>
<group attrs="{'invisible': [('pricing_type','=','fixed_rate')]}">
<group>
<field name="cost"/>
<!--<field name="cost"/>-->
<field name="consultant_cost"/>
<field name="other_expenses" readonly="1"/>
<field name="total_expenses"/>
@ -110,9 +110,7 @@
<field name="budgeted_hours"
attrs="{'invisible': [('pricing_type','=','fixed_rate')], 'readonly': [('project_type','=','hours_in_consultant')],
'required': [('pricing_type','!=','fixed_rate')]}"/>
<field name="hourly_rate" attrs="{'invisible': [('project_type','=','hours_no_limit')]}"/>
<field name="hourly_rate2" attrs="{'invisible': [('project_type','!=','hours_no_limit')],
'required': [('project_type','=','hours_no_limit')]}"/>
<field name="hourly_rate"/>
<field name="budgeted_hour_week"/>
</group>