Merged master into wsgi

This commit is contained in:
Anand Doshi
2013-10-10 16:04:40 +05:30
parent b604eddbfd
commit 373680bbae
33 changed files with 520 additions and 418 deletions

View File

@@ -121,4 +121,4 @@ def make_opportunity(source_name, target_doclist=None):
}
}}, target_doclist)
return [d.fields for d in doclist]
return [d if isinstance(d, dict) else d.fields for d in doclist]

View File

@@ -2,7 +2,7 @@
{
"creation": "2013-04-10 11:45:37",
"docstatus": 0,
"modified": "2013-10-03 17:24:33",
"modified": "2013-10-09 15:27:54",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -159,8 +159,63 @@
"doctype": "DocField",
"fieldname": "communication_history",
"fieldtype": "Section Break",
"label": "Communication History",
"options": "icon-comments"
"label": "Communication",
"options": "icon-comments",
"print_hide": 1
},
{
"default": "__user",
"doctype": "DocField",
"fieldname": "lead_owner",
"fieldtype": "Link",
"in_filter": 1,
"label": "Lead Owner",
"oldfieldname": "lead_owner",
"oldfieldtype": "Link",
"options": "Profile",
"search_index": 1
},
{
"doctype": "DocField",
"fieldname": "col_break123",
"fieldtype": "Column Break",
"width": "50%"
},
{
"allow_on_submit": 0,
"description": "Your sales person who will contact the lead in future",
"doctype": "DocField",
"fieldname": "contact_by",
"fieldtype": "Link",
"hidden": 0,
"in_filter": 1,
"label": "Next Contact By",
"oldfieldname": "contact_by",
"oldfieldtype": "Link",
"options": "Profile",
"print_hide": 0,
"reqd": 0,
"width": "100px"
},
{
"allow_on_submit": 0,
"description": "Your sales person will get a reminder on this date to contact the lead",
"doctype": "DocField",
"fieldname": "contact_date",
"fieldtype": "Date",
"in_filter": 1,
"label": "Next Contact Date",
"no_copy": 1,
"oldfieldname": "contact_date",
"oldfieldtype": "Date",
"reqd": 0,
"width": "100px"
},
{
"doctype": "DocField",
"fieldname": "sec_break123",
"fieldtype": "Section Break",
"options": "Simple"
},
{
"allow_on_submit": 0,
@@ -273,18 +328,6 @@
"oldfieldtype": "Select",
"options": "\nClient\nChannel Partner\nConsultant"
},
{
"default": "__user",
"doctype": "DocField",
"fieldname": "lead_owner",
"fieldtype": "Link",
"in_filter": 1,
"label": "Lead Owner",
"oldfieldname": "lead_owner",
"oldfieldtype": "Link",
"options": "Profile",
"search_index": 1
},
{
"doctype": "DocField",
"fieldname": "market_segment",
@@ -334,49 +377,6 @@
"oldfieldtype": "Column Break",
"width": "50%"
},
{
"allow_on_submit": 0,
"description": "Your sales person who will contact the lead in future",
"doctype": "DocField",
"fieldname": "contact_by",
"fieldtype": "Link",
"hidden": 0,
"in_filter": 1,
"label": "Next Contact By",
"oldfieldname": "contact_by",
"oldfieldtype": "Link",
"options": "Profile",
"print_hide": 0,
"reqd": 0,
"width": "100px"
},
{
"allow_on_submit": 0,
"description": "Your sales person will get a reminder on this date to contact the lead",
"doctype": "DocField",
"fieldname": "contact_date",
"fieldtype": "Date",
"in_filter": 1,
"label": "Next Contact Date",
"no_copy": 1,
"oldfieldname": "contact_date",
"oldfieldtype": "Date",
"reqd": 0,
"width": "100px"
},
{
"depends_on": "eval:!doc.__islocal",
"description": "Date on which the lead was last contacted",
"doctype": "DocField",
"fieldname": "last_contact_date",
"fieldtype": "Date",
"label": "Last Contact Date",
"no_copy": 1,
"oldfieldname": "last_contact_date",
"oldfieldtype": "Date",
"print_hide": 1,
"read_only": 1
},
{
"doctype": "DocField",
"fieldname": "company",

View File

@@ -4,7 +4,7 @@
from __future__ import unicode_literals
import webnotes
from webnotes.utils import cstr, getdate, cint
from webnotes.utils import cstr, cint
from webnotes.model.bean import getlist
from webnotes import msgprint, _
@@ -17,7 +17,7 @@ class DocType(TransactionBase):
self.doclist = doclist
self.fname = 'enq_details'
self.tname = 'Opportunity Item'
self._prev = webnotes._dict({
"contact_date": webnotes.conn.get_value("Opportunity", self.doc.name, "contact_date") if \
(not cint(self.doc.fields.get("__islocal"))) else None,
@@ -70,10 +70,6 @@ class DocType(TransactionBase):
def on_update(self):
# Add to calendar
if self.doc.contact_date and self.doc.contact_date_ref != self.doc.contact_date:
webnotes.conn.set(self.doc, 'contact_date_ref',self.doc.contact_date)
self.add_calendar_event()
def add_calendar_event(self, opts=None, force=False):
@@ -101,14 +97,6 @@ class DocType(TransactionBase):
super(DocType, self).add_calendar_event(opts, force)
def set_last_contact_date(self):
if self.doc.contact_date_ref and self.doc.contact_date_ref != self.doc.contact_date:
if getdate(self.doc.contact_date_ref) < getdate(self.doc.contact_date):
self.doc.last_contact_date=self.doc.contact_date_ref
else:
msgprint("Contact Date Cannot be before Last Contact Date")
raise Exception
def validate_item_details(self):
if not getlist(self.doclist, 'enquiry_details'):
msgprint("Please select items for which enquiry needs to be made")
@@ -122,7 +110,6 @@ class DocType(TransactionBase):
def validate(self):
self.set_status()
self.set_last_contact_date()
self.validate_item_details()
self.validate_uom_is_integer("uom", "qty")
self.validate_lead_cust()

View File

@@ -2,7 +2,7 @@
{
"creation": "2013-03-07 18:50:30",
"docstatus": 0,
"modified": "2013-10-03 16:30:58",
"modified": "2013-10-09 15:26:29",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -404,20 +404,6 @@
"oldfieldtype": "Date",
"read_only": 0
},
{
"allow_on_submit": 0,
"depends_on": "eval:!doc.__islocal",
"description": "Date on which the lead was last contacted",
"doctype": "DocField",
"fieldname": "last_contact_date",
"fieldtype": "Date",
"label": "Last Contact Date",
"no_copy": 1,
"oldfieldname": "last_contact_date",
"oldfieldtype": "Date",
"print_hide": 1,
"read_only": 1
},
{
"doctype": "DocField",
"fieldname": "to_discuss",

View File

@@ -4,7 +4,7 @@
from __future__ import unicode_literals
import webnotes
from webnotes.utils import cstr, getdate
from webnotes.utils import cstr
from webnotes.model.bean import getlist
from webnotes.model.code import get_obj
from webnotes import _, msgprint
@@ -97,24 +97,9 @@ class DocType(SellingController):
msgprint("You can not select non sales item "+d.item_code+" in Sales Quotation")
raise Exception
#--------------Validation For Last Contact Date-----------------
# ====================================================================================================================
def set_last_contact_date(self):
#if not self.doc.contact_date_ref:
#self.doc.contact_date_ref=self.doc.contact_date
#self.doc.last_contact_date=self.doc.contact_date_ref
if self.doc.contact_date_ref and self.doc.contact_date_ref != self.doc.contact_date:
if getdate(self.doc.contact_date_ref) < getdate(self.doc.contact_date):
self.doc.last_contact_date=self.doc.contact_date_ref
else:
msgprint("Contact Date Cannot be before Last Contact Date")
raise Exception
def validate(self):
super(DocType, self).validate()
self.set_status()
self.set_last_contact_date()
self.validate_order_type()
self.validate_for_items()

View File

@@ -126,7 +126,7 @@ class DocType(SellingController):
self.validate_po()
self.validate_uom_is_integer("stock_uom", "qty")
self.validate_for_items()
self.validate_warehouse_user()
self.validate_warehouse()
sales_com_obj = get_obj(dt = 'Sales Common')
sales_com_obj.check_active_sales_items(self)
sales_com_obj.check_conversion_rate(self)
@@ -147,14 +147,15 @@ class DocType(SellingController):
if not self.doc.delivery_status: self.doc.delivery_status = 'Not Delivered'
def validate_warehouse_user(self):
from stock.utils import validate_warehouse_user
def validate_warehouse(self):
from stock.utils import validate_warehouse_user, validate_warehouse_company
warehouses = list(set([d.reserved_warehouse for d in
self.doclist.get({"doctype": self.tname}) if d.reserved_warehouse]))
for w in warehouses:
validate_warehouse_user(w)
validate_warehouse_company(w, self.doc.company)
def validate_with_previous_doc(self):
super(DocType, self).validate_with_previous_doc(self.tname, {

View File

@@ -74,7 +74,7 @@ def get_item_details(args):
out.update(apply_pos_settings(pos_settings, out))
if args.doctype in ("Sales Invoice", "Delivery Note"):
if item_bean.doc.has_serial_no and not args.serial_no:
if item_bean.doc.has_serial_no == "Yes" and not args.serial_no:
out.serial_no = _get_serial_nos_by_fifo(args, item_bean)
return out