From: Denis Ledoux Date: Thu, 31 Jul 2014 12:16:52 +0000 (+0200) Subject: [FIX] account: _get_analytic_lines needs the date_invoice X-Git-Tag: 8.0.0~487 X-Git-Url: http://git.inspyration.org/?a=commitdiff_plain;h=60d038c350b73489105d30ad6e0081df260d5ec3;p=odoo%2Fodoo.git [FIX] account: _get_analytic_lines needs the date_invoice During the conversion of account_invoice.py to the new API, the date_invoice written on the invoice has been moved in the end of the action_move_create method. But, the method _get_analytic_lines needs it sooner. --- diff --git a/addons/account/account_invoice.py b/addons/account/account_invoice.py index 6221fb5..bf9db60 100644 --- a/addons/account/account_invoice.py +++ b/addons/account/account_invoice.py @@ -793,7 +793,10 @@ class account_invoice(models.Model): continue ctx = dict(self._context, lang=inv.partner_id.lang) - date_invoice = inv.date_invoice or fields.Date.context_today(self) + + if not inv.date_invoice: + inv.with_context(ctx).write({'date_invoice': fields.Date.context_today(self)}) + date_invoice = inv.date_invoice company_currency = inv.company_id.currency_id # create the analytical lines, one move line per invoice line @@ -906,7 +909,6 @@ class account_invoice(models.Model): move = account_move.with_context(ctx).create(move_vals) # make the invoice point to that move vals = { - 'date_invoice': date_invoice, 'move_id': move.id, 'period_id': period.id, 'move_name': move.name,