[FIX] Fixed cash register opening going to web pos view instead of cash register view. Also added default views in cash registers (draft, open).

bzr revid: tde@openerp.com-20120209180433-n7e1o5csqjxlfq7q
This commit is contained in:
Thibault Delavallée 2012-02-09 19:04:33 +01:00
parent bed150e5b0
commit 10d6d58927
3 changed files with 21 additions and 7 deletions

View File

@ -524,8 +524,9 @@
<field name="arch" type="xml">
<search string="Search Bank Statements">
<group>
<filter string="Draft" domain="[('state','=','draft')]" icon="terp-document-new"/>
<filter string="Confirmed" domain="[('state','=','confirm')]" icon="terp-camera_test"/>
<filter string="Draft" name="state_draft" domain="[('state','=','draft')]" icon="terp-document-new"/>
<filter string="Open" name="state_open" domain="[('state','=','open')]" icon="terp-document-new"/>
<filter string="Confirmed" name="state_confirmed" domain="[('state','=','confirm')]" icon="terp-camera_test"/>
<separator orientation="vertical"/>
<field name="date"/>
<field name="name"/>

View File

@ -114,6 +114,7 @@
<field name="view_mode">form,tree</field>
<field name="view_id" ref="account.view_bank_statement_form2"/>
<field name="search_view_id" ref="account.view_account_bank_statement_filter"/>
<field name="context">{'search_default_state_draft': 1, 'search_default_state_open': 1}</field>
</record>
<record model="ir.actions.act_window.view" id="act_cash_statement_all_register1">
<field name="sequence" eval="0"/>

View File

@ -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: