[FIX] hr_timesheet_invoice: invoice line in partner lang
During refactoring at 55f9cbf
, lost translation of invoice lines.
The invoice lines should be in the partner language instead of in the user lang.
The analytic lines are browsed explicitely in the user language.
Fixes #7774
Closes #7796
opw-646166
This commit is contained in:
parent
4fcc756ef9
commit
c16885e6e2
|
@ -251,6 +251,7 @@ class account_analytic_line(osv.osv):
|
|||
def invoice_cost_create(self, cr, uid, ids, data=None, context=None):
|
||||
invoice_obj = self.pool.get('account.invoice')
|
||||
invoice_line_obj = self.pool.get('account.invoice.line')
|
||||
analytic_line_obj = self.pool.get('account.analytic.line')
|
||||
invoices = []
|
||||
if context is None:
|
||||
context = {}
|
||||
|
@ -299,13 +300,15 @@ class account_analytic_line(osv.osv):
|
|||
analytic_line.to_invoice.id,
|
||||
analytic_line.account_id,
|
||||
analytic_line.journal_id.type)
|
||||
# We want to retrieve the data in the partner language for the invoice creation
|
||||
analytic_line = analytic_line_obj.browse(cr, uid , [line.id for line in analytic_line], context=invoice_context)
|
||||
invoice_lines_grouping.setdefault(key, []).append(analytic_line)
|
||||
|
||||
# finally creates the invoice line
|
||||
for (product_id, uom, user_id, factor_id, account, journal_type), lines_to_invoice in invoice_lines_grouping.items():
|
||||
curr_invoice_line = self._prepare_cost_invoice_line(cr, uid, last_invoice,
|
||||
product_id, uom, user_id, factor_id, account, lines_to_invoice,
|
||||
journal_type, data, context=context)
|
||||
journal_type, data, context=invoice_context)
|
||||
|
||||
invoice_line_obj.create(cr, uid, curr_invoice_line, context=context)
|
||||
self.write(cr, uid, [l.id for l in analytic_lines], {'invoice_id': last_invoice}, context=context)
|
||||
|
|
Loading…
Reference in New Issue