Multiple fixes

This commit is contained in:
Nabin Hait 2015-01-10 16:03:49 +05:30
parent d49a123fd0
commit e8500ad4e6
15 changed files with 603 additions and 624 deletions

View File

@ -65,6 +65,22 @@
"reqd": 1, "reqd": 1,
"search_index": 1 "search_index": 1
}, },
{
"fieldname": "root_type",
"fieldtype": "Select",
"label": "Root Type",
"options": "\nAsset\nLiability\nIncome\nExpense\nEquity",
"permlevel": 0,
"read_only": 1
},
{
"fieldname": "report_type",
"fieldtype": "Select",
"label": "Report Type",
"options": "\nBalance Sheet\nProfit and Loss",
"permlevel": 0,
"read_only": 1
},
{ {
"fieldname": "column_break1", "fieldname": "column_break1",
"fieldtype": "Column Break", "fieldtype": "Column Break",
@ -130,22 +146,6 @@
"options": "\nDebit\nCredit", "options": "\nDebit\nCredit",
"permlevel": 0 "permlevel": 0
}, },
{
"fieldname": "root_type",
"fieldtype": "Select",
"label": "Root Type",
"options": "\nAsset\nLiability\nIncome\nExpense\nEquity",
"permlevel": 0,
"read_only": 1
},
{
"fieldname": "report_type",
"fieldtype": "Select",
"label": "Report Type",
"options": "\nBalance Sheet\nProfit and Loss",
"permlevel": 0,
"read_only": 1
},
{ {
"fieldname": "lft", "fieldname": "lft",
"fieldtype": "Int", "fieldtype": "Int",
@ -177,7 +177,7 @@
"icon": "icon-money", "icon": "icon-money",
"idx": 1, "idx": 1,
"in_create": 0, "in_create": 0,
"modified": "2015-01-01 15:36:43.219662", "modified": "2015-01-05 11:03:07.861934",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Account", "name": "Account",

View File

@ -22,7 +22,9 @@ coa = {
}, },
"account_type": "Cash" "account_type": "Cash"
}, },
_("Loans and Advances (Assets)"): {}, _("Loans and Advances (Assets)"): {
"group_or_ledger": "Group"
},
_("Securities and Deposits"): { _("Securities and Deposits"): {
_("Earnest Money"): {} _("Earnest Money"): {}
}, },

View File

@ -74,9 +74,9 @@ def get_costcenter_target_details(filters):
def get_target_distribution_details(filters): def get_target_distribution_details(filters):
target_details = {} target_details = {}
for d in frappe.db.sql("""select bd.name, bdd.month, bdd.percentage_allocation for d in frappe.db.sql("""select md.name, mdp.month, mdp.percentage_allocation
from `tabBudget Distribution Detail` bdd, `tabBudget Distribution` bd from `tabMonthly Distribution Percentage` mdp, `tabMonthly Distribution` md
where bdd.parent=bd.name and bd.fiscal_year=%s""", (filters["fiscal_year"]), as_dict=1): where mdp.parent=md.name and md.fiscal_year=%s""", (filters["fiscal_year"]), as_dict=1):
target_details.setdefault(d.name, {}).setdefault(d.month, flt(d.percentage_allocation)) target_details.setdefault(d.name, {}).setdefault(d.month, flt(d.percentage_allocation))
return target_details return target_details

View File

@ -309,9 +309,9 @@ def validate_expense_against_budget(args):
def get_allocated_budget(distribution_id, posting_date, fiscal_year, yearly_budget): def get_allocated_budget(distribution_id, posting_date, fiscal_year, yearly_budget):
if distribution_id: if distribution_id:
distribution = {} distribution = {}
for d in frappe.db.sql("""select bdd.month, bdd.percentage_allocation for d in frappe.db.sql("""select mdp.month, mdp.percentage_allocation
from `tabBudget Distribution Detail` bdd, `tabBudget Distribution` bd from `tabMonthly Distribution Percentage` mdp, `tabMonthly Distribution` md
where bdd.parent=bd.name and bd.fiscal_year=%s""", fiscal_year, as_dict=1): where mdp.parent=md.name and md.fiscal_year=%s""", fiscal_year, as_dict=1):
distribution.setdefault(d.month, d.percentage_allocation) distribution.setdefault(d.month, d.percentage_allocation)
dt = frappe.db.get_value("Fiscal Year", fiscal_year, "year_start_date") dt = frappe.db.get_value("Fiscal Year", fiscal_year, "year_start_date")

