From c70e22c1a212d0f8af9671dbc135fb74a488fd7a Mon Sep 17 00:00:00 2001 From: mtr Date: Fri, 28 Jan 2011 17:14:50 +0530 Subject: [PATCH 1/6] [FIX] account: allows duplication of account lp bug: https://launchpad.net/bugs/708603 fixed bzr revid: mtr@mtr-20110128114450-998ho3olsdfno7yw --- addons/account/account.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/addons/account/account.py b/addons/account/account.py index 3abbe4cef2e..bd0839243a5 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -300,11 +300,13 @@ class account_account(osv.osv): brs.pop(0) for fn in field_names: sums.setdefault(current.id, {})[fn] = accounts.get(current.id, {}).get(fn, 0.0) - for child in current.child_id: - if child.company_id.currency_id.id == current.company_id.currency_id.id: - sums[current.id][fn] += sums[child.id][fn] - else: - sums[current.id][fn] += currency_obj.compute(cr, uid, child.company_id.currency_id.id, current.company_id.currency_id.id, sums[child.id][fn], context=context) + if current.child_id: + for child in current.child_id: + if child.company_id.currency_id.id == current.company_id.currency_id.id: + if sums.get(child.id): + sums[current.id][fn] += sums[child.id][fn] + else: + sums[current.id][fn] += currency_obj.compute(cr, uid, child.company_id.currency_id.id, current.company_id.currency_id.id, sums[child.id][fn], context=context) res = {} null_result = dict((fn, 0.0) for fn in field_names) for id in ids: From 6127d931f3b19f62269943c094b59bec87c878f9 Mon Sep 17 00:00:00 2001 From: mtr Date: Mon, 31 Jan 2011 12:06:45 +0530 Subject: [PATCH 2/6] [FIX] account: allows duplication of account lp bug: https://launchpad.net/bugs/708603 fixed bzr revid: mtr@mtr-20110131063645-pjwyyj3uv1jp40i1 --- addons/account/account.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/addons/account/account.py b/addons/account/account.py index bd0839243a5..e9b0c9e7905 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -300,13 +300,12 @@ class account_account(osv.osv): brs.pop(0) for fn in field_names: sums.setdefault(current.id, {})[fn] = accounts.get(current.id, {}).get(fn, 0.0) - if current.child_id: - for child in current.child_id: - if child.company_id.currency_id.id == current.company_id.currency_id.id: - if sums.get(child.id): - sums[current.id][fn] += sums[child.id][fn] - else: - sums[current.id][fn] += currency_obj.compute(cr, uid, child.company_id.currency_id.id, current.company_id.currency_id.id, sums[child.id][fn], context=context) + for child in current.child_id: + if child.company_id.currency_id.id == current.company_id.currency_id.id: + if sums.get(child.id, False): + sums[current.id][fn] += sums[child.id][fn] + else: + sums[current.id][fn] += currency_obj.compute(cr, uid, child.company_id.currency_id.id, current.company_id.currency_id.id, sums[child.id][fn], context=context) res = {} null_result = dict((fn, 0.0) for fn in field_names) for id in ids: From 60ac3e49e1db82291e17f7bb83694c8f850ca75a Mon Sep 17 00:00:00 2001 From: Mustufa Rangwala Date: Mon, 31 Jan 2011 12:18:45 +0530 Subject: [PATCH 3/6] [FIX] hr_holidays: can not refuse an approved holidays => due to case_id was char lp bug: https://launchpad.net/bugs/709130 fixed bzr revid: mra@mra-laptop-20110131064845-2joefqn4oqh1gob1 --- addons/hr_holidays/hr_holidays.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/hr_holidays/hr_holidays.py b/addons/hr_holidays/hr_holidays.py index 3e7a4a1b3a2..a7d9a1129bd 100644 --- a/addons/hr_holidays/hr_holidays.py +++ b/addons/hr_holidays/hr_holidays.py @@ -111,7 +111,7 @@ class hr_holidays(osv.osv): _columns = { 'name': fields.char('Description', required=True, size=64), - 'state': fields.selection([('draft', 'Draft'), ('confirm', 'Waiting Approval'), ('refuse', 'Refused'), + 'state': fields.selection([('draft', 'Draft'), ('confirm', 'Waiting Approval'), ('refuse', 'Refused'), ('validate1', 'Waiting Second Approval'), ('validate', 'Approved'), ('cancel', 'Cancelled')], 'State', readonly=True, help='When the holiday request is created the state is \'Draft\'.\n It is confirmed by the user and request is sent to admin, the state is \'Waiting Approval\'.\ If the admin accepts it, the state is \'Approved\'. If it is refused, the state is \'Refused\'.'), @@ -290,7 +290,7 @@ class hr_holidays(osv.osv): for record in self.browse(cr, uid, ids): # Delete the meeting if record.case_id: - obj_crm_meeting.unlink(cr, uid, [record.case_id]) + obj_crm_meeting.unlink(cr, uid, [int(record.case_id)]) # If a category that created several holidays, cancel all related wf_service = netsvc.LocalService("workflow") From f1d38b5844dc5ad40935e0b2d16f246329d418ae Mon Sep 17 00:00:00 2001 From: mtr Date: Mon, 31 Jan 2011 13:07:05 +0530 Subject: [PATCH 4/6] [IMP] account:placed else condition inside 'if sums.get(child.id, False):' bzr revid: mtr@mtr-20110131073705-2m6d54pjia4y1506 --- addons/account/account.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/account/account.py b/addons/account/account.py index e9b0c9e7905..6d4fe4eb98f 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -304,8 +304,8 @@ class account_account(osv.osv): if child.company_id.currency_id.id == current.company_id.currency_id.id: if sums.get(child.id, False): sums[current.id][fn] += sums[child.id][fn] - else: - sums[current.id][fn] += currency_obj.compute(cr, uid, child.company_id.currency_id.id, current.company_id.currency_id.id, sums[child.id][fn], context=context) + else: + sums[current.id][fn] += currency_obj.compute(cr, uid, child.company_id.currency_id.id, current.company_id.currency_id.id, sums[child.id][fn], context=context) res = {} null_result = dict((fn, 0.0) for fn in field_names) for id in ids: From 6847838d4b9bc1505a2f894bf7934437eac1ce33 Mon Sep 17 00:00:00 2001 From: mtr Date: Mon, 31 Jan 2011 13:32:07 +0530 Subject: [PATCH 5/6] [IMP] account:improved code for the account duplication bug bzr revid: mtr@mtr-20110131080207-hmsbxkmonkvdh3to --- addons/account/account.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/account/account.py b/addons/account/account.py index 6d4fe4eb98f..8a2cbdb8451 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -301,8 +301,8 @@ class account_account(osv.osv): for fn in field_names: sums.setdefault(current.id, {})[fn] = accounts.get(current.id, {}).get(fn, 0.0) for child in current.child_id: - if child.company_id.currency_id.id == current.company_id.currency_id.id: - if sums.get(child.id, False): + if sums.get(child.id, False): + if child.company_id.currency_id.id == current.company_id.currency_id.id: sums[current.id][fn] += sums[child.id][fn] else: sums[current.id][fn] += currency_obj.compute(cr, uid, child.company_id.currency_id.id, current.company_id.currency_id.id, sums[child.id][fn], context=context) From a78c1cf7ca3e021105b2b9772f0b1bfd1d9fc845 Mon Sep 17 00:00:00 2001 From: Mustufa Rangwala Date: Mon, 31 Jan 2011 13:35:56 +0530 Subject: [PATCH 6/6] [FIX] hr_expense: hr_expense: amounts must not be float lp bug: https://launchpad.net/bugs/709667 fixed bzr revid: mra@mra-laptop-20110131080556-jpw0ek3nwoojkxbf --- addons/hr_expense/hr_expense.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/hr_expense/hr_expense.py b/addons/hr_expense/hr_expense.py index f3d5f9657cb..40e0091d05e 100644 --- a/addons/hr_expense/hr_expense.py +++ b/addons/hr_expense/hr_expense.py @@ -24,6 +24,7 @@ import time import netsvc from osv import fields, osv from tools.translate import _ +import decimal_precision as dp def _employee_get(obj, cr, uid, context=None): if context is None: @@ -225,8 +226,8 @@ class hr_expense_line(osv.osv): 'name': fields.char('Expense Note', size=128, required=True), 'date_value': fields.date('Date', required=True), 'expense_id': fields.many2one('hr.expense.expense', 'Expense', ondelete='cascade', select=True), - 'total_amount': fields.function(_amount, method=True, string='Total'), - 'unit_amount': fields.float('Unit Price'), + 'total_amount': fields.function(_amount, method=True, string='Total', digits_compute=dp.get_precision('Account')), + 'unit_amount': fields.float('Unit Price', digits_compute=dp.get_precision('Account')), 'unit_quantity': fields.float('Quantities' ), 'product_id': fields.many2one('product.product', 'Product', domain=[('hr_expense_ok','=',True)]), 'uom_id': fields.many2one('product.uom', 'UoM' ),