-
-
Notifications
You must be signed in to change notification settings - Fork 597
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[16.0][ADD] pos_financial_risk #1018
[16.0][ADD] pos_financial_risk #1018
Conversation
2d052dd
to
12a6e03
Compare
const total = order.get_total_with_tax() + order.get_rounding_applied(); | ||
if (total > partner.risk_total) { | ||
return this.showPopup("ErrorPopup", { | ||
title: _t("Confirmation order is not allowed!"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cannot confirm order
if (total > partner.risk_total) { | ||
return this.showPopup("ErrorPopup", { | ||
title: _t("Confirmation order is not allowed!"), | ||
body: _t("Order total more than Customer risk total!"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Order total exceeds customer credit limit
@@ -0,0 +1,31 @@ | |||
odoo.define("pos_financial_risk.ProductScreen", function (require) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use the new method to define the js files, this will be more flexible for porting to a new version of odoo in the future
/** @odoo-module **/
import ProductScreen from "point_of_sale.ProductScreen";
import Registries from "point_of_sale.Registries";
import { _t } from "web.core";
export const ProductScreenRisk = (ProductScreen) =>
and etc
async _onClickPay() { | ||
const order = this.env.pos.get_order(); | ||
const partner = order.partner; | ||
if (!partner) { | ||
return super._onClickPay(); | ||
} | ||
const total = order.get_total_with_tax() + order.get_rounding_applied(); | ||
if (total > partner.risk_total) { | ||
return this.showPopup("ErrorPopup", { | ||
title: _t("Confirmation order is not allowed!"), | ||
body: _t("Order total more than Customer risk total!"), | ||
}); | ||
} | ||
return super._onClickPay(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
async _onClickPay() { | |
const order = this.env.pos.get_order(); | |
const partner = order.partner; | |
if (!partner) { | |
return super._onClickPay(); | |
} | |
const total = order.get_total_with_tax() + order.get_rounding_applied(); | |
if (total > partner.risk_total) { | |
return this.showPopup("ErrorPopup", { | |
title: _t("Confirmation order is not allowed!"), | |
body: _t("Order total more than Customer risk total!"), | |
}); | |
} | |
return super._onClickPay(); | |
} | |
async _onClickPay() { | |
const order = this.env.pos.get_order(); | |
const partner = order.partner; | |
if (partner && order.get_total_with_tax() + order.get_rounding_applied() > partner.risk_total) { | |
return await this.showPopup("ErrorPopup", { | |
title: _t("Cannot confirm order"), | |
body: _t("Order total exceeds customer credit limit"), | |
}); | |
} | |
return await super._onClickPay(); | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably a silly question 😅 : PoS orders are paid in the moment, shouldn't that keep the customer credit always balanced?
Well that's a good question. Actually they should. However at some moment you would like to block a customer from purchasing anything before he pays his debt. Otherwise he can keep paying through POS without taking care of his pending balance 😅 |
I think this PR is useful and should be re-opened. We have a use-case for it internally and may want to flesh out the concept a little more. How can I contact you to discuss funding this development? |
Hi @luke-stdev001 |
6e833ea
to
8ad21c2
Compare
0a3217c
to
609cc41
Compare
Functional testing has been done and it works as expected, thanks for the changes. From my end we are ok to merge pending a code review, however we'd prefer to just pull in the OCA/POS repo rather than maintain our own version until this PR is merged here. Would a code review from our team on this PR here help with the OCA process, or are we waiting on PSC and tests to pass for approval to merge into 16.0 for the OCA? |
@luke-stdev001 you can make a code review meanwhile. We will also do our own too |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
609cc41
to
6414b7d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Functional OK
test-requirements.txt
Outdated
@@ -0,0 +1 @@ | |||
odoo-addon-account_financial_risk @ git+https://github.com/OCA/credit-control.git@refs/pull/272/head#subdirectory=setup/account_financial_risk |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could please you rebase and update this dependency? 🙏🏻 it seems it was replaced by another PR
<div class="button paymentmethod"> | ||
<div | ||
class="payment-name" | ||
style="background: rgba(255, 0, 0, 0.6); cursor: not-allowed;" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not really a good practice to add inline styles.
The convention is to add styles through css or scss files instead
6414b7d
to
1698896
Compare
d9a698d
to
1632a68
Compare
thanks! /ocabot merge nobump |
This PR looks fantastic, let's merge it! |
Congratulations, your PR was merged at 810d455. Thanks a lot for contributing to OCA. ❤️ |
Extends Partner Financial Risk to manage POS orders.
If POS order exceeds partner limit POS order forbidden to be confirmed.