~factorlibre/sepa-tools/sepa-tools

« back to all changes in this revision

Viewing changes to account_payment_export/model/bank_payment_manual.py

  • Committer: Ignacio Ibeas - Acysos S.L.
  • Date: 2014-02-09 15:05:50 UTC
  • Revision ID: ignacio@acysos.com-20140209150550-uug8yon3vcuh3rlj
[ADD] New SEPA modules for account_payment_extension

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- coding: utf-8 -*-
 
2
##############################################################################
 
3
#
 
4
#    Copyright (C) 2009 EduSense BV (<http://www.edusense.nl>).
 
5
#              (C) 2011 - 2013 Therp BV (<http://therp.nl>).
 
6
#            
 
7
#    All other contributions are (C) by their respective contributors
 
8
#
 
9
#    All Rights Reserved
 
10
#
 
11
#    This program is free software: you can redistribute it and/or modify
 
12
#    it under the terms of the GNU Affero General Public License as
 
13
#    published by the Free Software Foundation, either version 3 of the
 
14
#    License, or (at your option) any later version.
 
15
#
 
16
#    This program is distributed in the hope that it will be useful,
 
17
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
18
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
19
#    GNU Affero General Public License for more details.
 
20
#
 
21
#    You should have received a copy of the GNU Affero General Public License
 
22
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
23
#
 
24
##############################################################################
 
25
 
 
26
'''
 
27
This module contains a single "wizard" for confirming manual
 
28
bank transfers.
 
29
'''
 
30
 
 
31
from openerp.osv import orm, fields
 
32
from openerp import netsvc
 
33
 
 
34
 
 
35
class payment_manual(orm.TransientModel):
 
36
    _name = 'payment.manual'
 
37
    _description = 'Send payment order(s) manually'
 
38
 
 
39
    _columns = {
 
40
        'payment_order_ids': fields.many2many('payment.order',
 
41
            'wiz_manual_payorders_rel', 'wizard_id', 'payment_order_id',
 
42
            'Payment orders', readonly=True),
 
43
        }
 
44
 
 
45
    def create(self, cr, uid, vals, context=None):
 
46
        payment_order_ids = context.get('active_ids', [])
 
47
        vals.update({
 
48
            'payment_order_ids': [[6, 0, payment_order_ids]],
 
49
        })
 
50
        return super(payment_manual, self).create(cr, uid,
 
51
            vals, context=context)
 
52
 
 
53
    def button_ok(self, cr, uid, ids, context=None):
 
54
        wf_service = netsvc.LocalService('workflow')
 
55
        for wiz in self.browse(cr, uid, ids, context=context):
 
56
            for order_id in wiz.payment_order_ids:
 
57
                wf_service.trg_validate(
 
58
                    uid, 'payment.order', order_id.id, 'done', cr)
 
59
        return {'type': 'ir.actions.act_window_close'}