Merge pull request #30206 from deepeshgarg007/implicit_pricing_rule_enable

fix: Do not update ignore prcing rule check implicitly
diff --git a/.github/workflows/patch.yml b/.github/workflows/patch.yml
index d05bbbe..afabe43 100644
--- a/.github/workflows/patch.yml
+++ b/.github/workflows/patch.yml
@@ -4,7 +4,10 @@
   pull_request:
     paths-ignore:
       - '**.js'
+      - '**.css'
       - '**.md'
+      - '**.html'
+      - '**.csv'
   workflow_dispatch:
 
 concurrency:
diff --git a/.github/workflows/server-tests-mariadb.yml b/.github/workflows/server-tests-mariadb.yml
index 40f9365..69be765 100644
--- a/.github/workflows/server-tests-mariadb.yml
+++ b/.github/workflows/server-tests-mariadb.yml
@@ -4,8 +4,10 @@
   pull_request:
     paths-ignore:
       - '**.js'
+      - '**.css'
       - '**.md'
       - '**.html'
+      - '**.csv'
   push:
     branches: [ develop ]
     paths-ignore:
diff --git a/.mergify.yml b/.mergify.yml
index b7d1df4..315d90f 100644
--- a/.mergify.yml
+++ b/.mergify.yml
@@ -7,6 +7,8 @@
           - author!=gavindsouza
           - author!=rohitwaghchaure
           - author!=nabinhait
+          - author!=ankush
+          - author!=deepeshgarg007
         - or:
           - base=version-13
           - base=version-12
diff --git a/erpnext/accounts/report/trial_balance_for_party/trial_balance_for_party.py b/erpnext/accounts/report/trial_balance_for_party/trial_balance_for_party.py
index d843dfd..70effce 100644
--- a/erpnext/accounts/report/trial_balance_for_party/trial_balance_for_party.py
+++ b/erpnext/accounts/report/trial_balance_for_party/trial_balance_for_party.py
@@ -107,6 +107,7 @@
 		select party, sum(debit) as opening_debit, sum(credit) as opening_credit
 		from `tabGL Entry`
 		where company=%(company)s
+			and is_cancelled=0
 			and ifnull(party_type, '') = %(party_type)s and ifnull(party, '') != ''
 			and (posting_date < %(from_date)s or ifnull(is_opening, 'No') = 'Yes')
 			{account_filter}
@@ -133,6 +134,7 @@
 		select party, sum(debit) as debit, sum(credit) as credit
 		from `tabGL Entry`
 		where company=%(company)s
+			and is_cancelled = 0
 			and ifnull(party_type, '') = %(party_type)s and ifnull(party, '') != ''
 			and posting_date >= %(from_date)s and posting_date <= %(to_date)s
 			and ifnull(is_opening, 'No') = 'No'
diff --git a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.json b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.json
index 023c95d..567e41f 100644
--- a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.json
+++ b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.json
@@ -72,8 +72,8 @@
   "section_break_46",
   "base_grand_total",
   "base_rounding_adjustment",
-  "base_in_words",
   "base_rounded_total",
+  "base_in_words",
   "column_break4",
   "grand_total",
   "rounding_adjustment",
@@ -635,6 +635,7 @@
    "fieldname": "rounded_total",
    "fieldtype": "Currency",
    "label": "Rounded Total",
+   "options": "currency",
    "read_only": 1
   },
   {
@@ -810,7 +811,7 @@
  "index_web_pages_for_search": 1,
  "is_submittable": 1,
  "links": [],
- "modified": "2021-12-11 06:43:20.924080",
+ "modified": "2022-03-14 16:13:20.284572",
  "modified_by": "Administrator",
  "module": "Buying",
  "name": "Supplier Quotation",
@@ -875,6 +876,7 @@
  "show_name_in_global_search": 1,
  "sort_field": "modified",
  "sort_order": "DESC",
+ "states": [],
  "timeline_field": "supplier",
  "title_field": "title"
 }
\ No newline at end of file
diff --git a/erpnext/manufacturing/doctype/bom/bom.py b/erpnext/manufacturing/doctype/bom/bom.py
index a025ff7..15fa67b 100644
--- a/erpnext/manufacturing/doctype/bom/bom.py
+++ b/erpnext/manufacturing/doctype/bom/bom.py
@@ -170,6 +170,7 @@
 			frappe.throw(_("Please select a Company first."), title=_("Mandatory"))
 
 		self.clear_operations()
