context = {}
st_ids = []
- new_st_ids = []
j_ids = journal_obj.search(cr, uid, [('journal_user','=',1)], context=context)
if not j_ids:
raise osv.except_osv(_('No Cash Register Defined !'), _('You must define which payment method must be available through the point of sale by reusing existing bank and cash through "Accounting > Configuration > Financial Accounting > Journals". Select a journal and check the field "PoS Payment Method" from the "Point of Sale" tab. You can also create new payment methods directly from menu "PoS Backend > Configuration > Payment Methods".'))
for journal in journal_obj.browse(cr, uid, j_ids, context=context):
ids = statement_obj.search(cr, uid, [('state', '!=', 'confirm'), ('user_id', '=', uid), ('journal_id', '=', journal.id)], context=context)
- if len(ids):
- st_ids += ids
- continue
if journal.sequence_id:
number = sequence_obj.next_by_id(cr, uid, journal.sequence_id.id)
'name': number
})
statement_id = statement_obj.create(cr, uid, data, context=context)
- st_ids.append(statement_id)
- new_st_ids.append(int(statement_id))
+ st_ids.append(int(statement_id))
if journal.auto_cash:
statement_obj.button_open(cr, uid, [statement_id], context)
tree_id = tree_res and tree_res[1] or False
form_res = mod_obj.get_object_reference(cr, uid, 'account', 'view_bank_statement_form2')
form_id = form_res and form_res[1] or False
- #search_id = mod_obj.get_object_reference(cr, uid, 'point_of_sale', 'view_pos_open_cash_statement_filter')
search_res = mod_obj.get_object_reference(cr, uid, 'account', 'view_account_bank_statement_filter')
search_id = search_res and search_res[1] or False
- print '[("id", "in", "%s")]'% new_st_ids
return {
'type': 'ir.actions.act_window',
'view_type': 'form',
'view_mode': 'tree, form',
'res_model': 'account.bank.statement',
- 'domain': "[('id', 'in', " + str(new_st_ids) + ")]",
+ 'domain': "[('id', 'in', " + str(st_ids) + ")]",
'views': [(tree_id, 'tree'), (form_id, 'form')],
'search_view_id': search_id,
}