mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-26 13:25:20 +00:00
Merge branch 'develop' of https://github.com/frappe/erpnext into fix-incorrect-translations
This commit is contained in:
@@ -4,6 +4,15 @@
|
||||
frappe.provide("erpnext.company");
|
||||
|
||||
frappe.ui.form.on("Company", {
|
||||
onload: function(frm) {
|
||||
if (frm.doc.__islocal && frm.doc.parent_company) {
|
||||
frappe.db.get_value('Company', frm.doc.parent_company, 'is_group', (r) => {
|
||||
if (!r.is_group) {
|
||||
frm.set_value('parent_company', '');
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
setup: function(frm) {
|
||||
erpnext.company.setup_queries(frm);
|
||||
frm.set_query("hra_component", function(){
|
||||
|
||||
@@ -47,6 +47,7 @@ class Company(NestedSet):
|
||||
self.validate_perpetual_inventory()
|
||||
self.check_country_change()
|
||||
self.set_chart_of_accounts()
|
||||
self.validate_parent_company()
|
||||
|
||||
def validate_abbr(self):
|
||||
if not self.abbr:
|
||||
@@ -189,6 +190,13 @@ class Company(NestedSet):
|
||||
self.create_chart_of_accounts_based_on = "Existing Company"
|
||||
self.existing_company = self.parent_company
|
||||
|
||||
def validate_parent_company(self):
|
||||
if self.parent_company:
|
||||
is_group = frappe.get_value('Company', self.parent_company, 'is_group')
|
||||
|
||||
if not is_group:
|
||||
frappe.throw(_("Parent Company must be a group company"))
|
||||
|
||||
def set_default_accounts(self):
|
||||
default_accounts = {
|
||||
"default_cash_account": "Cash",
|
||||
|
||||
@@ -119,7 +119,7 @@ def get_product_list_for_group(product_group=None, start=0, limit=10, search=Non
|
||||
or I.name like %(search)s)"""
|
||||
search = "%" + cstr(search) + "%"
|
||||
|
||||
query += """order by I.weightage desc, in_stock desc, I.modified desc limit %s, %s""" % (start, limit)
|
||||
query += """order by I.weightage desc, in_stock desc, I.modified desc limit %s, %s""" % (cint(start), cint(limit))
|
||||
|
||||
data = frappe.db.sql(query, {"product_group": product_group,"search": search, "today": nowdate()}, as_dict=1)
|
||||
data = adjust_qty_for_expired_items(data)
|
||||
|
||||
Reference in New Issue
Block a user