Files
account-reconcile/account_statement_operation_rule/static/src/js/account_widgets.js
Guewen Baconnier 64871c6950 Add module account_statement_operation_rule
This module allows to automatically apply Statement Operations (or
"presets") on the statement lines reconciliations according to rules,
for instance based on the balance.
2016-05-13 13:20:07 +02:00

38 lines
1.4 KiB
JavaScript

openerp.account_statement_operation_rule = function (instance) {
var _t = instance.web._t,
_lt = instance.web._lt;
var QWeb = instance.web.qweb;
instance.web.account_statement_operation_rule = instance.web.account_statement_operation_rule || {};
instance.web.account.bankStatementReconciliationLine.include({
operation_rules: function() {
var self = this;
var model_operation_rule = new instance.web.Model("account.statement.operation.rule");
model_operation_rule.call("operations_for_reconciliation",
[self.st_line.id,
_.pluck(self.get("mv_lines_selected"), 'id')])
.then(function (operations) {
_.each(operations, function(operation_id) {
preset_btn = self.$("button.preset[data-presetid='" + operation_id + "']");
preset_btn.click();
self.addLineBeingEdited();
});
});
},
render: function() {
deferred = this._super();
if (deferred) {
deferred.done(this.operation_rules());
}
return deferred;
},
restart: function() {
deferred = this._super();
deferred.done(this.operation_rules());
return deferred;
},
});
};