Improve code.
bzr revid: vba@tinyerp.com-20121121132238-blrkmrt10wsyxdqm
This commit is contained in:
parent
950ae6e125
commit
c4366709a8
|
@ -70,10 +70,9 @@ class account_invoice(osv.osv):
|
|||
section_id = vals.get('section_id', False)
|
||||
invoice_type = context.get('type', False)
|
||||
user_id = vals.get('user_id', False)
|
||||
user_obj = self.pool.get('res.users').browse(cr, uid, user_id, context=context)
|
||||
user_default_section_id = user_obj.default_section_id.id or False
|
||||
if not section_id and invoice_type in ['out_invoice', 'out_refund'] and user_id:
|
||||
vals['section_id'] = user_default_section_id
|
||||
user_obj = self.pool.get('res.users').browse(cr, uid, user_id, context=context)
|
||||
if not section_id and invoice_type in ['out_invoice', 'out_refund'] and user_id and user_obj.default_section_id:
|
||||
vals['section_id'] = user_obj.default_section_id.id
|
||||
obj_id = super(account_invoice, self).create(cr, uid, vals, context=context)
|
||||
return obj_id
|
||||
|
||||
|
|
Loading…
Reference in New Issue