Browse Source
fixup! [FIX] correctly initialize options
pull/204/head
Holger Brunn
6 years ago
No known key found for this signature in database
GPG Key ID: 1C9760FECA3AE18
2 changed files with
23 additions and
4 deletions
-
account_bank_statement_import_auto_reconcile/models/account_bank_statement_import_auto_reconcile_rule.py
-
account_bank_statement_import_auto_reconcile/tests/test_account_bank_statement_import_auto_reconcile.py
|
|
@ -142,10 +142,13 @@ class AccountBankStatementImportAutoReconcileRule(models.Model): |
|
|
|
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 |
|
|
|
}) |
|
|
|
lambda x: self.env[x.rule_type].new(dict( |
|
|
|
self.env[x.rule_type].default_get( |
|
|
|
self.env[x.rule_type]._fields.keys() |
|
|
|
), |
|
|
|
wizard_id=self.id, |
|
|
|
options=x.options, |
|
|
|
)) |
|
|
|
if x else None |
|
|
|
) |
|
|
|
for rule in rules: |
|
|
|
|
|
@ -85,3 +85,19 @@ class TestAccountBankStatementImportAutoReconcile(TransactionCase): |
|
|
|
'auto_reconcile': True, |
|
|
|
}).import_file() |
|
|
|
self.assertEqual(self.invoice.state, 'paid') |
|
|
|
|
|
|
|
def test_rule_options(self): |
|
|
|
self.rule.unlink() |
|
|
|
rule = self.env[ |
|
|
|
'account.bank.statement.import.auto.reconcile.rule' |
|
|
|
].create({ |
|
|
|
'journal_id': self.env.ref('account.bank_journal').id, |
|
|
|
'rule_type': |
|
|
|
'account.bank.statement.import.auto.reconcile.exact.amount', |
|
|
|
'match_st_name': False, |
|
|
|
}) |
|
|
|
rules = rule.get_rules() |
|
|
|
# explicitly written |
|
|
|
self.assertFalse(rules.match_st_name) |
|
|
|
# defaults must be used here too |
|
|
|
self.assertTrue(rules.match_st_ref) |