Merge branch 'master' of github.com:webnotes/erpnext
This commit is contained in:
commit
877a1a9274
@ -1,8 +1,8 @@
|
||||
[
|
||||
{
|
||||
"creation": "2013-01-10 16:34:09",
|
||||
"creation": "2013-01-24 11:03:30",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-01-23 17:11:18",
|
||||
"modified": "2013-01-24 14:15:49",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -161,7 +161,7 @@
|
||||
"fieldname": "included_in_print_rate",
|
||||
"fieldtype": "Check",
|
||||
"label": "Is this Tax included in Basic Rate?",
|
||||
"no_copy": 1,
|
||||
"no_copy": 0,
|
||||
"print_hide": 1,
|
||||
"report_hide": 1,
|
||||
"width": "150px"
|
||||
|
@ -172,6 +172,8 @@ class DocType(TransactionBase):
|
||||
pass
|
||||
|
||||
def on_update(self):
|
||||
self.validate_name_with_customer_group()
|
||||
|
||||
self.update_lead_status()
|
||||
# create account head
|
||||
self.create_account_head()
|
||||
@ -179,6 +181,12 @@ class DocType(TransactionBase):
|
||||
self.update_credit_days_limit()
|
||||
#create address and contact from lead
|
||||
self.create_lead_address_contact()
|
||||
|
||||
def validate_name_with_customer_group(self):
|
||||
if webnotes.conn.exists("Customer Group", self.doc.name):
|
||||
webnotes.msgprint("An Customer Group exists with same name (%s), \
|
||||
please change the Customer name or rename the Customer Group" %
|
||||
self.doc.name, raise_exception=1)
|
||||
|
||||
def delete_customer_address(self):
|
||||
for rec in sql("select * from `tabAddress` where customer='%s'" %(self.doc.name), as_dict=1):
|
||||
|
@ -18,12 +18,16 @@ def get_children():
|
||||
|
||||
@webnotes.whitelist()
|
||||
def add_node():
|
||||
from webnotes.model.doc import Document
|
||||
# from webnotes.model.doc import Document
|
||||
ctype = webnotes.form_dict.get('ctype')
|
||||
parent_field = 'parent_' + ctype.lower().replace(' ', '_')
|
||||
|
||||
d = Document(ctype)
|
||||
d.fields[ctype.lower().replace(' ', '_') + '_name'] = webnotes.form_dict['name_field']
|
||||
d.fields[parent_field] = webnotes.form_dict['parent']
|
||||
d.is_group = webnotes.form_dict['is_group']
|
||||
d.save()
|
||||
name_field = ctype.lower().replace(' ', '_') + '_name'
|
||||
|
||||
doclist = [{
|
||||
"doctype": ctype,
|
||||
"__islocal": 1,
|
||||
name_field: webnotes.form_dict['name_field'],
|
||||
parent_field: webnotes.form_dict['parent'],
|
||||
"is_group": webnotes.form_dict['is_group']
|
||||
}]
|
||||
webnotes.model_wrapper(doclist).save()
|
@ -37,6 +37,15 @@ class DocType(DocTypeNestedSet):
|
||||
To untrash please go to Setup -> Recycle Bin.""" %
|
||||
(self.doc.customer_group_name), raise_exception = 1)
|
||||
|
||||
def on_update(self):
|
||||
self.validate_name_with_customer()
|
||||
|
||||
def validate_name_with_customer(self):
|
||||
if webnotes.conn.exists("Customer", self.doc.name):
|
||||
webnotes.msgprint("An Customer exists with same name (%s), \
|
||||
please change the Customer Group name or rename the Customer" %
|
||||
self.doc.name, raise_exception=1)
|
||||
|
||||
def on_trash(self):
|
||||
cust = sql("select name from `tabCustomer` where ifnull(customer_group, '') = %s",
|
||||
self.doc.name)
|
||||
|
@ -24,10 +24,13 @@ class DocType(DocTypeNestedSet):
|
||||
def __init__(self, doc, doclist=[]):
|
||||
self.doc = doc
|
||||
self.doclist = doclist
|
||||
self.nsm_parent_field = 'parent_item_group';
|
||||
|
||||
self.nsm_parent_field = 'parent_item_group'
|
||||
|
||||
def on_update(self):
|
||||
super(DocType, self).on_update()
|
||||
|
||||
self.validate_name_with_item()
|
||||
|
||||
if self.doc.show_in_website:
|
||||
# webpage updates
|
||||
from website.utils import update_page_name
|
||||
@ -42,7 +45,12 @@ class DocType(DocTypeNestedSet):
|
||||
|
||||
from website.helpers.product import invalidate_cache_for
|
||||
invalidate_cache_for(self.doc.name)
|
||||
|
||||
|
||||
def validate_name_with_item(self):
|
||||
if webnotes.conn.exists("Item", self.doc.name):
|
||||
webnotes.msgprint("An item exists with same name (%s), please change the \
|
||||
item group name or rename the item" % self.doc.name, raise_exception=1)
|
||||
|
||||
def prepare_template_args(self):
|
||||
from website.helpers.product import get_product_list_for_group, \
|
||||
get_parent_item_groups, get_group_item_count
|
||||
|
@ -18,9 +18,8 @@ from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
from webnotes.utils import cstr, flt
|
||||
from webnotes.model import db_exists
|
||||
from webnotes.model.doc import addchild
|
||||
from webnotes.model.wrapper import getlist, copy_doclist
|
||||
from webnotes.model.wrapper import getlist
|
||||
from webnotes import msgprint
|
||||
|
||||
sql = webnotes.conn.sql
|
||||
@ -38,6 +37,8 @@ class DocType:
|
||||
return ret
|
||||
|
||||
def on_update(self):
|
||||
self.validate_name_with_item_group()
|
||||
|
||||
if self.doc.show_in_website:
|
||||
# webpage updates
|
||||
self.update_website()
|
||||
@ -62,8 +63,6 @@ class DocType:
|
||||
if flt(d.conversion_factor) != 1:
|
||||
msgprint("Conversion Factor of UOM : %s should be equal to 1. As UOM : %s is Stock UOM of Item: %s." % ( cstr(d.uom), cstr(d.uom), cstr(self.doc.name)))
|
||||
raise Exception
|
||||
# else set uom_exist as true
|
||||
uom_exist='true'
|
||||
elif cstr(d.uom) != cstr(self.doc.stock_uom) and flt(d.conversion_factor) == 1:
|
||||
msgprint("Conversion Factor of UOM : %s should not be equal to 1. As UOM : %s is not Stock UOM of Item: %s." % ( cstr(d.uom), cstr(d.uom), cstr(self.doc.name)))
|
||||
raise Exception
|
||||
@ -75,6 +74,12 @@ class DocType:
|
||||
child.conversion_factor = 1
|
||||
child.save()
|
||||
|
||||
def validate_name_with_item_group(self):
|
||||
if webnotes.conn.exists("Item Group", self.doc.name):
|
||||
webnotes.msgprint("An item group exists with same name (%s), \
|
||||
please change the item name or rename the item group" %
|
||||
self.doc.name, raise_exception=1)
|
||||
|
||||
def update_website(self):
|
||||
from website.utils import update_page_name
|
||||
if self.doc.name==self.doc.item_name:
|
||||
@ -179,7 +184,7 @@ class DocType:
|
||||
|
||||
if self.doc.name:
|
||||
self.old_page_name = webnotes.conn.get_value('Item', self.doc.name, 'page_name')
|
||||
|
||||
|
||||
def check_non_asset_warehouse(self):
|
||||
if self.doc.is_asset_item == "Yes":
|
||||
existing_qty = sql("select t1.warehouse, t1.actual_qty from tabBin t1, tabWarehouse t2 where t1.item_code=%s and (t2.warehouse_type!='Fixed Asset' or t2.warehouse_type is null) and t1.warehouse=t2.name and t1.actual_qty > 0", self.doc.name)
|
||||
|
Loading…
x
Reference in New Issue
Block a user