[FIX] account: bank statement reconciliation:

- ctrl-enter only persist balanced reconciliations
- give a reconciliation proposition only if there's an unambiguous match
- added some missing tanslations
- use default order to display statement lines in reconciliation widget
This commit is contained in:
Arthur Maniet 2015-05-05 09:49:53 +02:00
parent 7feb9c112b
commit ce32867a90
3 changed files with 9 additions and 10 deletions

View File

@ -540,8 +540,8 @@ class account_bank_statement_line(osv.osv):
# Look for structured communication
if st_line.name:
domain = self._domain_reconciliation_proposition(cr, uid, st_line, excluded_ids=excluded_ids, context=context)
match_id = mv_line_pool.search(cr, uid, domain, offset=0, limit=1, context=context)
if match_id:
match_id = mv_line_pool.search(cr, uid, domain, offset=0, limit=2, context=context)
if match_id and len(match_id) == 1:
mv_line_br = mv_line_pool.browse(cr, uid, match_id, context=context)
target_currency = st_line.currency_id or st_line.journal_id.currency or st_line.journal_id.company_id.currency_id
mv_line = mv_line_pool.prepare_move_lines_for_reconciliation_widget(cr, uid, mv_line_br, target_currency=target_currency, target_date=st_line.date, context=context)[0]
@ -571,8 +571,8 @@ class account_bank_statement_line(osv.osv):
# Look for a matching amount
domain_exact_amount = domain + [(amount_field, '=', float_round(sign * amount, precision_digits=precision_digits))]
match_id = self.get_move_lines_for_reconciliation(cr, uid, st_line, excluded_ids=excluded_ids, offset=0, limit=1, additional_domain=domain_exact_amount)
if match_id:
match_id = self.get_move_lines_for_reconciliation(cr, uid, st_line, excluded_ids=excluded_ids, offset=0, limit=2, additional_domain=domain_exact_amount)
if match_id and len(match_id) == 1:
return match_id
if not st_line.partner_id.id:

View File

@ -180,7 +180,6 @@ openerp.account = function (instance) {
deferred_promises.push(self.model_bank_statement_line
.query(['id'])
.filter(lines_filter)
.order_by('statement_id, id')
.all().then(function (data) {
self.st_lines = _(data).map(function(o){ return o.id });
})
@ -289,7 +288,7 @@ openerp.account = function (instance) {
keyboardShortcutsHandler: function(e) {
var self = this;
if ((e.which === 13 || e.which === 10) && (e.ctrlKey || e.metaKey)) {
self.persistReconciliations(_.filter(self.getChildren(), function(o) { return o.is_valid; }));
self.persistReconciliations(_.filter(self.getChildren(), function(o) { return o.get("balance").toFixed(3) === "0.000"; }));
}
},
@ -519,7 +518,7 @@ openerp.account = function (instance) {
var time_taken;
if (sec_taken/60 >= 1) time_taken = Math.floor(sec_taken/60) +"' "+ sec_taken%60 +"''";
else time_taken = sec_taken%60 +" seconds";
else time_taken = sec_taken%60 +_t(" seconds");
var title;
if (sec_per_item < 5) title = _t("Whew, that was fast !") + " <i class='fa fa-trophy congrats_icon'></i>";
@ -1277,7 +1276,7 @@ openerp.account = function (instance) {
self.is_valid = false;
self.$(".tip_reconciliation_not_balanced").show();
self.$(".tbody_open_balance").empty();
self.$(".button_ok").text("OK").removeClass("oe_highlight").attr("disabled", "disabled");
self.$(".button_ok").text(_t("OK")).removeClass("oe_highlight").attr("disabled", "disabled");
// Find out if the counterpart is lower than, equal or greater than the transaction being reconciled
var balance_type = undefined;
@ -1294,7 +1293,7 @@ openerp.account = function (instance) {
if (self.st_line.has_no_partner) {
createOpenBalance(_t("Choose counterpart"));
} else {
displayValidState(false, "Keep open");
displayValidState(false, _t("Keep open"));
createOpenBalance(_t("Open balance"));
}
}

View File

@ -33,7 +33,7 @@
<div class="oe_clear"></div>
<div class="reconciliation_lines_container"></div>
<div class="show_more_container"><button class="show_more">Show more... (<span class="num_items_remaining"></span> remaining)</button></div>
<p class='protip'>Tip : Hit ctrl-enter to validate the whole sheet.</p>
<p class='protip'>Tip : Hit ctrl-enter to reconcile all balanced items.</p>
</div></div>
</t>