add method for subproject
This commit is contained in:
parent
8703ed37f2
commit
1616e3654e
|
@ -14,8 +14,8 @@ 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)
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
<field name="inherit_id" ref="hr_timesheet.view_task_form2_inherited"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='timesheet_ids']//tree//field[@name='name']" position="after">
|
||||
<!--<field name="start_time" widget="float_time" invisible="1"/>
|
||||
<field name="end_time" widget="float_time" invisible="1"/>-->
|
||||
<field name="start_datetime" string="Start date"/>
|
||||
<field name="end_datetime" string="End date"/>
|
||||
</xpath>
|
||||
|
@ -178,21 +180,6 @@
|
|||
</field>
|
||||
</record>
|
||||
|
||||
<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>
|
||||
<field name="inherit_id" ref="hr_timesheet.hr_timesheet_line_search"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='date']" position="replace">
|
||||
<field name="start_datetime"/>
|
||||
</xpath>
|
||||
<xpath expr="//filter[@name='groupby_date']" position="replace">
|
||||
<filter string="Start Time" name="groupby_startdate" domain="[]" context="{'group_by': 'start_datetime'}" help="Timesheet by Start Date"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<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,6 +9,7 @@
|
|||
'license': '',
|
||||
'depends': ['base', 'project'],
|
||||
'data': ['views/sub_project.xml',
|
||||
#'views/analytic_view.xml',
|
||||
'security/ir.model.access.csv'],
|
||||
'demo': [''],
|
||||
'installable': True,
|
||||
|
|
|
@ -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"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
Loading…
Reference in New Issue