bzr revid: uco@tinyerp.com-20100716122448-uldbresnotc6kbga
This commit is contained in:
uco
2010-07-16 17:54:48 +05:30
48 changed files with 609 additions and 758 deletions
+2 -2
View File
@@ -124,8 +124,8 @@ write({'state':'cancel'})</field>
<field name="act_to" ref="act_cancel"/>
<field name="signal">invoice_cancel</field>
</record>
<record id="open_test_to_paid" model="workflow.transition">
<record id="open_test_to_paid" model="workflow.transition">
<field name="act_from" ref="act_open_test"/>
<field name="act_to" ref="act_paid"/>
<field name="trigger_model">account.move.line</field>
+5 -5
View File
@@ -892,7 +892,7 @@ class account_invoice(osv.osv):
self.write(cr, uid, [inv.id], {'move_id': move_id,'period_id':period_id, 'move_name':new_move_name})
self.pool.get('account.move').post(cr, uid, [move_id])
self._log_event(cr, uid, ids)
return True
def line_get_convert(self, cr, uid, x, part, date, context=None):
@@ -925,11 +925,11 @@ class account_invoice(osv.osv):
reference = obj_inv.reference
if not number:
tmp_context = {
'fiscalyear_id': inv.period_id.fiscalyear_id.id
'fiscalyear_id': obj_inv.period_id.fiscalyear_id.id
}
if inv.journal_id.invoice_sequence_id:
sequence_id = inv.journal_id.invoice_sequence_id.id
number = self.pool.get('ir.sequence').get_id(cr, uid,
if obj_inv.journal_id.invoice_sequence_id:
sequence_id = obj_inv.journal_id.invoice_sequence_id.id
number = self.pool.get('ir.sequence').get_id(cr, uid,
sequence_id,
'id',
context=tmp_context)
+1 -1
View File
@@ -266,7 +266,7 @@ class general_ledger(rml_parse.rml_parse):
JOIN account_journal j on (l.journal_id=j.id)
WHERE %s AND l.account_id = %%s AND l.date<=%%s AND l.date>=%%s ORDER by %s
""" % (self.query, sql_sort)
self.cr.execute(sql, (account.id, self.date_borne['max_date'], self.date_borne['min_date']))
self.cr.execute(sql, (account.id, self.date_borne['max_date'], self.date_borne['min_date']))
res = self.cr.dictfetchall()
account_sum = 0.0
account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
+1 -1
View File
@@ -5,7 +5,7 @@
<report auto="False" id="report_print_indicators" model="account.report.history" name="print.indicators" rml="account_report/report/print_indicator.rml" string="Indicators"/>
<report
<report
auto="False"
id="report_indicator_pdf"
menu="False"
@@ -1,16 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="board_account_report_form" model="ir.ui.view">
<field name="name">board.account.report.form</field>
<field name="model">board.board</field>
<field name="inherit_id" ref="account.board_account_form"/>
<field name="inherit_id" ref="account.board_account_form"/>
<field name="type">form</field>
<field name="arch" type="xml">
<xpath expr="/form/hpaned/child2" position="inside">
<button colspan="4" icon="terp-purchase" name="%(account_report.action_account_report_tree_view_indicator)d" string="My indicators" type="action"/>
</xpath>
<xpath expr="/form/vpaned/child1" position="inside">
<button colspan="4" icon="terp-purchase" name="%(account_report.action_account_report_tree_view_indicator)d" string="My indicators" type="action"/>
</xpath>
</field>
</record>
</data>
+1 -2
View File
@@ -151,8 +151,7 @@ and users"),
\nIf the case is in progress the state is set to \'Open\'.\
\nWhen the case is over, the state is set to \'Done\'.\
\nIf the case needs to be reviewed then the state is set to \'Pending\'.'),
'message_ids': fields.one2many('mailgate.message', 'res_id', 'Messages', domain=[('history', '=', True),('model','=',_name)], readonly=True),
'log_ids': fields.one2many('mailgate.message', 'res_id', 'Logs', domain=[('history', '=', False),('model','=',_name)], readonly=True),
'message_ids': fields.one2many('mailgate.message', 'res_id', 'Messages', domain=[('model','=',_name)], readonly=True),
'partner_assigned_id': fields.many2one('res.partner', 'Assigned Partner', help="Partner this case has been forwarded/assigned to.", select=True),
'date_assign': fields.date('Assignation Date', help="Last date this case was forwarded/assigned to a partner"),
}
+15 -14
View File
@@ -154,12 +154,19 @@
<field name="day_close"/>
</group>
</page>
<page string="Emails" groups="base.group_extended">
<page string="History" groups="base.group_extended">
<group colspan="4">
<field colspan="4" name="email_cc" string="CC" widget="char" size="512"/>
<field colspan="4" name="email_cc" string="Global CC" widget="char" size="512"/>
</group>
<!-- TODO-->
<field name="message_ids" colspan="4" nolabel="1" mode="form,tree">
<field name="message_ids" colspan="4" nolabel="1" mode="tree,form">
<tree string="Communication history">
<field name="display_text" string="History Information"/>
<button
string="Reply"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'crm.lead', 'include_original' : True}"
icon="gtk-undo" type="action" />
</tree>
<form string="Communication history">
<group col="4" colspan="4">
<field name="email_from"/>
@@ -177,17 +184,11 @@
</page>
</notebook>
<button colspan="4"
string="Reply"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'crm.lead', 'include_original' : True}"
icon="gtk-undo" type="action" />
string="Reply"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'crm.lead', 'include_original' : True}"
icon="gtk-undo" type="action" />
</form>
<tree string="Communication history">
<field name="date"/>
<field name="email_from" />
<field name="email_to"/>
<field name="description"/>
</tree>
</field>
<button colspan="2" string="Send New Email"
name="%(crm.action_crm_send_mail)d"
+1 -2
View File
@@ -68,8 +68,7 @@ class crm_meeting(osv.osv, crm_case):
'event_id', 'attendee_id', 'Attendees', states={'done': [('readonly', True)]}),
'date_closed': fields.datetime('Closed', readonly=True),
'date_deadline': fields.datetime('Deadline', states={'done': [('readonly', True)]}),
'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)]),
'message_ids': fields.one2many('mailgate.message', 'res_id', 'Messages', domain=[('model','=',_name)]),
'state': fields.selection([('open', 'Confirmed'),
('draft', 'Unconfirmed'),
('cancel', 'Cancelled'),
+16 -27
View File
@@ -116,11 +116,19 @@
</group>
</page>
<page string="Emails" groups="base.group_extended">
<page string="History" groups="base.group_extended">
<group colspan="4">
<field colspan="4" name="email_cc" string="Cc" widget="char" size="512"/>
<field colspan="4" name="email_cc" string="Global CC" widget="char" size="512"/>
</group>
<field name="message_ids" colspan="4" nolabel="1" mode="form,tree" height="280">
<field name="message_ids" colspan="4" nolabel="1" mode="tree,form">
<tree string="Communication history">
<field name="display_text" string="History Information"/>
<button
string="Reply"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'crm.lead', 'include_original' : True}"
icon="gtk-undo" type="action" />
</tree>
<form string="Communication history">
<group col="4" colspan="4">
<field name="email_from"/>
@@ -138,17 +146,11 @@
</page>
</notebook>
<button colspan="4"
string="Reply to Last Email"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'crm.lead', 'include_original' : True}"
icon="gtk-undo" type="action" />
string="Reply"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'crm.lead', 'include_original' : True}"
icon="gtk-undo" type="action" />
</form>
<tree string="Communication history">
<field name="date"/>
<field name="email_from" />
<field name="email_to"/>
<field name="description"/>
</tree>
</field>
<button colspan="2" string="Send New Email"
name="%(crm.action_crm_send_mail)d"
@@ -158,7 +160,7 @@
name="%(crm_lead_forward_to_partner_act)d"
icon="gtk-go-forward" type="action" />
</page>
<page string="History" groups="base.group_extended">
<page string="Extra Info" groups="base.group_extended">
<group col="2" colspan="2">
<separator string="Dates" colspan="2"/>
<field name="create_date"/>
@@ -176,19 +178,6 @@
<separator colspan="4" string="References"/>
<field name="ref"/>
<field name="ref2"/>
<field name="log_ids" nolabel="1" colspan="4">
<tree string="Logs">
<field name="name" colspan="4"/>
<field name="date"/>
<field name="user_id"/>
</tree>
<form string="Logs">
<separator string="Action Information" colspan="4"/>
<field name="name" colspan="4"/>
<field name="date"/>
<field name="user_id"/>
</form>
</field>
</page>
<page string="Assignation" groups="base.group_extended">
<group name="partner_assign_group" col="5" colspan="4">
+1 -2
View File
@@ -82,8 +82,7 @@ class crm_phonecall(osv.osv, crm_case):
'date_closed': fields.datetime('Closed', readonly=True),
'date': fields.datetime('Date'),
'opportunity_id': fields.many2one ('crm.lead', 'Opportunity'),
'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)]),
'message_ids': fields.one2many('mailgate.message', 'res_id', 'Messages', domain=[('model','=',_name)]),
}
_defaults = {
+33 -64
View File
@@ -229,26 +229,6 @@
<field name="view_id" ref="crm_case_section_view_tree"/>
</record>
<!-- Cases Tree View -->
<record id="crm_case_log_tree-view" model="ir.ui.view">
<field name="name">crm.case.log.tree</field>
<field name="model">crm.case.log</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Case logs">
<field name="date"/>
<field name="name"/>
<field name="user_id"/>
<field name="section_id"/>
<!--
<field name="som"/>
<field name="canal_id"/>
-->
</tree>
</field>
</record>
<!-- Segmentation line Tree View -->
<record id="crm_segmentation_line_tree-view" model="ir.ui.view">
@@ -564,54 +544,43 @@
<field name="active" select="2"/>
<separator colspan="4" string="References"/>
<field colspan="4" name="ref"/>
<field colspan="4" name="log_ids" nolabel="1">
<tree string="Logs">
<field name="name" colspan="4"/>
<field name="date"/>
<field name="user_id"/>
</tree>
<form string="Logs">
<separator string="Action Information" colspan="4"/>
<field name="name" colspan="4"/>
<field name="date"/>
<field name="user_id"/>
</form>
</field>
</page>
<page string="Emails" groups="base.group_extended">
<group colspan="4">
<field colspan="4" name="email_cc" string="CC" widget="char" size="512"/>
<field colspan="4" name="email_cc" string="Global CC" widget="char" size="512"/>
</group>
<field name="message_ids" colspan="4" nolabel="1" mode="form,tree">
<form string="Communication history">
<group col="4" colspan="4">
<field name="email_from"/>
<field name="date"/>
<field name="email_to" widget="char" size="512"/>
<field name="email_cc" widget="char" size="512"/>
<field name="name" colspan="4" widget="char" size="512"/>
</group>
<notebook colspan="4">
<page string="Details">
<field name="description" colspan="4" nolabel="1"/>
</page>
<page string="Attachments">
<field name="attachment_ids" colspan="4" readonly="1" nolabel="1"/>
</page>
</notebook>
<button colspan="4"
string="Reply"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'crm.case.custom', 'include_original' : True}"
icon="gtk-undo" type="action" />
</form>
<tree string="Communication history">
<field name="date"/>
<field name="email_from" />
<field name="email_to"/>
<field name="description"/>
</tree>
</field>
<field name="message_ids" colspan="4" nolabel="1" mode="tree,form">
<tree string="Communication history">
<field name="display_text" string="History Information"/>
<button
string="Reply"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'crm.case.custom', 'include_original' : True}"
icon="gtk-undo" type="action" />
</tree>
<form string="Communication history">
<group col="4" colspan="4">
<field name="email_from"/>
<field name="date"/>
<field name="email_to" widget="char" size="512"/>
<field name="email_cc" widget="char" size="512"/>
<field name="name" colspan="4" widget="char" size="512"/>
</group>
<notebook colspan="4">
<page string="Details">
<field name="description" colspan="4" nolabel="1"/>
</page>
<page string="Attachments">
<field name="attachment_ids" colspan="4" readonly="1" nolabel="1"/>
</page>
</notebook>
<button colspan="4"
string="Reply"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'crm.case.custom', 'include_original' : True}"
icon="gtk-undo" type="action" />
</form>
</field>
<button colspan="2" string="Send New Email"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'new', 'model': 'crm.case.custom'}"
+3 -2
View File
@@ -126,11 +126,12 @@ class crm_lead_forward_to_partner(osv.osv_memory):
elif history_type == 'whole':
log_ids = model_pool.browse(cr, uid, res_id, context=context).message_ids
log_ids = [x.id for x in log_ids]
log_ids = map(lambda x: x.id, filter(lambda x: x.history, log_ids))
msg_val = case_info + '\n\n' + self.get_whole_history(cr, uid, log_ids, context=context)
elif history_type == 'latest':
log_ids = model_pool.browse(cr, uid, res_id, context=context).message_ids
log_ids = filter(lambda x: x.history and x.id, log_ids)
if not log_ids:
msg_val = case_info
else:
@@ -227,7 +228,7 @@ class crm_lead_forward_to_partner(osv.osv_memory):
elif lead.type == 'opportunity':
pa = lead.partner_address_id
body = [
"Partner: %s" % (lead.partner_id.name_get()[0][1]),
"Partner: %s" % (lead.partner_id and lead.partner_id.name_get()[0][1]),
"Contact: %s" % (pa.name or ''),
"Title: %s" % (pa.title or ''),
"Function: %s" % (pa.function and pa.function.name_get()[0][1] or ''),
+3 -2
View File
@@ -105,7 +105,7 @@ class crm_send_new_email(osv.osv_memory):
ref_id = hist.ref_id
case = case_pool.browse(cr, uid, res_id, context=context)
emails = [obj.email_to]
email_cc = re.findall(r'([^ ,<@]+@[^> ,]+)', obj.email_cc)
email_cc = re.findall(r'([^ ,<@]+@[^> ,]+)', obj.email_cc or '')
emails = filter(None, emails)
body = obj.body
@@ -233,7 +233,8 @@ class crm_send_new_email(osv.osv_memory):
if 'subject' in fields:
res.update({u'subject': u'Re: %s' %(tools.ustr(hist.name or ''))})
if 'email_cc' in fields:
res.update({'email_cc': case.email_cc and tools.ustr(case.email_cc) or False})
email_cc = (case.email_cc and tools.ustr(case.email_cc) + ', ' or '') + (hist.email_cc or '')
res.update({'email_cc': email_cc})
if 'reply_to' in fields:
res.update({'reply_to': case.section_id.reply_to})
if 'state' in fields:
+2 -2
View File
@@ -22,6 +22,7 @@
from osv import fields, osv
from crm import crm
import time
class crm_claim(osv.osv, crm.crm_case):
"""
Crm claim
@@ -86,8 +87,7 @@ class crm_claim(osv.osv, crm.crm_case):
\nIf the case is in progress the state is set to \'Open\'.\
\nWhen the case is over, the state is set to \'Done\'.\
\nIf the case needs to be reviewed then the state is set to \'Pending\'.'),
'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)]),
'message_ids': fields.one2many('mailgate.message', 'res_id', 'Messages', domain=[('model','=',_name)]),
}
_defaults = {
+21 -30
View File
@@ -164,16 +164,26 @@
type="object" icon="gtk-convert" />
</group>
</page>
<page string="Emails" groups="base.group_extended">
<page string="History" groups="base.group_extended">
<group colspan="4">
<field colspan="4" name="email_cc" string="CC"/>
<field colspan="4" name="email_cc" string="Global CC" widget="char"/>
</group>
<field name="message_ids" colspan="4" nolabel="1" mode="form,tree" height="280">
<field name="message_ids" colspan="4" nolabel="1" mode="tree,form">
<tree string="Communication history">
<field name="display_text" string="History Information"/>
<button
string="Reply"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'crm.claim', 'include_original' : True}"
icon="gtk-undo" type="action" />
</tree>
<form string="Communication history">
<group col="6" colspan="4">
<field name="date"/>
<field name="email_to"/>
<group col="4" colspan="4">
<field name="email_from"/>
<field name="date"/>
<field name="email_to" widget="char" size="512"/>
<field name="email_cc" widget="char" size="512"/>
<field name="name" colspan="4" widget="char" size="512"/>
</group>
<notebook colspan="4">
<page string="Details">
@@ -184,24 +194,18 @@
</page>
</notebook>
<button colspan="4"
string="Reply to Last Email"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'crm.lead'}"
icon="terp-mail-replied" type="action" />
string="Reply"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'crm.claim', 'include_original' : True}"
icon="gtk-undo" type="action" />
</form>
<tree string="Communication history">
<field name="date"/>
<field name="email_from" />
<field name="email_to"/>
<field name="description"/>
</tree>
</field>
<button colspan="4" string="Send New Email"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'new', 'model': 'crm.claim'}"
icon="terp-mail-message-new" type="action" />
</page>
<page string="History" groups="base.group_extended">
<page string="Extra Info" groups="base.group_extended">
<field name="id" select="1"/>
<field name="active"/>
<field name="canal_id"/>
@@ -209,19 +213,6 @@
<separator colspan="4" string="Dates"/>
<field name="create_date"/>
<field name="date_closed"/>
<field name="log_ids" nolabel="1" colspan="4">
<tree string="Logs">
<field name="name" colspan="4"/>
<field name="date"/>
<field name="user_id"/>
</tree>
<form string="Logs">
<separator string="Action Information" colspan="4"/>
<field name="name" colspan="4"/>
<field name="date"/>
<field name="user_id"/>
</form>
</field>
</page>
</notebook>
</group>
+1 -2
View File
@@ -85,8 +85,7 @@ class crm_fundraising(osv.osv, crm.crm_case):
\nIf the case is in progress the state is set to \'Open\'.\
\nWhen the case is over, the state is set to \'Done\'.\
\nIf the case needs to be reviewed then the state is set to \'Pending\'.'),
'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)]),
'message_ids': fields.one2many('mailgate.message', 'res_id', 'Messages', domain=[('model','=',_name)]),
}
_defaults = {
+21 -30
View File
@@ -154,16 +154,26 @@
type="object" icon="gtk-convert" />
</group>
</page>
<page string="Emails" groups="base.group_extended">
<page string="History" groups="base.group_extended">
<group colspan="4">
<field colspan="4" name="email_cc" string="CC"/>
<field colspan="4" name="email_cc" string="Global CC" widget="char"/>
</group>
<field name="message_ids" colspan="4" nolabel="1" mode="form,tree">
<field name="message_ids" colspan="4" nolabel="1" mode="tree,form">
<tree string="Communication history">
<field name="display_text" string="History Information"/>
<button
string="Reply"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'crm.fundraising', 'include_original' : True}"
icon="gtk-undo" type="action" />
</tree>
<form string="Communication history">
<group col="6" colspan="4">
<field name="date"/>
<field name="email_to"/>
<group col="4" colspan="4">
<field name="email_from"/>
<field name="date"/>
<field name="email_to" widget="char" size="512"/>
<field name="email_cc" widget="char" size="512"/>
<field name="name" colspan="4" widget="char" size="512"/>
</group>
<notebook colspan="4">
<page string="Details">
@@ -174,24 +184,18 @@
</page>
</notebook>
<button colspan="4"
string="Reply to Last Email"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'crm.fundraising'}"
icon="gtk-undo" type="action" />
string="Reply"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'crm.fundraising', 'include_original' : True}"
icon="gtk-undo" type="action" />
</form>
<tree string="Communication history">
<field name="date"/>
<field name="email_from" />
<field name="email_to"/>
<field name="description"/>
</tree>
</field>
<button colspan="4" string="Send New Email"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'new', 'model': 'crm.fundraising'}"
icon="gtk-go-forward" type="action" />
</page>
<page string="History" groups="base.group_extended">
<page string="Extra Info" groups="base.group_extended">
<group col="2" colspan="2">
<separator colspan="4" string="Misc"/>
<field name="active"/>
@@ -212,19 +216,6 @@
<field colspan="4" name="ref"/>
<field colspan="4" name="ref2"/>
</group>
<field name="log_ids" nolabel="1" colspan="4">
<tree string="Logs">
<field name="name" colspan="4"/>
<field name="date"/>
<field name="user_id"/>
</tree>
<form string="Logs">
<separator string="Action Information" colspan="4"/>
<field name="name" colspan="4"/>
<field name="date"/>
<field name="user_id"/>
</form>
</field>
</page>
</notebook>
</form>
+1 -2
View File
@@ -75,8 +75,7 @@ class crm_helpdesk(osv.osv, crm.crm_case):
\nIf the case is in progress the state is set to \'Open\'.\
\nWhen the case is over, the state is set to \'Done\'.\
\nIf the case needs to be reviewed then the state is set to \'Pending\'.'),
'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)]),
'message_ids': fields.one2many('mailgate.message', 'res_id', 'Messages', domain=[('model','=',_name)]),
}
_defaults = {
+21 -30
View File
@@ -92,16 +92,26 @@
icon="gtk-convert" />
</group>
</page>
<page string="Emails" groups="base.group_extended">
<page string="History" groups="base.group_extended">
<group colspan="4">
<field colspan="4" name="email_cc" string="CC"/>
<field colspan="4" name="email_cc" string="Global CC" widget="char"/>
</group>
<field name="message_ids" colspan="4" nolabel="1" mode="form,tree">
<field name="message_ids" colspan="4" nolabel="1" mode="tree,form">
<tree string="Communication history">
<field name="display_text" string="History Information"/>
<button
string="Reply"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'crm.helpdesk', 'include_original' : True}"
icon="gtk-undo" type="action" />
</tree>
<form string="Communication history">
<group col="6" colspan="4">
<field name="date"/>
<field name="email_to"/>
<group col="4" colspan="4">
<field name="email_from"/>
<field name="date"/>
<field name="email_to" widget="char" size="512"/>
<field name="email_cc" widget="char" size="512"/>
<field name="name" colspan="4" widget="char" size="512"/>
</group>
<notebook colspan="4">
<page string="Details">
@@ -112,24 +122,18 @@
</page>
</notebook>
<button colspan="4"
string="Reply to Last Email"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'crm.helpdesk'}"
icon="gtk-undo" type="action" />
string="Reply"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'crm.helpdesk', 'include_original' : True}"
icon="gtk-undo" type="action" />
</form>
<tree string="Communication history">
<field name="date"/>
<field name="email_from" />
<field name="email_to"/>
<field name="description"/>
</tree>
</field>
<button colspan="4" string="Send New Email"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'new', 'model': 'crm.helpdesk'}"
icon="gtk-go-forward" type="action" />
</page>
<page string="History" groups="base.group_extended">
<page string="Extra Info" groups="base.group_extended">
<group colspan="2" col="2">
<separator colspan="4" string="Dates"/>
<field name="create_date"/>
@@ -150,19 +154,6 @@
<field colspan="4" name="ref"/>
<field colspan="4" name="ref2"/>
</group>
<field colspan="4" name="log_ids" nolabel="1">
<tree string="Logs">
<field name="name" colspan="4"/>
<field name="date"/>
<field name="user_id"/>
</tree>
<form string="Logs">
<separator string="Action Information" colspan="4"/>
<field name="name" colspan="4"/>
<field name="date"/>
<field name="user_id"/>
</form>
</field>
</page>
</notebook>
</form>
+6 -4
View File
@@ -133,11 +133,13 @@ class email_template(osv.osv):
string="Enforce From Account",
help="Emails will be sent only from this account(which are approved)."),
'from_email' : fields.related('enforce_from_account', 'email_id',
type='char', string='From',),
type='char', string='From',
help='From Email (select mail account)',
readonly=True),
'def_to':fields.char(
'Recepient (To)',
'Recipient (To)',
size=250,
help="The default recepient of email."
help="The default recipient of email."
"Placeholders can be used here."),
'def_cc':fields.char(
'Default CC',
@@ -172,7 +174,7 @@ class email_template(osv.osv):
'use_sign':fields.boolean(
'Signature',
help="the signature from the User details"
"will be appened to the mail"),
" will be appended to the mail"),
'file_name':fields.char(
'File Name Pattern',
size=200,
+10 -10
View File
@@ -59,21 +59,23 @@ class email_template_account(osv.osv):
'user':fields.many2one('res.users',
'Related User', required=True,
readonly=True, states={'draft':[('readonly', False)]}),
'email_id': fields.char('Email ID',
'email_id': fields.char('From Email',
size=120, required=True,
readonly=True, states={'draft':[('readonly', False)]} ,
help=" eg:yourname@yourdomain.com "),
help="eg: yourname@yourdomain.com "),
'smtpserver': fields.char('Server',
size=120, required=True,
readonly=True, states={'draft':[('readonly', False)]},
help="Enter name of outgoing server,eg:smtp.gmail.com "),
help="Enter name of outgoing server, eg:smtp.gmail.com "),
'smtpport': fields.integer('SMTP Port ',
size=64, required=True,
readonly=True, states={'draft':[('readonly', False)]},
help="Enter port number,eg:SMTP-587 "),
'smtpuname': fields.char('User Name',
size=120, required=False,
readonly=True, states={'draft':[('readonly', False)]}),
readonly=True, states={'draft':[('readonly', False)]},
help="Specify the username if your SMTP server requires authentication, "
"otherwise leave it empty."),
'smtppass': fields.char('Password',
size=120, invisible=True,
required=False, readonly=True,
@@ -91,11 +93,11 @@ class email_template_account(osv.osv):
'company':fields.selection([
('yes', 'Yes'),
('no', 'No')
], 'Company Mail A/c',
], 'Corporate',
readonly=True,
help="Select if this mail account does not belong" \
"to specific user but the organisation as a whole." \
"eg:info@somedomain.com",
help="Select if this mail account does not belong " \
"to specific user but to the organization as a whole. " \
"eg: info@companydomain.com",
required=True, states={
'draft':[('readonly', False)]
}),
@@ -316,8 +318,6 @@ class email_template_account(osv.osv):
msg['To'] = u','.join(addresses_l['To'])
if addresses_l['CC']:
msg['CC'] = u','.join(addresses_l['CC'])
# if addresses_l['BCC']:
# msg['BCC'] = u','.join(addresses_l['BCC'])
if body.get('text', False):
temp_body_text = body.get('text', '')
l = len(temp_body_text.replace(' ', '').replace('\r', '').replace('\n', ''))
@@ -24,7 +24,7 @@
<field name="smtpssl" select="2" colspan="2" />
<field name="smtptls" select="2" colspan="2" />
</group>
<button name="check_outgoing_connection" type="object" string="Check Outgoing Connection" />
<button name="check_outgoing_connection" type="object" string="Test Outgoing Connection" />
<separator string="User Information" colspan="4" />
<group col="2" colspan="2">
<field name="email_id" select="1" on_change="on_change_emailid(name,email_id)" colspan="2" />
+3 -6
View File
@@ -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',
-11
View File
@@ -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>
+147 -164
View File
@@ -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
@@ -77,20 +76,22 @@ class event_event(osv.osv):
return self.write(cr, uid, ids, {'state': 'cancel'}, context=context)
def button_done(self, cr, uid, ids, context=None):
if type(ids) in (int, long,):
ids = [ids]
return self.write(cr, uid, ids, {'state': 'done'}, context=context)
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):
@@ -99,6 +100,8 @@ class event_event(osv.osv):
@param context: A standard dictionary for contextual values
@return: True
"""
if type(ids) in (int, long,):
ids = [ids]
data_pool = self.pool.get('ir.model.data')
unconfirmed_ids = []
for event in self.browse(cr, uid, ids, context=context):
@@ -113,26 +116,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 +146,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):
@@ -189,37 +192,37 @@ class event_event(osv.osv):
return res
_columns = {
'name': fields.char('Name', size=64, required=True, translate=True, readonly=False, states={'done': [('readonly', True)]}),
'name': fields.char('Summary', size=64, required=True, translate=True, readonly=False, states={'done': [('readonly', True)]}),
'user_id': fields.many2one('res.users', 'Responsible User', readonly=False, states={'done': [('readonly', True)]}),
'parent_id': fields.many2one('event.event', 'Parent Event', readonly=False, states={'done': [('readonly', True)]}),
'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 +232,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 +263,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 +278,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,58 +296,59 @@ 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)]),
'message_ids': fields.one2many('mailgate.message', 'res_id', 'Messages', domain=[('model','=',_name)]),
'log_ids': fields.one2many('mailgate.message', 'res_id', 'Logs', domain=[('history', '=', False),('model','=',_name)]),
'date_deadline': fields.related('event_id','date_end', type='datetime', string="End Date", readonly=True, store=True),
'date': fields.related('event_id', 'date_begin', type='datetime', string="Start Date", readonly=True, store=True),
'section_id': fields.related('event_id', 'section_id', type='many2one', relation='crm.case.section', string='Sale Team', store=True, readonly=True, states={'draft':[('readonly',False)]}),
'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,
'date': time.strftime('%Y-%m-%d %H:%M:%S')
'nb_register': 1,
'tobe_invoiced': True,
}
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 +371,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 +389,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 +431,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 +456,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,56 +487,34 @@ 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'})
return True
def create(self, cr, uid, values, context=None):
""" Overrides orm create method.
"""
event_obj = self.pool.get('event.event')
event = event_obj.browse(cr, uid, values['event_id'], context=context)
values['date_deadline']= event.date_begin
values['description']= event.mail_confirm
res = super(event_registration, self).create(cr, uid, values, context=context)
registrations = self.browse(cr, uid, [res], context=context)
self._history(cr, uid, registrations, _('Created'))
return res
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)
values['date_deadline']= event.date_begin
values['description']= event.mail_confirm
return super(event_registration, self).write(cr, uid, ids, values, context=context)
return True
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 +542,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 +573,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,18 +589,19 @@ 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')
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}}
res = {'value': {'unit_price': False, 'event_product': False, 'user_id': False,
'date': data_event.date_begin, 'date_deadline': data_event.date_end, 'description': data_event.note, 'name': data_event.name}}
if data_event.user_id.id:
res['value'].update({'user_id':data_event.user_id.id})
if data_event.product_id:
@@ -627,7 +610,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 +624,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 +642,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 +659,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 +670,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 +680,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()
-6
View File
@@ -1,6 +0,0 @@
<?xml version="1.0"?>
<openerp>
<data>
</data>
</openerp>
+3 -5
View File
@@ -62,7 +62,6 @@
<field name="user_id" ref="base.user_root"/>
<field name="register_max">500</field>
<field name="type" ref="event_type_1"/>
<field name="state">draft</field>
</record>
<record id="event_1" model="event.event">
@@ -74,9 +73,8 @@
<field name="type" ref="event_type_1"/>
<field name="user_id" ref="base.user_root"/>
<field name="register_max">350</field>
<field name="state">confirm</field>
</record>
<function model="event.event" name="button_confirm" eval="[ref('event_1')]"/>
<record id="event_2" model="event.event">
<field name="name">Conference on ERP Buisness</field>
<field eval="time.strftime('%Y-%m-05 14:00:00')" name="date_begin"/>
@@ -88,10 +86,10 @@
<field name="user_id" ref="base.user_root"/>
<field name="mail_auto_registr">True</field>
<field name="mail_auto_confirm">True</field>
<field name="state">done</field>
<field name="mail_registr">Thanks for registrering. We will keep you informed of the modalities.</field>
<field name="mail_confirm">Thanks for registrering. The conference will begin at 2 PM and will be given by Mister Pinckaers.</field>
</record>
<function model="event.event" name="button_confirm" eval="[ref('event_2')]"/>
<function model="event.event" name="button_done" eval="[ref('event_2')]"/>
</data>
</openerp>
-21
View File
@@ -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>
+87 -84
View File
@@ -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"/>
<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"/>
<group colspan="4" col="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,14 +64,16 @@
<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>
<separator string="Description" colspan="4"/>
<field name="note" colspan="4" nolabel="1"/>
<field name="state" select="1"/>
<group col="4" colspan="2">
<button string="Confirm Event" name="button_confirm" states="draft" type="object" icon="gtk-apply"/>
@@ -79,24 +81,24 @@
<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"/>
<field name="register_prospect"/>
<field name="registration_ids" colspan="4" nolabel="1">
<field name="registration_ids" colspan="4" nolabel="1" readonly="1">
<form string="Registration">
<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"/>
@@ -112,8 +114,8 @@
<button name="button_reg_cancel" string="Cancel Registration" states="draft,open" type="object" icon="gtk-cancel"/>
</group>
</form>
<tree string="Registration" editable="bottom">
<field name="date" string="Date"/>
<tree string="Registration">
<field name="create_date" string="Registration Date"/>
<field name="partner_id" required="1" string="Partner" on_change="onchange_partner_id(partner_id,event_id)"/>
<field name="event_product"/>
<field name="nb_register"/>
@@ -145,18 +147,14 @@
<separator string="Confirmation Email Body" colspan="2"/>
<field name="mail_confirm" colspan="2" nolabel="1" attrs="{'readonly':[('mail_auto_confirm','=',False)]}"/>
</group>
</page>
<page string="Notes">
<separator string="Notes" colspan="4"/>
<field name="note" colspan="4" nolabel="1"/>
</page>
</page>
</notebook>
</form>
</field>
</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 +173,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 +192,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 +234,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 +245,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 +255,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 +264,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 +272,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>
@@ -308,26 +306,30 @@
<form string="Registration">
<group col="6" colspan="4">
<field name="event_id" on_change="onchange_event(event_id, partner_invoice_id)" domain="[('state','in',('draft','confirm'))]"/>
<field name="date" string="Registration Date"/>
<field name="create_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">
<field name="date" />
<field name="date_deadline" />
<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>
<separator string="Description" colspan="4"/>
<field name="description" colspan="4" nolabel="1"/>
<group col="8" colspan="4">
<separator string="" colspan="4"/>
<newline/>
@@ -353,30 +355,37 @@
<field name="address_id"/>
</form>
</field>
<group col="2" colspan="2">
<separator string="Dates" colspan="2"/>
<field name="create_date"/>
<group col="2" colspan="2" groups="base.group_extended">
<separator string="Dates" colspan="2"/>
<field name="date_closed"/>
</group>
<group col="2" colspan="2">
<group col="2" colspan="2" groups="base.group_extended">
<separator string="Misc" colspan="2"/>
<field name="id"/>
<field name="active"/>
</group>
</group>
</page>
<page string="Emails" groups="base.group_extended">
<group colspan="4">
<field colspan="4" name="email_cc" string="CC" widget="char" size="512"/>
</group>
<field name="message_ids" colspan="4" nolabel="1" mode="form,tree">
<field name="message_ids" colspan="4" nolabel="1" mode="tree,form">
<tree string="Communication history">
<field name="display_text" string="History Information"/>
<button
string="Reply"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'event.registration', 'include_original' : True}"
icon="gtk-undo" type="action" />
</tree>
<form string="Communication history">
<group col="4" colspan="4">
<field name="email_from"/>
<field name="date"/>
<field name="email_to" widget="char" size="512"/>
<field name="email_cc" widget="char" size="512"/>
<field name="name" colspan="4" widget="char" size="512"/>
</group>
<group col="4" colspan="4">
<field name="email_from"/>
<field name="date"/>
<field name="email_to" widget="char" size="512"/>
<field name="email_cc" widget="char" size="512"/>
<field name="name" colspan="4" widget="char" size="512"/>
</group>
<notebook colspan="4">
<page string="Details">
<field name="description" colspan="4" nolabel="1"/>
@@ -386,43 +395,37 @@
</page>
</notebook>
<button colspan="4"
string="Reply to Last Email"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'event.registration', 'include_original' : True}"
icon="gtk-undo" type="action" />
string="Reply"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'event.registration', 'include_original' : True}"
icon="gtk-undo" type="action" />
</form>
<tree string="Communication history">
<field name="date"/>
<field name="email_from" />
<field name="email_to"/>
<field name="description"/>
</tree>
</field>
</field>
<button colspan="4" string="Send New Email"
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>
<field name="type">calendar</field>
<field eval="2" name="priority"/>
<field name="arch" type="xml">
<calendar color="event_id" date_start="create_date" string="Event Registration">
<calendar color="event_id" date_start="date" date_delay="duration" string="Event Registration">
<field name="event_id"/>
<field name="partner_invoice_id"/>
</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 +437,7 @@
</graph>
</field>
</record>
<!-- Search view of event registration form-->
@@ -451,7 +454,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 +462,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 +483,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>
+8 -1
View File
@@ -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>
+2 -9
View File
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<openerp>
<data noupdate="0">
<data>
<record id="group_event_manager" model="res.groups">
@@ -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>
+3 -3
View File
@@ -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>
+12 -12
View File
@@ -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"/>
+1 -2
View File
@@ -65,8 +65,7 @@ class hr_applicant(osv.osv, crm.crm_case):
_inherit = ['mailgate.thread']
_columns = {
'name': fields.char('Name', size=128, required=True),
'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)]),
'message_ids': fields.one2many('mailgate.message', 'res_id', 'Messages', domain=[('model','=',_name)]),
'active': fields.boolean('Active', help="If the active field is set to false, it will allow you to hide the case without removing it."),
'description': fields.text('Description'),
'section_id': fields.many2one('crm.case.section', 'Sales Team', \
+34 -43
View File
@@ -140,56 +140,47 @@
<page string="History" groups="base.group_extended">
<field name="id"/>
<field name="active"/>
<field name="log_ids" nolabel="1" colspan="4">
<tree string="Logs">
<field name="name" colspan="4"/>
<field name="date"/>
<field name="user_id"/>
</tree>
<form string="Logs">
<separator string="Action Information" colspan="4"/>
<field name="name" colspan="4"/>
<field name="date"/>
<field name="user_id"/>
</form>
</field>
</page>
<page string="Emails" groups="base.group_extended">
<group colspan="4">
<field colspan="4" name="email_cc" string="CC"/>
<field colspan="4" name="email_cc" string="Global CC" widget="char"/>
</group>
<field name="message_ids" colspan="4" nolabel="1" mode="form,tree">
<form string="Communication history">
<group col="6" colspan="4">
<field name="date"/>
<field name="email_to"/>
<field name="email_from"/>
</group>
<notebook colspan="4">
<page string="Details">
<field name="description" colspan="4" nolabel="1"/>
</page>
<page string="Attachments">
<field name="attachment_ids" colspan="4" readonly="1" nolabel="1"/>
</page>
</notebook>
<button colspan="4"
string="Reply to Last Email"
<field name="message_ids" colspan="4" nolabel="1" mode="tree,form">
<tree string="Communication history">
<field name="display_text" string="History Information"/>
<button
string="Reply"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'hr.applicant'}"
context="{'mail':'reply', 'model': 'hr.applicant', 'include_original' : True}"
icon="gtk-undo" type="action" />
</form>
<tree string="Communication history">
</tree>
<form string="Communication history">
<group col="4" colspan="4">
<field name="email_from"/>
<field name="date"/>
<field name="email_from" />
<field name="email_to"/>
<field name="description"/>
</tree>
</field>
<button colspan="4" string="Send New Email"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'new', 'model': 'hr.applicant'}"
icon="gtk-go-forward" type="action" />
<field name="email_to" widget="char" size="512"/>
<field name="email_cc" widget="char" size="512"/>
<field name="name" colspan="4" widget="char" size="512"/>
</group>
<notebook colspan="4">
<page string="Details">
<field name="description" colspan="4" nolabel="1"/>
</page>
<page string="Attachments">
<field name="attachment_ids" colspan="4" readonly="1" nolabel="1"/>
</page>
</notebook>
<button colspan="4"
string="Reply"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'hr.applicant', 'include_original' : True}"
icon="gtk-undo" type="action" />
</form>
</field>
<button colspan="4" string="Send New Email"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'new', 'model': 'hr.applicant'}"
icon="gtk-go-forward" type="action" />
</page>
</notebook>
</form>
+19 -3
View File
@@ -41,8 +41,7 @@ class mailgate_thread(osv.osv):
_description = 'Mailgateway Thread'
_columns = {
'message_ids': fields.one2many('mailgate.message', 'res_id', 'Messages', domain=[('history', '=', True)], readonly=True),
'log_ids': fields.one2many('mailgate.message', 'res_id', 'Logs', domain=[('history', '=', False)], readonly=True),
'message_ids': fields.one2many('mailgate.message', 'res_id', 'Messages', readonly=True),
}
def message_new(self, cr, uid, msg, context):
@@ -145,9 +144,25 @@ class mailgate_message(osv.osv):
'''
Mailgateway Message
'''
def _get_display_text(self, cr, uid, ids, name, arg, context=None):
result = {}
for message in self.browse(cr, uid, ids, context=context):
msg_txt = ''
if message.history:
msg_txt += (message.email_from or '/') + ' wrote on ' + message.date + ':\n\t'
msg_txt += '\n\t'.join(message.description.split('\n')[:3]) + '...'
else:
msg_txt = (message.user_id.name or '/') + ' on ' + message.date + ':\n\t'
if message.name == 'Opportunity':
msg_txt += "Converted to Opportunity"
else:
msg_txt += "Changed Status to: " + message.name
result[message.id] = msg_txt
return result
_name = 'mailgate.message'
_description = 'Mailgateway Message'
_order = 'id desc'
_order = 'date desc'
_columns = {
'name':fields.text('Subject', readonly=True),
'model': fields.char('Object Name', size=128, select=1, readonly=True),
@@ -166,6 +181,7 @@ class mailgate_message(osv.osv):
'description': fields.text('Description', readonly=True),
'partner_id': fields.many2one('res.partner', 'Partner', required=False),
'attachment_ids': fields.many2many('ir.attachment', 'message_attachment_rel', 'message_id', 'attachment_id', 'Attachments', readonly=True),
'display_text': fields.function(_get_display_text, method=True, type='text', size="512", string='Display Text'),
}
def init(self, cr):
+2 -33
View File
@@ -79,41 +79,10 @@
<group col="6" colspan="4">
<field name="thread" select="1" colspan="3"/>
</group>
<separator string="Logs" colspan="4"/>
<field name="log_ids" nolabel="1" colspan="4" domain="[('history', '=', True)]">
<tree string="Mailgateway Logs">
<field name="name" select="1" />
<field name="date" />
</tree>
<form string="Mailgate Logs">
<field name="name" widget="char" size="512"/>
<field name="date" />
<field name="user_id" />
<field name="message_id" />
<notebook colspan="4">
<page string="Email Details">
<group col="4" colspan="4">
<separator string="Email Details" colspan="4"/>
<field name="email_from" />
<field name="email_to" widget="char" size="512"/>
<field name="email_cc" widget="char" size="512"/>
<field name="email_bcc" widget="char" size="512"/>
</group>
<separator string="Description" colspan="4"/>
<field name="description" nolabel="1" colspan="4" />
</page>
<page string="Attachments">
<separator string="Attachments" colspan="4"/>
<field name="attachment_ids" nolabel="1" colspan="4" />
</page>
</notebook>
</form>
</field>
<separator string="History" colspan="4"/>
<field name="message_ids" nolabel="1" colspan="4" domain="[('history', '=', True)]">
<field name="message_ids" nolabel="1" colspan="4" mode="tree,form">
<tree string="Mailgateway History">
<field name="name" select="1" />
<field name="date" />
<field name="display_text" />
</tree>
<form string="Mailgate History">
<field name="name" widget="char" size="512"/>
+47 -32
View File
@@ -26,6 +26,7 @@ from dateutil.relativedelta import relativedelta
from operator import itemgetter
from traceback import format_exception
from sys import exc_info
from tools.safe_eval import safe_eval as eval
from osv import fields, osv
import netsvc
@@ -82,6 +83,13 @@ class marketing_campaign(osv.osv):
_name = "marketing.campaign"
_description = "Marketing Campaign"
def _check_has_start(self, cr, uid, ids, context=None):
for campaign in self.browse(cr, uid, ids, context=context):
if not any(a.start for a in campaign.activity_ids):
return False
return True
_columns = {
'name': fields.char('Name', size=64, required=True),
'object_id': fields.many2one('ir.model', 'Model', required=True,
@@ -90,15 +98,15 @@ this campaign to be run"),
'partner_field_id': fields.many2one('ir.model.fields', 'Partner Field',
domain="[('model_id', '=', object_id), ('ttype', '=', 'many2one'), ('relation', '=', 'res.partner')]",
help="The generated workitems will be linked to the partner related to the record. If the record is the partner itself left this field empty."),
'mode':fields.selection([('test', 'Test Directly'),
'mode': fields.selection([('test', 'Test Directly'),
('test_realtime', 'Test in Realtime'),
('manual', 'With Manual Confirmation'),
('active', 'Normal')],
'Mode', required=True, help= \
"""Test - It creates and process all the activities directly (without waiting for the delay on transitions) but do not send emails or produce reports.
Test in Realtime - It creates and process all the activities directly but do not send emails or produce reports.
"""Test - It creates and process all the activities directly (without waiting for the delay on transitions) but does not send emails or produce reports.
Test in Realtime - It creates and processes all the activities directly but does not send emails or produce reports.
With Manual Confirmation - the campaigns runs normally, but the user has to validate all workitem manually.
Normal - the campaign runs normally and automatically sends all emails and reports"""),
Normal - the campaign runs normally and automatically sends all emails and reports (be very careful with this mode, you're live!)"""),
'state': fields.selection([('draft', 'Draft'),
('running', 'Running'),
('done', 'Done'),
@@ -106,32 +114,34 @@ Normal - the campaign runs normally and automatically sends all emails and repor
'State',),
'activity_ids': fields.one2many('marketing.campaign.activity',
'campaign_id', 'Activities'),
'fixed_cost': fields.float('Fixed Cost', help="The fixed cost is cost\
you required for the campaign"),
'fixed_cost': fields.float('Fixed Cost', help="Fixed cost for the campaign (used for campaign analysis), see also variable cost on activities"),
}
_defaults = {
'state': lambda *a: 'draft',
'mode': lambda *a: 'test',
}
_constraints = [(_check_has_start, 'Please mark at least one activity as a start activity', ['Activities'])]
def state_running_set(self, cr, uid, ids, *args):
# TODO check that all subcampaigns are running
campaign = self.browse(cr, uid, ids[0])
if not campaign.activity_ids :
raise osv.except_osv("Error", "There is no activitity in the campaign")
actvity_ids = [ act_id.id for act_id in campaign.activity_ids]
activity_ids = [ act_id.id for act_id in campaign.activity_ids]
if not activity_ids:
raise osv.except_osv(_("Error"), _("The campaign cannot be started : there are no activities in it"))
act_obj = self.pool.get('marketing.campaign.activity')
act_ids = act_obj.search(cr, uid, [('id', 'in', actvity_ids),
('start', '=', True)])
if not act_ids :
raise osv.except_osv("Error", "There is no starting activitity in the campaign")
act_ids = act_obj.search(cr, uid, [('id', 'in', actvity_ids),
act_ids = act_obj.search(cr, uid, [('id', 'in', activity_ids),
('type', '=', 'email')])
for activity in act_obj.browse(cr, uid, act_ids):
if not activity.email_template_id.enforce_from_account :
raise osv.except_osv("Error", "Campaign cannot be start : Email Account is missing in email activity")
raise osv.except_osv(_("Error"), _("The campaign cannot be started: an email account is missing in the email activity '%s'")%activity.name)
if activity.email_template_id.enforce_from_account.state != 'approved' :
raise osv.except_osv("Error", "Campaign cannot be start : Email Account is not approved for email activity")
raise osv.except_osv(_("Error"), _("The campaign cannot be started: the email account is not approved in the email activity '%s'")%activity.name)
self.write(cr, uid, ids, {'state': 'running'})
return True
@@ -141,7 +151,7 @@ you required for the campaign"),
[('campaign_id', 'in', ids),
('state', '=', 'running')])
if segment_ids :
raise osv.except_osv("Error", "Campaign cannot be marked as done before all segments are done")
raise osv.except_osv(_("Error"), _("The campaign cannot be marked as done before all segments are done"))
self.write(cr, uid, ids, {'state': 'done'})
return True
@@ -187,7 +197,7 @@ you required for the campaign"),
partner_field = campaign.partner_field_id.name
if partner_field:
return getattr(record, partner_field)
elif campaign.model_id.model == 'res.partner':
elif campaign.object_id.model == 'res.partner':
return record
return None
@@ -206,9 +216,10 @@ class marketing_campaign_segment(osv.osv):
string='Object'),
'ir_filter_id': fields.many2one('ir.filters', 'Filter', help=""),
'sync_last_date': fields.datetime('Latest Synchronization'),
'sync_mode': fields.selection([('create_date', 'Sync only on creation'),
('write_date', 'Sync at each modification')],
'Synchronization Mode'),
'sync_mode': fields.selection([('create_date', 'If record created after last sync'),
('write_date', 'If record modified after last sync (no duplicates)')],
'Workitem creation mode',
help="Determines when new workitems should be created for records matching a segment."),
'state': fields.selection([('draft', 'Draft'),
('running', 'Running'),
('done', 'Done'),
@@ -269,6 +280,7 @@ class marketing_campaign_segment(osv.osv):
criteria += eval(segment.ir_filter_id.domain)
object_ids = model_obj.search(cr, uid, criteria, context=context)
# XXX TODO: rewrite this loop more efficiently without doing 1 search per record!
for o_ids in model_obj.browse(cr, uid, object_ids, context=context):
# avoid duplicated workitem for the same resource
if segment.sync_mode == 'write_date':
@@ -318,9 +330,9 @@ class marketing_campaign_activity(osv.osv):
'object_id': fields.related('campaign_id','object_id',
type='many2one', relation='ir.model',
string='Object', readonly=True),
'start': fields.boolean('Start',help= "This activity is launched when the campaign starts."),
'start': fields.boolean('Start', help= "This activity is launched when the campaign starts.", select=True),
'condition': fields.char('Condition', size=256, required=True,
help="Python condition to know if the activity can be launched"),
help="Python condition to know if the activity can be executed, otherwise it will be deleted or cancelled."),
'type': fields.selection(_action_types, 'Type', required=True,
help="Describe type of action to be performed on the Activity.Eg : Send email,Send paper.."),
'email_template_id': fields.many2one('email.template','Email Template'),
@@ -341,9 +353,9 @@ class marketing_campaign_activity(osv.osv):
'variable_cost': fields.float('Variable Cost'),
'revenue': fields.float('Revenue'),
'signal': fields.char('Signal', size=128,
help='An activity with a signal can be called programmatically. Attention, the workitem is always created when the signal is send'),
'keep_if_condition_not_met': fields.boolean('Keep if condition not met',
help="By activating this option, the workitems that aren't processed because the condition is not met are marked as cancelled instead of being deleted.")
help='An activity with a signal can be called programmatically. Be careful, the workitem is always created when a signal is sent'),
'keep_if_condition_not_met': fields.boolean('Keep as cancelled when condition not met',
help="By activating this option, workitems that aren't executed because the condition is not met are marked as cancelled instead of being deleted.")
}
_defaults = {
@@ -460,7 +472,7 @@ class marketing_campaign_transition(osv.osv):
('cosmetic', 'Cosmetic'), # fake plastic transition
],
'Trigger', required=True,
help="How is triggered the destination workitem"),
help="How is the destination workitem triggered"),
}
_defaults = {
@@ -516,7 +528,7 @@ class marketing_campaign_workitem(osv.osv):
def button_draft(self, cr, uid, workitem_ids, context={}):
for wi in self.browse(cr, uid, workitem_ids, context=context):
if wi.state=='exception':
if wi.state in ('exception', 'cancelled'):
self.write(cr, uid, [wi.id], {'state':'todo'}, context=context)
return True
@@ -531,13 +543,13 @@ class marketing_campaign_workitem(osv.osv):
return
activity = workitem.activity_id
proxy = self.pool.get(workitem.object_id.model)
object_id = proxy.browse(cr, uid, workitem.res_id, context=context)
eval_context = {
'pool': self.pool,
'cr': cr,
'uid': uid,
'wi': workitem,
'object': activity,
'activity': activity,
'workitem': workitem,
'object': object_id,
'transition': activity.to_ids
}
try:
@@ -585,7 +597,7 @@ class marketing_campaign_workitem(osv.osv):
wi_id = self.create(cr, uid, values, context=context)
# Now, depending of the trigger and the campaign mode
# we now if must run the newly created workitem.
# we know if must run the newly created workitem.
#
# rows = transition trigger \ colums = campaign mode
#
@@ -675,6 +687,9 @@ class email_template(osv.osv):
_defaults = {
'object_name': lambda obj, cr, uid, context: context.get('object_id',False),
}
# TODO: add constraint to prevent disabling / disapproving an email account used in a running campaign
email_template()
class report_xml(osv.osv):
@@ -236,20 +236,15 @@
</group>
<field name="type" width='100'/>
<group colspan='2' col='1'>
<group attrs="{'invisible':[('type','!=','email')]}" >
<field name="email_template_id" attrs="{'required':[('type','=','email')]}" />
</group>
<field name="email_template_id" attrs="{'required':[('type','=','email')], 'invisible':[('type','!=','email')]}"
context="{'default_object_name':object_id}" />
<group attrs="{'invisible':[('type','!=','paper')]}" >
<field name="report_id" attrs="{'required':[('type','=','paper')]}" context="{'object_id':object_id}"/>
<field name="report_directory_id" attrs="{'required':[('type','=','paper')]}" />
</group>
<group attrs="{'invisible':[('type','!=','action')]}" >
<field name="server_action_id" attrs="{'required':[('type','=','action')]}" domain="[('model_id','=',object_id)]" />
</group>
<field name="server_action_id" attrs="{'required':[('type','=','action')],'invisible':[('type','!=','action')]}" domain="[('model_id','=',object_id)]" />
<!--
<group attrs="{'invisible':[('type','!=','subcampaign')]}" >
<field name="subcampaign_id" attrs="{'required':[('type','=','subcampaign')]}" />
</group>
<field name="subcampaign_id" attrs="{'required':[('type','=','subcampaign')], 'invisible':[('type','!=','subcampaign')]}" />
-->
</group>
</group>
@@ -350,7 +345,7 @@
<separator string="Status" colspan="4"/>
<group colspan="4" col="11">
<field name="state" nolabel="1" readonly="True" select="1"/>
<button string="Retry" states="exception" name="button_draft" type="object" icon="gtk-ok"/>
<button string="Reset" states="exception,cancelled" name="button_draft" type="object" icon="gtk-ok"/>
<button string="Process" states="todo" name="process" type="object" icon="gtk-ok"/>
<button string="Cancel" states="todo,exception" name="button_cancel" type="object" icon="gtk-cancel"/>
</group>
+1 -2
View File
@@ -188,8 +188,7 @@ class project_issue(osv.osv, crm.crm_case):
method=True, multi='working_days_open', type="float", store=True),
'working_hours_close': fields.function(_compute_day, string='Working Hours to Close the Issue', \
method=True, multi='working_days_close', type="float", store=True),
'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)]),
'message_ids': fields.one2many('mailgate.message', 'res_id', 'Messages', domain=[('model','=',_name)]),
'date_action_last': fields.datetime('Last Action', readonly=1),
'date_action_next': fields.datetime('Next Action', readonly=1),
}
+22 -29
View File
@@ -73,14 +73,24 @@
</page>
<page string="Emails" groups="base.group_extended">
<group colspan="4">
<field colspan="4" name="email_cc" string="CC"/>
<field colspan="4" name="email_cc" string="Global CC" widget="char"/>
</group>
<field name="message_ids" colspan="4" nolabel="1" mode="form,tree">
<field name="message_ids" colspan="4" nolabel="1" mode="tree,form">
<tree string="Communication history">
<field name="display_text" string="History Information"/>
<button
string="Reply"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'project.issue', 'include_original' : True}"
icon="gtk-undo" type="action" />
</tree>
<form string="Communication history">
<group col="6" colspan="4">
<field name="date"/>
<field name="email_to"/>
<field name="email_from"/>
<group col="4" colspan="4">
<field name="email_from"/>
<field name="date"/>
<field name="email_to" widget="char" size="512"/>
<field name="email_cc" widget="char" size="512"/>
<field name="name" colspan="4" widget="char" size="512"/>
</group>
<notebook colspan="4">
<page string="Details">
@@ -90,17 +100,13 @@
<field name="attachment_ids" colspan="4" readonly="1" nolabel="1"/>
</page>
</notebook>
<button colspan="4" string="Reply to Last Email" name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'project.issue', 'include_original' : True}"
icon="gtk-undo" type="action" />
<button colspan="4"
string="Reply"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'project.issue', 'include_original' : True}"
icon="gtk-undo" type="action" />
</form>
<tree string="Communication history">
<field name="date"/>
<field name="email_from" />
<field name="email_to"/>
<field name="description"/>
</tree>
</field>
</field>
<separator colspan="4"/>
<button colspan="4" string="Send New Email"
name="%(crm.action_crm_send_mail)d"
@@ -127,19 +133,6 @@
<field name="id"/>
<field name="active"/>
</group>
<field name="log_ids" nolabel="1" colspan="4">
<tree string="Logs">
<field name="name" colspan="4"/>
<field name="date"/>
<field name="user_id"/>
</tree>
<form string="Logs">
<separator string="Action Information" colspan="4"/>
<field name="name" colspan="4"/>
<field name="date"/>
<field name="user_id"/>
</form>
</field>
</page>
</notebook>
</form>
+1 -1
View File
@@ -168,7 +168,7 @@ class project_scrum_product_backlog(osv.osv):
if match:
ids = self.search(cr, uid, [('sprint_id','=', int(match.group(1)))], limit=limit, context=context)
return self.name_get(cr, uid, ids, context=context)
return super(scrum_product_backlog, self).name_search(cr, uid, name, args, operator,context, limit=limit)
return super(project_scrum_product_backlog, self).name_search(cr, uid, name, args, operator,context, limit=limit)
def _calc_progress(self, cr, uid, ids, name, args, context):
res = {}
+1 -1
View File
@@ -90,7 +90,7 @@
<field name="total_hours" widget="float_time"/>
<field name="remaining_hours" widget="float_time" sum="Remaining Hours" invisible="context.get('set_visible',False)"/>
<field name="date_deadline" invisible="context.get('set_visible',False)"/>
<field name="type" groups="base.group_extended" invisible="context.get('set_visible',False)"/>
<field name="type_id" groups="base.group_extended" invisible="context.get('set_visible',False)"/>
<field name="date_start" invisible="1"/>
<field name="date_end" invisible="1"/>
<button name="next_type" invisible="context.get('set_visible',False)"