Merge pull request #9811 from rohitwaghchaure/pricing_rule_issue_for_discount
[Fix] Manual discount is not applying in the transaction if discount amount is zero in the pricing rule
diff --git a/erpnext/accounts/page/pos/pos.js b/erpnext/accounts/page/pos/pos.js
index 02d5428..506427e 100644
--- a/erpnext/accounts/page/pos/pos.js
+++ b/erpnext/accounts/page/pos/pos.js
@@ -1078,7 +1078,7 @@
} else if (item.barcode == me.serach_item.$input.val()) {
search_status = false;
return item.barcode == me.serach_item.$input.val();
- } else if (reg.test(item.item_code.toLowerCase()) || reg.test(item.description.toLowerCase()) ||
+ } else if (reg.test(item.item_code.toLowerCase()) || (item.description && reg.test(item.description.toLowerCase())) ||
reg.test(item.item_name.toLowerCase()) || reg.test(item.item_group.toLowerCase())) {
return true
}
@@ -1351,7 +1351,7 @@
this.child.item_name = this.items[0].item_name;
this.child.stock_uom = this.items[0].stock_uom;
this.child.brand = this.items[0].brand;
- this.child.description = this.items[0].description;
+ this.child.description = this.items[0].description || this.items[0].item_name;
this.child.discount_percentage = 0.0;
this.child.qty = 1;
this.child.item_group = this.items[0].item_group;
diff --git a/erpnext/accounts/party.py b/erpnext/accounts/party.py
index 355803b..bf509de 100644
--- a/erpnext/accounts/party.py
+++ b/erpnext/accounts/party.py
@@ -8,9 +8,10 @@
from frappe import _, msgprint, scrub
from frappe.defaults import get_user_permissions
from frappe.model.utils import get_fetch_values
-from frappe.utils import add_days, getdate, formatdate, get_first_day, date_diff, \
- add_years, get_timestamp, nowdate, flt
-from frappe.contacts.doctype.address.address import get_address_display, get_default_address
+from frappe.utils import (add_days, getdate, formatdate, get_first_day, date_diff,
+ add_years, get_timestamp, nowdate, flt)
+from frappe.contacts.doctype.address.address import (get_address_display,
+ get_default_address, get_company_address)
from frappe.contacts.doctype.contact.contact import get_contact_details, get_default_contact
from erpnext.exceptions import PartyFrozen, PartyDisabled, InvalidAccountCurrency
from erpnext.accounts.utils import get_fiscal_year
@@ -77,8 +78,9 @@
out.update(get_fetch_values(doctype, 'shipping_address_name', out.shipping_address_name))
if doctype and doctype in ['Sales Invoice']:
- out.company_address = get_default_address('Company', company)
- out.update(get_fetch_values(doctype, 'company_address', out.company_address))
+ out.update(get_company_address(company))
+ if out.company_address:
+ out.update(get_fetch_values(doctype, 'company_address', out.company_address))
def set_contact_details(out, party, party_type):
out.contact_person = get_default_contact(party_type, party.name)
diff --git a/erpnext/buying/doctype/supplier_quotation_item/supplier_quotation_item.json b/erpnext/buying/doctype/supplier_quotation_item/supplier_quotation_item.json
index 622e630..62da505 100644
--- a/erpnext/buying/doctype/supplier_quotation_item/supplier_quotation_item.json
+++ b/erpnext/buying/doctype/supplier_quotation_item/supplier_quotation_item.json
@@ -1,5 +1,6 @@
{
"allow_copy": 0,
+ "allow_guest_to_view": 0,
"allow_import": 0,
"allow_rename": 0,
"autoname": "hash",
@@ -13,6 +14,7 @@
"engine": "InnoDB",
"fields": [
{
+ "allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 1,
"collapsible": 0,
@@ -44,6 +46,7 @@
"unique": 0
},
{
+ "allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -73,34 +76,7 @@
"unique": 0
},
{
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "columns": 0,
- "fieldname": "column_break_3",
- "fieldtype": "Column Break",
- "hidden": 0,
- "ignore_user_permissions": 0,
- "ignore_xss_filter": 0,
- "in_filter": 0,
- "in_global_search": 0,
- "in_list_view": 0,
- "in_standard_filter": 0,
- "length": 0,
- "no_copy": 0,
- "permlevel": 0,
- "precision": "",
- "print_hide": 0,
- "print_hide_if_no_value": 0,
- "read_only": 0,
- "remember_last_selected_value": 0,
- "report_hide": 0,
- "reqd": 0,
- "search_index": 0,
- "set_only_once": 0,
- "unique": 0
- },
- {
+ "allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -131,6 +107,66 @@
"unique": 0
},
{
+ "allow_bulk_edit": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "column_break_3",
+ "fieldtype": "Column Break",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "lead_time_days",
+ "fieldtype": "Int",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_global_search": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Lead Time in days",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "unique": 0
+ },
+ {
+ "allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 1,
@@ -160,6 +196,7 @@
"unique": 0
},
{
+ "allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -192,6 +229,7 @@
"width": "300px"
},
{
+ "allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -219,6 +257,7 @@
"unique": 0
},
{
+ "allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -248,6 +287,7 @@
"unique": 0
},
{
+ "allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -278,6 +318,7 @@
"unique": 0
},
{
+ "allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -306,6 +347,7 @@
"unique": 0
},
{
+ "allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 1,
"collapsible": 0,
@@ -338,6 +380,7 @@
"width": "60px"
},
{
+ "allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -368,6 +411,7 @@
"unique": 0
},
{
+ "allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -397,6 +441,7 @@
"unique": 0
},
{
+ "allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -426,6 +471,7 @@
"unique": 0
},
{
+ "allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -453,6 +499,7 @@
"unique": 0
},
{
+ "allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -486,6 +533,7 @@
"width": "100px"
},
{
+ "allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -515,6 +563,7 @@
"unique": 0
},
{
+ "allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -544,6 +593,7 @@
"unique": 0
},
{
+ "allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -571,6 +621,7 @@
"unique": 0
},
{
+ "allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 1,
"collapsible": 0,
@@ -602,6 +653,7 @@
"unique": 0
},
{
+ "allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -633,6 +685,7 @@
"unique": 0
},
{
+ "allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -660,6 +713,7 @@
"unique": 0
},
{
+ "allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -694,6 +748,7 @@
"width": "100px"
},
{
+ "allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -725,6 +780,7 @@
"unique": 0
},
{
+ "allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -754,6 +810,7 @@
"unique": 0
},
{
+ "allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -782,6 +839,7 @@
"unique": 0
},
{
+ "allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -811,6 +869,7 @@
"unique": 0
},
{
+ "allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -841,6 +900,7 @@
"unique": 0
},
{
+ "allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -869,6 +929,7 @@
"unique": 0
},
{
+ "allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -899,6 +960,7 @@
"unique": 0
},
{
+ "allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -929,6 +991,7 @@
"unique": 0
},
{
+ "allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -957,6 +1020,7 @@
"unique": 0
},
{
+ "allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -988,6 +1052,7 @@
"unique": 0
},
{
+ "allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -1017,6 +1082,7 @@
"unique": 0
},
{
+ "allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -1047,6 +1113,7 @@
"unique": 0
},
{
+ "allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -1080,6 +1147,7 @@
"width": "120px"
},
{
+ "allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -1110,6 +1178,7 @@
"unique": 0
},
{
+ "allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -1137,6 +1206,7 @@
"unique": 0
},
{
+ "allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -1167,6 +1237,7 @@
"unique": 0
},
{
+ "allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -1196,6 +1267,7 @@
"unique": 0
},
{
+ "allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -1227,6 +1299,7 @@
"unique": 0
},
{
+ "allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -1259,6 +1332,7 @@
"unique": 0
},
{
+ "allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -1290,6 +1364,7 @@
"unique": 0
},
{
+ "allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -1318,6 +1393,7 @@
"unique": 0
},
{
+ "allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -1347,6 +1423,7 @@
"unique": 0
},
{
+ "allow_bulk_edit": 0,
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
@@ -1377,17 +1454,17 @@
"unique": 0
}
],
+ "has_web_view": 0,
"hide_heading": 0,
"hide_toolbar": 0,
"idx": 1,
"image_view": 0,
"in_create": 0,
- "in_dialog": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 1,
"max_attachments": 0,
- "modified": "2017-02-17 16:43:59.582188",
+ "modified": "2017-07-10 09:08:52.015387",
"modified_by": "Administrator",
"module": "Buying",
"name": "Supplier Quotation Item",
diff --git a/erpnext/controllers/taxes_and_totals.py b/erpnext/controllers/taxes_and_totals.py
index 72785da..8b96152 100644
--- a/erpnext/controllers/taxes_and_totals.py
+++ b/erpnext/controllers/taxes_and_totals.py
@@ -559,7 +559,7 @@
item_tax[item_code][tax.name] = [tax_rate, tax_amount]
else:
- item_tax[item_code][tax.name] = [cstr(flt(tax_data, tax_rate_precision)) + "%", ""]
+ item_tax[item_code][tax.name] = [cstr(flt(tax_data, tax_rate_precision)) + "%", "0.00"]
tax_accounts.append([tax.name, tax.account_head])
return item_tax, tax_accounts
diff --git a/erpnext/crm/doctype/opportunity/opportunity.py b/erpnext/crm/doctype/opportunity/opportunity.py
index 58f26fe..93a2941 100644
--- a/erpnext/crm/doctype/opportunity/opportunity.py
+++ b/erpnext/crm/doctype/opportunity/opportunity.py
@@ -272,4 +272,6 @@
for opportunity in opportunities:
doc = frappe.get_doc("Opportunity", opportunity.get("name"))
doc.status = "Closed"
- doc.save(ignore_permissions=True)
\ No newline at end of file
+ doc.flags.ignore_permissions = True
+ doc.flags.ignore_mandatory = True
+ doc.save()
\ No newline at end of file
diff --git a/erpnext/docs/user/videos/learn/navigation.md b/erpnext/docs/user/videos/learn/navigation.md
index 6099940..cb280fc 100644
--- a/erpnext/docs/user/videos/learn/navigation.md
+++ b/erpnext/docs/user/videos/learn/navigation.md
@@ -1,7 +1,7 @@
# User Interface and Navigation
-<iframe width="660" height="371" src="https://www.youtube.com/embed/HdblX7kOWWs" frameborder="0" allowfullscreen></iframe>
+<iframe width="660" height="371" src="https://www.youtube.com/embed/vKjHRzMEei0" frameborder="0" allowfullscreen></iframe>
-**Duration: 2:17**
+**Duration: 2:41**
This video walks you through using the ERPNext "Desk" interface. The ERPNext User Interface is very web friendly and if you have used a website or mobile app before, the navigation should be very intuitive.
diff --git a/erpnext/manufacturing/doctype/production_order/production_order.js b/erpnext/manufacturing/doctype/production_order/production_order.js
index f6d9eaf..657819a 100644
--- a/erpnext/manufacturing/doctype/production_order/production_order.js
+++ b/erpnext/manufacturing/doctype/production_order/production_order.js
@@ -212,7 +212,9 @@
frappe.ui.form.on("Production Order Item", {
source_warehouse: function(frm, cdt, cdn) {
var row = locals[cdt][cdn];
- if(row.source_warehouse) {
+ if(!row.item_code) {
+ frappe.throw(__("Please set the Item Code first"));
+ } else if(row.source_warehouse) {
frappe.call({
"method": "erpnext.stock.utils.get_latest_stock_qty",
args: {
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index d833638..3d4d24e 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -415,4 +415,5 @@
erpnext.patches.v8_1.gst_fixes #2017-07-06
erpnext.patches.v8_0.update_production_orders
erpnext.patches.v8_1.remove_sales_invoice_from_returned_serial_no
-erpnext.patches.v8_1.allow_invoice_copy_to_edit_after_submit
\ No newline at end of file
+erpnext.patches.v8_1.allow_invoice_copy_to_edit_after_submit
+erpnext.patches.v8_1.update_gst_state
\ No newline at end of file
diff --git a/erpnext/patches/v8_1/update_gst_state.py b/erpnext/patches/v8_1/update_gst_state.py
new file mode 100644
index 0000000..2bbb6b8
--- /dev/null
+++ b/erpnext/patches/v8_1/update_gst_state.py
@@ -0,0 +1,6 @@
+import frappe
+from erpnext.regional.india import states
+
+def execute():
+ frappe.db.sql("update `tabCustom Field` set options=%s where fieldname='gst_state'", '\n'.join(states))
+ frappe.db.sql("update `tabAddress` set gst_state='Chhattisgarh' where gst_state='Chattisgarh'")
diff --git a/erpnext/public/js/controllers/taxes_and_totals.js b/erpnext/public/js/controllers/taxes_and_totals.js
index e09925d..837097b 100644
--- a/erpnext/public/js/controllers/taxes_and_totals.js
+++ b/erpnext/public/js/controllers/taxes_and_totals.js
@@ -675,7 +675,7 @@
item_tax[item_code][tax.name] = [tax_rate, tax_amount];
} else {
- item_tax[item_code][tax.name] = [flt(tax_data, tax_rate_precision) + "%", ""];
+ item_tax[item_code][tax.name] = [flt(tax_data, tax_rate_precision) + "%", "0.00"];
}
});
tax_accounts.push([tax.name, tax.account_head]);
diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js
index cff71f6..9ed1de2 100644
--- a/erpnext/public/js/controllers/transaction.js
+++ b/erpnext/public/js/controllers/transaction.js
@@ -338,7 +338,7 @@
this.frm.trigger("item_code", cdt, cdn);
}
else {
- var sr_no = [];
+ var valid_serial_nos = [];
// Replacing all occurences of comma with carriage return
var serial_nos = item.serial_no.trim().replace(/,/g, '\n');
@@ -347,21 +347,19 @@
// Trim each string and push unique string to new list
for (var x=0; x<=serial_nos.length - 1; x++) {
- if (serial_nos[x].trim() != "" && sr_no.indexOf(serial_nos[x].trim()) == -1) {
- sr_no.push(serial_nos[x].trim());
+ if (serial_nos[x].trim() != "" && valid_serial_nos.indexOf(serial_nos[x].trim()) == -1) {
+ valid_serial_nos.push(serial_nos[x].trim());
}
}
// Add the new list to the serial no. field in grid with each in new line
- item.serial_no = "";
- for (var x=0; x<=sr_no.length - 1; x++)
- item.serial_no += sr_no[x] + '\n';
+ item.serial_no = valid_serial_nos.join('\n');
refresh_field("serial_no", item.name, item.parentfield);
if(!doc.is_return) {
frappe.model.set_value(item.doctype, item.name,
- "qty", sr_no.length / item.conversion_factor);
- frappe.model.set_value(item.doctype, item.name, "stock_qty", sr_no.length);
+ "qty", valid_serial_nos.length / item.conversion_factor);
+ frappe.model.set_value(item.doctype, item.name, "stock_qty", valid_serial_nos.length);
}
}
}
diff --git a/erpnext/public/js/utils/serial_no_batch_selector.js b/erpnext/public/js/utils/serial_no_batch_selector.js
index fdab832..c7a2f77 100644
--- a/erpnext/public/js/utils/serial_no_batch_selector.js
+++ b/erpnext/public/js/utils/serial_no_batch_selector.js
@@ -50,6 +50,14 @@
batches.grid.refresh();
batches.grid.add_new_row(null, null, null);
}
+ },
+ get_query: function() {
+ return {
+ filters: {
+ is_group: 0,
+ company: me.frm.doc.company
+ }
+ };
}
},
{fieldtype:'Column Break'},
diff --git a/erpnext/regional/india/__init__.py b/erpnext/regional/india/__init__.py
index 9a6c376..4a9a211 100644
--- a/erpnext/regional/india/__init__.py
+++ b/erpnext/regional/india/__init__.py
@@ -1,11 +1,12 @@
states = [
'',
+ 'Andaman and Nicobar Islands',
'Andhra Pradesh',
'Arunachal Pradesh',
'Assam',
'Bihar',
'Chandigarh',
- 'Chattisgarh',
+ 'Chhattisgarh',
'Dadra and Nagar Haveli',
'Daman and Diu',
'Delhi',
@@ -25,6 +26,7 @@
'Mizoram',
'Nagaland',
'Odisha',
+ 'Other Territory',
'Pondicherry',
'Punjab',
'Rajasthan',
@@ -38,12 +40,13 @@
]
state_numbers = {
+ "Andaman and Nicobar Islands": "35",
"Andhra Pradesh": "37",
"Arunachal Pradesh": "12",
"Assam": "18",
"Bihar": "10",
"Chandigarh": "04",
- "Chattisgarh": "22",
+ "Chhattisgarh": "22",
"Dadra and Nagar Haveli": "26",
"Daman and Diu": "25",
"Delhi": "07",
@@ -63,6 +66,7 @@
"Mizoram": "15",
"Nagaland": "13",
"Odisha": "21",
+ "Other Territory": "98",
"Pondicherry": "34",
"Punjab": "03",
"Rajasthan": "08",
@@ -70,7 +74,7 @@
"Tamil Nadu": "33",
"Telangana": "36",
"Tripura": "16",
- "Uttar Pradesh": "35",
- "Uttarakhand": "36",
- "West Bengal": "19"
+ "Uttar Pradesh": "09",
+ "Uttarakhand": "05",
+ "West Bengal": "19",
}
\ No newline at end of file
diff --git a/erpnext/selling/doctype/customer/customer.py b/erpnext/selling/doctype/customer/customer.py
index 3b9d675..d797632 100644
--- a/erpnext/selling/doctype/customer/customer.py
+++ b/erpnext/selling/doctype/customer/customer.py
@@ -9,7 +9,7 @@
from frappe.utils import flt, cint, cstr
from frappe.desk.reportview import build_match_conditions
from erpnext.utilities.transaction_base import TransactionBase
-from erpnext.accounts.party import validate_party_accounts, get_dashboard_info # keep this
+from erpnext.accounts.party import validate_party_accounts, get_dashboard_info, get_timeline_data # keep this
from frappe.contacts.address_and_contact import load_address_and_contact, delete_contact_and_address
class Customer(TransactionBase):
diff --git a/erpnext/selling/doctype/sales_order/sales_order.py b/erpnext/selling/doctype/sales_order/sales_order.py
index ccaa07c..4333fd8 100644
--- a/erpnext/selling/doctype/sales_order/sales_order.py
+++ b/erpnext/selling/doctype/sales_order/sales_order.py
@@ -7,11 +7,12 @@
import frappe.utils
from frappe.utils import cstr, flt, getdate, comma_and, cint
from frappe import _
+from frappe.model.utils import get_fetch_values
from frappe.model.mapper import get_mapped_doc
from erpnext.stock.stock_balance import update_bin_qty, get_reserved_qty
from frappe.desk.notifications import clear_doctype_notifications
from erpnext.controllers.recurring_document import month_map, get_next_date
-
+from frappe.contacts.doctype.address.address import get_company_address
from erpnext.controllers.selling_controller import SellingController
form_grid_templates = {
@@ -504,6 +505,11 @@
target.run_method("set_missing_values")
target.run_method("calculate_taxes_and_totals")
+ # set company address
+ target.update(get_company_address(target.company))
+ if target.company_address:
+ target.update(get_fetch_values("Sales Invoice", 'company_address', target.company_address))
+
def update_item(source, target, source_parent):
target.amount = flt(source.amount) - flt(source.billed_amt)
target.base_amount = target.amount * flt(source_parent.conversion_rate)
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.py b/erpnext/stock/doctype/delivery_note/delivery_note.py
index 7523409..5c5f0f8 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note.py
+++ b/erpnext/stock/doctype/delivery_note/delivery_note.py
@@ -8,10 +8,12 @@
from frappe import msgprint, _
import frappe.defaults
+from frappe.model.utils import get_fetch_values
from frappe.model.mapper import get_mapped_doc
from erpnext.controllers.selling_controller import SellingController
from frappe.desk.notifications import clear_doctype_notifications
from erpnext.stock.doctype.batch.batch import set_batch_nos
+from frappe.contacts.doctype.address.address import get_company_address
form_grid_templates = {
"items": "templates/form_grid/item_grid.html"
@@ -371,7 +373,7 @@
def make_sales_invoice(source_name, target_doc=None):
invoiced_qty_map = get_invoiced_qty_map(source_name)
- def update_accounts(source, target):
+ def set_missing_values(source, target):
target.is_pos = 0
target.ignore_pricing_rule = 1
target.run_method("set_missing_values")
@@ -381,6 +383,11 @@
target.run_method("calculate_taxes_and_totals")
+ # set company address
+ target.update(get_company_address(target.company))
+ if target.company_address:
+ target.update(get_fetch_values("Sales Invoice", 'company_address', target.company_address))
+
def update_item(source_doc, target_doc, source_parent):
target_doc.qty = source_doc.qty - invoiced_qty_map.get(source_doc.name, 0)
@@ -415,7 +422,7 @@
},
"add_if_empty": True
}
- }, target_doc, update_accounts)
+ }, target_doc, set_missing_values)
return doc
diff --git a/erpnext/support/doctype/issue/issue.py b/erpnext/support/doctype/issue/issue.py
index 8a0be85..ab73b34 100644
--- a/erpnext/support/doctype/issue/issue.py
+++ b/erpnext/support/doctype/issue/issue.py
@@ -90,7 +90,9 @@
for issue in issues:
doc = frappe.get_doc("Issue", issue.get("name"))
doc.status = "Closed"
- doc.save(ignore_permissions=True)
+ doc.flags.ignore_permissions = True
+ doc.flags.ignore_mandatory = True
+ doc.save()
@frappe.whitelist()
def set_multiple_status(names, status):
diff --git a/erpnext/templates/print_formats/includes/taxes.html b/erpnext/templates/print_formats/includes/taxes.html
index b0bd1d4..b180c1c 100644
--- a/erpnext/templates/print_formats/includes/taxes.html
+++ b/erpnext/templates/print_formats/includes/taxes.html
@@ -17,7 +17,7 @@
{{ render_discount_amount(doc) }}
{%- endif -%}
{%- for charge in data -%}
- {%- if not charge.included_in_print_rate -%}
+ {%- if charge.tax_amount and not charge.included_in_print_rate -%}
<div class="row">
<div class="col-xs-5 {%- if not doc._align_labels_left %} text-right{%- endif -%}">
<label>{{ charge.get_formatted("description") }}</label></div>