[MERGE] forward port of branch 7.0 up to db98434

This commit is contained in:
Denis Ledoux 2014-12-11 12:15:09 +01:00
commit e11d1c2b7a
3 changed files with 18 additions and 15 deletions

View File

@ -175,18 +175,20 @@ class aged_trial_report(report_sxw.rml_parse, common_report_header):
partners_partial = self.cr.fetchall()
partners_amount = dict((i[0],0) for i in partners_partial)
for partner_info in partners_partial:
partial = False
if partner_info[2]:
# in case of partial reconciliation, we want to keep the left amount in the oldest period
self.cr.execute('''SELECT MIN(COALESCE(date_maturity,date)) FROM account_move_line WHERE reconcile_partial_id = %s''', (partner_info[2],))
date = self.cr.fetchall()
if date and args_list[-3] <= date[0][0] <= args_list[-2]:
# partial reconcilation
partial = True
self.cr.execute('''SELECT SUM(l.debit-l.credit)
FROM account_move_line AS l
WHERE l.reconcile_partial_id = %s''', (partner_info[2],))
unreconciled_amount = self.cr.fetchall()
partners_amount[partner_info[0]] += unreconciled_amount[0][0]
else:
if not partial:
partners_amount[partner_info[0]] += partner_info[1]
history.append(partners_amount)

View File

@ -439,11 +439,14 @@ class email_template(osv.osv):
results = dict()
for template, template_res_ids in templates_to_res_ids.iteritems():
# generate fields value for all res_ids linked to the current template
ctx = context.copy()
if template.lang:
ctx['lang'] = template._context.get('lang')
for field in fields:
generated_field_values = self.render_template_batch(
cr, uid, getattr(template, field), template.model, template_res_ids,
post_process=(field == 'body_html'),
context=context)
context=ctx)
for res_id, field_value in generated_field_values.iteritems():
results.setdefault(res_id, dict())[field] = field_value
# update values for all res_ids
@ -467,12 +470,8 @@ class email_template(osv.osv):
if template.report_template:
for res_id in template_res_ids:
attachments = []
report_name = self.render_template(cr, uid, template.report_name, template.model, res_id, context=context)
report_name = self.render_template(cr, uid, template.report_name, template.model, res_id, context=ctx)
report_service = report_xml_pool.browse(cr, uid, template.report_template.id, context).report_name
# Ensure report is rendered using template's language
ctx = context.copy()
if template.lang:
ctx['lang'] = self.render_template_batch(cr, uid, template.lang, template.model, [res_id], context)[res_id] # take 0 ?
result, format = openerp.report.render_report(cr, uid, [res_id], report_service, {'model': template.model}, ctx)
# TODO in trunk, change return format to binary to match message_post expected format
result = base64.b64encode(result)

View File

@ -1177,7 +1177,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM
},
build_eval_context: function() {
var a_dataset = this.dataset;
return new instance.web.CompoundContext(a_dataset.get_context(), this._build_view_fields_values());
return new instance.web.CompoundContext(this._build_view_fields_values(), a_dataset.get_context());
},
});
@ -3763,16 +3763,18 @@ instance.web.form.FieldOne2Many = instance.web.form.AbstractField.extend({
var self = this;
self.load_views();
this.is_loaded.done(function() {
self.on("change:effective_readonly", self, function() {
self.is_loaded = self.is_loaded.then(function() {
self.viewmanager.destroy();
return $.when(self.load_views()).done(function() {
self.reload_current_view();
});
var destroy = function() {
self.is_loaded = self.is_loaded.then(function() {
self.viewmanager.destroy();
return $.when(self.load_views()).done(function() {
self.reload_current_view();
});
});
};
this.is_loaded.done(function() {
self.on("change:effective_readonly", self, destroy);
});
this.view.on("on_button_cancel", self, destroy);
this.is_started = true;
this.reload_current_view();
},