add a reconcile rule matching a transaction_ref vs a reference

This commit is contained in:
Guewen Baconnier
2014-01-16 15:12:55 +01:00
parent 25e1bfa717
commit 64929f8574
3 changed files with 30 additions and 1 deletions

View File

@@ -41,3 +41,25 @@ class easy_reconcile_advanced_transaction_ref(orm.TransientModel):
def _opposite_matchers(self, cr, uid, rec, move_line, context=None):
yield ('partner_id', move_line['partner_id'])
yield ('ref', (move_line['transaction_ref'] or '').lower().strip())
class easy_reconcile_advanced_transaction_ref_vs_ref(orm.TransientModel):
_name = 'easy.reconcile.advanced.trans_ref_vs_ref'
_inherit = 'easy.reconcile.advanced'
def _skip_line(self, cr, uid, rec, move_line, context=None):
"""
When True is returned on some conditions, the credit move line
will be skipped for reconciliation. Can be inherited to
skip on some conditions. ie: ref or partner_id is empty.
"""
return not (move_line.get('ref') and move_line.get('partner_id'))
def _matchers(self, cr, uid, rec, move_line, context=None):
return (('partner_id', move_line['partner_id']),
('ref', move_line['transaction_ref'].lower().strip()))
def _opposite_matchers(self, cr, uid, rec, move_line, context=None):
yield ('partner_id', move_line['partner_id'])
yield ('ref', (move_line['ref'] or '').lower().strip())

View File

@@ -32,6 +32,8 @@ class account_easy_reconcile_method(orm.Model):
methods += [
('easy.reconcile.advanced.transaction_ref',
'Advanced. Partner and Transaction Ref.'),
('easy.reconcile.advanced.transaction_ref_vs_ref',
'Advanced. Partner and Transaction Ref. vs Ref.'),
]
return methods

View File

@@ -10,7 +10,12 @@
<group colspan="2" col="2">
<separator colspan="4" string="Advanced. Partner and Transaction Ref"/>
<label string="Match multiple debit vs multiple credit entries. Allow partial reconciliation.
The lines should have the partner, the credit entry transaction ref. is matched vs the debit entry transaction ref. or name." colspan="4"/>
The lines should have the partner, the credit entry transaction ref. is matched vs the debit entry transaction ref." colspan="4"/>
</group>
<group colspan="2" col="2">
<separator colspan="4" string="Advanced. Partner and Transaction Ref. vs Ref."/>
<label string="Match multiple debit vs multiple credit entries. Allow partial reconciliation.
The lines should have the partner, the credit entry transaction ref. is matched vs the debit entry reference." colspan="4"/>
</group>
</page>
</field>