diff --git a/addons/analytic_user_function/analytic_user_function.py b/addons/analytic_user_function/analytic_user_function.py
index c0e3c7f9c88..bd3d70e5de7 100644
--- a/addons/analytic_user_function/analytic_user_function.py
+++ b/addons/analytic_user_function/analytic_user_function.py
@@ -53,9 +53,9 @@ class account_analytic_line(osv.osv):
# Look in account, if no value for the user => look in parent until there is no more parent to look
# Take the first found... if nothing found => return False
- def _get_related_user_account_recursiv(self, cr, uid, user_id, account_id, context):
- user_function_id = self.pool.get('analytic.user.funct.grid').search(cr, uid, [('user_id', '=', user_id), ('account_id', '=', account_id)])
- account = self.pool['account.analytic.account'].browse(cr, uid, account_id)
+ def _get_related_user_account_recursiv(self, cr, uid, user_id, account_id, context=None):
+ user_function_id = self.pool.get('analytic.user.funct.grid').search(cr, uid, [('user_id', '=', user_id), ('account_id', '=', account_id)], context=context)
+ account = self.pool['account.analytic.account'].browse(cr, uid, account_id, context=context)
if user_function_id:
return user_function_id
elif account.parent_id:
@@ -68,16 +68,16 @@ class account_analytic_line(osv.osv):
if not (account_id):
return res
if not (user_id):
- return super(account_analytic_line, self).on_change_account_id(cr, uid, ids, account_id, user_id, is_timesheet, context)
+ return super(account_analytic_line, self).on_change_account_id(cr, uid, ids, account_id, user_id, unit_amount, is_timesheet, context)
# get the browse record related to user_id and account_id
user_function_id = self._get_related_user_account_recursiv(cr, uid, user_id, account_id, context)
if not user_function_id:
# if there isn't any record for this user_id and account_id
- return super(account_analytic_line, self).on_change_account_id(cr, uid, ids, account_id, user_id, is_timesheet, context)
+ return super(account_analytic_line, self).on_change_account_id(cr, uid, ids, account_id, user_id, unit_amount, is_timesheet, context)
else:
# get the old values from super and add the value from the new relation analytic_user_funct_grid
- res['value'] = super(account_analytic_line, self).on_change_account_id(cr, uid, ids, account_id, user_id, is_timesheet, context)['value']
+ res['value'] = super(account_analytic_line, self).on_change_account_id(cr, uid, ids, account_id, user_id, unit_amount, is_timesheet, context)['value']
res['value'].update(self._get_values_based_on_user_function(cr, uid, ids, user_function_id, unit_amount, context=context))
return res
diff --git a/addons/analytic_user_function/analytic_user_function_view.xml b/addons/analytic_user_function/analytic_user_function_view.xml
index 6010970b0ce..ff434cdd437 100644
--- a/addons/analytic_user_function/analytic_user_function_view.xml
+++ b/addons/analytic_user_function/analytic_user_function_view.xml
@@ -58,64 +58,11 @@
-
-
- hr.timesheet.sheet.form.tree
- hr_timesheet_sheet.sheet
-
-
-
-
- on_change_account_id(account_id, user_id, unit_amount, is_timesheet, context)
-
-
-
-
-
-
- hr.timesheet.sheet.form.form
- hr_timesheet_sheet.sheet
-
-
-
-
- on_change_account_id(account_id, user_id, unit_amount, is_timesheet, context)
- {'default_invoice_on_timesheets': 1}
-
-
-
-
-
-
- account.analytic.line.form
- account.analytic.line
-
-
-
- on_change_account_id(account_id, user_id, unit_amount, is_timesheet, context)
-
-
-
-
-
- account.analytic.line.form
- account.analytic.line
-
-
-
-
-
-
-
-
account.analytic.line.tree
account.analytic.line
-
- on_change_account_id(account_id, user_id, unit_amount, is_timesheet, context)
-
diff --git a/addons/hr_timesheet_invoice/hr_timesheet_invoice.py b/addons/hr_timesheet_invoice/hr_timesheet_invoice.py
index 2cb8bd754b6..326b2929228 100644
--- a/addons/hr_timesheet_invoice/hr_timesheet_invoice.py
+++ b/addons/hr_timesheet_invoice/hr_timesheet_invoice.py
@@ -288,7 +288,7 @@ class account_analytic_line(osv.osv):
invoice_obj.compute_taxes(cr, uid, [last_invoice], context)
return invoices
- def on_change_account_id(self, cr, uid, ids, account_id, user_id=False, is_timesheet=False, context=None):
+ def on_change_account_id(self, cr, uid, ids, account_id, user_id=False, unit_amount=0, is_timesheet=False, context=None):
res = {'value': {}}
if is_timesheet and account_id:
acc = self.pool.get('account.analytic.account').browse(cr, uid, account_id, context=context)
diff --git a/addons/hr_timesheet_invoice/hr_timesheet_invoice_view.xml b/addons/hr_timesheet_invoice/hr_timesheet_invoice_view.xml
index 30766544e13..77b3b25e14f 100644
--- a/addons/hr_timesheet_invoice/hr_timesheet_invoice_view.xml
+++ b/addons/hr_timesheet_invoice/hr_timesheet_invoice_view.xml
@@ -39,7 +39,7 @@
[('type','in',['normal','contract']),('state', '!=', 'close'),('invoice_on_timesheets','=',1)]
- on_change_account_id(account_id, user_id, is_timesheet, context)
+ on_change_account_id(account_id, user_id, unit_amount, is_timesheet, context)
{'default_invoice_on_timesheets': 1}
@@ -56,7 +56,7 @@
[('type','in',['normal','contract']),('state', '!=', 'close'),('invoice_on_timesheets','=',1)]
- on_change_account_id(account_id, user_id, is_timesheet, context)
+ on_change_account_id(account_id, user_id, unit_amount, is_timesheet, context)
{'default_invoice_on_timesheets': 1}
diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py
index cc5ff55a289..fee198150cc 100644
--- a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py
+++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py
@@ -350,7 +350,7 @@ class account_analytic_line(osv.osv):
return True
def multi_on_change_account_id(self, cr, uid, ids, account_ids, context=None):
- return dict([(account_id, self.on_change_account_id(cr, uid, ids, account_id, user_id=context.get('user_id', uid), is_timesheet=True, context=context)) for account_id in account_ids])
+ return dict([(account_id, self.on_change_account_id(cr, uid, ids, account_id, user_id=context.get('user_id', uid), unit_amount=0, is_timesheet=True, context=context)) for account_id in account_ids])
class hr_attendance(osv.osv):
diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml b/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml
index 86259b15525..42af5874cb2 100644
--- a/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml
+++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml
@@ -130,7 +130,7 @@
-
+
@@ -144,7 +144,7 @@