[MERGE] account_voucher, product, stock: use selection widgets for magic context fields, to pass IDs in the context instead of strings
Many2one fields resolve to strings when used as `self` within the @context or @filter_domain attributes of a search field, because they must be able to support partial matches, e.g. search for "Sto" to match "Stock". In many case the code was not prepared to accept string for the magic context values, so the magic fields now caused crashes. The widget="selection" attribute was dropped during the search view cleanup for 7.0, without noticing this unfortunate side-effect, at revision: addons 7.0 revno 7142 revid:qdp-launchpad@openerp.com-20120731150358-jqd3eoz06imzlx01 lp bug: https://launchpad.net/bugs/1192484 fixed bzr revid: odo@openerp.com-20131004122257-5cx5sf3nm8qi5auc
This commit is contained in:
commit
c536c5a432
|
@ -130,7 +130,7 @@
|
|||
<separator/>
|
||||
<filter icon="terp-gtk-jump-to-ltr" string="To Review" domain="[('state','=','posted'), ('audit','=',False)]" help="To Review"/>
|
||||
<field name="partner_id" filter_domain="[('partner_id', 'child_of', self)]"/>
|
||||
<field name="journal_id" context="{'journal_id': self, 'set_visible':False}" />
|
||||
<field name="journal_id" widget="selection" context="{'journal_id': self, 'set_visible':False}" /> <!-- Keep widget=selection on this field to pass numeric `self` value, which is not the case for regular m2o widgets! -->
|
||||
<field name="period_id"/>
|
||||
<group expand="0" string="Group By...">
|
||||
<filter string="Partner" icon="terp-partner" domain="[]" context="{'group_by':'partner_id'}"/>
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<filter icon="terp-document-new" string="Draft" domain="[('state','=','draft')]" help="Draft Vouchers"/>
|
||||
<filter icon="terp-camera_test" string="Posted" domain="[('state','=','posted')]" help="Posted Vouchers"/>
|
||||
<field name="partner_id" string="Customer" filter_domain="[('partner_id','child_of',self)]"/>
|
||||
<field name="journal_id" context="{'journal_id': self, 'set_visible':False}" domain="[('type','in',('bank','cash'))]"/>
|
||||
<field name="journal_id" widget="selection" context="{'journal_id': self, 'set_visible':False}" domain="[('type','in',('bank','cash'))]"/> <!-- Keep widget=selection on this field to pass numeric `self` value, which is not the case for regular m2o widgets! -->
|
||||
<field name="period_id"/>
|
||||
<group expand="0" string="Group By...">
|
||||
<filter string="Customer" icon="terp-personal" domain="[]" context="{'group_by':'partner_id'}"/>
|
||||
|
@ -35,7 +35,7 @@
|
|||
<filter icon="terp-document-new" string="Draft" domain="[('state','=','draft')]" help="Draft Vouchers"/>
|
||||
<filter icon="terp-camera_test" string="Posted" domain="[('state','=','posted')]" help="Posted Vouchers"/>
|
||||
<field name="partner_id" string="Supplier" filter_domain="[('partner_id','child_of',self)]"/>
|
||||
<field name="journal_id" context="{'journal_id': self, 'set_visible':False}" domain="[('type','in',('bank','cash'))]"/>
|
||||
<field name="journal_id" widget="selection" context="{'journal_id': self, 'set_visible':False}" domain="[('type','in',('bank','cash'))]"/> <!-- Keep widget=selection on this field to pass numeric `self` value, which is not the case for regular m2o widgets! -->
|
||||
<field name="period_id"/>
|
||||
<group expand="0" string="Group By...">
|
||||
<filter string="Supplier" icon="terp-personal" domain="[]" context="{'group_by':'partner_id'}"/>
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<filter icon="terp-document-new" string="Draft" domain="[('state','=','draft')]" help="Draft Vouchers"/>
|
||||
<filter icon="terp-camera_test" string="Posted" domain="[('state','=','posted')]" help="Posted Vouchers"/>
|
||||
<field name="partner_id" string="Supplier" filter_domain="[('partner_id','child_of',self)]"/>
|
||||
<field name="journal_id" context="{'journal_id': self, 'set_visible':False}" domain="[('type','in',('purchase','purchase_refund'))]"/>
|
||||
<field name="journal_id" widget="selection" context="{'journal_id': self, 'set_visible':False}" domain="[('type','in',('purchase','purchase_refund'))]"/> <!-- Keep widget=selection on this field to pass numeric `self` value, which is not the case for regular m2o widgets! -->
|
||||
<field name="period_id"/>
|
||||
<group expand="0" string="Group By...">
|
||||
<filter string="Supplier" icon="terp-personal" domain="[]" context="{'group_by':'partner_id'}"/>
|
||||
|
@ -33,7 +33,7 @@
|
|||
<filter icon="terp-document-new" string="Draft" domain="[('state','=','draft')]" help="Draft Vouchers"/>
|
||||
<filter icon="terp-camera_test" string="Posted" domain="[('state','=','posted')]" help="Posted Vouchers"/>
|
||||
<field name="partner_id" string="Customer" filter_domain="[('partner_id','child_of',self)]"/>
|
||||
<field name="journal_id" context="{'journal_id': self, 'set_visible':False}" domain="[('type','in',('sale','sale_refund'))]"/>
|
||||
<field name="journal_id" widget="selection" context="{'journal_id': self, 'set_visible':False}" domain="[('type','in',('sale','sale_refund'))]"/> <!-- Keep widget=selection on this field to pass numeric `self` value, which is not the case for regular m2o widgets! -->
|
||||
<field name="period_id"/>
|
||||
<group expand="0" string="Group By...">
|
||||
<filter string="Customer" icon="terp-personal" domain="[]" context="{'group_by':'partner_id'}"/>
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<filter string="Can be Sold" name="filter_to_sell" icon="terp-accessories-archiver-minus" domain="[('sale_ok','=',1)]"/>
|
||||
<field name="categ_id"/>
|
||||
<group expand="0" string="Context...">
|
||||
<field name="pricelist_id" context="{'pricelist': self}" filter_domain="[]" groups="product.group_sale_pricelist"/>
|
||||
<field name="pricelist_id" widget="selection" context="{'pricelist': self}" filter_domain="[]" groups="product.group_sale_pricelist"/> <!-- Keep widget=selection on this field to pass numeric `self` value, which is not the case for regular m2o widgets! -->
|
||||
<field name="company_id" groups="base.group_multi_company"/>
|
||||
</group>
|
||||
<group expand='0' string='Group by...'>
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
<field name="inherit_id" ref="product.product_search_form_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="pricelist_id" position="before">
|
||||
<field name="location_id" context="{'location': self}"/>
|
||||
<field name="warehouse_id" context="{'warehouse': self}"/>
|
||||
<field name="location_id" widget="selection" context="{'location': self}"/>
|
||||
<field name="warehouse_id" widget="selection" context="{'warehouse': self}"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
|
|
@ -75,6 +75,8 @@ class stock_location(osv.osv):
|
|||
_parent_order = 'posz,name'
|
||||
_order = 'parent_left'
|
||||
|
||||
# TODO: implement name_search() in a way that matches the results of name_get!
|
||||
|
||||
def name_get(self, cr, uid, ids, context=None):
|
||||
# always return the full hierarchical name
|
||||
res = self._complete_name(cr, uid, ids, 'complete_name', None, context=context)
|
||||
|
|
Loading…
Reference in New Issue