From c718661ba8ca6972f86fa21f427dd8b17b6dff80 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Tue, 10 Feb 2015 11:48:41 +0100 Subject: [PATCH 1/2] [FIX] hr_timesheet_sheet: default product in analytic lines The module analytic_user_function allows to define a specific product to use, when creating timesheet activities for a specific employee with a specific contract Nevertheless, the product was not set accordingly to this feature for the first timesheet activity, because, when initilialing the timesheet line, the on_change_account_id, which returns the product to use according to the user and contract, was called without passing the user. Besides, by default, on_change_account_id does not have a user_id parameter, this parameter is added by the module analytic_user_function, overriding this onchange, and adding a new user_id parameter (which is not a good pratice). We therefore use multi_on_change_account_id, which allow to pass the user_id, within the context --- addons/hr_timesheet_sheet/static/src/js/timesheet.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/hr_timesheet_sheet/static/src/js/timesheet.js b/addons/hr_timesheet_sheet/static/src/js/timesheet.js index ef1e2f17145..ca949937879 100644 --- a/addons/hr_timesheet_sheet/static/src/js/timesheet.js +++ b/addons/hr_timesheet_sheet/static/src/js/timesheet.js @@ -259,7 +259,9 @@ openerp.hr_timesheet_sheet = function(instance) { return; } var ops = self.generate_o2m_value(); - new instance.web.Model("hr.analytic.timesheet").call("on_change_account_id", [[], id]).then(function(res) { + new instance.web.Model("hr.analytic.timesheet").call("multi_on_change_account_id", [[], [id], + new instance.web.CompoundContext({'user_id': self.get('user_id')})]).then(function(res) { + res = res[id]; var def = _.extend({}, self.default_get, res.value, { name: self.description_line, unit_amount: 0, From 368c674a9bd74aa1ee8a11aea76721a767ad9486 Mon Sep 17 00:00:00 2001 From: Julien Laloux Date: Tue, 10 Feb 2015 15:23:25 +0100 Subject: [PATCH 2/2] [FIX] account_followup: formatted user language date in followup text When using %(date)s in the follow-up text in the follow-up levels configuration the date was formatted within server date format instead of the partner language date format. Closes https://github.com/odoo/odoo/pull/5168 --- addons/account_followup/report/account_followup_print.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/account_followup/report/account_followup_print.py b/addons/account_followup/report/account_followup_print.py index 16d88d69572..25103498b4b 100644 --- a/addons/account_followup/report/account_followup_print.py +++ b/addons/account_followup/report/account_followup_print.py @@ -103,9 +103,12 @@ class report_rappel(report_sxw.rml_parse): partner_max_text = i.followup_line_id.description text = partner_max_delay and partner_max_text or default_text if text: + lang_obj = self.pool['res.lang'] + lang_ids = lang_obj.search(self.cr, self.uid, [('code', '=', stat_line.partner_id.lang)], context=context) + date_format = lang_ids and lang_obj.browse(self.cr, self.uid, lang_ids[0], context=context).date_format or '%Y-%m-%d' text = text % { 'partner_name': stat_line.partner_id.name, - 'date': time.strftime('%Y-%m-%d'), + 'date': time.strftime(date_format), 'company_name': stat_line.company_id.name, 'user_signature': pooler.get_pool(self.cr.dbname).get('res.users').browse(self.cr, self.uid, self.uid, context).signature or '', }