Merge pull request #2427 from expsa/revert-2426-Ens-3223

Revert "[IMP] p_donation_theme: add dynamic amount"
This commit is contained in:
abdurrahman-saber 2025-02-17 10:21:48 +02:00 committed by GitHub
commit c1c7be1169
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 20 deletions

View File

@ -151,8 +151,8 @@ class PaymentPortalExtraFields(PaymentPortal):
success = False
order = request.website.sale_get_order(force_create=True)
product_id = kw.pop('product_id')
acquire_id = kw.pop('acquire_id', request.env.ref('payment_applepay.payment_acquirer_applepay').id)
mobile = kw.pop('mobile', '')
acquire_id = kw.pop('acquire_id')
mobile = kw.pop('mobile')
if order:
if product_id:
product_id = request.env['product.product'].sudo().browse(int(product_id))

View File

@ -30,23 +30,22 @@ odoo.define('p_donation_theme.product-gift-card', function (require) {
_convert_arabic_to_english(ev) {
ev.currentTarget.value = ArabictoEnglishNumber(ev.currentTarget.value)
},
async start() {
await this._super(...arguments);
const amounts = this.$('.donation-product-detail-layout .single-amount');
if (amounts.length > 0) {
amounts.get(0).click();
}
const $parent = this.$el.find('.js_product');
const product_id = this._getProductId($parent);
const amount = this._get_donation_amount();
if (product_id && amount) {
if (product_id) {
const data = await this._rpc({
route: '/quickpay/hyperpay/payment/create',
params: {
'acquire_id': 20,
'product_id': product_id,
'amount': amount,
'currency_id': 148,
'mobile': '',
'amount': 100,
'is_donation_detail_page': true
}
});
@ -65,17 +64,6 @@ odoo.define('p_donation_theme.product-gift-card', function (require) {
}
},
_get_donation_amount(){
let amount = ArabictoEnglishNumber(this.$el.find('input.donation-input-amt').val());
if (!amount) {
const $amountEl = this.$('#fixedqtyinput-1');
let qty = parseFloat($amountEl.val(), 10);
let price = parseFloat($amountEl.data('price'), 10);
amount = qty * price;
}
return amount;
},
_submitForm() {
const params = this.rootProduct;
const $product = $('#product_detail');