Contributors mailing list archives
contributors@odoo-community.org
Browse archives
Vendor Pricelist records for Product Variants - what am I missing?
byHello,
as New Year came it fell upon me to update lots of pricelists. As we use Product Variants (product.product) quite a bit I am invalidating (i.e. setting date_end) on existing Supplier Pricelist (product.supplierinfo) records and creating new ones. Using base_import_match to match the correct product variant by internal reference (default_code) and trying to import related product.supplierinfo record. Originally I wanted to create small helper that would invalidate all existing records (no end date, same variant, same template, same supplier, same company) when creating new one. Just to save time updating existing records and creating new ones. However it never works (more on that below).
Now there are 2 fields defined for product.template and none for product.product that would serve what I am wanting to do. Here's what's defined for product.template (in 13.0, 14.0 and 15.0 as well):
seller_ids = fields.One2many('product.supplierinfo', 'product_tmpl_id', 'Vendors', depends_context=('company',), help="Define vendor pricelists.")
variant_seller_ids = fields.One2many('product.supplierinfo', 'product_tmpl_id')
In Purchase there is this for product.template view:
<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','>',1)]}"/>
<field name="variant_seller_ids" context="{'default_product_tmpl_id': context.get('product_tmpl_id', active_id)}" nolabel="1" attrs="{'invisible': [('product_variant_count','<=',1)]}"/>
Just for clarity, here's part from product.supplierinfo:
product_id = fields.Many2one('product.product', 'Product Variant', check_company=True, help="If not set, the vendor price will apply to all variants of this product.")
product_tmpl_id = fields.Many2one('product.template', 'Product Template', check_company=True, index=True, ondelete='cascade')
Am I missing something here or are these the same besides the context and some witchcraft in views? While trying to import the product.product records when creating product.supplierinfo records there's always product_tmpl_id but never product_id. Shouldn't the definition of variant_s be like this and defined in product.product model:
variant_seller_ids = fields.One2many('product.supplierinfo', 'product_id')
What is the purpose of current design? Would anyone be willing to shed some light here? Hope such post fits in the mailing list.
Thank you very much.Best regards
Radovan Skolnik
Follow-Ups
-
Re: Vendor Pricelist records for Product Variants - what am I missing?
byData Dance s.r.o., Radovan Skolnik -
Re: Vendor Pricelist records for Product Variants - what am I missing?
byMoaHub, Graeme Gellatly -
Re: Vendor Pricelist records for Product Variants - what am I missing?
byData Dance s.r.o., Radovan Skolnik