Merge pull request #2726 from pdvyas/lang
Add Bosnian and Catalin language
diff --git a/erpnext/__version__.py b/erpnext/__version__.py
index 7ef9960..c975a31 100644
--- a/erpnext/__version__.py
+++ b/erpnext/__version__.py
@@ -1 +1 @@
-__version__ = '4.20.2'
+__version__ = '4.21.4'
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
index 6c7e87f..c9a4ff0 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
@@ -405,7 +405,7 @@
# Hence the first condition is an "OR"
return frappe.db.sql("""select tabAccount.name from `tabAccount`
where (tabAccount.report_type = "Profit and Loss"
- or tabAccount.account_type = "Expense Account")
+ or tabAccount.account_type in ("Expense Account", "Fixed Asset"))
and tabAccount.group_or_ledger="Ledger"
and tabAccount.docstatus!=2
and ifnull(tabAccount.master_type, "")=""
diff --git a/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py b/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py
index 127e9cb..100051a 100644
--- a/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py
+++ b/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py
@@ -10,40 +10,40 @@
if not filters: filters = {}
columns = get_columns()
last_col = len(columns)
-
+
item_list = get_items(filters)
aii_account_map = get_aii_accounts()
if item_list:
item_tax, tax_accounts = get_tax_accounts(item_list, columns)
-
+
data = []
for d in item_list:
expense_account = d.expense_account or aii_account_map.get(d.company)
- row = [d.item_code, d.item_name, d.item_group, d.parent, d.posting_date,
- d.supplier_name, d.credit_to, d.project_name, d.company, d.purchase_order,
+ row = [d.item_code, d.item_name, d.item_group, d.parent, d.posting_date,
+ d.supplier_name, d.credit_to, d.project_name, d.company, d.purchase_order,
d.purchase_receipt, expense_account, d.qty, d.base_rate, d.base_amount]
for tax in tax_accounts:
row.append(item_tax.get(d.parent, {}).get(d.item_code, {}).get(tax, 0))
total_tax = sum(row[last_col:])
row += [total_tax, d.base_amount + total_tax]
-
+
data.append(row)
-
+
return columns, data
-
-
+
+
def get_columns():
- return [_("Item Code") + ":Link/Item:120", _("Item Name") + "::120", _("Item Group") + ":Link/Item Group:100",
- _("Invoice") + ":Link/Purchase Invoice:120", _("Posting Date") + ":Date:80", _("Supplier") + ":Link/Customer:120",
- _("Supplier Account") + ":Link/Account:120", _("Project") + ":Link/Project:80", _("Company") + ":Link/Company:100",
- _("Purchase Order") + ":Link/Purchase Order:100", _("Purchase Receipt") + ":Link/Purchase Receipt:100",
- _("Expense Account") + ":Link/Account:140", _("Qty") + ":Float:120", _("Rate") + ":Currency:120",
+ return [_("Item Code") + ":Link/Item:120", _("Item Name") + "::120", _("Item Group") + ":Link/Item Group:100",
+ _("Invoice") + ":Link/Purchase Invoice:120", _("Posting Date") + ":Date:80", _("Supplier") + ":Link/Customer:120",
+ _("Supplier Account") + ":Link/Account:120", _("Project") + ":Link/Project:80", _("Company") + ":Link/Company:100",
+ _("Purchase Order") + ":Link/Purchase Order:100", _("Purchase Receipt") + ":Link/Purchase Receipt:100",
+ _("Expense Account") + ":Link/Account:140", _("Qty") + ":Float:120", _("Rate") + ":Currency:120",
_("Amount") + ":Currency:120"]
-
+
def get_conditions(filters):
conditions = ""
-
+
for opts in (("company", " and company=%(company)s"),
("account", " and pi.credit_to = %(account)s"),
("item_code", " and pi_item.item_code = %(item_code)s"),
@@ -53,48 +53,56 @@
conditions += opts[1]
return conditions
-
+
def get_items(filters):
conditions = get_conditions(filters)
match_conditions = frappe.build_match_conditions("Purchase Invoice")
-
- return frappe.db.sql("""select pi_item.parent, pi.posting_date, pi.credit_to, pi.company,
- pi.supplier, pi.remarks, pi_item.item_code, pi_item.item_name, pi_item.item_group,
- pi_item.project_name, pi_item.purchase_order, pi_item.purchase_receipt,
+
+ return frappe.db.sql("""select pi_item.parent, pi.posting_date, pi.credit_to, pi.company,
+ pi.supplier, pi.remarks, pi.net_total, pi_item.item_code, pi_item.item_name, pi_item.item_group,
+ pi_item.project_name, pi_item.purchase_order, pi_item.purchase_receipt,
pi_item.expense_account, pi_item.qty, pi_item.base_rate, pi_item.base_amount, pi.supplier_name
- from `tabPurchase Invoice` pi, `tabPurchase Invoice Item` pi_item
+ from `tabPurchase Invoice` pi, `tabPurchase Invoice Item` pi_item
where pi.name = pi_item.parent and pi.docstatus = 1 %s %s
order by pi.posting_date desc, pi_item.item_code desc""" % (conditions, match_conditions), filters, as_dict=1)
-
+
def get_aii_accounts():
return dict(frappe.db.sql("select name, stock_received_but_not_billed from tabCompany"))
-
+
def get_tax_accounts(item_list, columns):
import json
item_tax = {}
tax_accounts = []
-
- tax_details = frappe.db.sql("""select parent, account_head, item_wise_tax_detail
- from `tabPurchase Taxes and Charges` where parenttype = 'Purchase Invoice'
- and docstatus = 1 and ifnull(account_head, '') != '' and category in ('Total', 'Valuation and Total')
- and parent in (%s)""" % ', '.join(['%s']*len(item_list)), tuple([item.parent for item in item_list]))
-
- for parent, account_head, item_wise_tax_detail in tax_details:
+
+ invoice_wise_items = {}
+ for d in item_list:
+ invoice_wise_items.setdefault(d.parent, []).append(d)
+
+ tax_details = frappe.db.sql("""select parent, account_head, item_wise_tax_detail, charge_type, tax_amount
+ from `tabPurchase Taxes and Charges` where parenttype = 'Purchase Invoice'
+ and docstatus = 1 and ifnull(account_head, '') != '' and category in ('Total', 'Valuation and Total')
+ and parent in (%s)""" % ', '.join(['%s']*len(invoice_wise_items)), tuple(invoice_wise_items.keys()))
+
+ for parent, account_head, item_wise_tax_detail, charge_type, tax_amount in tax_details:
if account_head not in tax_accounts:
tax_accounts.append(account_head)
-
+
if item_wise_tax_detail:
try:
item_wise_tax_detail = json.loads(item_wise_tax_detail)
for item, tax_amount in item_wise_tax_detail.items():
item_tax.setdefault(parent, {}).setdefault(item, {})[account_head] = \
flt(tax_amount[1]) if isinstance(tax_amount, list) else flt(tax_amount)
-
+
except ValueError:
continue
-
+ elif charge_type == "Actual" and tax_amount:
+ for d in invoice_wise_items.get(parent, []):
+ item_tax.setdefault(parent, {}).setdefault(d.item_code, {})[account_head] = \
+ (tax_amount * d.base_amount) / d.net_total
+
tax_accounts.sort()
columns += [account_head + ":Currency:80" for account_head in tax_accounts]
columns += ["Total Tax:Currency:80", "Total:Currency:80"]
- return item_tax, tax_accounts
\ No newline at end of file
+ return item_tax, tax_accounts
diff --git a/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py b/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py
index 2840291..e3b93d0 100644
--- a/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py
+++ b/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py
@@ -14,36 +14,36 @@
item_list = get_items(filters)
if item_list:
item_tax, tax_accounts = get_tax_accounts(item_list, columns)
-
+
data = []
for d in item_list:
- row = [d.item_code, d.item_name, d.item_group, d.parent, d.posting_date,
- d.customer_name, d.debit_to, d.territory, d.project_name, d.company, d.sales_order,
+ row = [d.item_code, d.item_name, d.item_group, d.parent, d.posting_date,
+ d.customer_name, d.debit_to, d.territory, d.project_name, d.company, d.sales_order,
d.delivery_note, d.income_account, d.qty, d.base_rate, d.base_amount]
-
+
for tax in tax_accounts:
row.append(item_tax.get(d.parent, {}).get(d.item_code, {}).get(tax, 0))
total_tax = sum(row[last_col:])
row += [total_tax, d.base_amount + total_tax]
-
+
data.append(row)
-
+
return columns, data
-
+
def get_columns():
return [
- _("Item Code") + ":Link/Item:120", _("Item Name") + "::120", _("Item Group") + ":Link/Item Group:100",
- _("Invoice") + ":Link/Sales Invoice:120", _("Posting Date") + ":Date:80", _("Customer") + ":Link/Customer:120",
+ _("Item Code") + ":Link/Item:120", _("Item Name") + "::120", _("Item Group") + ":Link/Item Group:100",
+ _("Invoice") + ":Link/Sales Invoice:120", _("Posting Date") + ":Date:80", _("Customer") + ":Link/Customer:120",
_("Customer Account") + ":Link/Account:120", _("Territory") + ":Link/Territory:80",
- _("Project") + ":Link/Project:80", _("Company") + ":Link/Company:100", _("Sales Order") + ":Link/Sales Order:100",
- _("Delivery Note") + ":Link/Delivery Note:100", _("Income Account") + ":Link/Account:140",
+ _("Project") + ":Link/Project:80", _("Company") + ":Link/Company:100", _("Sales Order") + ":Link/Sales Order:100",
+ _("Delivery Note") + ":Link/Delivery Note:100", _("Income Account") + ":Link/Account:140",
_("Qty") + ":Float:120", _("Rate") + ":Currency:120", _("Amount") + ":Currency:120"
]
-
+
def get_conditions(filters):
conditions = ""
-
+
for opts in (("company", " and company=%(company)s"),
("account", " and si.debit_to = %(account)s"),
("item_code", " and si_item.item_code = %(item_code)s"),
@@ -53,32 +53,36 @@
conditions += opts[1]
return conditions
-
+
def get_items(filters):
conditions = get_conditions(filters)
- return frappe.db.sql("""select si_item.parent, si.posting_date, si.debit_to, si.project_name,
- si.customer, si.remarks, si.territory, si.company, si_item.item_code, si_item.item_name,
- si_item.item_group, si_item.sales_order, si_item.delivery_note, si_item.income_account,
+ return frappe.db.sql("""select si_item.parent, si.posting_date, si.debit_to, si.project_name,
+ si.customer, si.remarks, si.territory, si.company, si.net_total, si_item.item_code, si_item.item_name,
+ si_item.item_group, si_item.sales_order, si_item.delivery_note, si_item.income_account,
si_item.qty, si_item.base_rate, si_item.base_amount, si.customer_name
- from `tabSales Invoice` si, `tabSales Invoice Item` si_item
- where si.name = si_item.parent and si.docstatus = 1 %s
+ from `tabSales Invoice` si, `tabSales Invoice Item` si_item
+ where si.name = si_item.parent and si.docstatus = 1 %s
order by si.posting_date desc, si_item.item_code desc""" % conditions, filters, as_dict=1)
-
+
def get_tax_accounts(item_list, columns):
import json
item_tax = {}
tax_accounts = []
-
- tax_details = frappe.db.sql("""select parent, account_head, item_wise_tax_detail
- from `tabSales Taxes and Charges` where parenttype = 'Sales Invoice'
+
+ invoice_wise_items = {}
+ for d in item_list:
+ invoice_wise_items.setdefault(d.parent, []).append(d)
+
+ tax_details = frappe.db.sql("""select parent, account_head, item_wise_tax_detail, charge_type, tax_amount
+ from `tabSales Taxes and Charges` where parenttype = 'Sales Invoice'
and docstatus = 1 and ifnull(account_head, '') != ''
- and parent in (%s)""" % ', '.join(['%s']*len(item_list)),
- tuple([item.parent for item in item_list]))
-
- for parent, account_head, item_wise_tax_detail in tax_details:
+ and parent in (%s)""" % ', '.join(['%s']*len(invoice_wise_items)),
+ tuple(invoice_wise_items.keys()))
+
+ for parent, account_head, item_wise_tax_detail, charge_type, tax_amount in tax_details:
if account_head not in tax_accounts:
tax_accounts.append(account_head)
-
+
if item_wise_tax_detail:
try:
item_wise_tax_detail = json.loads(item_wise_tax_detail)
@@ -87,9 +91,13 @@
flt(tax_amount[1]) if isinstance(tax_amount, list) else flt(tax_amount)
except ValueError:
continue
-
+ elif charge_type == "Actual" and tax_amount:
+ for d in invoice_wise_items.get(parent, []):
+ item_tax.setdefault(parent, {}).setdefault(d.item_code, {})[account_head] = \
+ flt((tax_amount * d.base_amount) / d.net_total)
+
tax_accounts.sort()
columns += [account_head + ":Currency:80" for account_head in tax_accounts]
columns += ["Total Tax:Currency:80", "Total:Currency:80"]
- return item_tax, tax_accounts
\ No newline at end of file
+ return item_tax, tax_accounts
diff --git a/erpnext/buying/doctype/purchase_common/purchase_common.js b/erpnext/buying/doctype/purchase_common/purchase_common.js
index 3011160..265f7d4 100644
--- a/erpnext/buying/doctype/purchase_common/purchase_common.js
+++ b/erpnext/buying/doctype/purchase_common/purchase_common.js
@@ -209,26 +209,17 @@
calculate_totals: function() {
var tax_count = this.frm.tax_doclist.length;
- this.frm.doc.grand_total = flt(tax_count ?
- this.frm.tax_doclist[tax_count - 1].total : this.frm.doc.net_total);
- this.frm.doc.grand_total_import = flt(tax_count ?
- flt(this.frm.doc.grand_total / this.frm.doc.conversion_rate) : this.frm.doc.net_total_import);
+ this.frm.doc.grand_total = flt(tax_count ? this.frm.tax_doclist[tax_count - 1].total : this.frm.doc.net_total);
- this.frm.doc.total_tax = flt(this.frm.doc.grand_total - this.frm.doc.net_total,
- precision("total_tax"));
+ this.frm.doc.total_tax = flt(this.frm.doc.grand_total - this.frm.doc.net_total, precision("total_tax"));
this.frm.doc.grand_total = flt(this.frm.doc.grand_total, precision("grand_total"));
- this.frm.doc.grand_total_import = flt(this.frm.doc.grand_total_import, precision("grand_total_import"));
// rounded totals
if(frappe.meta.get_docfield(this.frm.doc.doctype, "rounded_total", this.frm.doc.name)) {
this.frm.doc.rounded_total = Math.round(this.frm.doc.grand_total);
}
- if(frappe.meta.get_docfield(this.frm.doc.doctype, "rounded_total_import", this.frm.doc.name)) {
- this.frm.doc.rounded_total_import = Math.round(this.frm.doc.grand_total_import);
- }
-
// other charges added/deducted
this.frm.doc.other_charges_added = 0.0
this.frm.doc.other_charges_deducted = 0.0
@@ -246,6 +237,16 @@
frappe.model.round_floats_in(this.frm.doc,
["other_charges_added", "other_charges_deducted"]);
}
+
+ this.frm.doc.grand_total_import = flt((this.frm.doc.other_charges_added || this.frm.doc.other_charges_deducted) ?
+ flt(this.frm.doc.grand_total / this.frm.doc.conversion_rate) : this.frm.doc.net_total_import);
+
+ this.frm.doc.grand_total_import = flt(this.frm.doc.grand_total_import, precision("grand_total_import"));
+
+ if(frappe.meta.get_docfield(this.frm.doc.doctype, "rounded_total_import", this.frm.doc.name)) {
+ this.frm.doc.rounded_total_import = Math.round(this.frm.doc.grand_total_import);
+ }
+
this.frm.doc.other_charges_added_import = flt(this.frm.doc.other_charges_added /
this.frm.doc.conversion_rate, precision("other_charges_added_import"));
this.frm.doc.other_charges_deducted_import = flt(this.frm.doc.other_charges_deducted /
diff --git a/erpnext/controllers/buying_controller.py b/erpnext/controllers/buying_controller.py
index f7b5a87..b4ca94d 100644
--- a/erpnext/controllers/buying_controller.py
+++ b/erpnext/controllers/buying_controller.py
@@ -91,8 +91,7 @@
item.rate = flt(item.price_list_rate * (1.0 - (item.discount_percentage / 100.0)),
self.precision("rate", item))
- item.amount = flt(item.rate * item.qty,
- self.precision("amount", item))
+ item.amount = flt(item.rate * item.qty, self.precision("amount", item))
item.item_tax_amount = 0.0;
self._set_in_company_currency(item, "amount", "base_amount")
@@ -111,20 +110,14 @@
def calculate_totals(self):
self.grand_total = flt(self.tax_doclist[-1].total if self.tax_doclist else self.net_total)
- self.grand_total_import = flt(self.grand_total / self.conversion_rate) \
- if self.tax_doclist else self.net_total_import
self.total_tax = flt(self.grand_total - self.net_total, self.precision("total_tax"))
self.grand_total = flt(self.grand_total, self.precision("grand_total"))
- self.grand_total_import = flt(self.grand_total_import, self.precision("grand_total_import"))
if self.meta.get_field("rounded_total"):
self.rounded_total = rounded(self.grand_total)
- if self.meta.get_field("rounded_total_import"):
- self.rounded_total_import = rounded(self.grand_total_import)
-
if self.meta.get_field("other_charges_added"):
self.other_charges_added = flt(sum([flt(d.tax_amount) for d in self.tax_doclist
if d.add_deduct_tax=="Add" and d.category in ["Valuation and Total", "Total"]]),
@@ -135,6 +128,14 @@
if d.add_deduct_tax=="Deduct" and d.category in ["Valuation and Total", "Total"]]),
self.precision("other_charges_deducted"))
+ self.grand_total_import = flt(self.grand_total / self.conversion_rate) \
+ if (self.other_charges_added or self.other_charges_deducted) else self.net_total_import
+
+ self.grand_total_import = flt(self.grand_total_import, self.precision("grand_total_import"))
+
+ if self.meta.get_field("rounded_total_import"):
+ self.rounded_total_import = rounded(self.grand_total_import)
+
if self.meta.get_field("other_charges_added_import"):
self.other_charges_added_import = flt(self.other_charges_added /
self.conversion_rate, self.precision("other_charges_added_import"))
diff --git a/erpnext/controllers/selling_controller.py b/erpnext/controllers/selling_controller.py
index 4b0cd4e..91bf0ae 100644
--- a/erpnext/controllers/selling_controller.py
+++ b/erpnext/controllers/selling_controller.py
@@ -218,10 +218,11 @@
def calculate_totals(self):
self.grand_total = flt(self.tax_doclist[-1].total if self.tax_doclist else self.net_total)
- self.grand_total_export = flt(self.grand_total / self.conversion_rate)
-
self.other_charges_total = flt(self.grand_total - self.net_total, self.precision("other_charges_total"))
+ self.grand_total_export = flt(self.grand_total / self.conversion_rate) \
+ if (self.other_charges_total or self.discount_amount) else self.net_total_export
+
self.other_charges_total_export = flt(self.grand_total_export - self.net_total_export +
flt(self.discount_amount), self.precision("other_charges_total_export"))
diff --git a/erpnext/hooks.py b/erpnext/hooks.py
index 13b3303..a8a5fa0 100644
--- a/erpnext/hooks.py
+++ b/erpnext/hooks.py
@@ -4,7 +4,7 @@
app_description = "Open Source Enterprise Resource Planning for Small and Midsized Organizations"
app_icon = "icon-th"
app_color = "#e74c3c"
-app_version = "4.20.2"
+app_version = "4.21.4"
error_report_email = "support@erpnext.com"
diff --git a/erpnext/hr/doctype/salary_slip/salary_slip.py b/erpnext/hr/doctype/salary_slip/salary_slip.py
index f87a122..32f0e04 100644
--- a/erpnext/hr/doctype/salary_slip/salary_slip.py
+++ b/erpnext/hr/doctype/salary_slip/salary_slip.py
@@ -45,7 +45,7 @@
def get_leave_details(self, lwp=None):
if not self.fiscal_year:
- self.fiscal_year = frappe.get_default("fiscal_year")
+ self.fiscal_year = frappe.db.get_default("fiscal_year")
if not self.month:
self.month = "%02d" % getdate(nowdate()).month
diff --git a/erpnext/manufacturing/doctype/bom/bom.py b/erpnext/manufacturing/doctype/bom/bom.py
index 8a19f41..b7a89c8 100644
--- a/erpnext/manufacturing/doctype/bom/bom.py
+++ b/erpnext/manufacturing/doctype/bom/bom.py
@@ -27,7 +27,7 @@
self.validate_main_item()
from erpnext.utilities.transaction_base import validate_uom_is_integer
- validate_uom_is_integer(self, "stock_uom", "qty")
+ validate_uom_is_integer(self, "stock_uom", "qty", "BOM Item")
self.validate_operations()
self.validate_materials()
diff --git a/erpnext/public/js/transaction.js b/erpnext/public/js/transaction.js
index 6d38b46..e1e78a3 100644
--- a/erpnext/public/js/transaction.js
+++ b/erpnext/public/js/transaction.js
@@ -404,23 +404,27 @@
_set_values_for_item_list: function(children) {
var me = this;
var price_list_rate_changed = false;
- $.each(children, function(i, d) {
+ for(var i=0, l=children.length; i<l; i++) {
+ var d = children[i];
var existing_pricing_rule = frappe.model.get_value(d.doctype, d.name, "pricing_rule");
- $.each(d, function(k, v) {
+
+ for(var k in d) {
+ var v = d[k];
if (["doctype", "name"].indexOf(k)===-1) {
if(k=="price_list_rate") {
if(flt(v) != flt(d.price_list_rate)) price_list_rate_changed = true;
}
frappe.model.set_value(d.doctype, d.name, k, v);
}
- });
+ }
+
// if pricing rule set as blank from an existing value, apply price_list
if(!me.frm.doc.ignore_pricing_rule && existing_pricing_rule && !d.pricing_rule) {
me.apply_price_list(frappe.get_doc(d.doctype, d.name));
}
+ }
- if(!price_list_rate_changed) me.calculate_taxes_and_totals();
- });
+ if(!price_list_rate_changed) me.calculate_taxes_and_totals();
},
apply_price_list: function(item) {
diff --git a/erpnext/selling/report/lead_details/lead_details.json b/erpnext/selling/report/lead_details/lead_details.json
index 0edec21..b5113d8 100644
--- a/erpnext/selling/report/lead_details/lead_details.json
+++ b/erpnext/selling/report/lead_details/lead_details.json
@@ -5,12 +5,12 @@
"doctype": "Report",
"idx": 1,
"is_standard": "Yes",
- "modified": "2014-06-03 07:18:17.139224",
+ "modified": "2015-02-02 11:39:57.231750",
"modified_by": "Administrator",
"module": "Selling",
"name": "Lead Details",
"owner": "Administrator",
- "query": "SELECT\n `tabLead`.name as \"Lead Id:Link/Lead:120\",\n `tabLead`.lead_name as \"Lead Name::120\",\n\t`tabLead`.company_name as \"Company Name::120\",\n\t`tabLead`.status as \"Status::120\",\n\tconcat_ws(', ', \n\t\ttrim(',' from `tabAddress`.address_line1), \n\t\ttrim(',' from tabAddress.address_line2), \n\t\ttabAddress.state, tabAddress.pincode, tabAddress.country\n\t) as 'Address::180',\n\t`tabLead`.phone as \"Phone::100\",\n\t`tabLead`.mobile_no as \"Mobile No::100\",\n\t`tabLead`.email_id as \"Email Id::120\",\n\t`tabLead`.lead_owner as \"Lead Owner::120\",\n\t`tabLead`.source as \"Source::120\",\n\t`tabLead`.territory as \"Territory::120\",\n `tabLead`.owner as \"Owner:Link/User:120\"\nFROM\n\t`tabLead`\n\tleft join `tabAddress` on (\n\t\t`tabAddress`.lead=`tabLead`.name\n\t)\nWHERE\n\t`tabLead`.docstatus<2\nORDER BY\n\t`tabLead`.name asc",
+ "query": "SELECT\n `tabLead`.name as \"Lead Id:Link/Lead:120\",\n `tabLead`.lead_name as \"Lead Name::120\",\n\t`tabLead`.company_name as \"Company Name::120\",\n\t`tabLead`.status as \"Status::120\",\n\tconcat_ws(', ', \n\t\ttrim(',' from `tabAddress`.address_line1), \n\t\ttrim(',' from tabAddress.address_line2)\n\t) as 'Address::180',\n\t`tabAddress`.state as \"State::100\",\n\t`tabAddress`.pincode as \"Pincode::70\",\n\t`tabAddress`.country as \"Country::100\",\n\t`tabLead`.phone as \"Phone::100\",\n\t`tabLead`.mobile_no as \"Mobile No::100\",\n\t`tabLead`.email_id as \"Email Id::120\",\n\t`tabLead`.lead_owner as \"Lead Owner::120\",\n\t`tabLead`.source as \"Source::120\",\n\t`tabLead`.territory as \"Territory::120\",\n `tabLead`.owner as \"Owner:Link/User:120\"\nFROM\n\t`tabLead`\n\tleft join `tabAddress` on (\n\t\t`tabAddress`.lead=`tabLead`.name\n\t)\nWHERE\n\t`tabLead`.docstatus<2\nORDER BY\n\t`tabLead`.name asc",
"ref_doctype": "Lead",
"report_name": "Lead Details",
"report_type": "Query Report"
diff --git a/erpnext/selling/sales_common.js b/erpnext/selling/sales_common.js
index 3a01811..5a7ed08 100644
--- a/erpnext/selling/sales_common.js
+++ b/erpnext/selling/sales_common.js
@@ -342,10 +342,13 @@
var tax_count = this.frm.tax_doclist.length;
this.frm.doc.grand_total = flt(tax_count ? this.frm.tax_doclist[tax_count - 1].total : this.frm.doc.net_total);
- this.frm.doc.grand_total_export = flt(this.frm.doc.grand_total / this.frm.doc.conversion_rate);
this.frm.doc.other_charges_total = flt(this.frm.doc.grand_total - this.frm.doc.net_total,
precision("other_charges_total"));
+
+ this.frm.doc.grand_total_export = (this.frm.doc.other_charges_total || this.frm.doc.discount_amount) ?
+ flt(this.frm.doc.grand_total / this.frm.doc.conversion_rate) : this.frm.doc.net_total_export;
+
this.frm.doc.other_charges_total_export = flt(this.frm.doc.grand_total_export -
this.frm.doc.net_total_export + flt(this.frm.doc.discount_amount),
precision("other_charges_total_export"));
diff --git a/erpnext/setup/doctype/authorization_control/authorization_control.py b/erpnext/setup/doctype/authorization_control/authorization_control.py
index fbf4b1c..b72f059 100644
--- a/erpnext/setup/doctype/authorization_control/authorization_control.py
+++ b/erpnext/setup/doctype/authorization_control/authorization_control.py
@@ -94,6 +94,9 @@
self.validate_auth_rule(doctype_name, auth_value, based_on, add_cond, company)
def validate_approving_authority(self, doctype_name,company, total, doc_obj = ''):
+ if not frappe.db.count("Authorization Rule"):
+ return
+
av_dis = 0
if doc_obj:
price_list_rate, base_rate = 0, 0
diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
index e04abbb..abc0859 100644
--- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
+++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
@@ -138,10 +138,11 @@
pr_qty = flt(d.qty) * flt(d.conversion_factor)
if pr_qty:
+ val_rate_db_precision = 6 if cint(self.precision("valuation_rate")) <= 6 else 9
sl_entries.append(self.get_sl_entries(d, {
"actual_qty": flt(pr_qty),
"serial_no": cstr(d.serial_no).strip(),
- "incoming_rate": d.valuation_rate
+ "incoming_rate": flt(d.valuation_rate, val_rate_db_precision)
}))
if flt(d.rejected_qty) > 0:
@@ -288,14 +289,16 @@
if d.item_code in stock_items and flt(d.valuation_rate) and flt(d.qty):
if warehouse_account.get(d.warehouse):
+ val_rate_db_precision = 6 if cint(self.precision("valuation_rate")) <= 6 else 9
+
# warehouse account
gl_entries.append(self.get_gl_dict({
"account": warehouse_account[d.warehouse],
"against": stock_rbnb,
"cost_center": d.cost_center,
"remarks": self.get("remarks") or _("Accounting Entry for Stock"),
- "debit": flt(flt(d.valuation_rate) * flt(d.qty) * flt(d.conversion_factor),
- self.precision("valuation_rate", d))
+ "debit": flt(flt(d.valuation_rate, val_rate_db_precision) * flt(d.qty) * flt(d.conversion_factor),
+ self.precision("base_amount", d))
}))
# stock received but not billed
@@ -329,6 +332,24 @@
"credit": flt(d.rm_supp_cost)
}))
+ # divisional loss adjustment
+ if not self.get("other_charges"):
+ sle_valuation_amount = flt(flt(d.valuation_rate, val_rate_db_precision) * flt(d.qty) * flt(d.conversion_factor),
+ self.precision("base_amount", d))
+
+ distributed_amount = flt(flt(d.base_amount, self.precision("base_amount", d))) + \
+ flt(d.landed_cost_voucher_amount) + flt(d.rm_supp_cost)
+
+ divisional_loss = flt(distributed_amount - sle_valuation_amount, self.precision("base_amount", d))
+ if divisional_loss:
+ gl_entries.append(self.get_gl_dict({
+ "account": stock_rbnb,
+ "against": warehouse_account[d.warehouse],
+ "cost_center": d.cost_center,
+ "remarks": self.get("remarks") or _("Accounting Entry for Stock"),
+ "debit": divisional_loss
+ }))
+
elif d.warehouse not in warehouse_with_no_account or \
d.rejected_warehouse not in warehouse_with_no_account:
warehouse_with_no_account.append(d.warehouse)
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.js b/erpnext/stock/doctype/stock_entry/stock_entry.js
index a2c670e..61cacce 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.js
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.js
@@ -24,6 +24,12 @@
};
};
+ this.frm.fields_dict.bom_no.get_query = function() {
+ return {
+ filters:{ 'docstatus': 1 }
+ };
+ };
+
this.frm.fields_dict.mtn_details.grid.get_field('item_code').get_query = function() {
if(in_list(["Sales Return", "Purchase Return"], me.frm.doc.purpose) &&
me.get_doctype_docname()) {
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.json b/erpnext/stock/doctype/stock_entry/stock_entry.json
index 5f78758..e865e6f 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.json
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.json
@@ -238,11 +238,6 @@
"read_only": 0
},
{
- "fieldname": "fold",
- "fieldtype": "Fold",
- "permlevel": 0
- },
- {
"depends_on": "eval:(doc.purpose!==\"Sales Return\" && doc.purpose!==\"Purchase Return\")",
"fieldname": "sb1",
"fieldtype": "Section Break",
@@ -340,6 +335,11 @@
"search_index": 0
},
{
+ "fieldname": "fold",
+ "fieldtype": "Fold",
+ "permlevel": 0
+ },
+ {
"depends_on": "eval:(doc.purpose==\"Sales Return\" || doc.purpose==\"Purchase Return\")",
"fieldname": "contact_section",
"fieldtype": "Section Break",
@@ -585,7 +585,7 @@
"is_submittable": 1,
"issingle": 0,
"max_attachments": 0,
- "modified": "2014-09-16 15:56:37.514676",
+ "modified": "2015-01-29 11:26:46.968041",
"modified_by": "Administrator",
"module": "Stock",
"name": "Stock Entry",
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py
index 81a2f59..5a5904a 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.py
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.py
@@ -109,8 +109,8 @@
def validate_warehouse(self, pro_obj):
"""perform various (sometimes conditional) validations on warehouse"""
- source_mandatory = ["Material Issue", "Material Transfer", "Purchase Return"]
- target_mandatory = ["Material Receipt", "Material Transfer", "Sales Return"]
+ source_mandatory = ["Material Issue", "Material Transfer", "Purchase Return", "Subcontract"]
+ target_mandatory = ["Material Receipt", "Material Transfer", "Sales Return", "Subcontract"]
validate_for_manufacture_repack = any([d.bom_no for d in self.get("mtn_details")])
@@ -467,6 +467,9 @@
"Subcontract"]:
if self.production_order and self.purpose == "Material Transfer":
item_dict = self.get_pending_raw_materials(pro_obj)
+ if self.to_warehouse and pro_obj:
+ for item in item_dict.values():
+ item["to_warehouse"] = pro_obj.wip_warehouse
else:
if not self.fg_completed_qty:
frappe.throw(_("Manufacturing Quantity is mandatory"))
@@ -474,7 +477,8 @@
for item in item_dict.values():
if pro_obj:
item["from_warehouse"] = pro_obj.wip_warehouse
- item["to_warehouse"] = ""
+
+ item["to_warehouse"] = self.to_warehouse if self.purpose=="Subcontract" else ""
# add raw materials to Stock Entry Detail table
self.add_to_stock_entry_detail(item_dict)
@@ -525,7 +529,7 @@
item_dict = get_bom_items_as_dict(self.bom_no, qty=qty, fetch_exploded = self.use_multi_level_bom)
for item in item_dict.values():
- item.from_warehouse = item.default_warehouse
+ item.from_warehouse = self.from_warehouse or item.default_warehouse
return item_dict
diff --git a/erpnext/templates/form_grid/item_grid.html b/erpnext/templates/form_grid/item_grid.html
index 21903c0..66b894e 100644
--- a/erpnext/templates/form_grid/item_grid.html
+++ b/erpnext/templates/form_grid/item_grid.html
@@ -41,7 +41,7 @@
var delivered = doc.doctype==="Sales Order Item" ?
doc.delivered_qty : doc.received_qty,
completed =
- 100 - cint((doc.qty - delivered) * 100 / doc.qty),
+ 100 - cint((flt(doc.qty) - flt(delivered)) * 100 / flt(doc.qty)),
title = __("Delivered");
%}
{% include "templates/form_grid/includes/progress.html" %}
@@ -95,7 +95,7 @@
{% if(in_list(["Sales Order Item", "Purchase Order Item"],
doc.doctype) && frm.doc.docstatus===1 && doc.amount) {
var completed =
- 100 - cint((doc.amount - doc.billed_amt) * 100 / doc.amount),
+ 100 - cint((flt(doc.amount) - flt(doc.billed_amt)) * 100 / flt(doc.amount)),
title = __("Billed");
%}
<br><small> </small>
diff --git a/erpnext/templates/print_formats/includes/item_grid.html b/erpnext/templates/print_formats/includes/item_grid.html
index 7e1d1a6..0c912ca 100644
--- a/erpnext/templates/print_formats/includes/item_grid.html
+++ b/erpnext/templates/print_formats/includes/item_grid.html
@@ -6,17 +6,19 @@
<table class="table table-bordered">
<tbody>
- <tr>
- <th style="width: 3%">{{ _("Sr") }}</th>
- <th style="width: 57%">{{ _("Item") }}</th>
- <th style="width: 10%;" class="text-right">{{ _(data[0].meta.get_label("qty")) }}</th>
- {% if not hide_rate -%}
- <th style="width: 15%;" class="text-right">{{ _(data[0].meta.get_label("rate")) }}</th>
- {%- endif %}
- {% if not hide_amount -%}
- <th style="width: 15%;" class="text-right">{{ _(data[0].meta.get_label("amount")) }}</th>
- {%- endif %}
- </tr>
+ {% if data|length -%}
+ <tr>
+ <th style="width: 3%">{{ _("Sr") }}</th>
+ <th style="width: 57%">{{ _("Item") }}</th>
+ <th style="width: 10%;" class="text-right">{{ _(data[0].meta.get_label("qty")) }}</th>
+ {% if not hide_rate -%}
+ <th style="width: 15%;" class="text-right">{{ _(data[0].meta.get_label("rate")) }}</th>
+ {%- endif %}
+ {% if not hide_amount -%}
+ <th style="width: 15%;" class="text-right">{{ _(data[0].meta.get_label("amount")) }}</th>
+ {%- endif %}
+ </tr>
+ {%- endif %}
{%- for row in data -%}
<tr>
<td>{{ row.idx }}</td>
diff --git a/erpnext/utilities/transaction_base.py b/erpnext/utilities/transaction_base.py
index 4ba1627..5e24d9b 100644
--- a/erpnext/utilities/transaction_base.py
+++ b/erpnext/utilities/transaction_base.py
@@ -95,7 +95,7 @@
class UOMMustBeIntegerError(frappe.ValidationError): pass
-def validate_uom_is_integer(doc, uom_field, qty_fields):
+def validate_uom_is_integer(doc, uom_field, qty_fields, child_dt=None):
if isinstance(qty_fields, basestring):
qty_fields = [qty_fields]
@@ -106,7 +106,7 @@
if not integer_uoms:
return
- for d in doc.get_all_children():
+ for d in doc.get_all_children(parenttype=child_dt):
if d.get(uom_field) in integer_uoms:
for f in qty_fields:
if d.get(f):
diff --git a/setup.py b/setup.py
index 4e650c8..603a13e 100644
--- a/setup.py
+++ b/setup.py
@@ -1,7 +1,7 @@
from setuptools import setup, find_packages
import os
-version = "4.20.2"
+version = "4.21.4"
with open("requirements.txt", "r") as f:
install_requires = f.readlines()
diff --git a/test_sites/test_site/site_config.json b/test_sites/test_site/site_config.json
index 1b388a0..a94f27c 100644
--- a/test_sites/test_site/site_config.json
+++ b/test_sites/test_site/site_config.json
@@ -3,5 +3,6 @@
"db_password": "test_frappe",
"admin_password": "admin",
"host_name": "http://localhost:8888",
+ "auto_email_id": "admin@example.com",
"mute_emails": 1
}