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

How to get value from supplier-pricelist into product(template) for further calculations?

By
R.Wouters
on 2/11/16, 5:34 AM 379 views

I've made a custom field in product.template to select a product quality, based on a Many2one relationship with qualities.

Product:

qualities_id = field.Many2one(comodel_name="qualities", string="quality")

In the class: qualities there is a One2Many relationship with the class: quality.supplier.

Qualities:

reseller_ids = fields.One2many('supplierinfo', 'product_qual_id', 'Supplier')

Here we can select a quality type e.g. ( id=16 type=B321 ). This quality type (16) can have more then one supplier. So in supplierinfo we have the field product_qual_id (id = 16) that holds multi suppliers (id = 24, 25, 26)

Supplierinfo:

product_qual_id = fields.Many2one('qualities', 'Quality Template')

Supplierinfo holds suppliers and each supplier holds more then one quantity and price. There is a relationship between supplierinfo and supplier prices using the field suppinfo_id.

pricelist_ids = fields.One2many('supplierprice', 'suppinfo_id', 'Supplier Price')

Because of this relationship, supplierprice: suppinfo, holds more then one quantity and corresponding price based on supplierinfo_id. Field that holds these records:

Supplierprice:

suppinfo_id = fields.Many2one('supplierinfo', 'Supplier information')


Qualities = ( id=16 type=B321 ). This quality type (16) can have more then one supplier. So in supplierinfo we have the field product_qual_id (id = 16) that holds multi suppliers (id = 24, 25, 26) where Record id: 24 in relation to supplierprice has multi qty and prices:

  1. supplierprice id=30 supplierinfo id=24 qty=200, price=285
  2. supplierprice id=31 supplierinfo id=24 qty=300, price=265
  3. supplierprice id=32 supplierinfo id=24 qty=500, price=248

With additional automation, I need the price from supplierprice, based on (less or more) quantity in the main product. (product.template, price). Can anyone push me in the right direction. How can I get the price from supplierprice into a (new) field in my product.template?

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

1 follower(s)

Stats

Asked: 2/11/16, 5:34 AM
Seen: 379 times
Last updated: 2/11/16, 9:58 AM