[IMP] account: add note and transaction_type to reconciliation model
Task 1999162 We want to be able to filter with the note and the transaction type, both in the bank statement line search view and in the reconciliation model closes odoo/odoo#34482 Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -581,6 +581,8 @@ action = model.setting_init_bank_account_action()
|
||||
<field name="partner_id" domain="['|',('parent_id','=',False),('is_company','=',True)]"
|
||||
attrs="{'readonly' : [('journal_entry_ids', '!=', [])] }"/>
|
||||
<field name="ref" attrs="{'readonly' : [('journal_entry_ids', '!=', [])] }" groups="base.group_no_one"/>
|
||||
<field name="transaction_type" attrs="{'readonly' : [('journal_entry_ids', '!=', [])] }" optional="hidden"/>
|
||||
<field name="note" optional="hidden"/>
|
||||
<field name="amount" attrs="{'readonly' : [('journal_entry_ids', '!=', [])] }"/>
|
||||
<field name="journal_currency_id" invisible="1"/>
|
||||
<field name="amount_currency" invisible="1"/>
|
||||
@@ -649,6 +651,8 @@ action = model.setting_init_bank_account_action()
|
||||
<field name="partner_id"/>
|
||||
<field name="date"/>
|
||||
<field name="journal_id" domain="[('type', 'in', ('bank', 'cash'))]" />
|
||||
<field name="note"/>
|
||||
<field name="transaction_type"/>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
@@ -669,6 +673,7 @@ action = model.setting_init_bank_account_action()
|
||||
<field name="journal_currency_id" invisible="1"/>
|
||||
<field name="sequence"/>
|
||||
<field name="note"/>
|
||||
<field name="transaction_type"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
@@ -687,6 +692,8 @@ action = model.setting_init_bank_account_action()
|
||||
<field name="ref"/>
|
||||
<field name="partner_id"/>
|
||||
<field name="amount"/>
|
||||
<field name="transaction_type" optional="hidden"/>
|
||||
<field name="note" optional="hidden"/>
|
||||
<field name="journal_currency_id" invisible="1"/>
|
||||
</tree>
|
||||
</field>
|
||||
@@ -775,6 +782,20 @@ action = model.setting_init_bank_account_action()
|
||||
<field name="match_label_param" style="width: 68% !important;" class="oe_inline"
|
||||
attrs="{'invisible': [('match_label', '=', False)], 'required': [('match_label', '!=', False)]}"/>
|
||||
</div>
|
||||
<label for="match_note"/>
|
||||
<div>
|
||||
<field name="match_note" style="width: 30% !important" class="oe_inline"/>
|
||||
<span class="o_form_label" style="width: 2% !important"> </span> <!-- Make a little space. -->
|
||||
<field name="match_note_param" style="width: 68% !important;" class="oe_inline"
|
||||
attrs="{'invisible': [('match_note', '=', False)], 'required': [('match_note', '!=', False)]}"/>
|
||||
</div>
|
||||
<label for="match_transaction_type"/>
|
||||
<div>
|
||||
<field name="match_transaction_type" style="width: 30% !important" class="oe_inline"/>
|
||||
<span class="o_form_label" style="width: 2% !important"> </span> <!-- Make a little space. -->
|
||||
<field name="match_transaction_type_param" style="width: 68% !important;" class="oe_inline"
|
||||
attrs="{'invisible': [('match_transaction_type', '=', False)], 'required': [('match_transaction_type', '!=', False)]}"/>
|
||||
</div>
|
||||
<field name="match_same_currency" attrs="{'invisible': [('rule_type', '!=', 'invoice_matching')]}"/>
|
||||
<label for="match_total_amount"
|
||||
attrs="{'invisible': ['|', ('rule_type', '!=', 'invoice_matching'), ('match_same_currency', '=', False)]}"/>
|
||||
|
||||
Reference in New Issue
Block a user