diff --git a/addons/account/account.py b/addons/account/account.py index bfc16a4c419..7ec3bcde2c8 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -2999,6 +2999,7 @@ class wizard_multi_charts_accounts(osv.osv_memory): _columns = { 'company_id':fields.many2one('res.company', 'Company', required=True), + 'currency_id': fields.many2one('res.currency', 'Currency', help="Currency as per company's country."), 'only_one_chart_template': fields.boolean('Only One Chart Template Available'), 'chart_template_id': fields.many2one('account.chart.template', 'Chart Template', required=True), 'bank_accounts_id': fields.one2many('account.bank.accounts.wizard', 'bank_account_id', 'Cash and Banks', required=True), @@ -3009,6 +3010,13 @@ class wizard_multi_charts_accounts(osv.osv_memory): 'purchase_tax_rate': fields.float('Purchase Tax(%)'), 'complete_tax_set': fields.boolean('Complete Set of Taxes', help='This boolean helps you to choose if you want to propose to the user to encode the sales and purchase rates or use the usual m2o fields. This last choice assumes that the set of tax defined for the chosen template is complete'), } + + def onchange_company_id(self, cr, uid, ids, company_id, context=None): + currency_id = False + if company_id: + currency_id = self.pool.get('res.company').browse(cr, uid, company_id, context=context).currency_id.id + return {'value': {'currency_id': currency_id}} + def onchange_tax_rate(self, cr, uid, ids, rate=False, context=None): return {'value': {'purchase_tax_rate': rate or False}} @@ -3039,6 +3047,13 @@ class wizard_multi_charts_accounts(osv.osv_memory): res.update({'bank_accounts_id': [{'acc_name': _('Cash'), 'account_type': 'cash'},{'acc_name': _('Bank'), 'account_type': 'bank'}]}) if 'company_id' in fields: res.update({'company_id': self.pool.get('res.users').browse(cr, uid, [uid], context=context)[0].company_id.id}) + if 'currency_id' in fields: + company_id = res.get('company_id') or False + if company_id: + company_obj = self.pool.get('res.company') + country_id = company_obj.browse(cr, uid, company_id, context=context).country_id.id + currency_id = company_obj.on_change_country(cr, uid, company_id, country_id, context=context)['value']['currency_id'] + res.update({'currency_id': currency_id}) ids = self.pool.get('account.chart.template').search(cr, uid, [('visible', '=', True)], context=context) if ids: @@ -3343,6 +3358,7 @@ class wizard_multi_charts_accounts(osv.osv_memory): ir_values_obj = self.pool.get('ir.values') obj_wizard = self.browse(cr, uid, ids[0]) company_id = obj_wizard.company_id.id + self.pool.get('res.company').write(cr, uid, [company_id], {'currency_id': obj_wizard.currency_id.id}) # If the floats for sale/purchase rates have been filled, create templates from them self._create_tax_templates_from_rates(cr, uid, obj_wizard, company_id, context=context) diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index 81e683e1cfd..e3c5c211990 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -2371,8 +2371,10 @@
+
diff --git a/addons/hr_attendance/static/src/css/slider.css b/addons/hr_attendance/static/src/css/slider.css index 9e0252156b2..664d4f96e41 100644 --- a/addons/hr_attendance/static/src/css/slider.css +++ b/addons/hr_attendance/static/src/css/slider.css @@ -8,9 +8,12 @@ float:left; height: 32px; width: 32px; - background: url(/hr_attendance/static/src/img/emp-in32.png); + background: url(/hr_attendance/static/src/img/emp-out32.png); cursor: pointer; } +.openerp .oe_attendance_signin:hover { + background: url(/hr_attendance/static/src/img/emp-out-disable32.png); +} .openerp .oe_attendance_status.oe_attendance_signed .oe_attendance_signin { display: none; } @@ -19,9 +22,12 @@ float:right; height: 32px; width: 32px; - background: url(/hr_attendance/static/src/img/emp-out32.png); + background: url(/hr_attendance/static/src/img/emp-in32.png); cursor: pointer; } +.openerp .oe_attendance_signout:hover { + background: url(/hr_attendance/static/src/img/emp-in-disable32.png); +} .openerp .oe_attendance_status.oe_attendance_nosigned .oe_attendance_signout { display: none; } diff --git a/addons/hr_attendance/static/src/js/attendance.js b/addons/hr_attendance/static/src/js/attendance.js index f6a4c15268a..0366fa47c6c 100644 --- a/addons/hr_attendance/static/src/js/attendance.js +++ b/addons/hr_attendance/static/src/js/attendance.js @@ -4,11 +4,6 @@ openerp.hr_attendance = function (instance) { var QWeb = instance.web.qweb; var _t = instance.web._t; var _lt = instance.web._lt; - - var tips = { - "true": _lt("You are currently signed in. Click here to sign out."), - "false": _lt("You are currently signed out. Click here to sign in."), - } instance.hr_attendance.AttendanceSlider = instance.web.Widget.extend({ template: 'AttendanceSlider', @@ -21,7 +16,6 @@ openerp.hr_attendance = function (instance) { var tmp = function() { this.$el.toggleClass("oe_attendance_nosigned", ! this.get("signed_in")); this.$el.toggleClass("oe_attendance_signed", this.get("signed_in")); - this.$el.attr("title", tips["" + this.get("signed_in")].toString()); }; this.on("change:signed_in", this, tmp); _.bind(tmp, this)(); @@ -31,6 +25,19 @@ openerp.hr_attendance = function (instance) { this.$(".oe_attendance_signout").click(function() { self.do_update_attendance(); }); + this.$el.tipsy({ + title: function() { + var last_text = instance.web.format_value(self.last_sign, {type: "datetime"}); + var current_text = instance.web.format_value(new Date(), {type: "datetime"}); + var duration = $.timeago(self.last_sign); + if (self.get("signed_in")) { + return _.str.sprintf(_t("Last sign in: %s,
%s.
Click to sign out."), last_text, duration); + } else { + return _.str.sprintf(_t("Click to Sign In at %s."), current_text); + } + }, + html: true, + }); return this.check_attendance(); }, do_update_attendance: function () { @@ -39,6 +46,7 @@ openerp.hr_attendance = function (instance) { hr_employee.call('attendance_action_change', [ [self.employee.id] ]).done(function (result) { + self.last_sign = new Date(); self.set({"signed_in": ! self.get("signed_in")}); }); }, @@ -49,11 +57,12 @@ openerp.hr_attendance = function (instance) { var employee = new instance.web.DataSetSearch(self, 'hr.employee', self.session.user_context, [ ['user_id', '=', self.session.uid] ]); - return employee.read_slice(['id', 'name', 'state']).pipe(function (res) { + return employee.read_slice(['id', 'name', 'state', 'last_sign']).pipe(function (res) { if (_.isEmpty(res)) return; self.$el.show(); self.employee = res[0]; + self.last_sign = instance.web.str_to_datetime(self.employee.last_sign); self.set({"signed_in": self.employee.state !== "absent"}); }); }, diff --git a/addons/hr_attendance/static/src/xml/attendance.xml b/addons/hr_attendance/static/src/xml/attendance.xml index 6896086440f..3fd9bcf2798 100644 --- a/addons/hr_attendance/static/src/xml/attendance.xml +++ b/addons/hr_attendance/static/src/xml/attendance.xml @@ -1,6 +1,6 @@