From a8ee852c8b77ef5c6b4f17bd3609bf2fcb6d67a5 Mon Sep 17 00:00:00 2001 From: Fabian Semal Date: Wed, 3 Sep 2008 16:06:37 +0200 Subject: [PATCH 1/2] Fixed Zero div on tasks bzr revid: fabian@tinyerp.com-20080903140637-ulg58ttgs50a13q5 --- addons/project/project.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/addons/project/project.py b/addons/project/project.py index 1ea69a12010..5e807d14e25 100644 --- a/addons/project/project.py +++ b/addons/project/project.py @@ -220,10 +220,13 @@ class task(osv.osv): def _progress_rate(self, cursor, user, ids, name, arg, context=None): res = {} for task in self.browse(cursor, user, ids, context=context): - tot = 0.0 - if task.state not in ('draft','cancelled'): - tot += task.effective_hours * 100.0 / task.planned_hours - res[task.id] = tot + if task.state in ('cancelled','done'): + res[task.id] = 100.0 + else: + if task.planned_hours: + res[task.id] = task.effective_hours * 100.0 / task.planned_hours + else: + res[task.id] = 0.0 return res _columns = { From c2561bd0c788b5fbff3ca2a8653b42921cbab07a Mon Sep 17 00:00:00 2001 From: Jay Vora Date: Wed, 3 Sep 2008 19:45:55 +0530 Subject: [PATCH 2/2] Corrected the copy behaviour of accounts and set condition for charts of accounts bzr revid: jvo@tinyerp.com-20080903141555-8sibwjd4x4v46qug --- addons/account/account.py | 6 +++--- addons/account/account_view.xml | 2 +- addons/product/product.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/addons/account/account.py b/addons/account/account.py index b7dd34a4f41..d36672a1e92 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -356,9 +356,9 @@ class account_account(osv.osv): child_ids=self.copy(cr, uid, child.id, default, context=context,done_list=done_list) if child_ids: new_child_ids.append(child_ids) - default['child_id'] = [(6, 0, new_child_ids)] + default['child_parent_ids'] = [(6, 0, new_child_ids)] else: - default['child_id'] = False + default['child_parent_ids'] = False return super(account_account, self).copy(cr, uid, id, default, context=context) def write(self, cr, uid, ids, vals, context=None): @@ -1899,7 +1899,7 @@ class wizard_multi_charts_accounts(osv.osv_memory): #recording the new tax code to do the mapping tax_code_template_ref[tax_code_template.id] = new_tax_code - #create all the tax + #create all the tax for tax in obj_multi.chart_template_id.tax_template_ids: #create it vals_tax = { diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index d4c69901f1b..eeb05967a4c 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -169,7 +169,7 @@ account.account tree - [('code','=','0')] + [('parent_id','=',False)] diff --git a/addons/product/product.py b/addons/product/product.py index ab53db828e1..427d97b9638 100644 --- a/addons/product/product.py +++ b/addons/product/product.py @@ -422,7 +422,7 @@ class product_product(osv.osv): 'price_margin': fields.float('Variant Price Margin', digits=(16, int(config['price_accuracy']))), } - def onchange_uom(self, cursor, user, ids, uom_id,uom_po_id): + def onchange_uom(self, cursor, user, ids, uom_id,uom_po_id): if uom_id and uom_po_id: uom_obj=self.pool.get('product.uom') uom=uom_obj.browse(cursor,user,[uom_id])[0]