This question has been flagged
2 Replies
1556 Views

The purchase page tab on product pages now adds items inline.  Does anyone know how to open the form in a new window (pop up modal)?  This was the default in V13.  The advantages are more space to work from and most importantly, the product variants are limited to the product that is being edited. (i.e. you don't have to search through all product variants)

Avatar
Discard
Best Answer

You need to remove the referenced tree view for the field.


Create your own View that inherits and overrides the base View:



<field name="seller_ids" position="replace">
<field name="seller_ids"
context="{'default_product_tmpl_id':context.get('product_tmpl_id',active_id), 'product_template_invisible_variant': True,}"
nolabel="1" attrs="{'invisible': [('product_variant_count','&gt;',1)]}"/>
</field>


The original View defines seller_ids with a context key of 'tree_view_ref':'purchase.product_supplierinfo_tree_view2'  so here we are removing this and keeping all other attributes of the field.

The popup Form View limits the selection of Variants to match those from the Product Template you are editing Vendor information for.

Avatar
Discard
Author Best Answer

Thanks Ray!  This seems like a mistake by Odoo as it was working well in V13.  

UPDATE:

I tried this and it works well for products with only one variant. Once a product has multiple variants it reverts back to inline editing. I played with the attributes - changing the gt to lt - but it didn't work.

Any idea why?  Thanks for your help with this. 

UPDATE2

I have replaced the variant_seller_ids field as well, and now the form opens in a new window for products with variants.  But the variants are not passed in the context, so the variant field in the form is empty.  Here is what I have so far:

<field name="seller_ids" 
        context="{'default_product_tmpl_id':context.get('product_tmpl_id',active_id), 'product_template_invisible_variant': True,}" 
        nolabel="1" attrs="{'invisible': [('product_variant_count','&gt;',1)]}"/>
 <field name="variant_seller_ids" position="replace">
  <field name="variant_seller_ids" 
        context="{'default_product_tmpl_id':context.get('product_tmpl_id',active_id), 'product_template_invisible_variant': True,}" 
        nolabel="1" attrs="{'invisible': [('product_variant_count','&lt;',1)]}"/>
</field> 
Avatar
Discard