Merge pull request #6723 from rohitwaghchaure/enhancement_remember_last_selected_value
Remember last selected value for link field
diff --git a/erpnext/__init__.py b/erpnext/__init__.py
index fc52f5a..9d71908 100644
--- a/erpnext/__init__.py
+++ b/erpnext/__init__.py
@@ -2,7 +2,7 @@
from __future__ import unicode_literals
import frappe
-__version__ = '7.1.1'
+__version__ = '7.1.6'
def get_default_company(user=None):
'''Get default company for user'''
diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.py b/erpnext/accounts/doctype/journal_entry/journal_entry.py
index 083ba6f..145ed81 100644
--- a/erpnext/accounts/doctype/journal_entry/journal_entry.py
+++ b/erpnext/accounts/doctype/journal_entry/journal_entry.py
@@ -763,7 +763,8 @@
return {
"account": account,
"balance": account_balance,
- "party_balance": party_balance
+ "party_balance": party_balance,
+ "account_currency": frappe.db.get_value("Account", account, "account_currency")
}
@frappe.whitelist()
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
index 1c9bcbc..22de07f 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
@@ -305,25 +305,8 @@
if not self.grand_total:
return
- self.auto_accounting_for_stock = \
- cint(frappe.defaults.get_global_default("auto_accounting_for_stock"))
-
- self.stock_received_but_not_billed = self.get_company_default("stock_received_but_not_billed")
- self.expenses_included_in_valuation = self.get_company_default("expenses_included_in_valuation")
- self.negative_expense_to_be_booked = 0.0
- gl_entries = []
-
-
- self.make_supplier_gl_entry(gl_entries)
- self.make_item_gl_entries(gl_entries)
- self.make_tax_gl_entries(gl_entries)
-
- gl_entries = merge_similar_entries(gl_entries)
-
- self.make_payment_gl_entries(gl_entries)
-
- self.make_write_off_gl_entry(gl_entries)
-
+ gl_entries = self.get_gl_entries()
+
if gl_entries:
update_outstanding = "No" if (cint(self.is_paid) or self.write_off_account) else "Yes"
@@ -342,6 +325,26 @@
elif self.docstatus == 2 and cint(self.update_stock) and self.auto_accounting_for_stock:
delete_gl_entries(voucher_type=self.doctype, voucher_no=self.name)
+ def get_gl_entries(self, warehouse_account=None):
+ self.auto_accounting_for_stock = \
+ cint(frappe.defaults.get_global_default("auto_accounting_for_stock"))
+
+ self.stock_received_but_not_billed = self.get_company_default("stock_received_but_not_billed")
+ self.expenses_included_in_valuation = self.get_company_default("expenses_included_in_valuation")
+ self.negative_expense_to_be_booked = 0.0
+ gl_entries = []
+
+
+ self.make_supplier_gl_entry(gl_entries)
+ self.make_item_gl_entries(gl_entries)
+ self.make_tax_gl_entries(gl_entries)
+
+ gl_entries = merge_similar_entries(gl_entries)
+
+ self.make_payment_gl_entries(gl_entries)
+ self.make_write_off_gl_entry(gl_entries)
+
+ return gl_entries
def make_supplier_gl_entry(self, gl_entries):
if self.grand_total:
diff --git a/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json b/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json
index dd46e76..7be5a24 100644
--- a/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json
+++ b/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json
@@ -572,7 +572,7 @@
"columns": 0,
"depends_on": "eval:doc.margin_type && doc.price_list_rate",
"fieldname": "total_margin",
- "fieldtype": "Float",
+ "fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
@@ -1724,7 +1724,7 @@
"issingle": 0,
"istable": 1,
"max_attachments": 0,
- "modified": "2016-08-26 04:48:29.142409",
+ "modified": "2016-11-01 13:01:58.844818",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Sales Invoice Item",
diff --git a/erpnext/accounts/page/pos/pos.js b/erpnext/accounts/page/pos/pos.js
index f43a436..4c13fe3 100644
--- a/erpnext/accounts/page/pos/pos.js
+++ b/erpnext/accounts/page/pos/pos.js
@@ -392,7 +392,7 @@
if(index < 30){
$(frappe.render_template("pos_item", {
item_code: obj.name,
- item_price: format_currency(obj.price_list_rate, obj.currency),
+ item_price: format_currency(obj.price_list_rate, me.frm.doc.currency),
item_name: obj.name===obj.item_name ? "" : obj.item_name,
item_image: obj.image ? "url('" + obj.image + "')" : null,
color: frappe.get_palette(obj.item_name),
diff --git a/erpnext/buying/doctype/request_for_quotation/request_for_quotation.py b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.py
index 78af1ef..802888d 100644
--- a/erpnext/buying/doctype/request_for_quotation/request_for_quotation.py
+++ b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.py
@@ -131,7 +131,8 @@
def send_email(self, data, sender, subject, message, attachments):
make(subject = subject, content=message,recipients=data.email_id,
- sender=sender,attachments = attachments, send_email=True)["name"]
+ sender=sender,attachments = attachments, send_email=True,
+ doctype=self.doctype, name=self.name)["name"]
frappe.msgprint(_("Email sent to supplier {0}").format(data.supplier))
diff --git a/erpnext/crm/doctype/opportunity/opportunity_dashboard.py b/erpnext/crm/doctype/opportunity/opportunity_dashboard.py
index 5fc8302..40ff6d0 100644
--- a/erpnext/crm/doctype/opportunity/opportunity_dashboard.py
+++ b/erpnext/crm/doctype/opportunity/opportunity_dashboard.py
@@ -3,6 +3,9 @@
def get_data():
return {
'fieldname': 'prevdoc_docname',
+ 'non_standard_fieldnames': {
+ 'Supplier Quotation': 'opportunity',
+ },
'transactions': [
{
'label': _('Related'),
diff --git a/erpnext/demo/setup/manufacture.py b/erpnext/demo/setup/manufacture.py
index 8ac2039..24ffd92 100644
--- a/erpnext/demo/setup/manufacture.py
+++ b/erpnext/demo/setup/manufacture.py
@@ -63,7 +63,10 @@
for i in items:
item = frappe.new_doc('Item')
item.update(i)
- item.default_warehouse = frappe.get_all('Warehouse', filters={'warehouse_name': item.default_warehouse}, limit=1)[0].name
+ if item.default_warehouse:
+ warehouse = frappe.get_all('Warehouse', filters={'warehouse_name': item.default_warehouse}, limit=1)
+ if warehouse:
+ item.default_warehouse = warehouse[0].name
item.insert()
def setup_product_bundle():
diff --git a/erpnext/demo/setup/setup_data.py b/erpnext/demo/setup/setup_data.py
index f25bbc3..278c398 100644
--- a/erpnext/demo/setup/setup_data.py
+++ b/erpnext/demo/setup/setup_data.py
@@ -41,9 +41,9 @@
setup_complete({
"first_name": "Test",
"last_name": "User",
- "email": "test_demo@erpnext.com",
+ "email": "demo@erpnext.com",
"company_tagline": 'Awesome Products and Services',
- "password": "test",
+ "password": "demo",
"fy_start_date": "2015-01-01",
"fy_end_date": "2015-12-31",
"bank_account": "National Bank",
diff --git a/erpnext/demo/user/stock.py b/erpnext/demo/user/stock.py
index ac380f2..ea23853 100644
--- a/erpnext/demo/user/stock.py
+++ b/erpnext/demo/user/stock.py
@@ -85,9 +85,10 @@
def submit_draft_stock_entries():
from erpnext.stock.doctype.stock_entry.stock_entry import IncorrectValuationRateError, \
- DuplicateEntryForProductionOrderError, OperationsNotCompleteError
+ DuplicateEntryForProductionOrderError, OperationsNotCompleteError
# try posting older drafts (if exists)
+ frappe.db.commit()
for st in frappe.db.get_values("Stock Entry", {"docstatus":0}, "name"):
try:
ste = frappe.get_doc("Stock Entry", st[0])
diff --git a/erpnext/docs/assets/img/accounts/change-amount.png b/erpnext/docs/assets/img/accounts/change-amount.png
new file mode 100644
index 0000000..33f9c88
--- /dev/null
+++ b/erpnext/docs/assets/img/accounts/change-amount.png
Binary files differ
diff --git a/erpnext/docs/assets/img/accounts/offline-records.png b/erpnext/docs/assets/img/accounts/offline-records.png
new file mode 100644
index 0000000..78bb730
--- /dev/null
+++ b/erpnext/docs/assets/img/accounts/offline-records.png
Binary files differ
diff --git a/erpnext/docs/assets/img/accounts/pos-item.png b/erpnext/docs/assets/img/accounts/pos-item.png
index fb6c1f8..321e8dc 100644
--- a/erpnext/docs/assets/img/accounts/pos-item.png
+++ b/erpnext/docs/assets/img/accounts/pos-item.png
Binary files differ
diff --git a/erpnext/docs/assets/img/accounts/pos-payment.png b/erpnext/docs/assets/img/accounts/pos-payment.png
index 0a0d37f..187e82c 100644
--- a/erpnext/docs/assets/img/accounts/pos-payment.png
+++ b/erpnext/docs/assets/img/accounts/pos-payment.png
Binary files differ
diff --git a/erpnext/docs/assets/img/accounts/write-off.png b/erpnext/docs/assets/img/accounts/write-off.png
new file mode 100644
index 0000000..c6896ea
--- /dev/null
+++ b/erpnext/docs/assets/img/accounts/write-off.png
Binary files differ
diff --git a/erpnext/docs/assets/img/articles/price-list.png b/erpnext/docs/assets/img/articles/price-list.png
new file mode 100644
index 0000000..a6982f9
--- /dev/null
+++ b/erpnext/docs/assets/img/articles/price-list.png
Binary files differ
diff --git a/erpnext/docs/assets/img/articles/pricing-rule-invoice.png b/erpnext/docs/assets/img/articles/pricing-rule-invoice.png
new file mode 100644
index 0000000..79d7fa7
--- /dev/null
+++ b/erpnext/docs/assets/img/articles/pricing-rule-invoice.png
Binary files differ
diff --git a/erpnext/docs/assets/img/articles/pricing-rule-margin.png b/erpnext/docs/assets/img/articles/pricing-rule-margin.png
new file mode 100644
index 0000000..66f6050
--- /dev/null
+++ b/erpnext/docs/assets/img/articles/pricing-rule-margin.png
Binary files differ
diff --git a/erpnext/docs/assets/img/articles/withhold-1.png b/erpnext/docs/assets/img/articles/withhold-1.png
new file mode 100644
index 0000000..89b63a0
--- /dev/null
+++ b/erpnext/docs/assets/img/articles/withhold-1.png
Binary files differ
diff --git a/erpnext/docs/assets/img/articles/withhold-2.gif b/erpnext/docs/assets/img/articles/withhold-2.gif
new file mode 100644
index 0000000..87a92c1
--- /dev/null
+++ b/erpnext/docs/assets/img/articles/withhold-2.gif
Binary files differ
diff --git a/erpnext/docs/assets/img/stock/projected_quantity.png b/erpnext/docs/assets/img/stock/projected_quantity.png
new file mode 100644
index 0000000..d9879b2
--- /dev/null
+++ b/erpnext/docs/assets/img/stock/projected_quantity.png
Binary files differ
diff --git a/erpnext/docs/assets/img/stock/warehouse.png b/erpnext/docs/assets/img/stock/warehouse.png
index 6b968d3..748cee8 100644
--- a/erpnext/docs/assets/img/stock/warehouse.png
+++ b/erpnext/docs/assets/img/stock/warehouse.png
Binary files differ
diff --git a/erpnext/docs/user/manual/en/accounts/articles/adjust-withhold-amount-payment-entry.md b/erpnext/docs/user/manual/en/accounts/articles/adjust-withhold-amount-payment-entry.md
new file mode 100644
index 0000000..d469b28
--- /dev/null
+++ b/erpnext/docs/user/manual/en/accounts/articles/adjust-withhold-amount-payment-entry.md
@@ -0,0 +1,37 @@
+#Adjust Withhold Amount in the Payment Entry
+
+###Question
+
+Let's assume that outstanding against a Sales Invoice is 20,000. When client makes payment, they will only pay 19,600. Rest 400 will be booked under Withhold account. How to manage this scenario in the Payment Entry.
+
+###Answer
+
+In the Payment Entry, you can mention Withhold Account in the Deductions or Loss table. Detailed steps below.
+
+####Step 1: Setup Withhold Account
+
+Create a Withhold Account in your Chart of Accounts master.
+
+`Accounts > Chart of Accounts'
+
+####Step 2: Payment Entry
+
+To create Payment Entry, go to unpaid Sales Invoice and create click on Make Payment button.
+
+#####Step 2.1: Enter Payment Amount
+
+Enter Payment Amount as 19,600.
+
+<img alt="Sales Invoice Payment Amount" class="screenshot" src="{{docs_base_url}}/assets/img/articles/withhold-1.png">
+
+#####Step 2.2: Allocate Against Sales Invoice
+
+Against Sales Invoice, allocate 20,000 (explained in GIF below).
+
+#####Step 2.3: Add Deduction/Loss Account
+
+You can notice that there is a difference of 400 in the Payment Amount and the Amount Allocated against Sales Invoice. You can book this difference account under Withhold Account.
+
+<img alt="Deduction/Loss Account" class="screenshot" src="{{docs_base_url}}/assets/img/articles/withhold-2.gif">
+
+ Following same steps, you can also manage difference availed due to Currency Exchange Gain/Loss.
\ No newline at end of file
diff --git a/erpnext/docs/user/manual/en/accounts/articles/index.txt b/erpnext/docs/user/manual/en/accounts/articles/index.txt
index c2fbf70..77474bd 100644
--- a/erpnext/docs/user/manual/en/accounts/articles/index.txt
+++ b/erpnext/docs/user/manual/en/accounts/articles/index.txt
@@ -11,4 +11,5 @@
update-stock-option-in-sales-invoice
what-is-the-differences-of-total-and-valuation-in-tax-and-charges
withdrawing-salary-from-owners-equity-account
+adjust-withhold-amount-payment-entry
c-form
\ No newline at end of file
diff --git a/erpnext/docs/user/manual/en/accounts/point-of-sale-pos-invoice.md b/erpnext/docs/user/manual/en/accounts/point-of-sale-pos-invoice.md
index 6a697b1..64fa22c 100644
--- a/erpnext/docs/user/manual/en/accounts/point-of-sale-pos-invoice.md
+++ b/erpnext/docs/user/manual/en/accounts/point-of-sale-pos-invoice.md
@@ -69,6 +69,25 @@
Submit the document to finalise the record. After the document is submitted,
you can either print or email it directly to the customer.
+### Write off Amount
+
+Outstanding amount can be write off from the POS, user has to enter the amount under write off field on the payment screen.
+
+<img class="screenshot" alt="POS Payment" src="{{docs_base_url}}/assets/img/accounts/write-off.png">
+
+System books the write off amount into the ledger which has selected on the POS Profile.
+
+### Change Amount
+
+POS calculate the extra amount paid by the customer, which user can return from the cash account. User has to set the account for the change amount on the POS profile.
+
+<img class="screenshot" alt="POS Payment" src="{{docs_base_url}}/assets/img/accounts/change-amount.png">
+
+### Offline Records
+All the records from the POS stores into the browser's local storegae and sync submitted records after every minute of the interval if system is connected to internet. User can view the offline records by clicking on Menu > View Offline Records
+
+<img class="screenshot" alt="POS Payment" src="{{docs_base_url}}/assets/img/accounts/offline-records.png">
+
#### Accounting entries (GL Entry) for a Point of Sale:
Debits:
@@ -82,6 +101,7 @@
* Taxes (liabilities to be paid to the government)
* Customer (payment)
* Write Off (optional)
+ * Account for Change Amount (optional)
To see entries after “Submit”, click on “View Ledger”.
diff --git a/erpnext/docs/user/manual/en/accounts/pricing-rule.md b/erpnext/docs/user/manual/en/accounts/pricing-rule.md
index 7afcbea..bd3c51a 100644
--- a/erpnext/docs/user/manual/en/accounts/pricing-rule.md
+++ b/erpnext/docs/user/manual/en/accounts/pricing-rule.md
@@ -79,4 +79,31 @@
<img alt="Disable" class="screenshot" src="{{docs_base_url}}/assets/img/articles/pricing-rule-disable.png">
+### Add Margin
+
+Using pricing rule user can add margin on the sales transactions
+
+For example : User want to add 10% margin on the supplier price list at the time of sales
+
+####1. Make Price List
+
+Create price list for supllier and create item price against the price list.
+
+<img alt="Disable" class="screenshot" src="{{docs_base_url}}/assets/img/articles/price-list.png">
+
+
+####2. Make Pricing Rule
+
+Create pricing rule for the item against which supplier rate has created
+
+<img alt="Disable" class="screenshot" src="{{docs_base_url}}/assets/img/articles/pricing-rule-margin.png">
+
+####2. Make Invoice
+
+System apply the margin rate on the item price on selection of an item.
+
+<img alt="Disable" class="screenshot" src="{{docs_base_url}}/assets/img/articles/pricing-rule-invoice.png">
+
+For more details about pricing rule [Click Here]({{docs_base_url}}/user/manual/en/selling/articles/adding-margin.html)
+
<!-- markdown -->
\ No newline at end of file
diff --git a/erpnext/docs/user/manual/en/selling/articles/adding-margin.md b/erpnext/docs/user/manual/en/selling/articles/adding-margin.md
index 2a9ddfa..2b2fb09 100644
--- a/erpnext/docs/user/manual/en/selling/articles/adding-margin.md
+++ b/erpnext/docs/user/manual/en/selling/articles/adding-margin.md
@@ -9,7 +9,7 @@
####Adding Margin in Pricing Rule
-<img alt="Adding Margin in Pricing Rule" class="screenshot" src="{{docs_base_url}}/assets/img/articles/margin-pricing-rule.png">
+<img alt="Adding Margin in Pricing Rule" class="screenshot" src="{{docs_base_url}}/assets/img/selling/margin-pricing-rule.png">
Total Margin is calculated as follows:
`Rate = Price List Rate + Margin Rate`
@@ -22,7 +22,7 @@
####Adding Item Price
-<img alt="Adding Margin in Pricing Rule" class="screenshot" src="{{docs_base_url}}/assets/img/articles/margin-item-price-list.png">
+<img alt="Adding Margin in Pricing Rule" class="screenshot" src="{{docs_base_url}}/assets/img/selling/margin-item-price-list.png">
2) Apply margin direct on Item: If user wants to apply the margin without pricing rule, they can use this option. In Quotation Item and Sales Order Item, user can select the margin type and rate or amount. The system will calculate the margin and apply it on price list rate to calculate the rate of the product.
@@ -34,4 +34,4 @@
####Adding Margin in Quotation
-<img alt="Adding Margin in Quotation" class="screenshot" src="{{docs_base_url}}/assets/img/articles/margin-quotation-item.png">
+<img alt="Adding Margin in Quotation" class="screenshot" src="{{docs_base_url}}/assets/img/selling/margin-quotation-item.png">
diff --git a/erpnext/docs/user/manual/en/stock/projected-quantity.md b/erpnext/docs/user/manual/en/stock/projected-quantity.md
index 9251a1b..d38bfc9 100644
--- a/erpnext/docs/user/manual/en/stock/projected-quantity.md
+++ b/erpnext/docs/user/manual/en/stock/projected-quantity.md
@@ -11,7 +11,7 @@
Having a tight control of the projected inventory is crucial to determine
shortages and to calculate the right order quantity.
-
+
> Projected Qty = Actual Qty + Planned Qty + Requested Qty + Ordered Qty -
diff --git a/erpnext/docs/user/manual/en/stock/stock-entry.md b/erpnext/docs/user/manual/en/stock/stock-entry.md
index 559f762..a47d863 100644
--- a/erpnext/docs/user/manual/en/stock/stock-entry.md
+++ b/erpnext/docs/user/manual/en/stock/stock-entry.md
@@ -38,6 +38,6 @@
<img class="screenshot" alt="Additional Costs General Ledger" src="{{docs_base_url}}/assets/img/stock/additional-costs-general-ledger.png">
-> **Note:** To update Stock from a spreadsheet, see [Stock Reconciliation] ({{doc_base_url}}/user/manual/en/setting-up/stock-reconciliation-for-non-serialized-item.html).
+> **Note:** To update Stock from a spreadsheet, see [Stock Reconciliation]({{doc_base_url}}/user/manual/en/setting-up/stock-reconciliation-for-non-serialized-item.html).
{next}
diff --git a/erpnext/docs/user/manual/en/stock/warehouse.md b/erpnext/docs/user/manual/en/stock/warehouse.md
index d86f401..172e469 100644
--- a/erpnext/docs/user/manual/en/stock/warehouse.md
+++ b/erpnext/docs/user/manual/en/stock/warehouse.md
@@ -4,10 +4,8 @@
cities, towns, and villages. They mostly have loading docks to load and unload
goods from trucks.
-To go to Warehouse, click on Stock and go to Warehouse under Masters. You
-could also go to the Setup module and click on Warehouse under Master Data.
-
-> Stock > Warehouse > New Warehouse
+To go to Warehouse, click on Stock and go to Warehouse under Setup. You
+could also switch to 'Tree' View or simply type warehouse tree in the awsone bar.
<img class="screenshot" alt="Warehouse" src="{{docs_base_url}}/assets/img/stock/warehouse.png">
@@ -20,17 +18,6 @@
wish a particular user to operate on a particular Warehouse, you can refrain
the user from accessing that Warehouse.
-### Merge Warehouse
-
-In day to day transactions, duplicate entries are done by mistake, resulting
-in duplicate Warehouses. Duplicate records can be merged into a single
-Warehouse. From the top bar of the system select the File menu. Select Rename
-and Enter the correct Warehouse and check the Merge button. The system will
-replace all the links of wrong Warehouse with the correct Warehouse, in all
-transactions. Also, the available quantity (actual qty, reserved qty, ordered
-qty etc) of all items in the duplicate warehouse will be transferred to the
-correct warehouse. Once merging is done, delete the duplicate Warehouse.
-
> Note: ERPNext system maintains stock balance for every distinct combination
of Item and Warehouse. Thus you can get stock balance for any specific Item in
a particular Warehouse on any particular date.
diff --git a/erpnext/docs/user/videos/index.md b/erpnext/docs/user/videos/index.md
index 071dedb..9a82db5 100644
--- a/erpnext/docs/user/videos/index.md
+++ b/erpnext/docs/user/videos/index.md
@@ -18,7 +18,7 @@
---
<h3>
- <a class="no-decoration" href="https://conf.erpnext.com/2014/videos">Conference Vidoes</a>
+ <a class="no-decoration" href="https://conf.erpnext.com/2014/videos">Conference Videos</a>
</h3>
<div class="row">
diff --git a/erpnext/hr/doctype/process_payroll/process_payroll.js b/erpnext/hr/doctype/process_payroll/process_payroll.js
index 6c057e1..2ab6aef 100644
--- a/erpnext/hr/doctype/process_payroll/process_payroll.js
+++ b/erpnext/hr/doctype/process_payroll/process_payroll.js
@@ -82,7 +82,7 @@
cur_frm.cscript.submit_salary_slip = function(doc, cdt, cdn) {
cur_frm.cscript.display_activity_log("");
- frappe.confirm(__("Do you really want to Submit all Salary Slip for Account {0} from {1} to {2}", [doc.payment_account, doc.from_date, doc.to_date]), function() {
+ frappe.confirm(__("Do you really want to Submit all Salary Slip from {0} to {1}", [doc.from_date, doc.to_date]), function() {
// clear all in locals
if(locals["Salary Slip"]) {
$.each(locals["Salary Slip"], function(name, d) {
diff --git a/erpnext/hr/doctype/process_payroll/process_payroll.py b/erpnext/hr/doctype/process_payroll/process_payroll.py
index f31ddfb..3554669 100644
--- a/erpnext/hr/doctype/process_payroll/process_payroll.py
+++ b/erpnext/hr/doctype/process_payroll/process_payroll.py
@@ -22,9 +22,9 @@
sal_struct = frappe.db.sql("""
select name from `tabSalary Structure`
- where docstatus != 2 and payment_account = '%(payment_account)s' and
- ifnull(salary_slip_based_on_timesheet,0) = %(salary_slip_based_on_timesheet)s"""%
- {"payment_account": self.payment_account, "salary_slip_based_on_timesheet":self.salary_slip_based_on_timesheet})
+ where docstatus != 2 and company = %(company)s and
+ ifnull(salary_slip_based_on_timesheet,0) = %(salary_slip_based_on_timesheet)s""",
+ {"company": self.company, "salary_slip_based_on_timesheet":self.salary_slip_based_on_timesheet})
if sal_struct:
cond += "and t2.parent IN %(sal_struct)s "
@@ -82,6 +82,7 @@
"start_date": self.from_date,
"end_date": self.to_date,
"employee": emp[0],
+ "employee_name": frappe.get_value("Employee", {"name":emp[0]}, "employee_name"),
"company": self.company,
"posting_date": self.posting_date
})
@@ -92,6 +93,7 @@
"fiscal_year": self.fiscal_year,
"month": self.month,
"employee": emp[0],
+ "employee_name": frappe.get_value("Employee", {"name":emp[0]}, "employee_name"),
"company": self.company,
"posting_date": self.posting_date
})
@@ -222,8 +224,8 @@
def make_journal_entry(self, reference_number = None, reference_date = None):
self.check_permission('write')
- earnings = self.get_salary_component_total(component_type = "earnings")
- deductions = self.get_salary_component_total(component_type = "deductions")
+ earnings = self.get_salary_component_total(component_type = "earnings") or {}
+ deductions = self.get_salary_component_total(component_type = "deductions") or {}
jv_name = ""
if earnings or deductions:
diff --git a/erpnext/hr/doctype/process_payroll/test_process_payroll.py b/erpnext/hr/doctype/process_payroll/test_process_payroll.py
index 4e3a588..3be4b4c 100644
--- a/erpnext/hr/doctype/process_payroll/test_process_payroll.py
+++ b/erpnext/hr/doctype/process_payroll/test_process_payroll.py
@@ -12,7 +12,12 @@
def test_process_payroll(self):
month = "11"
fiscal_year = "_Test Fiscal Year 2016"
- payment_account = frappe.get_all("Account")[0].name
+
+ for data in frappe.get_all('Salary Component', fields = ["name"]):
+ if not frappe.db.get_value('Salary Component Account', {'parent': data.name, 'company': erpnext.get_default_company()}, 'name'):
+ get_salary_component_account(data.name)
+
+ payment_account = frappe.get_value('Account', {'account_type': 'Cash', 'company': erpnext.get_default_company(),'is_group':0}, "name")
if not frappe.db.get_value("Salary Slip", {"fiscal_year": fiscal_year, "month": month}):
process_payroll = frappe.get_doc("Process Payroll", "Process Payroll")
process_payroll.company = erpnext.get_default_company()
@@ -21,7 +26,27 @@
process_payroll.from_date = "2016-11-01"
process_payroll.to_date = "2016-11-30"
process_payroll.payment_account = payment_account
+ process_payroll.posting_date = nowdate()
process_payroll.create_sal_slip()
process_payroll.submit_salary_slip()
if process_payroll.get_sal_slip_list(ss_status = 1):
- r = process_payroll.make_journal_entry(reference_number=random_string(10),reference_date=nowdate())
\ No newline at end of file
+ r = process_payroll.make_journal_entry(reference_number=random_string(10),reference_date=nowdate())
+
+
+def get_salary_component_account(sal_comp):
+ company = erpnext.get_default_company()
+ sal_comp = frappe.get_doc("Salary Component", sal_comp)
+ sc = sal_comp.append("accounts")
+ sc.company = company
+ sc.default_account = create_account(company)
+
+def create_account(company):
+ salary_account = frappe.db.get_value("Account", "Salary - " + frappe.db.get_value('Company', company, 'abbr'))
+ if not salary_account:
+ frappe.get_doc({
+ "doctype": "Account",
+ "account_name": "Salary",
+ "parent_account": "Indirect Expenses - " + frappe.db.get_value('Company', company, 'abbr'),
+ "company": company
+ }).insert()
+ return salary_account
\ No newline at end of file
diff --git a/erpnext/hr/doctype/salary_slip/salary_slip.py b/erpnext/hr/doctype/salary_slip/salary_slip.py
index e101c3d..1bceff7 100644
--- a/erpnext/hr/doctype/salary_slip/salary_slip.py
+++ b/erpnext/hr/doctype/salary_slip/salary_slip.py
@@ -168,7 +168,7 @@
return st_name and st_name[0][0] or ''
else:
self.salary_structure = None
- frappe.throw(_("No active or default Salary Structure found for employee {0} for the given dates")
+ frappe.msgprint(_("No active or default Salary Structure found for employee {0} for the given dates")
.format(self.employee), title=_('Salary Structure Missing'))
def pull_sal_struct(self):
diff --git a/erpnext/hr/doctype/salary_slip/test_salary_slip.py b/erpnext/hr/doctype/salary_slip/test_salary_slip.py
index 8bb9653..8cf0688 100644
--- a/erpnext/hr/doctype/salary_slip/test_salary_slip.py
+++ b/erpnext/hr/doctype/salary_slip/test_salary_slip.py
@@ -8,11 +8,11 @@
from frappe.utils.make_random import get_random
from frappe.utils import today, now_datetime, getdate, cstr, add_years, nowdate
from erpnext.hr.doctype.salary_structure.salary_structure import make_salary_slip
-from erpnext.hr.doctype.leave_application.test_leave_application import make_allocation_record
+from erpnext.hr.doctype.process_payroll.test_process_payroll import get_salary_component_account
class TestSalarySlip(unittest.TestCase):
def setUp(self):
- self.make_salary_component(["Basic Salary", "Allowance", "HRA", "Professional Tax", "TDS"])
+ make_salary_component(["Basic Salary", "Allowance", "HRA", "Professional Tax", "TDS"])
for dt in ["Leave Application", "Leave Allocation", "Salary Slip"]:
frappe.db.sql("delete from `tab%s`" % dt)
@@ -160,16 +160,7 @@
}).insert()
holiday_list.get_weekly_off_dates()
holiday_list.save()
-
- def make_salary_component(self, salary_components):
- for salary_component in salary_components:
- if not frappe.db.exists('Salary Component', salary_component):
- sal_comp = frappe.get_doc({
- "doctype": "Salary Component",
- "salary_component": salary_component
- })
- sal_comp.insert()
-
+
def make_employee_salary_slip(self, user):
employee = frappe.db.get_value("Employee", {"user_id": user})
salary_structure = make_salary_structure("Salary Structure Test for Salary Slip")
@@ -194,6 +185,15 @@
activity_type.wage_rate = 25
activity_type.save()
+def make_salary_component(salary_components):
+ for salary_component in salary_components:
+ if not frappe.db.exists('Salary Component', salary_component):
+ sal_comp = frappe.get_doc({
+ "doctype": "Salary Component",
+ "salary_component": salary_component
+ })
+ sal_comp.insert()
+ get_salary_component_account(salary_component)
def make_salary_structure(sal_struct):
if not frappe.db.exists('Salary Structure', sal_struct):
@@ -205,7 +205,7 @@
"employees": get_employee_details(),
"earnings": get_earnings_component(),
"deductions": get_deductions_component(),
- "payment_account": get_random("Account")
+ "payment_account": frappe.get_value('Account', {'account_type': 'Cash', 'company': erpnext.get_default_company(),'is_group':0}, "name")
}).insert()
return sal_struct
diff --git a/erpnext/hr/doctype/salary_structure/test_salary_structure.py b/erpnext/hr/doctype/salary_structure/test_salary_structure.py
index cd7ee47..81f6743 100644
--- a/erpnext/hr/doctype/salary_structure/test_salary_structure.py
+++ b/erpnext/hr/doctype/salary_structure/test_salary_structure.py
@@ -8,6 +8,7 @@
from frappe.utils.make_random import get_random
from frappe.utils import nowdate, add_days, add_years
from erpnext.hr.doctype.salary_structure.salary_structure import make_salary_slip
+from erpnext.hr.doctype.salary_slip.test_salary_slip import make_salary_component
# test_records = frappe.get_test_records('Salary Structure')
class TestSalaryStructure(unittest.TestCase):
@@ -23,7 +24,7 @@
self.make_holiday_list()
frappe.db.set_value("Company", erpnext.get_default_company(), "default_holiday_list", "Salary Structure Test Holiday List")
- self.make_salary_component(["Basic Salary", "Allowance", "HRA", "Professional Tax", "TDS"])
+ make_salary_component(["Basic Salary", "Allowance", "HRA", "Professional Tax", "TDS"])
employee1 = self.make_employee("test_employee@salary.com")
employee2 = self.make_employee("test_employee_2@salary.com")
@@ -69,17 +70,6 @@
return emp.name
else:
return frappe.get_value("Employee", {"employee_name":user}, "name")
-
- def make_salary_component(self, salary_components):
- for salary_component in salary_components:
- if not frappe.db.exists('Salary Component', salary_component):
- sal_comp = frappe.get_doc({
- "doctype": "Salary Component",
- "salary_component": salary_component
- })
- sal_comp.insert()
-
-
def test_amount_totals(self):
sal_slip = frappe.get_value("Salary Slip", {"employee_name":"test_employee@salary.com"})
@@ -114,7 +104,7 @@
"employees": get_employee_details(),
"earnings": get_earnings_component(),
"deductions": get_deductions_component(),
- "payment_account": frappe.get_all("Account")[0].name
+ "payment_account": frappe.get_value('Account', {'account_type': 'Cash', 'company': erpnext.get_default_company(),'is_group':0}, "name")
}).insert()
return sal_struct
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index e5cdb1a..f3905de 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -298,6 +298,7 @@
execute:frappe.delete_doc_if_exists("DocType", "Payment Tool Detail")
erpnext.patches.v7_0.setup_account_table_for_expense_claim_type_if_exists
erpnext.patches.v7_0.migrate_schools_to_erpnext
+erpnext.patches.v7_1.update_lead_source
erpnext.patches.v6_20x.remove_customer_supplier_roles
erpnext.patches.v7_0.remove_administrator_role_in_doctypes
erpnext.patches.v7_0.rename_fee_amount_to_fee_component
@@ -324,7 +325,6 @@
erpnext.patches.v7_0.update_conversion_factor_in_supplier_quotation_item
erpnext.patches.v7_1.move_sales_invoice_from_parent_to_child_timesheet
execute:frappe.db.sql("update `tabTimesheet` ts, `tabEmployee` emp set ts.employee_name = emp.employee_name where emp.name = ts.employee and ts.employee_name is null and ts.employee is not null")
-erpnext.patches.v7_1.update_lead_source
erpnext.patches.v7_1.fix_link_for_customer_from_lead
execute:frappe.db.sql("delete from `tabTimesheet Detail` where NOT EXISTS (select name from `tabTimesheet` where name = `tabTimesheet Detail`.parent)")
erpnext.patches.v7_0.update_mode_of_payment_type
@@ -341,4 +341,5 @@
erpnext.patches.v7_0.repost_bin_qty_and_item_projected_qty
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
+execute:frappe.db.sql("update `tabStock Entry` set total_amount = null where purpose in('Repack', 'Manufacture')")
+erpnext.patches.v7_0.repost_gle_for_pi_with_update_stock #2016-11-01
\ No newline at end of file
diff --git a/erpnext/patches/v7_0/repost_gle_for_pi_with_update_stock.py b/erpnext/patches/v7_0/repost_gle_for_pi_with_update_stock.py
new file mode 100644
index 0000000..2883a8a
--- /dev/null
+++ b/erpnext/patches/v7_0/repost_gle_for_pi_with_update_stock.py
@@ -0,0 +1,20 @@
+# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
+# License: GNU General Public License v3. See license.txt
+
+from __future__ import unicode_literals
+import frappe
+from frappe.utils import cint
+
+def execute():
+ if not cint(frappe.defaults.get_global_default("auto_accounting_for_stock")):
+ return
+
+ for pi in frappe.db.sql("""select name from `tabPurchase Invoice`
+ where update_stock=1 and docstatus=1 order by posting_date asc""", as_dict=1):
+
+ frappe.db.sql("""delete from `tabGL Entry`
+ where voucher_type = 'Purchase Invoice' and voucher_no = %s""", pi.name)
+
+ pi_doc = frappe.get_doc("Purchase Invoice", pi.name)
+ pi_doc.make_gl_entries(repost_future_gle=False)
+ frappe.db.commit()
\ No newline at end of file
diff --git a/erpnext/projects/doctype/timesheet/timesheet.py b/erpnext/projects/doctype/timesheet/timesheet.py
index 60435bc..9e32b52 100644
--- a/erpnext/projects/doctype/timesheet/timesheet.py
+++ b/erpnext/projects/doctype/timesheet/timesheet.py
@@ -369,7 +369,7 @@
conditions = get_conditions(filters)
return frappe.db.sql("""select `tabTimesheet Detail`.name as name,
`tabTimesheet Detail`.docstatus as status, `tabTimesheet Detail`.parent as parent,
- from_time, hours, activity_type, project, to_time
+ from_time as start_date, hours, activity_type, project, to_time as end_date
from `tabTimesheet Detail`, `tabTimesheet`
where `tabTimesheet Detail`.parent = `tabTimesheet`.name
and `tabTimesheet`.docstatus < 2
diff --git a/erpnext/public/js/controllers/taxes_and_totals.js b/erpnext/public/js/controllers/taxes_and_totals.js
index aeceda4..4b14d08 100644
--- a/erpnext/public/js/controllers/taxes_and_totals.js
+++ b/erpnext/public/js/controllers/taxes_and_totals.js
@@ -5,9 +5,10 @@
setup: function() {},
apply_pricing_rule_on_item: function(item){
if(item.margin_type == "Percentage"){
- item.total_margin = item.price_list_rate + item.price_list_rate * ( item.margin_rate_or_amount / 100);
+ item.total_margin = flt(item.price_list_rate)
+ + flt(item.price_list_rate) * ( flt(item.margin_rate_or_amount) / 100);
}else{
- item.total_margin = item.price_list_rate + item.margin_rate_or_amount;
+ item.total_margin = flt(item.price_list_rate) + flt(item.margin_rate_or_amount);
}
item.rate = flt(item.total_margin , precision("rate", item));
diff --git a/erpnext/selling/doctype/quotation_item/quotation_item.json b/erpnext/selling/doctype/quotation_item/quotation_item.json
index 2c73a8e..3a27706 100644
--- a/erpnext/selling/doctype/quotation_item/quotation_item.json
+++ b/erpnext/selling/doctype/quotation_item/quotation_item.json
@@ -563,7 +563,7 @@
"columns": 0,
"depends_on": "eval:doc.margin_type && doc.price_list_rate",
"fieldname": "total_margin",
- "fieldtype": "Float",
+ "fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
@@ -1276,7 +1276,7 @@
"istable": 1,
"max_attachments": 0,
"menu_index": 0,
- "modified": "2016-08-26 04:46:21.936481",
+ "modified": "2016-11-01 13:02:18.665333",
"modified_by": "Administrator",
"module": "Selling",
"name": "Quotation Item",
diff --git a/erpnext/selling/doctype/sales_order_item/sales_order_item.json b/erpnext/selling/doctype/sales_order_item/sales_order_item.json
index 35d8b0b..a59858a 100644
--- a/erpnext/selling/doctype/sales_order_item/sales_order_item.json
+++ b/erpnext/selling/doctype/sales_order_item/sales_order_item.json
@@ -563,7 +563,7 @@
"columns": 0,
"depends_on": "eval:doc.margin_type && doc.price_list_rate",
"fieldname": "total_margin",
- "fieldtype": "Float",
+ "fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
@@ -614,7 +614,7 @@
"columns": 2,
"depends_on": "eval: doc.type != \"\"",
"fieldname": "rate",
- "fieldtype": "Float",
+ "fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
@@ -1582,7 +1582,7 @@
"istable": 1,
"max_attachments": 0,
"menu_index": 0,
- "modified": "2016-08-26 04:50:27.723801",
+ "modified": "2016-11-01 13:01:13.572400",
"modified_by": "Administrator",
"module": "Selling",
"name": "Sales Order Item",
diff --git a/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json b/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json
index b40be5e..5ac7b45 100644
--- a/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json
+++ b/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json
@@ -10,11 +10,13 @@
"doctype": "DocType",
"document_type": "Document",
"editable_grid": 1,
+ "engine": "InnoDB",
"fields": [
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "barcode",
"fieldtype": "Data",
"hidden": 0,
@@ -39,6 +41,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "item_code",
"fieldtype": "Link",
"hidden": 0,
@@ -68,6 +71,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "item_name",
"fieldtype": "Data",
"hidden": 0,
@@ -96,6 +100,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "col_break1",
"fieldtype": "Column Break",
"hidden": 0,
@@ -119,6 +124,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "customer_item_code",
"fieldtype": "Data",
"hidden": 1,
@@ -143,6 +149,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 1,
+ "columns": 0,
"fieldname": "section_break_6",
"fieldtype": "Section Break",
"hidden": 0,
@@ -168,6 +175,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "description",
"fieldtype": "Text Editor",
"hidden": 0,
@@ -196,6 +204,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "column_break_8",
"fieldtype": "Column Break",
"hidden": 0,
@@ -220,6 +229,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "image",
"fieldtype": "Attach",
"hidden": 1,
@@ -245,6 +255,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "image_view",
"fieldtype": "Image",
"hidden": 0,
@@ -271,6 +282,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "quantity_and_rate",
"fieldtype": "Section Break",
"hidden": 0,
@@ -295,6 +307,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "qty",
"fieldtype": "Float",
"hidden": 0,
@@ -323,6 +336,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "price_list_rate",
"fieldtype": "Currency",
"hidden": 0,
@@ -352,6 +366,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "col_break2",
"fieldtype": "Column Break",
"hidden": 0,
@@ -375,6 +390,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "stock_uom",
"fieldtype": "Link",
"hidden": 0,
@@ -404,6 +420,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "base_price_list_rate",
"fieldtype": "Currency",
"hidden": 0,
@@ -433,6 +450,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 1,
+ "columns": 0,
"fieldname": "discount_and_margin",
"fieldtype": "Section Break",
"hidden": 0,
@@ -458,6 +476,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "price_list_rate",
"fieldname": "discount_percentage",
"fieldtype": "Float",
@@ -487,6 +506,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "column_break_19",
"fieldtype": "Column Break",
"hidden": 0,
@@ -511,6 +531,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "price_list_rate",
"fieldname": "margin_type",
"fieldtype": "Select",
@@ -538,6 +559,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "eval:doc.margin_type && doc.price_list_rate",
"fieldname": "margin_rate_or_amount",
"fieldtype": "Float",
@@ -564,9 +586,10 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "eval:doc.margin_type && doc.price_list_rate",
"fieldname": "total_margin",
- "fieldtype": "Float",
+ "fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
@@ -590,6 +613,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "section_break_1",
"fieldtype": "Section Break",
"hidden": 0,
@@ -613,6 +637,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "rate",
"fieldtype": "Currency",
"hidden": 0,
@@ -642,6 +667,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "amount",
"fieldtype": "Currency",
"hidden": 0,
@@ -671,6 +697,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "col_break3",
"fieldtype": "Column Break",
"hidden": 0,
@@ -694,6 +721,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "base_rate",
"fieldtype": "Currency",
"hidden": 0,
@@ -723,6 +751,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "base_amount",
"fieldtype": "Currency",
"hidden": 0,
@@ -752,6 +781,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "pricing_rule",
"fieldtype": "Link",
"hidden": 0,
@@ -777,6 +807,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "section_break_25",
"fieldtype": "Section Break",
"hidden": 0,
@@ -801,6 +832,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "net_rate",
"fieldtype": "Currency",
"hidden": 0,
@@ -827,6 +859,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "net_amount",
"fieldtype": "Currency",
"hidden": 0,
@@ -853,6 +886,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "column_break_28",
"fieldtype": "Column Break",
"hidden": 0,
@@ -877,6 +911,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "base_net_rate",
"fieldtype": "Currency",
"hidden": 0,
@@ -903,6 +938,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "base_net_amount",
"fieldtype": "Currency",
"hidden": 0,
@@ -929,6 +965,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "warehouse_and_reference",
"fieldtype": "Section Break",
"hidden": 0,
@@ -953,6 +990,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "warehouse",
"fieldtype": "Link",
"hidden": 0,
@@ -982,6 +1020,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "",
"description": "",
"fieldname": "target_warehouse",
@@ -1010,6 +1049,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "serial_no",
"fieldtype": "Text",
"hidden": 0,
@@ -1036,6 +1076,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "batch_no",
"fieldtype": "Link",
"hidden": 0,
@@ -1063,6 +1104,7 @@
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "actual_qty",
"fieldtype": "Float",
"hidden": 0,
@@ -1091,6 +1133,7 @@
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "batch_no",
"fieldname": "actual_batch_qty",
"fieldtype": "Float",
@@ -1119,6 +1162,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"description": "",
"fieldname": "item_group",
"fieldtype": "Link",
@@ -1147,6 +1191,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "brand",
"fieldtype": "Link",
"hidden": 1,
@@ -1176,6 +1221,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "item_tax_rate",
"fieldtype": "Small Text",
"hidden": 1,
@@ -1202,6 +1248,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "col_break4",
"fieldtype": "Column Break",
"hidden": 0,
@@ -1225,6 +1272,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "expense_account",
"fieldtype": "Link",
"hidden": 0,
@@ -1251,6 +1299,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"default": ":Company",
"fieldname": "cost_center",
"fieldtype": "Link",
@@ -1278,6 +1327,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "against_sales_order",
"fieldtype": "Link",
"hidden": 0,
@@ -1303,6 +1353,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "against_sales_invoice",
"fieldtype": "Link",
"hidden": 0,
@@ -1328,6 +1379,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "so_detail",
"fieldtype": "Data",
"hidden": 1,
@@ -1356,6 +1408,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "si_detail",
"fieldtype": "Data",
"hidden": 1,
@@ -1381,6 +1434,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "installed_qty",
"fieldtype": "Float",
"hidden": 0,
@@ -1409,6 +1463,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "billed_amt",
"fieldtype": "Currency",
"hidden": 0,
@@ -1435,6 +1490,7 @@
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "page_break",
"fieldtype": "Check",
"hidden": 0,
@@ -1468,7 +1524,7 @@
"issingle": 0,
"istable": 1,
"max_attachments": 0,
- "modified": "2016-07-11 03:27:59.254550",
+ "modified": "2016-11-01 13:01:29.621272",
"modified_by": "Administrator",
"module": "Stock",
"name": "Delivery Note Item",
diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py
index e9d4cb3..ced6a64 100644
--- a/erpnext/stock/doctype/item/item.py
+++ b/erpnext/stock/doctype/item/item.py
@@ -567,7 +567,7 @@
existing_allow_negative_stock = frappe.db.get_value("Stock Settings", None, "allow_negative_stock")
frappe.db.set_value("Stock Settings", None, "allow_negative_stock", 1)
- for warehouse in frappe.db.sql("select name from `tabWarehouse` where is_group = 0"):
+ for warehouse in frappe.db.sql("select warehouse from `tabBin` where item_code=%s", new_name):
repost_stock(new_name, warehouse[0])
frappe.db.set_value("Stock Settings", None, "allow_negative_stock", existing_allow_negative_stock)
diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
index 6d6ae97..86fb88b 100644
--- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
+++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
@@ -8,7 +8,7 @@
from frappe import throw, _
import frappe.defaults
-
+from frappe.utils import getdate
from erpnext.controllers.buying_controller import BuyingController
from erpnext.accounts.utils import get_account_currency
from frappe.desk.notifications import clear_doctype_notifications
@@ -59,7 +59,7 @@
pc_obj = frappe.get_doc('Purchase Common')
self.check_for_closed_status(pc_obj)
- if self.posting_date > nowdate():
+ if getdate(self.posting_date) > getdate(nowdate()):
throw(_("Posting Date cannot be future date"))
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py
index a60e945..65b9d26 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.py
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.py
@@ -31,7 +31,7 @@
item.update(get_bin_details(item.item_code, item.s_warehouse))
def validate(self):
- self.pro_doc = None
+ self.pro_doc = frappe._dict()
if self.production_order:
self.pro_doc = frappe.get_doc('Production Order', self.production_order)
@@ -297,7 +297,7 @@
def set_basic_rate_for_finished_goods(self, raw_material_cost, scrap_material_cost):
if self.purpose in ["Manufacture", "Repack"]:
for d in self.get("items"):
- if (d.bom_no or d.t_warehouse) and (getattr(self, "pro_doc", frappe._dict()).scrap_warehouse != d.t_warehouse):
+ if d.transfer_qty and (d.bom_no or d.t_warehouse) and (getattr(self, "pro_doc", frappe._dict()).scrap_warehouse != d.t_warehouse):
d.basic_rate = flt((raw_material_cost - scrap_material_cost) / flt(d.transfer_qty), d.precision("basic_rate"))
d.basic_amount = flt((raw_material_cost - scrap_material_cost), d.precision("basic_amount"))
@@ -316,11 +316,10 @@
def update_valuation_rate(self):
for d in self.get("items"):
- d.amount = flt(flt(d.basic_amount) + flt(d.additional_cost), d.precision("amount"))
- d.valuation_rate = flt(
- flt(d.basic_rate)
- + (flt(d.additional_cost) / flt(d.transfer_qty)),
- d.precision("valuation_rate"))
+ if d.transfer_qty:
+ d.amount = flt(flt(d.basic_amount) + flt(d.additional_cost), d.precision("amount"))
+ d.valuation_rate = flt(flt(d.basic_rate) + (flt(d.additional_cost) / flt(d.transfer_qty)),
+ d.precision("valuation_rate"))
def set_total_incoming_outgoing_value(self):
self.total_incoming_value = self.total_outgoing_value = 0.0
@@ -582,7 +581,7 @@
def set_production_order_details(self):
if not getattr(self, "pro_doc", None):
- self.pro_doc = None
+ self.pro_doc = frappe._dict()
if self.production_order:
# common validations
@@ -681,7 +680,7 @@
for item in transferred_materials:
qty= item.qty
- if manufacturing_qty > (produced_qty + flt(self.fg_completed_qty)):
+ if trans_qty and manufacturing_qty > (produced_qty + flt(self.fg_completed_qty)):
qty = (qty/trans_qty) * flt(self.fg_completed_qty)
elif backflushed_materials.get(item.item_code):
@@ -819,7 +818,7 @@
"amount": operating_cost_per_unit * flt(fg_qty)
})
- if production_order and production_order.additional_operating_cost:
+ if production_order and production_order.additional_operating_cost and production_order.qty:
additional_operating_cost_per_unit = \
flt(production_order.additional_operating_cost) / flt(production_order.qty)
@@ -839,13 +838,14 @@
for d in production_order.get("operations"):
if flt(d.completed_qty):
operating_cost_per_unit += flt(d.actual_operating_cost) / flt(d.completed_qty)
- else:
+ elif production_order.qty:
operating_cost_per_unit += flt(d.planned_operating_cost) / flt(production_order.qty)
# Get operating cost from BOM if not found in production_order.
if not operating_cost_per_unit and bom_no:
bom = frappe.db.get_value("BOM", bom_no, ["operating_cost", "quantity"], as_dict=1)
- operating_cost_per_unit = flt(bom.operating_cost) / flt(bom.quantity)
+ if bom.quantity:
+ operating_cost_per_unit = flt(bom.operating_cost) / flt(bom.quantity)
return operating_cost_per_unit