[fix] warehouse validation for parent_account

This commit is contained in:
Rushabh Mehta
2016-07-04 17:03:01 +05:30
parent bc10431b7d
commit 1d797f717b
5 changed files with 27 additions and 11 deletions

View File

@@ -39,6 +39,7 @@ frappe.ui.form.on("Request for Quotation",{
refresh: function(frm, cdt, cdn) { refresh: function(frm, cdt, cdn) {
if (frm.doc.docstatus === 1) { if (frm.doc.docstatus === 1) {
frm.dashboard.show_dashboard();
frm.add_custom_button(__("Make"), frm.add_custom_button(__("Make"),
function(){ frm.trigger("make_suppplier_quotation") }, __("Supplier Quotation")); function(){ frm.trigger("make_suppplier_quotation") }, __("Supplier Quotation"));

View File

@@ -0,0 +1,14 @@
from frappe import _
links = {
'fieldname': 'supplier_quotation',
# 'non_standard_fieldnames': {
# 'Purchase Order': 'prevdoc_detail_docname',
# },
'transactions': [
{
'label': _('Related Documents'),
'items': ['Supplier Quotation', 'Purchase Order']
},
]
}

View File

@@ -43,8 +43,6 @@ erpnext.buying.MaterialRequestController = erpnext.buying.BuyingController.exten
var me = this; var me = this;
this._super(); this._super();
this.frm.dashboard.reset();
if(doc.docstatus==0) { if(doc.docstatus==0) {
cur_frm.add_custom_button(__("Get Items from BOM"), cur_frm.add_custom_button(__("Get Items from BOM"),
cur_frm.cscript.get_items_from_bom, "icon-sitemap", "btn-default"); cur_frm.cscript.get_items_from_bom, "icon-sitemap", "btn-default");

View File

@@ -3,12 +3,11 @@ from frappe import _
links = { links = {
'fieldname': 'material_request', 'fieldname': 'material_request',
'non_standard_fieldnames': { 'non_standard_fieldnames': {
'Supplier Quotation': 'prevdoc_detail_docname',
'Purchase Order': 'prevdoc_detail_docname', 'Purchase Order': 'prevdoc_detail_docname',
}, },
'transactions': [ 'transactions': [
{ {
'label': _('Documents'), 'label': _('Related Documents'),
'items': ['Request for Quotation', 'Supplier Quotation', 'Purchase Order'] 'items': ['Request for Quotation', 'Supplier Quotation', 'Purchase Order']
}, },
] ]

View File

@@ -94,6 +94,11 @@ class Warehouse(NestedSet):
frappe.db.set_value("Warehouse", self.name, "create_account_under", parent_account[0][0]) frappe.db.set_value("Warehouse", self.name, "create_account_under", parent_account[0][0])
self.create_account_under = parent_account[0][0] self.create_account_under = parent_account[0][0]
else: else:
# did not find parent, add it to root Assets
# let the user figure.
self.create_account_under = frappe.db.get_all('Account',
filters = {'company': self.company, 'is_group': 1,
'parent_account': '', 'root_type': 'Asset'}, limit=1)[0].name
frappe.throw(_("Please enter parent account group for warehouse {0}").format(self.name)) frappe.throw(_("Please enter parent account group for warehouse {0}").format(self.name))
elif frappe.db.get_value("Account", self.create_account_under, "company") != self.company: elif frappe.db.get_value("Account", self.create_account_under, "company") != self.company:
frappe.throw(_("Warehouse {0}: Parent account {1} does not bolong to the company {2}") frappe.throw(_("Warehouse {0}: Parent account {1} does not bolong to the company {2}")
@@ -292,4 +297,3 @@ def add_node():
def convert_to_group_or_ledger(): def convert_to_group_or_ledger():
args = frappe.form_dict args = frappe.form_dict
return frappe.get_doc("Warehouse", args.docname).convert_to_group_or_ledger() return frappe.get_doc("Warehouse", args.docname).convert_to_group_or_ledger()