'account.move.reconcile': (_get_invoice_from_reconcile, None, 50),
}, help="It indicates that the invoice has been paid and the journal entry of the invoice has been reconciled with one or several journal entries of payment."),
'partner_bank_id': fields.many2one('res.partner.bank', 'Bank Account',
- help='Bank Account Number, Company bank account if Invoice is customer or supplier refund, otherwise Partner bank account number.', readonly=True, states={'draft':[('readonly',False)]}),
+ help='Bank Account Number to which the invoice will be paid. A Company bank account if this is a Customer Invoice or Supplier Refund, otherwise a Partner bank account number.', readonly=True, states={'draft':[('readonly',False)]}),
'move_lines':fields.function(_get_lines, type='many2many', relation='account.move.line', string='Entry Lines'),
'residual': fields.function(_amount_residual, digits_compute=dp.get_precision('Account'), string='Balance',
store={
voucher_id = voucher_obj.create(cr, uid, voucher_res, context=context)
voucher_line_dict = {}
- if result['value']['line_ids']:
- for line_dict in result['value']['line_ids']:
- move_line = line_obj.browse(cr, uid, line_dict['move_line_id'], context)
- if line.move_id.id == move_line.move_id.id:
- voucher_line_dict = line_dict
+ for line_dict in result['value']['line_cr_ids'] + result['value']['line_dr_ids']:
+ move_line = line_obj.browse(cr, uid, line_dict['move_line_id'], context)
+ if line.move_id.id == move_line.move_id.id:
+ voucher_line_dict = line_dict
if voucher_line_dict:
voucher_line_dict.update({'voucher_id': voucher_id})
}
account_statement_from_invoice()
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
<record id="project_task_1" model="project.task">
<field eval="100.0" name="planned_hours"/>
+ <field eval="100.0" name="remaining_hours"/>
<field name="user_id" ref="base.user_niv"/>
<field name="priority">2</field>
<field name="project_id" ref="project.project_integrate_openerp"/>
<record id="project_task_2" model="project.task">
<field eval="80.0" name="planned_hours"/>
+ <field eval="80.0" name="remaining_hours"/>
<field name="user_id" ref="base.user_niv"/>
<field name="priority">2</field>
<field name="project_id" ref="project.project_integrate_openerp"/>
<record id="project_task_3" model="project.task">
<field eval="40.0" name="planned_hours"/>
+ <field eval="40.0" name="remaining_hours"/>
<field name="user_id" ref="base.user_al"/>
<field name="priority">2</field>
<field name="project_id" ref="project.project_integrate_openerp"/>
<record id="project_task_4" model="project.task">
<field eval="25.0" name="planned_hours"/>
+ <field eval="25.0" name="remaining_hours"/>
<field name="user_id" ref="base.user_al"/>
<field name="priority">2</field>
<field name="project_id" ref="project.project_integrate_openerp"/>
<record id="project_task_5" model="project.task">
<field eval="25.0" name="planned_hours"/>
+ <field eval="25.0" name="remaining_hours"/>
<field name="user_id" ref="base.user_al"/>
<field name="priority">2</field>
<field name="project_id" ref="project.project_integrate_openerp"/>
<record id="project_task_6" model="project.task">
<field eval="20.0" name="planned_hours"/>
+ <field eval="20.0" name="remaining_hours"/>
<field name="user_id" ref="base.user_al"/>
<field name="priority">2</field>
<field name="project_id" ref="project.project_integrate_openerp"/>
<record id="project_task_7" model="project.task">
<field eval="30.0" name="planned_hours"/>
+ <field eval="30.0" name="remaining_hours"/>
<field name="user_id" ref="base.user_al"/>
<field name="priority">2</field>
<field name="project_id" ref="project.project_integrate_openerp"/>
<record id="project_task_8" model="project.task">
<field eval="10.0" name="planned_hours"/>
+ <field eval="10.0" name="remaining_hours"/>
<field name="user_id" ref="base.user_al"/>
<field name="priority">2</field>
<field name="project_id" ref="project.project_integrate_openerp"/>
<record id="project_task_9" model="project.task">
<field eval="50.0" name="planned_hours"/>
+ <field eval="50.0" name="remaining_hours"/>
<field name="user_id" ref="base.user_al"/>
<field name="priority">2</field>
<field name="project_id" ref="project.project_integrate_openerp"/>
<record id="project_task_10" model="project.task">
<field eval="40.0" name="planned_hours"/>
+ <field eval="40.0" name="remaining_hours"/>
<field name="user_id" ref="base.user_fpi"/>
<field name="priority">2</field>
<field name="project_id" ref="project.project_integrate_openerp"/>
<record id="project_task_11" model="project.task">
<field eval="90.0" name="planned_hours"/>
+ <field eval="90.0" name="remaining_hours"/>
<field name="user_id" ref="base.user_fpi"/>
<field name="priority">2</field>
<field name="project_id" ref="project.project_integrate_openerp"/>
<record id="project_task_12" model="project.task">
<field eval="20.0" name="planned_hours"/>
+ <field eval="20.0" name="remaining_hours"/>
<field name="user_id" ref="base.user_fpi"/>
<field name="priority">2</field>
<field name="project_id" ref="project.project_integrate_openerp"/>
<record id="project_task_13" model="project.task">
<field eval="50.0" name="planned_hours"/>
+ <field eval="50.0" name="remaining_hours"/>
<field name="user_id" ref="base.user_mit"/>
<field name="priority">2</field>
<field name="project_id" ref="project.project_integrate_openerp"/>
<record id="project_task_14" model="project.task">
<field eval="30.0" name="planned_hours"/>
+ <field eval="30.0" name="remaining_hours"/>
<field name="user_id" ref="base.user_mit"/>
<field name="priority">2</field>
<field name="project_id" ref="project.project_integrate_openerp"/>
<record id="project_task_15" model="project.task">
<field eval="15.0" name="planned_hours"/>
+ <field eval="15.0" name="remaining_hours"/>
<field name="user_id" ref="base.user_fpi"/>
<field name="priority">2</field>
<field name="project_id" ref="project.project_integrate_openerp"/>
<record id="project_task_16" model="project.task">
<field eval="10" name="sequence"/>
<field eval="40.0" name="planned_hours"/>
+ <field eval="40.0" name="remaining_hours"/>
<field name="user_id" ref="base.user_mit"/>
<field name="priority">2</field>
<field name="project_id" ref="project.project_integrate_openerp"/>
<record id="project_task_17" model="project.task">
<field eval="5.0" name="planned_hours"/>
+ <field eval="5.0" name="remaining_hours"/>
<field name="user_id" ref="base.user_niv"/>
<field name="priority">2</field>
<field name="project_id" ref="project.project_integrate_openerp"/>
<record id="project_task_18" model="project.task">
<field eval="10.0" name="planned_hours"/>
+ <field eval="10.0" name="remaining_hours"/>
<field name="user_id" ref="base.user_niv"/>
<field name="priority">2</field>
<field name="project_id" ref="project.project_integrate_openerp"/>
import logging
from mako.template import Template
+from mako.lookup import TemplateLookup
from mako import exceptions
import netsvc
This template uses UTF-8 encoding
"""
- # default_filters=['unicode', 'h'] can be used to set global filters
- return Template(text, input_encoding='utf-8', output_encoding='utf-8')
+ tmp_lookup = TemplateLookup() #we need it in order to allow inclusion and inheritance
+ return Template(text, input_encoding='utf-8', output_encoding='utf-8', lookup=tmp_lookup)
class WebKitParser(report_sxw):
* Reads the current dataset record (from its index)
*
* @params {Array} [fields] fields to read and return, by default all fields are returned
+ * @param {Object} [options.context] context data to add to the request payload, on top of the DataSet's own context
* @params {Function} callback function called with read_index result
* @returns {$.Deferred}
*/
- read_index: function (fields, callback) {
+ read_index: function (fields, options, callback) {
var def = $.Deferred().then(callback);
if (_.isEmpty(this.ids)) {
def.reject();
} else {
fields = fields || false;
- this.read_ids([this.ids[this.index]], fields).then(function(records) {
+ this.read_ids([this.ids[this.index]], fields, options).then(function(records) {
def.resolve(records[0]);
}, function() {
def.reject.apply(def, arguments);
_.defaults(this.options, {
"not_interactible_on_create": false
});
- this.mutating_lock = $.Deferred();
- this.initial_mutating_lock = this.mutating_lock;
- this.on_change_lock = $.Deferred().resolve();
- this.reload_lock = $.Deferred().resolve();
+ this.is_initialized = $.Deferred();
+ this.mutating_mutex = new $.Mutex();
+ this.on_change_mutex = new $.Mutex();
+ this.reload_mutex = new $.Mutex();
},
start: function() {
this._super();
});
}
self.on_form_changed();
- self.initial_mutating_lock.resolve();
+ self.is_initialized.resolve();
self.show_invalid = true;
self.do_update_pager(record.id == null);
if (self.sidebar) {
},
do_onchange: function(widget, processed) {
var self = this;
- var act = function() {
+ return this.on_change_mutex.exec(function() {
try {
processed = processed || [];
var on_change = widget.node.attrs.on_change;
console.error(e);
return $.Deferred().reject();
}
- };
- this.on_change_lock = this.on_change_lock.pipe(act, act);
- return this.on_change_lock;
+ });
},
on_processed_onchange: function(response, processed) {
try {
*/
do_save: function(success, prepend_on_create) {
var self = this;
- var action = function() {
+ return this.mutating_mutex.exec(function() { return self.is_initialized.pipe(function() {
try {
- if (!self.initial_mutating_lock.isResolved() && !self.initial_mutating_lock.isRejected())
- return;
var form_invalid = false,
values = {},
first_invalid_field = null;
console.error(e);
return $.Deferred().reject();
}
- };
- this.mutating_lock = this.mutating_lock.pipe(action, action);
- return this.mutating_lock;
+ });});
},
on_invalid: function() {
var msg = "<ul>";
},
reload: function() {
var self = this;
- var act = function() {
+ return this.reload_mutex.exec(function() {
if (self.dataset.index == null || self.dataset.index < 0) {
return $.when(self.on_button_new());
} else {
return self.dataset.read_index(_.keys(self.fields_view.fields)).pipe(self.on_record_loaded);
}
- };
- this.reload_lock = this.reload_lock.pipe(act, act);
- return this.reload_lock;
+ });
},
get_fields_values: function(blacklist) {
blacklist = blacklist || [];
* the fields'context with the action's context.
*/
build_context: function(blacklist) {
- var f_context = (this.field || {}).context || {};
- if (!!f_context.__ref || true) { //TODO: remove true
- var fields_values = this._build_eval_context(blacklist);
- f_context = new openerp.web.CompoundContext(f_context).set_eval_context(fields_values);
- }
- // maybe the default_get should only be used when we do a default_get?
- var v_contexts = _.compact([this.node.attrs.default_get || null,
- this.node.attrs.context || null]);
- var v_context = new openerp.web.CompoundContext();
- _.each(v_contexts, function(x) {v_context.add(x);});
- if (_.detect(v_contexts, function(x) {return !!x.__ref;}) || true) { //TODO: remove true
+ // only use the model's context if there is not context on the node
+ var v_context = this.node.attrs.context;
+ if (! v_context) {
+ v_context = (this.field || {}).context || {};
+ }
+
+ if (v_context.__ref || true) { //TODO: remove true
var fields_values = this._build_eval_context(blacklist);
- v_context.set_eval_context(fields_values);
+ v_context = new openerp.web.CompoundContext(v_context).set_eval_context(fields_values);
}
- // if there is a context on the node, overrides the model's context
- var ctx = v_contexts.length > 0 ? v_context : f_context;
- return ctx;
+ return v_context;
},
build_domain: function() {
var f_domain = this.field.domain || [];
openerp.web.form.dialog = function(content, options) {
options = _.extend({
- autoOpen: true,
width: '90%',
- height: '90%',
- min_width: '800px',
- min_height: '600px'
+ height: 'auto',
+ min_width: '800px'
}, options || {});
options.autoOpen = true;
- var dialog = new openerp.web.Dialog(null, options);
- dialog.$element = $(content).dialog(dialog.dialog_options);
- return dialog.$element;
+ var dialog = new openerp.web.Dialog(null, options).open();
+ return dialog.$element.html(content);
};
openerp.web.form.FieldMany2One = openerp.web.form.Field.extend({
this.viewmanager.views[this.viewmanager.active_view].controller) {
var view = this.viewmanager.views[this.viewmanager.active_view].controller;
if (this.viewmanager.active_view === "form") {
+ if (!view.is_initialized.isResolved()) {
+ return false;
+ }
var res = $.when(view.do_save());
if (!res.isResolved() && !res.isRejected()) {
console.warn("Asynchronous get_value() is not supported in form view.");
start: function () {
this._super();
var self = this;
- return this.user.read_index(['groups_id']).pipe(function (record) {
+ return this.user.read_index(['groups_id']).pipe(function(record) {
var todos_filter = [
['type', '!=', 'automatic'],
'|', ['groups_id', '=', false],
this.context || this.dataset.context
);
pop.on_select_elements.add_last(function(element_ids) {
- self.dataset.read_index(_.keys(self.fields_view.fields), self.on_diagram_loaded);
+ self.dataset.read_index(_.keys(self.fields_view.fields)).pipe(self.on_diagram_loaded);
});
} else {
pop = new openerp.web.form.FormOpenPopup(this);
}
);
pop.on_write.add(function() {
- self.dataset.read_index(_.keys(self.fields_view.fields), self.on_diagram_loaded);
+ self.dataset.read_index(_.keys(self.fields_view.fields)).pipe(self.on_diagram_loaded);
});
}
this.dataset.index = this.dataset.ids.length - 1;
break;
}
- this.dataset.read_index(_.keys(this.fields_view.fields), this.on_diagram_loaded);
+ this.dataset.read_index(_.keys(this.fields_view.fields)).pipe(this.on_diagram_loaded);
this.do_update_pager();
},