+		self.clear_inspection()
 		self.validate_main_item()
 		self.validate_currency()
 		self.set_conversion_rate()
@@ -425,6 +426,10 @@
 		if not self.with_operations:
 			self.set('operations', [])
 
+	def clear_inspection(self):
+		if not self.inspection_required:
+			self.quality_inspection_template = None
+
 	def validate_main_item(self):
 		""" Validate main FG item"""
 		item = self.get_item_det(self.item)
diff --git a/erpnext/manufacturing/doctype/bom/test_bom.py b/erpnext/manufacturing/doctype/bom/test_bom.py
index 4417123..2f9b9de 100644
--- a/erpnext/manufacturing/doctype/bom/test_bom.py
+++ b/erpnext/manufacturing/doctype/bom/test_bom.py
@@ -6,7 +6,6 @@
 from functools import partial
 
 import frappe
-from frappe.test_runner import make_test_records
 from frappe.tests.utils import FrappeTestCase
 from frappe.utils import cstr, flt
 
@@ -20,12 +19,9 @@
 from erpnext.tests.test_subcontracting import set_backflush_based_on
 
 test_records = frappe.get_test_records('BOM')
+test_dependencies = ["Item", "Quality Inspection Template"]
 
 class TestBOM(FrappeTestCase):
-	def setUp(self):
-		if not frappe.get_value('Item', '_Test Item'):
-			make_test_records('Item')
-
 	def test_get_items(self):
 		from erpnext.manufacturing.doctype.bom.bom import get_bom_items_as_dict
 		items_dict = get_bom_items_as_dict(bom=get_default_bom(),
@@ -495,6 +491,24 @@
 		self.assertNotEqual(amendment.name, version.name)
 		self.assertEqual(int(version.name.split("-")[-1]), 2)
 
+	def test_clear_inpection_quality(self):
+
+		bom = frappe.copy_doc(test_records[2], ignore_no_copy=True)
+		bom.docstatus = 0
+		bom.is_default = 0
+		bom.quality_inspection_template = "_Test Quality Inspection Template"
+		bom.inspection_required = 1
+		bom.save()
+		bom.reload()
+
+		self.assertEqual(bom.quality_inspection_template, '_Test Quality Inspection Template')
+
+		bom.inspection_required = 0
+		bom.save()
+		bom.reload()
+
+		self.assertEqual(bom.quality_inspection_template, None)
+
 
 def get_default_bom(item_code="_Test FG Item 2"):
 	return frappe.db.get_value("BOM", {"item": item_code, "is_active": 1, "is_default": 1})
diff --git a/erpnext/manufacturing/doctype/production_plan/test_production_plan.py b/erpnext/manufacturing/doctype/production_plan/test_production_plan.py
index eeab788..6425374 100644
--- a/erpnext/manufacturing/doctype/production_plan/test_production_plan.py
+++ b/erpnext/manufacturing/doctype/production_plan/test_production_plan.py
@@ -655,6 +655,17 @@
 		]
 		self.assertFalse(pp.all_items_completed())
 
