diff --git a/addons/hr_payroll/hr_payroll.py b/addons/hr_payroll/hr_payroll.py index 51dc67dd22f..c68f163742e 100644 --- a/addons/hr_payroll/hr_payroll.py +++ b/addons/hr_payroll/hr_payroll.py @@ -858,18 +858,20 @@ result = rules.NET > categories.NET * 0.10''', rule = self.browse(cr, uid, rule_id, context=context) if rule.amount_select == 'fix': try: - return rule.amount_fix, eval(rule.quantity, localdict), 100.0 + return rule.amount_fix, float(eval(rule.quantity, localdict)), 100.0 except: raise osv.except_osv(_('Error!'), _('Wrong quantity defined for salary rule %s (%s).')% (rule.name, rule.code)) elif rule.amount_select == 'percentage': try: - return eval(rule.amount_percentage_base, localdict), eval(rule.quantity, localdict), rule.amount_percentage + return (float(eval(rule.amount_percentage_base, localdict)), + float(eval(rule.quantity, localdict)), + rule.amount_percentage) except: raise osv.except_osv(_('Error!'), _('Wrong percentage base or quantity defined for salary rule %s (%s).')% (rule.name, rule.code)) else: try: eval(rule.amount_python_compute, localdict, mode='exec', nocopy=True) - return localdict['result'], 'result_qty' in localdict and localdict['result_qty'] or 1.0, 'result_rate' in localdict and localdict['result_rate'] or 100.0 + return float(localdict['result']), 'result_qty' in localdict and localdict['result_qty'] or 1.0, 'result_rate' in localdict and localdict['result_rate'] or 100.0 except: raise osv.except_osv(_('Error!'), _('Wrong python code defined for salary rule %s (%s).')% (rule.name, rule.code)) diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index c1f99e218f9..b662d7882b2 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -1013,10 +1013,12 @@ class purchase_order_line(osv.osv): context_partner.update( {'lang': lang, 'partner_id': partner_id} ) product = product_product.browse(cr, uid, product_id, context=context_partner) #call name_get() with partner in the context to eventually match name and description in the seller_ids field - dummy, name = product_product.name_get(cr, uid, product_id, context=context_partner)[0] - if product.description_purchase: - name += '\n' + product.description_purchase - res['value'].update({'name': name}) + if not name or not uom_id: + # The 'or not uom_id' part of the above condition can be removed in master. See commit message of the rev. introducing this line. + dummy, name = product_product.name_get(cr, uid, product_id, context=context_partner)[0] + if product.description_purchase: + name += '\n' + product.description_purchase + res['value'].update({'name': name}) # - set a domain on product_uom res['domain'] = {'product_uom': [('category_id','=',product.uom_id.category_id.id)]} diff --git a/addons/purchase/purchase_view.xml b/addons/purchase/purchase_view.xml index 9b43b2cdc12..b90eccd78fd 100644 --- a/addons/purchase/purchase_view.xml +++ b/addons/purchase/purchase_view.xml @@ -208,7 +208,7 @@ - + @@ -387,7 +387,7 @@ - +