mirror of
https://github.com/OCA/account-reconcile.git
synced 2025-01-20 12:27:39 +02:00
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.
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
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;
|
||||
},
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user