[MERGE] Forward-port of 7.0 bugfixes up to 63ea0df73f
This commit is contained in:
commit
3c0292645f
|
@ -295,7 +295,8 @@ class account_invoice(osv.osv):
|
||||||
},
|
},
|
||||||
multi='all'),
|
multi='all'),
|
||||||
'currency_id': fields.many2one('res.currency', 'Currency', required=True, readonly=True, states={'draft':[('readonly',False)]}, track_visibility='always'),
|
'currency_id': fields.many2one('res.currency', 'Currency', required=True, readonly=True, states={'draft':[('readonly',False)]}, track_visibility='always'),
|
||||||
'journal_id': fields.many2one('account.journal', 'Journal', required=True, readonly=True, states={'draft':[('readonly',False)]}),
|
'journal_id': fields.many2one('account.journal', 'Journal', required=True, readonly=True, states={'draft':[('readonly',False)]},
|
||||||
|
domain="[('type', 'in', {'out_invoice': ['sale'], 'out_refund': ['sale_refund'], 'in_refund': ['purchase_refund'], 'in_invoice': ['purchase']}.get(type, [])), ('company_id', '=', company_id)]"),
|
||||||
'company_id': fields.many2one('res.company', 'Company', required=True, change_default=True, readonly=True, states={'draft':[('readonly',False)]}),
|
'company_id': fields.many2one('res.company', 'Company', required=True, change_default=True, readonly=True, states={'draft':[('readonly',False)]}),
|
||||||
'check_total': fields.float('Verification Total', digits_compute=dp.get_precision('Account'), readonly=True, states={'draft':[('readonly',False)]}),
|
'check_total': fields.float('Verification Total', digits_compute=dp.get_precision('Account'), readonly=True, states={'draft':[('readonly',False)]}),
|
||||||
'reconciled': fields.function(_reconciled, string='Paid/Reconciled', type='boolean',
|
'reconciled': fields.function(_reconciled, string='Paid/Reconciled', type='boolean',
|
||||||
|
|
|
@ -32,7 +32,7 @@ class report_event_registration(osv.osv):
|
||||||
'draft_state': fields.integer(' # No of Draft Registrations', size=20),
|
'draft_state': fields.integer(' # No of Draft Registrations', size=20),
|
||||||
'confirm_state': fields.integer(' # No of Confirmed Registrations', size=20),
|
'confirm_state': fields.integer(' # No of Confirmed Registrations', size=20),
|
||||||
'seats_max': fields.integer('Max Seats'),
|
'seats_max': fields.integer('Max Seats'),
|
||||||
'nbevent': fields.integer('Number Of Events'),
|
'nbevent': fields.integer('Number of Registrations'),
|
||||||
'event_type': fields.many2one('event.type', 'Event Type'),
|
'event_type': fields.many2one('event.type', 'Event Type'),
|
||||||
'registration_state': fields.selection([('draft', 'Draft'), ('confirm', 'Confirmed'), ('done', 'Attended'), ('cancel', 'Cancelled')], 'Registration State', readonly=True, required=True),
|
'registration_state': fields.selection([('draft', 'Draft'), ('confirm', 'Confirmed'), ('done', 'Attended'), ('cancel', 'Cancelled')], 'Registration State', readonly=True, required=True),
|
||||||
'event_state': fields.selection([('draft', 'Draft'), ('confirm', 'Confirmed'), ('done', 'Done'), ('cancel', 'Cancelled')], 'Event State', readonly=True, required=True),
|
'event_state': fields.selection([('draft', 'Draft'), ('confirm', 'Confirmed'), ('done', 'Done'), ('cancel', 'Cancelled')], 'Event State', readonly=True, required=True),
|
||||||
|
@ -59,7 +59,7 @@ class report_event_registration(osv.osv):
|
||||||
r.name AS name_registration,
|
r.name AS name_registration,
|
||||||
e.company_id AS company_id,
|
e.company_id AS company_id,
|
||||||
e.date_begin AS event_date,
|
e.date_begin AS event_date,
|
||||||
count(e.id) AS nbevent,
|
count(r.id) AS nbevent,
|
||||||
CASE WHEN r.state IN ('draft') THEN r.nb_register ELSE 0 END AS draft_state,
|
CASE WHEN r.state IN ('draft') THEN r.nb_register ELSE 0 END AS draft_state,
|
||||||
CASE WHEN r.state IN ('open','done') THEN r.nb_register ELSE 0 END AS confirm_state,
|
CASE WHEN r.state IN ('open','done') THEN r.nb_register ELSE 0 END AS confirm_state,
|
||||||
e.type AS event_type,
|
e.type AS event_type,
|
||||||
|
|
|
@ -203,7 +203,7 @@ class hr_employee(osv.osv):
|
||||||
"resized as a 128x128px image, with aspect ratio preserved. "\
|
"resized as a 128x128px image, with aspect ratio preserved. "\
|
||||||
"Use this field in form views or some kanban views."),
|
"Use this field in form views or some kanban views."),
|
||||||
'image_small': fields.function(_get_image, fnct_inv=_set_image,
|
'image_small': fields.function(_get_image, fnct_inv=_set_image,
|
||||||
string="Smal-sized photo", type="binary", multi="_get_image",
|
string="Small-sized photo", type="binary", multi="_get_image",
|
||||||
store = {
|
store = {
|
||||||
'hr.employee': (lambda self, cr, uid, ids, c={}: ids, ['image'], 10),
|
'hr.employee': (lambda self, cr, uid, ids, c={}: ids, ['image'], 10),
|
||||||
},
|
},
|
||||||
|
|
|
@ -39,7 +39,9 @@
|
||||||
<page string="Public Information">
|
<page string="Public Information">
|
||||||
<group>
|
<group>
|
||||||
<group string="Contact Information">
|
<group string="Contact Information">
|
||||||
<field name="address_id" on_change="onchange_address_id(address_id)" context="{'show_address': 1}" options='{"always_reload": True, "highlight_first_line": True}'/>
|
<field name="address_id" on_change="onchange_address_id(address_id)"
|
||||||
|
context="{'show_address': 1, 'default_customer': False}"
|
||||||
|
options='{"always_reload": True, "highlight_first_line": True}'/>
|
||||||
<field name="mobile_phone"/>
|
<field name="mobile_phone"/>
|
||||||
<field name="work_location"/>
|
<field name="work_location"/>
|
||||||
</group>
|
</group>
|
||||||
|
@ -67,7 +69,9 @@
|
||||||
<field name="otherid" groups="base.group_hr_user"/>
|
<field name="otherid" groups="base.group_hr_user"/>
|
||||||
</group>
|
</group>
|
||||||
<group string="Contact Information">
|
<group string="Contact Information">
|
||||||
<field name="address_home_id" context="{'show_address': 1}" options='{"always_reload": True, "highlight_first_line": True}'/>
|
<field name="address_home_id"
|
||||||
|
context="{'show_address': 1, 'default_customer': False}"
|
||||||
|
options='{"always_reload": True, "highlight_first_line": True}'/>
|
||||||
</group>
|
</group>
|
||||||
<group string="Status">
|
<group string="Status">
|
||||||
<field name="gender"/>
|
<field name="gender"/>
|
||||||
|
|
|
@ -99,7 +99,7 @@ class hr_holidays_status(osv.osv):
|
||||||
for record in self.browse(cr, uid, ids, context=context):
|
for record in self.browse(cr, uid, ids, context=context):
|
||||||
name = record.name
|
name = record.name
|
||||||
if not record.limit:
|
if not record.limit:
|
||||||
name = name + (' (%d/%d)' % (record.leaves_taken or 0.0, record.max_leaves or 0.0))
|
name = name + (' (%g/%g)' % (record.leaves_taken or 0.0, record.max_leaves or 0.0))
|
||||||
res.append((record.id, name))
|
res.append((record.id, name))
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
|
|
@ -975,9 +975,11 @@ class mail_message(osv.Model):
|
||||||
cr, SUPERUSER_ID, [
|
cr, SUPERUSER_ID, [
|
||||||
('res_model', '=', message.model),
|
('res_model', '=', message.model),
|
||||||
('res_id', '=', message.res_id),
|
('res_id', '=', message.res_id),
|
||||||
('subtype_ids', 'in', message.subtype_id.id)
|
|
||||||
], context=context)
|
], context=context)
|
||||||
partners_to_notify |= set(fo.partner_id.id for fo in fol_obj.browse(cr, SUPERUSER_ID, fol_ids, context=context))
|
partners_to_notify |= set(
|
||||||
|
fo.partner_id for fo in fol_obj.browse(cr, SUPERUSER_ID, fol_ids, context=context)
|
||||||
|
if message.subtype_id.id in [st.id for st in fo.subtype_ids]
|
||||||
|
)
|
||||||
# remove me from notified partners, unless the message is written on my own wall
|
# remove me from notified partners, unless the message is written on my own wall
|
||||||
if message.subtype_id and message.author_id and message.model == "res.partner" and message.res_id == message.author_id.id:
|
if message.subtype_id and message.author_id and message.model == "res.partner" and message.res_id == message.author_id.id:
|
||||||
partners_to_notify |= set([message.author_id.id])
|
partners_to_notify |= set([message.author_id.id])
|
||||||
|
|
|
@ -233,7 +233,8 @@ instance.web.parse_value = function (value, descriptor, value_if_empty) {
|
||||||
value = value.replace(instance.web._t.database.parameters.thousands_sep, "");
|
value = value.replace(instance.web._t.database.parameters.thousands_sep, "");
|
||||||
} while(tmp !== value);
|
} while(tmp !== value);
|
||||||
tmp = Number(value);
|
tmp = Number(value);
|
||||||
if (isNaN(tmp))
|
// do not accept not numbers or float values
|
||||||
|
if (isNaN(tmp) || tmp % 1)
|
||||||
throw new Error(_.str.sprintf(_t("'%s' is not a correct integer"), value));
|
throw new Error(_.str.sprintf(_t("'%s' is not a correct integer"), value));
|
||||||
return tmp;
|
return tmp;
|
||||||
case 'float':
|
case 'float':
|
||||||
|
|
|
@ -130,15 +130,7 @@
|
||||||
if (this.editable()) {
|
if (this.editable()) {
|
||||||
this.$el.find('table:first').show();
|
this.$el.find('table:first').show();
|
||||||
this.$el.find('.oe_view_nocontent').remove();
|
this.$el.find('.oe_view_nocontent').remove();
|
||||||
this.start_edition().then(function(){
|
this.start_edition();
|
||||||
var fields = self.editor.form.fields;
|
|
||||||
self.editor.form.fields_order.some(function(field){
|
|
||||||
if (fields[field].$el.is(':visible')){
|
|
||||||
fields[field].$el.find("input").select();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
this._super();
|
this._super();
|
||||||
}
|
}
|
||||||
|
@ -243,6 +235,7 @@
|
||||||
return this.ensure_saved().then(function () {
|
return this.ensure_saved().then(function () {
|
||||||
var $recordRow = self.groups.get_row_for(record);
|
var $recordRow = self.groups.get_row_for(record);
|
||||||
var cells = self.get_cells_for($recordRow);
|
var cells = self.get_cells_for($recordRow);
|
||||||
|
var fields = {};
|
||||||
self.fields_for_resize.splice(0, self.fields_for_resize.length);
|
self.fields_for_resize.splice(0, self.fields_for_resize.length);
|
||||||
return self.with_event('edit', {
|
return self.with_event('edit', {
|
||||||
record: record.attributes,
|
record: record.attributes,
|
||||||
|
@ -256,10 +249,13 @@
|
||||||
|
|
||||||
// FIXME: need better way to get the field back from bubbling (delegated) DOM events somehow
|
// FIXME: need better way to get the field back from bubbling (delegated) DOM events somehow
|
||||||
field.$el.attr('data-fieldname', field_name);
|
field.$el.attr('data-fieldname', field_name);
|
||||||
|
fields[field_name] = field;
|
||||||
self.fields_for_resize.push({field: field, cell: cell});
|
self.fields_for_resize.push({field: field, cell: cell});
|
||||||
}, options).then(function () {
|
}, options).then(function () {
|
||||||
$recordRow.addClass('oe_edition');
|
$recordRow.addClass('oe_edition');
|
||||||
self.resize_fields();
|
self.resize_fields();
|
||||||
|
var focus_field = options && options.focus_field ? options.focus_field : (self.visible_columns.length ? self.visible_columns[0].name : undefined);
|
||||||
|
if (focus_field) fields[focus_field].$el.find('input').select();
|
||||||
return record.attributes;
|
return record.attributes;
|
||||||
});
|
});
|
||||||
}).fail(function () {
|
}).fail(function () {
|
||||||
|
@ -749,31 +745,6 @@
|
||||||
throw new Error("is_editing's state filter must be either `new` or" +
|
throw new Error("is_editing's state filter must be either `new` or" +
|
||||||
" `edit` if provided");
|
" `edit` if provided");
|
||||||
},
|
},
|
||||||
_focus_setup: function (focus_field) {
|
|
||||||
var form = this.form;
|
|
||||||
|
|
||||||
var field;
|
|
||||||
// If a field to focus was specified
|
|
||||||
if (focus_field
|
|
||||||
// Is actually in the form
|
|
||||||
&& (field = form.fields[focus_field])
|
|
||||||
// And is visible
|
|
||||||
&& field.$el.is(':visible')) {
|
|
||||||
// focus it
|
|
||||||
field.focus();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
_(form.fields_order).detect(function (name) {
|
|
||||||
// look for first visible field in fields_order, focus it
|
|
||||||
var field = form.fields[name];
|
|
||||||
if (!field.$el.is(':visible')) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
// Stop as soon as a field got focused
|
|
||||||
return field.focus() !== false;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
edit: function (record, configureField, options) {
|
edit: function (record, configureField, options) {
|
||||||
// TODO: specify sequence of edit calls
|
// TODO: specify sequence of edit calls
|
||||||
var self = this;
|
var self = this;
|
||||||
|
@ -788,7 +759,6 @@
|
||||||
_(form.fields).each(function (field, name) {
|
_(form.fields).each(function (field, name) {
|
||||||
configureField(name, field);
|
configureField(name, field);
|
||||||
});
|
});
|
||||||
self._focus_setup(options && options.focus_field);
|
|
||||||
return form;
|
return form;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
@ -537,7 +537,7 @@ class many2one(_column):
|
||||||
# we use uid=1 because the visibility of a many2one field value (just id and name)
|
# we use uid=1 because the visibility of a many2one field value (just id and name)
|
||||||
# must be the access right of the parent form and not the linked object itself.
|
# must be the access right of the parent form and not the linked object itself.
|
||||||
records = dict(obj.name_get(cr, SUPERUSER_ID,
|
records = dict(obj.name_get(cr, SUPERUSER_ID,
|
||||||
list(set([x for x in res.values() if isinstance(x, (int,long))])),
|
list(set([x for x in res.values() if x and isinstance(x, (int,long))])),
|
||||||
context=context))
|
context=context))
|
||||||
for id in res:
|
for id in res:
|
||||||
if res[id] in records:
|
if res[id] in records:
|
||||||
|
|
|
@ -3310,6 +3310,8 @@ class BaseModel(object):
|
||||||
return []
|
return []
|
||||||
if fields_to_read is None:
|
if fields_to_read is None:
|
||||||
fields_to_read = self._columns.keys()
|
fields_to_read = self._columns.keys()
|
||||||
|
else:
|
||||||
|
fields_to_read = list(set(fields_to_read))
|
||||||
|
|
||||||
# all inherited fields + all non inherited fields for which the attribute whose name is in load is True
|
# all inherited fields + all non inherited fields for which the attribute whose name is in load is True
|
||||||
fields_pre = [f for f in fields_to_read if
|
fields_pre = [f for f in fields_to_read if
|
||||||
|
|
Loading…
Reference in New Issue