[FIX] account_voucher: in fields_view_get overwrite, also add the 'default_supplier...
authorMartin Trigaux <mat@openerp.com>
Fri, 10 Jan 2014 13:48:45 +0000 (14:48 +0100)
committerMartin Trigaux <mat@openerp.com>
Fri, 10 Jan 2014 13:48:45 +0000 (14:48 +0100)
With this the 'create and edit' menu will initiate the partner as a supplier.

bzr revid: mat@openerp.com-20140110134845-hvbob1mii4ofqjay

addons/account_voucher/account_voucher.py

index 7e7cd9d..f6ce6e0 100644 (file)
@@ -226,7 +226,7 @@ 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('context', "{'search_default_supplier': 1}")
+                node.set('context', "{'default_customer': 0, 'search_default_supplier': 1, 'default_supplier': 1}")
                 if context.get('invoice_type','') in ('in_invoice', 'in_refund'):
                     node.set('string', _("Supplier"))
         res['arch'] = etree.tostring(doc)