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

Pricelist minimum margin not working in v7?

By
Sean Samborski
on 7/31/14, 5:23 PM 1,028 views

Set single pricelist, Based on Public Price

 

Base Price * (1 + 0) + 0

Minimum Margin: 5.00

 

When creating an SO with my test user of the lowest sales access rights, the Price that comes up in the form is $Price + 5.00. Which is correct. It still allows the test user to drop the price below this amount. THe purpose of the minimum margin is to stop this kind of behavior.

 

Secondly, is there a way to make this minimum margin based on cost with the price based on public price? I can set two or more pricelists if this is needed.

0

Ray Carnes

--Ray Carnes--
15717
| 9 7 9
Greater Los Angeles, United States
--Ray Carnes--

Senior Odoo Analyst

OpenERP 6.1, 7.0 and Odoo 8.0, 9.0 (Since 2012)

Completed Functional and Technical Training.

Major Skills:

  • Needs Discovery and Requirements Analysis;

  • Function and Technical Specifications;

  • Project Planning;

  • Prototyping and Proof of concepts;

  • Data migration;

  • Configuration & Customization (UI and modules);

  • Integration - data, business logic and service levels;

  • Training and Knowledge transfer;

  • Go Live support;

  • Help desk;

  • Version Migration.

I have over 20 years of experience empowering and enabling users with enterprise information systems that make a real and measurable difference in their ability to proactively manage their businesses and organizations. 

Ray Carnes
On 8/2/14, 3:35 PM

I believe it is working as intended.   If you look at the code**, the price for a Sales order line is fully editable:

'price_unit': fields.float('Unit Price', required=True, digits_compute= dp.get_precision('Product Price'), readonly=True, states={'draft': [('readonly', False)]}),

The implications of this design decision is that no matter what a pricelist is set to, users will always be able to edit the value.  

You can prevent this by creating a group that is allowed to edit prices and only adding the relevant users to that group.  You just need to inherit the sale.order.form view and restrict the price_unit field to those who are members of a new group you create****.

 

 

** - https://github.com/odoo/odoo/blob/master/addons/sale/sale.py#L863

*** - https://www.odoo.com/forum/help-1/question/make-field-readonly-based-on-group-58921

That doesn't make sense. On the one hand, you have a price calculation formula in the pricelist. Then you have a minimum margin, but to get the minimum margin to work, you have to restrict access to change prices. Now the user will only get the price created in the formula but still not be getting the minimum margin. If we use this advice, the minimum margin is a useless field that will never work regardless of your permissions.

Elephante, Sean Samborski
on 8/7/14, 12:59 AM

Everything works out of the box without needing changes, once you understand how to set things up. The documentation helps a lot. Permissions changes are only needed it you want an ENFORCED price instead of a SUGGESTION. Pricelists work with price calculations AND margins, not one or the other. Margins dictate the floor or ceiling that the calculation must work within. If the calculation works out to be below or above the margin limits, then they are used instead. If you are not seeing that you should post a screenshot of your rule. https://doc.odoo.com/book/6/6_16_Sales/6_16_Sales_pricing/

Bista Solutions US, Ray Carnes
on 8/7/14, 5:51 PM

The part of your assumption that isn't correct is "The purpose of the minimum margin is to stop this kind of behavior". Permissions stop changes that pricelists suggest. A pricelist will never create a price that can't be changed.

Bista Solutions US, Ray Carnes
on 8/7/14, 5:53 PM

Ok well that explanation actually makes sense. That the minimum is only used to control the formula you provide in price.

Elephante, Sean Samborski
on 8/8/14, 4:14 PM

I just found http://stackoverflow.com/questions/23359684/dont-allow-to-quote-below-the-sales-price-of-a-product-in-openerp - it shows how you can create a function to 'validate' any change a user makes to a price and warn them about it.

Bista Solutions US, Ray Carnes
on 8/12/14, 5:33 PM

Yeah I think I saw that before and there was another one like it. There's also some community modules that protect against price change. This question was more about my confusion about how the minimum margin works, which you cleared up. I'm pretty sure there are ways to write a module that can handle my use-case but I was just thinking the minimum margin was what I was thinking. Which it wasn't. Thanks for coming back and posting a followup info.

Elephante, Sean Samborski
on 8/12/14, 8:01 PM

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: 7/31/14, 5:23 PM
Seen: 1028 times
Last updated: 3/16/15, 8:10 AM