[FIX] point_of_sale: error message translation if no receivable account defined for partner

bzr revid: qdp-launchpad@openerp.com-20111007132246-2ilpi2t1ii6s4tnw
This commit is contained in:
Quentin (OpenERP)
2011-10-07 15:22:46 +02:00
parent 0910749ef8
commit cab1f52242
+8 -8
View File
@@ -259,17 +259,17 @@ class pos_order(osv.osv):
if data.get('payment_name', False):
args['name'] = args['name'] + ': ' + data['payment_name']
account_def = property_obj.get(cr, uid, 'property_account_receivable', 'res.partner', context=context)
args['account_id'] = order.partner_id and order.partner_id.property_account_receivable \
and order.partner_id.property_account_receivable.id or account_def and account_def.id or False
args['account_id'] = (order.partner_id and order.partner_id.property_account_receivable \
and order.partner_id.property_account_receivable.id) or (account_def and account_def.id) or False
args['partner_id'] = order.partner_id and order.partner_id.id or None
if not args['account_id']:
msg = 'There is no receivable account defined to make payment'
if args['partner_id']:
msg += ' for this partner: "%s" (id:%d)' % \
(order.partner_id.name, order.partner_id.id,)
raise osv.except_osv(_('Configuration Error !'), _('%s' %msg))
if not args['partner_id']:
msg = _('There is no receivable account defined to make payment')
else:
msg = _('There is no receivable account defined to make payment for the partner: "%s" (id:%d)') % (order.partner_id.name, order.partner_id.id,)
raise osv.except_osv(_('Configuration Error !'), msg)
statement_id = statement_obj.search(cr,uid, [
('journal_id', '=', int(data['journal'])),
('company_id', '=', curr_company),