Merge branch 'pawan_branch' into 'development'
Pawan branch See merge request prakash.jain/cor-odoo!142
This commit is contained in:
commit
6410ece7fa
|
@ -14,13 +14,38 @@ import dateutil.parser
|
|||
class AccountAnalyticLine(models.Model):
|
||||
_inherit = 'account.analytic.line'
|
||||
|
||||
#start_time = fields.Float(string='Start Time', digits=(16, 2))
|
||||
#end_time = fields.Float(string='End Time', digits=(16, 2))
|
||||
start_time = fields.Float(string='Start Time', digits=(16, 2))
|
||||
end_time = fields.Float(string='End Time', digits=(16, 2))
|
||||
start_datetime = fields.Datetime("Start Time", required=True)
|
||||
end_datetime = fields.Datetime("End Time", required=True)
|
||||
unit_amount = fields.Float('Duration', default=0.0)
|
||||
parent_project = fields.Many2one('project.project', related='project_id.parent_project', string='Parent Project')
|
||||
sub_project = fields.Many2many('project.project', 'project_subproject_timesheet_rel', 'project_id', 'id',
|
||||
domain="[('is_sub_project', '=', True)]",
|
||||
string='Sub Project')
|
||||
|
||||
# @api.onchange('employee_id')
|
||||
# def onchange_employee_id(self):
|
||||
# res = {}
|
||||
# emp_ids = [emp.employee_id.id for emp in self.project_id.sale_line_employee_ids]
|
||||
# res['domain'] = {'employee_id': [('id', 'in', emp_ids)]}
|
||||
# if 'project_id' in self.env.context:
|
||||
# # if not self.env.context['project_id']:
|
||||
# # raise UserError(_('Please save record before add a line'))
|
||||
# if not emp_ids:
|
||||
# raise UserError(_('Please add consultant at Invoicing tab before add a line'))
|
||||
# res['domain'] = {'employee_id': [('id', 'in', emp_ids)]}
|
||||
# return res
|
||||
|
||||
@api.onchange('project_id')
|
||||
def _onchange_sub_project_id(self):
|
||||
self.sub_project = False
|
||||
res = {}
|
||||
if self.project_id and self.project_id.sub_project:
|
||||
res['domain'] = {'sub_project': [('id', 'in', self.project_id.sub_project.ids)]}
|
||||
else:
|
||||
res['domain'] = {'sub_project': [('id', '=', False)]}
|
||||
return res
|
||||
|
||||
def _default_start_datetime(self):
|
||||
return fields.Datetime.to_string(datetime.combine(fields.Datetime.now(), datetime.min.time()))
|
||||
|
|
|
@ -67,6 +67,7 @@
|
|||
<field name="employee_id" invisible="1"/>
|
||||
<field name="project_id" required="1" options="{'no_create_edit': True}"
|
||||
context="{'form_view_ref': 'project.project_project_view_form_simplified',}"/>
|
||||
<field name="sub_project" widget="many2many_tags" options="{'no_open': True, 'no_create': True, 'no_create_edit': True}"/>
|
||||
<field name="task_id" optional="show" options="{'no_create_edit': True, 'no_open': True}"
|
||||
widget="task_with_hours" context="{'default_project_id': project_id}"
|
||||
domain="[('project_id', '=', project_id)]"/>
|
||||
|
@ -75,7 +76,7 @@
|
|||
<field name="end_datetime" string="End Time"/><!--custom-->
|
||||
<field name="unit_amount" optional="show" widget="timesheet_uom" sum="Total"
|
||||
decoration-danger="unit_amount > 24"/>
|
||||
<field name="parent_project" options="{'no_open': True, 'no_create': True, 'no_create_edit': True}"/><!--custom-->
|
||||
<!--<field name="parent_project" options="{'no_open': True, 'no_create': True, 'no_create_edit': True}"/>--><!--custom-->
|
||||
<field name="company_id" invisible="1"/>
|
||||
<field name="user_id" invisible="1"/>
|
||||
</tree>
|
||||
|
@ -178,6 +179,8 @@
|
|||
</field>
|
||||
</record>
|
||||
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
<record id="timesheet_view_inherit1_search" model="ir.ui.view">
|
||||
<field name="name">account.analytic.line.search</field>
|
||||
<field name="model">account.analytic.line</field>
|
||||
|
@ -213,6 +216,7 @@
|
|||
</record>-->
|
||||
|
||||
|
||||
>>>>>>> 0964d5378c9e26188e9e977126bb2beb977992ea
|
||||
<record id="view_hr_my_timesheet_line_calendar" model="ir.ui.view">
|
||||
<field name="name">account.analytic.line.calendar</field>
|
||||
<field name="model">account.analytic.line</field>
|
||||
|
|
|
@ -9,9 +9,10 @@
|
|||
'license': '',
|
||||
'depends': ['base', 'project'],
|
||||
'data': ['views/sub_project.xml',
|
||||
#'views/analytic_view.xml',
|
||||
'security/ir.model.access.csv'],
|
||||
'demo': [''],
|
||||
'installable': True,
|
||||
'auto_install': False,
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
from . import sub_project
|
||||
from . import sub_project
|
||||
from . import analytic
|
|
@ -0,0 +1,32 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details
|
||||
|
||||
from odoo import api, exceptions, fields, models, tools, _
|
||||
from odoo.exceptions import UserError, AccessError, ValidationError
|
||||
from odoo.osv import expression
|
||||
import math
|
||||
from datetime import datetime, time, timedelta
|
||||
from odoo.tools.float_utils import float_round
|
||||
from odoo.tools import DEFAULT_SERVER_DATE_FORMAT, ustr
|
||||
import dateutil.parser
|
||||
|
||||
|
||||
class AccountAnalyticLineSubProject(models.Model):
|
||||
_inherit = 'account.analytic.line'
|
||||
|
||||
# sub_project = fields.Many2many('project.project', 'project_subproject_timesheet_rel', 'project_id', 'id',
|
||||
# domain="[('is_sub_project', '=', True),('parent_project', '=', False)]",
|
||||
# string='Sub Project')
|
||||
|
||||
|
||||
|
||||
# @api.onchange('project_id')
|
||||
# def _onchange_parent_project_id(self):
|
||||
# if self.project_id:
|
||||
# parent_project = self.env['project.project'].search([('sub_project', '=', self.project_id.id)], limit=1)
|
||||
# if parent_project:
|
||||
# self.parent_project = parent_project.id
|
||||
# else:
|
||||
# self.parent_project = False
|
||||
# else:
|
||||
# self.parent_project = False
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<!--<record id="hr_timesheet_line_tree_inherit_subproject" model="ir.ui.view">
|
||||
<field name="name">account.analytic.line.tree.subproject</field>
|
||||
<field name="model">account.analytic.line</field>
|
||||
<field name="inherit_id" ref="hr_timesheet.timesheet_view_tree_user"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='project_id']" position="after">
|
||||
<field name="sub_project" widget="many2many_tags"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>-->
|
||||
</odoo>
|
Loading…
Reference in New Issue