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.

3

Sales price based on supplier price list not picking up price

By
martin mueller
on 9/25/13, 6:50 PM 3,182 views

I have the following situation (openerp 7 - 20130914 - windows)

  • supplier pricelist based on "Supplier Prices on the product form" => the correct price is picked up when I make a purchase quote
  • sales pricelist based on the "Supplier Prices on the product form" with an uplift and a fixed amount

The supplier price is not picked up, instead 0.00 is found. If I add a rule "Catch all" based on the public price, with a higher sequence number then that price is selected, thus this pricelist version is used to compute the price. I have checked the quantities, the product and product category, removed the uplift/fixed amount, but I cannot get it to pick up the supplier price, it always picks up the "Catch all" rule.

What am I (or the program) doing wrong?

1

Andreas Brueckl

--Andreas Brueckl--
5056
| 7 8 7
Vienna, Austria
--Andreas Brueckl--
OpenERP Consulting and Development
Andreas Brueckl
On 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

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 ?!?

martin mueller
on 9/26/13, 8:37 PM

Please post the whole traceback and your code

Andreas Brueckl
on 9/27/13, 4:39 AM
0
Sebastian Bollatti
On 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.

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

Sebastian Bollatti
on 4/15/15, 2:17 PM
0
martin mueller
On 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"/>
    </xpath>
</field>
</record>

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, ...)

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

0 follower(s)

Stats

Asked: 9/25/13, 6:50 PM
Seen: 3182 times
Last updated: 4/18/16, 4:53 AM