Skip to Content
Odoo Menu
  • Sign in
  • Try it free
  • Apps
    Finance
    • Accounting
    • Invoicing
    • Expenses
    • Spreadsheet (BI)
    • Documents
    • Sign
    Sales
    • CRM
    • Sales
    • POS Shop
    • POS Restaurant
    • Subscriptions
    • Rental
    Websites
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Supply Chain
    • Inventory
    • Manufacturing
    • PLM
    • Purchase
    • Maintenance
    • Quality
    Human Resources
    • Employees
    • Recruitment
    • Time Off
    • Appraisals
    • Referrals
    • Fleet
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Events
    • Marketing Automation
    • Surveys
    Services
    • Project
    • Timesheets
    • Field Service
    • Helpdesk
    • Planning
    • Appointments
    Productivity
    • Discuss
    • Approvals
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industries
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage Distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Estate Management
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Manufacturing
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Community
    Learn
    • Tutorials
    • Documentation
    • Certifications
    • Training
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Download
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Events
    • Translations
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Customer References
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Pricing
  • Help

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Accounting
  • Inventory
  • PoS
  • Project
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
Help

Credit limit with blocking feature using Studio

Subscribe

Get notified when there's activity on this post

This question has been flagged
credit_limitquickstartStudioapprovalsQuickstart
2 Replies
9059 Views
Avatar
Omar Lucas (olu)

This customization is designed for Odoo V15.X with Studio App

⚠️ Constraints: the following Studio customization works as expected in single currency databases, within Odoo Sales module and assumes ALL clients have a credit line. It has unexpected behaviours in other scenarios. There, additional logic might be required.



Display useful fields in Contacts

In the model res.partner two required fields are available but hidden to the user interface by default. Open the form view with Studio and bring them to the interface:

  • Credit limit (credit_limit)
  • Total Receivable (credit)



⚠️ Warning: a credit limit above 0 is required for this solution to work


Display credit info in Sale Order

  • Create related fields in sale.order model using the customer field for the relation with res.partner:
    • Credit limit (x_studio_credit_limit) from Customer > Credit limit
    • Total Receivable (x_studio_credit) from Customer > Total Receivable.


Bonus: set monetary widget on these two related fields



Credit consumption with current sale order

In order to configure a blocking feature, a basic logic is constructed through a credit usage ratio. If ratio is above 100% (1.000) the credit is surpassed by current transaction. Without the two related fields created in sales order, this calculation is not possible due to technicalities of Odoo.

  • Create “Consumed (%)” field (x_studio_ratio, type=float, widget=progressbar) in sale.order model
  • Create Automated action (Settings / Technical / Automation / Automated Actions)
    • Model: sale.order

    • Trigger: On creation & Update

    • Data to write

      • Field: Credit usage
      • Evaluation Type: Python expression (in this specific configuration does not create billable lines of code)
      • Value: the following python expression will sum both Total Receivable and the current transaction subtotal (tax excluded)

(record.x_studio_credit+record.amount_untaxed)/record.x_studio_credit_limit

Bonus: use amount_total instead of amount_untaxed if taxes are included in the calculation. If progress bar widget is used, multiple the whole expression by 100 in order to get a percentage (1 to 100) visualization.

⚠️ Warning: if credit amount is not set on the customer contact, Odoo might encounter errors (division by zero) when creating a sales order.



This automation works when the sale order is created or updated (in any field).



Blocking feature and authorized approvers

This blocking feature has the intention to avoid the order confirmation when the credit limit is surpassed.

⚠️ Constraints: this feature only works for total receivable amount. If there are uninvoiced sales order (other than the current transaction), the amount is not considered as part of the used credit.


  • Create approval user group (Settings / Users & Companies / Groups)


  • Export this user group in order to be used in Studio Approvals


  • In sale order form view, enable Studio and select Confirm button
  • Set approval for the approval group with the following condition rule: Credit usage > 1



Bonus: if progress bar widget is chosen, use 100 instead of 1




Proof of Concept

The following scenario is below credit limit. Thus, the user can confirm the sales order.




The following scenario is above credit limit. Thus, the user cannot confirm the sales order and manager approval (defined by user group) is required.



9
Avatar
Discard
Dr. Thomas Koliwer

I find your implementation very convincing (even if I wouldn't do it with Studio, that's forbidden in our project - for good reason - with maximum penalty).
I just wonder why Odoo itself does not come up with such ideas. What I can see at the moment from the credit limit check in V.16 is completely inadequate in my opinion.

Avatar
Andrey Kolesnikov
Best Answer

It looks like this implementation would provide a simplistic credit limit functionality.


I'd suggest also looking into totals from open SO's that are not delivered and done deliveries that are not invoiced - not just the total invoiced amount.  Aside from that - there can also be payments for the customer that are not linked to invoices, and credit memos too. 


Furthermore, aside from just not accepting new orders if a customer is over a credit limit - it is sensible to block doing deliveries for some instances where you want to take an order but want it to not ship until something is resolved, or to generally block deliveries (for example, if a customer is really late on payments). 


Our team created a major credit limit and credit blocking feature for our Odoo customers - I think its much more robust than modules on the Odoo marketplace or this Studio implementation. Read about it here: https://steersman.works/a/392-customer-credit-limits-and-blocks   maybe you can use some of our feature ideas and recreate a bit more via Studio.

0
Avatar
Discard
Avatar
Josep Anton Belchi Riera
Best Answer

There are some modules in the following repository that give full credit limit functionality

https://github.com/OCA/credit-control 

0
Avatar
Discard
Omar Lucas (olu)
Author

Thank you for your contribution. This solution works for companies without resources for sh (cost and programming knowledge) but for ones with it, the sky is the limit!

Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Sign up
Related Posts Replies Views Activity
How to change/select the date field used in the calendar view? [STUDIO] Solved
calendarview studio quickstart Studio Quickstart
Avatar
1
Sep 23
2192
How do I connect the Epson TM-T88VII to Odoo?
quickstart Quickstart
Avatar
Avatar
2
Oct 25
923
How to Set Customer-Specific Product Names Solved
quickstart Quickstart
Avatar
1
Nov 25
1403
✅ Odoo E-commerce: How to discriminate deliveries based on the type of clients
quickstart Quickstart
Avatar
0
Aug 25
1429
How can Import an existing Spreadsheets with formulas with out doing it manually? Solved
quickstart Quickstart
Avatar
2
Aug 25
1852
Community
  • Tutorials
  • Documentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Translations
Services
  • Odoo.sh Hosting
  • Support
  • Upgrade
  • Custom Developments
  • Education
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Brand Assets
  • Contact us
  • Jobs
  • Events
  • Podcast
  • Blog
  • Customers
  • Legal • Privacy
  • Security
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now