Merge branch 'develop' into FR_ISS_204290

This commit is contained in:
Afshan
2020-06-25 14:16:35 +05:30
committed by GitHub
29 changed files with 440 additions and 488 deletions

View File

@@ -264,7 +264,10 @@ erpnext.company.setup_queries = function(frm) {
["expenses_included_in_valuation",
{"root_type": "Expense", "account_type": "Expenses Included in Valuation"}],
["stock_received_but_not_billed",
{"root_type": "Liability", "account_type": "Stock Received But Not Billed"}]
{"root_type": "Liability", "account_type": "Stock Received But Not Billed"}],
["service_received_but_not_billed",
{"root_type": "Liability", "account_type": "Service Received But Not Billed"}],
], function(i, v) {
erpnext.company.set_custom_query(frm, v);
});

View File

@@ -66,10 +66,12 @@
"payment_terms",
"auto_accounting_for_stock_settings",
"enable_perpetual_inventory",
"enable_perpetual_inventory_for_non_stock_items",
"default_inventory_account",
"stock_adjustment_account",
"column_break_32",
"stock_received_but_not_billed",
"service_received_but_not_billed",
"expenses_included_in_valuation",
"fixed_asset_depreciation_settings",
"accumulated_depreciation_account",
@@ -717,6 +719,20 @@
"fieldtype": "Link",
"label": "Default Buying Terms",
"options": "Terms and Conditions"
},
{
"fieldname": "service_received_but_not_billed",
"fieldtype": "Link",
"ignore_user_permissions": 1,
"label": "Service Received But Not Billed",
"no_copy": 1,
"options": "Account"
},
{
"default": "0",
"fieldname": "enable_perpetual_inventory_for_non_stock_items",
"fieldtype": "Check",
"label": "Enable Perpetual Inventory For Non Stock Items"
}
],
"icon": "fa fa-building",

View File

@@ -46,6 +46,7 @@ class Company(NestedSet):
self.validate_currency()
self.validate_coa_input()
self.validate_perpetual_inventory()
self.validate_perpetual_inventory_for_non_stock_items()
self.check_country_change()
self.set_chart_of_accounts()
self.validate_parent_company()
@@ -182,6 +183,12 @@ class Company(NestedSet):
frappe.msgprint(_("Set default inventory account for perpetual inventory"),
alert=True, indicator='orange')
def validate_perpetual_inventory_for_non_stock_items(self):
if not self.get("__islocal"):
if cint(self.enable_perpetual_inventory_for_non_stock_items) == 1 and not self.service_received_but_not_billed:
frappe.throw(_("Set default {0} account for perpetual inventory for non stock items").format(
frappe.bold('Service Received But Not Billed')))
def check_country_change(self):
frappe.flags.country_change = False

View File

@@ -8,7 +8,7 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
cur_frm.cscript.set_root_readonly = function(doc) {
// read-only for root customer group
if(!doc.parent_customer_group) {
if(!doc.parent_customer_group && !doc.__islocal) {
cur_frm.set_read_only();
cur_frm.set_intro(__("This is a root customer group and cannot be edited."));
} else {
@@ -20,7 +20,8 @@ cur_frm.cscript.set_root_readonly = function(doc) {
cur_frm.fields_dict['parent_customer_group'].get_query = function(doc,cdt,cdn) {
return {
filters: {
'is_group': 1
'is_group': 1,
'name': ['!=', cur_frm.doc.customer_group_name]
}
}
}

View File

@@ -66,7 +66,7 @@ frappe.ui.form.on("Item Group", {
set_root_readonly: function(frm) {
// read-only for root item group
frm.set_intro("");
if(!frm.doc.parent_item_group) {
if(!frm.doc.parent_item_group && !frm.doc.__islocal) {
frm.set_read_only();
frm.set_intro(__("This is a root item group and cannot be edited."), true);
}

View File

@@ -19,7 +19,7 @@ frappe.ui.form.on('Sales Person', {
}
}
};
frm.make_methods = {
'Sales Order': () => frappe.new_doc("Sales Order")
.then(() => frm.add_child("sales_team", {"sales_person": frm.doc.name}))
@@ -33,7 +33,7 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
cur_frm.cscript.set_root_readonly = function(doc) {
// read-only for root
if(!doc.parent_sales_person) {
if(!doc.parent_sales_person && !doc.__islocal) {
cur_frm.set_read_only();
cur_frm.set_intro(__("This is a root sales person and cannot be edited."));
} else {

View File

@@ -8,7 +8,7 @@ cur_frm.cscript.refresh = function(doc) {
cur_frm.cscript.set_root_readonly = function(doc) {
// read-only for root customer group
if(!doc.parent_supplier_group) {
if(!doc.parent_supplier_group && !doc.__islocal) {
cur_frm.set_read_only();
cur_frm.set_intro(__("This is a root supplier group and cannot be edited."));
} else {
@@ -20,7 +20,8 @@ cur_frm.cscript.set_root_readonly = function(doc) {
cur_frm.fields_dict['parent_supplier_group'].get_query = function() {
return {
filters: {
'is_group': 1
'is_group': 1,
'name': ['!=', cur_frm.doc.supplier_group_name]
}
};
};

View File

@@ -20,7 +20,7 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
cur_frm.cscript.set_root_readonly = function(doc) {
// read-only for root territory
if(!doc.parent_territory) {
if(!doc.parent_territory && !doc.__islocal) {
cur_frm.set_read_only();
cur_frm.set_intro(__("This is a root territory and cannot be edited."));
} else {