Need to use set_balance_in_account_currency
https://github.com/revant/drop_ship/commit/b9ad5178e4f75a73be9f7b36a1b3d691c8937746
needed to make GL Entry
diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py
index 9916613..6a8c8aa 100644
--- a/erpnext/controllers/accounts_controller.py
+++ b/erpnext/controllers/accounts_controller.py
@@ -252,23 +252,6 @@
frappe.throw(_("Account {0} is invalid. Account Currency must be {1}")
.format(account, _(" or ").join(valid_currency)))
- def set_balance_in_account_currency(self, gl_dict, account_currency=None):
- if (not self.get("conversion_rate") and account_currency!=self.company_currency):
- frappe.throw(_("Account: {0} with currency: {1} can not be selected")
- .format(gl_dict.account, account_currency))
-
- gl_dict["account_currency"] = self.company_currency if account_currency==self.company_currency \
- else account_currency
-
- # set debit/credit in account currency if not provided
- if flt(gl_dict.debit) and not flt(gl_dict.debit_in_account_currency):
- gl_dict.debit_in_account_currency = gl_dict.debit if account_currency==self.company_currency \
- else flt(gl_dict.debit / (self.get("conversion_rate")), 2)
-
- if flt(gl_dict.credit) and not flt(gl_dict.credit_in_account_currency):
- gl_dict.credit_in_account_currency = gl_dict.credit if account_currency==self.company_currency \
- else flt(gl_dict.credit / (self.get("conversion_rate")), 2)
-
def clear_unallocated_advances(self, childtype, parentfield):
self.set(parentfield, self.get(parentfield, {"allocated_amount": ["not in", [0, None, ""]]}))
@@ -541,3 +524,20 @@
_on_previous_row_error("1 - %d" % (tax.row_id,))
elif tax.get("category") == "Valuation":
frappe.throw(_("Valuation type charges can not marked as Inclusive"))
+
+def set_balance_in_account_currency(gl_dict, conversion_rate=None, company_currency=None, account_currency=None):
+ if (not conversion_rate) and (account_currency!=company_currency):
+ frappe.throw(_("Account: {0} with currency: {1} can not be selected")
+ .format(gl_dict.account, account_currency))
+
+ gl_dict["account_currency"] = company_currency if account_currency==company_currency \
+ else account_currency
+
+ # set debit/credit in account currency if not provided
+ if flt(gl_dict.debit) and not flt(gl_dict.debit_in_account_currency):
+ gl_dict.debit_in_account_currency = gl_dict.debit if account_currency==company_currency \
+ else flt(gl_dict.debit / conversion_rate, 2)
+
+ if flt(gl_dict.credit) and not flt(gl_dict.credit_in_account_currency):
+ gl_dict.credit_in_account_currency = gl_dict.credit if account_currency==company_currency \
+ else flt(gl_dict.credit / conversion_rate, 2)