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

Update the sale price in function of the last buy price

By
José
on 11/13/14, 11:54 AM 1,124 views

Hello, I have Odoo 7 running under Windows XP.

I want to set a rule that update the sale price for the default pricelist in function of the LAST buy price.

For example, a rule that says "the sale price is the last buy price with a 30% of charge"

I buy 30 units of a product A for $10 per unit. The sale price for the product now is $13.

Then I buy 10 units of product A for $20 per unit. Then the sale price (for the all units) must automatically update to $26.

How can I do this? Thanks!

Do you mean last price for same customer or for all customer ?(i mean if you bye customer X a product A with price 50$ then bye customer Y a product A with price 60$ , so for customer X again the price will update to 50$ not 60$)

sameer alhwety
on 11/19/14, 10:18 AM

Thanks for your reply. I mean last buy price for all customer but in function of the cost price, not the sale price. If I buy a product A for $10 to the supplier R, then the sale price will be $13 for all the customers.

José
on 11/19/14, 12:28 PM
0

Ivan

--Ivan--
3210
| 5 3 6
Jakarta, Indonesia
--Ivan--
Ivan
On 11/20/14, 1:39 AM

Jose, you need to develop the logic.  I would think that you need to inherit the do_change_standard_price method of product.product.  It would be better if you can develop a way to configure the rule instead of "hard-coding" it in the module.

Note that the Sale Price can be overridden in Sale Order.  If the purpose is to suggest the selling price, I would suggest that maybe sale_margin module (https://www.odoo.com/apps/7.0/sale_margin/) is more approriate.

I was trying to edit the worflow of the Purchase Orders, so when the user confirms the PO, the cost price is updated. But I can't do this because I am new in Odoo and not understand the architecture yet. What must I do? Develop a server action which updates the product cost price when the PO is confirmed? Thanks for your help!

José
on 11/20/14, 6:21 AM

Jose, by "develop" I mean you need to create/modify the addons for this. You need to be familiar with Python to do this and have access to the source code in the server. Then you can read about the architecture and such in the documentation. The answer to this question: https://www.odoo.com/forum/help-1/question/what-documentation-is-available-for-odoo-60312 provides some links to the available documentations for Odoo. Now, if you want to change the cost price when PO is confirmed, you are on the right track that you need to do something on the PO's workflow. The PO is confirmed if it goes to the act_confirmed activity (see addons/purchase/purchase_workflow.xml) and it calls wkf_confirm_order method of PO (see addons/purchase/purchase.py). What you need to do is to inherit the purchase.order model, and then inherit its wkf_confirm_order method to update the price. To update the price, you can call product.product's do_change_standard_price to do the price change.

Ivan
on 11/21/14, 1:21 AM
0

michel Guénard

--michel Guénard--
1033
| 5 5 8
VIROFLAY, France
--michel Guénard--

VP operations & finance Social entrepreneur Certified Public Accountant Past Chief internal auditor

michel Guénard
On 11/19/14, 5:48 PM

I have not the solution to your technical question.

But I wil give my opinion on such a rule from the standpoint of business.

Whatever the business,  the sale price should be determined in consideration of the competition on the market place; certainly not as a mathematical ruling based from the purchase price.

Such a rule can easily place you outside of the market.

The issue is then to determine the top 10 (or 5) competitors you actually have and from there to know and appreciate their pricing policy in order to decide the level of your own sales prices.

Some clients, mostly if they are acting as reseller, have a business that depends on commission/margin only and maybe dealing with very specialized (custom build) product and hence it is logical to use margin calculation to determine the sale price. Anyway, the sale price is just a default that can be overridden in Sale Order.

Ivan
on 11/20/14, 1:43 AM

The rule what sets the sale price automatically is only a suggestion price. Then, the user can change de cost price when he wants. Thanks for your reply!

José
on 11/20/14, 6:18 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: 11/13/14, 11:54 AM
Seen: 1124 times
Last updated: 3/16/15, 8:10 AM