~openerp-commiter/openobject-addons/stable-sja-branch

« back to all changes in this revision

Viewing changes to loan/wizard/wizard_cheque_state_process.py

  • Committer: sja-axelor
  • Date: 2009-10-13 09:52:57 UTC
  • Revision ID: suniljagyasi@gmail.com-20091013095257-8u26ww0r20z9y6ey
add

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
import time
 
2
import wizard
 
3
import netsvc
 
4
import pooler
 
5
from osv.orm import browse_record
 
6
 
 
7
draft2posted_form = """<?xml version="1.0"?>
 
8
<form string="Draft To Posted">
 
9
    <separator colspan="4" string="change State : Draft to Posted " />
 
10
</form>
 
11
"""
 
12
 
 
13
draft2posted_fields = {
 
14
 
 
15
}
 
16
def _draft2posted(self, cr, uid, data, context):
 
17
        cheque_pool = pooler.get_pool(cr.dbname).get('account.loan.bank.cheque')
 
18
        wf_service = netsvc.LocalService("workflow")
 
19
        for o in cheque_pool.browse(cr, uid, data['ids'], context):
 
20
            if o.state=='draft':
 
21
                wf_service.trg_validate(uid, 'account.loan.bank.cheque', o.id, 'post_bank', cr)
 
22
        return {}
 
23
 
 
24
class change_cheque_state(wizard.interface):
 
25
    states = {
 
26
        'init' : {
 
27
            'actions' : [],
 
28
            'result' : {'type' : 'form',
 
29
                    'arch' : draft2posted_form,
 
30
                    'fields' : {},
 
31
                    'state' : [('end', 'Cancel'),('draft2posted', 'Draft To Posted') ]}
 
32
        },
 
33
        'draft2posted' : {
 
34
            'actions' : [],
 
35
            'result' : {'type' : 'action',
 
36
                    'action' : _draft2posted,
 
37
                    'state' : 'end'}
 
38
        },
 
39
    }
 
40
change_cheque_state('account.bank.cheque.process')
 
 
b'\\ No newline at end of file'