more fixes to perms, floats and default enabled / disabled in search

This commit is contained in:
Rushabh Mehta
2013-01-23 10:09:28 +05:30
parent efe8102351
commit 6382a42dbe
25 changed files with 330 additions and 290 deletions

View File

@@ -213,7 +213,9 @@ class DocType:
cc = sql("select name from `tabCost Center` where cost_center_name = 'Root' and company_name = '%s'"%(self.doc.name))
if not cc:
self.create_default_cost_center()
if self.doc.default_currency:
webnotes.conn.set_value("Currency", self.doc.default_currency, "enabled", 1)
def on_trash(self):
"""

View File

@@ -2,7 +2,7 @@
{
"creation": "2013-01-10 16:34:22",
"docstatus": 0,
"modified": "2013-01-22 14:55:58",
"modified": "2013-01-22 16:54:47",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -86,9 +86,9 @@
{
"doctype": "DocField",
"fieldname": "default_currency",
"fieldtype": "Select",
"fieldtype": "Link",
"label": "Default Currency",
"options": "link:Currency",
"options": "Currency",
"reqd": 1
},
{

View File

@@ -1,2 +1,6 @@
cur_frm.cscript.refresh = function(doc) {
cur_frm.set_intro("");
if(!cur_frm.doc.enabled) {
cur_frm.set_intro(wn._("This Currency is disabled. Enable to use in transactions"))
}
}

View File

@@ -0,0 +1,19 @@
wn.doclistviews['Currency'] = wn.views.ListView.extend({
init: function(d) {
this._super(d)
this.fields = this.fields.concat([
"`tabCurrency`.enabled",
]);
this.stats = this.stats.concat(['enabled']);
this.order_by = "`tabCurrency`.`enabled` desc, `tabCurrency`.modified desc";
},
columns: [
{width: '3%', content: 'check'},
{width: '5%', content: 'avatar'},
{width: '3%', content: "enabled"},
{width: '70%', content: 'name'},
{width: '20%', content:'modified',
css: {'text-align': 'right', 'color': '#777'}},
]
});

View File

@@ -65,7 +65,11 @@ class DocType:
webnotes.conn.set_default('year_start_date', ysd.strftime('%Y-%m-%d'))
webnotes.conn.set_default('year_end_date', \
get_last_day(get_first_day(ysd,0,11)).strftime('%Y-%m-%d'))
# enable default currency
if self.doc.default_currency:
webnotes.conn.set_value("Currency", self.doc.default_currency, "enabled", 1)
# clear cache
webnotes.clear_cache()

View File

@@ -2,7 +2,7 @@
{
"creation": "2013-01-10 16:34:23",
"docstatus": 0,
"modified": "2013-01-22 14:56:02",
"modified": "2013-01-22 16:54:48",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -101,9 +101,9 @@
"default": "INR",
"doctype": "DocField",
"fieldname": "default_currency",
"fieldtype": "Select",
"fieldtype": "Link",
"label": "Default Currency",
"options": "link:Currency",
"options": "Currency",
"reqd": 1
},
{

View File

@@ -53,6 +53,7 @@ class DocType:
}}
self.create_records(master_dict)
# Company
master_dict = {'Company': {
'company_name':args.get('company_name'),
@@ -60,6 +61,10 @@ class DocType:
'default_currency':args.get('currency')
}}
self.create_records(master_dict)
# enable default currency
webnotes.conn.set_value("Currency", args.get("currency"), "enabled", 1)
def_args = {
'current_fiscal_year':curr_fiscal_year,

View File

@@ -2,11 +2,12 @@
{
"creation": "2013-01-10 16:34:24",
"docstatus": 0,
"modified": "2013-01-22 14:57:26",
"modified": "2013-01-22 17:36:24",
"modified_by": "Administrator",
"owner": "Administrator"
},
{
"allow_rename": 1,
"autoname": "field:title",
"description": "Standard Terms and Conditions that can be added to Sales and Purchases.\n\nExamples:\n\n1. Validity of the offer.\n1. Payment Terms (In Advance, On Credit, part advance etc).\n1. What is extra (or payable by the Customer).\n1. Safety / usage warning.\n1. Warranty if any.\n1. Returns Policy.\n1. Terms of shipping, if applicable.\n1. Ways of addressing disputes, indemnity, liability, etc.\n1. Address and Contact of your Company.",
"doctype": "DocType",

View File

@@ -19,7 +19,7 @@ wn.module_page["Setup"] = [
{
"doctype":"Currency",
"label": wn._("Currency"),
"description": wn._("Currency Master")
"description": wn._("Enable / disable currencies.")
},
]
},