From e4ed76cd599565352dd3e0e54b1a3b51869226e8 Mon Sep 17 00:00:00 2001 From: Mustufa Rangwala Date: Wed, 7 Jul 2010 12:34:42 +0530 Subject: [PATCH 1/2] [IMP] Clean for 6.0 bzr revid: mra@mra-laptop-20100707070442-ztxuj718txuro9u1 --- addons/hr/hr.py | 13 +++++++------ addons/hr/hr_department.py | 20 ++++++++++---------- addons/hr/hr_view.xml | 18 ++++++++++++++++-- 3 files changed, 33 insertions(+), 18 deletions(-) diff --git a/addons/hr/hr.py b/addons/hr/hr.py index 372b5214f6f..41aecc0bce0 100644 --- a/addons/hr/hr.py +++ b/addons/hr/hr.py @@ -33,7 +33,7 @@ class hr_employee_category(osv.osv): 'child_ids': fields.one2many('hr.employee.category', 'parent_id', 'Child Categories') } - def _check_recursion(self, cr, uid, ids): + def _check_recursion(self, cr, uid, ids, context=None): level = 100 while len(ids): cr.execute('select distinct parent_id from hr_employee_category where id IN %s', (tuple(ids), )) @@ -53,9 +53,10 @@ class hr_employee_marital_status(osv.osv): _name = "hr.employee.marital.status" _description = "Employee Marital Status" _columns = { - 'name': fields.char('Marital Status', size=30, required=True), + 'name': fields.char('Marital Status', size=32, required=True), 'description': fields.text('Status Description'), } + hr_employee_marital_status() class hr_job(osv.osv): @@ -95,11 +96,11 @@ class hr_employee(osv.osv): 'country_id': fields.many2one('res.country', 'Nationality'), 'birthday': fields.date("Birthday"), 'ssnid': fields.char('SSN No', size=32, help='Social Security Number'), - 'sinid': fields.char('SIN No', size=32), + 'sinid': fields.char('SIN No', size=32, help="Social Insurance Number"), 'otherid': fields.char('Other ID', size=32), 'gender': fields.selection([('male', 'Male'),('female', 'Female')], 'Gender'), 'marital': fields.many2one('hr.employee.marital.status', 'Marital Status'), - 'bank_account': fields.char('Bank Account', size=56), + 'bank_account': fields.char('Bank Account', size=64), 'partner_id': fields.related('company_id', 'partner_id', type='many2one', relation='res.partner', readonly=True), 'department_id':fields.many2one('hr.department','Department'), 'address_id': fields.many2one('res.partner.address', 'Working Address'), @@ -127,7 +128,7 @@ class hr_employee(osv.osv): 'photo': _get_photo, } - def _check_recursion(self, cr, uid, ids): + def _check_recursion(self, cr, uid, ids, context=None): level = 100 while len(ids): cr.execute('select distinct parent_id from hr_employee where id IN %s',(tuple(ids),)) @@ -143,4 +144,4 @@ class hr_employee(osv.osv): hr_employee() -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/addons/hr/hr_department.py b/addons/hr/hr_department.py index d1e13e2f6ec..0a21e8aecee 100644 --- a/addons/hr/hr_department.py +++ b/addons/hr/hr_department.py @@ -39,7 +39,7 @@ class hr_department(osv.osv): return res def _dept_name_get_fnc(self, cr, uid, ids, prop, unknow_none, context=None): - res = self.name_get(cr, uid, ids, context) + res = self.name_get(cr, uid, ids, context=context) return dict(res) _name = "hr.department" @@ -53,20 +53,20 @@ class hr_department(osv.osv): 'manager_id': fields.many2one('res.users', 'Manager', required=True), 'member_ids': fields.many2many('res.users', 'hr_department_user_rel', 'department_id', 'user_id', 'Members'), } - - _defaults = { + + _defaults = { 'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'hr.department', context=c), - } + } def _get_members(self,cr, uid, context=None): mids = self.search(cr, uid, [('manager_id', '=', uid)]) - result = {uid:1} - for m in self.browse(cr, uid, mids, context): + result = {uid: 1} + for m in self.browse(cr, uid, mids, context=context): for user in m.member_ids: result[user.id] = 1 return result.keys() - def _check_recursion(self, cr, uid, ids): + def _check_recursion(self, cr, uid, ids, context=None): level = 100 while len(ids): cr.execute('select distinct parent_id from hr_department where id IN %s',(tuple(ids),)) @@ -122,12 +122,12 @@ class res_users(osv.osv): result[user_id] = parent_ids return result - def _parent_search(self, cr, uid, obj, name, args, context): + def _parent_search(self, cr, uid, obj, name, args, context=None): parent = [] for arg in args: if arg[0] == 'parent_id': parent = arg[2] - child_ids = self._child_compute(cr, uid, parent, name, args, {}) + child_ids = self._child_compute(cr, uid, parent, name, args, context=context) if not child_ids: return [('id', 'in', [0])] return [('id', 'in', child_ids.get(uid,[]))] @@ -163,7 +163,7 @@ class res_users(osv.osv): for arg in args: if arg[0] == 'child_ids': parent = arg[2] - child_ids = self._child_compute(cr, uid, parent, name, args, {}) + child_ids = self._child_compute(cr, uid, parent, name, args, context=context) if not child_ids: return [('id', 'in', [0])] return [('id', 'in', child_ids.get(uid,[]))] diff --git a/addons/hr/hr_view.xml b/addons/hr/hr_view.xml index 161064723f9..402df16939e 100644 --- a/addons/hr/hr_view.xml +++ b/addons/hr/hr_view.xml @@ -89,6 +89,7 @@ + @@ -150,9 +151,20 @@ + + hr.hr.employee.marital.status.tree + hr.employee.marital.status + tree + + + + + + + hr.hr.employee.marital.status hr.employee.marital.status @@ -171,6 +183,7 @@ hr.employee.marital.status form tree,form + + @@ -358,7 +372,7 @@ - + From a2a631f4cec45576356aa23f27793de3d0a2d399 Mon Sep 17 00:00:00 2001 From: Mustufa Rangwala Date: Wed, 7 Jul 2010 12:43:23 +0530 Subject: [PATCH 2/2] [FIX] sale_margin: fix bzr revid: mra@mra-laptop-20100707071323-lllc9ow3rad5djal --- addons/sale_margin/sale_margin.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/sale_margin/sale_margin.py b/addons/sale_margin/sale_margin.py index 80bb542fa3d..7d2c644de6b 100644 --- a/addons/sale_margin/sale_margin.py +++ b/addons/sale_margin/sale_margin.py @@ -32,8 +32,9 @@ class sale_order_line(osv.osv): res = super(sale_order_line, self).product_id_change(cr, uid, ids, pricelist, product, qty=qty, uom=uom, qty_uos=qty_uos, uos=uos, name=name, partner_id=partner_id, lang=lang, update_tax=update_tax, date_order=date_order, packaging=packaging, fiscal_position=fiscal_position, flag=flag) - purchase_price = self.pool.get('product.product').browse(cr, uid, product).standard_price - res['value'].update({'purchase_price':purchase_price}) + if product: + purchase_price = self.pool.get('product.product').browse(cr, uid, product).standard_price + res['value'].update({'purchase_price':purchase_price}) return res def _product_margin(self, cr, uid, ids, field_name, arg, context=None):