~syleam/+junk/hylafax_gateway

« back to all changes in this revision

Viewing changes to wizard/wizard_partner_send_fax.py

  • Committer: Yogesh Sakhreliya
  • Date: 2010-09-08 05:41:23 UTC
  • Revision ID: ysa@tinyerp.com-20100908054123-7y1j3jtqxj2gdecc
[IMP] remove default configuration dictionary and add m2o field in partner, sale and purchase wizard.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
 
22
22
import wizard
23
23
import pooler
24
 
 
 
24
import netsvc
25
25
import base64
26
26
import commands
27
27
import random
29
29
import hnm_heofax_lib
30
30
 
31
31
debug = True
32
 
cmd = hnm_heofax_lib.fax_cmd
33
32
 
34
33
_fax_form = '''<?xml version="1.0"?>
35
34
<form string="Send Fax (HeoFAX)">
 
35
        <separator string="Configuration" colspan="4"/>
 
36
        <field name="config_id"/>
36
37
        <separator string="Sender informations" colspan="4"/>
37
38
        <field name="from"/>
38
39
        <field name="email"/>
50
51
</form>'''
51
52
 
52
53
_fax_fields = {
 
54
        'config_id': {'string':'Configuration', 'type':'many2one', 'relation':'hylffax.config', 'required':True},
53
55
        'from': {'string':'From (name)', 'type':'char', 'size':30, 'required':True},
54
56
        'email': {'string':'From (email)', 'type':'char', 'size':30, 'required':True},
55
57
        'subject': {'string':'Subject', 'type':'char', 'size':64, 'required':True, 'help':'Information required for add information in partner\'s event'},
86
88
        ### Get general information
87
89
        # Get connected user info
88
90
        user_data = pool.get('res.users').browse(cr, uid, uid)
89
 
        cmd['user'] = user_data
90
91
        # Set form field
91
92
        # search if the current user is associated to a coverpage
92
93
        # in this case this one is the value by default for the form value 'link_coverpage'
102
103
        # Get email address of who send FAX.
103
104
        if user_data.address_id and user_data.address_id.email:
104
105
                datas['form']['email'] = user_data.address_id.email
105
 
        else:
106
 
                datas['form']['email'] = cmd['email']
107
106
        datas['form']['from'] = user_data.address_id.name
108
107
        return datas['form']
109
108
 
127
126
                if debug:
128
127
                        logger.notifyChannel("[HeoFAX - Debug]", netsvc.LOG_INFO, " File attached: %s" % " ".join(cmd['listFile']))
129
128
 
 
129
        cmd = pool.get('hylffax.config').read(cr, uid, datas['form']['config_id'], [])
 
130
        cmd['user'] = pool.get('res.users').browse(cr, uid, uid)
130
131
        partners = pool.get('res.partner').browse(cr, uid, datas['ids'], context)
131
132
        for partner in partners:
132
133
                for adr in partner.address: