[REF] account: prepares hooks for reconciliation requests
This commit changes some methods so they can be used in the account_documents enterprise bridge and adapts activity tests for the new request on upload_file feature. task: #1928404 related to: odoo/enterprise#3607 closes odoo/odoo#30950
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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();
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -925,7 +925,7 @@
|
||||
<field name="has_second_line" />
|
||||
<label for="has_second_line" string="Add a second line"/>
|
||||
</div>
|
||||
<group attrs="{'invisible':['|', ('has_second_line', '=', False), '&', ('rule_type', '=', 'invoice_matching'), '|', ('match_total_amount', '=', False), '&', ('match_total_amount', '=', True), ('match_total_amount_param', '=', 100.0)]}">
|
||||
<group name="second_line" attrs="{'invisible':['|', ('has_second_line', '=', False), '&', ('rule_type', '=', 'invoice_matching'), '|', ('match_total_amount', '=', False), '&', ('match_total_amount', '=', True), ('match_total_amount_param', '=', 100.0)]}">
|
||||
<group>
|
||||
<field name="second_account_id" string="Account" domain="[('company_id', '=', company_id)]"
|
||||
attrs="{'required': [('has_second_line', '=', True), '|', ('rule_type', '!=', 'invoice_matching'), '&', '&', ('rule_type', '=', 'invoice_matching'), ('match_total_amount', '=', True), ('match_total_amount_param', '!=', 100.0)]}"/>
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user