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.

5

How can I activate a credit limit for my customers?

By
Frédéric Gilson (fgi)
on 2/7/13, 6:33 AM 9,123 views

In the contact form, I notice a field named "Credit limit" in the Accounting tab. But if I set a value, nothing happens when I override this limit during a sale operation? How can I set up a blocking mechanism in the sales order validation?

12

You need to add a condition in the first transitions of the sales workflow: i.e. Credit limit > Total receivable (the amount the customer owes you) + Amount of the new SO.

So open the sales workflow (either from the developer drop-down menu, or from Settings > Technical > Workflows > Workflows). Then, add the following condition in the two order_confirm transitions (between draft & sent to router nodes): partner_id.credit_limit > partner_id.credit + amount_total (replacing True). Use the Diagram view to find them in an easier way.

From now on, everytime you try to validate a sales order, the SO status remains on "Quotation" if the sum of the amount the customer owes you and the new SO amount is higher than his credit limit.

Thank you, it works fine. However, I have another question, where you can help me one probably again. Is it possible, if so allow, show how a notification, if the credit limit is not sufficient for the job? Something like: The credit limit is not enough.

Thank you again.

my
on 2/9/13, 10:17 AM

another way to do it if you do want to modify your workflow through the interface is to override the function action_button_confirm cause this is this function that is raising the signal defined in the transitions

Skillteam, Houssine BAKKALI
on 7/29/13, 9:47 AM

To take this further, I would like the ability to override the credit hold with management approval. So if a customer was over their limit and the order was blocked, the system would throw a warning rather than just blocking it from being confirmed all-together. There are circumstances where a check was lost in the mail, or an invoice was missed being sent, etc, where it is not entirely the customers fault that they are over the limit and in those circumstances, with management approval, orders are still filled that are over a customer's credit limit.

Josh Stover
on 10/23/13, 5:55 PM

Is it possible to have an alert or popup display a message to the user? This method works to block the progression of the sales order when a user presses "Confirm Sale" but it just refreshes the page without any message. The user will probably just click the button and then not notice nothing actually happened.

Elephante, Sean Samborski
on 6/11/14, 11:54 PM

Great, works for us. How do I add the popup message that Josh asked about?

Santiago EV
on 9/8/15, 11:04 AM
0

Cameron

--Cameron--
769
| 6 5 8
United Kingdom
--Cameron--
Cameron
On 5/16/13, 11:39 AM

Many thanks Frederic, however I changed the formula slightly to

"partner_invoice_id.credit_limit > partner_invoice_id.credit + amount_total"

Reason is we give give credit to the company not each employee of that company! We use OpenERP this way - Sales>Sales>Quotations> Create

The customer is "Fred Blogs" who works for "Smiths Industries" this person has 0 Credit The Invoice Address is "Smiths Industries" who has a credit of XXX GBP

This way we track who placed the order and can communicate with that individual, but all invoices go the company

Just improved the formula (now allows for a path to create a proforma invoice - ie "create invoice = before delivery") new formula including brackets is (order_policy=='prepaid') or (partner_invoice_id.credit_limit > partner_invoice_id.credit + amount_total)

Cameron
on 5/24/13, 8:37 AM

Im not sure I follow why you made the change from partner_id.credit_limit to partner_invoice_id.credit_limit

Santiago EV
on 9/8/15, 11:05 AM
0
my
On 2/7/13, 8:33 AM

Sorry, but where can I find these two 'orderconfirm' transitions? I mean, what name they have exactly? I'm unfortunately not quite sure what these are.

Thank you.

Settings > Workflows > Transitions > draft - router - order_confirm sent - router - order_confirm

Santiago EV
on 9/8/15, 11:02 AM
0
Robert Klüsener
On 5/19/13, 5:43 PM

In the "Getting Started with OpenERP" chapter of the V7 documentation I found the following statement:

"if one of your accountants puts a customer on credit hold, then that will immediately block any other action related to that company’s credit (such as sales or delivery)."

To test that I putted a credit limit of "0" to a customer. But I still can create and confirm a sales order, deliver goods and create and validate an invoice for this customer. Why is that?

Hi Robert. Have you added the code of Fredeic Gilson? This code works fine. Make sure you that you have the code correctly. Greeting.

my
on 5/20/13, 11:29 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

6 follower(s)

Stats

Asked: 2/7/13, 6:33 AM
Seen: 9123 times
Last updated: 9/8/15, 11:52 AM