I am working with the two objects product.template and product.product. I am writing a script to (in realtime) create new product.product entries for a certain product.template, much like product_variant_multi can do. However, I need some fields that are defined in product.template to actually be defined in product.product, specifically supply_method in this case.
In addition, I need different suppliers per product.product as well, which is currently implemented on product.template as 'seller_ids': fields.one2many('product.supplierinfo', 'product_id', 'Supplier'),, with product.supplierinfo referencing product.template: 'product_id' : fields.many2one('product.template', 'Product', required=True, ondelete='cascade', select=True),.
So my questions seem to revolve around field inheritance and database design:
Can I
_inheritproduct.productand more or less copy thesupply_methoddefinition to it, and trust that the new database column will be used in preference to the one inproduct.templatethroughout the system?Can I
_inheritproduct.supplierinfoand overwrite the fieldproduct_idto point toproduct.productinstead ofproduct.template, and then_inheritproduct.productagain to correct theseller_idsdefinition?
Thanks for the advice.
I'm interested in a solution for the second issue as well; it seems a bit odd to me that supplier-specific information is managed in the product templates, and not in the products themselves. I fiddled around with the database, but no joy. product.template keeps on appearing in the error messages, and I don't know where it comes from. Things seem to work if you don't use variants, so that (in most cases) the product_id and template_id are equal. But if you use templates, it is a different story. Did you find something to sort this out?