Merge branch 'version-12-hotfix' into fixed-incorrect-balance-qty-in-stock-ledger

This commit is contained in:
Deepesh Garg
2020-07-12 17:21:25 +05:30
committed by GitHub
5 changed files with 236 additions and 228 deletions

View File

@@ -322,7 +322,9 @@ def apply_internal_priority(pricing_rules, field_set, args):
filtered_rules = [] filtered_rules = []
for field in field_set: for field in field_set:
if args.get(field): if args.get(field):
filtered_rules = filter(lambda x: x[field]==args[field], pricing_rules) # filter function always returns a filter object even if empty
# list conversion is necessary to check for an empty result
filtered_rules = list(filter(lambda x: x.get(field)==args.get(field), pricing_rules))
if filtered_rules: break if filtered_rules: break
return filtered_rules or pricing_rules return filtered_rules or pricing_rules

View File

@@ -123,14 +123,14 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend(
} }
if(doc.status != "Closed") { if(doc.status != "Closed") {
if (doc.status != "On Hold") { if (doc.status != "On Hold") {
if(flt(doc.per_received, 2) < 100 && allow_receipt) { if(flt(doc.per_received) < 100 && allow_receipt) {
cur_frm.add_custom_button(__('Receipt'), this.make_purchase_receipt, __('Create')); cur_frm.add_custom_button(__('Receipt'), this.make_purchase_receipt, __('Create'));
if(doc.is_subcontracted==="Yes" && me.has_unsupplied_items()) { if(doc.is_subcontracted==="Yes" && me.has_unsupplied_items()) {
cur_frm.add_custom_button(__('Material to Supplier'), cur_frm.add_custom_button(__('Material to Supplier'),
function() { me.make_stock_entry(); }, __("Transfer")); function() { me.make_stock_entry(); }, __("Transfer"));
} }
} }
if(flt(doc.per_billed, 2) < 100) if(flt(doc.per_billed) < 100)
cur_frm.add_custom_button(__('Invoice'), cur_frm.add_custom_button(__('Invoice'),
this.make_purchase_invoice, __('Create')); this.make_purchase_invoice, __('Create'));

View File

@@ -19,6 +19,7 @@
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0, "columns": 0,
"default": "0",
"fieldname": "from_amount", "fieldname": "from_amount",
"fieldtype": "Currency", "fieldtype": "Currency",
"hidden": 0, "hidden": 0,
@@ -83,6 +84,7 @@
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"columns": 0, "columns": 0,
"default": "0",
"fieldname": "percent_deduction", "fieldname": "percent_deduction",
"fieldtype": "Percent", "fieldtype": "Percent",
"hidden": 0, "hidden": 0,
@@ -214,7 +216,7 @@
"issingle": 0, "issingle": 0,
"istable": 1, "istable": 1,
"max_attachments": 0, "max_attachments": 0,
"modified": "2018-06-19 10:10:23.732132", "modified": "2020-06-22 18:16:07.596493",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "HR", "module": "HR",
"name": "Taxable Salary Slab", "name": "Taxable Salary Slab",

View File

@@ -443,19 +443,23 @@ def generate_ewb_json(dt, dn):
@frappe.whitelist() @frappe.whitelist()
def download_ewb_json(): def download_ewb_json():
data = frappe._dict(frappe.local.form_dict) data = json.loads(frappe.local.form_dict.data)
frappe.local.response.filecontent = json.dumps(data, indent=4, sort_keys=True)
frappe.local.response.filecontent = json.dumps(data['data'], indent=4, sort_keys=True)
frappe.local.response.type = 'download' frappe.local.response.type = 'download'
billList = json.loads(data['data'])['billLists'] filename_prefix = 'Bulk'
docname = frappe.local.form_dict.docname
if docname:
if docname.startswith('['):
docname = json.loads(docname)
if len(docname) == 1:
docname = docname[0]
if len(billList) > 1: if not isinstance(docname, list):
doc_name = 'Bulk' # removes characters not allowed in a filename (https://stackoverflow.com/a/38766141/4767738)
else: filename_prefix = re.sub('[^\w_.)( -]', '', docname)
doc_name = data['docname']
frappe.local.response.filename = '{0}_e-WayBill_Data_{1}.json'.format(doc_name, frappe.utils.random_string(5)) frappe.local.response.filename = '{0}_e-WayBill_Data_{1}.json'.format(filename_prefix, frappe.utils.random_string(5))
@frappe.whitelist() @frappe.whitelist()
def get_gstins_for_company(company): def get_gstins_for_company(company):

View File

@@ -21,7 +21,7 @@ def execute(filters=None):
for cd in consumed_details.get(item_code): for cd in consumed_details.get(item_code):
if (cd.voucher_no not in material_transfer_vouchers): if (cd.voucher_no not in material_transfer_vouchers):
if cd.voucher_type=="Delivery Note": if cd.voucher_type in ["Delivery Note", "Sales Invoice"]:
delivered_qty += abs(flt(cd.actual_qty)) delivered_qty += abs(flt(cd.actual_qty))
delivered_amount += abs(flt(cd.stock_value_difference)) delivered_amount += abs(flt(cd.stock_value_difference))
elif cd.voucher_type!="Delivery Note": elif cd.voucher_type!="Delivery Note":