diff --git a/addons/account/models/account_bank_statement.py b/addons/account/models/account_bank_statement.py index 602f5a5fda8..2f38507883e 100644 --- a/addons/account/models/account_bank_statement.py +++ b/addons/account/models/account_bank_statement.py @@ -353,6 +353,7 @@ class AccountBankStatementLine(models.Model): " when the partner doesn't exist yet in the database (or cannot be found).") ref = fields.Char(string='Reference') note = fields.Text(string='Notes') + transaction_type = fields.Char(string='Transaction Type') sequence = fields.Integer(index=True, help="Gives the sequence order when displaying a list of bank statement lines.", default=1) company_id = fields.Many2one('res.company', related='statement_id.company_id', string='Company', store=True, readonly=True) journal_entry_ids = fields.One2many('account.move.line', 'statement_line_id', 'Journal Items', copy=False, readonly=True) diff --git a/addons/account/models/account_reconcile_model.py b/addons/account/models/account_reconcile_model.py index c9d45548482..698f38f7cca 100644 --- a/addons/account/models/account_reconcile_model.py +++ b/addons/account/models/account_reconcile_model.py @@ -54,6 +54,24 @@ class AccountReconcileModel(models.Model): * Not Contains: Negation of "Contains". * Match Regex: Define your own regular expression.''') match_label_param = fields.Char(string='Label Parameter') + match_note = fields.Selection(selection=[ + ('contains', 'Contains'), + ('not_contains', 'Not Contains'), + ('match_regex', 'Match Regex'), + ], string='Note', help='''The reconciliation model will only be applied when the note: + * Contains: The proposition note must contains this string (case insensitive). + * Not Contains: Negation of "Contains". + * Match Regex: Define your own regular expression.''') + match_note_param = fields.Char(string='Note Parameter') + match_transaction_type = fields.Selection(selection=[ + ('contains', 'Contains'), + ('not_contains', 'Not Contains'), + ('match_regex', 'Match Regex'), + ], string='Transaction Type', help='''The reconciliation model will only be applied when the transaction type: + * Contains: The proposition transaction type must contains this string (case insensitive). + * Not Contains: Negation of "Contains". + * Match Regex: Define your own regular expression.''') + match_transaction_type_param = fields.Char(string='Transaction Type Parameter') match_same_currency = fields.Boolean(string='Same Currency Matching', default=True, help='Restrict to propositions having the same currency as the statement line.') match_total_amount = fields.Boolean(string='Amount Matching', default=True, @@ -348,16 +366,17 @@ class AccountReconcileModel(models.Model): query += 'BETWEEN %s AND %s' params += [rule.match_amount_min, rule.match_amount_max] - # Filter on label. - if rule.match_label == 'contains': - query += ' AND st_line.name ILIKE %s' - params += ['%%%s%%' % rule.match_label_param] - elif rule.match_label == 'not_contains': - query += ' AND st_line.name NOT ILIKE %s' - params += ['%%%s%%' % rule.match_label_param] - elif rule.match_label == 'match_regex': - query += ' AND st_line.name ~ %s' - params += [rule.match_label_param] + # Filter on label, note and transaction_type + for field in ['label', 'note', 'transaction_type']: + if rule['match_' + field] == 'contains': + query += ' AND st_line.name ILIKE %s' + params += ['%%%s%%' % rule['match_' + field + '_param']] + elif rule['match_' + field] == 'not_contains': + query += ' AND st_line.name NOT ILIKE %s' + params += ['%%%s%%' % rule['match_' + field + '_param']] + elif rule['match_' + field] == 'match_regex': + query += ' AND st_line.name ~ %s' + params += [rule['match_' + field + '_param']] # Filter on partners. if rule.match_partner: diff --git a/addons/account/models/chart_template.py b/addons/account/models/chart_template.py index ed2e8b7ee26..8013248968e 100644 --- a/addons/account/models/chart_template.py +++ b/addons/account/models/chart_template.py @@ -712,6 +712,10 @@ class AccountChartTemplate(models.Model): 'match_amount_max': account_reconcile_model.match_amount_max, 'match_label': account_reconcile_model.match_label, 'match_label_param': account_reconcile_model.match_label_param, + 'match_note': account_reconcile_model.match_note, + 'match_note_param': account_reconcile_model.match_note_param, + 'match_transaction_type': account_reconcile_model.match_transaction_type, + 'match_transaction_type_param': account_reconcile_model.match_transaction_type_param, 'match_same_currency': account_reconcile_model.match_same_currency, 'match_total_amount': account_reconcile_model.match_total_amount, 'match_total_amount_param': account_reconcile_model.match_total_amount_param, @@ -1111,6 +1115,24 @@ class AccountReconcileModelTemplate(models.Model): * Not Contains: Negation of "Contains". * Match Regex: Define your own regular expression.''') match_label_param = fields.Char(string='Label Parameter') + match_note = fields.Selection(selection=[ + ('contains', 'Contains'), + ('not_contains', 'Not Contains'), + ('match_regex', 'Match Regex'), + ], string='Note', help='''The reconciliation model will only be applied when the note: + * Contains: The proposition note must contains this string (case insensitive). + * Not Contains: Negation of "Contains". + * Match Regex: Define your own regular expression.''') + match_note_param = fields.Char(string='Note Parameter') + match_transaction_type = fields.Selection(selection=[ + ('contains', 'Contains'), + ('not_contains', 'Not Contains'), + ('match_regex', 'Match Regex'), + ], string='Transaction Type', help='''The reconciliation model will only be applied when the transaction type: + * Contains: The proposition transaction type must contains this string (case insensitive). + * Not Contains: Negation of "Contains". + * Match Regex: Define your own regular expression.''') + match_transaction_type_param = fields.Char(string='Transaction Type Parameter') match_same_currency = fields.Boolean(string='Same Currency Matching', default=True, help='Restrict to propositions having the same currency as the statement line.') match_total_amount = fields.Boolean(string='Amount Matching', default=True, diff --git a/addons/account/views/account_view.xml b/addons/account/views/account_view.xml index 6db90130d91..ba88d11715e 100644 --- a/addons/account/views/account_view.xml +++ b/addons/account/views/account_view.xml @@ -581,6 +581,8 @@ action = model.setting_init_bank_account_action() + + @@ -649,6 +651,8 @@ action = model.setting_init_bank_account_action() + + @@ -669,6 +673,7 @@ action = model.setting_init_bank_account_action() + @@ -687,6 +692,8 @@ action = model.setting_init_bank_account_action() + + @@ -775,6 +782,20 @@ action = model.setting_init_bank_account_action() +