Merge pull request #1798 from nabinhait/v4-hotfix
Account common get_query
This commit is contained in:
commit
ff367c7b31
@ -52,9 +52,8 @@ class BuyingController(StockController):
|
||||
validate_warehouse_company(w, self.company)
|
||||
|
||||
def validate_stock_or_nonstock_items(self):
|
||||
if not self.get_stock_items():
|
||||
tax_for_valuation = [d.account_head for d in
|
||||
self.get("other_charges")
|
||||
if self.meta.get_field("other_charges") and not self.get_stock_items():
|
||||
tax_for_valuation = [d.account_head for d in self.get("other_charges")
|
||||
if d.category in ["Valuation", "Valuation and Total"]]
|
||||
if tax_for_valuation:
|
||||
frappe.throw(_("Tax Category can not be 'Valuation' or 'Valuation and Total' as all items are non-stock items"))
|
||||
|
@ -236,13 +236,21 @@ def get_batch_no(doctype, txt, searchfield, start, page_len, filters):
|
||||
'page_len': page_len})
|
||||
|
||||
def get_account_list(doctype, txt, searchfield, start, page_len, filters):
|
||||
if isinstance(filters, dict):
|
||||
if not filters.get("group_or_ledger"):
|
||||
filters["group_or_ledger"] = "Ledger"
|
||||
elif isinstance(filters, list):
|
||||
if "group_or_ledger" not in [d[0] for d in filters]:
|
||||
filters.append(["Account", "group_or_ledger", "=", "Ledger"])
|
||||
filter_list = []
|
||||
|
||||
return frappe.widgets.reportview.execute("Account", filters = filters,
|
||||
if isinstance(filters, dict):
|
||||
for key, val in filters.items():
|
||||
if isinstance(val, (list, tuple)):
|
||||
filter_list.append([doctype, key, val[0], val[1]])
|
||||
else:
|
||||
filter_list.append([doctype, key, "=", val])
|
||||
|
||||
if "group_or_ledger" not in [d[1] for d in filter_list]:
|
||||
filter_list.append(["Account", "group_or_ledger", "=", "Ledger"])
|
||||
|
||||
if searchfield and txt:
|
||||
filter_list.append([doctype, searchfield, "like", "%%%s%%" % txt])
|
||||
|
||||
return frappe.widgets.reportview.execute("Account", filters = filter_list,
|
||||
fields = ["name", "parent_account"],
|
||||
limit_start=start, limit_page_length=page_len, as_list=True)
|
||||
|
@ -118,10 +118,10 @@ cur_frm.fields_dict['transporter_name'].get_query = function(doc) {
|
||||
}
|
||||
|
||||
cur_frm.cscript['Make Packing Slip'] = function() {
|
||||
n = frappe.model.make_new_doc_and_get_name('Packing Slip');
|
||||
ps = locals["Packing Slip"][n];
|
||||
ps.delivery_note = cur_frm.doc.name;
|
||||
loaddoc('Packing Slip', n);
|
||||
frappe.model.open_mapped_doc({
|
||||
method: "erpnext.stock.doctype.delivery_note.delivery_note.make_packing_slip",
|
||||
frm: cur_frm
|
||||
})
|
||||
}
|
||||
|
||||
var set_print_hide= function(doc, cdt, cdn){
|
||||
|
@ -346,3 +346,19 @@ def make_installation_note(source_name, target_doc=None):
|
||||
}, target_doc)
|
||||
|
||||
return doclist
|
||||
|
||||
@frappe.whitelist()
|
||||
def make_packing_slip(source_name, target_doc=None):
|
||||
doclist = get_mapped_doc("Delivery Note", source_name, {
|
||||
"Delivery Note": {
|
||||
"doctype": "Packing Slip",
|
||||
"field_map": {
|
||||
"name": "delivery_note"
|
||||
},
|
||||
"validation": {
|
||||
"docstatus": ["=", 0]
|
||||
}
|
||||
}
|
||||
}, target_doc)
|
||||
|
||||
return doclist
|
||||
|
@ -48,7 +48,7 @@ class MaterialRequest(BuyingController):
|
||||
|
||||
def validate_schedule_date(self):
|
||||
for d in self.get('indent_details'):
|
||||
if d.schedule_date < self.transaction_date:
|
||||
if d.schedule_date and d.schedule_date < self.transaction_date:
|
||||
frappe.throw(_("Expected Date cannot be before Material Request Date"))
|
||||
|
||||
# Validate
|
||||
|
@ -18,7 +18,7 @@ cur_frm.fields_dict['item_details'].grid.get_field('item_code').get_query =
|
||||
|
||||
cur_frm.cscript.onload_post_render = function(doc, cdt, cdn) {
|
||||
if(doc.delivery_note && doc.__islocal) {
|
||||
cur_frm.cscript.get_items(doc, cdt, cdn);
|
||||
cur_frm.cscript.get_items(doc, cdt, cdn);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -255,7 +255,7 @@ def apply_pricing_rule(args):
|
||||
|
||||
args = frappe._dict(args)
|
||||
out = frappe._dict()
|
||||
if not args.get("item_code"): return
|
||||
if args.get("doctype") == "Material Request" or not args.get("item_code"): return out
|
||||
|
||||
if not args.get("item_group") or not args.get("brand"):
|
||||
args.item_group, args.brand = frappe.db.get_value("Item",
|
||||
|
Loading…
x
Reference in New Issue
Block a user