mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-25 07:54:46 +00:00
feat: multiCurrency in epxense claim, set excahnge rate in advance & update it in gl entry
This commit is contained in:
@@ -196,6 +196,9 @@ class PaymentEntry(AccountsController):
|
|||||||
def before_save(self):
|
def before_save(self):
|
||||||
self.set_matched_unset_payment_requests_to_response()
|
self.set_matched_unset_payment_requests_to_response()
|
||||||
|
|
||||||
|
def before_submit(self):
|
||||||
|
self.set_exchange_rate_in_advance()
|
||||||
|
|
||||||
def on_submit(self):
|
def on_submit(self):
|
||||||
if self.difference_amount:
|
if self.difference_amount:
|
||||||
frappe.throw(_("Difference Amount must be zero"))
|
frappe.throw(_("Difference Amount must be zero"))
|
||||||
@@ -922,6 +925,18 @@ class PaymentEntry(AccountsController):
|
|||||||
|
|
||||||
self.db_set("status", self.status, update_modified=True)
|
self.db_set("status", self.status, update_modified=True)
|
||||||
|
|
||||||
|
def set_exchange_rate_in_advance(self):
|
||||||
|
if self.references:
|
||||||
|
for reference_doc in self.references:
|
||||||
|
if reference_doc.reference_doctype == "Employee Advance" and self.target_exchange_rate:
|
||||||
|
frappe.db.set_value(
|
||||||
|
"Employee Advance",
|
||||||
|
reference_doc.reference_name,
|
||||||
|
"exchange_rate",
|
||||||
|
self.target_exchange_rate,
|
||||||
|
update_modified=False,
|
||||||
|
)
|
||||||
|
|
||||||
def set_total_in_words(self):
|
def set_total_in_words(self):
|
||||||
from frappe.utils import money_in_words
|
from frappe.utils import money_in_words
|
||||||
|
|
||||||
|
|||||||
@@ -1289,7 +1289,10 @@ class AccountsController(TransactionBase):
|
|||||||
"Payment Entry",
|
"Payment Entry",
|
||||||
]:
|
]:
|
||||||
set_balance_in_account_currency(
|
set_balance_in_account_currency(
|
||||||
gl_dict, account_currency, self.get("conversion_rate"), self.company_currency
|
gl_dict,
|
||||||
|
account_currency,
|
||||||
|
args.get("transaction_exchange_rate") or self.get("conversion_rate"),
|
||||||
|
self.company_currency,
|
||||||
)
|
)
|
||||||
|
|
||||||
# Update details in transaction currency
|
# Update details in transaction currency
|
||||||
@@ -1297,7 +1300,8 @@ class AccountsController(TransactionBase):
|
|||||||
gl_dict.update(
|
gl_dict.update(
|
||||||
{
|
{
|
||||||
"transaction_currency": self.get("currency") or self.company_currency,
|
"transaction_currency": self.get("currency") or self.company_currency,
|
||||||
"transaction_exchange_rate": self.get("conversion_rate", 1),
|
"transaction_exchange_rate": args.get("transaction_exchange_rate")
|
||||||
|
or self.get("conversion_rate", 1),
|
||||||
"debit_in_transaction_currency": self.get_value_in_transaction_currency(
|
"debit_in_transaction_currency": self.get_value_in_transaction_currency(
|
||||||
account_currency, gl_dict, "debit"
|
account_currency, gl_dict, "debit"
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -35,6 +35,20 @@ frappe.ui.form.on("Employee", {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (frm.doc.salary_currency) {
|
||||||
|
frm.set_query("employee_advance_account", function () {
|
||||||
|
return {
|
||||||
|
filters: {
|
||||||
|
root_type: "Asset",
|
||||||
|
is_group: 0,
|
||||||
|
company: frm.doc.company,
|
||||||
|
account_currency: frm.doc.salary_currency,
|
||||||
|
account_type: "Receivable",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
refresh: function (frm) {
|
refresh: function (frm) {
|
||||||
|
|||||||
Reference in New Issue
Block a user