[IMP] let the code breathe
bzr revid: abo@openerp.com-20130214173156-e2o3ovrg6t8et90g
This commit is contained in:
parent
bf6c911b5d
commit
496a580335
|
@ -564,22 +564,27 @@ class account_invoice(osv.osv):
|
|||
obj_journal = self.pool.get('account.journal')
|
||||
account_obj = self.pool.get('account.account')
|
||||
inv_line_obj = self.pool.get('account.invoice.line')
|
||||
|
||||
if company_id and part_id and type:
|
||||
acc_id = False
|
||||
partner_obj = self.pool.get('res.partner').browse(cr,uid,part_id)
|
||||
|
||||
if partner_obj.property_account_payable and partner_obj.property_account_receivable:
|
||||
if partner_obj.property_account_payable.company_id.id != company_id and partner_obj.property_account_receivable.company_id.id != company_id:
|
||||
property_obj = self.pool.get('ir.property')
|
||||
rec_pro_id = property_obj.search(cr, uid, [('name','=','property_account_receivable'),('res_id','=','res.partner,'+str(part_id)+''),('company_id','=',company_id)])
|
||||
pay_pro_id = property_obj.search(cr, uid, [('name','=','property_account_payable'),('res_id','=','res.partner,'+str(part_id)+''),('company_id','=',company_id)])
|
||||
|
||||
if not rec_pro_id:
|
||||
rec_pro_id = property_obj.search(cr, uid, [('name','=','property_account_receivable'),('company_id','=',company_id)])
|
||||
if not pay_pro_id:
|
||||
pay_pro_id = property_obj.search(cr, uid, [('name','=','property_account_payable'),('company_id','=',company_id)])
|
||||
|
||||
rec_line_data = property_obj.read(cr, uid, rec_pro_id, ['name','value_reference','res_id'])
|
||||
pay_line_data = property_obj.read(cr, uid, pay_pro_id, ['name','value_reference','res_id'])
|
||||
rec_res_id = rec_line_data and rec_line_data[0].get('value_reference',False) and int(rec_line_data[0]['value_reference'].split(',')[1]) or False
|
||||
pay_res_id = pay_line_data and pay_line_data[0].get('value_reference',False) and int(pay_line_data[0]['value_reference'].split(',')[1]) or False
|
||||
|
||||
if not rec_res_id and not pay_res_id:
|
||||
raise osv.except_osv(_('Configuration Error!'),
|
||||
_('Cannot find a chart of account, you should create one from Settings\Configuration\Accounting menu.'))
|
||||
|
@ -587,6 +592,7 @@ class account_invoice(osv.osv):
|
|||
acc_id = rec_res_id
|
||||
else:
|
||||
acc_id = pay_res_id
|
||||
|
||||
val= {'account_id': acc_id}
|
||||
if ids:
|
||||
if company_id:
|
||||
|
|
|
@ -260,11 +260,13 @@ class res_users(osv.Model):
|
|||
template = self.pool.get('ir.model.data').get_object(cr, uid, 'auth_signup', 'reset_password_email')
|
||||
mail_obj = self.pool.get('mail.mail')
|
||||
assert template._name == 'email.template'
|
||||
|
||||
for user in self.browse(cr, uid, ids, context):
|
||||
if not user.email:
|
||||
raise osv.except_osv(_("Cannot send email: user has no email address."), user.name)
|
||||
mail_id = self.pool.get('email.template').send_mail(cr, uid, template.id, user.id, True, context=context)
|
||||
mail_state = mail_obj.read(cr, uid, mail_id, ['state'], context=context)
|
||||
|
||||
if mail_state and mail_state['state'] == 'exception':
|
||||
raise osv.except_osv(_("Cannot send email: no outgoing email server configured.\nYou can configure it under Settings/General Settings."), user.name)
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue