From 81662d28a997d5d8d498f41f9e3c680da7c2ccae Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Fri, 30 Apr 2010 13:25:55 +0200 Subject: [PATCH] [FIX] account: backport of fix of generation of account.move.lines from invoice by providing extension hook lp bug: https://launchpad.net/bugs/452854 fixed bzr revid: odo@openerp.com-20100430112555-vmp2l7h077sl3etk --- addons/account/invoice.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/addons/account/invoice.py b/addons/account/invoice.py index c66dda115b2..48a5bc1667e 100644 --- a/addons/account/invoice.py +++ b/addons/account/invoice.py @@ -539,6 +539,16 @@ class account_invoice(osv.osv): wf_service.trg_create(uid, 'account.invoice', inv_id, cr) return True + def finalize_invoice_move_lines(self, cr, uid, invoice_browse, move_lines): + """finalize_invoice_move_lines(cr, uid, invoice, move_lines) -> move_lines + Hook method to be overridden in additional modules to verify and possibly alter the + move lines to be created by an invoice, for special cases. + :param invoice_browse: browsable record of the invoice that is generating the move lines + :param move_lines: list of dictionaries with the account.move.lines (as for create()) + :return: the (possibly updated) final move_lines to create for this invoice + """ + return move_lines + # Workflow stuff ################# @@ -816,6 +826,9 @@ class account_invoice(osv.osv): if journal.centralisation: raise osv.except_osv(_('UserError'), _('Cannot create invoice move on centralised journal')) + + line = self.finalize_invoice_move_lines(self, cr, uid, inv, line) + move = {'ref': inv.number, 'line_id': line, 'journal_id': journal_id, 'date': date} period_id=inv.period_id and inv.period_id.id or False if not period_id: