summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGoffin Simon <simon.goffin@outlook.com>2015-02-05 13:10:56 +0100
committerGoffin Simon <sig@odoo.com>2015-02-19 09:11:21 +0100
commit8e5a0ac43cc38cd9e36b9c52523962b5e51dca95 (patch)
treef6b074622569aead2d6c48ab31a81931084bf4fe
parentd8eb9dd34716115eaec04e949ae54b7be9f72613 (diff)
[FIX]hr_timesheet: prevent quick creation and record opening for account fields
The quick creation and account record opening in the sheets are not useful. Besides, restricted users (simple employees) have no read access on account.account. opw:626989
-rw-r--r--addons/analytic_user_function/analytic_user_function_view.xml16
-rw-r--r--addons/hr_timesheet/hr_timesheet_view.xml4
-rw-r--r--addons/hr_timesheet_invoice/hr_timesheet_invoice_view.xml12
3 files changed, 20 insertions, 12 deletions
diff --git a/addons/analytic_user_function/analytic_user_function_view.xml b/addons/analytic_user_function/analytic_user_function_view.xml
index 051f15fd7f3..42e8123c2bc 100644
--- a/addons/analytic_user_function/analytic_user_function_view.xml
+++ b/addons/analytic_user_function/analytic_user_function_view.xml
@@ -78,8 +78,10 @@
<field name="priority" eval="19"/>
<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="replace">
- <field name="account_id" domain="[('type','=','normal'),('state', '&lt;&gt;', 'close')]" on_change="on_change_account_id(account_id, user_id, unit_amount)" context="{'default_use_timesheets': 1}"/>
+ <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="context">{'default_use_timesheets': 1}</attribute>
</xpath>
</field>
</record>
@@ -90,8 +92,9 @@
<field name="model">hr.analytic.timesheet</field>
<field name="inherit_id" ref="hr_timesheet.hr_timesheet_line_form"/>
<field name="arch" type="xml">
- <xpath expr="//field[@name='account_id']" position="replace">
- <field name="account_id" domain="[('type','=','normal'),('state', '&lt;&gt;', 'close')]" on_change="on_change_account_id(account_id, user_id, unit_amount)" />
+ <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>
</xpath>
</field>
</record>
@@ -112,8 +115,9 @@
<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='account_id']" position="replace">
- <field name="account_id" domain="[('type','=','normal'),('state', '&lt;&gt;', 'close')]" on_change="on_change_account_id(account_id, user_id, unit_amount)" />
+ <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>
</xpath>
</field>
</record>
diff --git a/addons/hr_timesheet/hr_timesheet_view.xml b/addons/hr_timesheet/hr_timesheet_view.xml
index fc0cd4ff7a1..4e19e1b689a 100644
--- a/addons/hr_timesheet/hr_timesheet_view.xml
+++ b/addons/hr_timesheet/hr_timesheet_view.xml
@@ -11,7 +11,7 @@
<field name="user_id" on_change="on_change_user_id(user_id)" required="1" options='{"no_open": True}'
context="{'default_groups_ref': ['base.group_user']}"/>
<field name="name"/>
- <field domain="[('type','=','normal'),('use_timesheets','=',1)]" name="account_id" context="{'default_use_timesheets': 1, 'default_type': 'contract'}"/>
+ <field domain="[('type','=','normal'),('use_timesheets','=',1)]" name="account_id" context="{'default_use_timesheets': 1, 'default_type': 'contract'}" options="{'no_open': True, 'no_create': True}"/>
<field name="unit_amount" string="Duration" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id)" sum="Total time" widget="float_time"/>
<field name="product_uom_id" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id)" invisible="1"/>
<field name="journal_id" invisible="1"/>
@@ -49,7 +49,7 @@
</div>
</group>
<group string="Accounting">
- <field domain="[('type','=','normal'),('state', '&lt;&gt;', 'close'),('parent_id','!=',False)]" name="account_id" select="1"/>
+ <field domain="[('type','=','normal'),('state', '&lt;&gt;', 'close'),('parent_id','!=',False)]" name="account_id" select="1" options="{'no_open': True, 'no_create': True}"/>
<field name="amount"/>
<field name="general_account_id"/>
<field name="journal_id"/>
diff --git a/addons/hr_timesheet_invoice/hr_timesheet_invoice_view.xml b/addons/hr_timesheet_invoice/hr_timesheet_invoice_view.xml
index bc06ed16ee2..a2c53f01db0 100644
--- a/addons/hr_timesheet_invoice/hr_timesheet_invoice_view.xml
+++ b/addons/hr_timesheet_invoice/hr_timesheet_invoice_view.xml
@@ -48,8 +48,10 @@
<field name="model">hr.analytic.timesheet</field>
<field name="inherit_id" ref="hr_timesheet.hr_timesheet_line_form"/>
<field name="arch" type="xml">
- <field name="account_id" position="replace">
- <field domain="[('type','in',['normal','contract']),('state', '&lt;&gt;', 'close'),('use_timesheets','=',1)]" name="account_id" on_change="on_change_account_id(account_id, user_id)" context="{'default_use_timesheets': 1}"/>
+ <field name="account_id" position="attributes">
+ <attribute name="domain">[('type','in',['normal','contract']),('state', '&lt;&gt;', 'close'),('use_timesheets','=',1)]</attribute>
+ <attribute name="on_change">on_change_account_id(account_id, user_id)</attribute>
+ <attribute name="context">{'default_use_timesheets': 1}</attribute>
</field>
</field>
</record>
@@ -70,8 +72,10 @@
<field name="model">hr.analytic.timesheet</field>
<field name="inherit_id" ref="hr_timesheet.hr_timesheet_line_tree"/>
<field name="arch" type="xml">
- <field name="account_id" position="replace">
- <field domain="[('type','in',['normal','contract']),('state', '&lt;&gt;', 'close'),('use_timesheets','=',1)]" name="account_id" on_change="on_change_account_id(account_id, user_id)" context="{'default_use_timesheets': 1}"/>
+ <field name="account_id" position="attributes">
+ <attribute name="domain">[('type','in',['normal','contract']),('state', '&lt;&gt;', 'close'),('use_timesheets','=',1)]</attribute>
+ <attribute name="on_change">on_change_account_id(account_id, user_id)</attribute>
+ <attribute name="context">{'default_use_timesheets': 1}</attribute>
</field>
</field>
</record>