[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
This commit is contained in:
Olivier Dony
2010-04-30 13:25:55 +02:00
parent b49cc61fb7
commit 81662d28a9
+13
View File
@@ -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: