~openerp-commiter/openobject-addons/trunk-extra-addons

« back to all changes in this revision

Viewing changes to portal/portal.py

  • Committer: bch
  • Date: 2007-10-08 07:51:57 UTC
  • Revision ID: bch-75f66c7e621801ec61ea98d64ea8d8ef492c2d96
Re-added auction_demo.xml in __terp__.py

Show diffs side-by-side

added added

removed removed

Lines of Context:
62
62
                        vals['menu_action_id']= self.create_action_menu(cr,user,vals['menu_id'], vals['name'],context)
63
63
                return super(portal_portal, self).create(cr, user, vals, context)
64
64
 
65
 
        def create_menu(self, cr, uid,portal_id, portal_model_id, menu_name, action_id,parent_menu_id=None,view_ids=None,view_type=False,context=None):
 
65
        def create_menu(self, cr, uid,portal_id, portal_model_id, menu_name, action_id,parent_menu_id=None,context=None):
66
66
                """
67
67
                Create a menuitem for the given portal and model whith the given name and action.
68
68
                """
69
69
                
70
70
                assert portal_id and portal_model_id and menu_name and action_id, "Create_menu does not accept null values"
71
71
                
72
 
                v=[]
73
 
                if view_type:
74
 
                        v.append('form')
75
 
                        v.append('tree')
76
 
                else:
77
 
                        v.append('tree')
78
 
                        v.append('form')
79
 
 
80
72
                portal= self.pool.get('portal.portal').browse(cr,uid,portal_id)
81
73
                model= self.pool.get('portal.model').browse(cr,uid,portal_model_id)
82
74
                action= self.pool.get('ir.actions.act_window').browse(cr,uid,action_id)
86
78
                        'parent_id': parent_menu_id or portal.menu_id.id,
87
79
                        'icon': 'STOCK_NEW'
88
80
                        })
89
 
 
90
81
                available_view={}
91
82
                for view in model.view_ids:
92
83
                        available_view[view.type]= view.id
101
92
                        }))
102
93
                        i+=1
103
94
 
104
 
                (unused1, unused2, cur_first_view) = vids[0]
105
 
 
106
 
                if view_ids['form'] != False:
107
 
                        if view_ids['tree'] != False:
108
 
                                vids[0]=(0,0, {
109
 
                                'sequence':0,
110
 
                                'view_id': view_ids[v[0]],
111
 
                                'view_mode': v[0],
112
 
                                })
113
 
                                vids[1]=(0,0, {
114
 
                                'sequence':1,
115
 
                                'view_id': view_ids[v[1]],
116
 
                                'view_mode': v[1],
117
 
                                })
118
 
                        else:
119
 
                                if view_type & (cur_first_view['view_mode']=='tree'):
120
 
                                        temp=vids[0]
121
 
                                        vids[0]=vids[1]
122
 
                                        vids[1]=temp
123
 
                                if v[0] =='form':
124
 
                                        vids[0]=(0,0, {
125
 
                                        'sequence':0,
126
 
                                        'view_id': view_ids['form'],
127
 
                                        'view_mode': 'form',
128
 
                                        })
129
 
                                else:
130
 
                                        vids[1]=(0,0, {
131
 
                                        'sequence':1,
132
 
                                        'view_id': view_ids['form'],
133
 
                                        'view_mode': 'form',
134
 
                                        })
135
 
                else:
136
 
                        if view_ids['tree'] != False:
137
 
                                if view_type & (cur_first_view['view_mode']=='tree'):
138
 
                                        temp=vids[0]
139
 
                                        vids[0]=vids[1]
140
 
                                        vids[1]=temp
141
 
                                if v[0] =='tree':
142
 
                                        vids[0]=(0,0, {
143
 
                                        'sequence':0,
144
 
                                        'view_id': view_ids['tree'],
145
 
                                        'view_mode': 'tree',
146
 
                                        })
147
 
                                else:
148
 
                                        vids[1]=(0,0, {
149
 
                                        'sequence':1,
150
 
                                        'view_id': view_ids['tree'],
151
 
                                        'view_mode': 'tree',
152
 
                                        })
153
 
                        else:
154
 
                                if view_type & (cur_first_view['view_mode']=='tree'):
155
 
                                        temp=vids[0]
156
 
                                        vids[0]=vids[1]
157
 
                                        vids[1]=temp
158
 
 
159
95
                ## Duplicate the action and give the fetched views to the new one:
160
96
                action_id = action.copy(cr,uid, action.id,{
161
97
                        'name': menu_name,
162
 
                        'view_ids': vids,
163
 
                        'view_type': v[0]
 
98
                        'view_ids': vids
164
99
                        })
165
100
 
166
101
                ## Create the values:
191
126
                }
192
127
portal_model()
193
128
 
194
 
class ir_actions_act_report_xml(osv.osv):
195
 
        _inherit="ir.actions.report.xml"
196
 
        _columns={
197
 
                "portal_visible": fields.boolean('Visible in Portal')
198
 
                }
199
 
        _defaults = {
200
 
                'portal_visible': lambda *a: True,
201
 
        }
202
 
ir_actions_act_report_xml()
203
 
 
204
 
class ir_actions_act_report_custom(osv.osv):
205
 
        _inherit="ir.actions.report.custom"
206
 
        _columns={
207
 
                "portal_visible": fields.boolean('Visible in Portal')
208
 
                }
209
 
        _defaults = {
210
 
                'portal_visible': lambda *a: True,
211
 
        }
212
 
ir_actions_act_report_custom()
213
 
 
214
 
class ir_actions_act_wizard(osv.osv):
215
 
        _inherit="ir.actions.wizard"
216
 
        _columns={
217
 
                "portal_visible": fields.boolean('Visible in Portal')
218
 
                }
219
 
        _defaults = {
220
 
                'portal_visible': lambda *a: True,
221
 
        }
222
 
ir_actions_act_wizard()
223
 
 
224
 
class ir_actions_act_window(osv.osv):
225
 
        _inherit="ir.actions.act_window"
226
 
        _columns={
227
 
                "portal_visible": fields.boolean('Visible in Portal')
228
 
                }
229
 
        _defaults = {
230
 
                'portal_visible': lambda *a: True,
231
 
        }
232
 
ir_actions_act_window()
 
129