summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoratp (Open ERP) <atp@tinyerp.co.in>2010-06-21 11:32:20 +0530
committeratp (Open ERP) <atp@tinyerp.co.in>2010-06-21 11:32:20 +0530
commit5a8aab4ce043cc7eb12291a8af0848bc290c5dcd (patch)
tree18a57f5c410fbbbcb0d792277ed2e6dedfdf38a9
parent832454eb459481c8b7450bbf070fc4d75b6133f9 (diff)
[IMP]: event: usability Improvement and Improve make invoice wizard.
bzr revid: atp@tinyerp.co.in-20100621060220-anjgndsm1jyhykl2
-rwxr-xr-xaddons/event/__openerp__.py1
-rwxr-xr-xaddons/event/event.py293
-rwxr-xr-xaddons/event/event_data.xml7
-rwxr-xr-xaddons/event/event_demo.xml3
-rwxr-xr-xaddons/event/event_view.xml188
-rw-r--r--addons/event/report/report_event_registration_view.xml31
-rwxr-xr-xaddons/event/security/ir.model.access.csv1
-rw-r--r--addons/event/test/test_event.yml48
-rwxr-xr-xaddons/event/wizard/__init__.py1
-rwxr-xr-xaddons/event/wizard/event_confirm_registration.py8
-rwxr-xr-xaddons/event/wizard/event_make_invoice.py153
-rwxr-xr-xaddons/event/wizard/event_make_invoice_view.xml20
-rwxr-xr-xaddons/event/wizard/event_registrations_partner.xml6
13 files changed, 434 insertions, 326 deletions
diff --git a/addons/event/__openerp__.py b/addons/event/__openerp__.py
index 61cb62ee600..184a034f05b 100755
--- a/addons/event/__openerp__.py
+++ b/addons/event/__openerp__.py
@@ -47,7 +47,6 @@
'event_sequence.xml',
'security/event_security.xml',
'security/ir.model.access.csv',
- 'wizard/event_registration_view.xml',
'wizard/event_registrations_partner.xml',
'wizard/event_make_invoice_view.xml',
],
diff --git a/addons/event/event.py b/addons/event/event.py
index 73cab202df6..a5364174f23 100755
--- a/addons/event/event.py
+++ b/addons/event/event.py
@@ -83,6 +83,11 @@ class event(osv.osv):
self.pool.get('event.registration').mail_user_confirm(cr, uid, reg_ids)
return self.write(cr, uid, ids, {'state': 'confirm'})
+
+
+
+
+
def _get_register(self, cr, uid, ids, name, args, context=None):
@@ -126,9 +131,10 @@ class event(osv.osv):
@param vals: dictionary with values to update.
@return: True
"""
-
res = super(event, self).write(cr, uid, ids, vals, *args, **kwargs)
+
if 'date_begin' in vals and vals['date_begin']:
+
for eve in self.browse(cr, uid, ids):
#change the deadlines of the registration linked to this event
reg_ids = self.pool.get('event.registration').search(cr, uid,
@@ -169,12 +175,13 @@ class event(osv.osv):
'mail_auto_confirm': fields.boolean('Mail Auto Confirm', help='Check this box if you want ot use the automatic confirmation emailing or the reminder'),
'mail_registr': fields.text('Registration Email', help='This email will be sent when someone subscribes to the event.'),
'mail_confirm': fields.text('Confirmation Email', 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),
+ 'product_id': fields.many2one('product.product', 'Product', required=True),
+ 'note': fields.text('Notes')
}
_defaults = {
'state': lambda *args: 'draft',
- 'code': lambda obj, cr, uid, context: obj.pool.get('ir.sequence').get(cr, uid, 'event.event'),
+# 'code': lambda obj, cr, uid, context: obj.pool.get('ir.sequence').get(cr, uid, 'event.event'),
'user_id': lambda self, cr, uid, ctx: uid,
}
@@ -184,6 +191,98 @@ class event_registration(osv.osv):
"""Event Registration"""
+ def _make_invoice(self, cr, uid, reg, lines, context=None):
+
+ if context is None:
+ context = {}
+ inv_obj = self.pool.get('account.invoice')
+
+ obj_lines = self.pool.get('account.invoice.line')
+
+ val_invoice = inv_obj.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 = obj_lines.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 = obj_lines.read(cr, uid, lines)
+
+ val_invoice['value'].update({
+ 'origin': reg.event_product,
+ 'reference': False,
+ 'invoice_line': [(6, 0, lines)],
+ 'comment': "",
+ })
+ inv_id = inv_obj.create(cr, uid, val_invoice['value'])
+
+ self._history(cr, uid, [reg], _('Invoiced'))
+#
+ inv_obj.button_compute(cr, uid, [inv_id])
+ return inv_id
+
+ def action_invoice_create(self, cr, uid, ids, grouped=False, date_inv = False):
+
+ res = False
+ invoices = {}
+ tax_ids=[]
+
+ obj_reg = self.pool.get('event.registration')
+ obj_lines = self.pool.get('account.invoice.line')
+ inv_obj = self.pool.get('account.invoice')
+
+ context = {}
+ # If date was specified, use it as date invoiced, usefull when invoices are generated this month and put the
+ # last day of the last month as invoice date
+ if date_inv:
+ context['date_inv'] = date_inv
+
+ obj_event_reg = self.pool.get('event.registration')
+ obj_lines = self.pool.get('account.invoice.line')
+ inv_obj = self.pool.get('account.invoice')
+ data_event_reg = obj_event_reg.browse(cr, uid, ids, context=context)
+
+ for reg in data_event_reg:
+
+ val_invoice = inv_obj.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 = obj_lines.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)
+ data_product = self.pool.get('product.product').browse(cr, uid, [reg.event_id.product_id.id])
+ for tax in data_product[0].taxes_id:
+ tax_ids.append(tax.id)
+
+ vals = value['value']
+ c_name = reg.contact_id and ('-' + self.pool.get('res.partner.contact').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)],
+ })
+ inv_line_ids = obj_event_reg._create_invoice_lines(cr, uid, [reg.id], vals)
+ invoices.setdefault(reg.partner_id.id, []).append((reg, inv_line_ids))
+
+ for val in invoices.values():
+ 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.write(cr, uid, [k.id], {'state': 'done', 'invoice_id': res})
+
+ else:
+ for k , v in val:
+ res = self._make_invoice(cr, uid, k, [v], context=context)
+ self.write(cr, uid, [k.id], {'state': 'done', 'invoice_id': res})
+ #res = self._make_invoice(cr, uid, val[0][0], m, context=context)
+ return res
+
def check_confirm(self, cr, uid, ids, context):
"""
@@ -194,61 +293,56 @@ class event_registration(osv.osv):
@param context: A standard dictionary for contextual values
@return: Dictionary value which open Confirm registration form.
"""
-
+ registration_obj = self.browse(cr, uid, ids)
+ self._history(cr, uid, registration_obj, _('Open'))
mod_obj = self.pool.get('ir.model.data')
- current_registration = self.browse(cr, uid, [ids[0]])[0]
- total_confirmed = current_registration.event_id.register_current + current_registration.nb_register
- if total_confirmed <= current_registration.event_id.register_max or current_registration.event_id.register_max == 0:
- self.write(cr, uid, [ids[0]], {'state': 'open'}, context=context)
- self._history(cr, uid, [ids[0]], 'Open', history=True)
- self.mail_user(cr, uid, [ids[0]])
- return True
- else:
- model_data_ids = mod_obj.search(cr, uid, [('model', '=', 'ir.ui.view'), ('name', '=', 'view_event_confirm_registration')], context=context)
- resource_id = mod_obj.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id']
- context.update({'reg_id': ids[0]})
- return {
- 'name': _('Confirm Registration'),
- 'context': context,
- 'view_type': 'form',
- 'view_mode': 'tree,form',
- 'res_model': 'event.confirm.registration',
- 'views': [(resource_id, 'form')],
- 'type': 'ir.actions.act_window',
- 'target': 'new',
- 'nodestroy': True
- }
-
- def _history(self, cr, uid, ids, keyword, history=False, email=False, context={}):
- """
- Create value in mailgateway.message model.
- @param cr: the current row, from the database cursor,
- @param uid: the current user’s ID for security checks,
- @param ids: List of Event registration's IDs
- @param context: A standard dictionary for contextual values
- @return: True
- """
-
- for case in self.browse(cr, uid, ids):
- data = {
- 'name': keyword,
- 'som': case.som.id,
- 'canal_id': case.canal_id.id,
- 'user_id': uid,
- }
- obj = self.pool.get('mailgate.message')
- obj.create(cr, uid, data, context=context)
- return True
+ for current_registration in registration_obj:
+
+ total_confirmed = current_registration.event_id.register_current + current_registration.nb_register
+ if total_confirmed <= current_registration.event_id.register_max or current_registration.event_id.register_max == 0:
+ self.write(cr, uid, ids, {'state': 'open'}, context=context)
+ self.mail_user(cr, uid, ids)
+
+ return True
+ else:
+ model_data_ids = mod_obj.search(cr, uid, [('model', '=', 'ir.ui.view'), ('name', '=', 'view_event_confirm_registration')], context=context)
+ resource_id = mod_obj.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id']
+ for id in ids:
+ context.update({'reg_id': id})
+
+ return {
+ 'name': _('Confirm Registration'),
+ 'context': context,
+ 'view_type': 'form',
+ 'view_mode': 'tree,form',
+ 'res_model': 'event.confirm.registration',
+ 'views': [(resource_id, 'form')],
+ 'type': 'ir.actions.act_window',
+ 'target': 'new',
+ 'nodestroy': True
+ }
+
+ def _history(self, cr, uid, cases, keyword, history=False, subject=None, email=False, details=None, email_from=False, message_id=False, attach=[], context={}):
+ mailgate_pool = self.pool.get('mailgate.thread')
+ return mailgate_pool._history(cr, uid, cases, keyword, history=history,\
+ subject=subject, email=email, \
+ details=details, email_from=email_from,\
+ message_id=message_id, attach=attach, \
+ context=context)
def button_reg_close(self, cr, uid, ids, *args):
- self.write(cr, uid, ids, {'state': 'done', })
- self._history(cr, uid, ids, 'Done', history=True)
+
+ cases = self.browse(cr, uid, ids)
+ self._history(cr, uid, cases, _('Done'))
+ self.write(cr, uid, ids, {'state': 'done', 'date_closed': time.strftime('%Y-%m-%d %H:%M:%S')})
return True
-
+
def button_reg_cancel(self, cr, uid, ids, *args):
- self.write(cr, uid, ids, {'state': 'cancel', })
- self._history(cr, uid, ids, 'Cancel', history=True)
+
+ cases = self.browse(cr, uid, ids)
+ self._history(cr, uid, cases, _('Cancel'))
+ self.write(cr, uid, ids, {'state': 'cancel'})
return True
def create(self, cr, uid, *args, **argv):
@@ -265,9 +359,8 @@ class event_registration(osv.osv):
args[0]['date_deadline']= event.date_begin
args[0]['description']= event.mail_confirm
res = super(event_registration, self).create(cr, uid, *args, **argv)
-
- self._history(cr, uid, [res], 'Created', history=True)
-
+ cases = self.browse(cr, uid, [res])
+ self._history(cr, uid, cases, _('Created'))
return res
def write(self, cr, uid, *args, **argv):
@@ -278,6 +371,75 @@ class event_registration(osv.osv):
args[1]['date_deadline']= event.date_begin
args[1]['description']= event.mail_confirm
return super(event_registration, self).write(cr, uid, *args, **argv)
+
+
+ def remind_partner(self, cr, uid, ids, context={}, attach=False):
+
+ """
+ @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 Remind Partner's IDs
+ @param context: A standard dictionary for contextual values
+
+ """
+ return self.remind_user(cr, uid, ids, context, attach,
+ destination=False)
+
+
+ def remind_user(self, cr, uid, ids, context={}, attach=False,destination=True):
+
+ """
+ @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 Remind user's IDs
+ @param context: A standard dictionary for contextual values
+ """
+
+ for case in self.browse(cr, uid, ids):
+
+ if not case.event_id.reply_to:
+ raise osv.except_osv(_('Error!'), ("Reply To is not specified for selected Event"))
+ if not case.email_from:
+ raise osv.except_osv(_('Error!'), ("Partner Email is not specified in Registration"))
+ if case.event_id.reply_to and case.email_from:
+ src = case.email_from
+ dest = case.event_id.reply_to
+ body = ""
+ body = case.description
+ if not destination:
+ src, dest = dest, src
+ if body and case.user_id.signature:
+ body += '\n\n%s' % (case.user_id.signature)
+
+ body = self.format_body(body)
+ dest = [dest]
+
+ attach_to_send = None
+
+ if attach:
+ attach_ids = self.pool.get('ir.attachment').search(cr, uid, [('res_model', '=', 'mailgate.thread'), ('res_id', '=', case.id)])
+ attach_to_send = self.pool.get('ir.attachment').read(cr, uid, attach_ids, ['datas_fname','datas'])
+ attach_to_send = map(lambda x: (x['datas_fname'], base64.decodestring(x['datas'])), attach_to_send)
+
+ # Send an email
+ flag = tools.email_send(
+ src,
+ dest,
+ "Reminder: [%s] %s" % (str(case.id), case.name,),
+ body,
+ reply_to = case.event_id.reply_to,
+ openobject_id=str(case.id),
+ attach=attach_to_send
+ )
+ self._history(cr, uid, [case], _('Send'), history=True, email=dest, details=body, email_from=src)
+
+ #if flag:
+ # raise osv.except_osv(_('Email!'),("Email Successfully Sent"))
+ #else:
+ # raise osv.except_osv(_('Email Fail!'),("Email is not sent successfully"))
+ return True
def mail_user_confirm(self, cr, uid, ids):
"""
@@ -287,7 +449,6 @@ class event_registration(osv.osv):
@param ids: List of Event Registration's Id.
@return : False
"""
-
reg_ids = self.browse(cr, uid, ids)
for reg_id in reg_ids:
src = reg_id.event_id.reply_to or False
@@ -297,9 +458,10 @@ class event_registration(osv.osv):
if reg_id.email_cc:
dest += [reg_id.email_cc]
if dest and src:
- tools.email_send(src, dest, 'Auto Confirmation: '+'['+str(reg_id.id)+']'+' '+reg_id.name, reg_id.event_id.mail_confirm, openobject_id = str(reg_id.id))
+ tools.email_send(src, dest, 'Auto Confirmation: '+'['+str(reg_id.id)+']'+' '+reg_id.name, reg_id.event_id.mail_confirm, openobject_id = str(reg_id.id))
if not src:
raise osv.except_osv(_('Error!'), _('You must define a reply-to address in order to mail the participant. You can do this in the Mailing tab of your event. Note that this is also the place where you can configure your event to not send emails automaticly while registering'))
+
return False
def mail_user(self, cr, uid, ids):
@@ -347,7 +509,7 @@ class event_registration(osv.osv):
_inherit = 'crm.meeting'
_columns = {
- 'email_cc': fields.text('Watchers Emails', size=252 , help="These \
+ 'email_cc': fields.text('CC', size=252 , help="These \
people will receive a copy of the future communication between partner \
and users by email"),
'nb_register': fields.integer('Number of Registration', readonly=True, states={'draft': [('readonly', False)]}),
@@ -358,7 +520,7 @@ and users by email"),
"badge_title": fields.char('Badge Title', size=128),
"badge_name": fields.char('Badge Name', size=128),
"badge_partner": fields.char('Badge Partner', size=128),
- "invoice_label": fields.char("Label Invoice", size=128, required=True),
+ "event_product": fields.char("Product Name", size=128, required=True),
"tobe_invoiced": fields.boolean("To be Invoiced"),
"invoice_id": fields.many2one("account.invoice", "Invoice"),
'date_closed': fields.datetime('Closed', readonly=True),
@@ -390,7 +552,7 @@ and users by email"),
data ={}
if not contact:
return data
-
+
contact_id = self.pool.get('res.partner.contact').browse(cr, uid, contact)
data['badge_name'] = contact_id.name
data['badge_title'] = contact_id.title
@@ -401,26 +563,24 @@ and users by email"),
data['email_from'] = self.pool.get('res.partner.job').browse(cr, uid, job_ids[0]).email
d = self.onchange_badge_name(cr, uid, ids, data['badge_name'])
data.update(d['value'])
-
return {'value': data}
def onchange_event(self, cr, uid, ids, event_id, partner_invoice_id):
context={}
if not event_id:
- return {'value': {'unit_price': False, 'invoice_label': False}}
+ return {'value': {'unit_price': False, 'event_product': False}}
data_event = self.pool.get('event.event').browse(cr, uid, event_id)
if data_event.product_id:
if not partner_invoice_id:
unit_price=self.pool.get('product.product').price_get(cr, uid, [data_event.product_id.id], context=context)[data_event.product_id.id]
- return {'value': {'unit_price': unit_price, 'invoice_label': data_event.product_id.name}}
+ return {'value': {'unit_price': unit_price, 'event_product': data_event.product_id.name}}
data_partner = self.pool.get('res.partner').browse(cr, uid, partner_invoice_id)
context.update({'partner_id': data_partner})
unit_price = self.pool.get('product.product')._product_price(cr, uid, [data_event.product_id.id], False, False, {'pricelist': data_partner.property_product_pricelist.id})[data_event.product_id.id]
- return {'value': {'unit_price': unit_price, 'invoice_label': data_event.product_id.name}}
+ return {'value': {'unit_price': unit_price, 'event_product': data_event.product_id.name}}
- return {'value': {'unit_price': False, 'invoice_label': False}}
-
+ return {'value': {'unit_price': False, 'event_product': False}}
def onchange_partner_id(self, cr, uid, ids, part, event_id, email=False):
@@ -464,7 +624,6 @@ and users by email"),
return {'value': data}
return {'value': data}
-
event_registration()
diff --git a/addons/event/event_data.xml b/addons/event/event_data.xml
index 37da989e12d..ebfe70e4c50 100755
--- a/addons/event/event_data.xml
+++ b/addons/event/event_data.xml
@@ -2,12 +2,5 @@
<openerp>
<data>
-<!-- The base section for all events -->
-
- <record model="crm.case.section" id="case_section_event">
- <field name="name">Events</field>
- </record>
-
-
</data>
</openerp>
diff --git a/addons/event/event_demo.xml b/addons/event/event_demo.xml
index ad25a1dbfc1..1611febcf5e 100755
--- a/addons/event/event_demo.xml
+++ b/addons/event/event_demo.xml
@@ -58,7 +58,6 @@
<field name="date_begin">2008-01-01 19:00:00</field>
<field name="date_end">2008-01-01 23:00:00</field>
<field name="product_id" ref="event_product_0"/>
- <field name="parent_id" ref="case_section_event"/>
<field name="user_id" ref="base.user_root"/>
<field name="register_max">500</field>
<field name="type" ref="event_type_1"/>
@@ -94,7 +93,6 @@
<field name="product_id" ref="event_product_1"/>
<field name="type" ref="event_type_1"/>
<field name="user_id" ref="base.user_root"/>
- <field name="parent_id" ref="case_section_event"/>
<field name="register_max">350</field>
<field name="state">confirm</field>
</record>
@@ -107,7 +105,6 @@
<field name="type" ref="event_type_2"/>
<field name="register_max">200</field>
<field name="user_id" ref="base.user_root"/>
- <field name="parent_id" ref="case_section_event"/>
<field name="mail_auto_registr">True</field>
<field name="mail_auto_confirm">True</field>
<field name="state">done</field>
diff --git a/addons/event/event_view.xml b/addons/event/event_view.xml
index 9815094e571..019f596e49a 100755
--- a/addons/event/event_view.xml
+++ b/addons/event/event_view.xml
@@ -48,7 +48,7 @@
<menuitem name="Events by Categories" id="menu_action_event_categories" action="action_event_categories" parent="menu_event_main"/>
- <!-- Events Organisation/CONFIGURATION/EVENTS -->
+ <!-- Events Organisation/CONFIGURATION/EVENTS -->
<record model="ir.ui.view" id="view_event_form">
<field name="name">Events</field>
@@ -67,11 +67,12 @@
<notebook colspan="4">
<page string="General">
<separator string="Event description" colspan="4"/>
- <field name="parent_id" domain="[('parent_id','child_of','Event')]" string="Parent Category"/>
+ <field name="parent_id" domain="[('parent_id','child_of','Event')]"/>
<field name="active"/>
<field name="register_min"/>
<field name="register_max"/>
- <separator string="Status" colspan="4"/>
+ <separator string="Notes" 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"/>
@@ -87,11 +88,9 @@
<group col="3" colspan="2">
<separator string="Auto Registration Email" colspan="2"/>
<newline/>
-
<field name="mail_auto_registr"/>
<separator string="Registration Email" colspan="2"/>
<field name="mail_registr" colspan="2" nolabel="1"/>
-
</group>
<group col="2" colspan="2">
<separator string="Auto Confirmation Email" colspan="2"/>
@@ -121,6 +120,7 @@
<tree string="Events" colors="red:register_min>register_current;black:register_min&lt;=register_current">
<field name="name" string="Name"/>
<field name="user_id"/>
+ <field name="type"/>
<field name="date_begin"/>
<field name="register_min"/>
<field name="register_current"/>
@@ -140,24 +140,24 @@
<filter icon="terp-camera_test" string="Confirmed" domain="[('state','=','confirm')]" help="Confirmed Events"/>
<separator orientation="vertical"/>
<field name="name" string="Event" select="1"/>
+ <field name="state" select="1"/>
<field name="user_id" widget="selection">
-
- <filter icon="terp-partner"
+ <filter icon="terp-personal"
string="My Events"
help="My Events"
domain="[('user_id','=',uid)]"/>
- </field>
+ </field>
<field name="date_begin" select="1"/>
- <field name="state" select="1"/>
</group>
<newline/>
- <group expand="1" string="Group By..." colspan="4" col="12">
- <filter string="Responsible" name="user" icon="terp-partner" context="{'group_by': 'user_id'}"/>
+ <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-crm" context="{'group_by':'state'}"/>
+ <filter string="state" icon="terp-stock_effects-object-colorize" context="{'group_by':'state'}"/>
+ <separator orientation="vertical"/>
+ <filter string="Responsible" name="user" icon="terp-personal" context="{'group_by': 'user_id'}"/>
<separator orientation="vertical"/>
- <filter string="Creation" icon="terp-project"
- domain="[]" context="{'group_by':'date_begin'}" />
+ <filter string="Creation" icon="terp-go-month"
+ domain="[]" context="{'group_by':'date_begin'}"/>
</group>
</search>
</field>
@@ -174,6 +174,15 @@
<field name="context">{"search_default_user_id":uid}</field>
<field name="search_view_id" ref="view_event_search"/>
</record>
+
+ <act_window
+ id="act_event_list_register_event"
+ name="Registration"
+ res_model="event.registration"
+ src_model="event.event"
+ view_mode="tree,form"
+ domain="[('event_id', '=', active_id)]"
+ view_type="form"/>
<menuitem name="Events" id="menu_event_event" action="action_event_view" parent="menu_event_main" />
@@ -228,77 +237,83 @@
<separator string="Status" colspan="4"/>
<group col="8" colspan="4">
<field name="state" select="1" colspan="2"/>
- <button name="button_reg_close" string="Registration Invoiced" states="open" type="object" icon="gtk-print"/>
+ <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"/>
</group>
</page>
<page string="Payments">
- <field name="invoice_label" select="1"/>
+ <field name="event_product" select="1"/>
<field name="tobe_invoiced" select="1"/>
<field name="invoice_id"/>
</page>
- <page string="History">
- <field name="message_ids" colspan="4" nolabel="1" mode="tree,form">
- <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"
- name="%(crm.action_crm_send_mail)d"
- context="{'mail':'reply', 'model': 'event.registration'}"
- 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="log_ids" nolabel="1" colspan="4" mode="tree,form" readonly="1">
- <tree string="Actions">
- <separator string="Action Information" colspan="4"/>
- <field name="name"/>
- <field name="date"/>
- <field name="user_id"/>
- </tree>
- <form string="Actions">
- <separator string="Action Information" colspan="4"/>
- <field name="name" colspan="4"/>
- <field name="date"/>
- <field name="user_id"/>
- </form>
- </field>
- </page>
- <page string="Extra Info">
- <group col="6" colspan="4">
- <field name="name" select="1" colspan="6"/>
- <newline/>
- <field name="categ_id"/>
- <field name="id" select="1"/>
- <field name="active"/>
- <separator colspan="6" string="Watchers Emails" />
- <field name="email_cc" colspan="6" nolabel="1"/>
+ <page string="Emails" groups="base.group_extended">
+ <group colspan="4">
+ <field colspan="4" name="email_cc" string="CC"/>
</group>
- <separator colspan="4" string="Dates"/>
- <field name="create_date"/>
- <field name="date_closed"/>
- <separator colspan="4" string="References"/>
- <field name="ref" colspan="4"/>
- <field name="ref2" colspan="4"/>
- </page>
+ <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"
+ 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>
+ </page>
+ <page string="History">
+ <group colspan="4">
+ <field name="name" select="1" colspan="4"/>
+ </group>
+ <group col="2" colspan="2">
+ <separator string="Dates" colspan="2"/>
+ <field name="create_date"/>
+ <field name="date_closed"/>
+ </group>
+ <group col="2" colspan="2">
+ <separator string="Misc" colspan="2"/>
+ <field name="id"/>
+ <field name="active"/>
+ </group>
+ <group col="3" colspan="4">
+ <separator colspan="4" string="References"/>
+ <field name="ref" />
+ <field name="ref2" />
+ </group>
+ <!-- TODO-->
+ <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>
</field>
@@ -313,21 +328,27 @@
<field name="arch" type="xml">
<search string="Event Registration">
<group col="12" colspan="4">
- <separator orientation="vertical"/>
<filter icon="terp-document-new" string="Draft" domain="[('state','=','draft')]" help="Draft Registrations"/>
<filter icon="terp-camera_test" string="Confirmed" domain="[('state','in',('open','done'))]" help="Confirmed Registrations"/>
<separator orientation="vertical"/>
+ <field name="partner_id" />
<field name="event_id" widget="selection"/>
- <field name="user_id" widget="selection"/>
<field name="state" select="1"/>
+
+ <field name="user_id" widget="selection">
+ <filter icon="terp-personal"
+ string="My Registration"
+ help="My Registration"
+ domain="[('user_id','=',uid)]"/>
+ </field>
</group>
<newline/>
- <group expand="1" string="Group By...">
- <filter string="Event" icon="terp-crm" domain="[]" context="{'group_by':'event_id'}"/>
- <filter string="State" icon="terp-crm" domain="[]" context="{'group_by':'state'}"/>
+ <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-crm" domain="[]" context="{'group_by':'partner_id'}"/>
- <filter string="Responsible" name="uid" icon="terp-partner" domain="[]" context="{'group_by':'user_id'}"/>
+ <filter string="Partner" icon="terp-personal" domain="[]" context="{'group_by':'partner_id'}"/>
+ <filter string="Responsible" name="uid" icon="terp-personal" domain="[]" context="{'group_by':'user_id'}"/>
</group>
</search>
</field>
@@ -342,6 +363,7 @@
<field name="context">{"search_default_user_id":uid}</field>
<field name="search_view_id" ref="view_registration_search"/>
</record>
+
<menuitem
name="Registrations"
id="menu_action_registration" parent="menu_event_main"
diff --git a/addons/event/report/report_event_registration_view.xml b/addons/event/report/report_event_registration_view.xml
index f7a2009020c..d4674436faa 100644
--- a/addons/event/report/report_event_registration_view.xml
+++ b/addons/event/report/report_event_registration_view.xml
@@ -49,50 +49,51 @@
<field name="arch" type="xml">
<search string="Event on Registration">
<group col="8" colspan="4">
- <filter icon="gtk-media-rewind" string=" 365 Days "
+ <filter icon="terp-go-year" string="Last 365 Days"
domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d')),('date','&gt;',(datetime.date.today()-datetime.timedelta(days=365)).strftime('%%Y-%%m-%%d'))]"
help="Tasks performed in last 365 days"/>
- <filter icon="gtk-media-rewind" string=" 30 Days "
+ <filter icon="terp-go-month" string="Last 30 Days"
name="month"
domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d')), ('date','&gt;',(datetime.date.today()-datetime.timedelta(days=30)).strftime('%%Y-%%m-%%d'))]"
help="Tasks performed in last 30 days"/>
- <filter icon="gtk-media-rewind"
- string=" 7 Days "
+ <filter icon="terp-go-week"
+ string="Last 7 Days"
separator="1"
domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d')), ('date','&gt;',(datetime.date.today()-datetime.timedelta(days=7)).strftime('%%Y-%%m-%%d'))]"
help="Tasks during last 7 days"/>
<separator orientation="vertical"/>
- <filter icon="terp-crm"
+ <filter icon="terp-document-new"
string="Draft"
domain="[('state','=','draft')]"/>
- <filter icon="terp-crm"
+ <filter icon="terp-camera_test"
string="Confirm"
domain="[('state', '=', 'confirm')]"/>
<separator orientation="vertical"/>
<field name="event_id" widget="selection"/>
-
<field name="type" widget="selection"/>
<field name="user_id" widget="selection">
- <filter icon="terp-partner"
+ <filter icon="terp-personal"
string="My Events"
help="My Events"
domain="[('user_id','=',uid)]"/>
</field>
- <field name="date" />
+ <field name="date"/>
</group>
<newline/>
- <group expand="1" string="Group By..." colspan="4" col="12">
- <filter string="User" name="user" icon="terp-partner" context="{'group_by': 'user_id'}"/>
+ <group expand="0" string="Group By..." colspan="4" col="12">
<filter string="Event" name="event" icon="terp-crm" context="{'group_by':'event_id'}"/>
<filter string="Event Type" icon="terp-crm" context="{'group_by':'type'}"/>
- <filter string="state" icon="terp-crm" context="{'group_by':'state'}"/>
+ <separator orientation="vertical"/>
+ <filter string="state" icon="terp-stock_effects-object-colorize" context="{'group_by':'state'}"/>
+ <separator orientation="vertical"/>
+ <filter string="Responsible" name="user" icon="terp-personal" context="{'group_by': 'user_id'}"/>
<separator orientation="vertical" />
- <filter string="Day" icon="terp-crm"
+ <filter string="Day" icon="terp-go-month"
domain="[]" context="{'group_by':'day'}"/>
- <filter string="Month" icon="terp-crm"
+ <filter string="Month" icon="terp-go-month"
domain="[]" context="{'group_by':'month'}"/>
- <filter string="Year" icon="terp-crm"
+ <filter string="Year" icon="terp-go-year"
domain="[]" context="{'group_by':'year'}"/>
</group>
</search>
diff --git a/addons/event/security/ir.model.access.csv b/addons/event/security/ir.model.access.csv
index 6a5f00e2846..ea7548c0a95 100755
--- a/addons/event/security/ir.model.access.csv
+++ b/addons/event/security/ir.model.access.csv
@@ -8,4 +8,3 @@
"access_event_confirm_registration_manager","event.confirm.registration manager","model_event_confirm_registration","crm.group_crm_manager",1,1,1,1
"access_event_make_invoice","event.make.invoice","model_event_make_invoice","crm.group_crm_user",1,1,1,1
"access_event_partners_list","event.partners.list","model_event_partners_list","crm.group_crm_user",1,0,0,0
-"access_event_registration_list","event.registration.list","model_event_registration_list","crm.group_crm_user",1,0,0,0
diff --git a/addons/event/test/test_event.yml b/addons/event/test/test_event.yml
index 4cf9438cb3d..d1a479535bc 100644
--- a/addons/event/test/test_event.yml
+++ b/addons/event/test/test_event.yml
@@ -51,14 +51,13 @@
property_account_receivable: account.a_recv
- |
- we create it with a "Conference on ERP Buisness" event and provide "Beginning date", "Ending Date", "Product" as Concert Ticket.
+ we create it with a "Conference on OpenERP Offshore Business" event and provide "Beginning date", "Ending Date", "Product" as Concert Ticket.
-
!record {model: event.event, id: event_event_conference0}:
code: C/004
date_begin: '2010-06-07 13:39:00'
date_end: '2010-06-10 13:39:00'
- name: Conference on ERP Buisness
- parent_id: event.case_section_event
+ name: Conference on OpenERP Offshore Business.
product_id: 'product_product_ticketforconcert0'
register_max: 0.0
register_min: 0.0
@@ -91,7 +90,7 @@
- |
person "Mark Johnson" want to confirm their registrations. for that
- I create New Registration for "Conference on ERP Buisness" event.
+ I create New Registration for "Conference on OpenERP Offshore Business.
-
!record {model: event.registration, id: event_registration_registrationjacot0}:
badge_name: Jacot
@@ -100,13 +99,13 @@
contact_id: base_contact.res_partner_contact_jacot0
date_deadline: '2010-06-07 13:39:00'
event_id: event.event_event_conference0
- invoice_label: Ticket for Concert
+ event_product: Ticket for Concert
name: 'Registration: Jacot'
partner_id: 'res_partner_markjohnson0'
partner_invoice_id: 'res_partner_markjohnson0'
unit_price: 68.0
- |
- I check that "Number of registration" is less than "Maximum registration" defined in "Conference on ERP Buisness" event.
+ I check that "Number of registration" is less than "Maximum registration" defined in "Conference on OpenERP Offshore Business" event.
if not then confirmation will fail because its greater then the Maximum registration.
-
!python {model: event.event}: |
@@ -132,7 +131,7 @@
contact_id: base_contact.res_partner_contact_zen0
date_deadline: '2010-06-07 13:39:00'
event_id: event.event_event_conference0
- invoice_label: Ticket for Concert
+ event_product: Ticket for Concert
name: 'Registration: Zen'
partner_id: base.res_partner_3
partner_invoice_id: base.res_partner_3
@@ -145,7 +144,7 @@
self.check_confirm(cr, uid, [ref("event_registration_registrationzen0")], {"active_ids": [ref("event.menu_action_registration")]})
- |
- Third person create New Registration for "Conference on ERP Business" event.
+ Third person create New Registration for "Conference on OpenERP Offshore Business" event.
-
!record {model: event.registration, id: event_registration_registrationpassot0}:
badge_name: Passot
@@ -155,7 +154,7 @@
date_deadline: '2010-06-07 13:39:00'
email_from: info@mediapole.net
event_id: 'event_event_conference0'
- invoice_label: Ticket for Concert
+ event_product: Ticket for Concert
name: 'Registration: Passot'
partner_id: base.res_partner_8
partner_invoice_id: base.res_partner_8
@@ -185,17 +184,6 @@
!python {model: event.partners.list}: |
self.list_partners(cr, uid, [ref("event_partners_list_0")], {"active_ids":
[ref("event.event_event_conference0")]})
-
-- |
- We check all registrations on current event using the wizard "Registrations"
--
- !record {model: event.registration.list, id: event_registration_list_0}:
- {}
-- |
- I click on "Open Registrations" button of "Registrations" wizard.
--
- !python {model: event.registration.list}: |
- self.open_registration(cr, uid, [ref("event_registration_list_0")], {"active_ids": [ref("event.event_event_conference0")]})
- |
This event is finished by click on "Event Done" button of this event form.
@@ -211,16 +199,15 @@
- |
Now, I will invoice the participant who have address using "Make Invoices". This wizard will also give the number of invoices are created and rejected.
Create invoice will be linked to Invoice Field available on Payments tab of registrations
+
-
!record {model: event.make.invoice, id: event_make_invoice_0}:
- inv_created: '0'
- inv_rej_reason: 'ID 1: Registration already has an invoice linked. \n'
- inv_rejected: '1'
+ {}
- |
- I click on "Open" button of this "Make Invoices" wizard.
+ I click on "Done" button of this "Make Invoices" wizard.
-
!python {model: event.make.invoice}: |
- self.confirm(cr, uid, [ref("event_make_invoice_0")], {"active_ids": [ref("event_registration_registrationjacot0")]})
+ self.make_invoice(cr, uid, [ref("event_make_invoice_0")], {"active_ids": [ref("event_registration_registrationzen0")]})
- |
I check that Invoice for this partner is create or not.
-
@@ -230,10 +217,11 @@
inv_obj = self.pool.get('account.invoice')
data_event_reg = obj_event_reg.browse(cr, uid, [ref('event_registration_registrationzen0')], context=context)[0]
invoice_ids = inv_obj.search(cr, uid, [('partner_id', '=', data_event_reg.partner_invoice_id.id)])
- invoice_id = inv_obj.browse(cr, uid, invoice_ids)
- if invoice_id:
- line_ids = obj_lines.search(cr, uid, [('product_id', '=', data_event_reg.event_id.product_id), ('invoice_id', '=', invoice_id.id), ('price_unit', '=', data_event_reg.unit_price)])
+
+ if invoice_ids:
+ invoice_id = inv_obj.browse(cr, uid, invoice_ids)[0]
+ line_ids = obj_lines.search(cr, uid, [('product_id', '=', data_event_reg.event_id.product_id.id), ('invoice_id', '=', invoice_id.id), ('price_unit', '=', data_event_reg.unit_price)])
line_id = obj_lines.browse(cr, uid, line_ids)[0]
- assert line_id.product_id == data_event_reg.product_id
+ assert line_id.product_id == data_event_reg.event_id.product_id
assert data_event_reg.partner_id == invoice_id.partner_id
- assert invoice_id.address_invoice_id == data_event_reg.partner_address_id
+ assert invoice_id.address_invoice_id == data_event_reg.partner_address_id \ No newline at end of file
diff --git a/addons/event/wizard/__init__.py b/addons/event/wizard/__init__.py
index 81191b5a2f9..bf8975b1611 100755
--- a/addons/event/wizard/__init__.py
+++ b/addons/event/wizard/__init__.py
@@ -19,7 +19,6 @@
#
##############################################################################
-import event_registration
import event_make_invoice
import event_registrations_partner
import event_confirm_registration
diff --git a/addons/event/wizard/event_confirm_registration.py b/addons/event/wizard/event_confirm_registration.py
index 0e64c0abe53..bb153fb0862 100755
--- a/addons/event/wizard/event_confirm_registration.py
+++ b/addons/event/wizard/event_confirm_registration.py
@@ -20,7 +20,8 @@
##############################################################################
from osv import fields, osv
-
+from tools.translate import _
+
class event_confirm_registration(osv.osv_memory):
"""
Confirm Event Registration
@@ -37,10 +38,13 @@ class event_confirm_registration(osv.osv_memory):
def confirm(self, cr, uid, ids, context):
registration_obj = self.pool.get('event.registration')
+
reg_id = context.get('reg_id', False) or context.get('active_id', False)
+ reg_ids = registration_obj.browse(cr, uid, [reg_id])
+
if reg_id:
registration_obj.write(cr, uid, [reg_id], {'state':'open', })
- registration_obj._history(cr, uid, [reg_id], 'Open', history=True)
+ registration_obj._history(cr, uid, reg_ids, _('Open'))
registration_obj.mail_user(cr, uid, [reg_id])
return {}
diff --git a/addons/event/wizard/event_make_invoice.py b/addons/event/wizard/event_make_invoice.py
index 7a8bcfb489b..a334d2e6c36 100755
--- a/addons/event/wizard/event_make_invoice.py
+++ b/addons/event/wizard/event_make_invoice.py
@@ -19,6 +19,7 @@
#
##############################################################################
from osv import fields, osv
+from tools.translate import _
class event_make_invoice(osv.osv_memory):
"""
@@ -27,125 +28,69 @@ class event_make_invoice(osv.osv_memory):
_name = "event.make.invoice"
_description = "Event Make Invoice"
_columns = {
- 'inv_created': fields.char('Invoice Created', size=32, readonly=True),
- 'inv_rejected': fields.char('Invoice Rejected', size=32, readonly=True),
- 'inv_rej_reason': fields.text('Error Messages', readonly=True),
+
+ 'grouped': fields.boolean('Group the invoices'),
+ 'invoice_date':fields.date('Invoice Date'),
# 'invoice_ids': fields.char('Invoice Ids', size=128), # Improve me
- }
+ }
- def _makeInvoices(self, cr, uid, context={}):
+ def view_init(self, cr, uid, fields, context=None):
"""
- Get default value for fields
+ This function checks for precondition before wizard executes
+ @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 fields: List of fields for default value
@param context: A standard dictionary for contextual values
- @return: Dictionary of value
"""
-
- invoices = {}
- invoice_ids = []
- create_ids=[]
- tax_ids=[]
- inv_create = 0
- inv_reject = 0
- inv_rej_reason = ""
- list_inv = []
obj_event_reg = self.pool.get('event.registration')
- obj_lines = self.pool.get('account.invoice.line')
- inv_obj = self.pool.get('account.invoice')
- data_event_reg = obj_event_reg.browse(cr, uid, context['active_ids'], context=context)
-
- for reg in data_event_reg:
- if reg.state=='draft':
- inv_reject = inv_reject + 1
- inv_rej_reason += "ID "+str(reg.id)+": Invoice cannot be created if the registration is in draft state. \n"
- continue
- if (not reg.tobe_invoiced):
- inv_reject = inv_reject + 1
- inv_rej_reason += "ID "+str(reg.id)+": Registration is set as 'Cannot be invoiced'. \n"
- continue
- if reg.invoice_id:
- inv_reject = inv_reject + 1
- inv_rej_reason += "ID "+str(reg.id)+": Registration already has an invoice linked. \n"
- continue
- if not reg.event_id.product_id:
- inv_reject = inv_reject + 1
- inv_rej_reason += "ID "+str(reg.id)+": Event related doesn't have any product defined. \n"
- continue
- if not reg.partner_invoice_id:
- inv_reject = inv_reject + 1
- inv_rej_reason += "ID "+str(reg.id)+": Registration doesn't have any partner to invoice. \n"
- continue
- else:
- val_invoice = inv_obj.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:
- inv_reject = inv_reject + 1
- inv_rej_reason += "ID "+str(reg.id)+": Registered partner doesn't have an address to make the invoice. \n"
- continue
-
- inv_create = inv_create + 1
- value = obj_lines.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)
- data_product = self.pool.get('product.product').browse(cr, uid, [reg.event_id.product_id.id])
- for tax in data_product[0].taxes_id:
- tax_ids.append(tax.id)
-
- vals = value['value']
- c_name = reg.contact_id and ('-' + self.pool.get('res.partner.contact').name_get(cr, uid, [reg.contact_id.id])[0][1]) or ''
- vals.update({
- 'name': reg.invoice_label + '-' + 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 = obj_event_reg._create_invoice_lines(cr, uid, [reg.id], vals)
-
- val_invoice['value'].update({
- 'origin': reg.invoice_label,
- 'reference': False,
- 'invoice_line': [(6, 0, [inv_line_ids])],
- 'comment': "",
- })
-
- inv_id = inv_obj.create(cr, uid, val_invoice['value'])
- list_inv.append(inv_id)
- obj_event_reg.write(cr, uid, reg.id, {'invoice_id': inv_id, 'state': 'done'})
- obj_event_reg._history(cr, uid, [reg.id], 'Invoiced', history=True)
+ 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 !'),
+ _("Invoice cannot be created if the registration is in draft state."))
+ if (not event_reg.tobe_invoiced):
+ raise osv.except_osv(_('Warning !'),
+ _("Registration is set as Cannot be invoiced"))
-# {'inv_created' : str(inv_create) , 'inv_rejected' : str(inv_reject), 'invoice_ids': str(list_inv), 'inv_rej_reason': inv_rej_reason}
- return {'inv_created': str(inv_create), 'inv_rejected': str(inv_reject), 'inv_rej_reason': inv_rej_reason}
+ if not event_reg.event_id.product_id:
+ raise osv.except_osv(_('Warning !'),
+ _("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."))
def default_get(self, cr, uid, fields_list, context=None):
res = super(event_make_invoice, self).default_get(cr, uid, fields_list, context)
- res.update(self._makeInvoices(cr, uid, context=context))
return res
- def confirm(self, cr, uid, ids, context={}):
- """
- Open Account invoice form.
- @param cr: the current row, from the database cursor,
- @param uid: the current user’s ID for security checks,
- @param ids: List of event make invoice's Id.
- @param context: A standard dictionary for contextual values
- @return: Dictionary of value
- """
- obj_model = self.pool.get('ir.model.data')
- data_inv = self.read(cr, uid, ids, [], context)[0]
- model_data_ids = obj_model.search(cr, uid, [('model', '=', 'ir.ui.view'), ('name', '=', 'invoice_form')])
- resource_id = obj_model.read(cr, uid, model_data_ids, fields=['res_id'])[0]['res_id']
+ def make_invoice(self, cr, uid, ids, context={}):
+
+ reg_obj = self.pool.get('event.registration')
+ newinv = []
+
+ for data in self.browse(cr, uid, ids):
+ reg_obj.action_invoice_create(cr, uid, context.get(('active_ids'),[]), data.grouped, date_inv = data.invoice_date)
+
+ # reg_id = reg_obj.browse(cr, uid, ids)[0]
+
+ 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'])
+
return {
-# 'domain': "[('id','in', ["+','.join(map(str,data_inv['invoice_ids']))+"])]",
- 'name': 'Invoices',
- 'view_type': 'form',
- 'view_mode': 'tree,form',
- 'res_model': 'account.invoice',
- 'views': [(False, 'tree'), (resource_id, 'form')],
- 'context': "{'type':'out_invoice'}",
- 'type': 'ir.actions.act_window'
+ # 'domain': "[('id','in', ["+','.join(map(str,newinv))+"])]",
+ 'name': 'Invoices',
+ 'view_type': 'form',
+ 'view_mode': 'tree,form',
+ 'res_model': 'account.invoice',
+ 'view_id': False,
+ 'context': "{'type':'out_refund'}",
+ 'type': 'ir.actions.act_window',
+ 'search_view_id': id['id']
}
-
+
event_make_invoice()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file
diff --git a/addons/event/wizard/event_make_invoice_view.xml b/addons/event/wizard/event_make_invoice_view.xml
index 0f4c7c9c152..68a07ceeee8 100755
--- a/addons/event/wizard/event_make_invoice_view.xml
+++ b/addons/event/wizard/event_make_invoice_view.xml
@@ -7,15 +7,17 @@
<field name="model">event.make.invoice</field>
<field name="type">form</field>
<field name="arch" type="xml">
- <form string="Make Invoices">
- <field name="inv_created" />
- <field name="inv_rejected" />
- <field name="inv_rej_reason" colspan="4"/>
- <group colspan="4" col="6">
- <button icon="gtk-cancel" special="cancel" string="_Ok"/>
- <button icon="gtk-ok" name="confirm" string="Open" type="object"/>
- </group>
- </form>
+ <form string="Create invoices">
+ <separator colspan="4" string="Do you really want to create the invoices ?" />
+ <field name="grouped" />
+ <field name="invoice_date"/>
+ <group colspan="4">
+ <separator string="" colspan="4" />
+ <label string="" colspan="2"/>
+ <button special="cancel" string="Close" icon="gtk-close"/>
+ <button name="make_invoice" string="Done" type="object" icon="gtk-ok"/>
+ </group>
+ </form>
</field>
</record>
diff --git a/addons/event/wizard/event_registrations_partner.xml b/addons/event/wizard/event_registrations_partner.xml
index bc982757435..a1700c3689b 100755
--- a/addons/event/wizard/event_registrations_partner.xml
+++ b/addons/event/wizard/event_registrations_partner.xml
@@ -9,16 +9,16 @@
<field name="arch" type="xml">
<form string="Event Partners">
<group colspan="4" col="2">
- <separator string="List Registrer Partners" colspan="4"/>
+ <separator string="Register Partners" colspan="4"/>
<button special="cancel" string="Close" icon="gtk-close"/>
- <button name="list_partners" string="Open Partners" type="object" icon="gtk-open"/>
+ <button name="list_partners" string="Open Partners" type="object" icon="gtk-open"/>
</group>
</form>
</field>
</record>
<record id="action_event_partners" model="ir.actions.act_window">
- <field name="name">List Register Partners</field>
+ <field name="name">Register Partners</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">event.partners.list</field>
<field name="view_type">form</field>