Merge branch 'develop' into taxjar-nexus-display-condition
This commit is contained in:
commit
802d583031
@ -3,7 +3,8 @@
|
|||||||
|
|
||||||
{% include "erpnext/public/js/controllers/accounts.js" %}
|
{% include "erpnext/public/js/controllers/accounts.js" %}
|
||||||
|
|
||||||
frappe.ui.form.on("POS Profile", "onload", function(frm) {
|
frappe.ui.form.on('POS Profile', {
|
||||||
|
setup: function(frm) {
|
||||||
frm.set_query("selling_price_list", function() {
|
frm.set_query("selling_price_list", function() {
|
||||||
return { filters: { selling: 1 } };
|
return { filters: { selling: 1 } };
|
||||||
});
|
});
|
||||||
@ -15,10 +16,7 @@ frappe.ui.form.on("POS Profile", "onload", function(frm) {
|
|||||||
erpnext.queries.setup_queries(frm, "Warehouse", function() {
|
erpnext.queries.setup_queries(frm, "Warehouse", function() {
|
||||||
return erpnext.queries.warehouse(frm.doc);
|
return erpnext.queries.warehouse(frm.doc);
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
frappe.ui.form.on('POS Profile', {
|
|
||||||
setup: function(frm) {
|
|
||||||
frm.set_query("print_format", function() {
|
frm.set_query("print_format", function() {
|
||||||
return {
|
return {
|
||||||
filters: [
|
filters: [
|
||||||
@ -27,10 +25,16 @@ frappe.ui.form.on('POS Profile', {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
frm.set_query("account_for_change_amount", function() {
|
frm.set_query("account_for_change_amount", function(doc) {
|
||||||
|
if (!doc.company) {
|
||||||
|
frappe.throw(__('Please set Company'));
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
filters: {
|
filters: {
|
||||||
account_type: ['in', ["Cash", "Bank"]]
|
account_type: ['in', ["Cash", "Bank"]],
|
||||||
|
is_group: 0,
|
||||||
|
company: doc.company
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
@ -45,7 +49,7 @@ frappe.ui.form.on('POS Profile', {
|
|||||||
});
|
});
|
||||||
|
|
||||||
frm.set_query('company_address', function(doc) {
|
frm.set_query('company_address', function(doc) {
|
||||||
if(!doc.company) {
|
if (!doc.company) {
|
||||||
frappe.throw(__('Please set Company'));
|
frappe.throw(__('Please set Company'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,11 +62,79 @@ frappe.ui.form.on('POS Profile', {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
frm.set_query('income_account', function(doc) {
|
||||||
|
if (!doc.company) {
|
||||||
|
frappe.throw(__('Please set Company'));
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
filters: {
|
||||||
|
'is_group': 0,
|
||||||
|
'company': doc.company,
|
||||||
|
'account_type': "Income Account"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
frm.set_query('cost_center', function(doc) {
|
||||||
|
if (!doc.company) {
|
||||||
|
frappe.throw(__('Please set Company'));
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
filters: {
|
||||||
|
'company': doc.company,
|
||||||
|
'is_group': 0
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
frm.set_query('expense_account', function(doc) {
|
||||||
|
if (!doc.company) {
|
||||||
|
frappe.throw(__('Please set Company'));
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
filters: {
|
||||||
|
"report_type": "Profit and Loss",
|
||||||
|
"company": doc.company,
|
||||||
|
"is_group": 0
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
frm.set_query("select_print_heading", function() {
|
||||||
|
return {
|
||||||
|
filters: [
|
||||||
|
['Print Heading', 'docstatus', '!=', 2]
|
||||||
|
]
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
frm.set_query("write_off_account", function(doc) {
|
||||||
|
return {
|
||||||
|
filters: {
|
||||||
|
'report_type': 'Profit and Loss',
|
||||||
|
'is_group': 0,
|
||||||
|
'company': doc.company
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
frm.set_query("write_off_cost_center", function(doc) {
|
||||||
|
return {
|
||||||
|
filters: {
|
||||||
|
'is_group': 0,
|
||||||
|
'company': doc.company
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
erpnext.accounts.dimensions.setup_dimension_filters(frm, frm.doctype);
|
erpnext.accounts.dimensions.setup_dimension_filters(frm, frm.doctype);
|
||||||
},
|
},
|
||||||
|
|
||||||
refresh: function(frm) {
|
refresh: function(frm) {
|
||||||
if(frm.doc.company) {
|
if (frm.doc.company) {
|
||||||
frm.trigger("toggle_display_account_head");
|
frm.trigger("toggle_display_account_head");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -76,71 +148,4 @@ frappe.ui.form.on('POS Profile', {
|
|||||||
frm.toggle_display('expense_account',
|
frm.toggle_display('expense_account',
|
||||||
erpnext.is_perpetual_inventory_enabled(frm.doc.company));
|
erpnext.is_perpetual_inventory_enabled(frm.doc.company));
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
|
||||||
// Income Account
|
|
||||||
// --------------------------------
|
|
||||||
cur_frm.fields_dict['income_account'].get_query = function(doc,cdt,cdn) {
|
|
||||||
return{
|
|
||||||
filters:{
|
|
||||||
'is_group': 0,
|
|
||||||
'company': doc.company,
|
|
||||||
'account_type': "Income Account"
|
|
||||||
}
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// Cost Center
|
|
||||||
// -----------------------------
|
|
||||||
cur_frm.fields_dict['cost_center'].get_query = function(doc,cdt,cdn) {
|
|
||||||
return{
|
|
||||||
filters:{
|
|
||||||
'company': doc.company,
|
|
||||||
'is_group': 0
|
|
||||||
}
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// Expense Account
|
|
||||||
// -----------------------------
|
|
||||||
cur_frm.fields_dict["expense_account"].get_query = function(doc) {
|
|
||||||
return {
|
|
||||||
filters: {
|
|
||||||
"report_type": "Profit and Loss",
|
|
||||||
"company": doc.company,
|
|
||||||
"is_group": 0
|
|
||||||
}
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
// ------------------ Get Print Heading ------------------------------------
|
|
||||||
cur_frm.fields_dict['select_print_heading'].get_query = function(doc, cdt, cdn) {
|
|
||||||
return{
|
|
||||||
filters:[
|
|
||||||
['Print Heading', 'docstatus', '!=', 2]
|
|
||||||
]
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
cur_frm.fields_dict.write_off_account.get_query = function(doc) {
|
|
||||||
return{
|
|
||||||
filters:{
|
|
||||||
'report_type': 'Profit and Loss',
|
|
||||||
'is_group': 0,
|
|
||||||
'company': doc.company
|
|
||||||
}
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
// Write off cost center
|
|
||||||
// -----------------------
|
|
||||||
cur_frm.fields_dict.write_off_cost_center.get_query = function(doc) {
|
|
||||||
return{
|
|
||||||
filters:{
|
|
||||||
'is_group': 0,
|
|
||||||
'company': doc.company
|
|
||||||
}
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
@ -12,6 +12,10 @@ frappe.ui.form.on("Company", {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
frm.call('check_if_transactions_exist').then(r => {
|
||||||
|
frm.toggle_enable("default_currency", (!r.message));
|
||||||
|
});
|
||||||
},
|
},
|
||||||
setup: function(frm) {
|
setup: function(frm) {
|
||||||
erpnext.company.setup_queries(frm);
|
erpnext.company.setup_queries(frm);
|
||||||
@ -87,9 +91,6 @@ frappe.ui.form.on("Company", {
|
|||||||
|
|
||||||
frappe.dynamic_link = {doc: frm.doc, fieldname: 'name', doctype: 'Company'}
|
frappe.dynamic_link = {doc: frm.doc, fieldname: 'name', doctype: 'Company'}
|
||||||
|
|
||||||
frm.toggle_enable("default_currency", (frm.doc.__onload &&
|
|
||||||
!frm.doc.__onload.transactions_exist));
|
|
||||||
|
|
||||||
if (frappe.perm.has_perm("Cost Center", 0, 'read')) {
|
if (frappe.perm.has_perm("Cost Center", 0, 'read')) {
|
||||||
frm.add_custom_button(__('Cost Centers'), function() {
|
frm.add_custom_button(__('Cost Centers'), function() {
|
||||||
frappe.set_route('Tree', 'Cost Center', {'company': frm.doc.name});
|
frappe.set_route('Tree', 'Cost Center', {'company': frm.doc.name});
|
||||||
|
@ -22,8 +22,8 @@ class Company(NestedSet):
|
|||||||
|
|
||||||
def onload(self):
|
def onload(self):
|
||||||
load_address_and_contact(self, "company")
|
load_address_and_contact(self, "company")
|
||||||
self.get("__onload")["transactions_exist"] = self.check_if_transactions_exist()
|
|
||||||
|
|
||||||
|
@frappe.whitelist()
|
||||||
def check_if_transactions_exist(self):
|
def check_if_transactions_exist(self):
|
||||||
exists = False
|
exists = False
|
||||||
for doctype in ["Sales Invoice", "Delivery Note", "Sales Order", "Quotation",
|
for doctype in ["Sales Invoice", "Delivery Note", "Sales Order", "Quotation",
|
||||||
|
@ -1315,7 +1315,7 @@
|
|||||||
"idx": 146,
|
"idx": 146,
|
||||||
"is_submittable": 1,
|
"is_submittable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2021-10-08 14:29:13.428984",
|
"modified": "2021-10-09 14:29:13.428984",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Stock",
|
"module": "Stock",
|
||||||
"name": "Delivery Note",
|
"name": "Delivery Note",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user