[REF] Refactored hr_timesheet: Refactored the "timesheet" model in several modules. hr.analytic.timesheet is removed, and account.analytic.line is used directly to represent timesheets.

Also removed worklogs on tasks and replaced them by generic timesheets, i.e. account.analytic.line(s)
This commit is contained in:
odoo-tac
2015-04-28 10:31:18 +02:00
parent eb91b14837
commit 14183ba2be
46 changed files with 915 additions and 1273 deletions
@@ -66,7 +66,7 @@
<field name="inherit_id" ref="hr_timesheet_sheet.hr_timesheet_sheet_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='timesheet_ids']/tree/field[@name='account_id']" position="attributes">
<attribute name="on_change">on_change_account_id(account_id, user_id, unit_amount)</attribute>
<attribute name="on_change">on_change_account_id(account_id, user_id, unit_amount, is_timesheet, context)</attribute>
</xpath>
</field>
</record>
@@ -79,8 +79,7 @@
<field name="inherit_id" ref="hr_timesheet_sheet.hr_timesheet_sheet_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='timesheet_ids']/form/field[@name='account_id']" position="attributes">
<attribute name="domain">[('type','=','normal'),('state', '&lt;&gt;', 'close')]</attribute>
<attribute name="on_change">on_change_account_id(account_id, user_id, unit_amount)</attribute>
<attribute name="on_change">on_change_account_id(account_id, user_id, unit_amount, is_timesheet, context)</attribute>
<attribute name="context">{'default_invoice_on_timesheets': 1}</attribute>
</xpath>
</field>
@@ -88,50 +87,39 @@
<!-- hr.analytic.timesheet inherited views -->
<record model="ir.ui.view" id="hr_timesheet_line_form_inherit">
<field name="name">hr.analytic.timesheet.form</field>
<field name="model">hr.analytic.timesheet</field>
<field name="inherit_id" ref="hr_timesheet.hr_timesheet_line_form"/>
<field name="name">account.analytic.line.form</field>
<field name="model">account.analytic.line</field>
<field name="inherit_id" ref="hr_timesheet_invoice.hr_timesheet_line_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='account_id']" position="attributes">
<attribute name="domain">[('type','=','normal'),('state', '&lt;&gt;', 'close')]</attribute>
<attribute name="on_change">on_change_account_id(account_id, user_id, unit_amount)</attribute>
<attribute name="on_change">on_change_account_id(account_id, user_id, unit_amount, is_timesheet, context)</attribute>
</xpath>
</field>
</record>
<record model="ir.ui.view" id="hr_timesheet_line_form_inherit_2">
<field name="name">hr.analytic.timesheet.form</field>
<field name="model">hr.analytic.timesheet</field>
<field name="inherit_id" ref="hr_timesheet.hr_timesheet_line_form"/>
<field name="name">account.analytic.line.form</field>
<field name="model">account.analytic.line</field>
<field name="inherit_id" ref="hr_timesheet_invoice.hr_timesheet_line_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='user_id']" position="replace">
<field name="user_id" required="1" on_change="on_change_user_id(user_id, account_id, unit_amount)"/>
<field name="user_id" required="1" on_change="on_change_user_id(user_id, unit_amount, account_id, is_timesheet, context)"/>
</xpath>
</field>
</record>
<record model="ir.ui.view" id="hr_timesheet_line_tree_inherit">
<field name="name">hr.analytic.timesheet.tree</field>
<field name="model">hr.analytic.timesheet</field>
<field name="inherit_id" ref="hr_timesheet.hr_timesheet_line_tree"/>
<field name="name">account.analytic.line.tree</field>
<field name="model">account.analytic.line</field>
<field name="inherit_id" ref="hr_timesheet_invoice.hr_timesheet_line_tree"/>
<field name="arch" type="xml">
<xpath expr="/tree/field[@name='account_id']" position="attributes">
<attribute name="domain">[('type','=','normal'),('state', '&lt;&gt;', 'close')]</attribute>
<attribute name="on_change">on_change_account_id(account_id, user_id, unit_amount)</attribute>
<attribute name="on_change">on_change_account_id(account_id, user_id, unit_amount, is_timesheet, context)</attribute>
</xpath>
</field>
</record>
<record model="ir.ui.view" id="hr_timesheet_line_tree_inherit_2">
<field name="name">hr.analytic.timesheet.tree</field>
<field name="model">hr.analytic.timesheet</field>
<field name="inherit_id" ref="hr_timesheet.hr_timesheet_line_tree"/>
<field name="arch" type="xml">
<xpath expr="/tree/field[@name='user_id']" position="replace">
<field name="user_id" required="1" on_change="on_change_user_id(user_id, account_id, unit_amount)" context="{'default_groups_ref': ['base.group_user']}"/>
<field name="user_id" required="1" on_change="on_change_user_id(user_id, unit_amount, account_id, is_timesheet, context)" context="{'default_groups_ref': ['base.group_user']}"/>
</xpath>
</field>
</record>
</data>
</openerp>