Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Supplier Info and Supply Method per product.product, not per product.template? Field inheritance?

By
CB
on 4/9/13, 6:14 PM 1,338 views

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:

  1. Can I _inherit product.product and more or less copy the supply_method definition to it, and trust that the new database column will be used in preference to the one in product.template throughout the system?

  2. Can I _inherit product.supplierinfo and overwrite the field product_id to point to product.product instead of product.template, and then _inherit product.product again to correct the seller_ids definition?

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?

Bart Criel
on 2/26/14, 10:53 AM

Your Answer

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

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

2 follower(s)

Stats

Asked: 4/9/13, 6:14 PM
Seen: 1338 times
Last updated: 3/16/15, 8:10 AM