Merge pull request #6579 from PawanMeh/fixes_6567
[fix] #6567
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
index d741a60..042af0b 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
@@ -71,7 +71,7 @@
frappe.throw(_("Cash or Bank Account is mandatory for making payment entry"))
if flt(self.paid_amount) + flt(self.write_off_amount) \
- - flt(self.base_grand_total) > 1/(10**(self.precision("base_grand_total") + 1)):
+ - flt(self.grand_total) > 1/(10**(self.precision("base_grand_total") + 1)):
frappe.throw(_("""Paid amount + Write Off Amount can not be greater than Grand Total"""))
def create_remarks(self):
diff --git a/erpnext/accounts/page/pos/pos.js b/erpnext/accounts/page/pos/pos.js
index 668b377..5f38116 100644
--- a/erpnext/accounts/page/pos/pos.js
+++ b/erpnext/accounts/page/pos/pos.js
@@ -93,7 +93,7 @@
me.get_data_from_server(function(){
me.load_data(false);
me.make_customer();
- me.make_item_list(true);
+ me.make_item_list();
me.set_missing_values();
})
});
@@ -266,7 +266,7 @@
make: function() {
this.make_search();
this.make_customer();
- this.make_item_list(true);
+ this.make_item_list();
this.make_discount_field()
},
@@ -287,7 +287,7 @@
this.search.$input.on("keyup", function() {
setTimeout(function() {
me.items = me.get_items();
- me.make_item_list(false);
+ me.make_item_list();
}, 1000);
});
@@ -363,7 +363,7 @@
}
},
- make_item_list: function(index_search) {
+ make_item_list: function() {
var me = this;
if(!this.price_list) {
msgprint(__("Price List not found or disabled"));
@@ -377,7 +377,7 @@
if (this.items) {
$.each(this.items, function(index, obj) {
- if(!index_search || index < 16){
+ if(index < 30){
$(frappe.render_template("pos_item", {
item_code: obj.name,
item_price: format_currency(obj.price_list_rate, obj.currency),
@@ -423,7 +423,7 @@
key = this.search.$input.val().toLowerCase();
var re = new RegExp('%', 'g');
- var reg = new RegExp(key.replace(re, '\\w*\\s*[a-zA-Z0-9]*'))
+ var reg = new RegExp(key.replace(re, '[\\w*\\s*[a-zA-Z0-9]*]*'))
search_status = true
if(key){
diff --git a/erpnext/controllers/taxes_and_totals.py b/erpnext/controllers/taxes_and_totals.py
index d8b5e2e..2369143 100644
--- a/erpnext/controllers/taxes_and_totals.py
+++ b/erpnext/controllers/taxes_and_totals.py
@@ -338,7 +338,7 @@
tax.item_wise_tax_detail = json.dumps(tax.item_wise_tax_detail, separators=(',', ':'))
def set_discount_amount(self):
- if not self.doc.discount_amount and self.doc.additional_discount_percentage:
+ if self.doc.additional_discount_percentage:
self.doc.discount_amount = flt(flt(self.doc.get(scrub(self.doc.apply_discount_on)))
* self.doc.additional_discount_percentage / 100, self.doc.precision("discount_amount"))
diff --git a/erpnext/manufacturing/doctype/production_order/production_order.py b/erpnext/manufacturing/doctype/production_order/production_order.py
index 250d6e6..8234e2e 100644
--- a/erpnext/manufacturing/doctype/production_order/production_order.py
+++ b/erpnext/manufacturing/doctype/production_order/production_order.py
@@ -58,7 +58,8 @@
if so[0].project:
self.project = so[0].project
- self.validate_production_order_against_so()
+ if not self.material_request:
+ self.validate_production_order_against_so()
else:
frappe.throw(_("Sales Order {0} is not valid").format(self.sales_order))
diff --git a/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py b/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py
index 5fbcf1e..1e6c48a 100644
--- a/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py
+++ b/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py
@@ -454,20 +454,21 @@
material_request.update({"material_request_type": item_wrapper.default_material_request_type})
for sales_order, requested_qty in items_to_be_requested[item].items():
- material_request.append("items", {
- "doctype": "Material Request Item",
- "__islocal": 1,
- "item_code": item,
- "item_name": item_wrapper.item_name,
- "description": item_wrapper.description,
- "uom": item_wrapper.stock_uom,
- "item_group": item_wrapper.item_group,
- "brand": item_wrapper.brand,
- "qty": requested_qty,
- "schedule_date": add_days(nowdate(), cint(item_wrapper.lead_time_days)),
- "warehouse": self.purchase_request_for_warehouse,
- "sales_order": sales_order if sales_order!="No Sales Order" else None
- })
+ if sales_order != 'No Sales Order':
+ material_request.append("items", {
+ "doctype": "Material Request Item",
+ "__islocal": 1,
+ "item_code": item,
+ "item_name": item_wrapper.item_name,
+ "description": item_wrapper.description,
+ "uom": item_wrapper.stock_uom,
+ "item_group": item_wrapper.item_group,
+ "brand": item_wrapper.brand,
+ "qty": requested_qty,
+ "schedule_date": add_days(nowdate(), cint(item_wrapper.lead_time_days)),
+ "warehouse": self.purchase_request_for_warehouse,
+ "sales_order": sales_order if sales_order!="No Sales Order" else None
+ })
material_request.flags.ignore_permissions = 1
material_request.submit()