View File

@ -104,19 +104,6 @@
"options": "icon-file-text", "options": "icon-file-text",
"permlevel": 0 "permlevel": 0
}, },
{
"description": "Enter the company name under which Account Head will be created for this Supplier",
"fieldname": "company",
"fieldtype": "Link",
"in_filter": 1,
"label": "Company",
"oldfieldname": "company",
"oldfieldtype": "Link",
"options": "Company",
"permlevel": 0,
"reqd": 1,
"search_index": 0
},
{ {
"fieldname": "default_currency", "fieldname": "default_currency",
"fieldtype": "Link", "fieldtype": "Link",

View File

@ -139,7 +139,7 @@ def get_data():
{ {
"type":"doctype", "type":"doctype",
"name": "Monthly Distribution", "name": "Monthly Distribution",
"description": _("Seasonality for setting budgets.") "description": _("Seasonality for setting budgets, targets etc.")
}, },
{ {
"type": "doctype", "type": "doctype",

View File

@ -220,6 +220,9 @@ rename_map = {
], ],
"Journal Entry": [ "Journal Entry": [
["entries", "accounts"] ["entries", "accounts"]
],
"Monthly Distribution": [
["budget_distribution_details", "percentages"]
] ]
} }

View File

@ -71,9 +71,9 @@ def get_salesperson_details(filters):
def get_target_distribution_details(filters): def get_target_distribution_details(filters):
target_details = {} target_details = {}
for d in frappe.db.sql("""select bd.name, bdd.month, bdd.percentage_allocation for d in frappe.db.sql("""select md.name, mdp.month, mdp.percentage_allocation
from `tabBudget Distribution Detail` bdd, `tabBudget Distribution` bd from `tabMonthly Distribution Percentage` mdp, `tabMonthly Distribution` mdp
where bdd.parent=bd.name and bd.fiscal_year=%s""", (filters["fiscal_year"]), as_dict=1): where mdp.parent=md.name and md.fiscal_year=%s""", (filters["fiscal_year"]), as_dict=1):
target_details.setdefault(d.name, {}).setdefault(d.month, flt(d.percentage_allocation)) target_details.setdefault(d.name, {}).setdefault(d.month, flt(d.percentage_allocation))
return target_details return target_details

View File

@ -70,9 +70,9 @@ def get_territory_details(filters):
def get_target_distribution_details(filters): def get_target_distribution_details(filters):
target_details = {} target_details = {}
for d in frappe.db.sql("""select bd.name, bdd.month, bdd.percentage_allocation for d in frappe.db.sql("""select md.name, mdp.month, mdp.percentage_allocation
from `tabBudget Distribution Detail` bdd, `tabBudget Distribution` bd from `tabMonthly Distribution Percentage` mdp, `tabMonthly Distribution` md
where bdd.parent=bd.name and bd.fiscal_year=%s""", (filters["fiscal_year"]), as_dict=1): where mdp.parent=md.name and md.fiscal_year=%s""", (filters["fiscal_year"]), as_dict=1):
target_details.setdefault(d.name, {}).setdefault(d.month, flt(d.percentage_allocation)) target_details.setdefault(d.name, {}).setdefault(d.month, flt(d.percentage_allocation))
return target_details return target_details

View File

@ -107,6 +107,7 @@
"read_only": 0 "read_only": 0
}, },
{ {
"depends_on": "eval:!doc.__islocal",
"fieldname": "default_cash_account", "fieldname": "default_cash_account",
"fieldtype": "Link", "fieldtype": "Link",
"ignore_user_permissions": 1, "ignore_user_permissions": 1,
@ -143,6 +144,7 @@
"read_only": 0 "read_only": 0
}, },
{ {
"depends_on": "eval:!doc.__islocal",
"fieldname": "default_expense_account", "fieldname": "default_expense_account",
"fieldtype": "Link", "fieldtype": "Link",
"ignore_user_permissions": 1, "ignore_user_permissions": 1,
@ -152,6 +154,7 @@
"permlevel": 0 "permlevel": 0
}, },
{ {
"depends_on": "eval:!doc.__islocal",
"fieldname": "default_income_account", "fieldname": "default_income_account",
"fieldtype": "Link", "fieldtype": "Link",
"ignore_user_permissions": 1, "ignore_user_permissions": 1,
@ -372,7 +375,7 @@
], ],
"icon": "icon-building", "icon": "icon-building",
"idx": 1, "idx": 1,
"modified": "2014-12-15 11:14:12.090020", "modified": "2015-01-05 11:30:45.716971",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Setup", "module": "Setup",
"name": "Company", "name": "Company",

