[FIX] account.invoice: only allow selecting partners that are `commercial entities`
authorOlivier Dony <odo@openerp.com>
Mon, 8 Apr 2013 00:01:24 +0000 (02:01 +0200)
committerOlivier Dony <odo@openerp.com>
Mon, 8 Apr 2013 00:01:24 +0000 (02:01 +0200)
Following-up to the discussion on bug 1160365, this will help users
make the right choice when manualling creating invoices.

lp bug: https://launchpad.net/bugs/1160365 fixed

bzr revid: odo@openerp.com-20130408000124-wcmjco9561hc9fbl

addons/account/account_invoice_view.xml

index 1fbdbf2..59c78c9 100644 (file)
                             <field string="Supplier" name="partner_id"
                               on_change="onchange_partner_id(type,partner_id,date_invoice,payment_term, partner_bank_id,company_id)"
                               context="{'default_customer': 0, 'search_default_supplier': 1, 'default_supplier': 1}"
-                              domain="[('supplier', '=', True)]"/>
+                              domain="[('supplier', '=', True),'|',('parent_id','=',False),('is_company','=',True)]"/>
                             <field name="fiscal_position" widget="selection"/>
                             <field name="origin"/>
                             <field name="supplier_invoice_number"/>
                             <field string="Customer" name="partner_id"
                                 on_change="onchange_partner_id(type,partner_id,date_invoice,payment_term, partner_bank_id,company_id)"
                                 groups="base.group_user" context="{'search_default_customer':1, 'show_address': 1}"
-                                options='{"always_reload": True}'/>
+                                options='{"always_reload": True}'
+                                domain="[('customer', '=', True),'|',('parent_id','=',False),('is_company','=',True)]"/>
                             <field name="fiscal_position" widget="selection" />
                         </group>
                         <group>