[IMP] Event: clean
bzr revid: hmo@tinyerp.com-20100716064714-ivuu3ux3sayo28fh
This commit is contained in:
parent
e3606ed329
commit
b651a55c71
|
@ -32,8 +32,6 @@
|
|||
* ...
|
||||
A dashboard for associations that includes:
|
||||
* Registration by Events (graph)
|
||||
* Next Events (list)
|
||||
* Unpaid Invoices (list)
|
||||
Note that:
|
||||
- You can define new types of events in
|
||||
Events / Configuration / Types of Events
|
||||
|
@ -42,15 +40,14 @@
|
|||
""",
|
||||
'author': 'Tiny',
|
||||
'depends': ['crm', 'base_contact', 'account'],
|
||||
'init_xml': ['event_data.xml'],
|
||||
'init_xml': [],
|
||||
'update_xml': [
|
||||
'security/event_security.xml',
|
||||
'security/ir.model.access.csv',
|
||||
'wizard/event_confirm_registration_view.xml',
|
||||
'wizard/event_confirm_view.xml',
|
||||
'event_view.xml',
|
||||
'report/report_event_registration_view.xml',
|
||||
'event_sequence.xml',
|
||||
'security/event_security.xml',
|
||||
'security/ir.model.access.csv',
|
||||
'wizard/event_make_invoice_view.xml',
|
||||
'wizard/partner_event_registration_view.xml',
|
||||
'board_association_view.xml',
|
||||
|
|
|
@ -2,17 +2,6 @@
|
|||
<openerp>
|
||||
<data noupdate="1">
|
||||
|
||||
<!--
|
||||
Administrator shortcut
|
||||
Demo user startup menu
|
||||
-->
|
||||
<!-- <record model="ir.ui.view_sc" id="sc_association_dash">-->
|
||||
<!-- <field name="name">Dashboard</field>-->
|
||||
<!-- <field name="user_id" ref="base.user_root"/>-->
|
||||
<!-- <field name="resource">ir.ui.menu</field>-->
|
||||
<!-- <field name="sequence">1</field>-->
|
||||
<!-- <field name="res_id" ref="menu_board_associations_manager"/>-->
|
||||
<!-- </record>-->
|
||||
<record model="res.users" id="base.user_root">
|
||||
<field name="action_id" ref="open_board_associations_manager"/>
|
||||
</record>
|
||||
|
|
|
@ -28,34 +28,33 @@ import time
|
|||
import tools
|
||||
import decimal_precision as dp
|
||||
|
||||
class event_type(osv.osv):
|
||||
""" Event Type """
|
||||
class event_type(osv.osv):
|
||||
""" Event Type """
|
||||
_name = 'event.type'
|
||||
_description = __doc__
|
||||
_columns = {
|
||||
'name': fields.char('Event type', size=64, required=True),
|
||||
'name': fields.char('Event type', size=64, required=True),
|
||||
}
|
||||
event_type()
|
||||
|
||||
class event_event(osv.osv):
|
||||
"""Event"""
|
||||
class event_event(osv.osv):
|
||||
"""Event"""
|
||||
_name = 'event.event'
|
||||
_description = __doc__
|
||||
_order = 'date_begin'
|
||||
|
||||
def copy(self, cr, uid, id, default=None, context=None):
|
||||
""" Copy record of Given id
|
||||
|
||||
def copy(self, cr, uid, id, default=None, context=None):
|
||||
""" Copy record of Given id
|
||||
@param id: Id of Event record.
|
||||
@param context: A standard dictionary for contextual values
|
||||
"""
|
||||
if not default:
|
||||
default = {}
|
||||
default.update({
|
||||
'code': self.pool.get('ir.sequence').get(cr, uid, 'event.event'),
|
||||
'state': 'draft'
|
||||
})
|
||||
'state': 'draft',
|
||||
'registration_ids': False,
|
||||
})
|
||||
return super(event_event, self).copy(cr, uid, id, default=default, context=context)
|
||||
|
||||
def onchange_product(self, cr, uid, ids, product_id):
|
||||
"""This function returns value of product's unit price based on product id.
|
||||
@param self: The object pointer
|
||||
|
@ -81,16 +80,16 @@ class event_event(osv.osv):
|
|||
|
||||
def do_confirm(self, cr, uid, ids, context=None):
|
||||
""" Confirm Event and send confirmation email to all register peoples
|
||||
"""
|
||||
"""
|
||||
register_pool = self.pool.get('event.registration')
|
||||
for event in self.browse(cr, uid, ids, context=context):
|
||||
if event.mail_auto_confirm:
|
||||
#send reminder that will confirm the event for all the people that were already confirmed
|
||||
reg_ids = register_pool.search(cr, uid, [
|
||||
('event_id', '=', event.id),
|
||||
('event_id', '=', event.id),
|
||||
('state', 'not in', ['draft', 'cancel'])])
|
||||
register_pool.mail_user_confirm(cr, uid, reg_ids)
|
||||
|
||||
|
||||
return self.write(cr, uid, ids, {'state': 'confirm'})
|
||||
|
||||
def button_confirm(self, cr, uid, ids, context=None):
|
||||
|
@ -113,26 +112,26 @@ class event_event(osv.osv):
|
|||
view_id = view_data.res_id
|
||||
context['event_ids'] = unconfirmed_ids
|
||||
return {
|
||||
'name': _('Confirm Event'),
|
||||
'context': context,
|
||||
'view_type': 'form',
|
||||
'view_mode': 'tree,form',
|
||||
'res_model': 'event.confirm',
|
||||
'views': [(view_id, 'form')],
|
||||
'type': 'ir.actions.act_window',
|
||||
'target': 'new',
|
||||
'name': _('Confirm Event'),
|
||||
'context': context,
|
||||
'view_type': 'form',
|
||||
'view_mode': 'tree,form',
|
||||
'res_model': 'event.confirm',
|
||||
'views': [(view_id, 'form')],
|
||||
'type': 'ir.actions.act_window',
|
||||
'target': 'new',
|
||||
'context': context,
|
||||
'nodestroy': True
|
||||
}
|
||||
return True
|
||||
return True
|
||||
|
||||
|
||||
def _get_register(self, cr, uid, ids, fields, args, context=None):
|
||||
def _get_register(self, cr, uid, ids, fields, args, context=None):
|
||||
"""Get Confirm or uncofirm register value.
|
||||
@param ids: List of Event registration type's id
|
||||
@param fields: List of function fields(register_current and register_prospect).
|
||||
@param context: A standard dictionary for contextual values
|
||||
@return: Dictionary of function fields value.
|
||||
@return: Dictionary of function fields value.
|
||||
"""
|
||||
register_pool = self.pool.get('event.registration')
|
||||
res = {}
|
||||
|
@ -143,18 +142,18 @@ class event_event(osv.osv):
|
|||
state = []
|
||||
if 'register_current' in fields:
|
||||
state += ['open', 'done']
|
||||
if 'register_prospect' in fields:
|
||||
if 'register_prospect' in fields:
|
||||
state.append('draft')
|
||||
|
||||
|
||||
reg_ids = register_pool.search(cr, uid, [
|
||||
('event_id', '=', event.id),
|
||||
('event_id', '=', event.id),
|
||||
('state', 'in', state)])
|
||||
|
||||
|
||||
if 'register_current' in fields:
|
||||
res[event.id]['register_current'] = len(reg_ids)
|
||||
if 'register_prospect' in fields:
|
||||
if 'register_prospect' in fields:
|
||||
res[event.id]['register_prospect'] = len(reg_ids)
|
||||
|
||||
|
||||
return res
|
||||
|
||||
def write(self, cr, uid, ids, vals, context=None):
|
||||
|
@ -195,31 +194,31 @@ class event_event(osv.osv):
|
|||
'section_id': fields.many2one('crm.case.section', 'Sale Team', readonly=False, states={'done': [('readonly', True)]}),
|
||||
'child_ids': fields.one2many('event.event', 'parent_id', 'Child Events', readonly=False, states={'done': [('readonly', True)]}),
|
||||
'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 Open ERP"),
|
||||
'type': fields.many2one('event.type', 'Type', help="Type of Event like Seminar, Exhibition, Conference, Training.", readonly=False, states={'done': [('readonly', True)]}),
|
||||
'register_max': fields.integer('Maximum Registrations', help="Provide Maximun Number of Registrations", readonly=True, states={'draft': [('readonly', False)]}),
|
||||
'register_min': fields.integer('Minimum Registrations', help="Providee Minimum Number of Registrations", readonly=True, states={'draft': [('readonly', False)]}),
|
||||
'register_current': fields.function(_get_register, method=True, string='Confirmed Registrations', multi='register_current',
|
||||
help="Total of Open and Done Registrations"),
|
||||
'register_prospect': fields.function(_get_register, method=True, string='Unconfirmed Registrations', multi='register_prospect',
|
||||
'type': fields.many2one('event.type', 'Type', help="Type of Event like Seminar, Exhibition, Conference, Training.", readonly=False, states={'done': [('readonly', True)]}),
|
||||
'register_max': fields.integer('Maximum Registrations', help="Provide Maximun Number of Registrations", readonly=True, states={'draft': [('readonly', False)]}),
|
||||
'register_min': fields.integer('Minimum Registrations', help="Providee Minimum Number of Registrations", readonly=True, states={'draft': [('readonly', False)]}),
|
||||
'register_current': fields.function(_get_register, method=True, string='Confirmed Registrations', multi='register_current',
|
||||
help="Total of Open and Done Registrations"),
|
||||
'register_prospect': fields.function(_get_register, method=True, string='Unconfirmed Registrations', multi='register_prospect',
|
||||
help="Total of Prospect Registrations"),
|
||||
'registration_ids': fields.one2many('event.registration', 'event_id', 'Registrations', readonly=False, states={'done': [('readonly', True)]}),
|
||||
'date_begin': fields.datetime('Beginning date', required=True, help="Beginning Date of Event", readonly=True, states={'draft': [('readonly', False)]}),
|
||||
'date_end': fields.datetime('Closing date', required=True, help="Closing Date of Event", readonly=True, states={'draft': [('readonly', False)]}),
|
||||
'date_begin': fields.datetime('Beginning date', required=True, help="Beginning Date of Event", readonly=True, states={'draft': [('readonly', False)]}),
|
||||
'date_end': fields.datetime('Closing date', required=True, help="Closing Date of Event", readonly=True, states={'draft': [('readonly', False)]}),
|
||||
'state': fields.selection([
|
||||
('draft', 'Draft'),
|
||||
('confirm', 'Confirmed'),
|
||||
('done', 'Done'),
|
||||
('cancel', 'Cancelled')],
|
||||
'State', readonly=True, required=True,
|
||||
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\'.'),
|
||||
'mail_auto_registr': fields.boolean('Mail Auto Register', readonly=False, states={'done': [('readonly', True)]}, help='Check this box if you want to use the automatic mailing for new registration'),
|
||||
'mail_auto_confirm': fields.boolean('Mail Auto Confirm', readonly=False, states={'done': [('readonly', True)]}, help='Check this box if you want ot use the automatic confirmation emailing or the reminder'),
|
||||
'mail_registr': fields.text('Registration Email', readonly=False, states={'done': [('readonly', True)]}, help='This email will be sent when someone subscribes to the event.'),
|
||||
'mail_confirm': fields.text('Confirmation Email', readonly=False, states={'done': [('readonly', True)]}, help="This email will be sent when the event gets confimed or when someone subscribes to a confirmed event. This is also the email sent to remind someone about the event."),
|
||||
('draft', 'Draft'),
|
||||
('confirm', 'Confirmed'),
|
||||
('done', 'Done'),
|
||||
('cancel', 'Cancelled')],
|
||||
'State', readonly=True, required=True,
|
||||
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\'.'),
|
||||
'mail_auto_registr': fields.boolean('Mail Auto Register', readonly=False, states={'done': [('readonly', True)]}, help='Check this box if you want to use the automatic mailing for new registration'),
|
||||
'mail_auto_confirm': fields.boolean('Mail Auto Confirm', readonly=False, states={'done': [('readonly', True)]}, help='Check this box if you want ot use the automatic confirmation emailing or the reminder'),
|
||||
'mail_registr': fields.text('Registration Email', readonly=False, states={'done': [('readonly', True)]}, help='This email will be sent when someone subscribes to the event.'),
|
||||
'mail_confirm': fields.text('Confirmation Email', readonly=False, states={'done': [('readonly', True)]}, help="This email will be sent when the event gets confimed or when someone subscribes to a confirmed event. This is also the email sent to remind someone about the event."),
|
||||
'product_id': fields.many2one('product.product', 'Product', required=True, readonly=True, states={'draft': [('readonly', False)]}, help="Product which is provided cost of event. Invoice of event will be created with this Product."),
|
||||
'note': fields.text('Notes', help="Description or Summary of Event", readonly=False, states={'done': [('readonly', True)]}),
|
||||
'pricelist_id': fields.many2one('product.pricelist', 'Pricelist', readonly=True, states={'draft': [('readonly', False)]}, help="Pricelist version for current event."),
|
||||
"unit_price": fields.float('Registration Cost', digits_compute= dp.get_precision('Event Price'), readonly=True, states={'draft': [('readonly', False)]}),
|
||||
'unit_price': fields.related('product_id', 'list_price', type='float', string='Registration Cost', readonly=True, states={'draft':[('readonly',False)]}),
|
||||
'main_speaker_id': fields.many2one('res.partner','Main Speaker', readonly=False, states={'done': [('readonly', True)]}),
|
||||
'speaker_ids':fields.many2many('res.partner', 'event_speaker_rel', 'speaker_id', 'partner_id', 'Other Speakers', readonly=False, states={'done': [('readonly', True)]}),
|
||||
'address_id': fields.many2one('res.partner.address','Location Address', readonly=False, states={'done': [('readonly', True)]}),
|
||||
|
@ -229,13 +228,13 @@ class event_event(osv.osv):
|
|||
'language': fields.char('Language',size=64, readonly=False, states={'done': [('readonly', True)]}),
|
||||
'note': fields.text('Description', readonly=False, states={'done': [('readonly', True)]}),
|
||||
'company_id': fields.many2one('res.company', 'Company', required=True, change_default=True, readonly=False, states={'done': [('readonly', True)]}),
|
||||
|
||||
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
'state': 'draft',
|
||||
'state': 'draft',
|
||||
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'event.event', context=c),
|
||||
'user_id': lambda obj, cr, uid, context: uid,
|
||||
'user_id': lambda obj, cr, uid, context: uid,
|
||||
}
|
||||
|
||||
def _check_recursion(self, cr, uid, ids):
|
||||
|
@ -260,7 +259,7 @@ class event_event(osv.osv):
|
|||
def do_team_change(self, cr, uid, ids, team_id, context=None):
|
||||
"""
|
||||
On Change Callback: when team change, this is call.
|
||||
on this function, take value of reply_to from selected team.
|
||||
on this function, take value of reply_to from selected team.
|
||||
"""
|
||||
if not team_id:
|
||||
return {}
|
||||
|
@ -275,7 +274,7 @@ class event_event(osv.osv):
|
|||
|
||||
event_event()
|
||||
|
||||
class event_registration(osv.osv):
|
||||
class event_registration(osv.osv):
|
||||
"""Event Registration"""
|
||||
_name= 'event.registration'
|
||||
_description = __doc__
|
||||
|
@ -293,20 +292,20 @@ class event_registration(osv.osv):
|
|||
return res
|
||||
|
||||
_columns = {
|
||||
'name': fields.char('Summary', size=124, readonly=True, states={'draft': [('readonly', False)]}),
|
||||
'email_cc': fields.text('CC', size=252 , readonly=False, states={'done': [('readonly', True)]}, help="These people will receive a copy of the future communication between partner and users by email"),
|
||||
'nb_register': fields.integer('Quantity', required=True, readonly=True, states={'draft': [('readonly', False)]}, help="Number of Registrations or Tickets"),
|
||||
'event_id': fields.many2one('event.event', 'Event Related', required=True, readonly=True, states={'draft': [('readonly', False)]}),
|
||||
"partner_invoice_id": fields.many2one('res.partner', 'Partner Invoiced', readonly=True, states={'draft': [('readonly', False)]}),
|
||||
'name': fields.char('Summary', size=124, readonly=True, states={'draft': [('readonly', False)]}),
|
||||
'email_cc': fields.text('CC', size=252 , readonly=False, states={'done': [('readonly', True)]}, help="These people will receive a copy of the future communication between partner and users by email"),
|
||||
'nb_register': fields.integer('Quantity', required=True, readonly=True, states={'draft': [('readonly', False)]}, help="Number of Registrations or Tickets"),
|
||||
'event_id': fields.many2one('event.event', 'Event Related', required=True, readonly=True, states={'draft': [('readonly', False)]}),
|
||||
"partner_invoice_id": fields.many2one('res.partner', 'Partner Invoiced', readonly=True, states={'draft': [('readonly', False)]}),
|
||||
"contact_id": fields.many2one('res.partner.contact', 'Partner Contact', readonly=False, states={'done': [('readonly', True)]}), #TODO: filter only the contacts that have a function into the selected partner_id
|
||||
"unit_price": fields.float('Unit Price', required=True, digits_compute= dp.get_precision('Event Price'), readonly=True, states={'draft': [('readonly', False)]}),
|
||||
'price_subtotal': fields.function(_amount_line, method=True, string='Subtotal', digits_compute= dp.get_precision('Event Price')),
|
||||
'price_subtotal': fields.function(_amount_line, method=True, string='Subtotal', digits_compute= dp.get_precision('Event Price')),
|
||||
"badge_ids": fields.one2many('event.registration.badge', 'registration_id', 'Badges', readonly=False, states={'done': [('readonly', True)]}),
|
||||
"event_product": fields.char("Invoice Name", size=128, required=True, readonly=True, states={'draft': [('readonly', False)]}),
|
||||
"tobe_invoiced": fields.boolean("To be Invoiced", readonly=True, states={'draft': [('readonly', False)]}),
|
||||
"invoice_id": fields.many2one("account.invoice", "Invoice", readonly=True),
|
||||
'date_closed': fields.datetime('Closed', readonly=True),
|
||||
'ref': fields.reference('Reference', selection=crm._links_get, size=128),
|
||||
"event_product": fields.char("Invoice Name", size=128, readonly=True, states={'draft': [('readonly', False)]}),
|
||||
"tobe_invoiced": fields.boolean("To be Invoiced", readonly=True, states={'draft': [('readonly', False)]}),
|
||||
"invoice_id": fields.many2one("account.invoice", "Invoice", readonly=True),
|
||||
'date_closed': fields.datetime('Closed', readonly=True),
|
||||
'ref': fields.reference('Reference', selection=crm._links_get, size=128),
|
||||
'ref2': fields.reference('Reference 2', selection=crm._links_get, size=128),
|
||||
'message_ids': fields.one2many('mailgate.message', 'res_id', 'Messages', domain=[('history', '=', True),('model','=',_name)]),
|
||||
'log_ids': fields.one2many('mailgate.message', 'res_id', 'Logs', domain=[('history', '=', False),('model','=',_name)]),
|
||||
|
@ -314,37 +313,37 @@ class event_registration(osv.osv):
|
|||
'company_id': fields.related('event_id', 'company_id', type='many2one', relation='res.company', string='Company', store=True, readonly=True, states={'draft':[('readonly',False)]}),
|
||||
}
|
||||
_defaults = {
|
||||
'nb_register': 1,
|
||||
'tobe_invoiced': True,
|
||||
'nb_register': 1,
|
||||
'tobe_invoiced': True,
|
||||
'date': time.strftime('%Y-%m-%d %H:%M:%S')
|
||||
}
|
||||
|
||||
def _make_invoice(self, cr, uid, reg, lines, context=None):
|
||||
""" Create Invoice from Invoice lines
|
||||
@param reg : Model of Event Registration
|
||||
@param lines: Ids of Invoice lines
|
||||
@param lines: Ids of Invoice lines
|
||||
"""
|
||||
if context is None:
|
||||
context = {}
|
||||
inv_pool = self.pool.get('account.invoice')
|
||||
inv_lines_pool = self.pool.get('account.invoice.line')
|
||||
|
||||
val_invoice = inv_pool.onchange_partner_id(cr, uid, [], 'out_invoice', reg.partner_invoice_id.id, False, False)
|
||||
|
||||
val_invoice = inv_pool.onchange_partner_id(cr, uid, [], 'out_invoice', reg.partner_invoice_id.id, False, False)
|
||||
val_invoice['value'].update({'partner_id': reg.partner_invoice_id.id})
|
||||
partner_address_id = val_invoice['value']['address_invoice_id']
|
||||
|
||||
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)
|
||||
|
||||
|
||||
l = inv_lines_pool.read(cr, uid, lines)
|
||||
|
||||
|
||||
val_invoice['value'].update({
|
||||
'origin': reg.event_product,
|
||||
'reference': False,
|
||||
'invoice_line': [(6, 0, lines)],
|
||||
'comment': "",
|
||||
'origin': reg.event_product,
|
||||
'reference': False,
|
||||
'invoice_line': [(6, 0, lines)],
|
||||
'comment': "",
|
||||
'date_invoice': context.get('date_inv', False)
|
||||
})
|
||||
inv_id = inv_pool.create(cr, uid, val_invoice['value'])
|
||||
inv_id = inv_pool.create(cr, uid, val_invoice['value'])
|
||||
inv_pool.button_compute(cr, uid, [inv_id])
|
||||
self._history(cr, uid, [reg], _('Invoiced'))
|
||||
return inv_id
|
||||
|
@ -367,16 +366,16 @@ class event_registration(osv.osv):
|
|||
context['date_inv'] = date_inv
|
||||
|
||||
for reg in self.browse(cr, uid, ids, context=context):
|
||||
|
||||
|
||||
val_invoice = inv_pool.onchange_partner_id(cr, uid, [], 'out_invoice', reg.partner_invoice_id.id, False, False)
|
||||
|
||||
|
||||
val_invoice['value'].update({'partner_id': reg.partner_invoice_id.id})
|
||||
partner_address_id = val_invoice['value']['address_invoice_id']
|
||||
|
||||
|
||||
if not partner_address_id:
|
||||
raise osv.except_osv(_('Error !'),
|
||||
_("Registered partner doesn't have an address to make the invoice."))
|
||||
|
||||
|
||||
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)
|
||||
product = product_pool.browse(cr, uid, reg.event_id.product_id.id, context=context)
|
||||
for tax in product.taxes_id:
|
||||
|
@ -385,38 +384,38 @@ class event_registration(osv.osv):
|
|||
vals = value['value']
|
||||
c_name = reg.contact_id and ('-' + contact_pool.name_get(cr, uid, [reg.contact_id.id])[0][1]) or ''
|
||||
vals.update({
|
||||
'name': reg.event_product + '-' + c_name,
|
||||
'price_unit': reg.unit_price,
|
||||
'quantity': reg.nb_register,
|
||||
'product_id':reg.event_id.product_id.id,
|
||||
'invoice_line_tax_id': [(6, 0, tax_ids)],
|
||||
'name': reg.event_product + '-' + c_name,
|
||||
'price_unit': reg.unit_price,
|
||||
'quantity': reg.nb_register,
|
||||
'product_id':reg.event_id.product_id.id,
|
||||
'invoice_line_tax_id': [(6, 0, tax_ids)],
|
||||
})
|
||||
inv_line_ids = self._create_invoice_lines(cr, uid, [reg.id], vals)
|
||||
invoices.setdefault(reg.partner_id.id, []).append((reg, inv_line_ids))
|
||||
|
||||
|
||||
for val in invoices.values():
|
||||
res = False
|
||||
if grouped:
|
||||
res = self._make_invoice(cr, uid, val[0][0], [v for k , v in val], context=context)
|
||||
|
||||
|
||||
for k , v in val:
|
||||
self.do_close(cr, uid, [k.id], context={'invoice_id': res})
|
||||
|
||||
|
||||
else:
|
||||
for k , v in val:
|
||||
res = self._make_invoice(cr, uid, k, [v], context=context)
|
||||
self.do_close(cr, uid, [k.id], context={'invoice_id': res})
|
||||
if res: new_invoice_ids.append(res)
|
||||
|
||||
|
||||
return new_invoice_ids
|
||||
|
||||
def do_open(self, cr, uid, ids, context=None):
|
||||
""" Open Registration
|
||||
"""
|
||||
res = self.write(cr, uid, ids, {'state': 'open'}, context=context)
|
||||
self.mail_user(cr, uid, ids)
|
||||
self.mail_user(cr, uid, ids)
|
||||
self._history(cr, uid, ids, _('Open'))
|
||||
return res
|
||||
return res
|
||||
|
||||
def do_close(self, cr, uid, ids, context=None):
|
||||
""" Close Registration
|
||||
|
@ -427,7 +426,7 @@ class event_registration(osv.osv):
|
|||
values = {'state': 'done', 'date_closed': time.strftime('%Y-%m-%d %H:%M:%S')}
|
||||
msg = _('Done')
|
||||
if invoice_id:
|
||||
values['invoice_id'] = invoice_id
|
||||
values['invoice_id'] = invoice_id
|
||||
res = self.write(cr, uid, ids, values)
|
||||
self._history(cr, uid, ids, msg)
|
||||
return res
|
||||
|
@ -452,22 +451,22 @@ class event_registration(osv.osv):
|
|||
view_id = view_data.res_id
|
||||
context['registration_ids'] = unconfirmed_ids
|
||||
return {
|
||||
'name': _('Confirm Registration'),
|
||||
'context': context,
|
||||
'view_type': 'form',
|
||||
'view_mode': 'tree,form',
|
||||
'res_model': 'event.confirm.registration',
|
||||
'views': [(view_id, 'form')],
|
||||
'type': 'ir.actions.act_window',
|
||||
'target': 'new',
|
||||
'name': _('Confirm Registration'),
|
||||
'context': context,
|
||||
'view_type': 'form',
|
||||
'view_mode': 'tree,form',
|
||||
'res_model': 'event.confirm.registration',
|
||||
'views': [(view_id, 'form')],
|
||||
'type': 'ir.actions.act_window',
|
||||
'target': 'new',
|
||||
'context': context,
|
||||
'nodestroy': True
|
||||
}
|
||||
return True
|
||||
return True
|
||||
|
||||
def button_reg_close(self, cr, uid, ids, context=None):
|
||||
"""This Function Close Event Registration.
|
||||
"""
|
||||
"""This Function Close Event Registration.
|
||||
"""
|
||||
if not context:
|
||||
context = {}
|
||||
data_pool = self.pool.get('ir.model.data')
|
||||
|
@ -483,22 +482,22 @@ class event_registration(osv.osv):
|
|||
view_id = view_data.res_id
|
||||
context['active_ids'] = unclosed_ids
|
||||
return {
|
||||
'name': _('Close Registration'),
|
||||
'context': context,
|
||||
'view_type': 'form',
|
||||
'view_mode': 'tree,form',
|
||||
'res_model': 'event.make.invoice',
|
||||
'views': [(view_id, 'form')],
|
||||
'type': 'ir.actions.act_window',
|
||||
'target': 'new',
|
||||
'name': _('Close Registration'),
|
||||
'context': context,
|
||||
'view_type': 'form',
|
||||
'view_mode': 'tree,form',
|
||||
'res_model': 'event.make.invoice',
|
||||
'views': [(view_id, 'form')],
|
||||
'type': 'ir.actions.act_window',
|
||||
'target': 'new',
|
||||
'context': context,
|
||||
'nodestroy': True
|
||||
}
|
||||
return True
|
||||
|
||||
|
||||
def button_reg_cancel(self, cr, uid, ids, *args):
|
||||
"""This Function Cancel Event Registration.
|
||||
"""
|
||||
"""
|
||||
registrations = self.browse(cr, uid, ids)
|
||||
self._history(cr, uid, registrations, _('Cancel'))
|
||||
self.write(cr, uid, ids, {'state': 'cancel'})
|
||||
|
@ -518,7 +517,7 @@ class event_registration(osv.osv):
|
|||
|
||||
def write(self, cr, uid, ids, values, context=None):
|
||||
""" Overrides orm write method.
|
||||
"""
|
||||
"""
|
||||
event_obj = self.pool.get('event.event')
|
||||
if 'event_id' in values:
|
||||
event = event_obj.browse(cr, uid, values['event_id'], context=context)
|
||||
|
@ -528,11 +527,11 @@ class event_registration(osv.osv):
|
|||
|
||||
def mail_user(self, cr, uid, ids, confirm=False, context=None):
|
||||
"""
|
||||
Send email to user
|
||||
Send email to user
|
||||
"""
|
||||
if not context:
|
||||
context = {}
|
||||
|
||||
|
||||
for regestration in self.browse(cr, uid, ids, context=context):
|
||||
src = regestration.event_id.reply_to or False
|
||||
email_to = []
|
||||
|
@ -560,30 +559,30 @@ class event_registration(osv.osv):
|
|||
self.history(cr, uid, [regestration], subject, history=True, \
|
||||
email=email_to, details=body, \
|
||||
subject=subject, email_from=src, \
|
||||
email_cc=', '.join(email_cc))
|
||||
|
||||
email_cc=', '.join(email_cc))
|
||||
|
||||
return True
|
||||
|
||||
def mail_user_confirm(self, cr, uid, ids, context=None):
|
||||
"""
|
||||
Send email to user
|
||||
Send email to user
|
||||
"""
|
||||
return self.mail_user(cr, uid, ids, confirm=True, context=context)
|
||||
|
||||
def _create_invoice_lines(self, cr, uid, ids, vals):
|
||||
""" Create account Invoice line for Registration Id.
|
||||
"""
|
||||
return self.pool.get('account.invoice.line').create(cr, uid, vals)
|
||||
return self.pool.get('account.invoice.line').create(cr, uid, vals)
|
||||
|
||||
def onchange_contact_id(self, cr, uid, ids, contact, partner):
|
||||
|
||||
|
||||
"""This function returns value of Badge Name , Badge Title based on Partner contact.
|
||||
@param self: The object pointer
|
||||
@param cr: the current row, from the database cursor,
|
||||
@param uid: the current user’s ID for security checks,
|
||||
@param ids: List of Registration IDs
|
||||
@param contact: Patner Contact IDS
|
||||
@param partner: Partner IDS
|
||||
@param partner: Partner IDS
|
||||
"""
|
||||
data ={}
|
||||
if not contact:
|
||||
|
@ -591,7 +590,7 @@ class event_registration(osv.osv):
|
|||
contact_obj = self.pool.get('res.partner.contact')
|
||||
addr_obj = self.pool.get('res.partner.address')
|
||||
job_obj = self.pool.get('res.partner.job')
|
||||
|
||||
|
||||
contact_id = contact_obj.browse(cr, uid, contact)
|
||||
if partner:
|
||||
partner_addresses = addr_obj.search(cr, uid, [('partner_id', '=', partner)])
|
||||
|
@ -607,16 +606,16 @@ class event_registration(osv.osv):
|
|||
@param uid: the current user’s ID for security checks,
|
||||
@param ids: List of Registration IDs
|
||||
@param event_id: Event ID
|
||||
@param partner_invoice_id: Partner Invoice ID
|
||||
@param partner_invoice_id: Partner Invoice ID
|
||||
"""
|
||||
context={}
|
||||
if not event_id:
|
||||
return {'value': {'unit_price': False, 'event_product': False}}
|
||||
|
||||
|
||||
event_obj = self.pool.get('event.event')
|
||||
prod_obj = self.pool.get('product.product')
|
||||
res_obj = self.pool.get('res.partner')
|
||||
|
||||
|
||||
data_event = event_obj.browse(cr, uid, event_id)
|
||||
res = {'value': {'unit_price': False, 'event_product': False, 'user_id': False}}
|
||||
if data_event.user_id.id:
|
||||
|
@ -627,7 +626,7 @@ class event_registration(osv.osv):
|
|||
partner = res_obj.browse(cr, uid, partner_invoice_id, context=context)
|
||||
pricelist_id = pricelist_id or partner.property_product_pricelist.id
|
||||
unit_price = prod_obj._product_price(cr, uid, [data_event.product_id.id], False, False, {'pricelist': pricelist_id})[data_event.product_id.id]
|
||||
res['value'].update({'unit_price': unit_price, 'event_product': data_event.product_id.name})
|
||||
res['value'].update({'unit_price': unit_price, 'event_product': data_event.product_id.name})
|
||||
return res
|
||||
|
||||
def onchange_partner_id(self, cr, uid, ids, part, event_id, email=False):
|
||||
|
@ -641,7 +640,7 @@ class event_registration(osv.osv):
|
|||
"""
|
||||
job_obj = self.pool.get('res.partner.job')
|
||||
res_obj = self.pool.get('res.partner')
|
||||
|
||||
|
||||
data = {}
|
||||
data['contact_id'], data['partner_invoice_id'], data['email_from'] = (False, False, False)
|
||||
if not part:
|
||||
|
@ -659,7 +658,7 @@ class event_registration(osv.osv):
|
|||
data['contact_id'] = job_obj.browse(cr, uid, job_ids[0]).contact_id.id
|
||||
d = self.onchange_contact_id(cr, uid, ids, data['contact_id'], part)
|
||||
data.update(d['value'])
|
||||
partner_data = res_obj.browse(cr, uid, part)
|
||||
partner_data = res_obj.browse(cr, uid, part)
|
||||
return {'value': data}
|
||||
|
||||
def onchange_partner_invoice_id(self, cr, uid, ids, event_id, partner_invoice_id):
|
||||
|
@ -676,7 +675,7 @@ class event_registration(osv.osv):
|
|||
event_obj = self.pool.get('event.event')
|
||||
prod_obj = self.pool.get('product.product')
|
||||
res_obj = self.pool.get('res.partner')
|
||||
|
||||
|
||||
data['unit_price']=False
|
||||
if not event_id:
|
||||
return {'value': data}
|
||||
|
@ -687,7 +686,7 @@ class event_registration(osv.osv):
|
|||
if partner_invoice_id:
|
||||
partner = res_obj.browse(cr, uid, partner_invoice_id, context=context)
|
||||
pricelist_id = pricelist_id or partner.property_product_pricelist.id
|
||||
data['unit_price'] = prod_obj._product_price(cr, uid, [data_event.product_id.id], False, False, {'pricelist': pricelist_id})[data_event.product_id.id]
|
||||
data['unit_price'] = prod_obj._product_price(cr, uid, [data_event.product_id.id], False, False, {'pricelist': pricelist_id})[data_event.product_id.id]
|
||||
return {'value': data}
|
||||
|
||||
event_registration()
|
||||
|
@ -697,9 +696,9 @@ class event_registration_badge(osv.osv):
|
|||
_description = __doc__
|
||||
_columns = {
|
||||
'registration_id': fields.many2one('event.registration', 'Registration', required=True),
|
||||
"title": fields.char('Title', size=128),
|
||||
"name": fields.char('Name', size=128, required=True),
|
||||
"address_id": fields.many2one('res.partner.address', 'Address'),
|
||||
"title": fields.char('Title', size=128),
|
||||
"name": fields.char('Name', size=128, required=True),
|
||||
"address_id": fields.many2one('res.partner.address', 'Address'),
|
||||
}
|
||||
event_registration_badge()
|
||||
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
</data>
|
||||
</openerp>
|
|
@ -1,21 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
#
|
||||
# Sequences for crm.case.section
|
||||
#
|
||||
|
||||
<record model="ir.sequence.type" id="seq_section_code">
|
||||
<field name="name">Section Code</field>
|
||||
<field name="code">event.event</field>
|
||||
</record>
|
||||
<record model="ir.sequence" id="seq_section_code1">
|
||||
<field name="name">Section Code</field>
|
||||
<field name="code">event.event</field>
|
||||
<field name="prefix">C/</field>
|
||||
<field name="padding">3</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
|
@ -1,9 +1,9 @@
|
|||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<menuitem name="Marketing" id="menu_marketing_event_main" icon="terp-calendar" sequence="9"/>
|
||||
<menuitem name="Events Organisation" id="menu_event_main" parent="menu_marketing_event_main" />
|
||||
|
||||
<menuitem name="Association" id="base.menu_association" icon="terp-calendar" sequence="9"/>
|
||||
<menuitem name="Events Organisation" id="menu_event_main" parent="base.menu_association" />
|
||||
|
||||
<!-- EVENTS -->
|
||||
|
||||
<!-- EVENTS/CONFIGURATION/TYPE OF EVENTS -->
|
||||
|
@ -33,7 +33,7 @@
|
|||
<field name="res_model">event.type</field>
|
||||
<field name="view_type">form</field>
|
||||
</record>
|
||||
<menuitem name="Configuration" id="menu_event_config" parent="menu_marketing_event_main" sequence="30" groups="base.group_extended"/>
|
||||
<menuitem name="Configuration" id="menu_event_config" parent="base.menu_association" sequence="30" groups="base.group_extended"/>
|
||||
<menuitem name="Types of Events" id="menu_event_type" action="action_event_type" parent="menu_event_config" groups="base.group_extended,crm.group_crm_manager"/>
|
||||
|
||||
<!-- Events Organisation/CONFIGURATION/EVENTS -->
|
||||
|
@ -45,17 +45,17 @@
|
|||
<field name="arch" type="xml">
|
||||
<form string="Events">
|
||||
<group col="6" colspan="4">
|
||||
<field name="name" string="Event"/>
|
||||
<field name="name" string="Event"/>
|
||||
<field name="date_begin"/>
|
||||
<field name="date_end"/>
|
||||
<field name="type" widget="selection"/>
|
||||
<field name="type" widget="selection"/>
|
||||
<field name="language"/>
|
||||
<field name="parent_id"/>
|
||||
<field name="parent_id"/>
|
||||
</group>
|
||||
<notebook colspan="4">
|
||||
<page string="Event">
|
||||
<group colspan="4" col="4">
|
||||
<separator string="Invoice Information" colspan="4"/>
|
||||
<separator string="Invoice Information" colspan="4"/>
|
||||
<field name="product_id" on_change="onchange_product(product_id)" colspan="4"/>
|
||||
<field name="unit_price"/>
|
||||
<field name="pricelist_id" domain="[('type','=','sale')]" groups="base.group_extended"/>
|
||||
|
@ -64,13 +64,13 @@
|
|||
<separator string="Contact" colspan="4"/>
|
||||
<field name="user_id"/>
|
||||
<field name="section_id" widget="selection" on_change="do_team_change(section_id)"/>
|
||||
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
|
||||
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
|
||||
</group>
|
||||
<group colspan="2" col="2">
|
||||
<separator string="Location" colspan="4"/>
|
||||
<field name="country_id" />
|
||||
<field name="address_id" domain="[('country_id','=',country_id)]"/>
|
||||
|
||||
<separator string="Location" colspan="4"/>
|
||||
<field name="country_id" />
|
||||
<field name="address_id" domain="[('country_id','=',country_id)]"/>
|
||||
|
||||
</group>
|
||||
<field name="state" select="1"/>
|
||||
<group col="4" colspan="2">
|
||||
|
@ -79,14 +79,14 @@
|
|||
<button string="Event Done" name="button_done" states="confirm" type="object" icon="gtk-jump-to"/>
|
||||
<button string="Set To Draft" name="button_draft" states="confirm,cancel,done" type="object" icon="gtk-convert"/>
|
||||
</group>
|
||||
</page>
|
||||
</page>
|
||||
<page string="Speakers">
|
||||
<field name="main_speaker_id" domain="[('speaker','=',True)]"/>
|
||||
<field name="speaker_confirmed"/>
|
||||
<separator string="Other Speakers" colspan="4"/>
|
||||
<field name="speaker_ids" domain="[('speaker','=',True)]" colspan="4" nolabel="1"/>
|
||||
</page>
|
||||
<page string="Registrations">
|
||||
<page string="Registrations">
|
||||
<field name="register_min"/>
|
||||
<field name="register_max"/>
|
||||
<field name="register_current"/>
|
||||
|
@ -96,7 +96,7 @@
|
|||
<field name="name"/>
|
||||
<field name="date" string="Date"/>
|
||||
<field name="partner_id" required="1" on_change="onchange_partner_id(partner_id,event_id)"/>
|
||||
<field name="partner_invoice_id" on_change="onchange_partner_invoice_id(event_id, partner_invoice_id)"/>
|
||||
<field name="partner_invoice_id" on_change="onchange_partner_invoice_id(event_id, partner_invoice_id)"/>
|
||||
<group colspan="4" col="4">
|
||||
<field name="event_product"/>
|
||||
<field name="nb_register"/>
|
||||
|
@ -156,7 +156,7 @@
|
|||
</record>
|
||||
|
||||
<!-- Event tree view -->
|
||||
|
||||
|
||||
<record model="ir.ui.view" id="view_event_tree">
|
||||
<field name="name">event.event.tree</field>
|
||||
<field name="model">event.event</field>
|
||||
|
@ -175,13 +175,13 @@
|
|||
<button string="Confirm Event" help="Confirm Event" name="button_confirm" states="draft" type="object" icon="gtk-apply"/>
|
||||
<button string="Cancel Event" help="Cancel Event" name="button_cancel" states="draft,confirm" type="object" icon="gtk-cancel"/>
|
||||
<button string="Event Done" help="Event Done" name="button_done" states="confirm" type="object" icon="gtk-jump-to"/>
|
||||
<button string="Set To Draft" help="Set To Draft" name="button_draft" states="confirm,cancel,done" type="object" icon="gtk-convert"/>
|
||||
<button string="Set To Draft" help="Set To Draft" name="button_draft" states="confirm,cancel,done" type="object" icon="gtk-convert"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Events Calendar View -->
|
||||
|
||||
|
||||
<!-- Events Calendar View -->
|
||||
|
||||
<record id="view_event_calendar" model="ir.ui.view">
|
||||
<field name="name">event.event.calendar</field>
|
||||
<field name="model">event.event</field>
|
||||
|
@ -194,9 +194,9 @@
|
|||
</calendar>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<!-- Event Graph view -->
|
||||
|
||||
|
||||
<record model="ir.ui.view" id="view_event_graph">
|
||||
<field name="name">Event Graph</field>
|
||||
<field name="model">event.event</field>
|
||||
|
@ -236,7 +236,7 @@
|
|||
<group expand="0" string="Group By..." colspan="4" col="12">
|
||||
<filter string="Event Type" icon="terp-crm" context="{'group_by':'type'}"/>
|
||||
<filter string="state" icon="terp-stock_effects-object-colorize" context="{'group_by':'state'}"/>
|
||||
<separator orientation="vertical"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter string="Responsible" icon="terp-personal" context="{'group_by': 'user_id'}"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter string="Creation" icon="terp-go-month"
|
||||
|
@ -247,7 +247,7 @@
|
|||
</record>
|
||||
|
||||
<!-- Events Organisation/CONFIGURATION/EVENTS -->
|
||||
|
||||
|
||||
<record model="ir.actions.act_window" id="action_event_view">
|
||||
<field name="name">Events</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
|
@ -257,7 +257,7 @@
|
|||
<field name="context">{"search_default_draft": "1"}</field>
|
||||
<field name="search_view_id" ref="view_event_search"/>
|
||||
</record>
|
||||
|
||||
|
||||
<act_window
|
||||
id="act_event_list_register_event"
|
||||
name="Registration"
|
||||
|
@ -266,7 +266,7 @@
|
|||
view_mode="tree,form,calendar,graph"
|
||||
domain="[('event_id', '=', active_id)]"
|
||||
view_type="form"/>
|
||||
|
||||
|
||||
<act_window
|
||||
id="act_register_event_partner"
|
||||
name="Subscribe"
|
||||
|
@ -274,13 +274,13 @@
|
|||
src_model="res.partner"
|
||||
view_mode="tree,form,calendar,graph"
|
||||
domain="[('partner_id', '=', active_id)]"
|
||||
view_type="form"/>
|
||||
view_type="form"/>
|
||||
|
||||
<menuitem name="Events" id="menu_event_event" action="action_event_view" parent="menu_event_main" />
|
||||
|
||||
<!-- EVENTS/REGISTRATIONS/EVENTS -->
|
||||
|
||||
|
||||
|
||||
<record model="ir.ui.view" id="view_event_registration_tree">
|
||||
<field name="name">event.registration.tree</field>
|
||||
<field name="model">event.registration</field>
|
||||
|
@ -311,23 +311,24 @@
|
|||
<field name="date" string="Registration Date"/>
|
||||
<field name="name"/>
|
||||
<field name="partner_id" required="1" on_change="onchange_partner_id(partner_id,event_id)" />
|
||||
<field name="partner_invoice_id" on_change="onchange_partner_invoice_id(event_id, partner_invoice_id)"/>
|
||||
<field name="user_id"/>
|
||||
<field name="tobe_invoiced"/>
|
||||
</group>
|
||||
<notebook colspan="4">
|
||||
<page string="Registration">
|
||||
<group colspan="2" col="2">
|
||||
<separator string="Invoice" colspan="4"/>
|
||||
<field name="event_product"/>
|
||||
<field name="invoice_id"/>
|
||||
<field name="tobe_invoiced"/>
|
||||
</group>
|
||||
<page string="Registration">
|
||||
<group colspan="2" col="2">
|
||||
<separator string="Registration Cost" colspan="4"/>
|
||||
<field name="nb_register"/>
|
||||
<field name="unit_price"/>
|
||||
<field name="price_subtotal"/>
|
||||
</group>
|
||||
</group>
|
||||
<group colspan="2" col="2" attrs="{'invisible':[('tobe_invoiced','=',False)]}">
|
||||
<separator string="Invoice" colspan="4"/>
|
||||
<field name="event_product" attrs="{'required':[('tobe_invoiced','=',True)]}"/>
|
||||
<field name="partner_invoice_id" attrs="{'required':[('tobe_invoiced','=',True)]}" on_change="onchange_partner_invoice_id(event_id, partner_invoice_id)"/>
|
||||
<field name="invoice_id"/>
|
||||
</group>
|
||||
|
||||
<group col="8" colspan="4">
|
||||
<separator string="" colspan="4"/>
|
||||
<newline/>
|
||||
|
@ -362,7 +363,7 @@
|
|||
<separator string="Misc" colspan="2"/>
|
||||
<field name="id"/>
|
||||
<field name="active"/>
|
||||
</group>
|
||||
</group>
|
||||
</page>
|
||||
<page string="Emails" groups="base.group_extended">
|
||||
<group colspan="4">
|
||||
|
@ -402,14 +403,14 @@
|
|||
name="%(crm.action_crm_send_mail)d"
|
||||
context="{'mail':'new', 'model': 'event.registration'}"
|
||||
icon="gtk-go-forward" type="action" />
|
||||
</page>
|
||||
</page>
|
||||
</notebook>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Calendar view of event registration -->
|
||||
|
||||
|
||||
<!-- Calendar view of event registration -->
|
||||
|
||||
<record id="view_event_registration_calendar" model="ir.ui.view">
|
||||
<field name="name">event.registration.calendar</field>
|
||||
<field name="model">event.registration</field>
|
||||
|
@ -422,7 +423,7 @@
|
|||
</calendar>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record model="ir.ui.view" id="view_event_registration_graph">
|
||||
<field name="name">Registration Graph</field>
|
||||
<field name="model">event.registration</field>
|
||||
|
@ -434,7 +435,7 @@
|
|||
</graph>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
|
||||
<!-- Search view of event registration form-->
|
||||
|
||||
|
@ -451,7 +452,7 @@
|
|||
<field name="partner_id" />
|
||||
<field name="event_id" widget="selection"/>
|
||||
<field name="state" select="1"/>
|
||||
|
||||
|
||||
<field name="user_id" widget="selection">
|
||||
<filter icon="terp-personal"
|
||||
string="My Registration"
|
||||
|
@ -459,12 +460,12 @@
|
|||
domain="[('user_id','=',uid)]"/>
|
||||
</field>
|
||||
</group>
|
||||
<newline/>
|
||||
<newline/>
|
||||
<group expand="0" string="Group By...">
|
||||
<filter string="Event" icon="terp-crm" domain="[]" context="{'group_by':'event_id'}"/>
|
||||
<filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter string="Partner" icon="terp-personal" domain="[]" context="{'group_by':'partner_id'}"/>
|
||||
<filter string="Partner" icon="terp-personal" domain="[]" context="{'group_by':'partner_id'}"/>
|
||||
<filter string="Responsible" icon="terp-personal" domain="[]" context="{'group_by':'user_id'}"/>
|
||||
</group>
|
||||
</search>
|
||||
|
@ -480,11 +481,11 @@
|
|||
<field name="context">{"search_default_draft": "1"}</field>
|
||||
<field name="search_view_id" ref="view_registration_search"/>
|
||||
</record>
|
||||
|
||||
|
||||
<menuitem
|
||||
name="Registrations"
|
||||
id="menu_action_registration" parent="menu_event_main"
|
||||
action="action_registration"/>
|
||||
<menuitem name="Reporting" id="menu_report_event" parent="menu_marketing_event_main" sequence="20"/>
|
||||
<menuitem name="Reporting" id="menu_report_event" parent="base.menu_association" sequence="20"/>
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
|
@ -30,9 +30,16 @@
|
|||
</field>
|
||||
<field name="event_registration_ids" colspan="4" nolabel="1">
|
||||
<tree string="Events Registration">
|
||||
<field name="date" string="Date"/>
|
||||
<field name="event_id" />
|
||||
<field name="partner_id"/>
|
||||
<field name="partner_invoice_id"/>
|
||||
<field name="nb_register"/>
|
||||
<field name="unit_price"/>
|
||||
<field name="price_subtotal"/>
|
||||
<field name="state"/>
|
||||
<button name="button_reg_close" string="Close Registration" states="open" type="object" icon="gtk-close"/>
|
||||
<button name="check_confirm" string="Confirm Registration" states="draft" type="object" icon="gtk-apply"/>
|
||||
<button name="button_reg_cancel" string="Cancel Registration" states="draft,open" type="object" icon="gtk-cancel"/>
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
|
|
|
@ -10,14 +10,7 @@
|
|||
<record id="group_event_subscriber" model="res.groups">
|
||||
<field name="name">EVENT / Subscriber</field>
|
||||
</record>
|
||||
|
||||
<!-- <record id="menu_event_config" model="ir.ui.menu">-->
|
||||
<!-- <field name="groups_id" eval="[(6,0,[ref('crm.group_crm_manager'), ref('base.group_extended')])]"/>-->
|
||||
<!-- </record>-->
|
||||
<!---->
|
||||
<!-- <record id="menu_report_event" model="ir.ui.menu">-->
|
||||
<!-- <field name="groups_id" eval="[(6,0,[ref('crm.group_crm_manager'), ref('base.group_extended')])]"/>-->
|
||||
<!-- </record>-->
|
||||
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
from osv import fields, osv
|
||||
from tools.translate import _
|
||||
|
||||
|
||||
class event_confirm(osv.osv_memory):
|
||||
"""
|
||||
Confirm Event
|
||||
|
@ -30,11 +30,11 @@ class event_confirm(osv.osv_memory):
|
|||
_description = "Event Confirmation"
|
||||
|
||||
_columns = {
|
||||
'msg': fields.text('Message', readonly=True),
|
||||
'msg': fields.text('Message', readonly=True),
|
||||
}
|
||||
_defaults = {
|
||||
'msg': _('Total Registrations of this Event could not reached Minimum Registration Limit. What do you want to do?')
|
||||
}
|
||||
}
|
||||
|
||||
def confirm(self, cr, uid, ids, context):
|
||||
event_pool = self.pool.get('event.event')
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
from osv import fields, osv
|
||||
from tools.translate import _
|
||||
|
||||
|
||||
class event_confirm_registration(osv.osv_memory):
|
||||
"""
|
||||
Confirm Event Registration
|
||||
|
@ -30,7 +30,7 @@ class event_confirm_registration(osv.osv_memory):
|
|||
_description = "Event Registraion"
|
||||
|
||||
_columns = {
|
||||
'msg': fields.text('Message', readonly=True),
|
||||
'msg': fields.text('Message', readonly=True),
|
||||
}
|
||||
_defaults = {
|
||||
'msg': 'The event limit is reached. What do you want to do?'
|
||||
|
@ -38,14 +38,14 @@ class event_confirm_registration(osv.osv_memory):
|
|||
|
||||
def default_get(self, cr, uid, fields, context=None):
|
||||
"""
|
||||
This function gets default values
|
||||
This function gets default values
|
||||
"""
|
||||
registration_pool = self.pool.get('event.registration')
|
||||
registration_ids = context.get('registration_ids', [])
|
||||
res = super(event_confirm_registration, self).default_get(cr, uid, fields, context=context)
|
||||
msg = ""
|
||||
overlimit_event_ids = []
|
||||
for registration in registration_pool.browse(cr, uid, registration_ids, context=context):
|
||||
for registration in registration_pool.browse(cr, uid, registration_ids, context=context):
|
||||
total_confirmed = registration.event_id.register_current
|
||||
register_max = registration.event_id.register_max
|
||||
if registration.event_id.id not in overlimit_event_ids:
|
||||
|
@ -54,7 +54,7 @@ class event_confirm_registration(osv.osv_memory):
|
|||
%(registration.event_id.name, register_max)
|
||||
if 'msg' in fields:
|
||||
res.update({'msg': msg})
|
||||
|
||||
|
||||
return res
|
||||
|
||||
def confirm(self, cr, uid, ids, context):
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="view_event_confirm_registration"/>
|
||||
<field name="context">{'record_id' : active_id}</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ class event_make_invoice(osv.osv_memory):
|
|||
_name = "event.make.invoice"
|
||||
_description = "Event Make Invoice"
|
||||
_columns = {
|
||||
|
||||
|
||||
'grouped': fields.boolean('Group the invoices'),
|
||||
'invoice_date':fields.date('Invoice Date'),
|
||||
# 'invoice_ids': fields.char('Invoice Ids', size=128), # Improve me
|
||||
|
@ -45,7 +45,7 @@ class event_make_invoice(osv.osv_memory):
|
|||
"""
|
||||
obj_event_reg = self.pool.get('event.registration')
|
||||
data = context and context.get('active_ids', [])
|
||||
|
||||
|
||||
for event_reg in obj_event_reg.browse(cr, uid, data, context=context):
|
||||
if event_reg.state == 'draft':
|
||||
raise osv.except_osv(_('Warning !'),
|
||||
|
@ -53,7 +53,7 @@ class event_make_invoice(osv.osv_memory):
|
|||
if event_reg.state == 'done':
|
||||
raise osv.except_osv(_('Warning !'),
|
||||
_("Invoice cannot be created if the registration is in done state."))
|
||||
|
||||
|
||||
if (not event_reg.tobe_invoiced):
|
||||
raise osv.except_osv(_('Warning !'),
|
||||
_("Registration is set as Cannot be invoiced"))
|
||||
|
@ -63,27 +63,27 @@ class event_make_invoice(osv.osv_memory):
|
|||
_("Event related doesn't have any product defined"))
|
||||
if not event_reg.partner_invoice_id:
|
||||
raise osv.except_osv(_('Warning !'),
|
||||
_("Registration doesn't have any partner to invoice."))
|
||||
_("Registration doesn't have any partner to invoice."))
|
||||
|
||||
def default_get(self, cr, uid, fields_list, context=None):
|
||||
res = super(event_make_invoice, self).default_get(cr, uid, fields_list, context)
|
||||
return res
|
||||
|
||||
def make_invoice(self, cr, uid, ids, context={}):
|
||||
|
||||
|
||||
reg_obj = self.pool.get('event.registration')
|
||||
newinv = []
|
||||
|
||||
|
||||
for data in self.browse(cr, uid, ids):
|
||||
res = reg_obj.action_invoice_create(cr, uid, context.get(('active_ids'),[]), data.grouped, date_inv = data.invoice_date)
|
||||
|
||||
mod_obj =self.pool.get('ir.model.data')
|
||||
result = mod_obj._get_id(cr, uid, 'account', 'view_account_invoice_filter')
|
||||
|
||||
id = mod_obj.read(cr, uid, result, ['res_id'])
|
||||
|
||||
|
||||
id = mod_obj.read(cr, uid, result, ['res_id'])
|
||||
|
||||
return {
|
||||
'domain': "[('id','in',%s)]" % res,
|
||||
'domain': "[('id','in',%s)]" % res,
|
||||
'name': 'Invoices',
|
||||
'view_type': 'form',
|
||||
'view_mode': 'tree,form',
|
||||
|
@ -91,8 +91,8 @@ class event_make_invoice(osv.osv_memory):
|
|||
'view_id': False,
|
||||
'context': "{'type':'out_refund'}",
|
||||
'type': 'ir.actions.act_window',
|
||||
'search_view_id': id['id']
|
||||
'search_view_id': id['id']
|
||||
}
|
||||
|
||||
|
||||
event_make_invoice()
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="view_event_make_invoice"/>
|
||||
<field name="context">{'record_id' : active_id}</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
|
|
|
@ -36,28 +36,26 @@ class partner_event_registration(osv.osv_memory):
|
|||
_columns = {
|
||||
'event_id': fields.many2one('event.event', 'Event'),
|
||||
'event_type': fields.many2one('event.type', 'Type', readonly=True),
|
||||
'unit_price': fields.float('Cost', readonly=True),
|
||||
'currency_id': fields.many2one('res.currency', 'Currency', readonly=True),
|
||||
'start_date': fields.datetime('Start date', required=True, help="Beginning Date of Event", readonly=True),
|
||||
'end_date': fields.datetime('Closing date', required=True, help="Closing Date of Event", readonly=True),
|
||||
'unit_price': fields.float('Registration Cost'),
|
||||
'start_date': fields.datetime('Start date', required=True, help="Beginning Date of Event", readonly=True),
|
||||
'end_date': fields.datetime('Closing date', required=True, help="Closing Date of Event", readonly=True),
|
||||
'nb_register': fields.integer('Number of Registration'),
|
||||
}
|
||||
_defaults = {
|
||||
'nb_register': 1,
|
||||
'nb_register': 1,
|
||||
}
|
||||
|
||||
def open_registration(self, cr, uid, ids, context=None):
|
||||
"""This Function Open Registration For Given Event id and Partner.
|
||||
|
||||
|
||||
"""
|
||||
|
||||
value = {}
|
||||
res_obj = self.pool.get('res.partner')
|
||||
job_obj = self.pool.get('res.partner.job')
|
||||
event_obj = self.pool.get('event.event')
|
||||
reg_obj = self.pool.get('event.registration')
|
||||
mod_obj = self.pool.get('ir.model.data')
|
||||
|
||||
|
||||
record_ids = context and context.get('active_ids', []) or []
|
||||
addr = res_obj.address_get(cr, uid, record_ids)
|
||||
contact_id = False
|
||||
|
@ -83,22 +81,21 @@ class partner_event_registration(osv.osv_memory):
|
|||
id3 = data_obj.browse(cr, uid, id3, context=context).res_id
|
||||
|
||||
for current in self.browse(cr, uid, ids, context=context):
|
||||
for reg in reg_obj.browse(cr, uid, record_ids, context=context):
|
||||
for partner in res_obj.browse(cr, uid, record_ids, context=context):
|
||||
new_case = reg_obj.create(cr, uid, {
|
||||
'name' : 'Registration',
|
||||
'event_id' : current.event_id and current.event_id.id or False,
|
||||
'unit_price' : current.event_id.unit_price,
|
||||
'currency_id' : current.event_id.currency_id and current.event_id.currency_id.id or False,
|
||||
'partner_id' : record_ids[0],
|
||||
'partner_invoice_id' : record_ids[0] or False,
|
||||
'unit_price' : current.unit_price,
|
||||
'partner_id' : partner.id,
|
||||
'partner_invoice_id' : partner.id,
|
||||
'event_product': current.event_id.product_id.name,
|
||||
'contact_id': contact_id,
|
||||
'email_from': email,
|
||||
'nb_register': current.nb_register,
|
||||
|
||||
|
||||
}, context=context)
|
||||
|
||||
value = {
|
||||
value = {
|
||||
'name': _('Event Registration'),
|
||||
'view_type': 'form',
|
||||
'view_mode': 'tree,form',
|
||||
|
@ -109,14 +106,14 @@ class partner_event_registration(osv.osv_memory):
|
|||
'search_view_id': res['res_id']
|
||||
}
|
||||
return value
|
||||
|
||||
|
||||
def name_get(self, cr, uid, ids, context=None):
|
||||
"""Overrides orm name_get method
|
||||
@param ids: List of partner_event_register ids
|
||||
"""
|
||||
if not context:
|
||||
context = {}
|
||||
|
||||
|
||||
res = []
|
||||
if not ids:
|
||||
return res
|
||||
|
@ -127,22 +124,31 @@ class partner_event_registration(osv.osv_memory):
|
|||
event_id = record['event_type'][1] + ' on ' + event_id
|
||||
res.append((record['id'], event_id))
|
||||
return res
|
||||
|
||||
def onchange_event_id(self, cr, uid, ids, event_id, context={}):
|
||||
|
||||
def onchange_event_id(self, cr, uid, ids, event_id, context=None):
|
||||
res = {}
|
||||
event_obj = self.pool.get('event.event')
|
||||
|
||||
if event_id:
|
||||
product_obj = self.pool.get('product.product')
|
||||
partner_obj = self.pool.get('res.partner')
|
||||
if not context:
|
||||
context = {}
|
||||
partner_id = context.get('active_id', False)
|
||||
if event_id:
|
||||
event = event_obj.browse(cr, uid, event_id)
|
||||
pricelist_id = event.pricelist_id and event.pricelist_id.id or False
|
||||
if partner_id:
|
||||
partner = partner_obj.browse(cr, uid, partner_id, context=context)
|
||||
pricelist_id = pricelist_id or partner.property_product_pricelist.id
|
||||
unit_price = product_obj._product_price(cr, uid, [event.product_id.id], False, False, {'pricelist': pricelist_id})[event.product_id.id]
|
||||
|
||||
res['value'] = {
|
||||
'event_type': event.type and event.type.id or False,
|
||||
'start_date': event.date_begin,
|
||||
'end_date': event.date_end,
|
||||
'unit_price': event.unit_price,
|
||||
'currency_id': event.currency_id and event.currency_id.id or False
|
||||
}
|
||||
'unit_price': unit_price,
|
||||
}
|
||||
return res
|
||||
|
||||
|
||||
partner_event_registration()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -16,17 +16,14 @@
|
|||
<field name="nb_register"/>
|
||||
</group>
|
||||
<separator string="Event Details" colspan="4"/>
|
||||
<group colspan="4" col="4">
|
||||
<group colspan="4" col="4">
|
||||
<field name="start_date"/>
|
||||
<field name="end_date"/>
|
||||
<field name="event_type"/>
|
||||
<group colspan="2" col="3">
|
||||
<field name="unit_price"/>
|
||||
<field name="currency_id" nolabel="1"/>
|
||||
</group>
|
||||
</group>
|
||||
|
||||
|
||||
<field name="unit_price"/>
|
||||
</group>
|
||||
|
||||
|
||||
<separator string="" colspan="4" />
|
||||
<group colspan="4" col="6">
|
||||
<label string="" colspan="2"/>
|
||||
|
|
Loading…
Reference in New Issue