*splitted event into 2 modules (added event_project) in order to remove the dependancy to project
*small bugfix bzr revid: qdp-launchpad@tinyerp.com-20081028162945-hk81vldgjt0y0cq3
This commit is contained in:
parent
6f7db33e10
commit
d8c7ae16e9
|
@ -8,7 +8,6 @@
|
|||
|
||||
This module allow you
|
||||
* to manage your events and their registrations
|
||||
* to create retro planning for managing your events
|
||||
* to use emails to automaticly confirm and send acknowledgements for any registration to an event
|
||||
* ...
|
||||
|
||||
|
@ -19,7 +18,7 @@
|
|||
Events \ Reporting
|
||||
""",
|
||||
"depends" : [
|
||||
"project","crm","base_contact","account_budget",
|
||||
"crm","base_contact","account_budget",
|
||||
],
|
||||
"demo_xml" : ["event_demo.xml"],
|
||||
"init_xml" : ["event_data.xml"],
|
||||
|
|
|
@ -45,24 +45,6 @@ class crm_case_log(osv.osv):
|
|||
}
|
||||
crm_case_log()
|
||||
|
||||
class one2many_mod_task(fields.one2many):
|
||||
def get(self, cr, obj, ids, name, user=None, offset=0, context=None, values=None):
|
||||
if not context:
|
||||
context = {}
|
||||
if not values:
|
||||
values = {}
|
||||
res = {}
|
||||
for id in ids:
|
||||
res[id] = []
|
||||
for id in ids:
|
||||
query = "select project_id from event_event where id = %i" %id
|
||||
cr.execute(query)
|
||||
project_ids = [ x[0] for x in cr.fetchall()]
|
||||
ids2 = obj.pool.get(self._obj).search(cr, user, [(self._fields_id,'in',project_ids),('state','<>','done')], limit=self._limit)
|
||||
for r in obj.pool.get(self._obj)._read_flat(cr, user, ids2, [self._fields_id], context=context, load='_classic_write'):
|
||||
res[id].append( r['id'] )
|
||||
return res
|
||||
|
||||
class event_type(osv.osv):
|
||||
_name = 'event.type'
|
||||
_description= 'Event type'
|
||||
|
@ -130,9 +112,6 @@ class event(osv.osv):
|
|||
reg_ids = self.pool.get('event.registration').search(cr, uid, [('event_id','=',eve.id)])
|
||||
if reg_ids:
|
||||
self.pool.get('event.registration').write(cr, uid, reg_ids, {'date_deadline':vals['date_begin']})
|
||||
#change the date of the project
|
||||
if eve.project_id:
|
||||
self.pool.get('project.project').write(cr, uid, [eve.project_id.id], {'date_end':eve.date_begin})
|
||||
|
||||
#change the description of the registration linked to this event
|
||||
if 'mail_auto_confirm' in vals:
|
||||
|
@ -156,8 +135,6 @@ class event(osv.osv):
|
|||
'register_min': fields.integer('Minimum Registrations'),
|
||||
'register_current': fields.function(_get_register, method=True, string='Confirmed Registrations'),
|
||||
'register_prospect': fields.function(_get_prospect, method=True, string='Unconfirmed Registrations'),
|
||||
'project_id': fields.many2one('project.project', 'Project', readonly=True),
|
||||
'task_ids': one2many_mod_task('project.task', 'project_id', "Project tasks", readonly=True, domain="[('state','<>', 'done')]"),
|
||||
'date_begin': fields.datetime('Beginning date', required=True),
|
||||
'date_end': fields.datetime('Ending date', required=True),
|
||||
'state': fields.selection([('draft','Draft'),('confirm','Confirmed'),('done','Done'),('cancel','Canceled')], 'Status', readonly=True, required=True),
|
||||
|
@ -178,7 +155,7 @@ event()
|
|||
class event_registration(osv.osv):
|
||||
|
||||
def _history(self, cr, uid,ids,keyword, history=False, email=False, context={}):
|
||||
for case in ids:
|
||||
for case in self.browse(cr, uid, ids):
|
||||
data = {
|
||||
'name': keyword,
|
||||
'som': case.som.id,
|
||||
|
@ -192,14 +169,12 @@ class event_registration(osv.osv):
|
|||
|
||||
def button_reg_close(self, cr, uid, ids, *args):
|
||||
self.write(cr, uid, ids, {'state':'done',})
|
||||
cases = self.browse(cr, uid, ids)
|
||||
self._history(cr, uid, cases, 'Done', history=True)
|
||||
self._history(cr, uid, ids, 'Done', history=True)
|
||||
return True
|
||||
|
||||
def button_reg_cancel(self, cr, uid, ids, *args):
|
||||
self.write(cr, uid, ids, {'state':'cancel',})
|
||||
cases = self.browse(cr, uid, ids)
|
||||
self._history(cr, uid, cases, 'Cancel', history=True)
|
||||
self._history(cr, uid, ids, 'Cancel', history=True)
|
||||
return True
|
||||
|
||||
def create(self, cr, uid, *args, **argv):
|
||||
|
@ -208,7 +183,7 @@ class event_registration(osv.osv):
|
|||
args[0]['date_deadline']= event.date_begin
|
||||
args[0]['description']= event.mail_confirm
|
||||
res = super(event_registration, self).create(cr, uid, *args, **argv)
|
||||
self._history(cr, uid,self.browse(cr, uid, [res]), 'Created', history=True)
|
||||
self._history(cr, uid,[res], 'Created', history=True)
|
||||
return res
|
||||
|
||||
def write(self, cr, uid, *args, **argv):
|
||||
|
|
|
@ -71,9 +71,6 @@
|
|||
<field name="register_min" select="2"/>
|
||||
<field name="register_max" select="2"/>
|
||||
<field name="budget_id"/>
|
||||
<separator string="Tasks management" colspan="4"/>
|
||||
<field name="project_id"/>
|
||||
<button string="Create Retro-Planning" name="%(event.event_wiz)d" type="action"/>
|
||||
<separator string="Status" colspan="4"/>
|
||||
<field name="state" select="1"/>
|
||||
<group col="4" colspan="2">
|
||||
|
@ -99,18 +96,6 @@
|
|||
<separator string="Registrations" colspan="4"/>
|
||||
<field name="register_current"/>
|
||||
<field name="register_prospect"/>
|
||||
<separator string="Remaining Tasks" colspan="4"/>
|
||||
<field name="task_ids" colspan="4" nolabel="1" widget="one2many_list" >
|
||||
<tree string="All tasks" colors="red:date_deadline<current_date and state=='draft';blue:date_deadline==current_date and state=='draft';grey:state=='cancel' or state=='close'">
|
||||
<field name="sequence"/>
|
||||
<field name="name"/>
|
||||
<field name="user_id" />
|
||||
<field name="date_deadline" />
|
||||
<field name="planned_hours" widget="float_time"/>
|
||||
<field name="effective_hours" widget="float_time"/>
|
||||
<field name="state" />
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
</notebook>
|
||||
</form>
|
||||
|
|
|
@ -1,17 +1,6 @@
|
|||
<?xml version="1.0" ?>
|
||||
<openerp>
|
||||
<data>
|
||||
<wizard string="Project"
|
||||
model="event.event"
|
||||
name="event.project"
|
||||
id="event_wiz"
|
||||
menu="False"/>
|
||||
|
||||
<wizard
|
||||
string="Tasks"
|
||||
model="event.event"
|
||||
name="wizard_event_tasks"
|
||||
id="wizard_event_task"/>
|
||||
|
||||
<wizard
|
||||
string="Registrations"
|
||||
|
|
|
@ -5,4 +5,3 @@
|
|||
"access_event_registration","event.registration","model_event_registration","crm.group_crm_user",1,1,1,1
|
||||
"access_report_event_registration","report.event.registration","model_report_event_registration","crm.group_crm_user",1,0,0,0
|
||||
"access_report_event_type_registration","report.event.type.registration","model_report_event_type_registration","crm.group_crm_user",1,0,0,0
|
||||
"access_project_project_crm_user","project.project crm user","project.model_project_project","crm.group_crm_user",1,0,0,0
|
||||
|
|
|
|
@ -1,6 +1,5 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
import event_registration
|
||||
import project_wizard
|
||||
import make_invoice
|
||||
import event_registrations_partner
|
||||
import confirm_registration
|
||||
|
|
|
@ -53,7 +53,7 @@ def _confirm(self, cr, uid, data, context):
|
|||
def _check_confirm(self, cr, uid, data, context):
|
||||
registration_obj = pooler.get_pool(cr.dbname).get('event.registration')
|
||||
registration_obj.write(cr, uid, [data['id']], {'state':'open',})
|
||||
registration_obj._history(cr, uid, reg, 'Open', history=True)
|
||||
registration_obj._history(cr, uid, [data['id']], 'Open', history=True)
|
||||
registration_obj.mail_user(cr,uid,[data['id']])
|
||||
return {}
|
||||
|
||||
|
|
|
@ -30,35 +30,5 @@ class wizard_event_registration(wizard.interface):
|
|||
}
|
||||
wizard_event_registration("wizard_event_registration")
|
||||
|
||||
def _event_tasks(self, cr, uid, data, context):
|
||||
event_id = data['id']
|
||||
cr.execute('''SELECT project_id FROM event_event WHERE id = %d '''% (event_id, ))
|
||||
res = cr.fetchone()
|
||||
if not res[0]:
|
||||
raise wizard.except_wizard('Error !', 'No project defined for this event.\nYou can create one with the retro-planning button !')
|
||||
value = {
|
||||
'domain': [('project_id', '=', res[0])],
|
||||
'name': 'Tasks',
|
||||
'view_type': 'form',
|
||||
'view_mode': 'tree,form,calendar',
|
||||
'res_model': 'project.task',
|
||||
'context': { },
|
||||
'type': 'ir.actions.act_window'
|
||||
}
|
||||
return value
|
||||
|
||||
class wizard_event_tasks(wizard.interface):
|
||||
states = {
|
||||
'init': {
|
||||
'actions': [],
|
||||
'result': {
|
||||
'type': 'action',
|
||||
'action': _event_tasks,
|
||||
'state': 'end'
|
||||
}
|
||||
},
|
||||
}
|
||||
wizard_event_tasks("wizard_event_tasks")
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
|
|
@ -63,6 +63,7 @@ def _makeInvoices(self, cr, uid, data, context):
|
|||
obj_event_reg=pool_obj.get('event.registration')
|
||||
data_event_reg=obj_event_reg.browse(cr,uid,data['ids'])
|
||||
obj_lines=pool_obj.get('account.invoice.line')
|
||||
partner_address_id = reg.partner_invoice_id and reg.partner_invoice_id.
|
||||
|
||||
for reg in data_event_reg:
|
||||
if reg.state=='draft':
|
||||
|
@ -71,23 +72,23 @@ def _makeInvoices(self, cr, uid, data, context):
|
|||
continue
|
||||
if (not reg.tobe_invoiced):
|
||||
inv_reject = inv_reject + 1
|
||||
inv_rej_reason += "ID "+str(reg.id)+": Registration Cannot Be Invoiced. \n"
|
||||
inv_rej_reason += "ID "+str(reg.id)+": Registration is set as 'Cannot be invoiced'. \n"
|
||||
continue
|
||||
if reg.invoice_id:
|
||||
inv_reject = inv_reject + 1
|
||||
inv_rej_reason += "ID "+str(reg.id)+": Registration Already Has an Invoice Linked. \n"
|
||||
inv_rej_reason += "ID "+str(reg.id)+": Registration already has an invoice linked. \n"
|
||||
continue
|
||||
if not reg.event_id.product_id:
|
||||
inv_reject = inv_reject + 1
|
||||
inv_rej_reason += "ID "+str(reg.id)+": Event Related Doesn't Have any Product. \n"
|
||||
continue
|
||||
if not reg.partner_address_id:
|
||||
inv_reject = inv_reject + 1
|
||||
inv_rej_reason += "ID "+str(reg.id)+": Registration Doesn't Have any Contact. \n"
|
||||
inv_rej_reason += "ID "+str(reg.id)+": Event related doesn't have any product defined. \n"
|
||||
continue
|
||||
if not reg.partner_invoice_id:
|
||||
inv_reject = inv_reject + 1
|
||||
inv_rej_reason += "ID "+str(reg.id)+": Registration Doesn't Have any Partner to Invoice. \n"
|
||||
inv_rej_reason += "ID "+str(reg.id)+": Registration doesn't have any partner to invoice. \n"
|
||||
continue
|
||||
if not partner_address_id:
|
||||
inv_reject = inv_reject + 1
|
||||
inv_rej_reason += "ID "+str(reg.id)+": Registered partner doesn't have an address to make the invoice. \n"
|
||||
continue
|
||||
|
||||
inv_create = inv_create + 1
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
import event
|
||||
import wizard
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
{
|
||||
"name" : "Event - Project",
|
||||
"version" : "0.1",
|
||||
"author" : "Tiny",
|
||||
"category" : "Generic Modules/Association",
|
||||
"description": """Organization and management of events.
|
||||
|
||||
This module allow you to create retro planning for managing your events.
|
||||
""",
|
||||
"depends" : [
|
||||
"project_retro_planning","event",
|
||||
],
|
||||
"demo_xml" : [],
|
||||
"init_xml" : [],
|
||||
"update_xml" : [
|
||||
"event_wizard.xml",
|
||||
"event_view.xml",
|
||||
],
|
||||
"active" : False,
|
||||
"installable" : True,
|
||||
}
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
@ -0,0 +1,73 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Copyright (c) 2007 TINY SPRL. (http://tiny.be) All Rights Reserved.
|
||||
#
|
||||
#
|
||||
# WARNING: This program as such is intended to be used by professional
|
||||
# programmers who take the whole responsability of assessing all potential
|
||||
# consequences resulting from its eventual inadequacies and bugs
|
||||
# End users who are looking for a ready-to-use solution with commercial
|
||||
# garantees and support are strongly adviced to contract a Free Software
|
||||
# Service Company
|
||||
#
|
||||
# This program is Free Software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from osv import fields, osv
|
||||
import time
|
||||
import netsvc
|
||||
import pooler
|
||||
import tools
|
||||
|
||||
|
||||
class one2many_mod_task(fields.one2many):
|
||||
def get(self, cr, obj, ids, name, user=None, offset=0, context=None, values=None):
|
||||
if not context:
|
||||
context = {}
|
||||
if not values:
|
||||
values = {}
|
||||
res = {}
|
||||
for id in ids:
|
||||
res[id] = []
|
||||
for id in ids:
|
||||
query = "select project_id from event_event where id = %i" %id
|
||||
cr.execute(query)
|
||||
project_ids = [ x[0] for x in cr.fetchall()]
|
||||
ids2 = obj.pool.get(self._obj).search(cr, user, [(self._fields_id,'in',project_ids),('state','<>','done')], limit=self._limit)
|
||||
for r in obj.pool.get(self._obj)._read_flat(cr, user, ids2, [self._fields_id], context=context, load='_classic_write'):
|
||||
res[id].append( r['id'] )
|
||||
return res
|
||||
|
||||
class event(osv.osv):
|
||||
_inherit = 'event.event'
|
||||
|
||||
def write(self, cr, uid, ids,vals, *args, **kwargs):
|
||||
if 'date_begin' in vals and vals['date_begin']:
|
||||
for eve in self.browse(cr, uid, ids):
|
||||
self.pool.get('project.project').write(cr, uid, [eve.project_id.id], {'date_end':eve.date_begin})
|
||||
|
||||
return super(event,self).write(cr, uid, ids,vals, *args, **kwargs)
|
||||
|
||||
_columns = {
|
||||
'project_id': fields.many2one('project.project', 'Project', readonly=True),
|
||||
'task_ids': one2many_mod_task('project.task', 'project_id', "Project tasks", readonly=True, domain="[('state','<>', 'done')]"),
|
||||
}
|
||||
event()
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<!-- EVENTS -->
|
||||
|
||||
<record model="ir.ui.view" id="view_event_form_inherited">
|
||||
<field name="name">Events</field>
|
||||
<field name="model">event.event</field>
|
||||
<field name="inherit_id" ref="event.view_event_form"/>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<field name="budget_id" position="after">
|
||||
<separator string="Tasks management" colspan="4"/>
|
||||
<field name="project_id"/>
|
||||
<button string="Create Retro-Planning" name="%(event_wiz)d" type="action"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="view_event_form_inherited2">
|
||||
<field name="name">Events</field>
|
||||
<field name="model">event.event</field>
|
||||
<field name="inherit_id" ref="event.view_event_form"/>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<field name="register_prospect" position="after">
|
||||
<separator string="Remaining Tasks" colspan="4"/>
|
||||
<field name="task_ids" colspan="4" nolabel="1" widget="one2many_list" >
|
||||
<tree string="All tasks" colors="red:date_deadline<current_date and state=='draft';blue:date_deadline==current_date and state=='draft';grey:state=='cancel' or state=='close'">
|
||||
<field name="sequence"/>
|
||||
<field name="name"/>
|
||||
<field name="user_id" />
|
||||
<field name="date_deadline" />
|
||||
<field name="planned_hours" widget="float_time"/>
|
||||
<field name="effective_hours" widget="float_time"/>
|
||||
<field name="state" />
|
||||
</tree>
|
||||
</field>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" ?>
|
||||
<openerp>
|
||||
<data>
|
||||
<wizard string="Project"
|
||||
model="event.event"
|
||||
name="event.project"
|
||||
id="event_wiz"
|
||||
menu="False"/>
|
||||
|
||||
<wizard
|
||||
string="Tasks"
|
||||
model="event.event"
|
||||
name="wizard_event_tasks"
|
||||
id="wizard_event_task"/>
|
||||
|
||||
|
||||
</data>
|
||||
</openerp>
|
|
@ -0,0 +1,6 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
import project_wizard
|
||||
import event_task
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
import wizard
|
||||
import pooler
|
||||
|
||||
def _event_tasks(self, cr, uid, data, context):
|
||||
event_id = data['id']
|
||||
cr.execute('''SELECT project_id FROM event_event WHERE id = %d '''% (event_id, ))
|
||||
res = cr.fetchone()
|
||||
if not res[0]:
|
||||
raise wizard.except_wizard('Error !', 'No project defined for this event.\nYou can create one with the retro-planning button !')
|
||||
value = {
|
||||
'domain': [('project_id', '=', res[0])],
|
||||
'name': 'Tasks',
|
||||
'view_type': 'form',
|
||||
'view_mode': 'tree,form,calendar',
|
||||
'res_model': 'project.task',
|
||||
'context': { },
|
||||
'type': 'ir.actions.act_window'
|
||||
}
|
||||
return value
|
||||
|
||||
class wizard_event_tasks(wizard.interface):
|
||||
states = {
|
||||
'init': {
|
||||
'actions': [],
|
||||
'result': {
|
||||
'type': 'action',
|
||||
'action': _event_tasks,
|
||||
'state': 'end'
|
||||
}
|
||||
},
|
||||
}
|
||||
wizard_event_tasks("wizard_event_tasks")
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
Loading…
Reference in New Issue