weekly hours
This commit is contained in:
parent
00bb3686d1
commit
6d5b74dd57
|
@ -29,6 +29,7 @@
|
|||
'views/crm_view.xml',
|
||||
'views/sale_views.xml',
|
||||
'views/project_view.xml',
|
||||
'views/hr_employee_views.xml',
|
||||
'views/hr_timesheet_templates.xml',
|
||||
'views/analytic_view.xml',
|
||||
'report/project_profitability_report_analysis_views.xml',
|
||||
|
|
|
@ -6,3 +6,4 @@ from . import project
|
|||
from . import project_overview
|
||||
from . import analytic
|
||||
from . import product
|
||||
from . import hr_employee
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from odoo import api, fields, models, _
|
||||
|
||||
|
||||
class HrEmployee(models.Model):
|
||||
_inherit = 'hr.employee'
|
||||
|
||||
budgeted_hour_week = fields.Integer("Budgeted Hours")
|
|
@ -46,6 +46,7 @@ class InheritProjectProductEmployeeMap(models.Model):
|
|||
budgeted_qty = fields.Float(string='Budgeted Qty', related='sale_line_id.product_uom_qty', readonly=True)
|
||||
budgeted_uom = fields.Many2one('uom.uom', string='Budgeted UOM', related='sale_line_id.product_uom', readonly=True)
|
||||
timesheet_hour = fields.Float("Timesheet Hour", compute='_compute_timesheet_hour', default=0.0)
|
||||
budgeted_hour_week = fields.Float("Budgeted Hours per week", compute='_compute_budgeted_hour_week')
|
||||
|
||||
def _compute_timesheet_hour(self):
|
||||
for val in self:
|
||||
|
@ -56,4 +57,11 @@ class InheritProjectProductEmployeeMap(models.Model):
|
|||
if res and res[2]:
|
||||
val.timesheet_hour = res[2]
|
||||
else:
|
||||
val.timesheet_hour = 0.0
|
||||
val.timesheet_hour = 0.0
|
||||
|
||||
def _compute_budgeted_hour_week(self):
|
||||
for val in self:
|
||||
if val.employee_id and val.employee_id.budgeted_hour_week and val.budgeted_qty:
|
||||
val.budgeted_hour_week = (val.budgeted_qty /val.employee_id.budgeted_hour_week)
|
||||
else:
|
||||
val.budgeted_hour_week = 0
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
|
||||
<record id="inherit_view_employee_form" model="ir.ui.view">
|
||||
<field name="name">hr.employee.form.inherit</field>
|
||||
<field name="model">hr.employee</field>
|
||||
<field name="inherit_id" ref="hr.view_employee_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//page[@name='hr_settings']" position="inside">
|
||||
<group>
|
||||
<label for="budgeted_hour_week"/>
|
||||
<div>
|
||||
<field name="budgeted_hour_week" class="oe_inline"/>
|
||||
per week
|
||||
</div>
|
||||
</group>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
|
@ -12,7 +12,8 @@
|
|||
</button>
|
||||
</div>
|
||||
<xpath expr="//field[@name='user_id']" position="replace">
|
||||
<field name="user_id" string="Project Manager" widget="many2one_avatar_user" required="0" attrs="{'readonly':[('active','=',False)]}" domain="[('share', '=', False)]"/>
|
||||
<field name="user_id" string="Project Manager" widget="many2one_avatar_user" required="0"
|
||||
attrs="{'readonly':[('active','=',False)]}" domain="[('share', '=', False)]"/>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='partner_id']" position="replace">
|
||||
<field name="partner_id" string="Client" required="0"/>
|
||||
|
@ -69,6 +70,9 @@
|
|||
<field name="timesheet_hour"/>
|
||||
<field name="employee_price" widget="monetary" options="{'currency_field': 'currency_id'}"/>
|
||||
<field name="currency_id" invisible="1" readonly="1"/>
|
||||
|
||||
<field name="budgeted_hour_week"/>
|
||||
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
|
|
Loading…
Reference in New Issue