Merge branch 'master' of github.com:webnotes/erpnext

This commit is contained in:
Nabin Hait 2012-10-29 14:46:27 +05:30
commit cf543d1979
12 changed files with 62 additions and 42 deletions

View File

@ -394,7 +394,9 @@ cur_frm.cscript.make_jv = function(doc, dt, dn, bank_account) {
// ***************** Get project name *****************
cur_frm.fields_dict['entries'].grid.get_field('project_name').get_query = function(doc, cdt, cdn) {
return 'SELECT `tabProject`.name FROM `tabProject` WHERE `tabProject`.status = "Open" AND `tabProject`.name LIKE "%s" ORDER BY `tabProject`.name ASC LIMIT 50';
return 'SELECT `tabProject`.name FROM `tabProject` \
WHERE `tabProject`.status not in ("Completed", "Cancelled") \
AND `tabProject`.name LIKE "%s" ORDER BY `tabProject`.name ASC LIMIT 50';
}

View File

@ -376,7 +376,10 @@ cur_frm.fields_dict.write_off_cost_center.get_query = function(doc) {
cur_frm.fields_dict['project_name'].get_query = function(doc, cdt, cdn) {
var cond = '';
if(doc.customer) cond = '(`tabProject`.customer = "'+doc.customer+'" OR IFNULL(`tabProject`.customer,"")="") AND';
return repl('SELECT `tabProject`.name FROM `tabProject` WHERE `tabProject`.status = "Open" AND %(cond)s `tabProject`.name LIKE "%s" ORDER BY `tabProject`.name ASC LIMIT 50', {cond:cond});
return repl('SELECT `tabProject`.name FROM `tabProject` \
WHERE `tabProject`.status not in ("Completed", "Cancelled") \
AND %(cond)s `tabProject`.name LIKE "%s" \
ORDER BY `tabProject`.name ASC LIMIT 50', {cond:cond});
}
//Territory

View File

@ -99,7 +99,9 @@ cur_frm.cscript.transaction_date = function(doc,cdt,cdn){
}
cur_frm.fields_dict['po_details'].grid.get_field('project_name').get_query = function(doc, cdt, cdn) {
return 'SELECT `tabProject`.name FROM `tabProject` WHERE `tabProject`.status = "Open" AND `tabProject`.name LIKE "%s" ORDER BY `tabProject`.name ASC LIMIT 50';
return 'SELECT `tabProject`.name FROM `tabProject` \
WHERE `tabProject`.status not in ("Completed", "Cancelled") \
AND `tabProject`.name LIKE "%s" ORDER BY `tabProject`.name ASC LIMIT 50';
}
cur_frm.fields_dict['indent_no'].get_query = function(doc) {

View File

@ -77,7 +77,8 @@ cur_frm.cscript.uom = function(doc, cdt, cdn) {
cur_frm.fields_dict['quotation_items'].grid.get_field('project_name').get_query =
function(doc, cdt, cdn) {
return "select `tabProject`.name from `tabProject` \
where `tabProject`.status = \"Open\" and `tabProject`.name like \"%s\" \
where `tabProject`.status not in (\"Completed\", \"Cancelled\") \
and `tabProject`.name like \"%s\" \
order by `tabProject`.name ASC LIMIT 50";
}

View File

@ -145,7 +145,9 @@ cur_frm.fields_dict['item'].get_query = function(doc) {
}
cur_frm.fields_dict['project_name'].get_query = function(doc, dt, dn) {
return 'SELECT `tabProject`.name FROM `tabProject` WHERE `tabProject`.status = "Open" AND `tabProject`.name LIKE "%s" ORDER BY `tabProject`.name ASC LIMIT 50';
return 'SELECT `tabProject`.name FROM `tabProject` \
WHERE `tabProject`.status not in ("Completed", "Cancelled") \
AND `tabProject`.name LIKE "%s" ORDER BY `tabProject`.name ASC LIMIT 50';
}
cur_frm.fields_dict['bom_materials'].grid.get_field('item_code').get_query = function(doc) {

View File

@ -104,7 +104,9 @@ cur_frm.fields_dict['production_item'].get_query = function(doc) {
}
cur_frm.fields_dict['project_name'].get_query = function(doc, dt, dn) {
return 'SELECT `tabProject`.name FROM `tabProject` WHERE `tabProject`.status = "Open" AND `tabProject`.name LIKE "%s" ORDER BY `tabProject`.name ASC LIMIT 50';
return 'SELECT `tabProject`.name FROM `tabProject` \
WHERE `tabProject`.status not in ("Completed", "Cancelled") \
AND `tabProject`.name LIKE "%s" ORDER BY `tabProject`.name ASC LIMIT 50';
}
cur_frm.fields_dict['bom_no'].get_query = function(doc) {

View File

@ -17,7 +17,9 @@
cur_frm.fields_dict['project'].get_query = function(doc,cdt,cdn){
var cond='';
if(doc.customer) cond = 'ifnull(`tabProject`.customer, "") = "'+doc.customer+'" AND';
return repl('SELECT distinct `tabProject`.`name` FROM `tabProject` WHERE %(cond)s `tabProject`.`name` LIKE "%s" ORDER BY `tabProject`.`name` ASC LIMIT 50', {cond:cond});
return repl('SELECT distinct `tabProject`.`name` FROM `tabProject` \
WHERE %(cond)s `tabProject`.`name` LIKE "%s" \
ORDER BY `tabProject`.`name` ASC LIMIT 50', {cond:cond});
}

View File

@ -3,9 +3,9 @@
# These values are common in all dictionaries
{
u'creation': '2012-08-08 15:39:55',
u'creation': '2012-09-18 11:05:48',
u'docstatus': 0,
u'modified': '2012-09-17 10:58:32',
u'modified': '2012-10-29 14:24:55',
u'modified_by': u'Administrator',
u'owner': u'Administrator'
},
@ -13,12 +13,14 @@
# These values are common for all DocType
{
'_last_update': u'1324880734',
'allow_attach': 1,
'allow_trash': 1,
'autoname': u'TASK.#####',
'colour': u'White:FFF',
'default_print_format': u'Standard',
u'doctype': u'DocType',
'document_type': u'Master',
'max_attachments': 5,
'module': u'Projects',
u'name': u'__common__',
'section_style': u'Tray',
@ -298,6 +300,17 @@
'oldfieldtype': u'Date'
},
# DocField
{
u'doctype': u'DocField',
'fieldname': u'file_list',
'fieldtype': u'Text',
'hidden': 1,
'label': u'File List',
'no_copy': 1,
'print_hide': 1
},
# DocPerm
{
'cancel': 1,

View File

@ -168,7 +168,9 @@ cur_frm.cscript.new_contact = function(){
cur_frm.fields_dict['project_name'].get_query = function(doc, cdt, cdn) {
var cond = '';
if(doc.customer) cond = '(`tabProject`.customer = "'+doc.customer+'" OR IFNULL(`tabProject`.customer,"")="") AND';
return repl('SELECT `tabProject`.name FROM `tabProject` WHERE `tabProject`.status = "Open" AND %(cond)s `tabProject`.name LIKE "%s" ORDER BY `tabProject`.name ASC LIMIT 50', {cond:cond});
return repl('SELECT `tabProject`.name FROM `tabProject` \
WHERE `tabProject`.status not in ("Completed", "Cancelled") \
AND %(cond)s `tabProject`.name LIKE "%s" ORDER BY `tabProject`.name ASC LIMIT 50', {cond:cond});
}
//---- get customer details ----------------------------

View File

@ -150,7 +150,10 @@ cur_frm.fields_dict['delivery_note_details'].grid.get_field('batch_no').get_quer
cur_frm.fields_dict['project_name'].get_query = function(doc, cdt, cdn) {
var cond = '';
if(doc.customer) cond = '(`tabProject`.customer = "'+doc.customer+'" OR IFNULL(`tabProject`.customer,"")="") AND';
return repl('SELECT `tabProject`.name FROM `tabProject` WHERE `tabProject`.status = "Open" AND %(cond)s `tabProject`.name LIKE "%s" ORDER BY `tabProject`.name ASC LIMIT 50', {cond:cond});
return repl('SELECT `tabProject`.name FROM `tabProject` \
WHERE `tabProject`.status not in ("Completed", "Cancelled") \
AND %(cond)s `tabProject`.name LIKE "%s" \
ORDER BY `tabProject`.name ASC LIMIT 50', {cond:cond});
}

View File

@ -128,7 +128,9 @@ cur_frm.cscript.transaction_date = function(doc,cdt,cdn){
// ***************** Get project name *****************
cur_frm.fields_dict['purchase_receipt_details'].grid.get_field('project_name').get_query = function(doc, cdt, cdn) {
return 'SELECT `tabProject`.name FROM `tabProject` WHERE `tabProject`.status = "Open" AND `tabProject`.name LIKE "%s" ORDER BY `tabProject`.name ASC LIMIT 50';
return 'SELECT `tabProject`.name FROM `tabProject` \
WHERE `tabProject`.status not in ("Completed", "Cancelled") \
AND `tabProject`.name LIKE "%s" ORDER BY `tabProject`.name ASC LIMIT 50';
}

View File

@ -28,13 +28,9 @@ class TransactionBase:
# -----------------------
def get_default_customer_address(self, args=''):
address_text, address_name = self.get_address_text(customer=self.doc.customer)
contact_text, contact_name, contact_email, contact_mobile = self.get_contact_text(customer=self.doc.customer)
self.doc.customer_address = address_name or ''
self.doc.contact_person = contact_name or ''
self.doc.address_display = address_text or ''
self.doc.contact_display = contact_text or ''
self.doc.contact_email = contact_email or ''
self.doc.contact_mobile = contact_mobile or ''
self.doc.fields.update(self.get_contact_text(customer=self.doc.customer))
if args != 'onload':
self.get_customer_details(self.doc.customer)
@ -44,13 +40,9 @@ class TransactionBase:
# -----------------------
def get_default_customer_shipping_address(self, args=''):
address_text, address_name = self.get_address_text(customer=self.doc.customer,is_shipping_address=1)
contact_text, contact_name, contact_email, contact_mobile = self.get_contact_text(customer=self.doc.customer)
self.doc.customer_address = address_name or ''
self.doc.contact_person = contact_name or ''
self.doc.address_display = address_text or ''
self.doc.contact_display = contact_text or ''
self.doc.contact_email = contact_email or ''
self.doc.contact_mobile = contact_mobile or ''
self.doc.fields.update(self.get_contact_text(customer=self.doc.customer))
if self.doc.doctype != 'Quotation' and args != 'onload':
self.get_customer_details(self.doc.customer)
@ -61,15 +53,13 @@ class TransactionBase:
def get_customer_address(self, args):
args = load_json(args)
address_text, address_name = self.get_address_text(address_name=args['address'])
contact_text, contact_name, contact_email, contact_mobile = self.get_contact_text(contact_name=args['contact'])
ret = {
'customer_address' : address_name,
'contact_person' : contact_name,
'address_display' : address_text,
'contact_display' : contact_text,
'contact_email' : contact_email,
'contact_mobile' : contact_mobile
}
ret.update(self.get_contact_text(contact_name=args['contact']))
return ret
# Get Address Text
@ -112,11 +102,15 @@ class TransactionBase:
contact_display = ''.join([a[0]+cstr(extract(a[1])) for a in contact_fields if extract(a[1])])
if contact_display.startswith('\n'): contact_display = contact_display[1:]
contact_name = details and details[0]['name'] or ''
contact_email = details and details[0]['email_id'] or ''
contact_mobile = details and details[0]['mobile_no'] or ''
return contact_display, contact_name, contact_email, contact_mobile
return {
"contact_display": contact_display,
"contact_person": details and details[0]["name"] or "",
"contact_email": details and details[0]["email_id"] or "",
"contact_mobile": details and details[0]["mobile_no"] or "",
"contact_designation": details and details[0]["designation"] or "",
"contact_department": details and details[0]["department"] or "",
}
def get_customer_details(self, name):
"""
Get customer details like name, group, territory
@ -185,15 +179,11 @@ class TransactionBase:
def get_default_supplier_address(self, args):
args = load_json(args)
address_text, address_name = self.get_address_text(supplier=args['supplier'])
contact_text, contact_name, contact_email, contact_mobile = self.get_contact_text(supplier=args['supplier'])
ret = {
'supplier_address' : address_name,
'address_display' : address_text,
'contact_person' : contact_name,
'contact_display' : contact_text,
'contact_email' : contact_email,
'contact_mobile' : contact_mobile
}
ret.update(self.get_contact_text(supplier=args['supplier']))
ret.update(self.get_supplier_details(args['supplier']))
return ret
@ -202,15 +192,11 @@ class TransactionBase:
def get_supplier_address(self, args):
args = load_json(args)
address_text, address_name = self.get_address_text(address_name=args['address'])
contact_text, contact_name, contact_email, contact_mobile = self.get_contact_text(contact_name=args['contact'])
ret = {
'supplier_address' : address_name,
'address_display' : address_text,
'contact_person' : contact_name,
'contact_display' : contact_text,
'contact_email' : contact_email,
'contact_mobile' : contact_mobile
}
ret.update(self.get_contact_text(contact_name=args['contact']))
return ret
# Get Supplier Details