If you go to the details page for a product and click on the "Procurements" tab, you'll see a list labeled "Suppliers". Looking at the XML for the page, the only field I can see in this location is "seller_ids". However, the list also shows "Delivery Lead Time" and "Minimal Quantity". Are these fields somehow contained within "seller_ids", like an array? I can't find any other views that add the other fields. I would like to add "Product Name" and "Product Code" to the list. I believe all of the fields are in the "product.supplierinfo" model. How do I go about this?
If you check out addons/product/product.py, you'll see that 'seller_ids' is a one2many field pointing to 'product.supplierinfo' from 'product_id'. If you search for product.supplierinfo in addons/product/product_view.xml there are two records that reference it, "product_supplierinfo_form_view" and "product_supplierinfo_tree_view". The first of these is the the one that pops up when you click "Add an item" under suppliers, the second is the table that you are trying to edit. It looks like this:
<record id="product_supplierinfo_tree_view" model="ir.ui.view">
<field name="arch" type="xml">
<tree string="Supplier Information">
<field name="sequence" widget="handle"/>
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
So what you'd have to do here is create a new module, inherit the "product_supplierinfo_tree_view" by using <field name="inherit_id" ref="product.product_supplierinfo_tree_view">, then add your fields using something like:
<record id="product_supplierinfo_tree_view_inherit" model="ir.ui.view">
<field name="inherit_id" ref="product.product_supplierinfo_tree_view">
<field name="name" position="after">
Since those columns are already in the 'product.supplierinfo' you don't even need to add any custom python code to your module.
Hope that helps! Cheers.
Information Officer LLC
Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!
About This Community
|Asked: 9/9/14, 1:37 PM|
|Seen: 941 times|
|Last updated: 3/16/15, 8:10 AM|