[MERGE][IMP] hr_timesheet: Quick create of contract (on timesheet) does not open contract edit window anymore

bzr revid: rim@openerp.com-20140414125558-zcwstm1ooa3qecpx
This commit is contained in:
Richard Mathot (OpenERP)
2014-04-14 14:55:58 +02:00
2 changed files with 14 additions and 3 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="replace">
<field name="account_id" domain="[('type','=','normal'),('state', '&lt;&gt;', 'close')]" on_change="on_change_account_id(account_id, user_id, unit_amount)"/>
<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>
</field>
</record>
@@ -79,7 +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="replace">
<field name="account_id" domain="[('type','=','normal'),('state', '&lt;&gt;', 'close')]" on_change="on_change_account_id(account_id, user_id, unit_amount)"/>
<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>
</field>
</record>
@@ -250,7 +250,18 @@ class account_analytic_line(osv.osv):
#if we don't get the dates from the timesheet, we return the default value from super()
return res
class account_analytic_account(osv.osv):
_inherit = "account.analytic.account"
def name_create(self, cr, uid, name, context=None):
if context is None:
context = {}
group_template_required = self.pool['res.users'].has_group(cr, uid, 'account_analytic_analysis.group_template_required')
if not context.get('default_use_timesheets', False) or group_template_required:
return super(account_analytic_account, self).name_create(cr, uid, name, context=context)
rec_id = self.create(cr, uid, {self._rec_name: name}, context)
return self.name_get(cr, uid, [rec_id], context)[0]
class hr_timesheet_line(osv.osv):
_inherit = "hr.analytic.timesheet"