diff options
| author | Fabien Pinckaers <fp@tinyerp.com> | 2012-09-27 19:03:23 +0200 |
|---|---|---|
| committer | Fabien Pinckaers <fp@tinyerp.com> | 2012-09-27 19:03:23 +0200 |
| commit | 2e3c76f4ffde2cf742952ac2f9a88d1acbf8a6b2 (patch) | |
| tree | cd8cca8836a7b68f37d37eab016e7c9241f50e6e /addons | |
| parent | 6970a3fec3217b4948a6f105414f6d9a10708bcd (diff) | |
| parent | 6cf318cb39c43798810869631a550a2f97dd8bcc (diff) | |
[FIX] Invoice Payment
bzr revid: fp@tinyerp.com-20120927170323-b0qpufpc94dcb58h
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/account_voucher/account_voucher.py | 9 | ||||
| -rw-r--r-- | addons/account_voucher/invoice.py | 11 | ||||
| -rw-r--r-- | addons/account_voucher/voucher_payment_receipt_view.xml | 107 |
3 files changed, 120 insertions, 7 deletions
diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py index c74ca5f833a..36aa8660bc4 100644 --- a/addons/account_voucher/account_voucher.py +++ b/addons/account_voucher/account_voucher.py @@ -782,9 +782,16 @@ class account_voucher(osv.osv): vals[key].update(res[key]) return vals + def button_proforma_voucher(self, cr, uid, ids, context=None): + context = context or {} + wf_service = netsvc.LocalService("workflow") + for vid in ids: + wf_service.trg_validate(uid, 'account.voucher', vid, 'proforma_voucher', cr) + return {'type': 'ir.actions.act_window_close'} + def proforma_voucher(self, cr, uid, ids, context=None): self.action_move_line_create(cr, uid, ids, context=context) - return {'type': 'ir.actions.act_window_close'} + return True def action_cancel_draft(self, cr, uid, ids, context=None): wf_service = netsvc.LocalService("workflow") diff --git a/addons/account_voucher/invoice.py b/addons/account_voucher/invoice.py index 14b725cbeca..91ba438756e 100644 --- a/addons/account_voucher/invoice.py +++ b/addons/account_voucher/invoice.py @@ -27,11 +27,12 @@ class invoice(osv.osv): def invoice_pay_customer(self, cr, uid, ids, context=None): if not ids: return [] + mod,modid = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'account_voucher', 'view_vendor_receipt_dialog_form') inv = self.browse(cr, uid, ids[0], context=context) return { 'name':_("Pay Invoice"), 'view_mode': 'form', - 'view_id': False, + 'view_id': modid, 'view_type': 'form', 'res_model': 'account.voucher', 'type': 'ir.actions.act_window', @@ -41,13 +42,13 @@ class invoice(osv.osv): 'context': { 'default_partner_id': inv.partner_id.id, 'default_amount': inv.type in ('out_refund', 'in_refund') and -inv.residual or inv.residual, - 'default_name':inv.name, + 'default_number':inv.name, 'close_after_process': True, - 'invoice_type':inv.type, - 'invoice_id':inv.id, + 'invoice_type': inv.type, + 'invoice_id': inv.id, 'default_type': inv.type in ('out_invoice','out_refund') and 'receipt' or 'payment', 'type': inv.type in ('out_invoice','out_refund') and 'receipt' or 'payment' - } + } } invoice() diff --git a/addons/account_voucher/voucher_payment_receipt_view.xml b/addons/account_voucher/voucher_payment_receipt_view.xml index 65bcdad8a9b..c4fe05060d0 100644 --- a/addons/account_voucher/voucher_payment_receipt_view.xml +++ b/addons/account_voucher/voucher_payment_receipt_view.xml @@ -284,6 +284,111 @@ <menuitem action="action_vendor_payment" icon="STOCK_JUSTIFY_FILL" sequence="12" id="menu_action_vendor_payment" parent="account.menu_finance_payables"/> + <record model="ir.ui.view" id="view_vendor_receipt_dialog_form"> + <field name="name">account.voucher.receipt.dialog.form</field> + <field name="model">account.voucher</field> + <field name="priority">30</field> + <field name="arch" type="xml"> + <form string="Payment" version="7.0"> + <group> + <group> + <field name="state" invisible="1"/> + <field name="partner_id" required="1" on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type, date, context)" string="Customer" context="{'search_default_customer': 1}"/> + <label for="amount" string="Paid Amount"/> + <div> + <field name="amount" class="oe_inline" + 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="currency_id" class="oe_inline"/> + </div> + <field name="journal_id" + domain="[('type','in',['bank', 'cash'])]" + invisible="context.get('line_type', False)" + widget="selection" + on_change="onchange_journal(journal_id, line_cr_ids, False, partner_id, date, amount, type, company_id, context)" + string="Payment Method"/> + </group> + <group> + <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="e.g. 003/10"/> + <field name="name" colspan="2" invisible="context.get('line_type', False)" placeholder="e.g. Invoice SAJ/0042"/> + <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"/> + </group> + </group> + <notebook invisible="1"> + <page string="Payment Information" groups="base.group_user"> + <label for="line_cr_ids"/> + <field name="line_cr_ids" context="{'journal_id':journal_id, 'type':type, 'partner_id':partner_id}" on_change="onchange_line_ids(line_dr_ids, line_cr_ids, amount, currency_id, type, context)"> + <tree string="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','in',('receivable','payable')), ('reconcile_id','=', False), ('partner_id','=',parent.partner_id)]" + required="1" + groups="account.group_account_user"/> + <field name="account_id" groups="base.group_no_one" domain="[('type','=','receivable')]"/> + <field name="date_original" readonly="1"/> + <field name="date_due" readonly="1"/> + <field name="amount_original" readonly="1"/> + <field name="amount_unreconciled" readonly="1" groups="account.group_account_user"/> + <field name="reconcile" on_change="onchange_reconcile(reconcile, amount, amount_unreconciled, context)" groups="account.group_account_user"/> + <field name="amount" sum="Total Allocation" on_change="onchange_amount(amount, amount_unreconciled, context)" string="Allocation"/> + </tree> + </field> + <label for="line_dr_ids" attrs="{'invisible': [('pre_line','=',False)]}"/> + <field name="line_dr_ids" attrs="{'invisible': [('pre_line','=',False)]}" context="{'journal_id':journal_id, 'partner_id':partner_id}" on_change="onchange_line_ids(line_dr_ids, line_cr_ids, amount, currency_id, type, context)"> + <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','in',('receivable','payable')), ('reconcile_id','=', False), ('partner_id','=',parent.partner_id)]" + required="1"/> + <field name="account_id" groups="base.group_no_one" domain="[('type','=','receivable')]"/> + <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)" string="Allocation"/> + </tree> + </field> + <group col="3"> + <group> + <field name="narration" colspan="2" nolabel="1"/> + </group> + <group col="4" attrs="{'invisible':[('currency_id','=',False),('is_multi_currency','=',False)]}"> + <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)" groups="base.group_multi_currency"/> + <field name="paid_amount_in_company_currency" colspan="4" invisible="1"/> + </group> + <group> + <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> + </page> + </notebook> + <footer> + <button name="button_proforma_voucher" string="Pay" class="oe_highlight" type="object"/> or + <button string="Cancel" class="oe_link" special="cancel"/> + </footer> + </form> + </field> + </record> + + <record model="ir.ui.view" id="view_vendor_receipt_form"> <field name="name">account.voucher.receipt.form</field> <field name="model">account.voucher</field> @@ -297,7 +402,7 @@ <field name="state" widget="statusbar" statusbar_visible="draft,posted" statusbar_colors='{"proforma":"blue"}'/> </header> <sheet> - <h1><field name="number"/></h1> + <h1 attrs="{'invisible': [('number','=',False)]}"><field name="number"/></h1> <group> <group> <field name="partner_id" domain="[('customer','=',True)]" required="1" invisible="context.get('line_type', False)" on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type, date, context)" string="Customer" context="{'search_default_customer': 1}"/> |
