[FIX]: fix a problem of getting type from context in search method account.move

[IMP]: improve the view for cheques

bzr revid: mga@tinyerp.com-20100818203909-hku2dfb28mwujmxf
This commit is contained in:
Mantavya Gajjar
2010-08-19 02:09:09 +05:30
parent 6c9f2ddebf
commit 57362a8ac0
4 changed files with 29 additions and 34 deletions
+1 -19
View File
@@ -25,24 +25,6 @@ from osv import fields
from osv import osv
from tools.translate import _
journal2type = {
'bank':'receipt',
'cash':'receipt',
'sale':'sale',
'purchase':'purchase'
}
type2journal = {
'rec_voucher': 'cash',
'bank_rec_voucher': 'bank',
'pay_voucher': 'cash',
'bank_pay_voucher': 'bank',
'cont_voucher': 'cash',
'journal_sale_vou': 'sale',
'journal_pur_voucher': 'purchase',
'journal_voucher':'general'
}
class ir_sequence_type(osv.osv):
_inherit = "ir.sequence.type"
_columns = {
@@ -106,7 +88,7 @@ class account_move(osv.osv):
"""
if not context:
context = {}
ttype = context.get('ttype', False)
ttype = context.get('type', False)
partner = context.get('partner_id', False)
voucher = context.get('voucher', False)
if voucher and not partner:
@@ -138,5 +138,18 @@
</record>
<menuitem action="action_vendor_receipt" icon="STOCK_JUSTIFY_FILL"
id="menu_action_vendor_receipt" parent="account.menu_finance_receivables"/>
<record id="action_cheque_pay" model="ir.actions.act_window">
<field name="name">Cheques</field>
<field name="res_model">account.voucher.open</field>
<field name="view_type">form</field>
<field name="domain">[('journal_id.type', 'in', ['bank']), ('type','=','payment')]</field>
<field name="context">{'journal_type':'bank', 'type':'payment'}</field>
<field name="view_id" ref="account_open_vouchers_view"/>
<field name="target">new</field>
</record>
<menuitem action="action_cheque_pay" icon="STOCK_JUSTIFY_FILL"
id="menu_action_cheque_pay" parent="account.menu_finance_bank_and_cash"/>
</data>
</openerp>
+14 -14
View File
@@ -272,20 +272,20 @@
<!-- id="menu_action_cheque_pay" -->
<!-- parent="account.menu_finance_payables"/>-->
<record id="action_cheque_pay_voucher" model="ir.actions.act_window">
<field name="name">Cheques</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">account.voucher</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="domain">[('journal_id.type', 'in', ['bank']), ('type','=','payment')]</field>
<field name="context">{'type':'bank'}</field>
<field name="view_id" ref="view_voucher_tree"/>
<field name="search_view_id" ref="view_voucher_filter_new"/>
</record>
<menuitem action="action_cheque_pay_voucher"
id="menu_action_cheque_pay_voucher"
parent="account.menu_finance_bank_and_cash"/>
<!-- <record id="action_cheque_pay_voucher" model="ir.actions.act_window">-->
<!-- <field name="name">Cheques</field>-->
<!-- <field name="type">ir.actions.act_window</field>-->
<!-- <field name="res_model">account.voucher</field>-->
<!-- <field name="view_type">form</field>-->
<!-- <field name="view_mode">tree,form</field>-->
<!-- <field name="domain">[('journal_id.type', 'in', ['bank']), ('type','=','payment')]</field>-->
<!-- <field name="context">{'type':'bank'}</field>-->
<!-- <field name="view_id" ref="view_voucher_tree"/>-->
<!-- <field name="search_view_id" ref="view_voucher_filter_new"/>-->
<!-- </record>-->
<!-- <menuitem action="action_cheque_pay_voucher" -->
<!-- id="menu_action_cheque_pay_voucher" -->
<!-- parent="account.menu_finance_bank_and_cash"/>-->
<record model="ir.ui.view" id="view_account_journal_form_inherit">
<field name="name">account.journal.form.inherit</field>
@@ -11,7 +11,7 @@
<field name="payment_ids" colspan="4" nolabel="1" height="200">
<tree string="Payment Lines" editable="top">
<field name="ref" on_change="onchange_partner(parent.partner_id,type,parent.type, parent.currency_id)"/>
<field name="move_id" string="Vendor Bill" context="{'ttype':parent.type, 'partner_id':parent.partner_id, 'voucher':True}" on_change="onchange_invoice_id(move_id, parent.currency_id)" domain="[('state','=','posted'), ('partner_id','=',parent.partner_id), ('reconcile_id','=', False)]"/>
<field name="move_id" string="Vendor Bill" context="{'type':parent.type, 'partner_id':parent.partner_id, 'voucher':True}" on_change="onchange_invoice_id(move_id, parent.currency_id)" domain="[('state','=','posted'), ('partner_id','=',parent.partner_id), ('reconcile_id','=', False)]"/>
<field name="amount"/>
<field name="account_id"/>
<field name="type" on_change="onchange_type(parent.partner_id,type,parent.type, parent.currency_id)"/>