View File

@ -168,6 +168,12 @@ class Company(Document):
#delete cost center #delete cost center
frappe.db.sql("delete from `tabCost Center` WHERE company = %s order by lft desc, rgt desc", self.name) frappe.db.sql("delete from `tabCost Center` WHERE company = %s order by lft desc, rgt desc", self.name)
# delete account from customer and supplier
frappe.db.sql("delete from `tabParty Account` where company=%s", self.name)
# delete email digest
frappe.db.sql("delete from `tabEmail Digest` where company=%s", self.name)
if not frappe.db.get_value("Stock Ledger Entry", {"company": self.name}): if not frappe.db.get_value("Stock Ledger Entry", {"company": self.name}):
frappe.db.sql("""delete from `tabWarehouse` where company=%s""", self.name) frappe.db.sql("""delete from `tabWarehouse` where company=%s""", self.name)

View File

@ -314,10 +314,10 @@ def create_items(args):
is_stock_item = item_group!=_("Services") is_stock_item = item_group!=_("Services")
default_warehouse = "" default_warehouse = ""
if is_stock_item: if is_stock_item:
if is_sales_item: default_warehouse = frappe.db.get_value("Warehouse", filters={
default_warehouse = _("Finished Goods") + " - " + args.get("company_abbr") "warehouse_name": _("Finished Goods") if is_sales_item else _("Stores"),
else: "company": args.get("company_name").strip()
default_warehouse = _("Stores") + " - " + args.get("company_abbr") })
frappe.get_doc({ frappe.get_doc({
"doctype":"Item", "doctype":"Item",

View File

@ -79,7 +79,7 @@ class Item(WebsiteGenerator):
return context return context
def check_warehouse_is_set_for_stock_item(self): def check_warehouse_is_set_for_stock_item(self):
if self.is_stock_item=="Yes" and not self.default_warehouse: if self.is_stock_item=="Yes" and not self.default_warehouse and frappe.get_all("Warehouse"):
frappe.msgprint(_("Default Warehouse is mandatory for stock Item."), frappe.msgprint(_("Default Warehouse is mandatory for stock Item."),
raise_exception=WarehouseNotSet) raise_exception=WarehouseNotSet)

View File

@ -18,17 +18,6 @@
"permlevel": 0, "permlevel": 0,
"width": "50%" "width": "50%"
}, },
{
"fieldname": "account",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Account",
"options": "Account",
"permlevel": 0,
"print_hide": 1,
"read_only": 0,
"reqd": 1
},
{ {
"fieldname": "amount", "fieldname": "amount",
"fieldtype": "Currency", "fieldtype": "Currency",
@ -40,7 +29,7 @@
} }
], ],
"istable": 1, "istable": 1,
"modified": "2014-08-08 13:12:02.594698", "modified": "2015-01-10 11:32:46.466371",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Stock", "module": "Stock",
"name": "Landed Cost Taxes and Charges", "name": "Landed Cost Taxes and Charges",

View File

@ -19,17 +19,6 @@ erpnext.stock.LandedCostVoucher = erpnext.stock.StockController.extend({
} }
}; };
this.frm.fields_dict.taxes.grid.get_field('account').get_query = function() {
if(!me.frm.doc.company) msgprint(__("Please enter company first"));
return {
filters:[
['Account', 'group_or_ledger', '=', 'Ledger'],
['Account', 'account_type', 'in', ['Tax', 'Chargeable', 'Expense Account']],
['Account', 'company', '=', me.frm.doc.company]
]
}
};
this.frm.add_fetch("purchase_receipt", "supplier", "supplier"); this.frm.add_fetch("purchase_receipt", "supplier", "supplier");
this.frm.add_fetch("purchase_receipt", "posting_date", "posting_date"); this.frm.add_fetch("purchase_receipt", "posting_date", "posting_date");
this.frm.add_fetch("purchase_receipt", "grand_total", "grand_total"); this.frm.add_fetch("purchase_receipt", "grand_total", "grand_total");