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

« back to all changes in this revision

Viewing changes to huissier/wizard/wizard_invoice_labels.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
# -*- encoding: utf-8 -*-
 
2
##############################################################################
 
3
#
 
4
#    OpenERP, Open Source Management Solution   
 
5
#    Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved
 
6
#    $Id$
 
7
#
 
8
#    This program is free software: you can redistribute it and/or modify
 
9
#    it under the terms of the GNU General Public License as published by
 
10
#    the Free Software Foundation, either version 3 of the License, or
 
11
#    (at your option) any later version.
 
12
#
 
13
#    This program is distributed in the hope that it will be useful,
 
14
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
15
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
16
#    GNU General Public License for more details.
 
17
#
 
18
#    You should have received a copy of the GNU General Public License
 
19
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
20
#
 
21
##############################################################################
 
22
 
 
23
import wizard
 
24
import netsvc
 
25
import pooler
 
26
 
 
27
# l'interet d'avoir un wizard pour ca est de pouvoir imprimer les vignettes directement
 
28
def _invoice_labels(self,cr,uid,datas,context):
 
29
#   service = netsvc.LocalService("object_proxy")
 
30
#   invoice_id = service.execute(uid, 'huissier.vignettes', 'invoice', [datas['id']])
 
31
    vign_obj = pooler.get_pool(cr.dbname).get('huissier.vignettes')
 
32
    ids = vign_obj.invoice(cr, uid, datas['ids'],context)
 
33
    cr.commit()
 
34
    print "Facturation finie"
 
35
    return{}
 
36
 
 
37
def facture(self, cr, uid, data, context):
 
38
    id_vignette = pooler.get_pool(cr.dbname).get('huissier.vignettes').browse(cr,uid,data['ids'])
 
39
    inv_vignette= id_vignette[0].invoice_id.id or false
 
40
    if not inv_vignette: return {}
 
41
    return {
 
42
        'domain': str([('id', 'in', [inv_vignette])]),
 
43
        'name': 'Factures de vignettes en attente',
 
44
        'view_type': 'form',
 
45
        'view_mode': 'tree,form',
 
46
        'res_model': 'account.invoice',
 
47
        'view_id': False,
 
48
        'type': 'ir.actions.act_window'
 
49
    }
 
50
 
 
51
 
 
52
class wizard_invoice_labels(wizard.interface):
 
53
    states = {
 
54
        'init': {
 
55
            'actions': [_invoice_labels],
 
56
            'result': {'type': 'print', 'report':'huissier.labels', 'state': 'fin'}
 
57
        },
 
58
        'fin':{
 
59
            'actions':[],
 
60
            'result':{'type':'action', 'action':facture, 'state':'end'}
 
61
        }
 
62
    }
 
63
wizard_invoice_labels('huissier.labels.invoice')
 
64
 
 
65
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
 
66