[imp] change the event view.

bzr revid: nco@tinyerp.com-20120427093242-o9srduq715lbqt8t
This commit is contained in:
Nimesh (Open ERP) 2012-04-27 15:02:42 +05:30
parent edd102bc77
commit fa10c5cec7
7 changed files with 238 additions and 72 deletions

View File

@ -53,7 +53,7 @@ Note that:
],
'demo_xml': ['event_demo.xml'],
'test': ['test/process/event_draft2done.yml'],
'css': ['static/src/css/event.css'],
'css': ['static/src/css/*.css'],
'installable': True,
'application': True,
'auto_install': False,

View File

@ -220,6 +220,8 @@ class event_event(osv.osv):
'note': fields.text('Description', readonly=False, states={'done': [('readonly', True)]}),
'company_id': fields.many2one('res.company', 'Company', required=False, change_default=True, readonly=False, states={'done': [('readonly', True)]}),
'is_subscribed' : fields.function(_subscribe_fnc, type="boolean", string='Subscribed'),
'location_id': fields.many2one('res.company','Location Address', readonly=False, states={'done': [('readonly', True)]}),
}
_defaults = {
@ -408,6 +410,5 @@ class event_registration(osv.osv):
return {'value': data}
event_registration()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -45,6 +45,39 @@
<menuitem name="Configuration" id="base.menu_marketing_config_root" parent="event_main_menu" sequence="30"/>
<menuitem name="Types of Events" id="menu_event_type" action="action_event_type" parent="base.menu_marketing_config_root" groups="base.group_no_one"/>
<!-- Event Item Tree view-->
<record model="ir.ui.view" id="view_event_items_tree">
<field name="name">Event Items Tree</field>
<field name="model">event.items</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Event Items">
<field name="product_id" string="Ticket Type" />
<field name="uom_id"/>
<field name="sales_end_date"/>
<field name="price"/>
<field name="qty"/>
</tree>
</field>
</record>
<!-- Event Item Form View -->
<record model="ir.ui.view" id="view_event_items_form">
<field name="name">Event Items Form</field>
<field name="model">event.items</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Event Items">
<field name="product_id" on_change="onchange_product_id(product_id)"/>
<field name="price"/>
<field name="qty"/>
<field name="uom_id"/>
<field name="discount"/>
<field name="sales_end_date"/>
</form>
</field>
</record>
<!-- Events Organisation/CONFIGURATION/EVENTS -->
<record model="ir.ui.view" id="view_event_form">
@ -52,20 +85,75 @@
<field name="model">event.event</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Events">
<group col="6" colspan="4">
<field name="name"/>
<field name="date_begin"/>
<field name="date_end"/>
<field name="type" on_change="onchange_event_type(type,context)"/>
<field name="user_id"/>
<field name="address_id" />
</group>
<form string="Events" layout="manual">
<div class="oe_form_topbar">
<button string="Cancel Event" name="button_cancel" states="draft,confirm" type="object" icon="gtk-cancel"/>
<button string="Confirm Event" name="button_confirm" states="draft" type="object" icon="gtk-apply"/>
<button string="Event Done" name="button_done" states="confirm" type="object" icon="gtk-jump-to"/>
<button string="Set To Draft" name="button_draft" states="cancel,done" type="object" icon="gtk-convert"/>
<div class="oe_right">
<field name="state" nolabel="1" widget="statusbar" statusbar_visible="draft,open,done" statusbar_colors='{"pending":"blue"}'/>
</div>
</div>
<sheet string="Event Form" layout="auto">
<group col="2">
<group col="2">
<div class="oe_event_title">
<field name="name" nolabel="1"/>
</div>
<newline/>
<group colspan="4" string="vanue">
<div class="sub1"> Venue : </div> <separator orientation="vertical"/>
<field name="location_id" nolabel="1"/>
</group>
</group>
<group>
<div class="mapbox"> </div><newline/>
<!--table>
<tr>
<td width="70px" style="text-align:top;" class="oe_td_border">
Where
</td>
<td width="150px">
<field name="address_id" nolabel="1"/>
</td>
<td width="150px">
<span width="15px"> Start</span> <field name="date_begin" nolabel="1"/>
<span width="15px"> End</span> <field name="date_end" nolabel="1"/>
</td>
</tr>
</table-->
<table>
<tr>
<td width="70px" class="oe_td_border">
Where
</td>
<td width="150px">
<field name="address_id" nolabel="1"/>
</td>
<td width="auto">
<table>
<tr>
<td class="oe_td_date_border">Start</td><td><field name="date_begin" nolabel="1"/></td>
</tr>
<tr>
<td class="oe_td_date_border">End</td><td><field name="date_end" nolabel="1"/></td>
</tr>
</table>
</td>
</tr>
</table>
<!--field name="date_end" label="To" string="end"/-->
</group>
</group>
<notebook colspan="4">
<page string="Event">
<separator string="Description" colspan="4"/>
<field name="note" colspan="4" nolabel="1"/>
<field name="registration_ids" colspan="4" nolabel="1" groups="event.group_event_manager,event.group_event_user">
<field name="registration_ids" colspan="4" nolabel="1" groups="event.group_event_manager">
<tree string="Registration" editable="top">
<field name="name" />
<field name="email" />
@ -98,13 +186,7 @@
</group>
</form>
</field>
<field name="state" select="1" widget="statusbar" statusbar_visible="draft,confirm,done"/>
<group col="4" colspan="2">
<button string="Cancel Event" name="button_cancel" states="draft,confirm" type="object" icon="gtk-cancel"/>
<button string="Confirm Event" name="button_confirm" states="draft" type="object" icon="gtk-apply"/>
<button string="Event Done" name="button_done" states="confirm" type="object" icon="gtk-jump-to"/>
<button string="Set To Draft" name="button_draft" states="cancel,done" type="object" icon="gtk-convert"/>
</group>
</page>
<page string="Speakers" groups="base.group_extended">
<field name="main_speaker_id" domain="[('speaker','=',True)]"/>
@ -112,7 +194,7 @@
<separator string="Other Speakers" colspan="4"/>
<field name="speaker_ids" domain="[('speaker','=',True)]" colspan="4" nolabel="1"/>
</page>
<page string="Extra Info">
<page string="Extra Info" groups="event.group_event_manager">
<group col="2" colspan="2">
<separator string="Registrations" colspan="2"/>
<field name="register_min"/>
@ -129,6 +211,7 @@
</group>
</page>
</notebook>
</sheet>
</form>
</field>
</record>

View File

@ -64,6 +64,7 @@ div.oe_fold_column{
-webkit-font-smoothing: antialiased;
outline: none;
}
.oe_event_button_unsubscribe {
display: inline-block;
border: 1px solid #AAA;
@ -116,7 +117,36 @@ div.oe_fold_column{
background-color: #DC5F59;
}
.no_of_seats{
width:25px;
width:25px;
}
.oe_event_title{
font-size: 25px;
}
.sub1
{
float:left;
}
.sub2
{
padding-left:50px;
text-align:left;
}
.mapbox
{
width:380px;
height:200px;
border:1px;
margin-left:auto;
margin-right:auto;
border:solid #677933;
}
.oe_td_border
{
width: 5em;
padding: 2px;
border-right: 1px solid black;
}
.oe_td_date_border
{
border-right:1px solid black;
}

View File

@ -34,12 +34,15 @@ This module allows you to automatize and connect your registration creation with
It defines a new kind of service products that offers you the possibility to choose an event category associated with it. When you encode a sale order for that product, you will be able to choose an existing event of that category and when you confirm your sale order it will automatically create a registration for this event.
""",
'author': 'OpenERP SA',
'depends': ['event','sale','sale_crm'],
'depends': ['event','sale','sale_crm','portal'],
'update_xml': [
'event_sale_view.xml',
],
'demo_xml': ['event_demo.xml'],
'js': ['static/src/js/*.js'],
'html': ['static/*.html'],
'test':['test/confirm.yml'],
'css': ['static/src/css/*.css'],
'installable': True,
'active': False,
}

View File

@ -19,6 +19,7 @@
#
##############################################################################
import time
from osv import fields, osv
from tools.translate import _
@ -92,13 +93,53 @@ class sale_order_line(osv.osv):
message = _("The registration %s has been created from the Sale Order %s.") % (registration_id, order_line.order_id.name)
registration_obj.log(cr, uid, registration_id, message)
return super(sale_order_line, self).button_confirm(cr, uid, ids, context=context)
class event_event(osv.osv):
_inherit = 'event.event'
_columns = {
'event_item_ids': fields.one2many('event.items','event_id', 'Event Items'),
}
'event_item_ids': fields.one2many('event.items','event_id', 'Event Items'),
}
def make_order(self, cr, uid, ids, partner_id, context=None):
sale_order = self.pool.get('sale.order')
sale_order_line_obj = self.pool.get('sale.order.line')
res_partner_obj = self.pool.get('res.partner')
prod_pricelist_obj = self.pool.get('product.pricelist')
res_users_obj = self.pool.get('res.users')
customer = res_partner_obj.browse(cr, uid, partner_id, context=context)
partner_id = res_users_obj.browse(cr, uid, uid, context=context).partner_id.id
if not partner_id:
user_name = res_users_obj.browse(cr, uid, uid, context=context).name
partner_id = res_partner_obj.create(cr, uid, {'name': user_name})
price_list = prod_pricelist_obj.search(cr,uid,[],context=context)[0]
for order_lines in self.browse(cr, uid, ids, context=context):
if order_lines.event_item_ids:
product = order_lines.id
sale_id = sale_order.create(cr, uid, {
'partner_id': partner_id,
'pricelist_id': price_list,
'partner_invoice_id': partner_id,
'partner_shipping_id': partner_id,
'date_order': order_lines.date_begin
})
for line in order_lines.event_item_ids:
sale_order_line_obj.create(cr, uid, {
'order_id': sale_id,
'name': order_lines.name,
'product_uom_qty': line.qty,
'product_id': product,
'product_uom': line.uom_id.id,
'price_unit': line.price,
'date_planned': line.sales_end_date,
}, context=context)
self.write(cr, uid, ids, {'state': 'confirm'}, context=context)
return True
class event_items(osv.osv):
_name = "event.items"
_columns = {
@ -110,7 +151,7 @@ class event_items(osv.osv):
'event_id': fields.many2one('event.event', 'Event'),
'sales_end_date': fields.date('Sales End')
}
def onchange_product_id(self, cr, uid, ids, product, context=None):
product_obj = self.pool.get('product.product')
data = {}

View File

@ -30,49 +30,57 @@
</field>
</record>
<record model="ir.ui.view" id="view_event_form_inherit">
<field name="name">Events Inherit</field>
<field name="model">event.event</field>
<field name="type">form</field>
<field name="inherit_id" ref="event.view_event_form"/>
<field name="arch" type="xml">
<xpath expr="//notebook[last()]" position="inside">
<page string="Event Items">
<field name="event_item_ids" nolabel="1"/>
</page>
</xpath>
</field>
</record>
<record model="ir.ui.view" id="view_event_form_inherit">
<field name="name">Events Inherit</field>
<field name="model">event.event</field>
<field name="type">form</field>
<field name="inherit_id" ref="event.view_event_form"/>
<field name="arch" type="xml">
<xpath expr="//group[@string='vanue']" position="after">
<field name="event_item_ids" nolabel="1"/><newline/>
<div class="oe_right">
<button string="Order Now" name="make_order" help="Order Event" type="object" icon="gtk-ok" attrs="{'invisible':[('state','=','confirm')]}"/>
</div>
</xpath>
<xpath expr="//group[@string='vanue']" position="attributes">
<attribute name="string"></attribute>
</xpath>
</field>
</record>
<record model="ir.ui.view" id="view_event_items_tree">
<field name="name">Event Items Tree</field>
<field name="model">event.items</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Event Items">
<field name="product_id"/>
<field name="price"/>
<field name="qty"/>
<field name="uom_id"/>
<field name="discount"/>
<field name="sales_end_date"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="view_event_items_form">
<field name="name">Event Items Form</field>
<field name="model">event.items</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Event Items">
<field name="product_id" domain="[('event_ok','=',True)]" on_change="onchange_product_id(product_id)"/>
<field name="price"/>
<field name="qty"/>
<field name="uom_id"/>
<field name="discount"/>
<field name="sales_end_date"/>
</form>
</field>
</record>
<record model="ir.ui.view" id="view_event_items_tree">
<field name="name">Event Items Tree</field>
<field name="model">event.items</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Event Items">
<field name="product_id"/>
<field name="price"/>
<field name="uom_id"/>
<field name="discount"/>
<field name="sales_end_date"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="view_event_items_form">
<field name="name">Event Items Form</field>
<field name="model">event.items</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Event Items">
<field name="product_id" domain="[('event_ok','=',True)]" on_change="onchange_product_id(product_id)"/>
<field name="price"/>
<field name="uom_id"/>
<field name="discount"/>
<field name="sales_end_date"/>
</form>
</field>
</record>
</data>
</openerp>