[FIX]: Add osv memory wizard for event preview.Refactor code as per new specification.
bzr revid: atp@tinyerp.com-20120521132458-xozrh3vcz4wbo6t5
This commit is contained in:
parent
96fde61acf
commit
4a02e98d42
|
@ -46,6 +46,7 @@ Note that:
|
|||
'security/event_security.xml',
|
||||
'security/ir.model.access.csv',
|
||||
'wizard/event_confirm_view.xml',
|
||||
'wizard/event_preview_view.xml',
|
||||
'event_view.xml',
|
||||
'report/report_event_registration_view.xml',
|
||||
'board_association_view.xml',
|
||||
|
@ -54,7 +55,7 @@ Note that:
|
|||
],
|
||||
'demo_xml': ['event_demo.xml'],
|
||||
'test': ['test/process/event_draft2done.yml'],
|
||||
# 'js': ['static/src/js/google_map.js'],
|
||||
'js': ['static/src/js/google_map.js'],
|
||||
'qweb': ['static/src/xml/event_address.xml'],
|
||||
'css': ['static/src/css/event.css'],
|
||||
'installable': True,
|
||||
|
|
|
@ -219,49 +219,14 @@ class event_event(osv.osv):
|
|||
'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'),
|
||||
'available_qty': fields.integer('Availabel Quantity'),
|
||||
'sale_end_date': fields.datetime('SalesEnd'),
|
||||
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
'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,
|
||||
}
|
||||
|
||||
def order_now(self, cr, uid, ids, context=None):
|
||||
register_pool = self.pool.get('event.registration')
|
||||
user_pool = self.pool.get('res.users')
|
||||
data_obj = self.pool.get('ir.model.data')
|
||||
user = user_pool.browse(cr, uid, uid, context=context)
|
||||
for event in self.browse(cr, uid, ids, context):
|
||||
self.check_registration_limits_before(cr, uid, ids, event.available_qty, context=context)
|
||||
curr_reg_ids = register_pool.search(cr, uid, [('user_id', '=', user.id), ('event_id', '=' , event.id)])
|
||||
#the subscription is done with UID = 1 because in case we share the kanban view, we want anyone to be able to subscribe
|
||||
print "event.curre_reg_ids",event.available_qty
|
||||
if not curr_reg_ids and event.available_qty > 0:
|
||||
print "cccccccccccc",event.available_qty
|
||||
curr_reg_ids = [register_pool.create(cr, 1, {'event_id': event.id ,'email': user.user_email, 'name':user.name, 'user_id': user.id, 'nb_register': event.available_qty})]
|
||||
elif event.available_qty > 0:
|
||||
print "mmmmmmm",event.available_qty
|
||||
register_pool.write(cr, uid, curr_reg_ids, {'nb_register': event.available_qty}, context=context)
|
||||
if event.available_qty > 0:
|
||||
register_pool.confirm_registration(cr, 1, curr_reg_ids, context=context)
|
||||
view_id = data_obj._get_id(cr, uid, 'event', 'view_event_registration_form')
|
||||
if view_id:
|
||||
res_id = data_obj.browse(cr, uid, view_id, context=context).res_id
|
||||
res = {
|
||||
'name': _('Registration'),
|
||||
'view_type': 'form',
|
||||
'view_mode': 'form',
|
||||
'res_model': 'event.registration',
|
||||
'res_id': curr_reg_ids[0],
|
||||
'views':[(res_id,'form'), (False, 'tree')],
|
||||
'type': 'ir.actions.act_window',
|
||||
'nodestroy': True,
|
||||
'target': 'current',
|
||||
}
|
||||
return res
|
||||
|
||||
def subscribe_to_event(self, cr, uid, ids, context=None):
|
||||
register_pool = self.pool.get('event.registration')
|
||||
user_pool = self.pool.get('res.users')
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
|
||||
<!-- Events Organisation/CONFIGURATION/EVENTS -->
|
||||
|
||||
<!-- <record model="ir.ui.view" id="view_event_form">
|
||||
<record model="ir.ui.view" id="view_event_form">
|
||||
<field name="name">Events</field>
|
||||
<field name="model">event.event</field>
|
||||
<field name="type">form</field>
|
||||
|
@ -120,7 +120,6 @@
|
|||
<field name="register_prospect"/>
|
||||
<field name="register_current"/>
|
||||
<field name="register_attended"/>
|
||||
<field name="location_id"/>
|
||||
</group>
|
||||
<group col="2" colspan="2">
|
||||
<separator string="Emails" colspan="2"/>
|
||||
|
@ -132,104 +131,7 @@
|
|||
</notebook>
|
||||
</form>
|
||||
</field>
|
||||
</record> -->
|
||||
|
||||
<record model="ir.ui.view" id="view_event_form">
|
||||
<field name="name">Events</field>
|
||||
<field name="model">event.event</field>
|
||||
<field name="type">form</field>
|
||||
<field name="priority">20</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Preview" 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 layout="auto">
|
||||
<group colspan="4" col="2">
|
||||
<field name="name" class="oe_form_title" width="80%%" nolabel="1"/>
|
||||
</group>
|
||||
<group colspan="2" col="2" class="oe_form_group_label_border">
|
||||
<field name="address_id" widget ="geo_address" string="Venue"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group colspan="2" col="2" class="oe-listview-content">
|
||||
<label string="Ticket Description"/>
|
||||
<label string="Quantity"/>
|
||||
<field nolabel="1" name="full_name" />
|
||||
<field nolabel="1" name="available_qty" />
|
||||
</group>
|
||||
<newline/>
|
||||
<group colspan="2" col="2">
|
||||
<button name="order_now" string="Order Now" type="object" icon="gtk-apply" />
|
||||
</group>
|
||||
<notebook colspan="4">
|
||||
<page string="Event">
|
||||
<group colspan="2" col="2" class="oe_form_group_label_border">
|
||||
<field name="register_min"/>
|
||||
<field name="register_max"/>
|
||||
</group>
|
||||
<group colspan="2" col="2" class="oe_form_group_label_border">
|
||||
<field name="register_current"/>
|
||||
<field name="register_prospect"/>
|
||||
<field name="register_attended"/>
|
||||
</group>
|
||||
<field name="registration_ids" colspan="4" nolabel="1" groups="event.group_event_manager,event.group_event_user">
|
||||
<tree string="Registration" editable="top">
|
||||
<field name="name" />
|
||||
<field name="email" />
|
||||
<field name="phone"/>
|
||||
<field name="nb_register" />
|
||||
<field name="state"/>
|
||||
<button name="registration_open" string="Confirm Registration" states="draft" type="object" icon="gtk-apply"/>
|
||||
<button name="button_reg_close" string="Attented the Event" states="open" type="object" icon="gtk-jump-to"/>
|
||||
<button name="button_reg_cancel" string="Cancel Registration" states="draft,open" type="object" icon="gtk-cancel"/>
|
||||
</tree>
|
||||
<form string="Registration">
|
||||
<field name="partner_id" attrs="{'readonly':[('state','!=', 'draft')]}" on_change="onchange_partner_id(partner_id, context)" />
|
||||
<field name="name"/>
|
||||
<group colspan="4" col="4">
|
||||
<field name="email"/>
|
||||
<field name="phone"/>
|
||||
</group>
|
||||
<group colspan="4" col="4">
|
||||
<field name="nb_register"/>
|
||||
</group>
|
||||
<group colspan="4" col="4">
|
||||
</group>
|
||||
<group col="8" colspan="4">
|
||||
<separator string="" colspan="4"/>
|
||||
<newline/>
|
||||
<field name="state" select="1" colspan="2"/>
|
||||
<button name="registration_open" string="Confirm Registration" states="draft" type="object" icon="gtk-apply"/>
|
||||
<button name="button_reg_close" string="Attended the Event" states="open" type="object" icon="gtk-jump-to"/>
|
||||
<button name="button_reg_cancel" string="Cancel Registration" states="draft,open" type="object" icon="gtk-cancel"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</page>
|
||||
|
||||
<page string="Speakers">
|
||||
<field name="main_speaker_id" domain="[('speaker','=',True)]" context="{'default_speaker':1}"/>
|
||||
<field name="speaker_confirmed"/>
|
||||
<separator string="Other Speakers" colspan="4"/>
|
||||
<field name="speaker_ids" domain="[('speaker','=',True)]" context="{'default_speaker':1}" colspan="4" nolabel="1"/>
|
||||
</page>
|
||||
</notebook>
|
||||
<separator colspan="4" string="Details"/>
|
||||
<field name="note" nolabel="1" colspan="4"/>
|
||||
</sheet>
|
||||
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
</record>
|
||||
|
||||
<!-- Event tree view -->
|
||||
|
||||
|
@ -257,6 +159,7 @@
|
|||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
|
||||
<!-- Event Kanban View -->
|
||||
|
||||
|
@ -308,7 +211,9 @@
|
|||
<button t-att-id="'btn_sub'+record.id.raw_value" type="object" name="subscribe_to_event" class="subscribe_button oe_event_button_subscribe">
|
||||
<span >Subscribe</span>
|
||||
</button>
|
||||
<a string="Edit" icon="gtk-edit" type="edit"/>
|
||||
<button name="%(action_event_preview)d" type="action">
|
||||
<span>Preview</span>
|
||||
</button>
|
||||
</t>
|
||||
</t>
|
||||
<t t-if="record.is_subscribed.raw_value">
|
||||
|
@ -316,7 +221,6 @@
|
|||
<span>Subscribed</span>
|
||||
<span class="unsubscribe">Unsubscribe</span>
|
||||
</button>
|
||||
|
||||
</t>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -584,7 +488,7 @@
|
|||
<field name="view_mode">tree,form,calendar,graph</field>
|
||||
<field name="context">{}</field>
|
||||
<field name="search_view_id" ref="view_registration_search"/>
|
||||
</record>
|
||||
</record>view_
|
||||
|
||||
<menuitem
|
||||
name="Registrations"
|
||||
|
|
|
@ -33,69 +33,25 @@ div.oe_fold_column{
|
|||
padding:0px !important;
|
||||
}
|
||||
.oe_event_button_subscribe {
|
||||
display: inline-block;
|
||||
border: 1px solid #ababab;
|
||||
color: #404040;
|
||||
font-size: 12px;
|
||||
padding: 0px !important;
|
||||
text-align: center;
|
||||
-o-background-size: 100% 100%;
|
||||
-moz-background-size: 100% 100%;
|
||||
-webkit-background-size: auto auto !important;
|
||||
background-size: 100% 100%;
|
||||
background: #d8d8d8 none;
|
||||
background: none, -webkit-gradient(linear, left top, left bottom, from(#efefef), to(#d8d8d8));
|
||||
background: none, -webkit-linear-gradient(#efefef, #d8d8d8);
|
||||
background: none, -moz-linear-gradient(#efefef, #d8d8d8);
|
||||
background: none, -o-linear-gradient(top, #efefef, #d8d8d8);
|
||||
background: none, -khtml-gradient(linear, left top, left bottom, from(#efefef), to(#d8d8d8));
|
||||
background: -ms-linear-gradient(top, #efefef, #d8d8d8);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#efefef', endColorstr='#d8d8d8',GradientType=0 );
|
||||
-moz-border-radius: 3px;
|
||||
-webkit-border-radius: 3px;
|
||||
-o-border-radius: 3px;
|
||||
-ms-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
-moz-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 1px rgba(255, 255, 255, 0.8) inset;
|
||||
-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 1px rgba(255, 255, 255, 0.8) inset;
|
||||
-o-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 1px rgba(255, 255, 255, 0.8) inset;
|
||||
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 1px rgba(255, 255, 255, 0.8) inset;
|
||||
text-shadow: 0 1px 1px rgba(255, 255, 255, 0.5);
|
||||
-webkit-font-smoothing: antialiased;
|
||||
outline: none;
|
||||
color: white;
|
||||
background-color: #8a89ba;
|
||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#8a89ba), to(#807fb4));
|
||||
background-image: -webkit-linear-gradient(top, #8a89ba, #807fb4);
|
||||
background-image: -moz-linear-gradient(top, #8a89ba, #807fb4);
|
||||
background-image: -ms-linear-gradient(top, #8a89ba, #807fb4);
|
||||
background-image: -o-linear-gradient(top, #8a89ba, #807fb4);
|
||||
background-image: linear-gradient(to bottom, #8a89ba, #807fb4);
|
||||
}
|
||||
|
||||
.oe_event_button_unsubscribe {
|
||||
display: inline-block;
|
||||
border: 1px solid #AAA;
|
||||
color: #404040;
|
||||
font-size: 12px;
|
||||
padding: 3px 10px;
|
||||
text-align: center;
|
||||
-o-background-size: 100% 100%;
|
||||
-moz-background-size: 100% 100%;
|
||||
-webkit-background-size: auto auto !important;
|
||||
background-size: 100% 100%;
|
||||
background: #AAA none;
|
||||
background: none, -webkit-gradient(linear, left top, left bottom, from(#AAA), to(#AAA));
|
||||
background: none, -webkit-linear-gradient(#AAA, #AAA);
|
||||
background: none, -moz-linear-gradient(#AAA, #AAA);
|
||||
background: none, -o-linear-gradient(top, #AAA, #AAA);
|
||||
background: none, -khtml-gradient(linear, left top, left bottom, from(#AAA), to(#AAA));
|
||||
background: -ms-linear-gradient(top, #AAA, #AAA);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#AAA, endColorstr='#AAA',GradientType=0 );
|
||||
-moz-border-radius: 3px;
|
||||
-webkit-border-radius: 3px;
|
||||
-o-border-radius: 3px;
|
||||
-ms-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
-moz-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 1px rgba(255, 255, 255, 0.8) inset;
|
||||
-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 1px rgba(255, 255, 255, 0.8) inset;
|
||||
-o-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 1px rgba(255, 255, 255, 0.8) inset;
|
||||
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 1px rgba(255, 255, 255, 0.8) inset;
|
||||
text-shadow: 0 1px 1px rgba(255, 255, 255, 0.5);
|
||||
-webkit-font-smoothing: antialiased;
|
||||
outline: none;
|
||||
color: white;
|
||||
background-color: #8a89ba;
|
||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#8a89ba), to(#807fb4));
|
||||
background-image: -webkit-linear-gradient(top, #8a89ba, #807fb4);
|
||||
background-image: -moz-linear-gradient(top, #8a89ba, #807fb4);
|
||||
background-image: -ms-linear-gradient(top, #8a89ba, #807fb4);
|
||||
background-image: -o-linear-gradient(top, #8a89ba, #807fb4);
|
||||
background-image: linear-gradient(to bottom, #8a89ba, #807fb4);;
|
||||
}
|
||||
.oe_event_button_subscribe:hover {
|
||||
cursor: pointer;
|
||||
|
@ -120,3 +76,108 @@ div.oe_fold_column{
|
|||
width:35px;
|
||||
|
||||
}
|
||||
.oe_event_title{
|
||||
font-size: 25px;
|
||||
}
|
||||
.oe_sub1
|
||||
{
|
||||
float:left;
|
||||
height:50px;
|
||||
border-right: 1px solid black;
|
||||
border-color: #DCDCDC;
|
||||
}
|
||||
.oe_mapbox
|
||||
{
|
||||
width:auto;
|
||||
height:200px;
|
||||
margin-left:auto;
|
||||
margin-right:auto;
|
||||
text-align: right;
|
||||
}
|
||||
.oe_td_border
|
||||
{
|
||||
width: 7em;
|
||||
padding: 5px;
|
||||
border-right: 1px solid black;
|
||||
text-align: right;
|
||||
border-color: #DCDCDC;
|
||||
border-spacing:5em
|
||||
}
|
||||
.oe_td_date_border
|
||||
{
|
||||
border-right:1px solid black;
|
||||
border-color: #DCDCDC;
|
||||
}
|
||||
|
||||
td.oe_sale_end_date
|
||||
{
|
||||
padding:5px;
|
||||
}
|
||||
td.oe_qty
|
||||
{
|
||||
width: 80px;
|
||||
text-align:right;
|
||||
padding:5px;
|
||||
}
|
||||
|
||||
.oe_order_button
|
||||
{
|
||||
height:25px;
|
||||
position: absolute;
|
||||
left:330px;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
.oe_a
|
||||
{
|
||||
position: absolute;
|
||||
left: 22%;
|
||||
}
|
||||
|
||||
td.oe_b
|
||||
{
|
||||
position:relative;
|
||||
left: 60%;
|
||||
}
|
||||
|
||||
textarea.field_text
|
||||
{
|
||||
width: 765px;
|
||||
height: 318px;
|
||||
}
|
||||
|
||||
td.oe_form_group_nested
|
||||
{
|
||||
padding: 5px;
|
||||
}
|
||||
.oe_event_title{
|
||||
font-size: 25px;
|
||||
}
|
||||
.oe_sub1
|
||||
{
|
||||
float:left;
|
||||
height:50px;
|
||||
border-right: 1px solid black;
|
||||
border-color: #DCDCDC;
|
||||
}
|
||||
.oe_mapbox
|
||||
{
|
||||
width:auto;
|
||||
height:200px;
|
||||
margin-left:auto;
|
||||
margin-right:auto;
|
||||
text-align: right;
|
||||
}
|
||||
.oe_td_border
|
||||
{
|
||||
width: 5em;
|
||||
padding: 2px;
|
||||
border-right: 1px solid black;
|
||||
text-align: center;
|
||||
border-color: #DCDCDC;
|
||||
}
|
||||
.oe_td_date_border
|
||||
{
|
||||
border-right:1px solid black;
|
||||
border-color: #DCDCDC;
|
||||
}
|
||||
|
|
|
@ -1,11 +1,24 @@
|
|||
openerp.event = function(instance){
|
||||
instance.web.form.widgets.add('geo_address', 'instance.event.GeoAddress');
|
||||
instance.event.GoogleMapConnecter = instance.web.Class.extend({
|
||||
init : function(){
|
||||
// call ajex to render map load
|
||||
|
||||
},
|
||||
render_map: function(address){
|
||||
instance.web.form.widgets.add('many2one_Geo_address', 'instance.event.Many2OneAddress');
|
||||
|
||||
instance.web.GoogleMapConnector = instance.web.Class.extend({
|
||||
init: function(){
|
||||
this.googleMapsLoaded = $.Deferred();
|
||||
this.map_load();
|
||||
},
|
||||
map_load: function() {
|
||||
var self = this;
|
||||
if(this.googleMapsLoaded.state() != "pending"){return this.googleMapsLoaded.promise();}
|
||||
googleMapsCallback = function () {
|
||||
self.googleMapsLoaded.resolve();
|
||||
};
|
||||
$.ajax({
|
||||
url: "https://maps.googleapis.com/maps/api/js?v=3&callback=googleMapsCallback&sensor=false",
|
||||
dataType: "script"
|
||||
}).fail(self.googleMapsLoaded.reject);
|
||||
return this.googleMapsLoaded.promise();
|
||||
},
|
||||
render_map: function(address,$element){
|
||||
var geocoder = new google.maps.Geocoder();
|
||||
geocoder.geocode( { 'address': address}, function(results, status){
|
||||
if (status == google.maps.GeocoderStatus.OK){
|
||||
|
@ -16,54 +29,40 @@ openerp.event = function(instance){
|
|||
mapTypeId: google.maps.MapTypeId.ROADMAP
|
||||
}
|
||||
return new google.maps.Marker({
|
||||
map : new google.maps.Map(document.getElementById("oe_mapbox"),myOptions),
|
||||
map : new google.maps.Map($element,myOptions),
|
||||
position: new google.maps.LatLng(lat,lng)
|
||||
});
|
||||
}
|
||||
});
|
||||
map_load: function() {
|
||||
var self = this;
|
||||
if(this.googleMapsLoaded.state() != "pending"){return this.googleMapsLoaded.promise();}
|
||||
googleMapsCallback = function () {
|
||||
self.googleMapsLoaded.resolve();
|
||||
};
|
||||
$.ajax({
|
||||
url: "https://maps.googleapis.com/maps/api/js?v=3&callback=googleMapsCallback&sensor=false",
|
||||
dataType: "script"
|
||||
}).fail(self.googleMapsLoaded.reject);
|
||||
return this.googleMapsLoaded.promise();
|
||||
},
|
||||
|
||||
}),
|
||||
|
||||
instance.event.GeoAddress = instance.web.form.Many2OneField.extend(_.extend({}, {
|
||||
init : function(){
|
||||
this._super();
|
||||
this.googleMapsLoaded = $.Deferred();
|
||||
},
|
||||
|
||||
|
||||
set_value:function(value){
|
||||
var self = this;
|
||||
this.get_address(value).done(function(value){
|
||||
if(!self.__parentedParent.$element.find("#address_text").length)self.__parentedParent.$element.find(".oe_td_border").after(instance.web.qweb.render("address",{'record': value}));
|
||||
var address = _.str.sprintf(' %(street)s, %(city)s, %(country_id[1])s', value);
|
||||
var defer = self.map_load();
|
||||
defer.done(function(){
|
||||
return self.render_map(address);
|
||||
});
|
||||
});
|
||||
});
|
||||
instance.event.Many2OneAddress = instance.web.form.FieldMany2One.extend({
|
||||
init: function(field_manager, node){
|
||||
this._super(field_manager, node);
|
||||
this.map = new instance.web.GoogleMapConnector();
|
||||
},
|
||||
get_address:function(value){
|
||||
var self = this;
|
||||
if (!value || value.length == 0){
|
||||
return $.Deferred().reject();
|
||||
}
|
||||
return new instance.web.DataSet (this,this.field.relation, this.build_context()).read_ids(value[0],["street","city","country_id"]);
|
||||
(value instanceof Array)?value = parseInt(value[0]):false;
|
||||
var data = new instance.web.DataSet(this,this.field.relation, this.build_context());
|
||||
data.read_ids(value,["street","city","country_id"]).done(function(value){
|
||||
var address = _.str.sprintf(' %(street)s, %(city)s, %(country_id[1])s', value);
|
||||
self.map.googleMapsLoaded.done(function(){
|
||||
self.map.render_map(address,document.getElementById("oe_mapbox"));
|
||||
})
|
||||
});
|
||||
},
|
||||
set_value:function(value){
|
||||
this._super(value);
|
||||
this.get_address(value);
|
||||
},
|
||||
|
||||
},
|
||||
get_value:function(){
|
||||
render_value:function(no_recurse){
|
||||
this.get_address(this.get("value"));
|
||||
this._super(no_recurse);
|
||||
}
|
||||
|
||||
}));
|
||||
});
|
||||
};
|
|
@ -21,4 +21,5 @@
|
|||
|
||||
|
||||
import event_confirm
|
||||
import event_preview
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -0,0 +1,56 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from osv import osv, fields
|
||||
|
||||
|
||||
class event_preview(osv.osv_memory):
|
||||
_name = 'event.preview'
|
||||
_inherit= 'event.event'
|
||||
_columns = {
|
||||
'qty': fields.integer('Quantity'),
|
||||
'sale_end_date': fields.datetime('SalesEnd'),
|
||||
}
|
||||
def default_get(self, cr, uid, fields, context=None):
|
||||
event_pool = self.pool.get('event.event')
|
||||
data_obj = self.pool.get('ir.model.data')
|
||||
res_id = data_obj._get_id(cr, uid, 'event', 'view_event_preview')
|
||||
if res_id:
|
||||
event_preview_id = data_obj.browse(cr, uid, res_id, context=context).res_id
|
||||
|
||||
record_ids = context and context.get('active_ids', []) or []
|
||||
res = {}
|
||||
for event in event_pool.browse(cr, uid, record_ids, context=context):
|
||||
if 'name' in fields:
|
||||
res.update({'name': event.name})
|
||||
if 'date_begin' in fields:
|
||||
res.update({'date_begin': event.date_begin or False})
|
||||
if 'address_id' in fields:
|
||||
res.update({'address_id': event.address_id and event.address_id.id or False})
|
||||
if 'date_end' in fields:
|
||||
res.update({'date_end': event.date_end})
|
||||
if 'note' in fields:
|
||||
res.update({'note': event.note})
|
||||
return res
|
||||
|
||||
event_preview()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -0,0 +1,67 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record model="ir.ui.view" id="view_event_preview">
|
||||
<field name="name">Events</field>
|
||||
<field name="model">event.preview</field>
|
||||
<field name="type">form</field>
|
||||
<field name="priority">20</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Preview" 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 layout="auto">
|
||||
<group colspan="4" col="2">
|
||||
<field name="name" nolabel="1" class="oe_form_title" width="60%%" />
|
||||
<div id = "oe_mapbox" class="oe_mapbox"> </div>
|
||||
<table>
|
||||
<tr>
|
||||
<td width="70px" class="oe_td_border">
|
||||
Where
|
||||
</td>
|
||||
<td width="auto">
|
||||
<field name="address_id" widget ="many2one_Geo_address" nolabel="1"/>
|
||||
</td>
|
||||
<td width="210px">
|
||||
<table align="right">
|
||||
<tr>
|
||||
<td class="oe_td_date_border">Start: </td><td><field name="date_begin" nolabel="1" readonly="1"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="oe_td_date_border">End</td><td><field name="date_end" nolabel="1" readonly="1"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<group colspan="2">
|
||||
</group>
|
||||
</group>
|
||||
<separator colspan="4" string="Details" nolabel="1"/>
|
||||
<field name="note" colspan="4" nolabel="1"/>
|
||||
</sheet>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window" id="action_event_preview">
|
||||
<field name="name">Preview</field>
|
||||
<field name="res_model">event.preview</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">current</field>
|
||||
</record>
|
||||
|
||||
|
||||
</data>
|
||||
</openerp>
|
|
@ -57,7 +57,7 @@
|
|||
<newline/>
|
||||
<group colspan="4" name="venue">
|
||||
<div class="oe_sub1"> Venue : </div>
|
||||
<field name="location_id" nolabel="1" readonly="1"/>
|
||||
<field name="address_id_id" nolabel="1"/>
|
||||
</group>
|
||||
<field name="event_item_ids" nolabel="1">
|
||||
<tree editable="top" string="Event Items">
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
|
||||
/* ------------------------------ */
|
||||
/* Wall */
|
||||
/* ------------------------------ */
|
||||
|
|
Loading…
Reference in New Issue