diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index e7686919d22..f7b73f13040 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -524,8 +524,9 @@ - - + + + diff --git a/addons/point_of_sale/account_statement_view.xml b/addons/point_of_sale/account_statement_view.xml index d6c4b3f244a..a1a0fa44b39 100644 --- a/addons/point_of_sale/account_statement_view.xml +++ b/addons/point_of_sale/account_statement_view.xml @@ -114,6 +114,7 @@ form,tree + {'search_default_state_draft': 1, 'search_default_state_open': 1} diff --git a/addons/point_of_sale/wizard/pos_open_statement.py b/addons/point_of_sale/wizard/pos_open_statement.py index 0c2ba0daeb3..73d6f782cc1 100644 --- a/addons/point_of_sale/wizard/pos_open_statement.py +++ b/addons/point_of_sale/wizard/pos_open_statement.py @@ -44,6 +44,7 @@ class pos_open_statement(osv.osv_memory): 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".')) @@ -67,7 +68,8 @@ class pos_open_statement(osv.osv_memory): }) statement_id = statement_obj.create(cr, uid, data, context=context) st_ids.append(statement_id) - + new_st_ids.append(int(statement_id)) + if journal.auto_cash: statement_obj.button_open(cr, uid, [statement_id], context) @@ -75,12 +77,22 @@ class pos_open_statement(osv.osv_memory): 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_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.client', - 'tag': 'pos.ui', + 'type': 'ir.actions.act_window', + 'name': _('List of Cash Registers'), + 'view_type': 'form', + 'view_mode': 'tree, form', + 'res_model': 'account.bank.statement', + 'domain': "[('id', 'in', " + str(new_st_ids) + ")]", + 'views': [(tree_id, 'tree'), (form_id, 'form')], + 'search_view_id': search_id, } + pos_open_statement() # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: