[FIX] account, invoice, sale: description (product sold, invoice line and account entry line) was not translated

lp bug: https://launchpad.net/bugs/489355 fixed

bzr revid: olt@tinyerp.com-20091130160220-t0nroni5p0ufy5wi
This commit is contained in:
olt@tinyerp.com 2009-11-30 17:02:20 +01:00
parent 9ce8c62491
commit 8c349adead
3 changed files with 11 additions and 7 deletions

View File

@ -906,7 +906,10 @@ class account_move(osv.osv):
amount+= (line.debit - line.credit)
return amount
def _centralise(self, cr, uid, move, mode):
def _centralise(self, cr, uid, move, mode, context=None):
if context is None:
context = {}
if mode=='credit':
account_id = move.journal_id.default_debit_account_id.id
mode2 = 'debit'
@ -929,8 +932,9 @@ class account_move(osv.osv):
if res:
line_id = res[0]
else:
context.update({'journal_id': move.journal_id.id, 'period_id': move.period_id.id})
line_id = self.pool.get('account.move.line').create(cr, uid, {
'name': _('Centralisation ') + mode,
'name': _t(cr, None, 'selection', context.get('lang'), source=(mode.capitalize()+' Centralisation')) or (mode.capitalize()+' Centralisation'),
'centralisation': mode,
'account_id': account_id,
'move_id': move.id,
@ -939,7 +943,7 @@ class account_move(osv.osv):
'date': move.period_id.date_stop,
'debit': 0.0,
'credit': 0.0,
}, {'journal_id': move.journal_id.id, 'period_id': move.period_id.id})
}, context)
# find the first line of this move with the other mode
# so that we can exclude it from our calculation
@ -1021,8 +1025,8 @@ class account_move(osv.osv):
#
continue
if journal.centralisation:
self._centralise(cr, uid, move, 'debit')
self._centralise(cr, uid, move, 'credit')
self._centralise(cr, uid, move, 'debit', context=context)
self._centralise(cr, uid, move, 'credit', context=context)
self.pool.get('account.move.line').write(cr, uid, line_draft_ids, {
'state': 'valid'
}, context, check=False)

View File

@ -679,7 +679,7 @@ class account_invoice(osv.osv):
for i in line:
i[2]['period_id'] = period_id
move_id = self.pool.get('account.move').create(cr, uid, move)
move_id = self.pool.get('account.move').create(cr, uid, move, context=context)
new_move_name = self.pool.get('account.move').browse(cr, uid, move_id).name
# make the invoice point to that move
self.write(cr, uid, [inv.id], {'move_id': move_id,'period_id':period_id, 'move_name':new_move_name})

View File

@ -955,7 +955,7 @@ class sale_order_line(osv.osv):
partner = partner_obj.browse(cr, uid, partner_id)
result['tax_id'] = self.pool.get('account.fiscal.position').map_tax(cr, uid, fpos, product_obj.taxes_id)
if not flag:
result['name'] = product_obj.partner_ref
result['name'] = self.pool.get('product.product').name_get(cr, uid, [product_obj.id], context=context)[0][1]
domain = {}
if (not uom) and (not uos):
result['product_uom'] = product_obj.uom_id.id