Merge branch 'develop'

This commit is contained in:
Pratik Vyas 2015-02-05 14:25:13 +05:30
commit 1dae1c40b9
12 changed files with 120 additions and 92 deletions

View File

@ -1 +1 @@
__version__ = '4.20.2'
__version__ = '4.21.0'

View File

@ -405,7 +405,7 @@ def get_expense_account(doctype, txt, searchfield, start, page_len, filters):
# 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, "")=""

View File

@ -59,7 +59,7 @@ def get_items(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.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
@ -74,12 +74,16 @@ def get_tax_accounts(item_list, columns):
item_tax = {}
tax_accounts = []
tax_details = frappe.db.sql("""select parent, account_head, item_wise_tax_detail
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(item_list)), tuple([item.parent for item in item_list]))
and parent in (%s)""" % ', '.join(['%s']*len(invoice_wise_items)), tuple(invoice_wise_items.keys()))
for parent, account_head, item_wise_tax_detail in tax_details:
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)
@ -92,6 +96,10 @@ def get_tax_accounts(item_list, columns):
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]

View File

@ -57,7 +57,7 @@ def get_conditions(filters):
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.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
@ -69,13 +69,17 @@ def get_tax_accounts(item_list, columns):
item_tax = {}
tax_accounts = []
tax_details = frappe.db.sql("""select parent, account_head, item_wise_tax_detail
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]))
and parent in (%s)""" % ', '.join(['%s']*len(invoice_wise_items)),
tuple(invoice_wise_items.keys()))
for parent, account_head, item_wise_tax_detail in tax_details:
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)
@ -87,6 +91,10 @@ def get_tax_accounts(item_list, columns):
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]

View File

@ -4,7 +4,7 @@ app_publisher = "Web Notes Technologies Pvt. Ltd. and Contributors"
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.0"
error_report_email = "support@erpnext.com"

View File

@ -45,7 +45,7 @@ class SalarySlip(TransactionBase):
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

View File

@ -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"

View File

@ -24,6 +24,12 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({
};
};
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()) {

View File

@ -237,11 +237,6 @@
"print_hide": 1,
"read_only": 0
},
{
"fieldname": "fold",
"fieldtype": "Fold",
"permlevel": 0
},
{
"depends_on": "eval:(doc.purpose!==\"Sales Return\" && doc.purpose!==\"Purchase Return\")",
"fieldname": "sb1",
@ -339,6 +334,11 @@
"reqd": 0,
"search_index": 0
},
{
"fieldname": "fold",
"fieldtype": "Fold",
"permlevel": 0
},
{
"depends_on": "eval:(doc.purpose==\"Sales Return\" || doc.purpose==\"Purchase Return\")",
"fieldname": "contact_section",
@ -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",

View File

@ -109,8 +109,8 @@ class StockEntry(StockController):
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 @@ class StockEntry(StockController):
"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 @@ class StockEntry(StockController):
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 @@ class StockEntry(StockController):
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

View File

@ -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>

View File

@ -1,7 +1,7 @@
from setuptools import setup, find_packages
import os
version = "4.20.2"
version = "4.21.0"
with open("requirements.txt", "r") as f:
install_requires = f.readlines()