commented payment and received fix, because already fixed in v16
This commit is contained in:
parent
f30de47c65
commit
a77903cee8
|
|
@ -49,57 +49,57 @@ frappe.ui.form.on('Payment Entry', {
|
|||
});
|
||||
},
|
||||
|
||||
// Переопределение received_amount
|
||||
received_amount: function (frm) {
|
||||
if (frm.set_paid_amount_based_on_received_amount) return;
|
||||
// // Переопределение received_amount
|
||||
// received_amount: function (frm) {
|
||||
// if (frm.set_paid_amount_based_on_received_amount) return;
|
||||
|
||||
const company_currency = frappe.get_doc(":Company", frm.doc.company).default_currency;
|
||||
const from_currency = frm.doc.paid_from_account_currency;
|
||||
const to_currency = frm.doc.paid_to_account_currency;
|
||||
// const company_currency = frappe.get_doc(":Company", frm.doc.company).default_currency;
|
||||
// const from_currency = frm.doc.paid_from_account_currency;
|
||||
// const to_currency = frm.doc.paid_to_account_currency;
|
||||
|
||||
const from_rate = frm.doc.source_exchange_rate || 1;
|
||||
const to_rate = frm.doc.target_exchange_rate || 1;
|
||||
// const from_rate = frm.doc.source_exchange_rate || 1;
|
||||
// const to_rate = frm.doc.target_exchange_rate || 1;
|
||||
|
||||
const cross_rate = from_currency === to_currency ? 1 : from_rate / to_rate;
|
||||
// const cross_rate = from_currency === to_currency ? 1 : from_rate / to_rate;
|
||||
|
||||
frm.set_paid_amount_based_on_received_amount = true;
|
||||
frm.set_value(
|
||||
"paid_amount",
|
||||
flt(frm.doc.received_amount / cross_rate, precision("paid_amount"))
|
||||
);
|
||||
frm.set_paid_amount_based_on_received_amount = false;
|
||||
// frm.set_paid_amount_based_on_received_amount = true;
|
||||
// frm.set_value(
|
||||
// "paid_amount",
|
||||
// flt(frm.doc.received_amount / cross_rate, precision("paid_amount"))
|
||||
// );
|
||||
// frm.set_paid_amount_based_on_received_amount = false;
|
||||
|
||||
frm.set_value("base_received_amount", flt(frm.doc.received_amount * to_rate));
|
||||
frm.events.hide_unhide_fields(frm);
|
||||
frm.trigger("set_difference_amount");
|
||||
},
|
||||
// frm.set_value("base_received_amount", flt(frm.doc.received_amount * to_rate));
|
||||
// frm.events.hide_unhide_fields(frm);
|
||||
// frm.trigger("set_difference_amount");
|
||||
// },
|
||||
|
||||
// Переопределение paid_amount
|
||||
paid_amount: function (frm) {
|
||||
if (frm.set_paid_amount_based_on_received_amount) return;
|
||||
// // Переопределение paid_amount
|
||||
// paid_amount: function (frm) {
|
||||
// if (frm.set_paid_amount_based_on_received_amount) return;
|
||||
|
||||
const company_currency = frappe.get_doc(":Company", frm.doc.company).default_currency;
|
||||
const from_currency = frm.doc.paid_from_account_currency;
|
||||
const to_currency = frm.doc.paid_to_account_currency;
|
||||
// const company_currency = frappe.get_doc(":Company", frm.doc.company).default_currency;
|
||||
// const from_currency = frm.doc.paid_from_account_currency;
|
||||
// const to_currency = frm.doc.paid_to_account_currency;
|
||||
|
||||
// Получаем курсы валют относительно базовой валюты компании
|
||||
const from_rate = frm.doc.source_exchange_rate || 1;
|
||||
const to_rate = frm.doc.target_exchange_rate || 1;
|
||||
// // Получаем курсы валют относительно базовой валюты компании
|
||||
// const from_rate = frm.doc.source_exchange_rate || 1;
|
||||
// const to_rate = frm.doc.target_exchange_rate || 1;
|
||||
|
||||
// Рассчитываем кросс-курс между валютами списания и зачисления
|
||||
const cross_rate = from_currency === to_currency ? 1 : from_rate / to_rate;
|
||||
// // Рассчитываем кросс-курс между валютами списания и зачисления
|
||||
// const cross_rate = from_currency === to_currency ? 1 : from_rate / to_rate;
|
||||
|
||||
// Обновляем Received Amount
|
||||
frm.set_paid_amount_based_on_received_amount = true;
|
||||
frm.set_value(
|
||||
"received_amount",
|
||||
flt(frm.doc.paid_amount * cross_rate, precision("received_amount"))
|
||||
);
|
||||
frm.set_paid_amount_based_on_received_amount = false;
|
||||
// // Обновляем Received Amount
|
||||
// frm.set_paid_amount_based_on_received_amount = true;
|
||||
// frm.set_value(
|
||||
// "received_amount",
|
||||
// flt(frm.doc.paid_amount * cross_rate, precision("received_amount"))
|
||||
// );
|
||||
// frm.set_paid_amount_based_on_received_amount = false;
|
||||
|
||||
// Обновляем base_paid_amount (в базовой валюте компании)
|
||||
frm.set_value("base_paid_amount", flt(frm.doc.paid_amount * from_rate));
|
||||
frm.events.hide_unhide_fields(frm);
|
||||
frm.trigger("set_difference_amount");
|
||||
}
|
||||
// // Обновляем base_paid_amount (в базовой валюте компании)
|
||||
// frm.set_value("base_paid_amount", flt(frm.doc.paid_amount * from_rate));
|
||||
// frm.events.hide_unhide_fields(frm);
|
||||
// frm.trigger("set_difference_amount");
|
||||
// }
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue