*improvement and overall cleaning + better views

bzr revid: qdp@tinyerp.com-20080917145737-p0t5r4wnc5eaae8h
This commit is contained in:
qdp 2008-09-17 16:57:37 +02:00
parent b8134ef123
commit cfb6ba7f15
2 changed files with 35 additions and 49 deletions

View File

@ -391,8 +391,8 @@ class payment_line(osv.osv):
# help='Amount to pay in the partner currency'),
# 'currency': fields.function(_currency, string='Currency',
# method=True, type='many2one', obj='res.currency'),
'currency': fields.many2one('res.currency','Currency',required=True),
'company_currency': fields.many2one('res.currency','Currency',readonly=True),
'currency': fields.many2one('res.currency','Partner Currency',required=True),
'company_currency': fields.many2one('res.currency','Company Currency',readonly=True),
'bank_id': fields.many2one('res.partner.bank', 'Destination Bank account'),
'order_id': fields.many2one('payment.order', 'Order', required=True,
ondelete='cascade', select=True),
@ -432,17 +432,23 @@ class payment_line(osv.osv):
def onchange_move_line(self,cr,uid,ids,move_line_id,payment_type,date_prefered,date_planned,currency=False,company_currency=False,context=None):
data={}
data['amount_currency']=data['currency']=data['communication']=data['partner_id']=data['reference']=data['date_created']=data['bank_id']=data['amount']=False
data['amount_currency']=data['communication']=data['partner_id']=data['reference']=data['date_created']=data['bank_id']=data['amount']=False
if move_line_id:
line = self.pool.get('account.move.line').browse(cr,uid,move_line_id)
data['amount_currency']=line.amount_to_pay
res = self.onchange_amount(cr, uid, ids, data['amount_currency'], currency, company_currency, context)
res = self.onchange_amount(cr, uid, ids, data['amount_currency'], currency, company_currency,
if res:
data['amount'] = res['value']['amount']
data['partner_id']=line.partner_id.id
data['currency']=line.currency_id and line.currency_id.id or False
if not data['currency']:
data['currency']=line.invoice and line.invoice.currency_id.id or False
temp = line.currency_id and line.currency_id.id or False
if not temp:
if line.invoice:
data['currency'] = line.invoice.currency_id.id
else:
data['currency'] = temp
# calling onchange of partner and updating data dictionary
temp_dict=self.onchange_partner(cr,uid,ids,line.partner_id.id,payment_type)
data.update(temp_dict['value'])

View File

@ -3,6 +3,18 @@
<data>
<!-- View used in the wizard -->
<record id="view_move_line_form" model="ir.ui.view">
<field name="name">account.move.line.form.inherit</field>
<field name="model">account.move.line</field>
<field name="type">form</field>
<field name="inherit_id" ref="account.view_move_line_form"/>
<field name="arch" type="xml">
<field name="reconcile_partial_id" position="after">
<field name="amount_to_pay" select="2"/>
</field>
</field>
</record>
<record model="ir.ui.view" id="view_move_line_tree_wiz">
<field name="name">account.move.line.tree</field>
<field name="model">account.move.line</field>
@ -17,6 +29,7 @@
<field name="date"/>
<field name="debit" sum="Total debit"/>
<field name="credit" sum="Total credit"/>
<field name="amount_to_pay"/>
<field name="amount_currency"/>
<field name="currency_id"/>
</tree>
@ -88,8 +101,7 @@
<form string="Payment Line">
<notebook>
<page string="Payment">
<field name="move_line_id" on_change="onchange_move_line(move_line_id,parent.mode,parent.date_prefered,parent.date_planned,currency,company_currency)" select="1"/>
<!--domain="[('reconcile_id','=', False), ('credit', '>',0),('amount_to_pay','>',0)] "/>-->
<field name="move_line_id" on_change="onchange_move_line(move_line_id,parent.mode,parent.date_prefered,parent.date_planned,currency,company_currency)" select="1" domain="[('reconcile_id','=', False), ('credit', '>',0),('amount_to_pay','>',0)] "/>
<separator colspan="4" string="Transaction Information"/>
<field name="date"/>
<group colspan="2">
@ -102,7 +114,6 @@
<separator colspan="2" string="Desitination Account"/>
<field colspan="2" name="info_owner" nolabel="1"/>
<field colspan="2" name="info_partner" nolabel="1"/>
<field colspan="4" name="communication"/>
<field colspan="4" name="communication2"/>
<field name="name"/>
@ -115,34 +126,23 @@
<field name="amount"/>
<field name="company_currency" nolabel="1"/>
</group>
<!--<field name="partner_payable"/>-->
<separator colspan="4" string="Entry Information"/>
<field name="create_date" readonly="1"/>
<field name="ml_maturity_date"/>
<field name="ml_inv_ref"/>
<!--<field name="to_pay_currency"/>
<field name="to_pay"/>-->
</page>
</notebook>
</form>
<tree string="Payment Line"> <!-- editable="bottom" colors="red:to_pay_currency&lt;amount_currency" -->
<tree string="Payment Line">
<field name="ml_inv_ref" />
<field name="partner_id" select="1"/>
<field name="bank_id" domain="[('partner_id', '=', partner_id)]" required="1"/>
<field name="bank_id" domain="[('partner_id', '=', partner_id)]"/>
<field name="ml_maturity_date"/>
<field name="date"/>
<!--<field name="value_date"/>-->
<!--<field name="amount" sum="Amount Total"/>-->
<field name="amount_currency" sum="Currency Amount Total" select="2" string="Amount"/>
<field name="amount_currency" select="2" string="Amount"/>
<field name="currency"/>
<!--<field name="to_pay_currency"/>
<field name="to_pay"/>-->
<!--domain="[('partner_id','=',partner_id),('reconcile_id', '=', False), ('credit', '>', 0),('amount_to_pay','>',0)]"/>-->
<field name="name"/>
<!--<field name="communication"/>
<field name="state"/>
<field name="date"/>-->
<!-- <field invisible="1" name="to_pay_currency"/>-->
<field name="amount" sum="Total in Company Currency" invisible="1"/>
</tree>
</field>
<field name="date_created" select="2"/>
@ -167,7 +167,6 @@
<tree string="Payment order">
<field name="reference"/>
<field name="mode"/>
<!--<field name="line_ids"/>-->
<field name="date_planned"/>
<field name="date_created" select="2"/>
<field name="date_done" select="2"/>
@ -212,9 +211,7 @@
<notebook>
<page string="Payment">
<field name="order_id" select="1"/>
<!--<field name="reference" />-->
<field name="move_line_id" on_change="onchange_move_line(move_line_id,parent.mode,currency,company_currency)" select="1"/>
<!--domain="[('reconcile_id','=', False), ('credit', '>',0),('amount_to_pay','>',0)] "/>-->
<field name="move_line_id" on_change="onchange_move_line(move_line_id,parent.mode, currency, company_currency)" select="1" domain="[('reconcile_id','=', False), ('credit', '>',0),('amount_to_pay','>',0)] "/>
<separator colspan="4" string="Transaction Information"/>
<field name="date"/>
<group colspan="2">
@ -222,7 +219,7 @@
<field name="currency" nolabel="1"/>
</group>
<field name="partner_id" on_change="onchange_partner(partner_id)" select="1"/>
<field domain="[('partner_id','=',partner_id)]" name="bank_id" required="1"/>
<field domain="[('partner_id','=',partner_id)]" name="bank_id"/>
<separator colspan="2" string="Owner Account"/>
<separator colspan="2" string="Desitination Account"/>
<field colspan="2" name="info_owner" nolabel="1"/>
@ -238,18 +235,12 @@
<separator colspan="4" string="General Information"/>
<group colspan="2">
<field name="amount" select="1"/>
<!--<field name="currency"/>-->
<field name="company_currency" nolabel="1"/>
</group>
<!--<field name="partner_payable"/>-->
<separator colspan="4" string="Entry Information"/>
<field name="create_date"/>
<field name="ml_maturity_date"/>
<field name="ml_inv_ref"/>
<!--<field name="due_date"/>-->
<!--<field name="to_pay_currency"/>
<field name="to_pay"/>-->
</page>
</notebook>
</form>
@ -261,30 +252,19 @@
<field name="type">tree</field>
<field eval="4" name="priority"/>
<field name="arch" type="xml">
<tree string="Payment Line"> <!-- editable="bottom" colors="red:to_pay_currency&lt;amount_currency" -->
<tree string="Payment Line">
<field name="order_id"/>
<field name="ml_inv_ref" />
<field name="ml_maturity_date"/>
<!--<field name="value_date"/>-->
<field name="partner_id" select="1"/>
<field name="amount" sum="Amount Total"/>
<field name="amount_currency" sum="Currency Amount Total" select="2" />
<field name="currency"/>
<field name="bank_id" domain="[('partner_id', '=', partner_id)]" required="1"/>
<!--<field name="to_pay_currency"/>
<field name="to_pay"/>-->
<field name="bank_id" domain="[('partner_id', '=', partner_id)]"/>
<field name="move_line_id" on_change="onchange_move_line(move_line_id,parent.mode)"/>
<!--domain="[('partner_id','=',partner_id),('reconcile_id', '=', False), ('credit', '>', 0),('amount_to_pay','>',0)]"/>-->
<field domain="[('partner_id', '=', partner_id)]" name="bank_id"/>
<!--<field name="partner_payable"/>-->
<field name="create_date"/>
<field name="name"/>
<!--<field name="communication"/>
<field name="state"/>
<field name="date"/>-->
<!-- <field invisible="1" name="to_pay_currency"/>-->
</tree>
</field>
</record>