Holger Brunn
8 years ago
No known key found for this signature in database
GPG Key ID: 1C9760FECA3AE18
3 changed files with
16 additions and
10 deletions
-
account_bank_statement_import_auto_reconcile/models/account_bank_statement_import.py
-
account_bank_statement_import_auto_reconcile/models/account_bank_statement_import_auto_reconcile_rule.py
-
account_bank_statement_import_auto_reconcile/models/account_bank_statement_import_reapply_rules.py
|
|
@ -25,12 +25,7 @@ class AccountBankStatementImport(models.TransientModel): |
|
|
|
): |
|
|
|
return statement_id, notifications |
|
|
|
reconcile_rules = statement.journal_id\ |
|
|
|
.statement_import_auto_reconcile_rule_ids.mapped( |
|
|
|
lambda x: self.env[x.rule_type].new({ |
|
|
|
'wizard_id': self.id, |
|
|
|
'options': x.options |
|
|
|
}) |
|
|
|
) |
|
|
|
.statement_import_auto_reconcile_rule_ids.get_rules() |
|
|
|
auto_reconciled_ids = [] |
|
|
|
for line in statement.line_ids: |
|
|
|
for rule in reconcile_rules: |
|
|
|
|
|
@ -137,3 +137,17 @@ class AccountBankStatementImportAutoReconcileRule(models.Model): |
|
|
|
if field_name in values: |
|
|
|
options[field_name] = values.pop(field_name) |
|
|
|
values['options'] = options |
|
|
|
|
|
|
|
@api.multi |
|
|
|
def get_rules(self): |
|
|
|
"""Return a NewId object for the configured rule""" |
|
|
|
rules = self.mapped( |
|
|
|
lambda x: self.env[x.rule_type].new({ |
|
|
|
'wizard_id': self.id, |
|
|
|
'options': x.options |
|
|
|
}) |
|
|
|
if x else None |
|
|
|
) |
|
|
|
for rule in rules: |
|
|
|
rule.update(rule.options) |
|
|
|
return rules |
|
|
@ -25,10 +25,7 @@ class AccountBankStatementImportReapplyRules(models.TransientModel): |
|
|
|
|
|
|
|
self.write({'journal_id': journal.id}) |
|
|
|
reconcile_rules = journal.statement_import_auto_reconcile_rule_ids\ |
|
|
|
.mapped(lambda x: self.env[x.rule_type].new({ |
|
|
|
'wizard_id': self.id, |
|
|
|
'options': x.options |
|
|
|
})) |
|
|
|
.get_rules() |
|
|
|
|
|
|
|
for line in self.env['account.bank.statement.line'].search([ |
|
|
|
('statement_id', 'in', statements.ids), |
|
|
|