Merge branch 'pawan_branch' into 'development'

Pawan branch

See merge request prakash.jain/cor-odoo!36
This commit is contained in:
pawan.sharma 2020-12-29 22:56:05 -08:00
commit 5f117f6d9f
2 changed files with 13 additions and 10 deletions

View File

@ -37,23 +37,26 @@ class Project(models.Model):
"- Invited portal and all internal users: employees may see everything."
" Portal users may see project and tasks followed by\n"
" them or by someone of their company.")
allow_billable = fields.Boolean("Billable", default=True, help="Invoice your time and material from tasks.")
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 Qty', related='sale_line_id.product_uom_qty', readonly=True, store=True)
budgeted_qty = fields.Float(string='Budgeted Hours', related='sale_line_id.product_uom_qty', readonly=True, 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)
budgeted_hour_week = fields.Float("Budgeted Hours per week", compute='_compute_budgeted_hour_week')
budgeted_hour_week = fields.Float("Budgeted Hours per week ", compute='_compute_budgeted_hour_week')
price_unit = fields.Float("Hourly rate", compute='_compute_price_unit', store=True, readonly=True)
sale_line_id = fields.Many2one('sale.order.line', "Service", domain=[('is_service', '=', True)])
def _compute_timesheet_hour(self):
for val in self:
self._cr.execute('''SELECT project_id, employee_id, SUM(unit_amount) FROM account_analytic_line
where project_id = %(project_id)s and employee_id = %(employee_id)s
GROUP BY project_id, employee_id''', { 'project_id': val.project_id.id, 'employee_id': val.employee_id.id,})
GROUP BY project_id, employee_id''', { 'project_id': val.project_id._origin.id, 'employee_id': val.employee_id.id,})
res = self._cr.fetchone()
if res and res[2]:
val.timesheet_hour = res[2]

View File

@ -57,22 +57,22 @@
<tree editable="top">
<field name="company_id" invisible="1"/>
<field name="project_id" invisible="1"/>
<field name="employee_id" options="{'no_create': True}" string="Consultant"/>
<field name="timesheet_product_id"
<field name="employee_id" options="{'no_create': True}" string="Consultant Name"/>
<field name="timesheet_product_id"
attrs="{'column_invisible': [('parent.sale_order_id', '!=', False)]}"/>
<field name="sale_line_id" options="{'no_create': True}"
attrs="{'column_invisible': [('parent.sale_order_id', '=', False)]}"
domain="[('order_id','=',parent.sale_order_id), ('is_service', '=', True)]"/>
<field name="budgeted_qty" attrs="{'column_invisible': [('parent.sale_order_id', '=', False)]}"/>
<field name="budgeted_uom" attrs="{'column_invisible': [('parent.sale_order_id', '=', False)]}"/>
<!--<field name="budgeted_uom"
attrs="{'column_invisible': [('parent.sale_order_id', '=', False)]}"/>-->
<field name="price_unit" widget="monetary" options="{'currency_field': 'currency_id'}"
attrs="{'readonly': [('parent.sale_order_id', '!=', False)]}"/>
<field name="budgeted_qty"
attrs="{'column_invisible': [('parent.sale_order_id', '=', False)]}"/>
<field name="timesheet_hour"/>
<field name="employee_price" widget="monetary" options="{'currency_field': 'currency_id'}"/>
<!--<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>