Merge pull request #6659 from shreyasp/selling-price-validation
[Minor] Validate purchase price against selling price
diff --git a/erpnext/accounts/doctype/accounts_settings/accounts_settings.json b/erpnext/accounts/doctype/accounts_settings/accounts_settings.json
index c5b3e5b..c389b5c 100644
--- a/erpnext/accounts/doctype/accounts_settings/accounts_settings.json
+++ b/erpnext/accounts/doctype/accounts_settings/accounts_settings.json
@@ -10,6 +10,7 @@
"doctype": "DocType",
"document_type": "Other",
"editable_grid": 1,
+ "engine": "InnoDB",
"fields": [
{
"allow_on_submit": 0,
@@ -194,6 +195,33 @@
"search_index": 0,
"set_only_once": 0,
"unique": 0
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "default": "1",
+ "fieldname": "unlink_payment_on_cancellation_of_invoice",
+ "fieldtype": "Check",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "label": "Unlink Payment on Cancellation of Invoice",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "unique": 0
}
],
"hide_heading": 0,
@@ -207,8 +235,8 @@
"issingle": 1,
"istable": 0,
"max_attachments": 0,
- "modified": "2016-10-05 16:13:10.978208",
- "modified_by": "rohitw1991@gmail.com",
+ "modified": "2016-10-20 16:12:38.595075",
+ "modified_by": "Administrator",
"module": "Accounts",
"name": "Accounts Settings",
"owner": "Administrator",
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
index 042af0b..1c9bcbc 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
@@ -578,7 +578,8 @@
if not self.is_return:
from erpnext.accounts.utils import unlink_ref_doc_from_payment_entries
- unlink_ref_doc_from_payment_entries(self.doctype, self.name)
+ if frappe.db.get_single_value('Accounts Settings', 'unlink_payment_on_cancellation_of_invoice'):
+ unlink_ref_doc_from_payment_entries(self.doctype, self.name)
self.update_prevdoc_status()
self.update_billing_status_for_zero_amount_refdoc("Purchase Order")
diff --git a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py
index 4ea18ac..b4b8444 100644
--- a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py
+++ b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py
@@ -6,7 +6,7 @@
import unittest
import frappe
import frappe.model
-from frappe.utils import cint, flt, today
+from frappe.utils import cint, flt, today, nowdate
import frappe.defaults
from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import set_perpetual_inventory, \
test_records as pr_test_records
@@ -17,6 +17,12 @@
test_ignore = ["Serial No"]
class TestPurchaseInvoice(unittest.TestCase):
+ def setUp(self):
+ unlink_payment_on_cancel_of_invoice()
+
+ def tearDown(self):
+ unlink_payment_on_cancel_of_invoice(0)
+
def test_gl_entries_without_auto_accounting_for_stock(self):
set_perpetual_inventory(0)
self.assertTrue(not cint(frappe.defaults.get_global_default("auto_accounting_for_stock")))
@@ -55,6 +61,27 @@
set_perpetual_inventory(0)
+ def test_payment_entry_unlink_against_purchase_invoice(self):
+ from erpnext.accounts.doctype.payment_entry.test_payment_entry import get_payment_entry
+ unlink_payment_on_cancel_of_invoice(0)
+
+ pi_doc = make_purchase_invoice()
+
+ pe = get_payment_entry("Purchase Invoice", pi_doc.name, bank_account="_Test Bank - _TC")
+ pe.reference_no = "1"
+ pe.reference_date = nowdate()
+ pe.paid_from_account_currency = pi_doc.currency
+ pe.paid_to_account_currency = pi_doc.currency
+ pe.source_exchange_rate = 1
+ pe.target_exchange_rate = 1
+ pe.paid_amount = pi_doc.grand_total
+ pe.save(ignore_permissions=True)
+ pe.submit()
+
+ pi_doc = frappe.get_doc('Purchase Invoice', pi_doc.name)
+
+ self.assertRaises(frappe.LinkExistsError, pi_doc.cancel)
+
def test_gl_entries_with_auto_accounting_for_stock_against_pr(self):
set_perpetual_inventory(1)
self.assertEqual(cint(frappe.defaults.get_global_default("auto_accounting_for_stock")), 1)
@@ -411,6 +438,11 @@
self.assertEquals(frappe.db.get_value("Serial No", pi.get("items")[0].rejected_serial_no,
"warehouse"), pi.get("items")[0].rejected_warehouse)
+def unlink_payment_on_cancel_of_invoice(enable=1):
+ accounts_settings = frappe.get_doc("Accounts Settings")
+ accounts_settings.unlink_payment_on_cancellation_of_invoice = enable
+ accounts_settings.save()
+
def make_purchase_invoice(**args):
pi = frappe.new_doc("Purchase Invoice")
args = frappe._dict(args)
@@ -455,4 +487,4 @@
pi.submit()
return pi
-test_records = frappe.get_test_records('Purchase Invoice')
+test_records = frappe.get_test_records('Purchase Invoice')
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
index 3c46a16..521b0eb 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
@@ -136,7 +136,8 @@
self.check_close_sales_order("sales_order")
from erpnext.accounts.utils import unlink_ref_doc_from_payment_entries
- unlink_ref_doc_from_payment_entries(self.doctype, self.name)
+ if frappe.db.get_single_value('Accounts Settings', 'unlink_payment_on_cancellation_of_invoice'):
+ unlink_ref_doc_from_payment_entries(self.doctype, self.name)
if self.is_return:
# NOTE status updating bypassed for is_return
diff --git a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
index 1bb7b1c..83fc83c 100644
--- a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
@@ -4,8 +4,9 @@
import frappe
import unittest, copy
-from frappe.utils import nowdate, add_days, flt
+from frappe.utils import nowdate, add_days, flt, nowdate
from erpnext.stock.doctype.stock_entry.test_stock_entry import make_stock_entry, get_qty_after_transaction
+from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import unlink_payment_on_cancel_of_invoice
from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import set_perpetual_inventory
from erpnext.exceptions import InvalidAccountCurrency, InvalidCurrency
from erpnext.stock.doctype.serial_no.serial_no import SerialNoWarehouseError
@@ -19,6 +20,12 @@
w.submit()
return w
+ def setUp(self):
+ unlink_payment_on_cancel_of_invoice()
+
+ def tearDown(self):
+ unlink_payment_on_cancel_of_invoice(0)
+
def test_timestamp_change(self):
w = frappe.copy_doc(test_records[0])
w.docstatus = 0
@@ -78,6 +85,28 @@
self.assertEquals(si.base_grand_total, 1627.05)
self.assertEquals(si.grand_total, 1627.05)
+ def test_payment_entry_unlink_against_invoice(self):
+ from erpnext.accounts.doctype.payment_entry.test_payment_entry import get_payment_entry
+ si = frappe.copy_doc(test_records[0])
+ si.is_pos = 0
+ si.insert()
+ si.submit()
+
+ pe = get_payment_entry("Sales Invoice", si.name, bank_account="_Test Bank - _TC")
+ pe.reference_no = "1"
+ pe.reference_date = nowdate()
+ pe.paid_from_account_currency = si.currency
+ pe.paid_to_account_currency = si.currency
+ pe.source_exchange_rate = 1
+ pe.target_exchange_rate = 1
+ pe.paid_amount = si.grand_total
+ pe.insert()
+ pe.submit()
+
+ unlink_payment_on_cancel_of_invoice(0)
+ si = frappe.get_doc('Sales Invoice', si.name)
+ self.assertRaises(frappe.LinkExistsError, si.cancel)
+
def test_sales_invoice_calculation_export_currency(self):
si = frappe.copy_doc(test_records[2])
si.currency = "USD"
diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.json b/erpnext/buying/doctype/purchase_order/purchase_order.json
index 923a3ed..8177b57 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order.json
+++ b/erpnext/buying/doctype/purchase_order/purchase_order.json
@@ -9,11 +9,13 @@
"docstatus": 0,
"doctype": "DocType",
"document_type": "Document",
+ "editable_grid": 0,
"fields": [
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "supplier_section",
"fieldtype": "Section Break",
"hidden": 0,
@@ -39,6 +41,7 @@
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"default": "{supplier_name}",
"fieldname": "title",
"fieldtype": "Data",
@@ -65,6 +68,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "naming_series",
"fieldtype": "Select",
"hidden": 0,
@@ -92,6 +96,7 @@
"allow_on_submit": 0,
"bold": 1,
"collapsible": 0,
+ "columns": 0,
"description": "",
"fieldname": "supplier",
"fieldtype": "Link",
@@ -120,6 +125,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "eval:doc.supplier && doc.docstatus===0 && (!(doc.items && doc.items.length) || (doc.items.length==1 && !doc.items[0].item_code))",
"fieldname": "get_items_from_open_material_requests",
"fieldtype": "Button",
@@ -146,6 +152,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"default": "No",
"fieldname": "is_subcontracted",
"fieldtype": "Select",
@@ -172,6 +179,7 @@
"allow_on_submit": 0,
"bold": 1,
"collapsible": 0,
+ "columns": 0,
"fieldname": "supplier_name",
"fieldtype": "Data",
"hidden": 0,
@@ -196,6 +204,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "column_break1",
"fieldtype": "Column Break",
"hidden": 0,
@@ -222,6 +231,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"default": "Today",
"fieldname": "transaction_date",
"fieldtype": "Date",
@@ -249,6 +259,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "amended_from",
"fieldtype": "Link",
"hidden": 0,
@@ -276,6 +287,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"description": "",
"fieldname": "company",
"fieldtype": "Link",
@@ -305,6 +317,7 @@
"bold": 0,
"collapsible": 0,
"collapsible_depends_on": "",
+ "columns": 0,
"fieldname": "drop_ship",
"fieldtype": "Section Break",
"hidden": 0,
@@ -330,6 +343,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "",
"fieldname": "customer",
"fieldtype": "Link",
@@ -357,6 +371,7 @@
"allow_on_submit": 0,
"bold": 1,
"collapsible": 0,
+ "columns": 0,
"depends_on": "",
"fieldname": "customer_name",
"fieldtype": "Data",
@@ -383,6 +398,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "column_break_19",
"fieldtype": "Column Break",
"hidden": 0,
@@ -407,6 +423,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "",
"fieldname": "customer_contact_person",
"fieldtype": "Link",
@@ -434,6 +451,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "customer_contact_display",
"fieldtype": "Small Text",
"hidden": 1,
@@ -459,6 +477,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "customer_contact_mobile",
"fieldtype": "Small Text",
"hidden": 1,
@@ -484,6 +503,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "customer_contact_email",
"fieldtype": "Code",
"hidden": 1,
@@ -510,6 +530,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 1,
+ "columns": 0,
"fieldname": "section_addresses",
"fieldtype": "Section Break",
"hidden": 0,
@@ -535,6 +556,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "supplier_address",
"fieldtype": "Link",
"hidden": 0,
@@ -560,6 +582,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "contact_person",
"fieldtype": "Link",
"hidden": 0,
@@ -585,6 +608,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "",
"fieldname": "address_display",
"fieldtype": "Small Text",
@@ -610,6 +634,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "contact_display",
"fieldtype": "Small Text",
"hidden": 0,
@@ -634,6 +659,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "contact_mobile",
"fieldtype": "Small Text",
"hidden": 0,
@@ -658,6 +684,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "contact_email",
"fieldtype": "Small Text",
"hidden": 0,
@@ -682,6 +709,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "col_break_address",
"fieldtype": "Column Break",
"hidden": 0,
@@ -706,6 +734,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "",
"fieldname": "shipping_address",
"fieldtype": "Link",
@@ -733,6 +762,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "shipping_address_display",
"fieldtype": "Small Text",
"hidden": 0,
@@ -758,6 +788,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 1,
+ "columns": 0,
"fieldname": "currency_and_price_list",
"fieldtype": "Section Break",
"hidden": 0,
@@ -783,6 +814,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "currency",
"fieldtype": "Link",
"hidden": 0,
@@ -810,6 +842,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"description": "",
"fieldname": "conversion_rate",
"fieldtype": "Float",
@@ -838,6 +871,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "cb_price_list",
"fieldtype": "Column Break",
"hidden": 0,
@@ -861,6 +895,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "buying_price_list",
"fieldtype": "Link",
"hidden": 0,
@@ -886,6 +921,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "price_list_currency",
"fieldtype": "Link",
"hidden": 0,
@@ -911,6 +947,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "plc_conversion_rate",
"fieldtype": "Float",
"hidden": 0,
@@ -936,6 +973,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "ignore_pricing_rule",
"fieldtype": "Check",
"hidden": 0,
@@ -960,6 +998,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "items_section",
"fieldtype": "Section Break",
"hidden": 0,
@@ -986,6 +1025,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "items",
"fieldtype": "Table",
"hidden": 0,
@@ -1013,6 +1053,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "eval:doc.docstatus===0 && (doc.items && doc.items.length)",
"fieldname": "get_last_purchase_rate",
"fieldtype": "Button",
@@ -1039,6 +1080,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "sb_last_purchase",
"fieldtype": "Section Break",
"hidden": 0,
@@ -1062,6 +1104,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "base_total",
"fieldtype": "Currency",
"hidden": 0,
@@ -1088,6 +1131,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "base_net_total",
"fieldtype": "Currency",
"hidden": 0,
@@ -1115,6 +1159,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "column_break_26",
"fieldtype": "Column Break",
"hidden": 0,
@@ -1138,6 +1183,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "total",
"fieldtype": "Currency",
"hidden": 0,
@@ -1164,6 +1210,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "net_total",
"fieldtype": "Currency",
"hidden": 0,
@@ -1191,6 +1238,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "taxes_section",
"fieldtype": "Section Break",
"hidden": 0,
@@ -1217,6 +1265,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"description": "",
"fieldname": "taxes_and_charges",
"fieldtype": "Link",
@@ -1245,6 +1294,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "taxes",
"fieldtype": "Table",
"hidden": 0,
@@ -1272,6 +1322,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "other_charges_calculation",
"fieldtype": "HTML",
"hidden": 0,
@@ -1297,6 +1348,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "totals",
"fieldtype": "Section Break",
"hidden": 0,
@@ -1323,6 +1375,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "base_taxes_and_charges_added",
"fieldtype": "Currency",
"hidden": 0,
@@ -1350,6 +1403,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "base_taxes_and_charges_deducted",
"fieldtype": "Currency",
"hidden": 0,
@@ -1377,6 +1431,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "base_total_taxes_and_charges",
"fieldtype": "Currency",
"hidden": 0,
@@ -1404,6 +1459,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "column_break_39",
"fieldtype": "Column Break",
"hidden": 0,
@@ -1428,6 +1484,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "taxes_and_charges_added",
"fieldtype": "Currency",
"hidden": 0,
@@ -1455,6 +1512,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "taxes_and_charges_deducted",
"fieldtype": "Currency",
"hidden": 0,
@@ -1482,6 +1540,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "total_taxes_and_charges",
"fieldtype": "Currency",
"hidden": 0,
@@ -1509,6 +1568,7 @@
"bold": 0,
"collapsible": 1,
"collapsible_depends_on": "discount_amount",
+ "columns": 0,
"fieldname": "discount_section",
"fieldtype": "Section Break",
"hidden": 0,
@@ -1534,6 +1594,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"default": "Grand Total",
"fieldname": "apply_discount_on",
"fieldtype": "Select",
@@ -1561,6 +1622,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "base_discount_amount",
"fieldtype": "Currency",
"hidden": 0,
@@ -1587,6 +1649,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "column_break_45",
"fieldtype": "Column Break",
"hidden": 0,
@@ -1611,6 +1674,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "additional_discount_percentage",
"fieldtype": "Float",
"hidden": 0,
@@ -1636,6 +1700,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "discount_amount",
"fieldtype": "Currency",
"hidden": 0,
@@ -1662,6 +1727,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "totals_section",
"fieldtype": "Section Break",
"hidden": 0,
@@ -1686,6 +1752,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "base_grand_total",
"fieldtype": "Currency",
"hidden": 0,
@@ -1713,6 +1780,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"description": "In Words will be visible once you save the Purchase Order.",
"fieldname": "base_in_words",
"fieldtype": "Data",
@@ -1740,6 +1808,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "base_rounded_total",
"fieldtype": "Currency",
"hidden": 0,
@@ -1767,6 +1836,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "column_break4",
"fieldtype": "Column Break",
"hidden": 0,
@@ -1791,6 +1861,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "grand_total",
"fieldtype": "Currency",
"hidden": 0,
@@ -1818,6 +1889,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "in_words",
"fieldtype": "Data",
"hidden": 0,
@@ -1844,6 +1916,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "advance_paid",
"fieldtype": "Currency",
"hidden": 0,
@@ -1870,6 +1943,7 @@
"bold": 0,
"collapsible": 1,
"collapsible_depends_on": "terms",
+ "columns": 0,
"fieldname": "terms_section_break",
"fieldtype": "Section Break",
"hidden": 0,
@@ -1896,6 +1970,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "tc_name",
"fieldtype": "Link",
"hidden": 0,
@@ -1923,6 +1998,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "terms",
"fieldtype": "Text Editor",
"hidden": 0,
@@ -1949,6 +2025,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 1,
+ "columns": 0,
"fieldname": "more_info",
"fieldtype": "Section Break",
"hidden": 0,
@@ -1974,6 +2051,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"default": "Draft",
"fieldname": "status",
"fieldtype": "Select",
@@ -2002,6 +2080,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "ref_sq",
"fieldtype": "Data",
"hidden": 1,
@@ -2028,6 +2107,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "party_account_currency",
"fieldtype": "Link",
"hidden": 1,
@@ -2054,6 +2134,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "column_break_74",
"fieldtype": "Column Break",
"hidden": 0,
@@ -2078,6 +2159,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "eval:!doc.__islocal",
"description": "",
"fieldname": "per_received",
@@ -2106,6 +2188,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "eval:!doc.__islocal",
"description": "",
"fieldname": "per_billed",
@@ -2134,6 +2217,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 1,
+ "columns": 0,
"fieldname": "column_break5",
"fieldtype": "Section Break",
"hidden": 0,
@@ -2161,6 +2245,7 @@
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "letter_head",
"fieldtype": "Link",
"hidden": 0,
@@ -2188,6 +2273,7 @@
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "select_print_heading",
"fieldtype": "Link",
"hidden": 0,
@@ -2215,6 +2301,59 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
+ "fieldname": "column_break_86",
+ "fieldtype": "Column Break",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "unique": 0
+ },
+ {
+ "allow_on_submit": 1,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "description": "",
+ "fieldname": "group_same_items",
+ "fieldtype": "Check",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "label": "Group same items",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 1,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "unique": 0
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
"default": "",
"fieldname": "language",
"fieldtype": "Data",
@@ -2243,6 +2382,7 @@
"bold": 0,
"collapsible": 1,
"collapsible_depends_on": "supplied_items",
+ "columns": 0,
"description": "",
"fieldname": "raw_material_details",
"fieldtype": "Section Break",
@@ -2270,6 +2410,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "supplied_items",
"fieldtype": "Table",
"hidden": 0,
@@ -2298,6 +2439,7 @@
"bold": 0,
"collapsible": 1,
"collapsible_depends_on": "is_recurring",
+ "columns": 0,
"fieldname": "recurring_order",
"fieldtype": "Section Break",
"hidden": 0,
@@ -2323,6 +2465,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "column_break",
"fieldtype": "Column Break",
"hidden": 0,
@@ -2347,6 +2490,7 @@
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "eval:doc.docstatus<2",
"description": "",
"fieldname": "is_recurring",
@@ -2373,6 +2517,7 @@
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "is_recurring",
"description": "",
"fieldname": "recurring_id",
@@ -2400,6 +2545,7 @@
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "eval:doc.is_recurring && doc.recurring_id === doc.name",
"description": "",
"fieldname": "recurring_type",
@@ -2427,6 +2573,7 @@
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "eval:doc.is_recurring && doc.recurring_id === doc.name",
"description": "",
"fieldname": "repeat_on_day_of_month",
@@ -2453,6 +2600,7 @@
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "eval:doc.is_recurring && doc.recurring_id === doc.name",
"description": "",
"fieldname": "end_date",
@@ -2479,6 +2627,7 @@
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "eval:doc.is_recurring && doc.recurring_id === doc.name",
"fieldname": "submit_on_creation",
"fieldtype": "Check",
@@ -2505,6 +2654,7 @@
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "eval:doc.is_recurring && doc.recurring_id === doc.name",
"description": "",
"fieldname": "notify_by_email",
@@ -2532,6 +2682,7 @@
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "eval:doc.is_recurring && doc.notify_by_email && doc.recurring_id === doc.name",
"description": "",
"fieldname": "notification_email_address",
@@ -2559,6 +2710,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "eval:doc.is_recurring && doc.notify_by_email && doc.recurring_id === doc.name",
"fieldname": "recurring_print_format",
"fieldtype": "Link",
@@ -2586,6 +2738,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "column_break83",
"fieldtype": "Column Break",
"hidden": 0,
@@ -2610,6 +2763,7 @@
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "is_recurring",
"description": "",
"fieldname": "from_date",
@@ -2636,6 +2790,7 @@
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "is_recurring",
"description": "",
"fieldname": "to_date",
@@ -2662,6 +2817,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "is_recurring",
"description": "",
"fieldname": "next_date",
@@ -2696,7 +2852,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
- "modified": "2016-07-07 11:32:05.248626",
+ "modified": "2016-10-20 03:07:24.683178",
"modified_by": "Administrator",
"module": "Buying",
"name": "Purchase Order",
@@ -2712,6 +2868,7 @@
"export": 0,
"if_owner": 0,
"import": 0,
+ "is_custom": 0,
"permlevel": 0,
"print": 0,
"read": 1,
@@ -2732,6 +2889,7 @@
"export": 0,
"if_owner": 0,
"import": 0,
+ "is_custom": 0,
"permlevel": 0,
"print": 1,
"read": 1,
@@ -2752,6 +2910,7 @@
"export": 0,
"if_owner": 0,
"import": 0,
+ "is_custom": 0,
"permlevel": 0,
"print": 1,
"read": 1,
@@ -2772,6 +2931,7 @@
"export": 0,
"if_owner": 0,
"import": 0,
+ "is_custom": 0,
"permlevel": 1,
"print": 0,
"read": 1,
diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.py b/erpnext/buying/doctype/purchase_order/purchase_order.py
index 3230cd0..54ca07b 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order.py
+++ b/erpnext/buying/doctype/purchase_order/purchase_order.py
@@ -155,6 +155,30 @@
if date_diff and date_diff[0][0]:
msgprint(_("{0} {1} has been modified. Please refresh.").format(self.doctype, self.name),
raise_exception=True)
+
+ def before_print(self):
+ if self.get("group_same_items"):
+
+ group_item_qty = {}
+ group_item_amount = {}
+
+ for item in self.items:
+ group_item_qty[item.item_code] = group_item_qty.get(item.item_code, 0) + item.qty
+ group_item_amount[item.item_code] = group_item_amount.get(item.item_code, 0) + item.amount
+
+ duplicate_list = []
+
+ for item in self.items:
+ if item.item_code in group_item_qty:
+ item.qty = group_item_qty[item.item_code]
+ item.amount = group_item_amount[item.item_code]
+ del group_item_qty[item.item_code]
+ else:
+ duplicate_list.append(item)
+
+ for item in duplicate_list:
+ self.remove(item)
+
def update_status(self, status):
self.check_modified_date()
diff --git a/erpnext/buying/doctype/purchase_order/test_purchase_order.py b/erpnext/buying/doctype/purchase_order/test_purchase_order.py
index c24bcdc..d4a0d07 100644
--- a/erpnext/buying/doctype/purchase_order/test_purchase_order.py
+++ b/erpnext/buying/doctype/purchase_order/test_purchase_order.py
@@ -110,6 +110,37 @@
po.update_status("Closed")
self.assertEquals(get_ordered_qty(item_code="_Test Item", warehouse="_Test Warehouse - _TC"), existing_ordered_qty)
+
+ def test_group_same_items(self):
+ frappe.get_doc({
+ "doctype": "Purchase Order",
+ "company": "_Test Company",
+ "supplier" : "_Test Supplier",
+ "is_subcontracted" : "No",
+ "currency" : frappe.db.get_value("Company", "_Test Company", "default_currency"),
+ "conversion_factor" : 1,
+ "items" : get_same_items(),
+ "group_same_items": 1
+ }).insert()
+
+
+def get_same_items():
+ return [
+ {
+ "item_code": "_Test FG Item",
+ "warehouse": "_Test Warehouse - _TC",
+ "qty": 1,
+ "rate": 500,
+ "schedule_date": add_days(nowdate(), 1)
+ },
+ {
+ "item_code": "_Test FG Item",
+ "warehouse": "_Test Warehouse - _TC",
+ "qty": 4,
+ "rate": 500,
+ "schedule_date": add_days(nowdate(), 1)
+ }
+ ]
def create_purchase_order(**args):
po = frappe.new_doc("Purchase Order")
diff --git a/erpnext/demo/setup/setup_data.py b/erpnext/demo/setup/setup_data.py
index d279a64..f25bbc3 100644
--- a/erpnext/demo/setup/setup_data.py
+++ b/erpnext/demo/setup/setup_data.py
@@ -130,7 +130,7 @@
ss.from_date = e.date_of_joining if (e.date_of_joining
and e.date_of_joining > f.year_start_date) else f.year_start_date
ss.to_date = f.year_end_date
-
+ ss.payment_account = frappe.get_value('Account', {'account_type': 'Cash', 'company': erpnext.get_default_company(),'is_group':0}, "name")
ss.append('earnings', {
'salary_component': 'Basic',
"abbr":'B',
diff --git a/erpnext/demo/user/hr.py b/erpnext/demo/user/hr.py
index 2b80afb..2686987 100644
--- a/erpnext/demo/user/hr.py
+++ b/erpnext/demo/user/hr.py
@@ -1,5 +1,5 @@
from __future__ import unicode_literals
-import frappe
+import frappe, erpnext
import random
from frappe.utils import random_string, add_days, cint
from erpnext.projects.doctype.timesheet.test_timesheet import make_timesheet
@@ -24,18 +24,14 @@
process_payroll.company = frappe.flags.company
process_payroll.month = prev_month
process_payroll.fiscal_year = year
- process_payroll.create_sal_slip()
+ process_payroll.from_date = frappe.flags.current_date
+ process_payroll.to_date = add_days(frappe.flags.current_date, random.randint(0, 30))
+ process_payroll.reference_number = "DemoRef23"
+ process_payroll.reference_date = frappe.flags.current_date
+ process_payroll.payment_account = frappe.get_value('Account', {'account_type': 'Cash', 'company': erpnext.get_default_company(),'is_group':0}, "name")
process_payroll.submit_salary_slip()
- r = process_payroll.make_journal_entry(frappe.get_value('Account',
- {'account_name': 'Salary'}))
-
- journal_entry = frappe.get_doc(r)
- journal_entry.cheque_no = random_string(10)
- journal_entry.cheque_date = frappe.flags.current_date
- journal_entry.posting_date = frappe.flags.current_date
- journal_entry.insert()
- journal_entry.submit()
-
+ process_payroll.make_journal_entry()
+
if frappe.db.get_global('demo_hr_user'):
make_timesheet_records()
diff --git a/erpnext/docs/user/manual/en/accounts/setup/accounts-settings.md b/erpnext/docs/user/manual/en/accounts/setup/accounts-settings.md
index 5242b39..e920b65 100644
--- a/erpnext/docs/user/manual/en/accounts/setup/accounts-settings.md
+++ b/erpnext/docs/user/manual/en/accounts/setup/accounts-settings.md
@@ -7,4 +7,8 @@
* Credit Controller: Role that is allowed to submit transactions that exceed credit limits set.
+* Make Payment via Journal Entry: If checked, on invoice if uer has clicked on payment system open the journal entry else payment entry
+
+* Unlink Payment on Cancellation of Invoice: If checked system inlink the payment against the invoice else shows the link error.
+
{next}
\ No newline at end of file
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index 84312b8..e5cdb1a 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -339,4 +339,6 @@
erpnext.patches.v7_0.update_status_of_zero_amount_sales_order
erpnext.patches.v7_1.add_field_for_task_dependent
erpnext.patches.v7_0.repost_bin_qty_and_item_projected_qty
-erpnext.patches.v7_1.set_prefered_contact_email
\ No newline at end of file
+erpnext.patches.v7_1.set_prefered_contact_email
+execute:frappe.db.sql("update `tabSingles` set value = 1 where field = 'unlink_payment_on_cancellation_of_invoice' and doctype = 'Accounts Settings'")
+execute:frappe.db.sql("update `tabStock Entry` set total_amount = null where purpose in('Repack', 'Manufacture')")
\ No newline at end of file
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.json b/erpnext/stock/doctype/stock_entry/stock_entry.json
index 0ab80c2..8e31332 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.json
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.json
@@ -3,16 +3,20 @@
"allow_import": 1,
"allow_rename": 0,
"autoname": "naming_series:",
+ "beta": 0,
"creation": "2013-04-09 11:43:55",
"custom": 0,
"docstatus": 0,
"doctype": "DocType",
"document_type": "Document",
+ "editable_grid": 0,
+ "engine": "InnoDB",
"fields": [
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "items_section",
"fieldtype": "Section Break",
"hidden": 0,
@@ -38,6 +42,7 @@
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"default": "{purpose}",
"fieldname": "title",
"fieldtype": "Data",
@@ -64,6 +69,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "naming_series",
"fieldtype": "Select",
"hidden": 0,
@@ -91,6 +97,7 @@
"allow_on_submit": 0,
"bold": 1,
"collapsible": 0,
+ "columns": 0,
"default": "Material Issue",
"fieldname": "purpose",
"fieldtype": "Select",
@@ -119,6 +126,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "company",
"fieldtype": "Link",
"hidden": 0,
@@ -146,6 +154,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "eval:in_list([\"Material Transfer for Manufacture\", \"Manufacture\"], doc.purpose)",
"fieldname": "production_order",
"fieldtype": "Link",
@@ -174,6 +183,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "eval:doc.purpose==\"Subcontract\"",
"fieldname": "purchase_order",
"fieldtype": "Link",
@@ -201,6 +211,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "eval:doc.purpose==\"Sales Return\"",
"fieldname": "delivery_note_no",
"fieldtype": "Link",
@@ -229,6 +240,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "eval:doc.purpose==\"Sales Return\"",
"fieldname": "sales_invoice_no",
"fieldtype": "Link",
@@ -255,6 +267,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "eval:doc.purpose==\"Purchase Return\"",
"fieldname": "purchase_receipt_no",
"fieldtype": "Link",
@@ -283,6 +296,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "eval:in_list([\"Material Issue\", \"Material Transfer\", \"Manufacture\", \"Repack\", \t\t\t\t\t\"Subcontract\", \"Material Transfer for Manufacture\"], doc.purpose)",
"fieldname": "from_bom",
"fieldtype": "Check",
@@ -309,6 +323,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "col2",
"fieldtype": "Column Break",
"hidden": 0,
@@ -335,6 +350,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"default": "Today",
"fieldname": "posting_date",
"fieldtype": "Date",
@@ -362,6 +378,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "posting_time",
"fieldtype": "Time",
"hidden": 0,
@@ -388,6 +405,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "eval: doc.from_bom && (doc.purpose!==\"Sales Return\" && doc.purpose!==\"Purchase Return\")",
"fieldname": "sb1",
"fieldtype": "Section Break",
@@ -413,6 +431,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "from_bom",
"fieldname": "bom_no",
"fieldtype": "Link",
@@ -439,6 +458,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "from_bom",
"description": "As per Stock UOM",
"fieldname": "fg_completed_qty",
@@ -467,6 +487,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "cb1",
"fieldtype": "Column Break",
"hidden": 0,
@@ -490,6 +511,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"default": "1",
"depends_on": "from_bom",
"description": "Including items for sub assemblies",
@@ -517,6 +539,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "from_bom",
"fieldname": "get_items",
"fieldtype": "Button",
@@ -543,6 +566,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "section_break_12",
"fieldtype": "Section Break",
"hidden": 0,
@@ -567,6 +591,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "from_warehouse",
"fieldtype": "Link",
"hidden": 0,
@@ -594,6 +619,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "cb0",
"fieldtype": "Column Break",
"hidden": 0,
@@ -617,6 +643,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "to_warehouse",
"fieldtype": "Link",
"hidden": 0,
@@ -644,6 +671,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "sb0",
"fieldtype": "Section Break",
"hidden": 0,
@@ -668,6 +696,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "items",
"fieldtype": "Table",
"hidden": 0,
@@ -695,6 +724,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"description": "",
"fieldname": "get_stock_and_rate",
"fieldtype": "Button",
@@ -722,6 +752,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "section_break_19",
"fieldtype": "Section Break",
"hidden": 0,
@@ -746,6 +777,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "total_incoming_value",
"fieldtype": "Currency",
"hidden": 0,
@@ -772,6 +804,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "column_break_22",
"fieldtype": "Column Break",
"hidden": 0,
@@ -796,6 +829,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "total_outgoing_value",
"fieldtype": "Currency",
"hidden": 0,
@@ -822,6 +856,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "value_difference",
"fieldtype": "Currency",
"hidden": 0,
@@ -849,6 +884,7 @@
"bold": 0,
"collapsible": 1,
"collapsible_depends_on": "total_additional_costs",
+ "columns": 0,
"fieldname": "additional_costs_section",
"fieldtype": "Section Break",
"hidden": 0,
@@ -874,6 +910,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "additional_costs",
"fieldtype": "Table",
"hidden": 0,
@@ -900,6 +937,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "total_additional_costs",
"fieldtype": "Currency",
"hidden": 0,
@@ -926,6 +964,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 1,
+ "columns": 0,
"depends_on": "eval: in_list([\"Sales Return\", \"Purchase Return\", \"Subcontract\"], doc.purpose)",
"fieldname": "contact_section",
"fieldtype": "Section Break",
@@ -951,6 +990,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "eval:doc.purpose==\"Purchase Return\" || doc.purpose==\"Subcontract\"",
"fieldname": "supplier",
"fieldtype": "Link",
@@ -979,6 +1019,7 @@
"allow_on_submit": 0,
"bold": 1,
"collapsible": 0,
+ "columns": 0,
"depends_on": "eval:doc.purpose==\"Purchase Return\" || doc.purpose==\"Subcontract\"",
"fieldname": "supplier_name",
"fieldtype": "Data",
@@ -1006,6 +1047,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "eval:doc.purpose==\"Purchase Return\" || doc.purpose==\"Subcontract\"",
"fieldname": "supplier_address",
"fieldtype": "Small Text",
@@ -1033,6 +1075,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "column_break_39",
"fieldtype": "Column Break",
"hidden": 0,
@@ -1057,6 +1100,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "eval:doc.purpose==\"Sales Return\"",
"fieldname": "customer",
"fieldtype": "Link",
@@ -1085,6 +1129,7 @@
"allow_on_submit": 0,
"bold": 1,
"collapsible": 0,
+ "columns": 0,
"depends_on": "eval:doc.purpose==\"Sales Return\"",
"fieldname": "customer_name",
"fieldtype": "Data",
@@ -1112,6 +1157,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "eval:doc.purpose==\"Sales Return\"",
"fieldname": "customer_address",
"fieldtype": "Small Text",
@@ -1139,6 +1185,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 1,
+ "columns": 0,
"fieldname": "printing_settings",
"fieldtype": "Section Break",
"hidden": 0,
@@ -1164,6 +1211,7 @@
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "select_print_heading",
"fieldtype": "Link",
"hidden": 0,
@@ -1191,6 +1239,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "letter_head",
"fieldtype": "Link",
"hidden": 0,
@@ -1217,6 +1266,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 1,
+ "columns": 0,
"fieldname": "more_info",
"fieldtype": "Section Break",
"hidden": 0,
@@ -1242,6 +1292,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "project",
"fieldtype": "Link",
"hidden": 0,
@@ -1268,6 +1319,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "remarks",
"fieldtype": "Text",
"hidden": 0,
@@ -1294,6 +1346,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "col5",
"fieldtype": "Column Break",
"hidden": 0,
@@ -1319,6 +1372,8 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
+ "depends_on": "total_amount",
"fieldname": "total_amount",
"fieldtype": "Currency",
"hidden": 0,
@@ -1332,7 +1387,7 @@
"options": "Company:company:default_currency",
"permlevel": 0,
"print_hide": 0,
- "print_hide_if_no_value": 0,
+ "print_hide_if_no_value": 1,
"read_only": 1,
"report_hide": 0,
"reqd": 0,
@@ -1344,6 +1399,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "amended_from",
"fieldtype": "Link",
"hidden": 0,
@@ -1371,6 +1427,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "credit_note",
"fieldtype": "Link",
"hidden": 1,
@@ -1398,13 +1455,14 @@
"hide_toolbar": 0,
"icon": "icon-file-text",
"idx": 1,
+ "image_view": 0,
"in_create": 0,
"in_dialog": 0,
"is_submittable": 1,
"issingle": 0,
"istable": 0,
"max_attachments": 0,
- "modified": "2016-09-08 06:40:03.284036",
+ "modified": "2016-10-19 16:11:22.110926",
"modified_by": "Administrator",
"module": "Stock",
"name": "Stock Entry",
@@ -1420,6 +1478,7 @@
"export": 0,
"if_owner": 0,
"import": 0,
+ "is_custom": 0,
"permlevel": 0,
"print": 1,
"read": 1,
@@ -1440,6 +1499,7 @@
"export": 0,
"if_owner": 0,
"import": 0,
+ "is_custom": 0,
"permlevel": 0,
"print": 1,
"read": 1,
@@ -1460,6 +1520,7 @@
"export": 0,
"if_owner": 0,
"import": 0,
+ "is_custom": 0,
"permlevel": 0,
"print": 1,
"read": 1,
@@ -1480,6 +1541,7 @@
"export": 0,
"if_owner": 0,
"import": 0,
+ "is_custom": 0,
"permlevel": 0,
"print": 1,
"read": 1,
@@ -1491,6 +1553,7 @@
"write": 1
}
],
+ "quick_entry": 0,
"read_only": 0,
"read_only_onload": 0,
"search_fields": "posting_date, from_warehouse, to_warehouse, purpose, remarks",
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py
index 44782d5..ec3873e 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.py
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.py
@@ -319,7 +319,9 @@
self.value_difference = self.total_incoming_value - self.total_outgoing_value
def set_total_amount(self):
- self.total_amount = sum([flt(item.amount) for item in self.get("items")])
+ self.total_amount = None
+ if self.purpose not in ['Manufacture', 'Repack']:
+ self.total_amount = sum([flt(item.amount) for item in self.get("items")])
def validate_purchase_order(self):
"""Throw exception if more raw material is transferred against Purchase Order than in