Merge pull request #17078 from rohitwaghchaure/unlinked_advance_payment_on_cancellation_of_order
feat: provision to unlink advance payment entry on cancelation of order
diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.py b/erpnext/accounts/doctype/payment_entry/payment_entry.py
index 9ef6446..b8073ce 100644
--- a/erpnext/accounts/doctype/payment_entry/payment_entry.py
+++ b/erpnext/accounts/doctype/payment_entry/payment_entry.py
@@ -749,7 +749,7 @@
@frappe.whitelist()
def get_reference_details(reference_doctype, reference_name, party_account_currency):
- total_amount = outstanding_amount = exchange_rate = None
+ total_amount = outstanding_amount = exchange_rate = bill_no = None
ref_doc = frappe.get_doc(reference_doctype, reference_name)
company_currency = ref_doc.get("company_currency") or erpnext.get_company_currency(ref_doc.company)
@@ -783,6 +783,7 @@
if reference_doctype in ("Sales Invoice", "Purchase Invoice"):
outstanding_amount = ref_doc.get("outstanding_amount")
+ bill_no = ref_doc.get("bill_no")
elif reference_doctype == "Expense Claim":
outstanding_amount = flt(ref_doc.get("total_sanctioned_amount")) \
- flt(ref_doc.get("total_amount+reimbursed")) - flt(ref_doc.get("total_advance_amount"))
@@ -799,7 +800,8 @@
"due_date": ref_doc.get("due_date"),
"total_amount": total_amount,
"outstanding_amount": outstanding_amount,
- "exchange_rate": exchange_rate
+ "exchange_rate": exchange_rate,
+ "bill_no": bill_no
})
diff --git a/erpnext/accounts/doctype/pos_profile/pos_profile.py b/erpnext/accounts/doctype/pos_profile/pos_profile.py
index e64ad28..4f17e9f 100644
--- a/erpnext/accounts/doctype/pos_profile/pos_profile.py
+++ b/erpnext/accounts/doctype/pos_profile/pos_profile.py
@@ -155,7 +155,6 @@
def set_default_profile(pos_profile, company):
modified = now()
user = frappe.session.user
- company = frappe.db.escape(company)
if pos_profile and company:
frappe.db.sql(""" update `tabPOS Profile User` pfu, `tabPOS Profile` pf
diff --git a/erpnext/accounts/doctype/pricing_rule/pricing_rule.py b/erpnext/accounts/doctype/pricing_rule/pricing_rule.py
index 8c1ddbb..01b935c 100644
--- a/erpnext/accounts/doctype/pricing_rule/pricing_rule.py
+++ b/erpnext/accounts/doctype/pricing_rule/pricing_rule.py
@@ -164,7 +164,7 @@
args_copy.update(item)
data = get_pricing_rule_for_item(args_copy, item.get('price_list_rate'), doc=doc)
out.append(data)
- if set_serial_nos_based_on_fifo and not args.get('is_return'):
+ if not item.get("serial_no") and set_serial_nos_based_on_fifo and not args.get('is_return'):
out[0].update(get_serial_no_for_item(args_copy))
return out
diff --git a/erpnext/accounts/doctype/pricing_rule/utils.py b/erpnext/accounts/doctype/pricing_rule/utils.py
index 936f97c..d3db130 100644
--- a/erpnext/accounts/doctype/pricing_rule/utils.py
+++ b/erpnext/accounts/doctype/pricing_rule/utils.py
@@ -497,8 +497,8 @@
frappe.msgprint(_("Row {0}: user has not applied rule <b>{1}</b> on the item <b>{2}</b>")
.format(item.idx, pr_doc.title, item.item_code))
- if rule_applied and doc.pricing_rules:
- for d in doc.pricing_rules:
+ if rule_applied and doc.get("pricing_rules"):
+ for d in doc.get("pricing_rules"):
key = (d.child_docname, d.pricing_rule)
if key in rule_applied:
d.rule_applied = 1
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
index ac2ce8e..6ca31e7 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
@@ -468,7 +468,7 @@
cur_frm.cscript.cost_center = function(doc, cdt, cdn){
var d = locals[cdt][cdn];
- if(d.idx == 1 && d.cost_center){
+ if(d.cost_center){
var cl = doc.items || [];
for(var i = 0; i < cl.length; i++){
if(!cl[i].cost_center) cl[i].cost_center = d.cost_center;
diff --git a/erpnext/config/desktop.py b/erpnext/config/desktop.py
index 6dc95b2..8ce0964 100644
--- a/erpnext/config/desktop.py
+++ b/erpnext/config/desktop.py
@@ -81,9 +81,9 @@
"description": "Sales pipeline, leads, opportunities and customers."
},
{
- "module_name": "Help Desk",
+ "module_name": "Support",
"category": "Modules",
- "label": _("Help Desk"),
+ "label": _("Support"),
"color": "#1abc9c",
"icon": "fa fa-check-square-o",
"type": "module",
diff --git a/erpnext/config/help_desk.py b/erpnext/config/help_desk.py
deleted file mode 100644
index c19dd42..0000000
--- a/erpnext/config/help_desk.py
+++ /dev/null
@@ -1,82 +0,0 @@
-from __future__ import unicode_literals
-from frappe import _
-
-def get_data():
- return [
- {
- "label": _("Issues"),
- "items": [
- {
- "type": "doctype",
- "name": "Issue",
- "description": _("Support queries from customers."),
- "onboard": 1,
- },
- {
- "type": "doctype",
- "name": "Communication",
- "description": _("Communication log."),
- "onboard": 1,
- },
- ]
- },
- {
- "label": _("Warranty"),
- "items": [
- {
- "type": "doctype",
- "name": "Warranty Claim",
- "description": _("Warranty Claim against Serial No."),
- },
- {
- "type": "doctype",
- "name": "Serial No",
- "description": _("Single unit of an Item."),
- },
- ]
- },
- {
- "label": _("Service Level Agreement"),
- "items": [
- {
- "type": "doctype",
- "name": "Employee Group",
- "description": _("Support Team."),
- },
- {
- "type": "doctype",
- "name": "Service Level",
- "description": _("Service Level."),
- },
- {
- "type": "doctype",
- "name": "Service Level Agreement",
- "description": _("Service Level Agreement."),
- }
- ]
- },
- {
- "label": _("Reports"),
- "icon": "fa fa-list",
- "items": [
- {
- "type": "page",
- "name": "support-analytics",
- "label": _("Support Analytics"),
- "icon": "fa fa-bar-chart"
- },
- {
- "type": "report",
- "name": "Minutes to First Response for Issues",
- "doctype": "Issue",
- "is_query_report": True
- },
- {
- "type": "report",
- "name": "Support Hours",
- "doctype": "Issue",
- "is_query_report": True
- },
- ]
- },
- ]
\ No newline at end of file
diff --git a/erpnext/config/hr.py b/erpnext/config/hr.py
index f517a5e..0f009b8 100644
--- a/erpnext/config/hr.py
+++ b/erpnext/config/hr.py
@@ -289,6 +289,11 @@
},
{
"type": "doctype",
+ "name": "Expense Claim",
+ "dependencies": ["Employee"]
+ },
+ {
+ "type": "doctype",
"name": "Loan Type",
},
{
@@ -296,6 +301,10 @@
"name": "Loan Application",
"dependencies": ["Employee"]
},
+ {
+ "type": "doctype",
+ "name": "Loan"
+ }
]
},
{
diff --git a/erpnext/config/selling.py b/erpnext/config/selling.py
index 4a65af3..400f6be 100644
--- a/erpnext/config/selling.py
+++ b/erpnext/config/selling.py
@@ -29,6 +29,13 @@
},
{
"type": "doctype",
+ "name": "Sales Invoice",
+ "description": _("Invoices for Costumers."),
+ "onboard": 1,
+ "dependencies": ["Item", "Customer"],
+ },
+ {
+ "type": "doctype",
"name": "Sales Partner",
"description": _("Manage Sales Partners."),
"dependencies": ["Item"],
diff --git a/erpnext/config/support.py b/erpnext/config/support.py
index 3980b42..c19dd42 100644
--- a/erpnext/config/support.py
+++ b/erpnext/config/support.py
@@ -10,11 +10,13 @@
"type": "doctype",
"name": "Issue",
"description": _("Support queries from customers."),
+ "onboard": 1,
},
{
"type": "doctype",
"name": "Communication",
"description": _("Communication log."),
+ "onboard": 1,
},
]
},
@@ -34,6 +36,26 @@
]
},
{
+ "label": _("Service Level Agreement"),
+ "items": [
+ {
+ "type": "doctype",
+ "name": "Employee Group",
+ "description": _("Support Team."),
+ },
+ {
+ "type": "doctype",
+ "name": "Service Level",
+ "description": _("Service Level."),
+ },
+ {
+ "type": "doctype",
+ "name": "Service Level Agreement",
+ "description": _("Service Level Agreement."),
+ }
+ ]
+ },
+ {
"label": _("Reports"),
"icon": "fa fa-list",
"items": [
@@ -57,24 +79,4 @@
},
]
},
- {
- "label": _("Service Level Agreement"),
- "items": [
- {
- "type": "doctype",
- "name": "Employee Group",
- "description": _("Support Team."),
- },
- {
- "type": "doctype",
- "name": "Service Level",
- "description": _("Service Level."),
- },
- {
- "type": "doctype",
- "name": "Service Level Agreement",
- "description": _("Service Level Agreement."),
- }
- ]
- },
- ]
+ ]
\ No newline at end of file
diff --git a/erpnext/hooks.py b/erpnext/hooks.py
index 2fac232..608e8b2 100644
--- a/erpnext/hooks.py
+++ b/erpnext/hooks.py
@@ -152,7 +152,6 @@
{"title": _("Issues"), "route": "/issues", "reference_doctype": "Issue", "role":"Customer"},
{"title": _("Addresses"), "route": "/addresses", "reference_doctype": "Address"},
{"title": _("Timesheets"), "route": "/timesheets", "reference_doctype": "Timesheet", "role":"Customer"},
- {"title": _("Timesheets"), "route": "/timesheets", "reference_doctype": "Timesheet", "role":"Customer"},
{"title": _("Lab Test"), "route": "/lab-test", "reference_doctype": "Lab Test", "role":"Patient"},
{"title": _("Prescription"), "route": "/prescription", "reference_doctype": "Patient Encounter", "role":"Patient"},
{"title": _("Patient Appointment"), "route": "/patient-appointments", "reference_doctype": "Patient Appointment", "role":"Patient"},
@@ -332,4 +331,4 @@
'match_field': 'contact_email',
'personal_fields': ['contact_mobile', 'contact_display', 'customer_name'],
}
-]
\ No newline at end of file
+]
diff --git a/erpnext/hr/report/salary_register/salary_register.py b/erpnext/hr/report/salary_register/salary_register.py
index 0c42150..586ca67 100644
--- a/erpnext/hr/report/salary_register/salary_register.py
+++ b/erpnext/hr/report/salary_register/salary_register.py
@@ -14,11 +14,11 @@
columns, earning_types, ded_types = get_columns(salary_slips)
ss_earning_map = get_ss_earning_map(salary_slips)
ss_ded_map = get_ss_ded_map(salary_slips)
-
+ doj_map = get_employee_doj_map()
data = []
for ss in salary_slips:
- row = [ss.name, ss.employee, ss.employee_name, ss.branch, ss.department, ss.designation,
+ row = [ss.name, ss.employee, ss.employee_name, doj_map.get(ss.employee), ss.branch, ss.department, ss.designation,
ss.company, ss.start_date, ss.end_date, ss.leave_without_pay, ss.payment_days]
if not ss.branch == None:columns[3] = columns[3].replace('-1','120')
@@ -44,17 +44,17 @@
def get_columns(salary_slips):
"""
columns = [
- _("Salary Slip ID") + ":Link/Salary Slip:150",_("Employee") + ":Link/Employee:120", _("Employee Name") + "::140", _("Branch") + ":Link/Branch:120",
- _("Department") + ":Link/Department:120", _("Designation") + ":Link/Designation:120",
- _("Company") + ":Link/Company:120", _("Start Date") + "::80", _("End Date") + "::80", _("Leave Without Pay") + ":Float:130",
- _("Payment Days") + ":Float:120"
+ _("Salary Slip ID") + ":Link/Salary Slip:150",_("Employee") + ":Link/Employee:120", _("Employee Name") + "::140",
+ _("Date of Joining") + "::80", _("Branch") + ":Link/Branch:120", _("Department") + ":Link/Department:120",
+ _("Designation") + ":Link/Designation:120", _("Company") + ":Link/Company:120", _("Start Date") + "::80",
+ _("End Date") + "::80", _("Leave Without Pay") + ":Float:130", _("Payment Days") + ":Float:120"
]
"""
columns = [
- _("Salary Slip ID") + ":Link/Salary Slip:150",_("Employee") + ":Link/Employee:120", _("Employee Name") + "::140", _("Branch") + ":Link/Branch:-1",
- _("Department") + ":Link/Department:-1", _("Designation") + ":Link/Designation:-1",
- _("Company") + ":Link/Company:120", _("Start Date") + "::80", _("End Date") + "::80", _("Leave Without Pay") + ":Float:-1",
- _("Payment Days") + ":Float:120"
+ _("Salary Slip ID") + ":Link/Salary Slip:150",_("Employee") + ":Link/Employee:120", _("Employee Name") + "::140",
+ _("Date of Joining") + "::80", _("Branch") + ":Link/Branch:-1", _("Department") + ":Link/Department:-1",
+ _("Designation") + ":Link/Designation:-1", _("Company") + ":Link/Company:120", _("Start Date") + "::80",
+ _("End Date") + "::80", _("Leave Without Pay") + ":Float:-1", _("Payment Days") + ":Float:120"
]
salary_components = {_("Earning"): [], _("Deduction"): []}
@@ -93,6 +93,16 @@
return conditions, filters
+def get_employee_doj_map():
+ return frappe._dict(frappe.db.sql("""
+ SELECT
+ employee,
+ date_of_joining
+ FROM `tabEmployee`
+ WHERE
+ `status`='Active'
+ """))
+
def get_ss_earning_map(salary_slips):
ss_earnings = frappe.db.sql("""select parent, salary_component, amount
from `tabSalary Detail` where parent in (%s)""" %
@@ -115,4 +125,4 @@
ss_ded_map.setdefault(d.parent, frappe._dict()).setdefault(d.salary_component, [])
ss_ded_map[d.parent][d.salary_component] = flt(d.amount)
- return ss_ded_map
+ return ss_ded_map
\ No newline at end of file
diff --git a/erpnext/patches/v12_0/move_item_tax_to_item_tax_template.py b/erpnext/patches/v12_0/move_item_tax_to_item_tax_template.py
index 68db591..575ebeb 100644
--- a/erpnext/patches/v12_0/move_item_tax_to_item_tax_template.py
+++ b/erpnext/patches/v12_0/move_item_tax_to_item_tax_template.py
@@ -3,6 +3,8 @@
from six import iteritems
def execute():
+ if "tax_type" not in frappe.db.get_table_columns("Item Tax"):
+ return
old_item_taxes = {}
item_tax_templates = {}
rename_template_to_untitled = []
@@ -40,7 +42,7 @@
item.set("taxes", [])
item.append("taxes", {"item_tax_template": item_tax_template_name, "tax_category": ""})
item.save()
-
+
doctypes = [
'Quotation', 'Sales Order', 'Delivery Note', 'Sales Invoice',
'Supplier Quotation', 'Purchase Order', 'Purchase Receipt', 'Purchase Invoice'
diff --git a/erpnext/public/.gitignore b/erpnext/public/.gitignore
new file mode 100644
index 0000000..3c3629e
--- /dev/null
+++ b/erpnext/public/.gitignore
@@ -0,0 +1 @@
+node_modules
diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js
index fa1b6df..1bfcd6f 100644
--- a/erpnext/public/js/controllers/transaction.js
+++ b/erpnext/public/js/controllers/transaction.js
@@ -1393,7 +1393,9 @@
},
callback: function(r) {
if(!r.exc) {
- me.frm.set_value("taxes", r.message);
+ for (let tax of r.message) {
+ me.frm.add_child("taxes", tax);
+ }
me.calculate_taxes_and_totals();
}
}
diff --git a/erpnext/public/node_modules b/erpnext/public/node_modules
deleted file mode 120000
index 903b09c..0000000
--- a/erpnext/public/node_modules
+++ /dev/null
@@ -1 +0,0 @@
-/Users/netchampfaris/frappe-bench/apps/erpnext/node_modules
\ No newline at end of file
diff --git a/erpnext/regional/doctype/gstr_3b_report/test_gstr_3b_report.py b/erpnext/regional/doctype/gstr_3b_report/test_gstr_3b_report.py
index 2e9f536..d50eaeb 100644
--- a/erpnext/regional/doctype/gstr_3b_report/test_gstr_3b_report.py
+++ b/erpnext/regional/doctype/gstr_3b_report/test_gstr_3b_report.py
@@ -5,6 +5,7 @@
import frappe
import unittest
+from frappe.utils import getdate
from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice
from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import make_purchase_invoice
from erpnext.stock.doctype.item.test_item import make_item
@@ -12,10 +13,27 @@
class TestGSTR3BReport(unittest.TestCase):
def test_gstr_3b_report(self):
+
+ month_number_mapping = {
+ 1: "January",
+ 2: "February",
+ 3: "March",
+ 4: "April",
+ 5: "May",
+ 6: "June",
+ 7: "July",
+ 8: "August",
+ 9: "September",
+ 10: "October",
+ 11: "November",
+ 12: "December"
+ }
+
frappe.set_user("Administrator")
frappe.db.sql("delete from `tabSales Invoice` where company='_Test Company GST'")
frappe.db.sql("delete from `tabPurchase Invoice` where company='_Test Company GST'")
+ frappe.db.sql("delete from `tabGSTR 3B Report` where company='_Test Company GST'")
make_company()
make_item("Milk", properties = {"is_nil_exempt": 1, "standard_rate": 0.000000})
@@ -33,8 +51,8 @@
"doctype": "GSTR 3B Report",
"company": "_Test Company GST",
"company_address": "_Test Address-Billing",
- "year": "2019",
- "month": "March"
+ "year": getdate().year,
+ "month": month_number_mapping.get(getdate().month)
}).insert()
output = json.loads(report.json_output)
@@ -55,7 +73,6 @@
income_account = 'Sales - _GST',
expense_account = 'Cost of Goods Sold - _GST',
cost_center = 'Main - _GST',
- posting_date = '2019-03-10',
do_not_save=1
)
@@ -77,7 +94,6 @@
income_account = 'Sales - _GST',
expense_account = 'Cost of Goods Sold - _GST',
cost_center = 'Main - _GST',
- posting_date = '2019-03-10',
do_not_save=1
)
@@ -99,7 +115,6 @@
income_account = 'Sales - _GST',
expense_account = 'Cost of Goods Sold - _GST',
cost_center = 'Main - _GST',
- posting_date = '2019-03-10',
do_not_save=1
)
@@ -122,7 +137,6 @@
income_account = 'Sales - _GST',
expense_account = 'Cost of Goods Sold - _GST',
cost_center = 'Main - _GST',
- posting_date = '2019-03-10',
do_not_save=1
)
si3.submit()
@@ -135,7 +149,6 @@
currency = 'INR',
warehouse = 'Finished Goods - _GST',
cost_center = 'Main - _GST',
- posting_date = '2019-03-10',
do_not_save=1,
)
@@ -157,7 +170,6 @@
currency = 'INR',
warehouse = 'Finished Goods - _GST',
cost_center = 'Main - _GST',
- posting_date = '2019-03-10',
item = "Milk",
do_not_save=1
)
diff --git a/erpnext/regional/india/setup.py b/erpnext/regional/india/setup.py
index f7057aa..bad99ba 100644
--- a/erpnext/regional/india/setup.py
+++ b/erpnext/regional/india/setup.py
@@ -265,6 +265,7 @@
'Purchase Order Item': [hsn_sac_field, nil_rated_exempt, is_non_gst],
'Purchase Receipt Item': [hsn_sac_field, nil_rated_exempt, is_non_gst],
'Purchase Invoice Item': [hsn_sac_field, nil_rated_exempt, is_non_gst],
+ 'Material Request Item': [hsn_sac_field, nil_rated_exempt, is_non_gst],
'Employee': [
dict(fieldname='ifsc_code', label='IFSC Code',
fieldtype='Data', insert_after='bank_ac_no', print_hide=1,
diff --git a/erpnext/regional/italy/utils.py b/erpnext/regional/italy/utils.py
index e1a4c67..876bdcf 100644
--- a/erpnext/regional/italy/utils.py
+++ b/erpnext/regional/italy/utils.py
@@ -5,6 +5,7 @@
from erpnext.controllers.taxes_and_totals import get_itemised_tax
from frappe import _
from frappe.core.doctype.file.file import remove_file
+from six import string_types
from frappe.desk.form.load import get_attachments
from erpnext.regional.italy import state_codes
@@ -151,7 +152,7 @@
tax_amount=(reference_row.tax_amount * tax.rate) / 100,
net_amount=reference_row.tax_amount,
taxable_amount=reference_row.tax_amount,
- item_tax_rate="{}",
+ item_tax_rate={tax.account_head: tax.rate},
charges=True
)
)
@@ -159,10 +160,16 @@
#Check item tax rates if tax rate is zero.
if tax.rate == 0:
for item in items:
- item_tax_rate = json.loads(item.item_tax_rate)
- if tax.account_head in item_tax_rate:
+ item_tax_rate = item.item_tax_rate
+ if isinstance(item.item_tax_rate, string_types):
+ item_tax_rate = json.loads(item.item_tax_rate)
+
+ if item_tax_rate and tax.account_head in item_tax_rate:
key = cstr(item_tax_rate[tax.account_head])
- summary_data.setdefault(key, {"tax_amount": 0.0, "taxable_amount": 0.0, "tax_exemption_reason": "", "tax_exemption_law": ""})
+ if key not in summary_data:
+ summary_data.setdefault(key, {"tax_amount": 0.0, "taxable_amount": 0.0,
+ "tax_exemption_reason": "", "tax_exemption_law": ""})
+
summary_data[key]["tax_amount"] += item.tax_amount
summary_data[key]["taxable_amount"] += item.net_amount
if key == "0.0":
diff --git a/erpnext/selling/page/point_of_sale/point_of_sale.js b/erpnext/selling/page/point_of_sale/point_of_sale.js
index b098fde..4c0f42d 100644
--- a/erpnext/selling/page/point_of_sale/point_of_sale.js
+++ b/erpnext/selling/page/point_of_sale/point_of_sale.js
@@ -233,13 +233,21 @@
} else {
this.update_item_in_frm(item, field, value)
.then(() => {
- this.frm.doc.items.forEach(item_row => {
- // update cart
- frappe.run_serially([
- () => this.update_cart_data(item_row),
- () => this.set_form_action()
- ]);
- });
+ frappe.dom.unfreeze();
+ frappe.run_serially([
+ () => {
+ let items = this.frm.doc.items.map(item => item.name);
+ if (items && items.length > 0 && items.includes(item.name)) {
+ this.frm.doc.items.forEach(item_row => {
+ // update cart
+ this.on_qty_change(item_row);
+ });
+ } else {
+ this.on_qty_change(item);
+ }
+ },
+ () => this.post_qty_change(item)
+ ]);
});
}
return;
@@ -260,9 +268,20 @@
.then(() => {
this.frm.script_manager.trigger('qty', item.doctype, item.name)
.then(() => {
- this.frm.doc.items.forEach(item => {
- this.update_cart_data(item);
- });
+ frappe.run_serially([
+ () => {
+ let items = this.frm.doc.items.map(i => i.name);
+ if (items && items.length > 0 && items.includes(item.name)) {
+ this.frm.doc.items.forEach(item_row => {
+ // update cart
+ this.on_qty_change(item_row);
+ });
+ } else {
+ this.on_qty_change(item);
+ }
+ },
+ () => this.post_qty_change(item)
+ ]);
});
});
},
@@ -280,6 +299,20 @@
]);
}
+ on_qty_change(item) {
+ frappe.run_serially([
+ () => this.update_cart_data(item),
+ ]);
+ }
+
+ post_qty_change(item) {
+ this.cart.update_taxes_and_totals();
+ this.cart.update_grand_total();
+ this.cart.update_qty_total();
+ this.cart.scroll_to_item(item.item_code);
+ this.set_form_action();
+ }
+
select_batch_and_serial_no(row) {
frappe.dom.unfreeze();
@@ -294,7 +327,8 @@
frappe.model.clear_doc(item.doctype, item.name);
}
},
- () => this.update_cart_data(item)
+ () => this.update_cart_data(item),
+ () => this.post_qty_change(item)
]);
});
})
@@ -311,9 +345,6 @@
update_cart_data(item) {
this.cart.add_item(item);
- this.cart.update_taxes_and_totals();
- this.cart.update_grand_total();
- this.cart.update_qty_total();
frappe.dom.unfreeze();
}
@@ -457,16 +488,15 @@
}
setup_company() {
- this.company = frappe.sys_defaults.company;
return new Promise(resolve => {
- if(!this.company) {
+ if(!frappe.sys_defaults.company) {
frappe.prompt({fieldname:"company", options: "Company", fieldtype:"Link",
label: __("Select Company"), reqd: 1}, (data) => {
this.company = data.company;
resolve(this.company);
}, __("Select Company"));
} else {
- resolve(this.company);
+ resolve();
}
})
}
@@ -520,7 +550,9 @@
}
set_pos_profile_data() {
- this.frm.doc.company = this.company;
+ if (this.company) {
+ this.frm.doc.company = this.company;
+ }
return new Promise(resolve => {
return this.frm.call({
@@ -964,7 +996,6 @@
$item.appendTo(this.$cart_items);
}
this.highlight_item(item.item_code);
- this.scroll_to_item(item.item_code);
}
update_item(item) {
@@ -1217,7 +1248,10 @@
clearTimeout(this.last_search);
this.last_search = setTimeout(() => {
const search_term = e.target.value;
- this.filter_items({ search_term });
+ const item_group = this.item_group_field ?
+ this.item_group_field.get_value() : '';
+
+ this.filter_items({ search_term:search_term, item_group: item_group});
}, 300);
});
diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py
index 43d7972..a108305 100644
--- a/erpnext/stock/doctype/item/item.py
+++ b/erpnext/stock/doctype/item/item.py
@@ -118,7 +118,6 @@
self.validate_has_variants()
self.validate_stock_exists_for_template_item()
- self.validate_asset_exists_for_serialized_asset()
self.validate_attributes()
self.validate_variant_attributes()
self.validate_website_image()
@@ -128,6 +127,7 @@
self.validate_uom_conversion_factor()
self.validate_item_defaults()
self.validate_customer_provided_part()
+ self.validate_stock_for_has_batch_and_has_serial()
if not self.get("__islocal"):
self.old_item_group = frappe.db.get_value(self.doctype, self.name, "item_group")
@@ -759,12 +759,6 @@
frappe.throw(
_('Cannot change Attributes after stock transaction. Make a new Item and transfer stock to the new Item'))
- def validate_asset_exists_for_serialized_asset(self):
- if (not self.get("__islocal") and self.asset_exists() and
- cint(self.has_serial_no) != cint(frappe.db.get_value('Item', self.name, 'has_serial_no'))):
- frappe.throw(_("Asset is already exists against the item {0}, you cannot change the has serial no value")
- .format(self.name))
-
def asset_exists(self):
if not hasattr(self, '_asset_created'):
self._asset_created = frappe.db.get_all("Asset",
@@ -824,6 +818,11 @@
for d in self.attributes:
d.variant_of = self.variant_of
+ def validate_stock_for_has_batch_and_has_serial(self):
+ if self.stock_ledger_created():
+ for value in ["has_batch_no", "has_serial_no"]:
+ if frappe.db.get_value("Item", self.name, value) != self.get_value(value):
+ frappe.throw(_("Cannot change {0} as Stock Transaction for Item {1} exist.".format(value, self.name)))
def get_timeline_data(doctype, name):
'''returns timeline data based on stock ledger entry'''
diff --git a/erpnext/stock/doctype/warehouse/warehouse.json b/erpnext/stock/doctype/warehouse/warehouse.json
index 0d60a5c..63e374f 100644
--- a/erpnext/stock/doctype/warehouse/warehouse.json
+++ b/erpnext/stock/doctype/warehouse/warehouse.json
@@ -51,6 +51,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "description": "If blank, parent Warehouse Account or company default will be considered",
"fieldname": "warehouse_name",
"fieldtype": "Data",
"hidden": 0,
@@ -870,7 +871,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
- "modified": "2018-08-29 06:26:48.647225",
+ "modified": "2018-08-29 06:26:49.647225",
"modified_by": "Administrator",
"module": "Stock",
"name": "Warehouse",
diff --git a/erpnext/stock/get_item_details.py b/erpnext/stock/get_item_details.py
index 6d75314..4d8022c 100644
--- a/erpnext/stock/get_item_details.py
+++ b/erpnext/stock/get_item_details.py
@@ -667,28 +667,39 @@
@frappe.whitelist()
def get_pos_profile(company, pos_profile=None, user=None):
- if pos_profile:
- return frappe.get_cached_doc('POS Profile', pos_profile)
+ if pos_profile: return frappe.get_cached_doc('POS Profile', pos_profile)
if not user:
user = frappe.session['user']
+ condition = "pfu.user = %(user)s AND pfu.default=1"
+ if user and company:
+ condition = "pfu.user = %(user)s AND pf.company = %(company)s AND pfu.default=1"
+
pos_profile = frappe.db.sql("""SELECT pf.*
FROM
`tabPOS Profile` pf LEFT JOIN `tabPOS Profile User` pfu
ON
pf.name = pfu.parent
WHERE
- (
- (pfu.user = %(user)s AND pf.company = %(company)s AND pfu.default=1)
- OR (pfu.user = %(user)s AND pfu.default=1)
- OR (ifnull(pfu.user, '') = '' AND pf.company = %(company)s)
- ) AND pf.disabled = 0
- """, {
+ {cond} AND pf.disabled = 0
+ """.format(cond = condition), {
'user': user,
'company': company
}, as_dict=1)
+ if not pos_profile and company:
+ pos_profile = frappe.db.sql("""SELECT pf.*
+ FROM
+ `tabPOS Profile` pf LEFT JOIN `tabPOS Profile User` pfu
+ ON
+ pf.name = pfu.parent
+ WHERE
+ pf.company = %(company)s AND pf.disabled = 0
+ """, {
+ 'company': company
+ }, as_dict=1)
+
return pos_profile and pos_profile[0] or None
def get_serial_nos_by_fifo(args, sales_order=None):
diff --git a/erpnext/support/doctype/issue/issue.json b/erpnext/support/doctype/issue/issue.json
index 02432e6..3a1c5ef 100644
--- a/erpnext/support/doctype/issue/issue.json
+++ b/erpnext/support/doctype/issue/issue.json
@@ -576,7 +576,7 @@
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
- "label": "Agreement Staus",
+ "label": "Agreement Status",
"length": 0,
"no_copy": 0,
"options": "Ongoing\nFulfilled\nFailed",
@@ -1262,17 +1262,15 @@
}
],
"has_web_view": 0,
- "hide_heading": 0,
"hide_toolbar": 0,
"icon": "fa fa-ticket",
"idx": 7,
- "image_view": 0,
"in_create": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 0,
"max_attachments": 0,
- "modified": "2019-03-17 22:42:16.274957",
+ "modified": "2019-04-04 10:55:40.222692",
"modified_by": "Administrator",
"module": "Support",
"name": "Issue",
@@ -1300,7 +1298,6 @@
],
"quick_entry": 1,
"read_only": 0,
- "read_only_onload": 0,
"search_fields": "status,customer,subject,raised_by",
"show_name_in_global_search": 0,
"sort_order": "ASC",