+	def test_production_plan_planned_qty(self):
+		pln = create_production_plan(item_code="_Test FG Item", planned_qty=0.55)
+		pln.make_work_order()
+		work_order = frappe.db.get_value('Work Order', {'production_plan': pln.name}, 'name')
+		wo_doc = frappe.get_doc('Work Order', work_order)
+		wo_doc.update({
+			'wip_warehouse': 'Work In Progress - _TC',
+			'fg_warehouse': 'Finished Goods - _TC'
+		})
+		wo_doc.submit()
+		self.assertEqual(wo_doc.qty, 0.55)
 
 def create_production_plan(**args):
 	"""
diff --git a/erpnext/manufacturing/doctype/work_order/work_order.py b/erpnext/manufacturing/doctype/work_order/work_order.py
index 8ec80ad..7eb40ec 100644
--- a/erpnext/manufacturing/doctype/work_order/work_order.py
+++ b/erpnext/manufacturing/doctype/work_order/work_order.py
@@ -647,12 +647,12 @@
 		if self.production_plan and self.production_plan_item:
 			qty_dict = frappe.db.get_value("Production Plan Item", self.production_plan_item, ["planned_qty", "ordered_qty"], as_dict=1)
 
-			allowance_qty =flt(frappe.db.get_single_value("Manufacturing Settings",
+			allowance_qty = flt(frappe.db.get_single_value("Manufacturing Settings",
 			"overproduction_percentage_for_work_order"))/100 * qty_dict.get("planned_qty", 0)
 
 			max_qty = qty_dict.get("planned_qty", 0) + allowance_qty - qty_dict.get("ordered_qty", 0)
 
-			if max_qty < 1:
+			if not max_qty > 0:
 				frappe.throw(_("Cannot produce more item for {0}")
 				.format(self.production_item), OverProductionError)
 			elif self.qty > max_qty:
diff --git a/erpnext/stock/doctype/quality_inspection_template/test_records.json b/erpnext/stock/doctype/quality_inspection_template/test_records.json
new file mode 100644
index 0000000..980f49a
--- /dev/null
+++ b/erpnext/stock/doctype/quality_inspection_template/test_records.json
@@ -0,0 +1,13 @@
+[
+ {
+     "quality_inspection_template_name" : "_Test Quality Inspection Template",
+     "doctype": "Quality Inspection Template",
+     "item_quality_inspection_parameter" : [
+           {
+            "specification": "_Test Param",
+            "doctype": "Item Quality Inspection Parameter",
+            "parentfield": "item_quality_inspection_parameter"
+           }
+     ]
+ }
+]
diff --git a/erpnext/stock/doctype/stock_settings/stock_settings.js b/erpnext/stock/doctype/stock_settings/stock_settings.js
index cc0e2cf..89ac4b5 100644
--- a/erpnext/stock/doctype/stock_settings/stock_settings.js
+++ b/erpnext/stock/doctype/stock_settings/stock_settings.js
@@ -13,5 +13,24 @@
 
 		frm.set_query("default_warehouse", filters);
 		frm.set_query("sample_retention_warehouse", filters);
+	},
+	allow_negative_stock: function(frm) {
+		if (!frm.doc.allow_negative_stock) {
+			return;
+		}
+
+		let msg = __("Using negative stock disables FIFO/Moving average valuation when inventory is negative.");
+		msg += " ";
+		msg += __("This is considered dangerous from accounting point of view.")
+		msg += "<br>";
+		msg += ("Do you still want to enable negative inventory?");
+
+		frappe.confirm(
+			msg,
+			() => {},
+			() => {
+				frm.set_value("allow_negative_stock", 0);
+			}
+		);
 	}
 });
diff --git a/erpnext/translations/de.csv b/erpnext/translations/de.csv
index b882b9d..b53e5a1 100644
--- a/erpnext/translations/de.csv
+++ b/erpnext/translations/de.csv
@@ -987,15 +987,15 @@
 Expected End Date,Voraussichtliches Enddatum,
 Expected Hrs,Erwartete Stunden,
 Expected Start Date,Voraussichtliches Startdatum,
-Expense,Auslage,
+Expense,Aufwand,
 Expense / Difference account ({0}) must be a 'Profit or Loss' account,"Aufwands-/Differenz-Konto ({0}) muss ein ""Gewinn oder Verlust""-Konto sein",
 Expense Account,Aufwandskonto,
-Expense Claim,Aufwandsabrechnung,
+Expense Claim,Auslagenabrechnung,
 Expense Claim for Vehicle Log {0},Auslagenabrechnung für Fahrtenbuch {0},
 Expense Claim {0} already exists for the Vehicle Log,Auslagenabrechnung {0} existiert bereits für das Fahrzeug Log,
 Expense Claims,Aufwandsabrechnungen,
 Expense account is mandatory for item {0},Aufwandskonto ist zwingend für Artikel {0},
-Expenses,Ausgaben,
+Expenses,Aufwendungen,
 Expenses Included In Asset Valuation,"Aufwendungen, die in der Vermögensbewertung enthalten sind",
 Expenses Included In Valuation,In der Bewertung enthaltene Aufwendungen,
 Expired Batches,Abgelaufene Chargen,