Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
7390 มุมมอง

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.



อวตาร
ละทิ้ง

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.

คำตอบที่ดีที่สุด

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.

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

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

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

อวตาร
ละทิ้ง
ผู้เขียน

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!

Related Posts ตอบกลับ มุมมอง กิจกรรม
1
ก.ย. 23
1464
0
ส.ค. 25
411
2
ก.ค. 25
546
Does Odoo manage WebP ? แก้ไขแล้ว
3
ก.ค. 25
3105
1
มิ.ย. 25
1383