[ADD] field 'residual' in bank statement line trees

[RFR] field 'match_type' on bank statement lines is now a related field
[FIX] bug: invoices with state 'debid denied' are selected for new nebit orders
[ADD] filter button on invoices search view for state 'debit denied'
[FIX] invoice workflow does not allow reopening of invoices in state debit denied
[FIX] match wizard does not show payment line but move line for storno type matches
This commit is contained in:
OpenERP instance user
2011-12-21 14:06:26 +01:00
parent 363c82c2e2
commit 059e8d4420
10 changed files with 62 additions and 16 deletions

View File

@@ -27,7 +27,7 @@
##############################################################################
{
'name': 'Account Banking',
'version': '0.1.89',
'version': '0.1.90',
'license': 'GPL-3',
'author': 'EduSense BV / Therp BV / Smile',
'website': 'https://launchpad.net/banking-addons',

View File

@@ -267,6 +267,7 @@
</xpath>
<xpath expr="/form/notebook/page/field[@name='line_ids']/tree/field[@name='amount']" position="after">
<field name="match_type"/>
<field name="residual"/>
<button name="match_wizard" states="draft"
string="Match"
icon="terp-gtk-jump-to-ltr"
@@ -482,6 +483,7 @@
<field name="analytic_account_id" groups="analytic.group_analytic_accounting" domain="[('company_id', '=', parent.company_id), ('type', '&lt;&gt;', 'view')]"/>
<field name="amount"/>
<field name="match_type"/>
<field name="residual"/>
<button name="match_wizard" states="draft"
string="Match"
icon="terp-gtk-jump-to-ltr"

View File

@@ -1334,7 +1334,7 @@ class banking_import_transaction(osv.osv):
values['partner_id'] = move_info['partner_id']
values['partner_bank_id'] = move_info['partner_bank_id']
values['type'] = move_info['type']
values['match_type'] = move_info['match_type']
# values['match_type'] = move_info['match_type']
else:
values['partner_id'] = values['partner_bank_id'] = False
if not values['partner_id'] and partner_ids and len(partner_ids) == 1:
@@ -1421,7 +1421,8 @@ class banking_import_transaction(osv.osv):
res = dict([(x, False) for x in ids])
move_line_obj = self.pool.get('account.move.line')
for transaction in self.browse(cr, uid, ids, context):
if (transaction.match_type in
if (transaction.statement_line_id.state == 'draft'
and transaction.match_type in
[('invoice'), ('move'), ('manual')]):
rec_moves = (
transaction.move_line_id.reconcile_id and
@@ -1580,11 +1581,16 @@ class account_bank_statement_line(osv.osv):
'duplicate': fields.related(
'import_transaction_id', 'duplicate', type='boolean',
string='Possible duplicate import'),
'match_type': fields.selection(
[('manual', 'Manual'), ('move','Move'), ('invoice', 'Invoice'),
'match_type': fields.related(
'import_transaction_id', 'match_type', type='selection',
selection=[('manual', 'Manual'), ('move','Move'), ('invoice', 'Invoice'),
('payment', 'Payment'), ('payment_order', 'Payment order'),
('storno', 'Storno'),
], 'Match type', readonly=True),
('storno', 'Storno')], string='Match type', readonly=True,
),
'residual': fields.related(
'import_transaction_id', 'residual', type='float',
string='Residual', readonly=True,
),
'state': fields.selection(
[('draft', 'Draft'), ('confirmed', 'Confirmed')], 'State',
readonly=True, required=True),

View File

@@ -254,7 +254,7 @@ class banking_transaction_wizard(osv.osv_memory):
string='Write-off journal'),
'payment_line_id': fields.related(
'import_transaction_id', 'payment_line_id', string="Matching payment or storno",
type='many2one', relation='payment.line'),
type='many2one', relation='payment.line', readonly=True),
'payment_order_ids': fields.related(
'import_transaction_id', 'payment_order_ids', string="Matching payment orders",
type='many2many', relation='payment.order'),

View File

@@ -38,7 +38,7 @@
<label colspan="2" string="Multiple matches were found for this bank transfer. You must pick one of the matches or select a match manually below." />
</group>
<field name='payment_line_id'
attrs="{'invisible': [('match_type', 'not in', [('payment', 'storno')])]}"
attrs="{'invisible': [('match_type', '!=', 'storno'),('match_type', '!=', 'payment')]}"
/>
<group attrs="{'readonly': [('match_multi', '!=' True)]}">
<!-- show if we have an invoice type match (but the user may need to select from multiple options)
@@ -51,7 +51,7 @@
<!-- show if we have a move type match or a manual match without an invoice_id
-->
<field name='move_line_id'
attrs="{'readonly': [('match_multi', '=', False)], 'invisible': ['|',('match_type', '!=', 'move'),('match_type', '=', 'manual'),('invoice_id', '!=', False)]}"
attrs="{'readonly': [('match_multi', '=', False)], 'invisible': [('match_type', '!=', 'move'),('invoice_id', '=', False)]}"
domain="[('id', 'in', move_line_ids[0][2])]"
/>
<field name='payment_order_id'

View File

@@ -26,7 +26,7 @@
##############################################################################
{
'name': 'Direct Debit',
'version': '6.0.1.89',
'version': '6.0.1.90',
'license': 'GPL-3',
'author': 'Therp BV / Smile',
'website': 'https://launchpad.net/banking-addons',

View File

@@ -96,8 +96,27 @@ class account_move_line(osv.osv):
invoice_ids = invoice_obj.search(
cr, uid, [('payment_term', args[0][1], args[0][2])],
context=context)
operator = (args[0][1] not in ['in', '=', '==', 'like', 'ilike']
and 'not in' or 'in')
operator = 'in' # (args[0][1] not in ['in', '=', '==', 'like', 'ilike']
# and 'not in' or 'in')
if not invoice_ids:
return [('id', operator, [])]
cr.execute('SELECT l.id ' \
'FROM account_move_line l, account_invoice i ' \
'WHERE l.move_id = i.move_id AND i.id in %s', (tuple(invoice_ids),))
res = cr.fetchall()
if not res:
return [('id', '=', False)]
return [('id', operator, [x[0] for x in res])]
def _invoice_state_search(self, cr, uid, obj, name, args, context=None):
if not args:
return []
invoice_obj = self.pool.get('account.invoice')
invoice_ids = invoice_obj.search(
cr, uid, [('state', args[0][1], args[0][2])],
context=context)
operator = 'in' # (args[0][1] not in ['in', '=', '==', 'like', 'ilike']
# and 'not in' or 'in')
if not invoice_ids:
return [('id', operator, [])]
cr.execute('SELECT l.id ' \
@@ -118,6 +137,11 @@ class account_move_line(osv.osv):
string='Select by invoice payment term',
type='many2one', relation='account.payment.term',
fnct_search=_invoice_payment_term_id_search),
'invoice_state': fields.function(
_dummy, method=True,
string='Select by invoice state',
type='char', size=24,
fnct_search=_invoice_state_search),
}
account_move_line()

View File

@@ -12,7 +12,9 @@ class payment_mode(osv.osv):
domain=[('type', '=', 'other'),
('reconcile', '=', True)],
help=('Pay off lines in sent orders with a ' +
'move on this account. For debit type modes only'),
'move on this account. For debit type modes only. ' +
'You can only select accounts of type regular that ' +
'are marked for reconciliation'),
),
'transfer_journal_id': fields.many2one(
'account.journal', 'Transfer journal',
@@ -436,6 +438,7 @@ class payment_order_create(osv.osv_memory):
domain = [
('reconcile_id', '=', False),
('account_id.type', '=', 'receivable'),
('invoice_state', '!=', 'debit_denied'),
('amount_to_receive', '>', 0),
]
else:

View File

@@ -31,5 +31,16 @@
</data>
</field>
</record>
<record id="view_account_invoice_filter" model="ir.ui.view">
<field name="name">account.invoice.select direct debit</field>
<field name="model">account.invoice</field>
<field name="type">search</field>
<field name="inherit_id" ref="account.view_account_invoice_filter"/>
<field name="arch" type="xml">
<filter name="invoices" position="after">
<filter name="debit_denied" icon="terp-dolar_ok!" string="Debit denied" domain="[('state','=','debit_denied')]" help="Show only invoices with state Debit denied"/>
</filter>
</field>
</record>
</data>
</openerp>

View File

@@ -20,8 +20,8 @@
</record>
<record id="debit_denied_to_open" model="workflow.transition">
<field name="act_from" ref="act_debit_denied"/>
<field name="act_to" ref="account.act_open_test"/>
<field name="signal">open_test</field>
<field name="act_to" ref="account.act_open"/>
<field name="signal">invoice_open</field>
</record>
</data>
</openerp>