-
-
Notifications
You must be signed in to change notification settings - Fork 602
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIX] sale_financial_risk_pos_compatibility: Js code is changed.
- Loading branch information
Showing
5 changed files
with
56 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
from . import pos_session | ||
from . import sale_order |
11 changes: 11 additions & 0 deletions
11
sale_financial_risk_pos_compatibility/models/sale_order.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from odoo import api, models | ||
|
||
|
||
class SaleOrder(models.Model): | ||
_inherit = "sale.order" | ||
|
||
@api.model | ||
def create_order_from_pos(self, order_data, action): | ||
if "bypass_risk" in order_data: | ||
self = self.with_context(bypass_risk=order_data.get("bypass_risk")) | ||
return super(SaleOrder, self).create_order_from_pos(order_data, action) |
3 changes: 0 additions & 3 deletions
3
sale_financial_risk_pos_compatibility/static/src/js/ConfirmRiskPopup.esm.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,10 @@ | ||
/** @odoo-module **/ | ||
|
||
import ConfirmPopup from "point_of_sale.ConfirmPopup"; | ||
import Registries from "point_of_sale.Registries"; | ||
|
||
export class ConfirmRiskPopup extends ConfirmPopup {} | ||
ConfirmRiskPopup.template = "ConfirmRiskPopup"; | ||
ConfirmRiskPopup.defaultProps = { | ||
...ConfirmPopup.defaultProps, | ||
showButton: false, | ||
}; | ||
|
||
Registries.Component.add(ConfirmRiskPopup); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
sale_financial_risk_pos_compatibility/static/src/js/models.esm.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/** @odoo-module **/ | ||
|
||
import {Order} from "point_of_sale.models"; | ||
import Registries from "point_of_sale.Registries"; | ||
|
||
const PosSaleFinancialRiskOrder = (Order) => | ||
class PosSaleFinancialRiskOrder extends Order { | ||
constructor() { | ||
super(...arguments); | ||
this.bypass_risk = false; | ||
} | ||
set_bypass_risk(bypass_risk) { | ||
this.bypass_risk = bypass_risk; | ||
} | ||
export_as_JSON() { | ||
const result = super.export_as_JSON(...arguments); | ||
result.bypass_risk = this.bypass_risk; | ||
return result; | ||
} | ||
init_from_JSON(json) { | ||
super.init_from_JSON(...arguments); | ||
this.bypass_risk = json.bypass_risk; | ||
} | ||
}; | ||
|
||
Registries.Model.extend(Order, PosSaleFinancialRiskOrder); | ||
|
||
export default PosSaleFinancialRiskOrder; |