~vauxoo/addons-vauxoo/6.0-trunk

« back to all changes in this revision

Viewing changes to product_catalog_m321/wizard/wizard_product_catalog.py

[ADD] [product_customs_rate] Add new module product_customs_rate

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
##############################################################################
2
 
#
 
2
#    
3
3
#    OpenERP, Open Source Management Solution
4
4
#    Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
5
5
#
14
14
#    GNU Affero General Public License for more details.
15
15
#
16
16
#    You should have received a copy of the GNU Affero General Public License
17
 
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
17
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.     
18
18
#
19
19
##############################################################################
20
20
 
32
32
</form>'''
33
33
 
34
34
 
 
35
 
35
36
class wiz_productCatalog(wizard.interface):
36
37
    def _get_language(self, cr, uid, context):
37
 
        lang_obj = pooler.get_pool(cr.dbname).get('res.lang')
38
 
        ids = lang_obj.search(cr, uid, [('active', '=', True), ])
39
 
        langs = lang_obj.browse(cr, uid, ids)
40
 
        return [(lang.code, lang.name) for lang in langs]
 
38
        lang_obj=pooler.get_pool(cr.dbname).get('res.lang')
 
39
        ids=lang_obj.search(cr, uid, [('active', '=', True),])
 
40
        langs=lang_obj.browse(cr, uid, ids)
 
41
        return [(lang.code, lang.name ) for lang in langs]
41
42
 
42
43
    _lang_fields = {
43
 
        'report_lang': {'string': 'Language', 'type': 'selection', 'selection': _get_language, },
44
 
        'categories': {'string': 'Select Category', 'type': 'many2many', 'relation': 'product.category', 'required': True},
 
44
    'report_lang': {'string':'Language', 'type':'selection', 'selection':_get_language,},
 
45
    'categories': {'string':'Select Category', 'type':'many2many', 'relation':'product.category', 'required':True},
45
46
    }
46
47
 
47
 
    def _load(self, cr, uid, data, context):
48
 
        partner_obj = pooler.get_pool(cr.dbname).get('res.partner')
49
 
        partners = partner_obj.browse(cr, uid, [data['id']])
50
 
        if len(partners) > 0:
51
 
            data['form']['report_lang'] = partners[0].lang
 
48
    def _load(self,cr,uid,data,context):
 
49
        partner_obj=pooler.get_pool(cr.dbname).get('res.partner')
 
50
        partners=partner_obj.browse(cr, uid, [data['id']])
 
51
        if len(partners)>0:
 
52
            data['form']['report_lang']=partners[0].lang
52
53
        return data['form']
53
54
    states = {
54
55
        'init': {
55
56
            'actions': [_load],
56
 
            'result': {'type': 'form', 'arch': _lang_form, 'fields': _lang_fields, 'state': [('end', 'Cancel'), ('print', 'Print Product Catalog')]}
 
57
            'result': {'type': 'form', 'arch':_lang_form, 'fields':_lang_fields, 'state':[('end','Cancel'),('print','Print Product Catalog') ]}
57
58
        },
58
59
        'print': {
59
60
            'actions': [],
60
 
            'result': {'type': 'print', 'report': 'product_catalog', 'state': 'end'}
 
61
            'result': {'type': 'print', 'report': 'product_catalog', 'state':'end'}
61
62
        }
62
63
    }
63
64
wiz_productCatalog('res.partner.product_catalog')
64
65
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
 
66