[IMP] workflow triggers when unreconciling move lines too

As the workflows listening on account_move_line are triggered upon
reconciliation, it makes sens to trigger them upon unreconcile too.
This commit is contained in:
Stéphane Bidoul
2014-09-29 22:08:48 +02:00
parent cbb0f41426
commit ad523cba58
2 changed files with 46 additions and 0 deletions

View File

@@ -2,3 +2,4 @@ from . import account_payment
from . import payment_line
from . import payment_mode
from . import payment_order_create
from . import account_move_reconcile

View File

@@ -0,0 +1,45 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2014 ACSONE SA (<http://acsone.eu>).
#
# All other contributions are (C) by their respective contributors
#
# All Rights Reserved
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from openerp.osv import orm
from openerp import workflow
class AccountMoveReconcile(orm.Model):
_inherit = 'account.move.reconcile'
def unlink(self, cr, uid, ids, context=None):
""" workflow triggers upon unreconcile
This should go into the core"""
line_ids = []
for reconcile in self.browse(cr, uid, ids, context=context):
for move_line in reconcile.line_id:
line_ids.append(move_line.id)
res = super(AccountMoveReconcile, self).\
unlink(cr, uid, ids, context=context)
for line_id in line_ids:
workflow.trg_trigger(uid, 'account.move.line', line_id, cr)
return res