result = self.write(cr, uid, [journal.id], res)
return result
-
+
def create(self, cr, uid, vals, context={}):
journal_id = super(account_journal, self).create(cr, uid, vals, context)
self.create_sequence(cr, uid, [journal_id], context)
if not args:
args = []
ids = []
+
+ if context.get('journal_type', False):
+ args += [('type','=',context.get('journal_type'))]
+
if name:
ids = self.search(cr, user, [('code','ilike',name)]+ args, limit=limit, context=context)
if not ids:
ids = self.search(cr, user, [('name',operator,name)]+ args, limit=limit, context=context)
+
return self.name_get(cr, user, ids, context=context)
def onchange_type(self, cr, uid, ids, type, currency):
}
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context={}, toolbar=False, submenu=False):
+ journal_pool = self.pool.get('account.journal')
+
result = super(osv.osv, self).fields_view_get(cr, uid, view_id, view_type, context, toolbar=toolbar, submenu=submenu)
if view_type != 'tree':
#Remove the toolbar from the form view
if view_type == 'form':
result['toolbar']['action'] = []
+
+ #Restrict the list of journal view in search view
+ if view_type == 'search':
+ journal_list = journal_pool.name_search(cr, uid, '', [], context=context)
+ result['fields']['journal_id']['selection'] = journal_list
return result
fld = []
flds = []
title = "Accounting Entries" #self.view_header_get(cr, uid, view_id, view_type, context)
xml = '''<?xml version="1.0"?>\n<tree string="%s" editable="top" refresh="5" on_write="on_create_write">\n\t''' % (title)
- journal_pool = self.pool.get('account.journal')
+
ids = journal_pool.search(cr, uid, [])
journals = journal_pool.browse(cr, uid, ids)