~vauxoo/addons-vauxoo/8.0-import_tax_tariff-dev-yani-rev-2

« back to all changes in this revision

Viewing changes to account_move_validate_multi_wizard/wizard/wizard.py

  • Committer: Jorge Angel Naranjo Rogel
  • Date: 2013-07-08 16:02:43 UTC
  • mto: (543.7.113 addons-vauxoo)
  • mto: This revision was merged to the branch mainline in revision 837.
  • Revision ID: jorge_nr@vauxoo.com-20130708160243-p91vazww8j1aip67
[ADD][account_move_validate_multi_wizard] Added new wizard for validate multi journal entries

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/python
 
2
# -*- encoding: utf-8 -*-
 
3
###########################################################################
 
4
#    Module Writen to OpenERP, Open Source Management Solution
 
5
#    Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>).
 
6
#    All Rights Reserved
 
7
###############Credits######################################################
 
8
#    Coded by: Jorge Naranajo <jorge_nr@vauxoo.com>
 
9
#############################################################################
 
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.
 
14
#
 
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.
 
19
#
 
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/>.
 
22
################################################################################
 
23
 
 
24
 
 
25
from openerp.osv import fields, osv
 
26
 
 
27
class account_move_multi_wizard(osv.TransientModel):
 
28
    _name = 'account.move.multi.wizard'
 
29
    
 
30
    def default_get(self, cr, uid, fields, context=None):
 
31
        moves = context['active_ids'] or False
 
32
        res = super(account_move_multi_wizard, self).default_get(cr, uid, fields, context=context)
 
33
        res.update({'account_move_ids': moves})
 
34
        return res
 
35
    
 
36
    _columns = {
 
37
        'account_move_ids' : fields.many2many('account.move',
 
38
                            'account_move_wizard_rel','wiz_id','move_id'),
 
39
    }
 
40
    
 
41
    def validate_moves(self,cr,uid,ids,context={}):
 
42
        form = self.read(cr, uid, ids, context=context)
 
43
        move_ids = form[0]['account_move_ids']
 
44
        obj_account_move=self.pool.get('account.move')
 
45
        for move in move_ids:
 
46
            obj_account_move.button_validate(cr, uid, [move], context=context)
 
47
        return {}