2
# -*- encoding: utf-8 -*-
4
# Module Writen to OpenERP, Open Source Management Solution
5
# Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>).
8
# Coded by: Jorge Naranajo <jorge_nr@vauxoo.com>
10
# This program is free software: you can redistribute it and/or modify
11
# it under the terms of the GNU Affero General Public License as published by
12
# the Free Software Foundation, either version 3 of the License, or
13
# (at your option) any later version.
15
# This program is distributed in the hope that it will be useful,
16
# but WITHOUT ANY WARRANTY; without even the implied warranty of
17
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
# GNU Affero General Public License for more details.
20
# You should have received a copy of the GNU Affero General Public License
21
# along with this program. If not, see <http://www.gnu.org/licenses/>.
25
from openerp.osv import fields, osv
26
from openerp.tools.translate import _
29
class account_move_multi_wizard(osv.TransientModel):
30
_name = 'account.move.multi.wizard'
32
def default_get(self, cr, uid, fields, context=None):
35
moves = context.get('active_ids', False)
36
res = super(account_move_multi_wizard, self).default_get(
37
cr, uid, fields, context=context)
38
res.update({'account_move_ids': moves})
42
'account_move_ids': fields.many2many('account.move',
43
'account_move_wizard_rel', 'wiz_id', 'move_id'),
44
'result': fields.text('Result'),
47
def validate_moves(self, cr, uid, ids, context=None):
51
obj_account_move = self.pool.get('account.move')
52
for form in self.browse(cr, uid, ids, context=context):
53
for move in form.account_move_ids:
55
obj_account_move.button_validate(
56
cr, uid, [move.id], context=context)
62
__, xml_id = self.pool.get('ir.model.data').get_object_reference(
63
cr, uid, 'account_move_validate_multi_wizard', 'account_move_validate_multi_wizard_unbalance')
65
{'default_result': '''You cannot validate a non-balanced entry. Make sure you have configured payment terms properly.
66
The latest payment term line should be of the "Balance" type. \n\n In journal entries: %s''' % (lista)})
68
'res_model': 'account.move.multi.wizard',
73
'type': 'ir.actions.act_window',