Merge branch 'pawan_branch' into 'development'
Pawan branch See merge request prakash.jain/cor-odoo!52
This commit is contained in:
commit
9cb9b085e6
|
@ -48,6 +48,7 @@ class Project(models.Model):
|
|||
total_expenses = fields.Float(string='Total Expenses', digits=(16, 2), compute='_compute_calc', 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)
|
||||
consultant_cost = fields.Float("Sum of Cost", compute='onchange_compute_values', store=True)
|
||||
|
||||
@api.onchange('budgeted_revenue', 'expenses_per')
|
||||
def onchange_expenses_per(self):
|
||||
|
@ -71,13 +72,16 @@ class Project(models.Model):
|
|||
if record.project_type == 'hours_in_consultant':
|
||||
val = 0.0
|
||||
cost = 0.0
|
||||
consultant_cost = 0.0
|
||||
budgeted_hour_week = 0.0
|
||||
for rec in record.sale_line_employee_ids:
|
||||
val = val + rec.budgeted_qty
|
||||
cost = cost + rec.cost
|
||||
consultant_cost = consultant_cost + rec.consultant_cost
|
||||
budgeted_hour_week = budgeted_hour_week + rec.budgeted_hour_week
|
||||
record.budgeted_hours = val
|
||||
record.cost = cost
|
||||
record.consultant_cost = cost
|
||||
if val > 0.0:
|
||||
record.hourly_rate = (cost/val)
|
||||
record.budgeted_hour_week = budgeted_hour_week
|
||||
|
@ -89,7 +93,7 @@ class Project(models.Model):
|
|||
price_unit = price_unit + rec.price_unit
|
||||
count = count + 1
|
||||
print('price_unit', price_unit, count)
|
||||
if record.budgeted_hours > 0.0:
|
||||
if record.budgeted_hours > 0.0 and count > 0.0:
|
||||
avg =(record.budgeted_hours/count)
|
||||
hourly_rate = price_unit * avg
|
||||
print('ppppppppppp', avg, hourly_rate)
|
||||
|
@ -101,17 +105,19 @@ class Project(models.Model):
|
|||
class InheritProjectProductEmployeeMap(models.Model):
|
||||
_inherit = 'project.sale.line.employee.map'
|
||||
|
||||
employee_price = fields.Monetary(string="Consultant Price", related="employee_id.timesheet_cost", readonly=True)
|
||||
budgeted_qty = fields.Float(string='Budgeted Hours', store=True)
|
||||
budgeted_uom = fields.Many2one('uom.uom', string='Budgeted UOM', related='sale_line_id.product_uom', readonly=True)
|
||||
# budgeted_uom = fields.Many2one('uom.uom', string='Budgeted UOM', related='timesheet_product_id.uom_id', readonly=True)
|
||||
timesheet_hour = fields.Float("Timesheet Hour", compute='_compute_timesheet_hour', default=0.0)
|
||||
employee_price = fields.Monetary(string="Consultant Price", related="employee_id.timesheet_cost", readonly=True)
|
||||
budgeted_hour_week = fields.Float("Budgeted Hours per week", compute='_compute_budgeted_hour_week')
|
||||
price_unit = fields.Float("Hourly rate")
|
||||
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("Cost", compute='_compute_total_cost')
|
||||
consultant_cost = fields.Float("Cost", compute='_compute_total_cost')
|
||||
total = fields.Float("Total")
|
||||
|
||||
def _compute_timesheet_hour(self):
|
||||
for val in self:
|
||||
|
@ -135,6 +141,7 @@ class InheritProjectProductEmployeeMap(models.Model):
|
|||
def _compute_total_cost(self):
|
||||
for val in self:
|
||||
val.cost = val.budgeted_qty * val.price_unit
|
||||
val.consultant_cost = val.timesheet_hour * val.employee_price
|
||||
|
||||
@api.depends('sale_line_id', 'sale_line_id.price_unit', 'timesheet_product_id')
|
||||
def _compute_price_unit(self):
|
||||
|
|
|
@ -74,15 +74,16 @@
|
|||
<field name="budgeted_qty"
|
||||
attrs="{'readonly': [('parent.project_type', '=', 'hours_no_limit')]}"/>
|
||||
<field name="cost"/>
|
||||
<field name="timesheet_hour"/>
|
||||
<field name="budgeted_hour_week"/>
|
||||
<!--<field name="timesheet_product_id"
|
||||
attrs="{'column_invisible': [('parent.sale_order_id', '!=', False)]}"/>-->
|
||||
<!--<field name="budgeted_uom"
|
||||
attrs="{'column_invisible': [('parent.sale_order_id', '=', False)]}"/>-->
|
||||
<!--<field name="budgeted_qty"
|
||||
attrs="{'column_invisible': [('parent.sale_order_id', '=', False)]}"/>-->
|
||||
<!--<field name="employee_price" widget="monetary" options="{'currency_field': 'currency_id'}"/>-->
|
||||
<field name="timesheet_hour"/>
|
||||
<field name="employee_price" widget="monetary" options="{'currency_field': 'currency_id'}"/>
|
||||
<field name="consultant_cost"/>
|
||||
<field name="budgeted_hour_week"/>
|
||||
</tree>
|
||||
</field>
|
||||
<group attrs="{'invisible': [('pricing_type','=','fixed_rate')]}">
|
||||
|
@ -96,6 +97,7 @@
|
|||
</group>
|
||||
<group>
|
||||
<field name="cost"/>
|
||||
<field name="consultant_cost"/>
|
||||
<field name="hourly_rate"/>
|
||||
<field name="budgeted_hour_week"/>
|
||||
</group>
|
||||
|
|
Loading…
Reference in New Issue