Odoo Help


7 Answers

Andreas Brueckl Austria

--Andreas Brueckl--

| 8 8 9
Vienna, Austria
--Andreas Brueckl--
OpenERP Consulting and Development
Andreas Brueckl Austria
9/26/13, 5:16 AM

I have tested this scenario and it was working fine when the customer of the SO is one of the suppliers.

If the customer of the SO is not one of the products suppliers, then this can not work since OpenERP does not know which supplier it should choose.

If you want to use always the first one you can customize the following:

  • Create a new function field in the product which always returns the cost price of the first supplier
  • Create a new Price Type which points to the new function field
  • Create a new Pricelist Item in your pricelist which is based on this Price Type
martin mueller Switzerland
9/26/13, 8:37 PM

Thanks Andreas! yes that way it works, although computing the best purchase price for all suppliers would make more sense to me. I was wondering because there is a field price in product.product and _product_price could be rewritten to take into account the preferred supplier (lowest sequence nb in the supplier subform). BTW, when I try to add the function field to the tree view of products I get a KeyError:3 from orm.py ?!?

Andreas Brueckl Austria
9/27/13, 4:39 AM

Please post the whole traceback and your code

Sanat Panda India
8/24/17, 3:09 AM

In Openerp 7, when you create pricelist to pick 'Supplier Price from Product', then the pricelist always makes sure to check the Customer chosen on the Sales Order and the Supplier set on the Product are same, only then it picks up the Supplier price on Product. So essentialy the customer chosen should alse be a supplier and should be among the ones set on the product.

In Odoo 8, the pricelist does not check for this. It always picks up the price of the first supplier set on the Product. Thus no matter what it always picks up supplier price in Pricelist.

Sebastian Bollatti Argentina
4/15/15, 12:27 PM

I will like to understand the use of "Supplier Pricelist" and it's difference to Product -> Supplier according to "Request For Quotation "and "Purchase Order"

If a supplier provide a Pricelist and it's updated you just can avoid the RFQ and go directly to Purchase Order.

The prices for every product should be picked from Supplier Pricelist and if a discount per quantity would be used from ??? product -> supplier?

...really I don't understand whats the meaning or the thought when it was made the module.

1 Comment
Sebastian Bollatti Argentina
4/15/15, 2:17 PM

Also dealing with Product Variant like Bolts that has many sizes and a few pitches... How can it work with this?

martin mueller Switzerland
9/27/13, 5:18 AM

This is my code:

from openerp.osv import fields, osv
from openerp.tools.translate import _
import openerp.addons.decimal_precision as dp

class product_product(osv.osv):
_inherit = "product.product"
_name = "product.product"

def _product_best_price(self, cr, uid, ids, name, arg, context=None):
return {ids[0]: 17}
def _product_best_supplier(self, cr, uid, ids, name, arg, context=None):
    return {ids[0] : 6}
_columns = {
    'bsprice': fields.function(_product_best_price, type='float', string='Best Purchase Price', digits_compute=dp.get_precision('Product Price')),
    'bsupp_id': fields.function(_product_best_supplier, type='many2one', relation="res.partner", string='Main Supplier'),

and I use this xml file:

<record id="product_normal_form_view" model="ir.ui.view">
<field name="name">base.product.defaults.product.form</field>
<field name="model">product.product</field>
<field name="inherit_id" ref="product.product_normal_form_view"/>
    <field name="arch" type="xml">
    <xpath expr="/form/sheet/notebook/page[@string='Procurements']/group[@name='procurement']/group[@name='general']/field[@name='standard_price']" position="after">
        <field name="bsprice"/>
        <field name="bsupp_id"/>

That works perfectly in form view, but when I add bsprice to the tree view (via web), I get this error:

File "C:\Program Files (x86)\OpenERP\Server\server\.\openerp\osv\orm.py", line 3729, in _read_flat
KeyError: 3

The server log doesn't say more.

I also tried to make an xml file for the tree view, but without success (xml errors, key error, ...)

Ask a Question
Keep Informed
0 follower(s)
About This Community

This platform 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.

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now