[IMP] improve the supplier payment and write check view.
bzr revid: nco@tinyerp.com-20120625133705-z4v609vb7wkr46ta
This commit is contained in:
parent
0a22debf5f
commit
37dc334f0c
|
@ -2,14 +2,12 @@
|
|||
<openerp>
|
||||
<data>
|
||||
|
||||
<!-- Supplier voucher view -->
|
||||
|
||||
<record model="ir.ui.view" id="view_vendor_payment_check_form">
|
||||
<field name="name">account.voucher.payment.check.form</field>
|
||||
<field name="model">account.voucher</field>
|
||||
<field name="type">form</field>
|
||||
<field name="inherit_id" ref="account_voucher.view_vendor_payment_form" />
|
||||
|
||||
<!-- <field name="inherit_id" ref="account_voucher.view_vendor_payment_form" />
|
||||
<field name="arch" type="xml">
|
||||
<h1 position="replace">
|
||||
<field name="partner_id" required="1" invisible="context.get('line_type', False)" on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type, date, context)" context="{'invoice_currency':currency_id, 'default_customer': 0, 'search_default_supplier': 1, 'default_supplier': 1}" string="Supplier"/>
|
||||
</h1>
|
||||
<field name="journal_id" position="after">
|
||||
<newline/>
|
||||
<field name="allow_check" invisible="1"/>
|
||||
|
@ -22,7 +20,141 @@
|
|||
<button name="proforma_voucher" position="after">
|
||||
<button name="print_check" icon="gtk-print" string="Print Check" type="object" attrs="{'invisible':['|',('allow_check','!=',1),('state','!=','posted') ]}"/>
|
||||
</button>
|
||||
</field> -->
|
||||
|
||||
|
||||
<!-- Supplier voucher view -->
|
||||
|
||||
<record model="ir.ui.view" id="view_vendor_payment_check_form">
|
||||
<field name="name">account.voucher.payment.check.form</field>
|
||||
<field name="model">account.voucher</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form version="7.0">
|
||||
<header>
|
||||
<button name="proforma_voucher" string="Validate" states="draft" invisible="context.get('line_type', False)"/>
|
||||
<button name="print_check" icon="gtk-print" string="Print Check" type="object" attrs="{'invisible':['|',('allow_check','!=',1),('state','!=','posted') ]}"/>
|
||||
<button name="cancel_voucher" string="Cancel" states="draft,proforma" invisible="context.get('line_type', False)"/>
|
||||
<button name="cancel_voucher" string="Unreconcile" type="object" states="posted" invisible="context.get('line_type', False)" confirm="Are you sure to unreconcile and cancel this record ?"/>
|
||||
<button name="action_cancel_draft" type="object" states="cancel" string="Set to Draft" invisible="context.get('line_type', False)"/>
|
||||
<field name="state" widget="statusbar" statusbar_visible="draft,posted" statusbar_colors='{"proforma":"blue"}'/>
|
||||
</header>
|
||||
<sheet string="Bill Payment">
|
||||
<group col="4">
|
||||
<field name="partner_id" required="1" invisible="context.get('line_type', False)" on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type, date, context)" context="{'invoice_currency':currency_id, 'default_customer': 0, 'search_default_supplier': 1, 'default_supplier': 1}" string="Supplier"/>
|
||||
<field name="journal_id"
|
||||
domain="[('type','in',['bank', 'cash'])]"
|
||||
invisible="context.get('line_type', False)"
|
||||
widget="selection"
|
||||
on_change="onchange_journal(journal_id, line_dr_ids, False, partner_id, date, amount, type, company_id, context)"
|
||||
string="Payment Method"/>
|
||||
<field name="amount" invisible="context.get('line_type', False)" on_change="onchange_amount(amount, payment_rate, partner_id, journal_id, currency_id, type, date, payment_rate_currency_id, company_id, context)"/>
|
||||
<field name="amount_in_word" attrs="{'invisible':[('allow_check','!=',1)]}" nolabel="1" colspan="6"/>
|
||||
<field name="date" invisible="context.get('line_type', False)" on_change="onchange_date(date, currency_id, payment_rate_currency_id, amount, company_id, context)"/>
|
||||
<field name="reference" invisible="context.get('line_type', False)" string="Payment Ref" placeholder="003/10"/>
|
||||
<field name="name" colspan="2" invisible="context.get('line_type', False)" placeholder="Invoice SAJ/0042"/>
|
||||
<field name="allow_check" invisible="1"/>
|
||||
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
|
||||
<field name="account_id"
|
||||
widget="selection"
|
||||
invisible="True"/>
|
||||
<field name="pre_line" invisible="1"/>
|
||||
<field name="type" invisible="True"/>
|
||||
<field name="currency_id" invisible="1" colspan="4"/>
|
||||
</group>
|
||||
<notebook>
|
||||
<page string="Payment Information">
|
||||
<field name="line_dr_ids" context="{'journal_id':journal_id, 'type':type, 'partner_id':partner_id}">
|
||||
<tree string="Supplier Invoices and Outstanding transactions" editable="bottom" colors="gray:amount==0">
|
||||
<field name="move_line_id" context="{'journal_id':parent.journal_id, 'partner_id':parent.partner_id}"
|
||||
on_change="onchange_move_line_id(move_line_id)"
|
||||
domain="[('account_id.type','=','payable'), ('reconcile_id','=', False), ('partner_id','=',parent.partner_id)]"
|
||||
required="1"
|
||||
/>
|
||||
<field name="account_id" groups="base.group_no_one" domain="[('type','=','payable')]"/>
|
||||
<field name="date_original" readonly="1"/>
|
||||
<field name="date_due" readonly="1"/>
|
||||
<field name="amount_original" readonly="1"/>
|
||||
<field name="amount_unreconciled" readonly="1"/>
|
||||
<field name="reconcile" on_change="onchange_reconcile(reconcile, amount, amount_unreconciled, context)"/>
|
||||
<field name="amount" sum="Total Allocation" on_change="onchange_amount(amount, amount_unreconciled, context)"/>
|
||||
</tree>
|
||||
</field>
|
||||
<field name="line_cr_ids" attrs="{'invisible': [('pre_line','=',False)]}" context="{'journal_id':journal_id, 'partner_id':partner_id}">
|
||||
<tree string="Credits" editable="bottom" colors="gray:amount==0">
|
||||
<field name="move_line_id" context="{'journal_id':parent.journal_id, 'partner_id':parent.partner_id}"
|
||||
on_change="onchange_move_line_id(move_line_id)"
|
||||
domain="[('account_id.type','=','payable'), ('reconcile_id','=', False), ('partner_id','=',parent.partner_id)]"
|
||||
required="1"
|
||||
/>
|
||||
<field name="account_id" groups="base.group_no_one" domain="[('type','=','payable')]"/>
|
||||
<field name="date_original" readonly="1"/>
|
||||
<field name="date_due" readonly="1"/>
|
||||
<field name="amount_original" readonly="1"/>
|
||||
<field name="amount_unreconciled" readonly="1"/>
|
||||
<field name="reconcile" on_change="onchange_reconcile(reconcile, amount, amount_unreconciled, context)"/>
|
||||
<field name="amount" sum="Total Allocation" on_change="onchange_amount(amount, amount_unreconciled, context)"/>
|
||||
</tree>
|
||||
</field>
|
||||
<group class="oe_subtotal_footer">
|
||||
<field name="amount_total" class="oe_subtotal_footer_separator"/>
|
||||
</group>
|
||||
<group>
|
||||
<group string="Internal Notes">
|
||||
<field name="narration" colspan="2" nolabel="1"/>
|
||||
</group>
|
||||
<group>
|
||||
<group col="4" attrs="{'invisible':[('currency_id','=',False),('is_multi_currency','=',False)]}">
|
||||
<separator string="Currency Options" colspan="4"/>
|
||||
<field name="is_multi_currency" invisible="1"/>
|
||||
<field name="payment_rate" required="1" on_change="onchange_rate(payment_rate, amount, currency_id, payment_rate_currency_id, company_id, context)" colspan="3"/>
|
||||
<field name="payment_rate_currency_id" colspan="1" nolabel="1" on_change="onchange_payment_rate_currency(currency_id, payment_rate, payment_rate_currency_id, date, amount, company_id, context)"/>
|
||||
<field name="paid_amount_in_company_currency" colspan="4" invisible="1"/>
|
||||
</group>
|
||||
<group col="2">
|
||||
<separator string="Payment Options" colspan="2"/>
|
||||
<field name="writeoff_amount"/>
|
||||
<field name="payment_option" required="1"/>
|
||||
<field name="writeoff_acc_id"
|
||||
attrs="{'invisible':[('payment_option','!=','with_writeoff')], 'required':[('payment_option','=','with_writeoff')]}"
|
||||
domain="[('type','=','other')]"/>
|
||||
<field name="comment"
|
||||
attrs="{'invisible':[('payment_option','!=','with_writeoff')]}"/>
|
||||
<field name="analytic_id"
|
||||
groups="analytic.group_analytic_accounting"/>
|
||||
</group>
|
||||
</group>
|
||||
</group>
|
||||
</page>
|
||||
<page string="Journal Items" attrs="{'invisible': [('state','!=','posted')]}">
|
||||
<group col="4">
|
||||
<field name="period_id"/>
|
||||
<field name="audit"/>
|
||||
<field name="number" attrs="{'readonly':[('allow_check','!=',1)]}" />
|
||||
</group>
|
||||
<field name="move_ids" readonly="1">
|
||||
<tree string="Journal Items">
|
||||
<field name="move_id"/>
|
||||
<field name="ref"/>
|
||||
<field name="date"/>
|
||||
<field name="statement_id"/>
|
||||
<field name="partner_id"/>
|
||||
<field name="account_id"/>
|
||||
<field name="name"/>
|
||||
<field name="debit"/>
|
||||
<field name="credit"/>
|
||||
<field name="state"/>
|
||||
<field name="reconcile_id"/>
|
||||
<field name="amount_currency"/>
|
||||
<field name="currency_id"/>
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
</notebook>
|
||||
</sheet>
|
||||
</form>
|
||||
</field>
|
||||
|
||||
</record>
|
||||
|
||||
<record id="action_write_check" model="ir.actions.act_window">
|
||||
|
|
|
@ -247,7 +247,18 @@ class account_voucher(osv.osv):
|
|||
rate = voucher_rate * company_currency_rate
|
||||
res[voucher.id] = voucher.amount / rate
|
||||
return res
|
||||
|
||||
def _amount_all(self, cr, uid, ids, name, args, context=None):
|
||||
print ids, "\n name ",name, "\n args ::> ", args, "\n context ::> ",context
|
||||
res = {}
|
||||
amount = 0.0
|
||||
for voucher in self.browse(cr, uid, ids, context=context):
|
||||
print "voucher :> ",voucher
|
||||
for line in voucher.line_dr_ids:
|
||||
print "line :> ",line
|
||||
amount += line.amount
|
||||
print "amount ::>> ",amount
|
||||
res[voucher.id] = amount
|
||||
return res
|
||||
_name = 'account.voucher'
|
||||
_description = 'Accounting Voucher'
|
||||
_order = "date desc, id desc"
|
||||
|
@ -312,6 +323,7 @@ class account_voucher(osv.osv):
|
|||
help='The specific rate that will be used, in this voucher, between the selected currency (in \'Payment Rate Currency\' field) and the voucher currency.'),
|
||||
'paid_amount_in_company_currency': fields.function(_paid_amount_in_company_currency, string='Paid Amount in Company Currency', type='float', readonly=True),
|
||||
'is_multi_currency': fields.boolean('Multi Currency Voucher', help='Fields with internal purpose only that depicts if the voucher is a multi currency one or not'),
|
||||
'amount_total': fields.function(_amount_all, digits_compute=dp.get_precision('Account'), string='Invoice Total'),
|
||||
}
|
||||
_defaults = {
|
||||
'period_id': _get_period,
|
||||
|
|
|
@ -150,8 +150,10 @@
|
|||
<field name="state" widget="statusbar" statusbar_visible="draft,posted" statusbar_colors='{"proforma":"blue"}'/>
|
||||
</header>
|
||||
<sheet string="Bill Payment">
|
||||
<group col="6">
|
||||
<field name="partner_id" required="1" invisible="context.get('line_type', False)" on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type, date, context)" context="{'invoice_currency':currency_id, 'default_customer': 0, 'search_default_supplier': 1, 'default_supplier': 1}" string="Supplier"/>
|
||||
<h1>
|
||||
<field name="partner_id" required="1" invisible="context.get('line_type', False)" on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type, date, context)" context="{'invoice_currency':currency_id, 'default_customer': 0, 'search_default_supplier': 1, 'default_supplier': 1}" string="Supplier"/>
|
||||
</h1>
|
||||
<group col="4">
|
||||
<field name="amount" invisible="context.get('line_type', False)" on_change="onchange_amount(amount, payment_rate, partner_id, journal_id, currency_id, type, date, payment_rate_currency_id, company_id, context)"/>
|
||||
<field name="journal_id"
|
||||
domain="[('type','in',['bank', 'cash'])]"
|
||||
|
@ -204,6 +206,9 @@
|
|||
<field name="amount" sum="Total Allocation" on_change="onchange_amount(amount, amount_unreconciled, context)"/>
|
||||
</tree>
|
||||
</field>
|
||||
<group class="oe_subtotal_footer">
|
||||
<field name="amount_total" class="oe_subtotal_footer_separator"/>
|
||||
</group>
|
||||
<group>
|
||||
<group string="Internal Notes">
|
||||
<field name="narration" colspan="2" nolabel="1"/>
|
||||
|
@ -228,7 +233,9 @@
|
|||
<field name="analytic_id"
|
||||
groups="analytic.group_analytic_accounting"/>
|
||||
</group>
|
||||
|
||||
</group>
|
||||
|
||||
</group>
|
||||
</page>
|
||||
<page string="Journal Items" attrs="{'invisible': [('state','!=','posted')]}">
|
||||
|
|
Loading…
Reference in New Issue