From 118316430aa03118bd9b33ec8b2b22d293014987 Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Fri, 21 Dec 2012 10:58:44 +0100 Subject: [PATCH] [FIX] account_voucher; when making a payment directly from an invoice, copy the invoice description as payment reference (instead of number, which should never be filled except by the voucher validation) + open a correct view with improved usability on partner_id field bzr revid: qdp-launchpad@openerp.com-20121221095844-5029t8z6twv67dsc --- addons/account_voucher/account_voucher.py | 4 +++- addons/account_voucher/invoice.py | 7 ++++--- addons/account_voucher/voucher_payment_receipt_view.xml | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py index 82b18f4..4d51085 100644 --- a/addons/account_voucher/account_voucher.py +++ b/addons/account_voucher/account_voucher.py @@ -193,7 +193,9 @@ class account_voucher(osv.osv): if context.get('type', 'sale') in ('purchase', 'payment'): nodes = doc.xpath("//field[@name='partner_id']") for node in nodes: - node.set('domain', "[('supplier', '=', True)]") + node.set('context', "{'search_default_supplier': 1}") + if context.get('invoice_type','') in ('in_invoice', 'in_refund'): + node.set('string', _("Supplier")) res['arch'] = etree.tostring(doc) return res diff --git a/addons/account_voucher/invoice.py b/addons/account_voucher/invoice.py index 13c4b9a..bd43694 100644 --- a/addons/account_voucher/invoice.py +++ b/addons/account_voucher/invoice.py @@ -27,12 +27,13 @@ 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') + dummy, view_id = 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': modid, + 'view_id': view_id, 'view_type': 'form', 'res_model': 'account.voucher', 'type': 'ir.actions.act_window', @@ -42,7 +43,7 @@ class invoice(osv.osv): 'context': { 'default_partner_id': self._find_partner(inv).id, 'default_amount': inv.type in ('out_refund', 'in_refund') and -inv.residual or inv.residual, - 'default_number':inv.name, + 'default_reference': inv.name, 'close_after_process': True, 'invoice_type': inv.type, 'invoice_id': inv.id, diff --git a/addons/account_voucher/voucher_payment_receipt_view.xml b/addons/account_voucher/voucher_payment_receipt_view.xml index b6f3676..e4da7b6 100644 --- a/addons/account_voucher/voucher_payment_receipt_view.xml +++ b/addons/account_voucher/voucher_payment_receipt_view.xml @@ -292,7 +292,7 @@ - +