Merge lp:~openerp-dev/openobject-addons/trunk-event-mva into lp:openobject-addons
- trunk-event-mva
- Merge into trunk
Proposed by
Antony Lesuisse (OpenERP)
Status: | Work in progress |
---|---|
Proposed branch: | lp:~openerp-dev/openobject-addons/trunk-event-mva |
Merge into: | lp:openobject-addons |
Diff against target: |
1804 lines (+300/-907) (has conflicts) 15 files modified
event/__openerp__.py (+7/-7) event/board_association_view.xml (+3/-3) event/email_template.xml (+27/-0) event/event.py (+67/-449) event/event_demo.xml (+10/-6) event/event_view.xml (+110/-161) event/report/report_event_registration.py (+38/-57) event/report/report_event_registration_view.xml (+27/-20) event/security/ir.model.access.csv (+0/-3) event/test/process/partner_register2invoice.yml (+8/-38) event/wizard/__init__.py (+1/-1) event/wizard/event_confirm_registration.py (+2/-26) event/wizard/event_make_invoice.py (+0/-95) event/wizard/event_make_invoice_view.xml (+0/-40) event/wizard/partner_event_registration.py (+0/-1) Text conflict in event/__openerp__.py |
To merge this branch: | bzr merge lp:~openerp-dev/openobject-addons/trunk-event-mva |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
OpenERP Core Team | Pending | ||
Review via email: mp+88857@code.launchpad.net |
Commit message
Description of the change
event rework
To post a comment you must log in.
- 6288. By Michael (OpenERP)
-
[CLEAN] cleaning the code
- 6289. By Michael (OpenERP)
-
[MERGE] merged with main trunk
- 6290. By Michael (OpenERP)
-
[merge]merge with the trunk
- 6291. By Michael (OpenERP)
-
[merge]merge with the trunk
- 6292. By Michael (OpenERP)
-
[CLEAN] cleaning the code
- 6293. By Michael (OpenERP)
-
[CLEAN] cleaning the code
- 6294. By Michael (OpenERP)
-
[REF] remove product id from the report view
- 6295. By Michael (OpenERP)
-
[ADD] add email template
- 6296. By Quentin (OpenERP) <email address hidden>
-
[IMP] event: some usability changes
- 6297. By Quentin (OpenERP) <email address hidden>
-
[REF] event: code refactoring
- 6298. By Michael (OpenERP)
-
[REF] remove the make invoice action
- 6299. By Michael (OpenERP)
-
[IMP] change the sql request and change demo data
- 6300. By Michael (OpenERP)
-
[REF] clean the sql in the report
- 6301. By Michael (OpenERP)
-
[REF] remove the certificate
Unmerged revisions
- 6301. By Michael (OpenERP)
-
[REF] remove the certificate
- 6300. By Michael (OpenERP)
-
[REF] clean the sql in the report
- 6299. By Michael (OpenERP)
-
[IMP] change the sql request and change demo data
- 6298. By Michael (OpenERP)
-
[REF] remove the make invoice action
- 6297. By Quentin (OpenERP) <email address hidden>
-
[REF] event: code refactoring
- 6296. By Quentin (OpenERP) <email address hidden>
-
[IMP] event: some usability changes
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'event/__openerp__.py' |
2 | --- event/__openerp__.py 2012-01-31 13:36:57 +0000 |
3 | +++ event/__openerp__.py 2012-02-02 16:05:26 +0000 |
4 | @@ -39,7 +39,7 @@ |
5 | Association / Configuration / Types of Events |
6 | """, |
7 | 'author': 'OpenERP SA', |
8 | - 'depends': ['crm', 'account', 'marketing', 'mail'], |
9 | + 'depends': ['crm', 'account', 'marketing', 'email_template'], |
10 | 'init_xml': [], |
11 | 'update_xml': [ |
12 | 'security/ir.model.access.csv', |
13 | @@ -47,20 +47,20 @@ |
14 | 'wizard/event_confirm_view.xml', |
15 | 'event_view.xml', |
16 | 'report/report_event_registration_view.xml', |
17 | - 'wizard/event_make_invoice_view.xml', |
18 | 'wizard/partner_event_registration_view.xml', |
19 | 'board_association_view.xml', |
20 | 'res_partner_view.xml', |
21 | + 'email_template.xml', |
22 | ], |
23 | 'demo_xml': ['event_demo.xml'], |
24 | - 'test': ['test/process/event_confirm2done.yml', |
25 | - 'test/process/event_draft2cancel.yml', |
26 | - 'test/process/partner_register2invoice.yml', |
27 | - 'test/ui/duplicate_event.yml', |
28 | - 'test/ui/demo_data.yml'], |
29 | + 'test': [], |
30 | 'installable': True, |
31 | +<<<<<<< TREE |
32 | 'auto_install': False, |
33 | 'certificate': '0083059161581', |
34 | +======= |
35 | + 'active': False, |
36 | +>>>>>>> MERGE-SOURCE |
37 | 'images': ['images/1_event_type_list.jpeg','images/2_events.jpeg','images/3_registrations.jpeg'], |
38 | } |
39 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
40 | |
41 | === modified file 'event/board_association_view.xml' |
42 | --- event/board_association_view.xml 2011-12-19 16:54:40 +0000 |
43 | +++ event/board_association_view.xml 2012-02-02 16:05:26 +0000 |
44 | @@ -21,7 +21,7 @@ |
45 | <field name="name">Events Filling Status</field> |
46 | <field name="res_model">report.event.registration</field> |
47 | <field name="view_type">form</field> |
48 | - <field name="domain">[('state','not in',('cancel','done'))]</field> |
49 | + <field name="domain">[('event_state','not in',('cancel','done'))]</field> |
50 | <field name="view_mode">graph,tree</field> |
51 | <field name="view_id" ref="view_report_event_reg_graph"/> |
52 | </record> |
53 | @@ -45,9 +45,9 @@ |
54 | <action string="Next Events" |
55 | name="%(act_event_view)d" |
56 | domain="[('state','not in',('cancel','done'))]"/> |
57 | - <action string="Unconfirmed Registrations" |
58 | + <!--<action string="Unconfirmed Registrations" |
59 | name="%(event.act_event_list_register_event)d" |
60 | - domain="[('state','=','draft')]"/> |
61 | + domain="[('state','=','draft')]"/>--> |
62 | </column> |
63 | <column> |
64 | <action string="Events Filling Status" |
65 | |
66 | === added file 'event/email_template.xml' |
67 | --- event/email_template.xml 1970-01-01 00:00:00 +0000 |
68 | +++ event/email_template.xml 2012-02-02 16:05:26 +0000 |
69 | @@ -0,0 +1,27 @@ |
70 | +<?xml version="1.0"?> |
71 | +<openerp> |
72 | + <data> |
73 | + |
74 | + <record id="confirmation_event" model="email.template"> |
75 | + <field name="name">confirmation the event</field> |
76 | +<!-- <field name="model_id" ref="event.event_registration"/>--> |
77 | + <field name="email_from" >${object.user_id.user_email or object.company_id.email or 'noreply@localhost'}</field> |
78 | + <field name="email_to" >${object.email_from}</field> |
79 | + <field name="subject">Ticket for ${object.event_id.name}</field> |
80 | + <field name="body_text">thank you for your registration</field> |
81 | + </record> |
82 | + |
83 | + </data> |
84 | + <data> |
85 | + |
86 | + <record id="confirmation_registration" model="email.template"> |
87 | + <field name="name">confirmation the registration</field> |
88 | +<!-- <field name="model_id" ref="event.event_registration"/>--> |
89 | + <field name="email_from" >${object.user_id.user_email or object.company_id.email or 'noreply@localhost'}</field> |
90 | + <field name="email_to" >${object.email_from}</field> |
91 | + <field name="subject">Ticket for ${object.event_id.name}</field> |
92 | + <field name="body_text">thank you for your registration</field> |
93 | + </record> |
94 | + |
95 | + </data> |
96 | +</openerp> |
97 | |
98 | === modified file 'event/event.py' |
99 | --- event/event.py 2011-12-22 17:02:05 +0000 |
100 | +++ event/event.py 2012-02-02 16:05:26 +0000 |
101 | @@ -47,9 +47,7 @@ |
102 | _order = 'date_begin' |
103 | |
104 | def copy(self, cr, uid, id, default=None, context=None): |
105 | - """ Copy record of Given id |
106 | - @param id: Id of Event record. |
107 | - @param context: A standard dictionary for contextual values |
108 | + """ Reset the state and the registrations while copying an event |
109 | """ |
110 | if not default: |
111 | default = {} |
112 | @@ -59,20 +57,6 @@ |
113 | }) |
114 | return super(event_event, self).copy(cr, uid, id, default=default, context=context) |
115 | |
116 | - def onchange_product(self, cr, uid, ids, product_id=False): |
117 | - """This function returns value of product's unit price based on product id. |
118 | - @param self: The object pointer |
119 | - @param cr: the current row, from the database cursor, |
120 | - @param uid: the current user’s ID for security checks, |
121 | - @param ids: List of Event IDs |
122 | - @param product_id: Product's id |
123 | - """ |
124 | - if not product_id: |
125 | - return {'value': {'unit_price': False}} |
126 | - else: |
127 | - unit_price=self.pool.get('product.product').price_get(cr, uid, [product_id])[product_id] |
128 | - return {'value': {'unit_price': unit_price}} |
129 | - |
130 | def button_draft(self, cr, uid, ids, context=None): |
131 | return self.write(cr, uid, ids, {'state': 'draft'}, context=context) |
132 | |
133 | @@ -80,61 +64,27 @@ |
134 | return self.write(cr, uid, ids, {'state': 'cancel'}, context=context) |
135 | |
136 | def button_done(self, cr, uid, ids, context=None): |
137 | - if type(ids) in (int, long,): |
138 | - ids = [ids] |
139 | return self.write(cr, uid, ids, {'state': 'done'}, context=context) |
140 | |
141 | - def do_confirm(self, cr, uid, ids, context=None): |
142 | + def button_confirm(self, cr, uid, ids, context=None): |
143 | """ Confirm Event and send confirmation email to all register peoples |
144 | """ |
145 | + if isinstance(ids, (int, long)): |
146 | + ids = [ids] |
147 | + #renforcing method : create a list of ids |
148 | register_pool = self.pool.get('event.registration') |
149 | for event in self.browse(cr, uid, ids, context=context): |
150 | - if event.mail_auto_confirm: |
151 | + total_confirmed = event.register_current |
152 | + if total_confirmed < event.register_min or total_confirmed > event.register_max: |
153 | + raise osv.except_osv(_('Error!'),_("The total of confirmed registration for the event '%s' does not meet the expected minimum/maximum. You should maybe reconsider those limits before going further") % (even.name)) |
154 | + if event.email_confirmation_id: |
155 | #send reminder that will confirm the event for all the people that were already confirmed |
156 | reg_ids = register_pool.search(cr, uid, [ |
157 | ('event_id', '=', event.id), |
158 | ('state', 'not in', ['draft', 'cancel'])], context=context) |
159 | register_pool.mail_user_confirm(cr, uid, reg_ids) |
160 | - |
161 | return self.write(cr, uid, ids, {'state': 'confirm'}, context=context) |
162 | |
163 | - def button_confirm(self, cr, uid, ids, context=None): |
164 | - """This Function Confirm Event. |
165 | - @param ids: List of Event IDs |
166 | - @param context: A standard dictionary for contextual values |
167 | - @return: True |
168 | - """ |
169 | - if context is None: |
170 | - context = {} |
171 | - res = False |
172 | - if type(ids) in (int, long,): |
173 | - ids = [ids] |
174 | - data_pool = self.pool.get('ir.model.data') |
175 | - unconfirmed_ids = [] |
176 | - for event in self.browse(cr, uid, ids, context=context): |
177 | - total_confirmed = event.register_current |
178 | - if total_confirmed >= event.register_min or event.register_max == 0: |
179 | - res = self.do_confirm(cr, uid, [event.id], context=context) |
180 | - else: |
181 | - unconfirmed_ids.append(event.id) |
182 | - if unconfirmed_ids: |
183 | - view_id = data_pool.get_object_reference(cr, uid, 'event', 'view_event_confirm') |
184 | - view_id = view_id and view_id[1] or False |
185 | - context['event_ids'] = unconfirmed_ids |
186 | - return { |
187 | - 'name': _('Confirm Event'), |
188 | - 'context': context, |
189 | - 'view_type': 'form', |
190 | - 'view_mode': 'tree,form', |
191 | - 'res_model': 'event.confirm', |
192 | - 'views': [(view_id, 'form')], |
193 | - 'type': 'ir.actions.act_window', |
194 | - 'target': 'new', |
195 | - 'context': context, |
196 | - 'nodestroy': True |
197 | - } |
198 | - return res |
199 | - |
200 | def _get_register(self, cr, uid, ids, fields, args, context=None): |
201 | """Get Confirm or uncofirm register value. |
202 | @param ids: List of Event registration type's id |
203 | @@ -169,44 +119,10 @@ |
204 | res[event.id]['register_prospect'] = number and number[0] or 0.0 |
205 | return res |
206 | |
207 | - def write(self, cr, uid, ids, vals, context=None): |
208 | - """ |
209 | - Writes values in one or several fields. |
210 | - @param ids: List of Event registration type's IDs |
211 | - @param vals: dictionary with values to update. |
212 | - @return: True |
213 | - """ |
214 | - register_pool = self.pool.get('event.registration') |
215 | - res = super(event_event, self).write(cr, uid, ids, vals, context=context) |
216 | - if vals.get('date_begin', False) or vals.get('mail_auto_confirm', False) or vals.get('mail_confirm', False): |
217 | - for event in self.browse(cr, uid, ids, context=context): |
218 | - #change the deadlines of the registration linked to this event |
219 | - register_values = {} |
220 | - if vals.get('date_begin', False): |
221 | - register_values['date_deadline'] = vals['date_begin'] |
222 | - |
223 | - #change the description of the registration linked to this event |
224 | - if vals.get('mail_auto_confirm', False): |
225 | - if vals['mail_auto_confirm']: |
226 | - if 'mail_confirm' not in vals: |
227 | - vals['mail_confirm'] = event.mail_confirm |
228 | - else: |
229 | - vals['mail_confirm'] = False |
230 | - if 'mail_confirm' in vals: |
231 | - register_values['description'] = vals['mail_confirm'] |
232 | - |
233 | - if register_values: |
234 | - reg_ids = register_pool.search(cr, uid, [('event_id', '=', event.id)], context=context) |
235 | - register_pool.write(cr, uid, reg_ids, register_values, context=context) |
236 | - return res |
237 | - |
238 | _columns = { |
239 | - 'name': fields.char('Summary', size=64, required=True, translate=True, readonly=False, states={'done': [('readonly', True)]}), |
240 | + 'name': fields.char('Name', size=64, required=True, translate=True, readonly=False, states={'done': [('readonly', True)]}), |
241 | 'user_id': fields.many2one('res.users', 'Responsible User', readonly=False, states={'done': [('readonly', True)]}), |
242 | - 'parent_id': fields.many2one('event.event', 'Parent Event', readonly=False, states={'done': [('readonly', True)]}), |
243 | 'section_id': fields.many2one('crm.case.section', 'Sale Team', readonly=False, states={'done': [('readonly', True)]}), |
244 | - 'child_ids': fields.one2many('event.event', 'parent_id', 'Child Events', readonly=False, states={'done': [('readonly', True)]}), |
245 | - 'reply_to': fields.char('Reply-To', size=64, readonly=False, states={'done': [('readonly', True)]}, help="The email address put in the 'Reply-To' of all emails sent by OpenERP"), |
246 | 'type': fields.many2one('event.type', 'Type', help="Type of Event like Seminar, Exhibition, Conference, Training.", readonly=False, states={'done': [('readonly', True)]}), |
247 | 'register_max': fields.integer('Maximum Registrations', help="Provide Maximum Number of Registrations", readonly=True, states={'draft': [('readonly', False)]}), |
248 | 'register_min': fields.integer('Minimum Registrations', help="Provide Minimum Number of Registrations", readonly=True, states={'draft': [('readonly', False)]}), |
249 | @@ -215,8 +131,8 @@ |
250 | 'register_prospect': fields.function(_get_register, string='Unconfirmed Registrations', multi='register_prospect', |
251 | help="Total of Prospect Registrations"), |
252 | 'registration_ids': fields.one2many('event.registration', 'event_id', 'Registrations', readonly=False, states={'done': [('readonly', True)]}), |
253 | - 'date_begin': fields.datetime('Beginning date', required=True, help="Beginning Date of Event", readonly=True, states={'draft': [('readonly', False)]}), |
254 | - 'date_end': fields.datetime('Closing date', required=True, help="Closing Date of Event", readonly=True, states={'draft': [('readonly', False)]}), |
255 | + 'date_begin': fields.datetime('Starting Date', required=True, help="Beginning Date of Event", readonly=True, states={'draft': [('readonly', False)]}), |
256 | + 'date_end': fields.datetime('Closing Date', required=True, help="Closing Date of Event", readonly=True, states={'draft': [('readonly', False)]}), |
257 | 'state': fields.selection([ |
258 | ('draft', 'Draft'), |
259 | ('confirm', 'Confirmed'), |
260 | @@ -224,23 +140,18 @@ |
261 | ('cancel', 'Cancelled')], |
262 | 'State', readonly=True, required=True, |
263 | help='If event is created, the state is \'Draft\'.If event is confirmed for the particular dates the state is set to \'Confirmed\'. If the event is over, the state is set to \'Done\'.If event is cancelled the state is set to \'Cancelled\'.'), |
264 | - 'mail_auto_registr': fields.boolean('Mail Auto Register', readonly=False, states={'done': [('readonly', True)]}, help='Check this box if you want to use automatic emailing for new registration.'), |
265 | - 'mail_auto_confirm': fields.boolean('Mail Auto Confirm', readonly=False, states={'done': [('readonly', True)]}, help='Check this box if you want to use automatic confirmation emailing or reminder.'), |
266 | - 'mail_registr': fields.text('Registration Email', readonly=False, states={'done': [('readonly', True)]}, help='This email will be sent when someone subscribes to the event.'), |
267 | - 'mail_confirm': fields.text('Confirmation Email', readonly=False, states={'done': [('readonly', True)]}, help="This email will be sent when the event gets confirmed or when someone subscribes to a confirmed event. This is also the email sent to remind someone about the event."), |
268 | - 'product_id': fields.many2one('product.product', 'Product', required=True, readonly=True, states={'draft': [('readonly', False)]}, help="The invoices of this event registration will be created with this Product. Thus it allows you to set the default label and the accounting info you want by default on these invoices."), |
269 | - 'note': fields.text('Notes', help="Description or Summary of Event", readonly=False, states={'done': [('readonly', True)]}), |
270 | - 'pricelist_id': fields.many2one('product.pricelist', 'Pricelist', readonly=True, states={'draft': [('readonly', False)]}, help="Pricelist version for current event."), |
271 | - 'unit_price': fields.related('product_id', 'list_price', type='float', string='Registration Cost', readonly=True, states={'draft':[('readonly',False)]}, help="This will be the default price used as registration cost when invoicing this event. Note that you can specify a specific amount for each registration.", digits_compute=dp.get_precision('Sale Price')), |
272 | + 'email_registration_id' : fields.many2one('email.template','Email registration'), |
273 | + 'email_confirmation_id' : fields.many2one('email.template','Email confirmation'), |
274 | + 'reply_to': fields.char('Reply-To', size=64, readonly=False, states={'done': [('readonly', True)]}, help="The email address put in the 'Reply-To' of all emails sent by OpenERP"), |
275 | 'main_speaker_id': fields.many2one('res.partner','Main Speaker', readonly=False, states={'done': [('readonly', True)]}, help="Speaker who will be giving speech at the event."), |
276 | 'speaker_ids': fields.many2many('res.partner', 'event_speaker_rel', 'speaker_id', 'partner_id', 'Other Speakers', readonly=False, states={'done': [('readonly', True)]}), |
277 | 'address_id': fields.many2one('res.partner.address','Location Address', readonly=False, states={'done': [('readonly', True)]}), |
278 | 'speaker_confirmed': fields.boolean('Speaker Confirmed', readonly=False, states={'done': [('readonly', True)]}), |
279 | 'country_id': fields.related('address_id', 'country_id', |
280 | type='many2one', relation='res.country', string='Country', readonly=False, states={'done': [('readonly', True)]}), |
281 | - 'language': fields.char('Language',size=64, readonly=False, states={'done': [('readonly', True)]}), |
282 | 'note': fields.text('Description', readonly=False, states={'done': [('readonly', True)]}), |
283 | 'company_id': fields.many2one('res.company', 'Company', required=False, change_default=True, readonly=False, states={'done': [('readonly', True)]}), |
284 | + 'product_id': fields.many2one('product.product', 'Product', readonly=True, states={'draft': [('readonly', False)]}, help="The product is optional and only serves informative purposes. It will be used for analysis mainly."), |
285 | } |
286 | |
287 | _defaults = { |
288 | @@ -249,9 +160,6 @@ |
289 | 'user_id': lambda obj, cr, uid, context: uid, |
290 | } |
291 | |
292 | - def _check_recursion(self, cr, uid, ids, context=None): |
293 | - return super(event_event, self)._check_recursion(cr, uid, ids, context=context) |
294 | - |
295 | def _check_closing_date(self, cr, uid, ids, context=None): |
296 | for event in self.browse(cr, uid, ids, context=context): |
297 | if event.date_end < event.date_begin: |
298 | @@ -259,10 +167,9 @@ |
299 | return True |
300 | |
301 | _constraints = [ |
302 | - (_check_recursion, 'Error ! You cannot create recursive event.', ['parent_id']), |
303 | (_check_closing_date, 'Error ! Closing Date cannot be set before Beginning Date.', ['date_end']), |
304 | ] |
305 | - |
306 | + #TODO: display sale_team in event form view and use this onchange |
307 | def do_team_change(self, cr, uid, ids, team_id, context=None): |
308 | """ |
309 | On Change Callback: when team change, this is call. |
310 | @@ -283,151 +190,36 @@ |
311 | """Event Registration""" |
312 | _name= 'event.registration' |
313 | _description = __doc__ |
314 | - _inherit = 'mail.thread' |
315 | - |
316 | - def _amount_line(self, cr, uid, ids, field_name, arg, context=None): |
317 | - cur_obj = self.pool.get('res.currency') |
318 | - res = {} |
319 | - for line in self.browse(cr, uid, ids, context=context): |
320 | - price = line.unit_price * line.nb_register |
321 | - pricelist = line.event_id.pricelist_id or line.partner_invoice_id.property_product_pricelist |
322 | - cur = pricelist and pricelist.currency_id or False |
323 | - res[line.id] = cur and cur_obj.round(cr, uid, cur, price) or price |
324 | - return res |
325 | + _inherit = ['mail.thread','res.partner.address'] |
326 | |
327 | _columns = { |
328 | 'id': fields.integer('ID'), |
329 | - 'name': fields.char('Summary', size=124, readonly=True, states={'draft': [('readonly', False)]}), |
330 | - 'email_cc': fields.text('CC', size=252, readonly=False, states={'done': [('readonly', True)]}, help="These email addresses will be added to the CC field of all inbound and outbound emails for this record before being sent. Separate multiple email addresses with a comma"), |
331 | + 'origin': fields.char('Origin', size=124, readonly=True, states={'draft': [('readonly', False)]}), |
332 | 'nb_register': fields.integer('Quantity', required=True, readonly=True, states={'draft': [('readonly', False)]}, help="Number of Registrations or Tickets"), |
333 | 'event_id': fields.many2one('event.event', 'Event', required=True, readonly=True, states={'draft': [('readonly', False)]}), |
334 | 'partner_id': fields.many2one('res.partner', 'Partner', states={'done': [('readonly', True)]}), |
335 | - "partner_invoice_id": fields.many2one('res.partner', 'Partner Invoiced', readonly=True, states={'draft': [('readonly', False)]}), |
336 | + 'partner_id_address': fields.many2one('res.partner.address', 'Partner', states={'done': [('readonly', True)]}), |
337 | "contact_id": fields.many2one('res.partner.address', 'Partner Contact', readonly=False, states={'done': [('readonly', True)]}), #TODO: filter only the contacts that have a function into the selected partner_id |
338 | - "unit_price": fields.float('Unit Price', required=True, digits_compute=dp.get_precision('Sale Price'), readonly=True, states={'draft': [('readonly', False)]}), |
339 | - 'price_subtotal': fields.function(_amount_line, string='Subtotal', digits_compute=dp.get_precision('Sale Price'), store=True), |
340 | - "badge_ids": fields.one2many('event.registration.badge', 'registration_id', 'Badges', readonly=False, states={'done': [('readonly', True)]}), |
341 | - "event_product": fields.char("Invoice Name", size=128, readonly=True, states={'draft': [('readonly', False)]}), |
342 | - "tobe_invoiced": fields.boolean("To be Invoiced", readonly=True, states={'draft': [('readonly', False)]}), |
343 | - "invoice_id": fields.many2one("account.invoice", "Invoice", readonly=True), |
344 | - 'date_closed': fields.datetime('Closed', readonly=True), |
345 | - 'ref': fields.reference('Reference', selection=crm._links_get, size=128), |
346 | - 'ref2': fields.reference('Reference 2', selection=crm._links_get, size=128), |
347 | - 'email_from': fields.char('Email', size=128, states={'done': [('readonly', True)]}, help="These people will receive email."), |
348 | - 'create_date': fields.datetime('Creation Date', readonly=True), |
349 | - 'write_date': fields.datetime('Write Date', readonly=True), |
350 | - 'description': fields.text('Description', states={'done': [('readonly', True)]}), |
351 | - 'message_ids': fields.one2many('mail.message', 'res_id', 'Messages', domain=[('model','=',_name)]), |
352 | + 'date_closed': fields.datetime('Closure Date', readonly=True), |
353 | + 'email_from': fields.related('event_id','reply_to',string='Reply-to Email', type='char', size=128, readonly=True,), |
354 | 'log_ids': fields.one2many('mail.message', 'res_id', 'Logs', domain=[('email_from', '=', False),('model','=',_name)]), |
355 | - 'date_deadline': fields.related('event_id','date_end', type='datetime', string="End Date", readonly=True), |
356 | - 'date': fields.related('event_id', 'date_begin', type='datetime', string="Start Date", readonly=True), |
357 | + 'date_deadline': fields.related('event_id','date_end', type='datetime', string="Event End Date", readonly=True), |
358 | + 'date': fields.related('event_id', 'date_begin', type='datetime', string="Event Start Date", readonly=True), |
359 | 'user_id': fields.many2one('res.users', 'Responsible', states={'done': [('readonly', True)]}), |
360 | - 'active': fields.boolean('Active'), |
361 | 'section_id': fields.related('event_id', 'section_id', type='many2one', relation='crm.case.section', string='Sale Team', store=True, readonly=True), |
362 | 'company_id': fields.related('event_id', 'company_id', type='many2one', relation='res.company', string='Company', store=True, readonly=True, states={'draft':[('readonly',False)]}), |
363 | - 'state': fields.selection([('open', 'Confirmed'), |
364 | - ('draft', 'Unconfirmed'), |
365 | + 'state': fields.selection([('draft', 'Unconfirmed'), |
366 | + ('open', 'Confirmed'), |
367 | ('cancel', 'Cancelled'), |
368 | ('done', 'Done')], 'State', \ |
369 | size=16, readonly=True) |
370 | } |
371 | _defaults = { |
372 | 'nb_register': 1, |
373 | - 'tobe_invoiced': True, |
374 | 'state': 'draft', |
375 | - 'active': 1, |
376 | 'user_id': lambda self, cr, uid, ctx: uid, |
377 | } |
378 | |
379 | - def _make_invoice(self, cr, uid, reg, lines, context=None): |
380 | - """ Create Invoice from Invoice lines |
381 | - @param reg: Model of Event Registration |
382 | - @param lines: Ids of Invoice lines |
383 | - """ |
384 | - if context is None: |
385 | - context = {} |
386 | - inv_pool = self.pool.get('account.invoice') |
387 | - val_invoice = inv_pool.onchange_partner_id(cr, uid, [], 'out_invoice', reg.partner_invoice_id.id, False, False) |
388 | - val_invoice['value'].update({'partner_id': reg.partner_invoice_id.id}) |
389 | - val_invoice['value'].update({ |
390 | - 'origin': reg.event_product, |
391 | - 'reference': False, |
392 | - 'invoice_line': [(6, 0, lines)], |
393 | - 'comment': "", |
394 | - 'date_invoice': context.get('date_inv', False) |
395 | - }) |
396 | - inv_id = inv_pool.create(cr, uid, val_invoice['value'], context=context) |
397 | - inv_pool.button_compute(cr, uid, [inv_id]) |
398 | - self.message_append(cr, uid, [reg], _('Invoiced')) |
399 | - return inv_id |
400 | - |
401 | - def copy(self, cr, uid, id, default=None, context=None): |
402 | - """ Copy record of Given id |
403 | - @param id: Id of Registration record. |
404 | - @param context: A standard dictionary for contextual values |
405 | - """ |
406 | - if not default: |
407 | - default = {} |
408 | - default.update({ |
409 | - 'invoice_id': False, |
410 | - }) |
411 | - return super(event_registration, self).copy(cr, uid, id, default=default, context=context) |
412 | - |
413 | - def action_invoice_create(self, cr, uid, ids, grouped=False, date_inv = False, context=None): |
414 | - """ Action of Create Invoice """ |
415 | - res = False |
416 | - invoices = {} |
417 | - tax_ids=[] |
418 | - new_invoice_ids = [] |
419 | - inv_lines_pool = self.pool.get('account.invoice.line') |
420 | - inv_pool = self.pool.get('account.invoice') |
421 | - product_pool = self.pool.get('product.product') |
422 | - contact_pool = self.pool.get('res.partner.address') |
423 | - if context is None: |
424 | - context = {} |
425 | - # If date was specified, use it as date invoiced, usefull when invoices are generated this month and put the |
426 | - # last day of the last month as invoice date |
427 | - if date_inv: |
428 | - context['date_inv'] = date_inv |
429 | - |
430 | - for reg in self.browse(cr, uid, ids, context=context): |
431 | - val_invoice = inv_pool.onchange_partner_id(cr, uid, [], 'out_invoice', reg.partner_invoice_id.id, False, False) |
432 | - val_invoice['value'].update({'partner_id': reg.partner_invoice_id.id}) |
433 | - partner_address_id = val_invoice['value']['address_invoice_id'] |
434 | - if not partner_address_id: |
435 | - raise osv.except_osv(_('Error !'), |
436 | - _("Registered partner doesn't have an address to make the invoice.")) |
437 | - |
438 | - value = inv_lines_pool.product_id_change(cr, uid, [], reg.event_id.product_id.id, uom =False, partner_id=reg.partner_invoice_id.id, fposition_id=reg.partner_invoice_id.property_account_position.id) |
439 | - product = product_pool.browse(cr, uid, reg.event_id.product_id.id, context=context) |
440 | - for tax in product.taxes_id: |
441 | - tax_ids.append(tax.id) |
442 | - vals = value['value'] |
443 | - c_name = reg.contact_id and ('-' + contact_pool.name_get(cr, uid, [reg.contact_id.id])[0][1]) or '' |
444 | - vals.update({ |
445 | - 'name': reg.event_product + '-' + c_name, |
446 | - 'price_unit': reg.unit_price, |
447 | - 'quantity': reg.nb_register, |
448 | - 'product_id':reg.event_id.product_id.id, |
449 | - 'invoice_line_tax_id': [(6, 0, tax_ids)], |
450 | - }) |
451 | - inv_line_ids = self._create_invoice_lines(cr, uid, [reg.id], vals) |
452 | - invoices.setdefault(reg.partner_id.id, []).append((reg, inv_line_ids)) |
453 | - for val in invoices.values(): |
454 | - res = False |
455 | - if grouped: |
456 | - res = self._make_invoice(cr, uid, val[0][0], [v for k, v in val], context=context) |
457 | - |
458 | - for k, v in val: |
459 | - self.do_close(cr, uid, [k.id], context={'invoice_id': res}) |
460 | - |
461 | - else: |
462 | - for k, v in val: |
463 | - res = self._make_invoice(cr, uid, k, [v], context=context) |
464 | - self.do_close(cr, uid, [k.id], context={'invoice_id': res}) |
465 | - if res: new_invoice_ids.append(res) |
466 | - return new_invoice_ids |
467 | - |
468 | def do_open(self, cr, uid, ids, context=None): |
469 | """ Open Registration |
470 | """ |
471 | @@ -441,274 +233,100 @@ |
472 | """ |
473 | if context is None: |
474 | context = {} |
475 | - invoice_id = context.get('invoice_id', False) |
476 | values = {'state': 'done', 'date_closed': time.strftime('%Y-%m-%d %H:%M:%S')} |
477 | msg = _('Done') |
478 | - if invoice_id: |
479 | - values['invoice_id'] = invoice_id |
480 | res = self.write(cr, uid, ids, values) |
481 | self.message_append(cr, uid, ids, msg) |
482 | return res |
483 | - |
484 | + |
485 | # event uses add_note wizard from crm, which expects case_* methods |
486 | def case_open(self, cr, uid, ids, context=None): |
487 | self.do_open(cr, uid, ids, context) |
488 | - |
489 | + |
490 | # event uses add_note wizard from crm, which expects case_* methods |
491 | - def case_close(self, cr, uid, ids, context=None): |
492 | - self.do_close(cr, uid, ids, context) |
493 | - |
494 | + #def case_close(self, cr, uid, ids, context=None): |
495 | + # self.do_close(cr, uid, ids, context) |
496 | + # return self.write(cr, uid, ids, {'state': 'done'}) |
497 | + |
498 | # event uses add_note wizard from crm, which expects case_* methods |
499 | def case_cancel(self, cr, uid, ids, context=None): |
500 | """ Cancel Registration |
501 | """ |
502 | self.message_append(cr, uid, ids, _('Cancel')) |
503 | return self.write(cr, uid, ids, {'state': 'cancel'}) |
504 | - |
505 | + |
506 | # event uses add_note wizard from crm, which expects case_* methods |
507 | def case_reset(self, cr, uid, ids, context=None): |
508 | pass |
509 | - |
510 | + |
511 | # event uses add_note wizard from crm, which expects case_* methods |
512 | def case_pending(self, cr, uid, ids, context=None): |
513 | pass |
514 | - |
515 | - def check_confirm(self, cr, uid, ids, context=None): |
516 | - """This Function Open Event Registration and send email to user. |
517 | - @param ids: List of Event registration's IDs |
518 | - @param context: A standard dictionary for contextual values |
519 | - @return: True |
520 | - """ |
521 | - if type(ids) in (int, long,): |
522 | - ids = [ids] |
523 | - data_pool = self.pool.get('ir.model.data') |
524 | - unconfirmed_ids = [] |
525 | - if context is None: |
526 | - context = {} |
527 | - for registration in self.browse(cr, uid, ids, context=context): |
528 | - total_confirmed = registration.event_id.register_current + registration.nb_register |
529 | - if total_confirmed <= registration.event_id.register_max or registration.event_id.register_max == 0: |
530 | - self.do_open(cr, uid, [registration.id], context=context) |
531 | - else: |
532 | - unconfirmed_ids.append(registration.id) |
533 | - if unconfirmed_ids: |
534 | - view_id = data_pool.get_object_reference(cr, uid, 'event', 'view_event_confirm_registration') |
535 | - view_id = view_id and view_id[1] or False |
536 | - context['registration_ids'] = unconfirmed_ids |
537 | - return { |
538 | - 'name': _('Confirm Registration'), |
539 | - 'context': context, |
540 | - 'view_type': 'form', |
541 | - 'view_mode': 'tree,form', |
542 | - 'res_model': 'event.confirm.registration', |
543 | - 'views': [(view_id, 'form')], |
544 | - 'type': 'ir.actions.act_window', |
545 | - 'target': 'new', |
546 | - 'context': context, |
547 | - 'nodestroy': True |
548 | - } |
549 | - return True |
550 | |
551 | - def button_reg_close(self, cr, uid, ids, context=None): |
552 | - """This Function Close Event Registration. |
553 | - """ |
554 | - data_pool = self.pool.get('ir.model.data') |
555 | - unclosed_ids = [] |
556 | - for registration in self.browse(cr, uid, ids, context=context): |
557 | - if registration.tobe_invoiced and not registration.invoice_id: |
558 | - unclosed_ids.append(registration.id) |
559 | - else: |
560 | - self.do_close(cr, uid, [registration.id], context=context) |
561 | - if unclosed_ids: |
562 | - view_id = data_pool.get_object_reference(cr, uid, 'event', 'view_event_make_invoice') |
563 | - view_id = view_id and view_id[1] or False |
564 | - context['active_ids'] = unclosed_ids |
565 | - return { |
566 | - 'name': _('Close Registration'), |
567 | - 'context': context, |
568 | - 'view_type': 'form', |
569 | - 'view_mode': 'tree,form', |
570 | - 'res_model': 'event.make.invoice', |
571 | - 'views': [(view_id, 'form')], |
572 | - 'type': 'ir.actions.act_window', |
573 | - 'target': 'new', |
574 | - 'context': context, |
575 | - 'nodestroy': True |
576 | - } |
577 | - return True |
578 | + #def button_reg_close(self, cr, uid, ids, context=None): |
579 | + # """This Function Close Event Registration. |
580 | + # """ |
581 | + # return self.case_close(cr, uid, ids) |
582 | |
583 | def button_reg_cancel(self, cr, uid, ids, context=None, *args): |
584 | return self.case_cancel(cr, uid, ids) |
585 | |
586 | def mail_user(self, cr, uid, ids, confirm=False, context=None): |
587 | """ |
588 | - Send email to user |
589 | + Send email to user with email_template when registration is done |
590 | """ |
591 | - mail_message = self.pool.get('mail.message') |
592 | for registration in self.browse(cr, uid, ids, context=context): |
593 | - src = registration.event_id.reply_to or False |
594 | - email_to = [] |
595 | - email_cc = [] |
596 | - if registration.email_from: |
597 | - email_to = [registration.email_from] |
598 | - if registration.email_cc: |
599 | - email_cc += [registration.email_cc] |
600 | - if not (email_to or email_cc): |
601 | - continue |
602 | - subject = "" |
603 | - body = "" |
604 | - if confirm: |
605 | - subject = _('Auto Confirmation: [%s] %s') %(registration.id, registration.name) |
606 | - body = registration.event_id.mail_confirm |
607 | - elif registration.event_id.mail_auto_confirm or registration.event_id.mail_auto_registr: |
608 | - if registration.event_id.state in ['draft', 'fixed', 'open', 'confirm', 'running'] and registration.event_id.mail_auto_registr: |
609 | - subject = _('Auto Registration: [%s] %s') %(registration.id, registration.name) |
610 | - body = registration.event_id.mail_registr |
611 | - if (registration.event_id.state in ['confirm', 'running']) and registration.event_id.mail_auto_confirm: |
612 | - subject = _('Auto Confirmation: [%s] %s') %(registration.id, registration.name) |
613 | - body = registration.event_id.mail_confirm |
614 | - if subject or body: |
615 | - mail_message.schedule_with_attach(cr, uid, src, email_to, subject, body, model='event.registration', email_cc=email_cc, res_id=registration.id) |
616 | - |
617 | + template_id = registration.event_id.email_registration_id.id |
618 | + if template_id: |
619 | + mail_message = self.pool.get('email.template').send_mail(cr,uid,template_id,registration.id) |
620 | return True |
621 | |
622 | def mail_user_confirm(self, cr, uid, ids, context=None): |
623 | """ |
624 | - Send email to user |
625 | - """ |
626 | - return self.mail_user(cr, uid, ids, confirm=True, context=context) |
627 | - |
628 | - def _create_invoice_lines(self, cr, uid, ids, vals): |
629 | - """ Create account Invoice line for Registration Id. |
630 | - """ |
631 | - return self.pool.get('account.invoice.line').create(cr, uid, vals) |
632 | - |
633 | - def onchange_contact_id(self, cr, uid, ids, contact, partner): |
634 | - |
635 | - """This function returns value of Badge Name, Badge Title based on Partner contact. |
636 | - @param self: The object pointer |
637 | - @param cr: the current row, from the database cursor, |
638 | - @param uid: the current user’s ID for security checks, |
639 | - @param ids: List of Registration IDs |
640 | - @param contact: Patner Contact IDS |
641 | - @param partner: Partner IDS |
642 | - """ |
643 | + Send email to user when the event is done |
644 | + """ |
645 | + for registration in self.browse(cr, uid, ids, context=context): |
646 | + template_id = registration.event_id.email_confirmation_id.id |
647 | + if template_id: |
648 | + mail_message = self.pool.get('email.template').send_mail(cr,uid,template_id,registration.id) |
649 | + return True |
650 | + |
651 | + def onchange_contact_id(self, cr, uid, ids, contact, partner, context=None): |
652 | data ={} |
653 | if not contact: |
654 | return data |
655 | addr_obj = self.pool.get('res.partner.address') |
656 | - data['email_from'] = addr_obj.browse(cr, uid, contact).email |
657 | + data['email_from'] = addr_obj.browse(cr, uid, contact, context).email |
658 | return {'value': data} |
659 | |
660 | - def onchange_event(self, cr, uid, ids, event_id, partner_invoice_id): |
661 | + def onchange_event(self, cr, uid, ids, event_id, context=None): |
662 | """This function returns value of Product Name, Unit Price based on Event. |
663 | - @param self: The object pointer |
664 | - @param cr: the current row, from the database cursor, |
665 | - @param uid: the current user’s ID for security checks, |
666 | - @param ids: List of Registration IDs |
667 | - @param event_id: Event ID |
668 | - @param partner_invoice_id: Partner Invoice ID |
669 | """ |
670 | - context = {} |
671 | + if context is None: |
672 | + context = {} |
673 | if not event_id: |
674 | - return {'value': {'unit_price': False, 'event_product': False}} |
675 | - |
676 | + return {} |
677 | event_obj = self.pool.get('event.event') |
678 | - prod_obj = self.pool.get('product.product') |
679 | - res_obj = self.pool.get('res.partner') |
680 | - |
681 | - data_event = event_obj.browse(cr, uid, event_id) |
682 | - res = {'value': {'unit_price': False, |
683 | - 'event_product': False, |
684 | - 'user_id': False, |
685 | - 'date': data_event.date_begin, |
686 | - 'date_deadline': data_event.date_end, |
687 | - 'description': data_event.note, |
688 | - 'name': data_event.name, |
689 | - 'section_id': data_event.section_id and data_event.section_id.id or False, |
690 | - }} |
691 | - if data_event.user_id.id: |
692 | - res['value'].update({'user_id': data_event.user_id.id}) |
693 | - if data_event.product_id: |
694 | - pricelist_id = data_event.pricelist_id and data_event.pricelist_id.id or False |
695 | - if partner_invoice_id: |
696 | - partner = res_obj.browse(cr, uid, partner_invoice_id, context=context) |
697 | - pricelist_id = pricelist_id or partner.property_product_pricelist.id |
698 | - unit_price = prod_obj._product_price(cr, uid, [data_event.product_id.id], False, False, {'pricelist': pricelist_id})[data_event.product_id.id] |
699 | - if not unit_price: |
700 | - unit_price = data_event.unit_price |
701 | - res['value'].update({'unit_price': unit_price, 'event_product': data_event.product_id.name}) |
702 | - return res |
703 | - |
704 | - def onchange_partner_id(self, cr, uid, ids, part, event_id, email=False): |
705 | - """This function returns value of Patner Invoice id, Unit Price, badget title based on partner and Event. |
706 | - @param self: The object pointer |
707 | - @param cr: the current row, from the database cursor, |
708 | - @param uid: the current user’s ID for security checks, |
709 | - @param ids: List of Registration IDs |
710 | - @param event_id: Event ID |
711 | - @param partner_invoice_id: Partner Invoice ID |
712 | - """ |
713 | + data_event = event_obj.browse(cr, uid, event_id, context=context) |
714 | + return {'value': |
715 | + {'date': data_event.date_begin, |
716 | + 'date_deadline': data_event.date_end, |
717 | + 'section_id': data_event.section_id and data_event.section_id.id or False, |
718 | + 'company_id': data_event.company_id and data_event.company_id.id or False, |
719 | + } |
720 | + } |
721 | + |
722 | + def onchange_partner_id(self, cr, uid, ids, part, context=None): |
723 | res_obj = self.pool.get('res.partner') |
724 | |
725 | data = {} |
726 | - data['contact_id'], data['partner_invoice_id'], data['email_from'] = (False, False, False) |
727 | if not part: |
728 | return {'value': data} |
729 | - data['partner_invoice_id'] = part |
730 | - # this calls onchange_partner_invoice_id |
731 | - d = self.onchange_partner_invoice_id(cr, uid, ids, event_id, part) |
732 | - # this updates the dictionary |
733 | - data.update(d['value']) |
734 | addr = res_obj.address_get(cr, uid, [part]).get('default', False) |
735 | if addr: |
736 | - d = self.onchange_contact_id(cr, uid, ids, addr, part) |
737 | + d = self.onchange_contact_id(cr, uid, ids, addr, part, context) |
738 | data.update(d['value']) |
739 | return {'value': data} |
740 | |
741 | - def onchange_partner_invoice_id(self, cr, uid, ids, event_id, partner_invoice_id): |
742 | - """This function returns value of Product unit Price based on Invoiced partner. |
743 | - @param self: The object pointer |
744 | - @param cr: the current row, from the database cursor, |
745 | - @param uid: the current user’s ID for security checks, |
746 | - @param ids: List of Registration IDs |
747 | - @param event_id: Event ID |
748 | - @param partner_invoice_id: Partner Invoice ID |
749 | - """ |
750 | - data = {} |
751 | - context = {} |
752 | - event_obj = self.pool.get('event.event') |
753 | - prod_obj = self.pool.get('product.product') |
754 | - res_obj = self.pool.get('res.partner') |
755 | - |
756 | - data['unit_price']=False |
757 | - if not event_id: |
758 | - return {'value': data} |
759 | - data_event = event_obj.browse(cr, uid, event_id, context=context) |
760 | - if data_event.product_id: |
761 | - data['event_product'] = data_event.product_id.name |
762 | - pricelist_id = data_event.pricelist_id and data_event.pricelist_id.id or False |
763 | - if partner_invoice_id: |
764 | - partner = res_obj.browse(cr, uid, partner_invoice_id, context=context) |
765 | - pricelist_id = pricelist_id or partner.property_product_pricelist.id |
766 | - unit_price = prod_obj._product_price(cr, uid, [data_event.product_id.id], False, False, {'pricelist': pricelist_id})[data_event.product_id.id] |
767 | - if not unit_price: |
768 | - unit_price = data_event.unit_price |
769 | - data['unit_price'] = unit_price |
770 | - return {'value': data} |
771 | - |
772 | event_registration() |
773 | - |
774 | -class event_registration_badge(osv.osv): |
775 | - _name = 'event.registration.badge' |
776 | - _description = __doc__ |
777 | - _columns = { |
778 | - "registration_id": fields.many2one('event.registration', 'Registration', required=True), |
779 | - "title": fields.char('Title', size=128), |
780 | - "name": fields.char('Name', size=128, required=True), |
781 | - "address_id": fields.many2one('res.partner.address', 'Address'), |
782 | - } |
783 | - |
784 | -event_registration_badge() |
785 | - |
786 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
787 | |
788 | === modified file 'event/event_demo.xml' |
789 | --- event/event_demo.xml 2011-12-19 16:54:40 +0000 |
790 | +++ event/event_demo.xml 2012-02-02 16:05:26 +0000 |
791 | @@ -4,6 +4,10 @@ |
792 | <record id="base.user_demo" model="res.users"> |
793 | <field name="groups_id" eval="[(4, ref('marketing.group_marketing_user')),(4, ref('base.group_sale_salesman'))]"/> |
794 | </record> |
795 | + |
796 | + |
797 | + |
798 | + |
799 | <!-- Demo Data for Product --> |
800 | <record id="event_product_0" model="product.product"> |
801 | <field name="list_price">68.00</field> |
802 | @@ -99,7 +103,7 @@ |
803 | <!-- Demo data for Event Registration--> |
804 | <record id="reg_1_1" model="event.registration"> |
805 | <field name="event_id" ref="event_1"/> |
806 | - <field name="partner_id" ref="base.res_partner_asus"/> |
807 | + <field name="partner_id_address" ref="base.res_partner_asus"/> |
808 | <field name="partner_invoice_id" ref="base.res_partner_asus"/> |
809 | <field name="nb_register">5</field> |
810 | <field name="event_product">Ticket for Opera</field> |
811 | @@ -108,25 +112,25 @@ |
812 | |
813 | <record id="reg_1_2" model="event.registration"> |
814 | <field name="event_id" ref="event_1"/> |
815 | - <field name="partner_id" ref="base.res_partner_agrolait"/> |
816 | + <field name="partner_id_address" ref="base.res_partner_agrolait"/> |
817 | <field name="partner_invoice_id" ref="base.res_partner_agrolait"/> |
818 | <field name="nb_register">10</field> |
819 | <field name="event_product">Ticket for Opera</field> |
820 | <field name="unit_price">24.00</field> |
821 | </record> |
822 | |
823 | - <function model="event.registration" name="check_confirm" eval="[ref('reg_1_2')]"/> |
824 | + |
825 | |
826 | <record id="reg_0_1" model="event.registration"> |
827 | <field name="event_id" ref="event_0"/> |
828 | - <field name="partner_id" ref="base.res_partner_c2c"/> |
829 | + <field name="partner_id_address" ref="base.res_partner_c2c"/> |
830 | <field name="partner_invoice_id" ref="base.res_partner_c2c"/> |
831 | <field name="nb_register">6</field> |
832 | <field name="event_product">Ticket for Concert</field> |
833 | <field name="unit_price">15.50</field> |
834 | </record> |
835 | |
836 | - <function model="event.registration" name="check_confirm" eval="[ref('reg_0_1')]"/> |
837 | + |
838 | |
839 | <record id="reg_0_2" model="event.registration"> |
840 | <field name="event_id" ref="event_2"/> |
841 | @@ -137,7 +141,7 @@ |
842 | <field name="unit_price">20</field> |
843 | </record> |
844 | |
845 | - <function model="event.registration" name="check_confirm" eval="[ref('reg_0_2')]"/> |
846 | + |
847 | |
848 | </data> |
849 | </openerp> |
850 | |
851 | === modified file 'event/event_view.xml' |
852 | --- event/event_view.xml 2011-12-19 16:54:40 +0000 |
853 | +++ event/event_view.xml 2012-02-02 16:05:26 +0000 |
854 | @@ -38,11 +38,11 @@ |
855 | <field name="res_model">event.type</field> |
856 | <field name="view_type">form</field> |
857 | </record> |
858 | - <menuitem name="Configuration" id="base.menu_marketing_config_root" parent="base.marketing_menu" sequence="30" groups="base.group_extended"/> |
859 | - <menuitem name="Configuration" id="base.menu_marketing_config_association" parent="base.menu_association" sequence="30" groups="base.group_extended"/> |
860 | + <menuitem name="Configuration" id="base.menu_marketing_config_root" parent="base.marketing_menu" sequence="30"/> |
861 | + <menuitem name="Configuration" id="base.menu_marketing_config_association" parent="base.menu_association" sequence="30"/> |
862 | |
863 | - <menuitem name="Types of Events" id="menu_event_type" action="action_event_type" parent="base.menu_marketing_config_root" groups="base.group_extended"/> |
864 | - <menuitem name="Events Type" id="menu_event_type_association" action="action_event_type" parent="base.menu_marketing_config_association" groups="base.group_extended"/> |
865 | + <menuitem name="Types of Events" id="menu_event_type" action="action_event_type" parent="base.menu_marketing_config_root"/> |
866 | + <menuitem name="Events Type" id="menu_event_type_association" action="action_event_type" parent="base.menu_marketing_config_association"/> |
867 | |
868 | <!-- Events Organisation/CONFIGURATION/EVENTS --> |
869 | |
870 | @@ -57,32 +57,51 @@ |
871 | <field name="date_begin"/> |
872 | <field name="date_end"/> |
873 | <field name="type" widget="selection"/> |
874 | - <field name="language"/> |
875 | - <field name="parent_id"/> |
876 | + <field name="user_id"/> |
877 | + <field name="address_id" /> |
878 | </group> |
879 | <notebook colspan="4"> |
880 | <page string="Event"> |
881 | - <group colspan="4" col="4"> |
882 | - <separator string="Invoice Information" colspan="4"/> |
883 | - <field name="product_id" on_change="onchange_product(product_id)" colspan="4"/> |
884 | - <field name="unit_price"/> |
885 | - <field name="pricelist_id" widget="selection" domain="[('type','=','sale')]" groups="base.group_extended"/> |
886 | - </group> |
887 | - <group colspan="2" col="2"> |
888 | - <separator string="Contact" colspan="4"/> |
889 | - <field name="user_id"/> |
890 | - <field name="section_id" widget="selection" on_change="do_team_change(section_id)"/> |
891 | - <field name="company_id" groups="base.group_multi_company" widget="selection"/> |
892 | - </group> |
893 | - <group colspan="2" col="2"> |
894 | - <separator string="Location" colspan="4"/> |
895 | - <field name="country_id" /> |
896 | - <field name="address_id" domain="[('country_id','=',country_id)]"/> |
897 | - |
898 | - </group> |
899 | <separator string="Description" colspan="4"/> |
900 | <field name="note" colspan="4" nolabel="1"/> |
901 | - <field name="state" select="1"/> |
902 | + <field name="registration_ids" colspan="4" nolabel="1"> |
903 | + <tree string="Registration" editable="top"> |
904 | + <field name="name" /> |
905 | + <field name="email" /> |
906 | + <field name="phone"/> |
907 | + <field name="nb_register" /> |
908 | + <field name="state"/> |
909 | + <button name="button_reg_close" string="Close Registration" states="open" type="object" icon="gtk-close"/> |
910 | + <button name="case_open" string="Confirm Registration" states="draft" type="object" icon="gtk-apply"/> |
911 | + <button name="button_reg_cancel" string="Cancel Registration" states="draft,open" type="object" icon="gtk-cancel"/> |
912 | + </tree> |
913 | + <form string="Registration"> |
914 | + <field name="partner_id" attrs="{'readonly':[('state','!=', 'draft')]}" on_change="onchange_partner_id(partner_id, context)" /> |
915 | + <field name="name"/> |
916 | + <group colspan="4" col="4"> |
917 | + <field name="street"/> |
918 | + <field name="city"/> |
919 | + </group> |
920 | + <group colspan="4" col="4"> |
921 | + <field name="email"/> |
922 | + <field name="phone"/> |
923 | + </group> |
924 | + <group colspan="4" col="4"> |
925 | + <field name="nb_register"/> |
926 | + </group> |
927 | + <group colspan="4" col="4"> |
928 | + </group> |
929 | + <group col="8" colspan="4"> |
930 | + <separator string="" colspan="4"/> |
931 | + <newline/> |
932 | + <field name="state" select="1" colspan="2"/> |
933 | + <button name="button_reg_close" string="Close Registration" states="open" type="object" icon="gtk-close"/> |
934 | + <button name="case_open" string="Confirm Registration" states="draft" type="object" icon="gtk-apply"/> |
935 | + <button name="button_reg_cancel" string="Cancel Registration" states="draft,open" type="object" icon="gtk-cancel"/> |
936 | + </group> |
937 | + </form> |
938 | + </field> |
939 | + <field name="state" select="1" widget="statusbar" statusbar_visible="draft,confirm,done"/> |
940 | <group col="4" colspan="2"> |
941 | <button string="Cancel Event" name="button_cancel" states="draft,confirm" type="object" icon="gtk-cancel"/> |
942 | <button string="Confirm Event" name="button_confirm" states="draft" type="object" icon="gtk-apply"/> |
943 | @@ -90,72 +109,33 @@ |
944 | <button string="Set To Draft" name="button_draft" states="cancel" type="object" icon="gtk-convert"/> |
945 | </group> |
946 | </page> |
947 | - <page string="Speakers"> |
948 | + <page string="Speakers" groups="base.group_extended"> |
949 | <field name="main_speaker_id" domain="[('speaker','=',True)]"/> |
950 | <field name="speaker_confirmed"/> |
951 | <separator string="Other Speakers" colspan="4"/> |
952 | <field name="speaker_ids" domain="[('speaker','=',True)]" colspan="4" nolabel="1"/> |
953 | </page> |
954 | - <page string="Registrations"> |
955 | - <field name="register_min"/> |
956 | - <field name="register_max"/> |
957 | - <field name="register_current"/> |
958 | - <field name="register_prospect"/> |
959 | - <field name="registration_ids" colspan="4" nolabel="1" readonly="1"> |
960 | - <form string="Registration"> |
961 | - <field name="name"/> |
962 | - <field name="date" string="Date"/> |
963 | - <field name="partner_id" required="1" on_change="onchange_partner_id(partner_id,event_id)"/> |
964 | - <field name="partner_invoice_id" on_change="onchange_partner_invoice_id(event_id, partner_invoice_id)"/> |
965 | - <group colspan="4" col="4"> |
966 | - <field name="event_product"/> |
967 | - <field name="nb_register"/> |
968 | - <field name="unit_price"/> |
969 | - <field name="price_subtotal"/> |
970 | - </group> |
971 | - <group col="8" colspan="4"> |
972 | - <separator string="" colspan="4"/> |
973 | - <newline/> |
974 | - <field name="state" select="1" colspan="2"/> |
975 | - <button name="button_reg_close" string="Close Registration" states="open" type="object" icon="gtk-close"/> |
976 | - <button name="check_confirm" string="Confirm Registration" states="draft" type="object" icon="gtk-apply"/> |
977 | - <button name="button_reg_cancel" string="Cancel Registration" states="draft,open" type="object" icon="gtk-cancel"/> |
978 | - </group> |
979 | - </form> |
980 | - <tree string="Registration"> |
981 | - <field name="create_date" string="Registration Date"/> |
982 | - <field name="partner_id" required="1" string="Partner" on_change="onchange_partner_id(partner_id,event_id)"/> |
983 | - <field name="event_product"/> |
984 | - <field name="nb_register"/> |
985 | - <field name="unit_price"/> |
986 | - <field name="price_subtotal"/> |
987 | - <field name="state"/> |
988 | - <button name="button_reg_close" string="Close Registration" states="open" type="object" icon="gtk-close"/> |
989 | - <button name="check_confirm" string="Confirm Registration" states="draft" type="object" icon="gtk-apply"/> |
990 | - <button name="button_reg_cancel" string="Cancel Registration" states="draft,open" type="object" icon="gtk-cancel"/> |
991 | - </tree> |
992 | - </field> |
993 | - </page> |
994 | - <page string="Mailing"> |
995 | - <field name="reply_to" /> |
996 | - <newline/> |
997 | - <group col="4" colspan="4"> |
998 | - <group col="2" colspan="2"> |
999 | - <separator string="Auto Registration Email" colspan="4"/> |
1000 | - <field name="mail_auto_registr" colspan="4"/> |
1001 | - <group colspan="4" attrs="{'readonly':[('mail_auto_registr','=',False)]}"> |
1002 | - <separator string="Registration Email Body" colspan="4"/> |
1003 | - <field name="mail_registr" colspan="4" nolabel="1" /> |
1004 | - </group> |
1005 | - </group> |
1006 | - <group col="2" colspan="2"> |
1007 | - <separator string="Auto Confirmation Email" colspan="4"/> |
1008 | - <field name="mail_auto_confirm" colspan="4"/> |
1009 | - <group colspan="4" attrs="{'readonly':[('mail_auto_confirm','=',False)]}"> |
1010 | - <separator string="Confirmation Email Body" colspan="4"/> |
1011 | - <field name="mail_confirm" nolabel="1" colspan="4"/> |
1012 | - </group> |
1013 | - </group> |
1014 | + <page string="Extra Info"> |
1015 | + <group col="2" colspan="2"> |
1016 | + <separator string="Registrations" colspan="2"/> |
1017 | + <field name="register_min"/> |
1018 | + <field name="register_max"/> |
1019 | + <field name="register_current"/> |
1020 | + <field name="register_prospect"/> |
1021 | + </group> |
1022 | + <group col="2" colspan="2"> |
1023 | + <separator string="Emails" colspan="2"/> |
1024 | + <field name="reply_to"/> |
1025 | + <field name="email_registration_id" domain="[('model_id','=','Event Registration')]"/> |
1026 | + <field name="email_confirmation_id"/> |
1027 | + </group> |
1028 | + <group col="2" colspan="2" groups="base.group_extended"> |
1029 | + <separator string="Misc" colspan="2"/> |
1030 | + <field name="product_id"/> |
1031 | + </group> |
1032 | + <group col="2" colspan="2"> |
1033 | + <separator string="Sales Team" colspan="2"/> |
1034 | + <field name="section_id" on_change="do_team_change(self, cr, uid, ids, team_id)"/> |
1035 | </group> |
1036 | </page> |
1037 | </notebook> |
1038 | @@ -172,14 +152,13 @@ |
1039 | <field name="arch" type="xml"> |
1040 | <tree string="Events" colors="red:register_min>register_current;black:register_min<=register_current"> |
1041 | <field name="name" string="Name"/> |
1042 | - <field name="main_speaker_id"/> |
1043 | - <field name="language"/> |
1044 | <field name="type"/> |
1045 | <field name="date_begin"/> |
1046 | <field name="date_end"/> |
1047 | + <field name="register_current"/> |
1048 | <field name="register_min"/> |
1049 | - <field name="register_current"/> |
1050 | <field name="section_id" invisible="context.get('invisible_section', True)"/> |
1051 | + <field name="main_speaker_id" groups="base.extended"/> |
1052 | <field name="user_id"/> |
1053 | <field name="state"/> |
1054 | <button string="Confirm Event" help="Confirm Event" name="button_confirm" states="draft" type="object" icon="gtk-apply"/> |
1055 | @@ -262,8 +241,8 @@ |
1056 | </field> |
1057 | </record> |
1058 | |
1059 | - <!-- Events Organisation/CONFIGURATION/EVENTS --> |
1060 | |
1061 | + <!-- Events Organisation/CONFIGURATION/EVENTS --> |
1062 | <record model="ir.actions.act_window" id="action_event_view"> |
1063 | <field name="name">Events</field> |
1064 | <field name="type">ir.actions.act_window</field> |
1065 | @@ -296,23 +275,23 @@ |
1066 | <menuitem name="Events" id="menu_event_event" action="action_event_view" parent="base.menu_event_main" /> |
1067 | <menuitem name="Events" id="menu_event_event_assiciation" action="action_event_view" parent="base.menu_event_association" /> |
1068 | |
1069 | - <!-- EVENTS/REGISTRATIONS/EVENTS --> |
1070 | - |
1071 | - |
1072 | + |
1073 | + <!-- EVENTS/REGISTRATIONS/EVENTS --> |
1074 | <record model="ir.ui.view" id="view_event_registration_tree"> |
1075 | <field name="name">event.registration.tree</field> |
1076 | <field name="model">event.registration</field> |
1077 | <field name="type">tree</field> |
1078 | <field name="arch" type="xml"> |
1079 | - <tree string="Registration"> |
1080 | - <field name="partner_id"/> |
1081 | + <tree string="Registration" > |
1082 | + <field name="name"/> |
1083 | + <field name="email"/> |
1084 | + <field name="phone"/> |
1085 | <field name="event_id"/> |
1086 | - <field name="nb_register"/> |
1087 | - <field name="price_subtotal" sum="Total"/> |
1088 | + <field name="nb_register" invisible="1"/> |
1089 | <field name="user_id"/> |
1090 | <field name="state"/> |
1091 | - <button name="button_reg_close" string="Close Registration" states="open" type="object" icon="gtk-close"/> |
1092 | - <button name="check_confirm" string="Confirm Registration" states="draft" type="object" icon="gtk-apply"/> |
1093 | + <button name="case_close" string="Close Registration" states="open" type="object" icon="gtk-close"/> |
1094 | + <button name="case_open" string="Confirm Registration" states="draft" type="object" icon="gtk-apply"/> |
1095 | <button name="button_reg_cancel" string="Cancel Registration" states="draft,open" type="object" icon="gtk-cancel"/> |
1096 | </tree> |
1097 | </field> |
1098 | @@ -325,69 +304,39 @@ |
1099 | <field name="arch" type="xml"> |
1100 | <form string="Registration"> |
1101 | <group col="6" colspan="4"> |
1102 | - <field name="event_id" on_change="onchange_event(event_id, partner_invoice_id)" domain="[('state','in',('draft','confirm'))]"/> |
1103 | - <field name="create_date" string="Registration Date"/> |
1104 | - <field name="name"/> |
1105 | - <field name="partner_id" attrs="{'readonly':[('state','!=', 'draft')]}" required="1" on_change="onchange_partner_id(partner_id,event_id)" /> |
1106 | - <field name="user_id" attrs="{'readonly':[('state','!=', 'draft')]}" /> |
1107 | - <field name="tobe_invoiced"/> |
1108 | + <field name="event_id" on_change="onchange_event(event_id, context)" domain="[('state','in',('draft','confirm'))]"/> |
1109 | + <field name="nb_register"/> |
1110 | + <field name="origin"/> |
1111 | + <field name="name" colspan="4"/> |
1112 | + <field name="user_id" attrs="{'readonly':[('state','!=', 'draft')]}"/> |
1113 | </group> |
1114 | <notebook colspan="4"> |
1115 | - <page string="Registration"> |
1116 | - <field name="date" /> |
1117 | - <field name="date_deadline" /> |
1118 | + <page string="Additional Information"> |
1119 | <group colspan="2" col="2"> |
1120 | - <separator string="Registration Cost" colspan="4"/> |
1121 | - <field name="nb_register"/> |
1122 | - <field name="unit_price"/> |
1123 | - <field name="price_subtotal"/> |
1124 | - </group> |
1125 | - <group colspan="2" col="2" attrs="{'invisible':[('tobe_invoiced','=',False)]}"> |
1126 | - <separator string="Invoice" colspan="4"/> |
1127 | - <field name="event_product" attrs="{'required':[('tobe_invoiced','=',True)]}"/> |
1128 | - <field name="partner_invoice_id" attrs="{'required':[('tobe_invoiced','=',True)]}" on_change="onchange_partner_invoice_id(event_id, partner_invoice_id)"/> |
1129 | - <field name="invoice_id"/> |
1130 | - </group> |
1131 | - <separator string="Description" colspan="4"/> |
1132 | - <field name="description" colspan="4" nolabel="1"/> |
1133 | + <separator string="Contact Information" colspan="2"/> |
1134 | + <field name="partner_id" attrs="{'readonly':[('state','!=', 'draft')]}" on_change="onchange_partner_id(partner_id, context)" groups="base.group_extended"/> |
1135 | + <field name="contact_id" attrs="{'readonly':[('state','!=', 'draft')]}" on_change="onchange_contact_id(contact_id, context)" groups="base.group_extended"/> |
1136 | + <field name="email"/> |
1137 | + <field name="phone"/> |
1138 | + <field name="street"/> |
1139 | + <field name="city"/> |
1140 | + </group> |
1141 | + <group colspan="2" col="2" groups="base.group_extended"> |
1142 | + <separator string="Dates" colspan="2"/> |
1143 | + <field name="date_closed"/> |
1144 | + <field name="date" /> |
1145 | + <field name="date_deadline" /> |
1146 | + </group> |
1147 | + |
1148 | <separator string="" colspan="4"/> |
1149 | <group col="8" colspan="4"> |
1150 | - <field name="state" select="1" colspan="2"/> |
1151 | + <field name="state" select="1" colspan="2" widget="statusbar" statusbar_visible="draft,open,done"/> |
1152 | <button name="button_reg_cancel" string="Cancel Registration" states="draft,open" type="object" icon="gtk-cancel"/> |
1153 | <button name="button_reg_close" string="Close Registration" states="open" type="object" icon="gtk-close"/> |
1154 | - <button name="check_confirm" string="Confirm Registration" states="draft" type="object" icon="gtk-apply"/> |
1155 | - </group> |
1156 | - </page> |
1157 | - <page string="Extra Info"> |
1158 | - <separator string="Contact" colspan="4"/> |
1159 | - <field name="contact_id" on_change="onchange_contact_id(contact_id, partner_id)" /> |
1160 | - <field name="email_from"/> |
1161 | - <field name="badge_ids" colspan="4" nolabel="1"> |
1162 | - <tree string="Badges" editable="bottom"> |
1163 | - <field name="name"/> |
1164 | - <field name="title"/> |
1165 | - <field name="address_id"/> |
1166 | - </tree> |
1167 | - <form string="Badges"> |
1168 | - <field name="name"/> |
1169 | - <field name="title"/> |
1170 | - <field name="address_id"/> |
1171 | - </form> |
1172 | - </field> |
1173 | - <group col="2" colspan="2" groups="base.group_extended"> |
1174 | - <separator string="Dates" colspan="2"/> |
1175 | - <field name="date_closed"/> |
1176 | - </group> |
1177 | - <group col="2" colspan="2" groups="base.group_extended"> |
1178 | - <separator string="Misc" colspan="2"/> |
1179 | - <field name="id"/> |
1180 | - <field name="active"/> |
1181 | + <button name="case_open" string="Confirm Registration" states="draft" type="object" icon="gtk-apply"/> |
1182 | </group> |
1183 | </page> |
1184 | <page string="Emails" groups="base.group_extended"> |
1185 | - <group colspan="4"> |
1186 | - <field colspan="4" name="email_cc" string="CC" widget="char" size="512"/> |
1187 | - </group> |
1188 | <field name="message_ids" colspan="4" nolabel="1" mode="tree"> |
1189 | <tree string="History"> |
1190 | <field name="display_text" string="History Information"/> |
1191 | @@ -407,13 +356,13 @@ |
1192 | name="%(mail.action_email_compose_message_wizard)d" |
1193 | icon="terp-mail-message-new" type="action"/> |
1194 | </page> |
1195 | + |
1196 | </notebook> |
1197 | </form> |
1198 | </field> |
1199 | </record> |
1200 | |
1201 | - <!-- Calendar view of event registration --> |
1202 | - |
1203 | + <!-- Calendar view of event registration --> |
1204 | <record id="view_event_registration_calendar" model="ir.ui.view"> |
1205 | <field name="name">event.registration.calendar</field> |
1206 | <field name="model">event.registration</field> |
1207 | @@ -422,7 +371,7 @@ |
1208 | <field name="arch" type="xml"> |
1209 | <calendar color="event_id" date_start="date" date_stop="date_closed" string="Event Registration"> |
1210 | <field name="event_id"/> |
1211 | - <field name="partner_invoice_id"/> |
1212 | + <field name="name"/> |
1213 | </calendar> |
1214 | </field> |
1215 | </record> |
1216 | @@ -434,14 +383,13 @@ |
1217 | <field name="arch" type="xml"> |
1218 | <graph string="Registration" type="bar" orientation="horizontal"> |
1219 | <field name="event_id"/> |
1220 | - <field name = "nb_register" operator="+"/> |
1221 | + <field name= "nb_register" operator="+"/> |
1222 | </graph> |
1223 | </field> |
1224 | </record> |
1225 | |
1226 | |
1227 | -<!-- Search view of event registration form--> |
1228 | - |
1229 | + <!-- Search view of event registration --> |
1230 | <record model="ir.ui.view" id="view_registration_search"> |
1231 | <field name="name">Registrations</field> |
1232 | <field name="model">event.registration</field> |
1233 | @@ -452,24 +400,25 @@ |
1234 | <filter icon="terp-check" string="New" name="draft" domain="[('state','=','draft')]" help="Registrations in unconfirmed state"/> |
1235 | <filter icon="terp-camera_test" string="Confirmed" domain="[('state','=','open')]" help="Confirmed registrations"/> |
1236 | <separator orientation="vertical"/> |
1237 | - <field name="partner_id" /> |
1238 | <field name="event_id" widget="selection"/> |
1239 | + <field name="partner_id" groups="base.group_extended"/> |
1240 | <field name="user_id" widget="selection"> |
1241 | <filter icon="terp-personal" |
1242 | string="My Registrations" |
1243 | help="My Registrations" |
1244 | domain="[('user_id','=',uid)]"/> |
1245 | </field> |
1246 | - <field name="state"/> |
1247 | + <field name="origin"/> |
1248 | </group> |
1249 | <newline/> |
1250 | <group expand="0" string="Group By..."> |
1251 | <filter string="Responsible" icon="terp-personal" domain="[]" context="{'group_by':'user_id'}"/> |
1252 | - <filter string="Partner" icon="terp-partner" domain="[]" context="{'group_by':'partner_id'}"/> |
1253 | + <filter string="Partner" icon="terp-partner" domain="[]" context="{'group_by':'partner_id'}" groups="base.group_extended"/> |
1254 | <separator orientation="vertical"/> |
1255 | <filter string="Event" icon="terp-crm" domain="[]" context="{'group_by':'event_id'}"/> |
1256 | <filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/> |
1257 | </group> |
1258 | + |
1259 | </search> |
1260 | </field> |
1261 | </record> |
1262 | |
1263 | === modified file 'event/report/report_event_registration.py' |
1264 | --- event/report/report_event_registration.py 2011-12-19 16:54:40 +0000 |
1265 | +++ event/report/report_event_registration.py 2012-02-02 16:05:26 +0000 |
1266 | @@ -29,7 +29,7 @@ |
1267 | _auto = False |
1268 | _rec_name = 'date' |
1269 | _columns = { |
1270 | - 'date': fields.date('Event Start Date', readonly=True), |
1271 | + 'event_date': fields.date('Event Start Date', readonly=True), |
1272 | 'year': fields.char('Year', size=4, readonly=True), |
1273 | 'month': fields.selection([('01','January'), ('02','February'), ('03','March'), ('04','April'), |
1274 | ('05','May'), ('06','June'), ('07','July'), ('08','August'), ('09','September'), |
1275 | @@ -39,16 +39,18 @@ |
1276 | 'confirm_state': fields.integer(' # No of Confirmed Registrations', size=20), |
1277 | 'register_max': fields.integer('Maximum Registrations'), |
1278 | 'nbevent': fields.integer('Number Of Events'), |
1279 | - 'type': fields.many2one('event.type', 'Event Type'), |
1280 | - 'state': fields.selection([('draft', 'Draft'), ('confirm', 'Confirmed'), ('done', 'Done'), ('cancel', 'Cancelled')], 'State', readonly=True, required=True), |
1281 | + 'event_type': fields.many2one('event.type', 'Event Type'), |
1282 | + 'registration_state': fields.selection([('draft', 'Draft'), ('confirm', 'Confirmed'), ('done', 'Done'), ('cancel', 'Cancelled')], 'State', readonly=True, required=True), |
1283 | + 'event_state': fields.selection([('draft', 'Draft'), ('confirm', 'Confirmed'), ('done', 'Done'), ('cancel', 'Cancelled')], 'State', readonly=True, required=True), |
1284 | 'user_id': fields.many2one('res.users', 'Responsible', readonly=True), |
1285 | + 'user_id_registration': fields.many2one('res.users', 'Register', readonly=True), |
1286 | + 'name_registration': fields.char('Register',size=45, readonly=True), |
1287 | 'speaker_id': fields.many2one('res.partner', 'Speaker', readonly=True), |
1288 | 'company_id': fields.many2one('res.company', 'Company', readonly=True), |
1289 | - 'product_id': fields.many2one('product.product', 'Product', readonly=True), |
1290 | 'total': fields.float('Total'), |
1291 | 'section_id': fields.related('event_id', 'section_id', type='many2one', relation='crm.case.section', string='Sale Team', store=True, readonly=True), |
1292 | } |
1293 | - _order = 'date desc' |
1294 | + _order = 'event_date desc' |
1295 | def init(self, cr): |
1296 | """ |
1297 | initialize the sql view for the event registration |
1298 | @@ -58,75 +60,54 @@ |
1299 | cr.execute(""" |
1300 | CREATE OR REPLACE view report_event_registration AS ( |
1301 | SELECT |
1302 | - id, |
1303 | event_id, |
1304 | - date, |
1305 | - user_id, |
1306 | - section_id, |
1307 | - company_id, |
1308 | - product_id, |
1309 | - speaker_id, |
1310 | - year, |
1311 | - month, |
1312 | - nbevent, |
1313 | - type, |
1314 | - SUM(draft_state) AS draft_state, |
1315 | - SUM(confirm_state) AS confirm_state, |
1316 | - SUM(total) AS total, |
1317 | - register_max, |
1318 | - state |
1319 | - FROM( |
1320 | - SELECT |
1321 | - MIN(e.id) AS id, |
1322 | - e.id AS event_id, |
1323 | - e.date_begin AS date, |
1324 | + r.id, |
1325 | + e.date_begin AS event_date, |
1326 | e.user_id AS user_id, |
1327 | + r.user_id AS user_id_registration, |
1328 | + r.name AS name_registration, |
1329 | e.section_id AS section_id, |
1330 | e.company_id AS company_id, |
1331 | - e.product_id AS product_id, |
1332 | e.main_speaker_id AS speaker_id, |
1333 | to_char(e.date_begin, 'YYYY') AS year, |
1334 | to_char(e.date_begin, 'MM') AS month, |
1335 | count(e.id) AS nbevent, |
1336 | - t.id AS type, |
1337 | - CASE WHEN c.state IN ('draft') THEN c.nb_register ELSE 0 END AS draft_state, |
1338 | - CASE WHEN c.state IN ('open','done') THEN c.nb_register ELSE 0 END AS confirm_state, |
1339 | - CASE WHEN c.state IN ('done') THEN c.price_subtotal ELSE 0 END AS total, |
1340 | + CASE WHEN r.state IN ('draft') THEN r.nb_register ELSE 0 END AS draft_state, |
1341 | + CASE WHEN r.state IN ('open','done') THEN r.nb_register ELSE 0 END AS confirm_state, |
1342 | + e.type AS event_type, |
1343 | e.register_max AS register_max, |
1344 | - e.state AS state |
1345 | + e.state AS event_state, |
1346 | + r.state AS registration_state |
1347 | FROM |
1348 | event_event e |
1349 | - LEFT JOIN |
1350 | - event_registration c ON (e.id=c.event_id) |
1351 | - LEFT JOIN |
1352 | - event_type t ON (e.type=t.id) |
1353 | - WHERE c.active = 'true' |
1354 | + |
1355 | + LEFT JOIN |
1356 | + event_registration r ON (e.id=r.event_id) |
1357 | + |
1358 | + WHERE r.active = 'true' |
1359 | + |
1360 | GROUP BY |
1361 | - to_char(e.date_begin, 'YYYY'), |
1362 | - to_char(e.date_begin, 'MM'), |
1363 | - c.state, |
1364 | - c.nb_register, |
1365 | - t.id, e.id, e.date_begin, e.main_speaker_id, |
1366 | - e.register_max, e.type, e.state, c.event_id, e.user_id,e.company_id,e.product_id,e.section_id, |
1367 | - to_char(e.date_begin, 'YYYY-MM-DD'), c.id, c.price_subtotal )AS foo |
1368 | - GROUP BY |
1369 | - id, |
1370 | event_id, |
1371 | - date, |
1372 | - user_id, |
1373 | - section_id, |
1374 | - company_id, |
1375 | - product_id, |
1376 | - speaker_id, |
1377 | + user_id_registration, |
1378 | + e.id, |
1379 | + r.id, |
1380 | + registration_state, |
1381 | + r.nb_register, |
1382 | + event_type, e.id, e.date_begin, e.main_speaker_id, |
1383 | + e.register_max,event_id, e.user_id,e.company_id,e.section_id, |
1384 | + e.user_id, |
1385 | + e.section_id, |
1386 | + event_state, |
1387 | + e.company_id, |
1388 | + e.main_speaker_id, |
1389 | year, |
1390 | month, |
1391 | - nbevent, |
1392 | - type, |
1393 | - register_max, |
1394 | - state |
1395 | + e.register_max, |
1396 | + name_registration |
1397 | + |
1398 | ) |
1399 | """) |
1400 | |
1401 | report_event_registration() |
1402 | |
1403 | -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
1404 | \ No newline at end of file |
1405 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
1406 | |
1407 | === modified file 'event/report/report_event_registration_view.xml' |
1408 | --- event/report/report_event_registration_view.xml 2011-11-16 19:01:24 +0000 |
1409 | +++ event/report/report_event_registration_view.xml 2012-02-02 16:05:26 +0000 |
1410 | @@ -8,21 +8,23 @@ |
1411 | <field name="model">report.event.registration</field> |
1412 | <field name="type">tree</field> |
1413 | <field name="arch" type="xml"> |
1414 | - <tree colors="blue:state == 'draft';black:state == 'confirm';gray:state in('done','cancel')" string="Events Analysis"> |
1415 | - <field name="date" invisible="1"/> |
1416 | + <tree colors="blue:event_state == 'draft';black:event_state == 'confirm';gray:event_state in('done','cancel')" string="Events Analysis"> |
1417 | + <field name="event_date" invisible="1"/> |
1418 | <field name="user_id" invisible="1"/> |
1419 | <field name="speaker_id" invisible="1"/> |
1420 | <field name="year" invisible="1"/> |
1421 | <field name="month" invisible="1"/> |
1422 | <field name="event_id" invisible="1"/> |
1423 | - <field name="state" invisible="1"/> |
1424 | - <field name="type" invisible="1"/> |
1425 | + <field name="event_state" invisible="1"/> |
1426 | + <field name="event_type" invisible="1"/> |
1427 | <field name="nbevent"/> |
1428 | <field name="draft_state" invisible="context.get('no_of_draft_invisible', False)"/> |
1429 | <field name="confirm_state"/> |
1430 | + <field name="registration_state" invisible="1"/> |
1431 | + <field name="name_registration" invisible="1"/> |
1432 | + <field name="user_id_registration" invisible="1"/> |
1433 | <field name="register_max" invisible="context.get('max_reg_event_visible', True)"/> |
1434 | <field name="company_id" invisible="1"/> |
1435 | - <field name="product_id" invisible="1"/> |
1436 | <field name="section_id" invisible="1"/> |
1437 | <field name="total" invisible="context.get('total_invisible', True)" sum="Total"/> |
1438 | </tree> |
1439 | @@ -54,33 +56,30 @@ |
1440 | <search string="Event on Registration"> |
1441 | <group> |
1442 | <filter string="Year" icon="terp-go-year" name="year" |
1443 | - domain="[('date','<=', time.strftime('%%Y-%%m-%%d')),('date','>=',time.strftime('%%Y-01-01'))]" |
1444 | + domain="[('event_date','<=', time.strftime('%%Y-%%m-%%d')),('event_date','>=',time.strftime('%%Y-01-01'))]" |
1445 | help="Events created in current year"/> |
1446 | <separator orientation="vertical"/> |
1447 | <filter string="Month" icon="terp-go-month" name="this_month" |
1448 | - domain="[('date','<=',(datetime.date.today()+relativedelta(day=31)).strftime('%%Y-%%m-%%d')),('date','>=',(datetime.date.today()-relativedelta(day=1)).strftime('%%Y-%%m-%%d'))]" |
1449 | + domain="[('event_date','<=',(datetime.date.today()+relativedelta(day=31)).strftime('%%Y-%%m-%%d')),('event_date','>=',(datetime.date.today()-relativedelta(day=1)).strftime('%%Y-%%m-%%d'))]" |
1450 | help="Events created in current month"/> |
1451 | <filter icon="terp-go-month" string=" Month-1 " |
1452 | - domain="[('date','<=', (datetime.date.today() - relativedelta(day=31, months=1)).strftime('%%Y-%%m-%%d')),('date','>=',(datetime.date.today() - relativedelta(day=1,months=1)).strftime('%%Y-%%m-%%d'))]" |
1453 | + domain="[('event_date','<=', (datetime.date.today() - relativedelta(day=31, months=1)).strftime('%%Y-%%m-%%d')),('event_date','>=',(datetime.date.today() - relativedelta(day=1,months=1)).strftime('%%Y-%%m-%%d'))]" |
1454 | help="Events created in last month"/> |
1455 | <separator orientation="vertical"/> |
1456 | <filter icon="terp-document-new" |
1457 | string="New" |
1458 | - domain="[('state','=','draft')]" |
1459 | + domain="[('event_state','=','draft')]" |
1460 | help="Events which are in New state"/> |
1461 | <filter icon="terp-check" |
1462 | string="Confirm" |
1463 | - domain="[('state','=','confirm')]" |
1464 | + domain="[('event_state','=','confirm')]" |
1465 | help="Events which are in confirm state"/> |
1466 | <separator orientation="vertical"/> |
1467 | <filter icon="terp-camera_test" |
1468 | string="Confirmed Registrations" |
1469 | help="Registrations in confirmed or done state" |
1470 | context="{'no_of_draft_invisible':1}"/> |
1471 | - <filter string="Invoiced" |
1472 | - name="invoiced" |
1473 | - icon="terp-dolar" |
1474 | - help = "Invoiced Registrations only" context="{'total_invisible':0, 'no_of_draft_invisible':1}"/> |
1475 | + |
1476 | <separator orientation="vertical"/> |
1477 | <field name="event_id" string="Event"/> |
1478 | <field name="user_id" widget="selection"> |
1479 | @@ -92,31 +91,39 @@ |
1480 | </group> |
1481 | <newline/> |
1482 | <group expand="0" string="Extended Filters..." groups="base.group_extended"> |
1483 | - <field name="type" widget="selection"/> |
1484 | - <field name="date"/> |
1485 | + <field name="event_type" widget="selection"/> |
1486 | + <field name="event_date"/> |
1487 | </group> |
1488 | <newline/> |
1489 | |
1490 | <group expand="1" string="Group By..."> |
1491 | <filter string="Responsible" name="user_id" icon="terp-personal" context="{'group_by': 'user_id'}"/> |
1492 | <filter string="Speaker" name="speaker" icon="terp-personal+" context="{'group_by': 'speaker_id'}"/> |
1493 | + <filter string="Participant" icon="terp-personal" context="{'group_by':'name_registration'}" help="Registration contact"/> |
1494 | <filter string="Sale Team" icon="terp-personal" context="{'group_by': 'section_id'}"/> |
1495 | <separator orientation="vertical"/> |
1496 | <filter string="Event" name="event" icon="terp-crm" context="{'group_by':'event_id', 'max_reg_event_visible':0}"/> |
1497 | - <filter string="Product" icon="terp-accessories-archiver" context="{'group_by': 'product_id'}"/> |
1498 | + |
1499 | <separator orientation="vertical"/> |
1500 | - <filter string="Event Type" icon="terp-crm" context="{'group_by':'type'}"/> |
1501 | - <filter string="State" icon="terp-stock_effects-object-colorize" context="{'group_by':'state'}" help="Events States"/> |
1502 | + <filter string="Event Type" icon="terp-crm" context="{'group_by':'event_type'}"/> |
1503 | + <filter string="event_state" icon="terp-stock_effects-object-colorize" context="{'group_by':'event_state'}" help="Events States"/> |
1504 | <separator orientation="vertical" groups="base.group_multi_company"/> |
1505 | <filter string="Company" icon="terp-go-home" domain="[]" context="{'group_by':'company_id'}" groups="base.group_multi_company"/> |
1506 | <separator orientation="vertical" /> |
1507 | <filter string="Date" icon="terp-go-month" |
1508 | - domain="[]" context="{'group_by':'date'}" help="Event Beginning Date"/> |
1509 | + domain="[]" context="{'group_by':'event_date'}" help="Event Beginning Date"/> |
1510 | <filter string="Month" icon="terp-go-month" |
1511 | domain="[]" context="{'group_by':'month'}" help="Event Beginning Date"/> |
1512 | <filter string="Year" icon="terp-go-year" |
1513 | domain="[]" context="{'group_by':'year'}" help="Event Beginning Date"/> |
1514 | + <filter string="State" icon="terp-stock_effects-object-colorize" context="{'group_by':'registration_state'}" help="Events States"/> |
1515 | + <filter string="name of the register" icon="terp-personal" context="{'group_by':'user_id_registration'}" help="Registration contact"/> |
1516 | + |
1517 | </group> |
1518 | + |
1519 | + |
1520 | + |
1521 | + |
1522 | </search> |
1523 | </field> |
1524 | </record> |
1525 | |
1526 | === modified file 'event/security/ir.model.access.csv' |
1527 | --- event/security/ir.model.access.csv 2011-12-19 16:54:40 +0000 |
1528 | +++ event/security/ir.model.access.csv 2012-02-02 16:05:26 +0000 |
1529 | @@ -8,8 +8,5 @@ |
1530 | access_event_registration_manager,event.registration manager,model_event_registration,marketing.group_marketing_manager,1,0,0,0 |
1531 | access_crm_case_section_manager,crm.case.section manager,crm.model_crm_case_section,marketing.group_marketing_manager,1,1,1,1 |
1532 | access_product_product,product.product.product manager,product.model_product_product,marketing.group_marketing_manager,1,1,1,1 |
1533 | -access_event_registration_badge_manager,event.registration.badge manager,model_event_registration_badge,marketing.group_marketing_manager,1,1,1,1 |
1534 | access_event_event_sale_salesman,event.event.sale,model_event_event,base.group_sale_salesman,1,0,0,0 |
1535 | -access_account_account_invoice_manager,account.account.invoice,account.model_account_invoice,marketing.group_marketing_manager,1,0,0,0 |
1536 | -access_event_registration_badge,event.registration.badge,model_event_registration_badge,marketing.group_marketing_user,1,0,0,0 |
1537 | access_event_registration_sale_user,event.registration.sale.user,model_event_registration,base.group_sale_salesman,1,0,0,0 |
1538 | |
1539 | === modified file 'event/test/process/partner_register2invoice.yml' |
1540 | --- event/test/process/partner_register2invoice.yml 2011-11-15 09:18:56 +0000 |
1541 | +++ event/test/process/partner_register2invoice.yml 2012-02-02 16:05:26 +0000 |
1542 | @@ -22,41 +22,11 @@ |
1543 | - |
1544 | !assert {model: event.registration, id: reg_1_1}: |
1545 | - state == 'open', "Registration should be open here." |
1546 | -- |
1547 | - After confirmation of partner, I create invoice base on costing of event. |
1548 | -- |
1549 | - !python {model: event.registration}: | |
1550 | - self.action_invoice_create(cr, uid, [ref("reg_1_1")]) |
1551 | -- |
1552 | - Now I Check for Invoice is created and Registration should be closed after invoice generated. |
1553 | -- |
1554 | - !python {model: event.registration}: | |
1555 | - record = self.browse(cr, uid, [ref("reg_1_1")])[0] |
1556 | - assert record.invoice_id, "Invoice should be generated" |
1557 | - assert record.invoice_id.state == "draft", "Invoice state should be draft" |
1558 | - assert record.invoice_id.partner_id == record.partner_id, "Customer is not correspond with registration" |
1559 | - assert record.invoice_id.type == 'out_invoice', "Invoice type is not correct" |
1560 | - assert record.invoice_id.origin == record.event_product, "Invoice origin is not correct" |
1561 | - assert record.invoice_id.amount_total == record.price_subtotal, "Invoice amount is not correct" |
1562 | - assert record.state == "done", "Registration should be closed after invoice generated" |
1563 | -- |
1564 | - Now I check for same partner registration for two diffrent event and I create group invoices for same partner. |
1565 | -- |
1566 | - !python {model: event.make.invoice}: | |
1567 | - context.update({'active_model': 'event.make.invoice', 'active_ids': [ref("reg_0_1"), ref("reg_0_2")], 'active_id': ref("reg_0_1")}) |
1568 | - invoice = self.create(cr, uid, {'grouped': True}, context=context) |
1569 | - self.make_invoice(cr, uid, [invoice], context=context) |
1570 | -- |
1571 | - Now I Check for group Invoice is created with total amount of both registration |
1572 | - and Registration should be closed after invoice generated. |
1573 | -- |
1574 | - !python {model: event.registration}: | |
1575 | - reg_data_1 = self.browse(cr, uid, [ref("reg_0_1")])[0] |
1576 | - reg_data_2 = self.browse(cr, uid, [ref("reg_0_2")])[0] |
1577 | - assert reg_data_1.invoice_id, "Invoice should be generated" |
1578 | - assert reg_data_1.invoice_id.state == "draft", "Invoice state should be draft" |
1579 | - assert reg_data_1.invoice_id.partner_id == reg_data_1.partner_id, "Customer is not correspond with registration" |
1580 | - assert reg_data_1.invoice_id.type == 'out_invoice', "Invoice type is not correct" |
1581 | - assert reg_data_1.invoice_id.origin == reg_data_1.event_product, "Invoice origin is not correct" |
1582 | - assert reg_data_1.invoice_id.amount_total == (reg_data_1.price_subtotal + reg_data_2.price_subtotal), "Invoice total amount is not correct" |
1583 | - assert reg_data_1.state == "done", "Registration should be closed after invoice generated" |
1584 | + |
1585 | +- |
1586 | + I Check that Registration is close. |
1587 | +- |
1588 | + !assert {model: event.registration, id: reg_1_1}: |
1589 | + - state == 'done', "Registration should be done here." |
1590 | + |
1591 | + |
1592 | |
1593 | === modified file 'event/wizard/__init__.py' |
1594 | --- event/wizard/__init__.py 2011-09-07 17:25:00 +0000 |
1595 | +++ event/wizard/__init__.py 2012-02-02 16:05:26 +0000 |
1596 | @@ -19,7 +19,7 @@ |
1597 | # |
1598 | ############################################################################## |
1599 | |
1600 | -import event_make_invoice |
1601 | + |
1602 | import event_confirm_registration |
1603 | import event_confirm |
1604 | import partner_event_registration |
1605 | |
1606 | === modified file 'event/wizard/event_confirm_registration.py' |
1607 | --- event/wizard/event_confirm_registration.py 2011-01-14 00:11:01 +0000 |
1608 | +++ event/wizard/event_confirm_registration.py 2012-02-02 16:05:26 +0000 |
1609 | @@ -36,35 +36,11 @@ |
1610 | 'msg': 'The event limit is reached. What do you want to do?' |
1611 | } |
1612 | |
1613 | - def default_get(self, cr, uid, fields, context=None): |
1614 | - """ |
1615 | - This function gets default values |
1616 | - """ |
1617 | - if context is None: |
1618 | - context = {} |
1619 | - registration_pool = self.pool.get('event.registration') |
1620 | - registration_ids = context.get('registration_ids', []) |
1621 | - res = super(event_confirm_registration, self).default_get(cr, uid, fields, context=context) |
1622 | - msg = "" |
1623 | - overlimit_event_ids = [] |
1624 | - for registration in registration_pool.browse(cr, uid, registration_ids, context=context): |
1625 | - register_max = registration.event_id.register_max |
1626 | - if registration.event_id.id not in overlimit_event_ids: |
1627 | - overlimit_event_ids.append(registration.event_id.id) |
1628 | - msg += _("Warning: The Event '%s' has reached its Maximum Limit (%s).") \ |
1629 | - %(registration.event_id.name, register_max) |
1630 | - if 'msg' in fields: |
1631 | - res.update({'msg': msg}) |
1632 | - return res |
1633 | + |
1634 | |
1635 | def confirm(self, cr, uid, ids, context=None): |
1636 | - if context is None: |
1637 | - context = {} |
1638 | - registration_pool = self.pool.get('event.registration') |
1639 | - registration_ids = context.get('registration_ids', []) |
1640 | - registration_pool.do_open(cr, uid, registration_ids, context=context) |
1641 | return {'type': 'ir.actions.act_window_close'} |
1642 | |
1643 | event_confirm_registration() |
1644 | |
1645 | -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
1646 | \ No newline at end of file |
1647 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
1648 | |
1649 | === removed file 'event/wizard/event_make_invoice.py' |
1650 | --- event/wizard/event_make_invoice.py 2011-01-14 00:11:01 +0000 |
1651 | +++ event/wizard/event_make_invoice.py 1970-01-01 00:00:00 +0000 |
1652 | @@ -1,95 +0,0 @@ |
1653 | -# -*- coding: utf-8 -*- |
1654 | -############################################################################## |
1655 | -# |
1656 | -# OpenERP, Open Source Management Solution |
1657 | -# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). |
1658 | -# |
1659 | -# This program is free software: you can redistribute it and/or modify |
1660 | -# it under the terms of the GNU Affero General Public License as |
1661 | -# published by the Free Software Foundation, either version 3 of the |
1662 | -# License, or (at your option) any later version. |
1663 | -# |
1664 | -# This program is distributed in the hope that it will be useful, |
1665 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
1666 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1667 | -# GNU Affero General Public License for more details. |
1668 | -# |
1669 | -# You should have received a copy of the GNU Affero General Public License |
1670 | -# along with this program. If not, see <http://www.gnu.org/licenses/>. |
1671 | -# |
1672 | -############################################################################## |
1673 | - |
1674 | -from osv import fields, osv |
1675 | -from tools.translate import _ |
1676 | - |
1677 | -class event_make_invoice(osv.osv_memory): |
1678 | - """ |
1679 | - Make Invoices |
1680 | - """ |
1681 | - _name = "event.make.invoice" |
1682 | - _description = "Event Make Invoice" |
1683 | - _columns = { |
1684 | - 'grouped': fields.boolean('Group the invoices'), |
1685 | - 'invoice_date': fields.date('Invoice Date'), |
1686 | - } |
1687 | - |
1688 | - def view_init(self, cr, uid, fields, context=None): |
1689 | - """ |
1690 | - This function checks for precondition before wizard executes |
1691 | - @param self: The object pointer |
1692 | - @param cr: the current row, from the database cursor, |
1693 | - @param uid: the current user’s ID for security checks, |
1694 | - @param fields: List of fields for default value |
1695 | - @param context: A standard dictionary for contextual values |
1696 | - """ |
1697 | - obj_event_reg = self.pool.get('event.registration') |
1698 | - data = context and context.get('active_ids', []) |
1699 | - |
1700 | - for event_reg in obj_event_reg.browse(cr, uid, data, context=context): |
1701 | - if event_reg.state in ('draft', 'done', 'cancel'): |
1702 | - raise osv.except_osv(_('Warning !'), |
1703 | - _("Invoice cannot be created if the registration is in %s state.") % (event_reg.state)) |
1704 | - |
1705 | - if (not event_reg.tobe_invoiced): |
1706 | - raise osv.except_osv(_('Warning !'), |
1707 | - _("Registration is set as Cannot be invoiced")) |
1708 | - |
1709 | - if not event_reg.event_id.product_id: |
1710 | - raise osv.except_osv(_('Warning !'), |
1711 | - _("Event related doesn't have any product defined")) |
1712 | - |
1713 | - if not event_reg.partner_invoice_id: |
1714 | - raise osv.except_osv(_('Warning !'), |
1715 | - _("Registration doesn't have any partner to invoice.")) |
1716 | - |
1717 | - def default_get(self, cr, uid, fields_list, context=None): |
1718 | - return super(event_make_invoice, self).default_get(cr, uid, fields_list, context=context) |
1719 | - |
1720 | - def make_invoice(self, cr, uid, ids, context=None): |
1721 | - reg_obj = self.pool.get('event.registration') |
1722 | - mod_obj = self.pool.get('ir.model.data') |
1723 | - if context is None: |
1724 | - context = {} |
1725 | - |
1726 | - for data in self.browse(cr, uid, ids, context=context): |
1727 | - res = reg_obj.action_invoice_create(cr, uid, context.get(('active_ids'),[]), data.grouped, date_inv = data.invoice_date) |
1728 | - |
1729 | - form_id = mod_obj.get_object_reference(cr, uid, 'account', 'invoice_form') |
1730 | - form_res = form_id and form_id[1] or False |
1731 | - tree_id = mod_obj.get_object_reference(cr, uid, 'account', 'invoice_tree') |
1732 | - tree_res = tree_id and tree_id[1] or False |
1733 | - return { |
1734 | - 'domain': "[('id', 'in', %s)]" % res, |
1735 | - 'name': _('Customer Invoices'), |
1736 | - 'view_type': 'form', |
1737 | - 'view_mode': 'tree,form', |
1738 | - 'res_model': 'account.invoice', |
1739 | - 'view_id': False, |
1740 | - 'views': [(tree_res, 'tree'), (form_res, 'form')], |
1741 | - 'context': "{'type':'out_refund'}", |
1742 | - 'type': 'ir.actions.act_window', |
1743 | - } |
1744 | - |
1745 | -event_make_invoice() |
1746 | - |
1747 | -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
1748 | |
1749 | === removed file 'event/wizard/event_make_invoice_view.xml' |
1750 | --- event/wizard/event_make_invoice_view.xml 2011-01-14 00:11:01 +0000 |
1751 | +++ event/wizard/event_make_invoice_view.xml 1970-01-01 00:00:00 +0000 |
1752 | @@ -1,40 +0,0 @@ |
1753 | -<?xml version="1.0" encoding="utf-8"?> |
1754 | -<openerp> |
1755 | - <data> |
1756 | - |
1757 | - <record id="view_event_make_invoice" model="ir.ui.view"> |
1758 | - <field name="name">event.make.invoice</field> |
1759 | - <field name="model">event.make.invoice</field> |
1760 | - <field name="type">form</field> |
1761 | - <field name="arch" type="xml"> |
1762 | - <form string="Create invoices"> |
1763 | - <separator colspan="4" string="Do you really want to create the invoice(s) ?" /> |
1764 | - <field name="grouped" /> |
1765 | - <field name="invoice_date"/> |
1766 | - <group colspan="4"> |
1767 | - <separator string="" colspan="4" /> |
1768 | - <label string="" colspan="2"/> |
1769 | - <button special="cancel" string="Close" icon="gtk-close"/> |
1770 | - <button name="make_invoice" string="Done" type="object" icon="gtk-ok"/> |
1771 | - </group> |
1772 | - </form> |
1773 | - </field> |
1774 | - </record> |
1775 | - |
1776 | - <record id="action_event_confirm_registration" model="ir.actions.act_window"> |
1777 | - <field name="name">Make Invoices</field> |
1778 | - <field name="type">ir.actions.act_window</field> |
1779 | - <field name="res_model">event.make.invoice</field> |
1780 | - <field name="view_type">form</field> |
1781 | - <field name="view_mode">form</field> |
1782 | - <field name="view_id" ref="view_event_make_invoice"/> |
1783 | - <field name="target">new</field> |
1784 | - </record> |
1785 | - |
1786 | - <act_window id="action_make_invoices" |
1787 | - key2 = "client_action_multi" name="Make Invoice" |
1788 | - res_model="event.make.invoice" src_model="event.registration" |
1789 | - view_mode="form" target="new" view_type="form" /> |
1790 | - |
1791 | - </data> |
1792 | -</openerp> |
1793 | |
1794 | === modified file 'event/wizard/partner_event_registration.py' |
1795 | --- event/wizard/partner_event_registration.py 2011-12-19 16:54:40 +0000 |
1796 | +++ event/wizard/partner_event_registration.py 2012-02-02 16:05:26 +0000 |
1797 | @@ -76,7 +76,6 @@ |
1798 | 'event_id': current.event_id and current.event_id.id or False, |
1799 | 'unit_price': current.unit_price, |
1800 | 'partner_id': partner.id, |
1801 | - 'partner_invoice_id': partner.id, |
1802 | 'event_product': current.event_id.product_id.name, |
1803 | 'contact_id': contact_id, |
1804 | 'email_from': email, |