[IMP] merge events

bzr revid: fp@tinyerp.com-20120525134306-3lz3127527hyly77
This commit is contained in:
Fabien Pinckaers 2012-05-25 15:43:06 +02:00
parent 7a70637b10
commit cdd8b9d47a
3 changed files with 17 additions and 16 deletions

View File

@ -210,12 +210,6 @@ 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'),
'city': fields.related('address_id', 'city', type='char', string='City'),
'street': fields.related('address_id', 'street', type='char', string='Street'),
'country_id': fields.related('address_id', 'country_id', relation='res.country', type='many2one', string='Country'),
'state_id': fields.related('address_id', 'state_id', relation="res.country.state", type="many2one", string='Fed. State'),
'zip': fields.related('address_id','zip', type="char", string="Zip"),
}
_defaults = {
'state': 'draft',

View File

@ -64,16 +64,17 @@
<sheet layout="auto">
<field name="name" required="1" nolabel="1" class="oe_form_title" colspan="4"/>
<group colspan="4" col="3">
<group colspan="2" class="oe_form_group_label_border" style="margin-top: 20px;">
<group colspan="4" col="5">
<group col="2" colspan="2" class="oe_form_group_label_border" style="margin-top: 20px;">
<field name="type" on_change="onchange_event_type(type,context)"/>
<field name="date_begin"/>
<field name="user_id"/>
<field name="date_end"/>
<field name="address_id" widget ="many2one_Geo_address"/>
<field name="address"/>
</group>
<group col="2" colspan="2" class="oe_form_group_label_border" style="margin-top: 20px;">
<field name="date_begin"/>
<field name="date_end"/>
<field name="register_min"/>
<label string=""/>
<field name="street" nolabel="1"/>
<field name="register_max"/>
</group>
<div id="oe_mapbox" class="oe_mapbox"></div>

View File

@ -1,4 +1,4 @@
openerp.event = function(instance){
openerp.event = function(instance) {
instance.web.form.widgets.add('many2one_Geo_address', 'instance.event.Many2OneAddress');
instance.web.GoogleMapConnector = instance.web.Class.extend({
@ -48,8 +48,14 @@ openerp.event = function(instance){
}
(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);
data.read_ids(value,["street","city","zip","country_id"]).done(function(value){
var address;
if value['country_id'] {
address = _.str.sprintf('%(street)s, %(zip)s %(city)s, %(country_id[1])s', value);
} else {
address = _.str.sprintf('%(street)s, %(zip)s %(city)s', value);
}
self.map.googleMapsLoaded.done(function(){
self.map.render_map(address,document.getElementById("oe_mapbox"));
})
@ -65,4 +71,4 @@ openerp.event = function(instance){
this._super(no_recurse);
}
});
};
};