[IMP] account_bank_statement_extensions: simplified code and replaced the fields update_by and update_date by the fields write_uid and write_date which are already handlded by the orm
bzr revid: qdp-launchpad@openerp.com-20111223162528-20b2o1nq9fwnuruj
This commit is contained in:
parent
f8f123a92a
commit
b588890d91
|
@ -88,13 +88,13 @@ class account_bank_statement_line_global(osv.osv):
|
|||
args = []
|
||||
ids = []
|
||||
if name:
|
||||
ids = self.search(cr, user, [('code', '=ilike', name)] + args, limit=limit)
|
||||
ids = self.search(cr, user, [('code', 'ilike', name)] + args, limit=limit)
|
||||
if not ids:
|
||||
ids = self.search(cr, user, [('name', operator, name)] + args, limit=limit)
|
||||
if not ids and len(name.split()) >= 2:
|
||||
#Separating code and name for searching
|
||||
operand1, operand2 = name.split(' ', 1) #name can contain spaces
|
||||
ids = self.search(cr, user, [('code', '=like', operand1), ('name', operator, operand2)] + args, limit=limit)
|
||||
ids = self.search(cr, user, [('code', 'like', operand1), ('name', operator, operand2)] + args, limit=limit)
|
||||
else:
|
||||
ids = self.search(cr, user, args, context=context, limit=limit)
|
||||
return self.name_get(cr, user, ids, context=context)
|
||||
|
@ -112,8 +112,6 @@ class account_bank_statement_line(osv.osv):
|
|||
'globalisation_amount': fields.related('globalisation_id', 'amount', type='float',
|
||||
relation='account.bank.statement.line.global', string='Glob. Amount', readonly=True),
|
||||
'journal_id': fields.related('statement_id', 'journal_id', type='many2one', relation='account.journal', string='Journal', store=True, readonly=True),
|
||||
'update_date': fields.date('Update Date', required=True, readonly=True),
|
||||
'update_by': fields.many2one('res.users', 'Updated by', required=True, readonly=True),
|
||||
'state': fields.selection([('draft', 'Draft'), ('confirm', 'Confirmed')],
|
||||
'State', required=True, readonly=True),
|
||||
'counterparty_name': fields.char('Counterparty Name', size=35),
|
||||
|
@ -122,8 +120,6 @@ class account_bank_statement_line(osv.osv):
|
|||
'counterparty_currency': fields.char('Counterparty Currency', size=3),
|
||||
}
|
||||
_defaults = {
|
||||
'update_date': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
|
||||
'update_by': lambda s, c, u, ctx: u,
|
||||
'state': 'draft',
|
||||
}
|
||||
|
||||
|
@ -131,15 +127,10 @@ class account_bank_statement_line(osv.osv):
|
|||
if context is None:
|
||||
context = {}
|
||||
if context.get('block_statement_line_delete', False):
|
||||
raise osv.except_osv('Warning', _('Delete operation not allowed ! \
|
||||
raise osv.except_osv(_('Warning'), _('Delete operation not allowed ! \
|
||||
Please go to the associated bank statement in order to delete and/or modify this bank statement line'))
|
||||
return super(account_bank_statement_line, self).unlink(cr, uid, ids, context=context)
|
||||
|
||||
def write(self, cr, uid, ids, vals, context=None):
|
||||
vals['update_date'] = time.strftime('%Y-%m-%d %H:%M:%S')
|
||||
vals['update_by'] = uid
|
||||
return super(account_bank_statement_line, self).write(cr, uid, ids, vals, context=context)
|
||||
|
||||
account_bank_statement_line()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -81,8 +81,8 @@
|
|||
<field name="globalisation_id" string="Glob. Id"/>
|
||||
<field name="globalisation_amount" string="Glob. Am."/>
|
||||
<field name="state"/>
|
||||
<field name="update_date"/>
|
||||
<field name="update_by"/>
|
||||
<field name="write_date"/>
|
||||
<field name="write_uid"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
@ -106,8 +106,8 @@
|
|||
<field name="amount"/>
|
||||
<field name="globalisation_id"/>
|
||||
<field name="sequence" readonly="0"/>
|
||||
<field name="update_date"/>
|
||||
<field name="update_by"/>
|
||||
<field name="write_date"/>
|
||||
<field name="write_uid"/>
|
||||
<field name="state"/>
|
||||
<separator colspan="4" string="Notes"/>
|
||||
<field colspan="4" name="note" nolabel="1"/>
|
||||
|
@ -140,8 +140,8 @@
|
|||
<group string="Extended Filters..." expand="0">
|
||||
<field name="account_id"/>
|
||||
<field name="partner_id"/>
|
||||
<field name="update_date"/>
|
||||
<field name="update_by"/>
|
||||
<field name="write_date"/>
|
||||
<field name="write_uid"/>
|
||||
<field name="ref"/>
|
||||
<field name="note"/>
|
||||
</group>
|
||||
|
|
Loading…
Reference in New Issue