diff --git a/addons/account/models/reconciliation_widget.py b/addons/account/models/reconciliation_widget.py
index 90c6b254f90..e3bc2630c1d 100644
--- a/addons/account/models/reconciliation_widget.py
+++ b/addons/account/models/reconciliation_widget.py
@@ -24,11 +24,13 @@ class AccountReconciliation(models.AbstractModel):
'counterpart_aml_dicts', 'payment_aml_ids' and 'new_aml_dicts',
whose value is the same as described in process_reconciliation
except that ids are used instead of recordsets.
+ :returns dict: used as a hook to add additional keys.
"""
st_lines = self.env['account.bank.statement.line'].browse(st_line_ids)
AccountMoveLine = self.env['account.move.line']
ctx = dict(self._context, force_price_include=False)
+ processed_moves = self.env['account.move']
for st_line, datum in zip(st_lines, data):
payment_aml_rec = AccountMoveLine.browse(datum.get('payment_aml_ids', []))
@@ -40,10 +42,12 @@ class AccountReconciliation(models.AbstractModel):
st_line.write({'partner_id': datum['partner_id']})
ctx['default_to_check'] = datum.get('to_check')
- st_line.with_context(ctx).process_reconciliation(
+ moves = st_line.with_context(ctx).process_reconciliation(
datum.get('counterpart_aml_dicts', []),
payment_aml_rec,
datum.get('new_aml_dicts', []))
+ processed_moves = (processed_moves | moves)
+ return {'moves': processed_moves}
@api.model
def get_move_lines_for_bank_statement_line(self, st_line_id, partner_id=None, excluded_ids=None, search_str=False, offset=0, limit=None):
@@ -113,7 +117,7 @@ class AccountReconciliation(models.AbstractModel):
'value_max': 0,
'reconciled_aml_ids': [],
}
-
+
if not st_line_ids:
return results
diff --git a/addons/account/static/src/js/reconciliation/reconciliation_model.js b/addons/account/static/src/js/reconciliation/reconciliation_model.js
index 9f667221621..91b200c2d93 100644
--- a/addons/account/static/src/js/reconciliation/reconciliation_model.js
+++ b/addons/account/static/src/js/reconciliation/reconciliation_model.js
@@ -761,6 +761,7 @@ var StatementModel = BasicModel.extend({
args: [ids, values],
context: self.context,
})
+ .then(this._validatePostProcess.bind(this))
.then(function () {
return {handles: handles};
});
@@ -1265,6 +1266,17 @@ var StatementModel = BasicModel.extend({
if (prop.reconcileModelId) result.reconcile_model_id = prop.reconcileModelId
return result;
},
+ /**
+ * Hook to handle return values of the validate's line process.
+ *
+ * @private
+ * @param {Object} data
+ * @param {Object[]} data.moves list of processed account.move
+ * @returns {Deferred}
+ */
+ _validatePostProcess: function (data) {
+ return $.when();
+ },
});
diff --git a/addons/account/views/account_view.xml b/addons/account/views/account_view.xml
index b7ffd04d859..500028bfcf5 100644
--- a/addons/account/views/account_view.xml
+++ b/addons/account/views/account_view.xml
@@ -925,7 +925,7 @@
-
+
diff --git a/addons/test_mail/tests/test_performance.py b/addons/test_mail/tests/test_performance.py
index ff162bb1ecf..50744c54f56 100644
--- a/addons/test_mail/tests/test_performance.py
+++ b/addons/test_mail/tests/test_performance.py
@@ -172,7 +172,7 @@ class TestAdvMailPerformance(TransactionCase):
'default_res_model': 'mail.test.activity',
})
- with self.assertQueryCount(__system__=10, emp=16): # com runbot: 9 - 15 // test_mail only: 10 - 15
+ with self.assertQueryCount(__system__=10, emp=17): # com runbot: 9 - 15 // test_mail only: 10 - 15
activity = MailActivity.create({
'summary': 'Test Activity',
'res_id': record.id,
@@ -191,7 +191,7 @@ class TestAdvMailPerformance(TransactionCase):
def test_adv_activity_mixin(self):
record = self.env['mail.test.activity'].create({'name': 'Test'})
- with self.assertQueryCount(__system__=10, emp=16): # com runbot: 9 - 15 // test_mail only: 10 - 15
+ with self.assertQueryCount(__system__=10, emp=17): # com runbot: 9 - 15 // test_mail only: 10 - 15
activity = record.action_start('Test Start')
#read activity_type to normalize cache between enterprise and community
#voip module read activity_type during create leading to one less query in enterprise on action_close