mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-04 04:39:11 +00:00
feat: reporting_currency on company
This commit is contained in:
@@ -17,6 +17,9 @@ frappe.ui.form.on("Company", {
|
|||||||
frm.toggle_enable("default_currency", !r.message);
|
frm.toggle_enable("default_currency", !r.message);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
if (frm.doc.__islocal) {
|
||||||
|
frm.set_value("reporting_currency", "");
|
||||||
|
}
|
||||||
},
|
},
|
||||||
setup: function (frm) {
|
setup: function (frm) {
|
||||||
frm.__rename_queue = "long";
|
frm.__rename_queue = "long";
|
||||||
@@ -156,6 +159,10 @@ frappe.ui.form.on("Company", {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (frm.doc.__islocal) {
|
||||||
|
frm.set_value("reporting_currency", "");
|
||||||
|
}
|
||||||
|
|
||||||
erpnext.company.set_chart_of_accounts_options(frm.doc);
|
erpnext.company.set_chart_of_accounts_options(frm.doc);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
"domain",
|
"domain",
|
||||||
"date_of_establishment",
|
"date_of_establishment",
|
||||||
"parent_company",
|
"parent_company",
|
||||||
|
"reporting_currency",
|
||||||
"company_info",
|
"company_info",
|
||||||
"company_logo",
|
"company_logo",
|
||||||
"date_of_incorporation",
|
"date_of_incorporation",
|
||||||
@@ -835,6 +836,14 @@
|
|||||||
"fieldtype": "Select",
|
"fieldtype": "Select",
|
||||||
"label": "Reconciliation Takes Effect On",
|
"label": "Reconciliation Takes Effect On",
|
||||||
"options": "Advance Payment Date\nOldest Of Invoice Or Advance\nReconciliation Date"
|
"options": "Advance Payment Date\nOldest Of Invoice Or Advance\nReconciliation Date"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "reporting_currency",
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"label": "Reporting Currency",
|
||||||
|
"options": "Currency",
|
||||||
|
"print_hide": 1,
|
||||||
|
"read_only": 1
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"icon": "fa fa-building",
|
"icon": "fa fa-building",
|
||||||
|
|||||||
@@ -91,6 +91,7 @@ class Company(NestedSet):
|
|||||||
"Advance Payment Date", "Oldest Of Invoice Or Advance", "Reconciliation Date"
|
"Advance Payment Date", "Oldest Of Invoice Or Advance", "Reconciliation Date"
|
||||||
]
|
]
|
||||||
registration_details: DF.Code | None
|
registration_details: DF.Code | None
|
||||||
|
reporting_currency: DF.Link | None
|
||||||
rgt: DF.Int
|
rgt: DF.Int
|
||||||
round_off_account: DF.Link | None
|
round_off_account: DF.Link | None
|
||||||
round_off_cost_center: DF.Link | None
|
round_off_cost_center: DF.Link | None
|
||||||
@@ -153,6 +154,7 @@ class Company(NestedSet):
|
|||||||
self.check_parent_changed()
|
self.check_parent_changed()
|
||||||
self.set_chart_of_accounts()
|
self.set_chart_of_accounts()
|
||||||
self.validate_parent_company()
|
self.validate_parent_company()
|
||||||
|
self.set_reporting_currency()
|
||||||
|
|
||||||
def validate_abbr(self):
|
def validate_abbr(self):
|
||||||
if not self.abbr:
|
if not self.abbr:
|
||||||
@@ -490,6 +492,14 @@ class Company(NestedSet):
|
|||||||
if not is_group:
|
if not is_group:
|
||||||
frappe.throw(_("Parent Company must be a group company"))
|
frappe.throw(_("Parent Company must be a group company"))
|
||||||
|
|
||||||
|
def set_reporting_currency(self):
|
||||||
|
self.reporting_currency = self.default_currency
|
||||||
|
if self.parent_company:
|
||||||
|
parent_reporting_currency = frappe.db.get_value(
|
||||||
|
"Company", self.parent_company, ["reporting_currency"]
|
||||||
|
)
|
||||||
|
self.reporting_currency = parent_reporting_currency
|
||||||
|
|
||||||
def set_default_accounts(self):
|
def set_default_accounts(self):
|
||||||
default_accounts = {
|
default_accounts = {
|
||||||
"default_cash_account": "Cash",
|
"default_cash_account": "Cash",
|
||||||
@@ -681,7 +691,7 @@ class Company(NestedSet):
|
|||||||
frappe.db.sql("delete from tabBOM where company=%s", self.name)
|
frappe.db.sql("delete from tabBOM where company=%s", self.name)
|
||||||
for dt in ("BOM Operation", "BOM Item", "BOM Scrap Item", "BOM Explosion Item"):
|
for dt in ("BOM Operation", "BOM Item", "BOM Scrap Item", "BOM Explosion Item"):
|
||||||
frappe.db.sql(
|
frappe.db.sql(
|
||||||
"delete from `tab{}` where parent in ({})" "".format(dt, ", ".join(["%s"] * len(boms))),
|
"delete from `tab{}` where parent in ({})".format(dt, ", ".join(["%s"] * len(boms))),
|
||||||
tuple(boms),
|
tuple(boms),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user