Merge branch 'master' of github.com:webnotes/erpnext
This commit is contained in:
commit
43eb513a43
@ -1,49 +0,0 @@
|
|||||||
[
|
|
||||||
{
|
|
||||||
"owner": "ashwini@webnotestech.com",
|
|
||||||
"docstatus": 0,
|
|
||||||
"creation": "2010-09-01 15:47:59",
|
|
||||||
"modified_by": "Administrator",
|
|
||||||
"modified": "2012-04-03 12:49:50"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"match_id": 0,
|
|
||||||
"parent": "Project-Sales Invoice",
|
|
||||||
"name": "__common__",
|
|
||||||
"doctype": "Table Mapper Detail",
|
|
||||||
"parenttype": "DocType Mapper",
|
|
||||||
"from_table": "Project",
|
|
||||||
"to_table": "Sales Invoice",
|
|
||||||
"validation_logic": "name is not null",
|
|
||||||
"parentfield": "table_mapper_details"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"map": "Yes",
|
|
||||||
"match_id": 0,
|
|
||||||
"parent": "Project-Sales Invoice",
|
|
||||||
"name": "__common__",
|
|
||||||
"to_field": "customer",
|
|
||||||
"doctype": "Field Mapper Detail",
|
|
||||||
"parenttype": "DocType Mapper",
|
|
||||||
"checking_operator": "=",
|
|
||||||
"from_field": "customer",
|
|
||||||
"parentfield": "field_mapper_details"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "__common__",
|
|
||||||
"to_doctype": "Sales Invoice",
|
|
||||||
"module": "Accounts",
|
|
||||||
"doctype": "DocType Mapper",
|
|
||||||
"from_doctype": "Project"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Project-Sales Invoice",
|
|
||||||
"doctype": "DocType Mapper"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"doctype": "Field Mapper Detail"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"doctype": "Table Mapper Detail"
|
|
||||||
}
|
|
||||||
]
|
|
@ -482,6 +482,9 @@ class DocType(TransactionBase):
|
|||||||
|
|
||||||
|
|
||||||
def on_submit(self):
|
def on_submit(self):
|
||||||
|
purchase_controller = webnotes.get_obj("Purchase Common")
|
||||||
|
purchase_controller.is_item_table_empty(self)
|
||||||
|
|
||||||
self.check_prev_docstatus()
|
self.check_prev_docstatus()
|
||||||
|
|
||||||
# Check for Approving Authority
|
# Check for Approving Authority
|
||||||
@ -492,8 +495,7 @@ class DocType(TransactionBase):
|
|||||||
self.make_gl_entries()
|
self.make_gl_entries()
|
||||||
|
|
||||||
self.update_against_document_in_jv()
|
self.update_against_document_in_jv()
|
||||||
|
purchase_controller.update_prevdoc_detail(self, is_submit = 1)
|
||||||
get_obj(dt = 'Purchase Common').update_prevdoc_detail(self, is_submit = 1)
|
|
||||||
|
|
||||||
|
|
||||||
def make_gl_entries(self, is_cancel = 0):
|
def make_gl_entries(self, is_cancel = 0):
|
||||||
|
@ -264,13 +264,6 @@ cur_frm.cscript.write_off_amount = function(doc) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---- get customer details ----------------------------
|
|
||||||
cur_frm.cscript.project_name = function(doc,cdt,cdn){
|
|
||||||
$c_obj(make_doclist(doc.doctype, doc.name),'pull_project_customer','', function(r,rt){
|
|
||||||
refresh_many(['customer', 'customer_name','customer_address', 'territory']);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//Set debit and credit to zero on adding new row
|
//Set debit and credit to zero on adding new row
|
||||||
//----------------------------------------------
|
//----------------------------------------------
|
||||||
cur_frm.fields_dict['entries'].grid.onrowadd = function(doc, cdt, cdn){
|
cur_frm.fields_dict['entries'].grid.onrowadd = function(doc, cdt, cdn){
|
||||||
|
@ -320,13 +320,6 @@ class DocType(TransactionBase):
|
|||||||
def get_advances(self):
|
def get_advances(self):
|
||||||
self.doclist = get_obj('GL Control').get_advances(self, self.doc.debit_to, 'Sales Invoice Advance', 'advance_adjustment_details', 'credit')
|
self.doclist = get_obj('GL Control').get_advances(self, self.doc.debit_to, 'Sales Invoice Advance', 'advance_adjustment_details', 'credit')
|
||||||
|
|
||||||
|
|
||||||
def pull_project_customer(self):
|
|
||||||
res = webnotes.conn.sql("select customer from `tabProject` where name = '%s'" %
|
|
||||||
self.doc.project_name)
|
|
||||||
if res and res[0][0]:
|
|
||||||
get_obj('DocType Mapper', 'Project-Sales Invoice').dt_map('Project', 'Sales Invoice', self.doc.project_name, self.doc, self.doclist, "[['Project', 'Sales Invoice']]")
|
|
||||||
|
|
||||||
def get_company_abbr(self):
|
def get_company_abbr(self):
|
||||||
return webnotes.conn.sql("select abbr from tabCompany where name=%s", self.doc.company)[0][0]
|
return webnotes.conn.sql("select abbr from tabCompany where name=%s", self.doc.company)[0][0]
|
||||||
|
|
||||||
|
@ -280,21 +280,8 @@ cur_frm.cscript.import_ref_rate = function(doc, cdt, cdn) {
|
|||||||
cur_frm.cscript.calc_amount(doc, 5);
|
cur_frm.cscript.calc_amount(doc, 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
//==================== check if item table is blank ==============================================
|
|
||||||
var is_item_table = function(doc,cdt,cdn) {
|
|
||||||
// Step 1 :=>Get all childrens/ rows from Detail Table
|
|
||||||
var cl = getchildren(tname, doc.name, fname);
|
|
||||||
// Step 2 :=> If there are no rows then set validated = false, this will stop further execution of code.
|
|
||||||
if (cl.length == 0) {
|
|
||||||
alert("There is no item in table"); validated = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//==================== Validate ====================================================================
|
//==================== Validate ====================================================================
|
||||||
cur_frm.cscript.validate = function(doc, cdt, cdn) {
|
cur_frm.cscript.validate = function(doc, cdt, cdn) {
|
||||||
// Step 1:=> check if item table is blank
|
|
||||||
is_item_table(doc,cdt,cdn);
|
|
||||||
// Step 2:=> Calculate Amount
|
|
||||||
cur_frm.cscript.calc_amount(doc, 1);
|
cur_frm.cscript.calc_amount(doc, 1);
|
||||||
|
|
||||||
// calculate advances if pv
|
// calculate advances if pv
|
||||||
|
@ -22,14 +22,14 @@ from webnotes.model import db_exists
|
|||||||
from webnotes.model.doc import Document, addchild
|
from webnotes.model.doc import Document, addchild
|
||||||
from webnotes.model.wrapper import getlist, copy_doclist
|
from webnotes.model.wrapper import getlist, copy_doclist
|
||||||
from webnotes.model.code import get_obj
|
from webnotes.model.code import get_obj
|
||||||
from webnotes import form, msgprint
|
from webnotes import form, msgprint, _
|
||||||
|
|
||||||
sql = webnotes.conn.sql
|
sql = webnotes.conn.sql
|
||||||
|
|
||||||
from utilities.transaction_base import TransactionBase
|
from utilities.transaction_base import TransactionBase
|
||||||
|
|
||||||
class DocType(TransactionBase):
|
class DocType(TransactionBase):
|
||||||
def __init__(self, doc, doclist=[]):
|
def __init__(self, doc, doclist=None):
|
||||||
self.doc = doc
|
self.doc = doc
|
||||||
self.doclist = doclist
|
self.doclist = doclist
|
||||||
|
|
||||||
@ -64,6 +64,11 @@ class DocType(TransactionBase):
|
|||||||
|
|
||||||
self.msg = []
|
self.msg = []
|
||||||
|
|
||||||
|
def is_item_table_empty(self, obj):
|
||||||
|
if not len(obj.doclist.get({"parentfield": obj.fname})):
|
||||||
|
msgprint(_("Hey there! You need to put at least one item in \
|
||||||
|
the item table."), raise_exception=True)
|
||||||
|
|
||||||
|
|
||||||
def get_default_schedule_date( self, obj):
|
def get_default_schedule_date( self, obj):
|
||||||
for d in getlist( obj.doclist, obj.fname):
|
for d in getlist( obj.doclist, obj.fname):
|
||||||
|
@ -220,10 +220,11 @@ class DocType(TransactionBase):
|
|||||||
|
|
||||||
# On Submit
|
# On Submit
|
||||||
def on_submit(self):
|
def on_submit(self):
|
||||||
pc_obj = get_obj(dt ='Purchase Common')
|
purchase_controller = webnotes.get_obj("Purchase Common")
|
||||||
|
purchase_controller.is_item_table_empty(self)
|
||||||
|
|
||||||
# Step 1 :=> Update Previous Doc i.e. update pending_qty and Status accordingly
|
# Step 1 :=> Update Previous Doc i.e. update pending_qty and Status accordingly
|
||||||
pc_obj.update_prevdoc_detail(self, is_submit = 1)
|
purchase_controller.update_prevdoc_detail(self, is_submit = 1)
|
||||||
|
|
||||||
# Step 2 :=> Update Bin
|
# Step 2 :=> Update Bin
|
||||||
self.update_bin(is_submit = 1, is_stopped = 0)
|
self.update_bin(is_submit = 1, is_stopped = 0)
|
||||||
@ -236,7 +237,7 @@ class DocType(TransactionBase):
|
|||||||
"last_purchase_order", self.doc.name)
|
"last_purchase_order", self.doc.name)
|
||||||
|
|
||||||
# Step 5 :=> Update last purchase rate
|
# Step 5 :=> Update last purchase rate
|
||||||
pc_obj.update_last_purchase_rate(self, is_submit = 1)
|
purchase_controller.update_last_purchase_rate(self, is_submit = 1)
|
||||||
|
|
||||||
# Step 6 :=> Set Status
|
# Step 6 :=> Set Status
|
||||||
webnotes.conn.set(self.doc,'status','Submitted')
|
webnotes.conn.set(self.doc,'status','Submitted')
|
||||||
|
@ -50,22 +50,19 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
|||||||
erpnext.hide_naming_series();
|
erpnext.hide_naming_series();
|
||||||
|
|
||||||
if(doc.docstatus == 1 && doc.status != 'Stopped'){
|
if(doc.docstatus == 1 && doc.status != 'Stopped'){
|
||||||
|
cur_frm.add_custom_button("Make Supplier Quotation", cur_frm.cscript.make_supplier_quotation);
|
||||||
if(flt(doc.per_ordered, 2) < 100) {
|
if(flt(doc.per_ordered, 2) < 100) {
|
||||||
cur_frm.add_custom_button('Make Purchase Order', cur_frm.cscript['Make Purchase Order']);
|
cur_frm.add_custom_button('Make Purchase Order', cur_frm.cscript['Make Purchase Order']);
|
||||||
cur_frm.add_custom_button('Stop Purchase Request', cur_frm.cscript['Stop Purchase Request']);
|
cur_frm.add_custom_button('Stop Purchase Request', cur_frm.cscript['Stop Purchase Request']);
|
||||||
}
|
}
|
||||||
cur_frm.add_custom_button('Send SMS', cur_frm.cscript.send_sms);
|
cur_frm.add_custom_button('Send SMS', cur_frm.cscript.send_sms);
|
||||||
cur_frm.add_custom_button("Make Supplier Quotation", cur_frm.cscript.make_supplier_quotation);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(doc.docstatus == 1 && doc.status == 'Stopped')
|
if(doc.docstatus == 1 && doc.status == 'Stopped')
|
||||||
cur_frm.add_custom_button('Unstop Purchase Request', cur_frm.cscript['Unstop Purchase Request'])
|
cur_frm.add_custom_button('Unstop Purchase Request', cur_frm.cscript['Unstop Purchase Request'])
|
||||||
}
|
}
|
||||||
|
|
||||||
//======================= validation ===================================
|
|
||||||
cur_frm.cscript.validate = function(doc,cdt,cdn){
|
|
||||||
is_item_table(doc,cdt,cdn);
|
|
||||||
}
|
|
||||||
//======================= transaction date =============================
|
//======================= transaction date =============================
|
||||||
cur_frm.cscript.transaction_date = function(doc,cdt,cdn){
|
cur_frm.cscript.transaction_date = function(doc,cdt,cdn){
|
||||||
if(doc.__islocal){
|
if(doc.__islocal){
|
||||||
|
@ -178,6 +178,9 @@ class DocType:
|
|||||||
get_obj('Warehouse', d.warehouse).update_bin(args)
|
get_obj('Warehouse', d.warehouse).update_bin(args)
|
||||||
|
|
||||||
def on_submit(self):
|
def on_submit(self):
|
||||||
|
purchase_controller = webnotes.get_obj("Purchase Common")
|
||||||
|
purchase_controller.is_item_table_empty(self)
|
||||||
|
|
||||||
webnotes.conn.set(self.doc,'status','Submitted')
|
webnotes.conn.set(self.doc,'status','Submitted')
|
||||||
self.update_bin(is_submit = 1, is_stopped = 0)
|
self.update_bin(is_submit = 1, is_stopped = 0)
|
||||||
|
|
||||||
|
@ -36,6 +36,9 @@ class DocType(TransactionBase):
|
|||||||
self.doc.status = "Draft"
|
self.doc.status = "Draft"
|
||||||
|
|
||||||
def on_submit(self):
|
def on_submit(self):
|
||||||
|
purchase_controller = webnotes.get_obj("Purchase Common")
|
||||||
|
purchase_controller.is_item_table_empty(self)
|
||||||
|
|
||||||
webnotes.conn.set(self.doc, "status", "Submitted")
|
webnotes.conn.set(self.doc, "status", "Submitted")
|
||||||
|
|
||||||
def on_cancel(self):
|
def on_cancel(self):
|
||||||
|
6
patches/december_2012/remove_project_mapper.py
Normal file
6
patches/december_2012/remove_project_mapper.py
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
import webnotes
|
||||||
|
|
||||||
|
def execute():
|
||||||
|
from webnotes.model import delete_doc
|
||||||
|
for d in ["Project-Sales Order", "Project-Delivery Note", "Project-Sales Invoice"]:
|
||||||
|
delete_doc("DocType Mapper", d)
|
@ -566,4 +566,8 @@ patch_list = [
|
|||||||
'patch_file': 'delete_form16_print_format',
|
'patch_file': 'delete_form16_print_format',
|
||||||
>>>>>>> a85b2e4ee349c544acb7a1949351e9a7c70f7b7c
|
>>>>>>> a85b2e4ee349c544acb7a1949351e9a7c70f7b7c
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
'patch_module': 'patches.december_2012',
|
||||||
|
'patch_file': 'remove_project_mapper',
|
||||||
|
},
|
||||||
]
|
]
|
@ -1,49 +0,0 @@
|
|||||||
[
|
|
||||||
{
|
|
||||||
"owner": "ashwini@webnotestech.com",
|
|
||||||
"docstatus": 0,
|
|
||||||
"creation": "2010-09-01 15:47:59",
|
|
||||||
"modified_by": "Administrator",
|
|
||||||
"modified": "2011-09-15 15:04:43"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"match_id": 0,
|
|
||||||
"parent": "Project-Sales Order",
|
|
||||||
"name": "__common__",
|
|
||||||
"doctype": "Table Mapper Detail",
|
|
||||||
"parenttype": "DocType Mapper",
|
|
||||||
"from_table": "Project",
|
|
||||||
"to_table": "Sales Order",
|
|
||||||
"validation_logic": "name is not null",
|
|
||||||
"parentfield": "table_mapper_details"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"map": "Yes",
|
|
||||||
"match_id": 0,
|
|
||||||
"parent": "Project-Sales Order",
|
|
||||||
"name": "__common__",
|
|
||||||
"to_field": "customer",
|
|
||||||
"doctype": "Field Mapper Detail",
|
|
||||||
"parenttype": "DocType Mapper",
|
|
||||||
"checking_operator": "=",
|
|
||||||
"from_field": "customer",
|
|
||||||
"parentfield": "field_mapper_details"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "__common__",
|
|
||||||
"to_doctype": "Sales Order",
|
|
||||||
"module": "Selling",
|
|
||||||
"doctype": "DocType Mapper",
|
|
||||||
"from_doctype": "Project"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Project-Sales Order",
|
|
||||||
"doctype": "DocType Mapper"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"doctype": "Field Mapper Detail"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"doctype": "Table Mapper Detail"
|
|
||||||
}
|
|
||||||
]
|
|
@ -20,7 +20,8 @@ wn.doclistviews['Lead'] = wn.views.ListView.extend({
|
|||||||
data.label_type = 'info'
|
data.label_type = 'info'
|
||||||
}
|
}
|
||||||
data.status_html = repl('<span class="label label-%(label_type)s">%(status)s</span>', data);
|
data.status_html = repl('<span class="label label-%(label_type)s">%(status)s</span>', data);
|
||||||
data.lead_name = repl("<a href=\"#!Form/Lead/%(name)s\">%(name)s: %(lead_name)s</a>",
|
data.lead_name = repl("<a href=\"#!Form/Lead/%(name)s\" \
|
||||||
|
title=\"%(name)s: %(lead_name)s\">%(name)s: %(lead_name)s</a>",
|
||||||
data);
|
data);
|
||||||
data.lead_status = (data.rating ? ('['+data.rating+'] ') : '') + '['+data.source+']';
|
data.lead_status = (data.rating ? ('['+data.rating+'] ') : '') + '['+data.source+']';
|
||||||
},
|
},
|
||||||
@ -28,10 +29,11 @@ wn.doclistviews['Lead'] = wn.views.ListView.extend({
|
|||||||
columns: [
|
columns: [
|
||||||
{width: '3%', content: 'check'},
|
{width: '3%', content: 'check'},
|
||||||
{width: '5%', content:'avatar_modified'},
|
{width: '5%', content:'avatar_modified'},
|
||||||
{width: '30%', content:'lead_name'},
|
{width: '30%', content:'lead_name', title: "Lead Name"},
|
||||||
{width: '12%', content:'status_html'},
|
{width: '12%', content:'status_html', title: "Status"},
|
||||||
{width: '15%', content:'lead_status+tags', css: {color:'#222'}},
|
{width: '25%', content: 'company_name', title: "Company"},
|
||||||
{width: '23%', content: 'company_name'},
|
{width: '13%', content:'lead_status+tags', css: {color:'#222'},
|
||||||
|
title: "More Info"},
|
||||||
{width: '12%', content:'modified', css: {'text-align': 'right', 'color':'#777'}}
|
{width: '12%', content:'modified', css: {'text-align': 'right', 'color':'#777'}}
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
@ -178,19 +178,11 @@ cur_frm.fields_dict['project_name'].get_query = function(doc, cdt, cdn) {
|
|||||||
var cond = '';
|
var cond = '';
|
||||||
if(doc.customer) cond = '(`tabProject`.customer = "'+doc.customer+'" OR IFNULL(`tabProject`.customer,"")="") AND';
|
if(doc.customer) cond = '(`tabProject`.customer = "'+doc.customer+'" OR IFNULL(`tabProject`.customer,"")="") AND';
|
||||||
return repl('SELECT `tabProject`.name FROM `tabProject` \
|
return repl('SELECT `tabProject`.name FROM `tabProject` \
|
||||||
WHERE `tabProject`.status not in ("Completed", "Cancelled") \
|
WHERE `tabProject`.status not in ("Completed", "Cancelled") \
|
||||||
AND %(cond)s `tabProject`.name LIKE "%s" ORDER BY `tabProject`.name ASC LIMIT 50', {cond:cond});
|
AND %(cond)s `tabProject`.name LIKE "%s" \
|
||||||
|
ORDER BY `tabProject`.name ASC LIMIT 50', {cond:cond});
|
||||||
}
|
}
|
||||||
|
|
||||||
//---- get customer details ----------------------------
|
|
||||||
cur_frm.cscript.project_name = function(doc,cdt,cdn){
|
|
||||||
$c_obj(make_doclist(doc.doctype, doc.name),'pull_project_customer','', function(r,rt){
|
|
||||||
refresh_many(['customer','customer_name', 'customer_address', 'contact_person', 'territory', 'contact_no', 'email_id', 'customer_group']);
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// *************** Customized link query for QUOTATION *****************************
|
// *************** Customized link query for QUOTATION *****************************
|
||||||
cur_frm.fields_dict['quotation_no'].get_query = function(doc) {
|
cur_frm.fields_dict['quotation_no'].get_query = function(doc) {
|
||||||
|
@ -39,10 +39,6 @@ class DocType(TransactionBase):
|
|||||||
self.partner_tname = 'Partner Target Detail'
|
self.partner_tname = 'Partner Target Detail'
|
||||||
self.territory_tname = 'Territory Target Detail'
|
self.territory_tname = 'Territory Target Detail'
|
||||||
|
|
||||||
# DOCTYPE TRIGGER FUNCTIONS
|
|
||||||
# =============================
|
|
||||||
# Pull Quotation Items
|
|
||||||
# -----------------------
|
|
||||||
def pull_quotation_details(self):
|
def pull_quotation_details(self):
|
||||||
self.doclist = self.doc.clear_table(self.doclist, 'other_charges')
|
self.doclist = self.doc.clear_table(self.doclist, 'other_charges')
|
||||||
self.doclist = self.doc.clear_table(self.doclist, 'sales_order_details')
|
self.doclist = self.doc.clear_table(self.doclist, 'sales_order_details')
|
||||||
@ -55,29 +51,12 @@ class DocType(TransactionBase):
|
|||||||
|
|
||||||
return cstr(self.doc.quotation_no)
|
return cstr(self.doc.quotation_no)
|
||||||
|
|
||||||
#pull project customer
|
|
||||||
#-------------------------
|
|
||||||
def pull_project_customer(self):
|
|
||||||
res = sql("select customer from `tabProject` where name = '%s'"%self.doc.project_name)
|
|
||||||
if res and res[0][0]:
|
|
||||||
get_obj('DocType Mapper', 'Project-Sales Order').dt_map('Project', 'Sales Order', self.doc.project_name, self.doc, self.doclist, "[['Project', 'Sales Order']]")
|
|
||||||
|
|
||||||
|
|
||||||
# Get contact person details based on customer selected
|
|
||||||
# ------------------------------------------------------
|
|
||||||
def get_contact_details(self):
|
def get_contact_details(self):
|
||||||
get_obj('Sales Common').get_contact_details(self,0)
|
get_obj('Sales Common').get_contact_details(self,0)
|
||||||
|
|
||||||
# Get Commission rate of Sales Partner
|
|
||||||
# -------------------------------------
|
|
||||||
def get_comm_rate(self, sales_partner):
|
def get_comm_rate(self, sales_partner):
|
||||||
return get_obj('Sales Common').get_comm_rate(sales_partner, self)
|
return get_obj('Sales Common').get_comm_rate(sales_partner, self)
|
||||||
|
|
||||||
|
|
||||||
# SALES ORDER DETAILS TRIGGER FUNCTIONS
|
|
||||||
# ================================================================================
|
|
||||||
# Get Item Details
|
|
||||||
# ----------------
|
|
||||||
def get_item_details(self, args=None):
|
def get_item_details(self, args=None):
|
||||||
import json
|
import json
|
||||||
args = args and json.loads(args) or {}
|
args = args and json.loads(args) or {}
|
||||||
@ -94,45 +73,24 @@ class DocType(TransactionBase):
|
|||||||
if not doc.fields.get(r):
|
if not doc.fields.get(r):
|
||||||
doc.fields[r] = ret[r]
|
doc.fields[r] = ret[r]
|
||||||
|
|
||||||
|
|
||||||
# Re-calculates Basic Rate & amount based on Price List Selected
|
|
||||||
# --------------------------------------------------------------
|
|
||||||
def get_adj_percent(self, arg=''):
|
def get_adj_percent(self, arg=''):
|
||||||
get_obj('Sales Common').get_adj_percent(self)
|
get_obj('Sales Common').get_adj_percent(self)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Get projected qty of item based on warehouse selected
|
|
||||||
# -----------------------------------------------------
|
|
||||||
def get_available_qty(self,args):
|
def get_available_qty(self,args):
|
||||||
return get_obj('Sales Common').get_available_qty(eval(args))
|
return get_obj('Sales Common').get_available_qty(eval(args))
|
||||||
|
|
||||||
# OTHER CHARGES TRIGGER FUNCTIONS
|
|
||||||
# ====================================================================================
|
|
||||||
|
|
||||||
# Get Tax rate if account type is TAX
|
|
||||||
# ------------------------------------
|
|
||||||
def get_rate(self,arg):
|
def get_rate(self,arg):
|
||||||
return get_obj('Sales Common').get_rate(arg)
|
return get_obj('Sales Common').get_rate(arg)
|
||||||
|
|
||||||
# Load Default Charges
|
|
||||||
# ----------------------------------------------------------
|
|
||||||
def load_default_taxes(self):
|
def load_default_taxes(self):
|
||||||
self.doclist = get_obj('Sales Common').load_default_taxes(self)
|
self.doclist = get_obj('Sales Common').load_default_taxes(self)
|
||||||
|
|
||||||
# Pull details from other charges master (Get Sales Taxes and Charges Master)
|
|
||||||
# ----------------------------------------------------------
|
|
||||||
def get_other_charges(self):
|
def get_other_charges(self):
|
||||||
self.doclist = get_obj('Sales Common').get_other_charges(self)
|
self.doclist = get_obj('Sales Common').get_other_charges(self)
|
||||||
|
|
||||||
|
|
||||||
# GET TERMS & CONDITIONS
|
|
||||||
# =====================================================================================
|
|
||||||
def get_tc_details(self):
|
def get_tc_details(self):
|
||||||
return get_obj('Sales Common').get_tc_details(self)
|
return get_obj('Sales Common').get_tc_details(self)
|
||||||
|
|
||||||
#check if maintenance schedule already generated
|
|
||||||
#============================================
|
|
||||||
def check_maintenance_schedule(self):
|
def check_maintenance_schedule(self):
|
||||||
nm = sql("select t1.name from `tabMaintenance Schedule` t1, `tabMaintenance Schedule Item` t2 where t2.parent=t1.name and t2.prevdoc_docname=%s and t1.docstatus=1", self.doc.name)
|
nm = sql("select t1.name from `tabMaintenance Schedule` t1, `tabMaintenance Schedule Item` t2 where t2.parent=t1.name and t2.prevdoc_docname=%s and t1.docstatus=1", self.doc.name)
|
||||||
nm = nm and nm[0][0] or ''
|
nm = nm and nm[0][0] or ''
|
||||||
@ -140,8 +98,6 @@ class DocType(TransactionBase):
|
|||||||
if not nm:
|
if not nm:
|
||||||
return 'No'
|
return 'No'
|
||||||
|
|
||||||
#check if maintenance visit already generated
|
|
||||||
#============================================
|
|
||||||
def check_maintenance_visit(self):
|
def check_maintenance_visit(self):
|
||||||
nm = sql("select t1.name from `tabMaintenance Visit` t1, `tabMaintenance Visit Purpose` t2 where t2.parent=t1.name and t2.prevdoc_docname=%s and t1.docstatus=1 and t1.completion_status='Fully Completed'", self.doc.name)
|
nm = sql("select t1.name from `tabMaintenance Visit` t1, `tabMaintenance Visit Purpose` t2 where t2.parent=t1.name and t2.prevdoc_docname=%s and t1.docstatus=1 and t1.completion_status='Fully Completed'", self.doc.name)
|
||||||
nm = nm and nm[0][0] or ''
|
nm = nm and nm[0][0] or ''
|
||||||
@ -149,20 +105,12 @@ class DocType(TransactionBase):
|
|||||||
if not nm:
|
if not nm:
|
||||||
return 'No'
|
return 'No'
|
||||||
|
|
||||||
# VALIDATE
|
|
||||||
# =====================================================================================
|
|
||||||
# Fiscal Year Validation
|
|
||||||
# ----------------------
|
|
||||||
def validate_fiscal_year(self):
|
def validate_fiscal_year(self):
|
||||||
get_obj('Sales Common').validate_fiscal_year(self.doc.fiscal_year,self.doc.transaction_date,'Sales Order Date')
|
get_obj('Sales Common').validate_fiscal_year(self.doc.fiscal_year,self.doc.transaction_date,'Sales Order Date')
|
||||||
|
|
||||||
# Validate values with reference document
|
|
||||||
#----------------------------------------
|
|
||||||
def validate_reference_value(self):
|
def validate_reference_value(self):
|
||||||
get_obj('DocType Mapper', 'Quotation-Sales Order', with_children = 1).validate_reference_value(self, self.doc.name)
|
get_obj('DocType Mapper', 'Quotation-Sales Order', with_children = 1).validate_reference_value(self, self.doc.name)
|
||||||
|
|
||||||
# Validate Mandatory
|
|
||||||
# -------------------
|
|
||||||
def validate_mandatory(self):
|
def validate_mandatory(self):
|
||||||
# validate transaction date v/s delivery date
|
# validate transaction date v/s delivery date
|
||||||
if self.doc.delivery_date:
|
if self.doc.delivery_date:
|
||||||
@ -174,9 +122,6 @@ class DocType(TransactionBase):
|
|||||||
msgprint("Please Enter Amendment Date")
|
msgprint("Please Enter Amendment Date")
|
||||||
raise Exception
|
raise Exception
|
||||||
|
|
||||||
|
|
||||||
# Validate P.O Date
|
|
||||||
# ------------------
|
|
||||||
def validate_po(self):
|
def validate_po(self):
|
||||||
# validate p.o date v/s delivery date
|
# validate p.o date v/s delivery date
|
||||||
if self.doc.po_date and self.doc.delivery_date and getdate(self.doc.po_date) > getdate(self.doc.delivery_date):
|
if self.doc.po_date and self.doc.delivery_date and getdate(self.doc.po_date) > getdate(self.doc.delivery_date):
|
||||||
@ -191,8 +136,6 @@ class DocType(TransactionBase):
|
|||||||
msgprint("""Another Sales Order (%s) exists against same PO No and Customer.
|
msgprint("""Another Sales Order (%s) exists against same PO No and Customer.
|
||||||
Please be sure, you are not making duplicate entry.""" % so[0][0])
|
Please be sure, you are not making duplicate entry.""" % so[0][0])
|
||||||
|
|
||||||
# Validations of Details Table
|
|
||||||
# -----------------------------
|
|
||||||
def validate_for_items(self):
|
def validate_for_items(self):
|
||||||
check_list, flag = [], 0
|
check_list, flag = [], 0
|
||||||
chk_dupl_itm = []
|
chk_dupl_itm = []
|
||||||
@ -237,8 +180,6 @@ class DocType(TransactionBase):
|
|||||||
if getlist(self.doclist, 'sales_order_details') and self.doc.quotation_no and flag == 0:
|
if getlist(self.doclist, 'sales_order_details') and self.doc.quotation_no and flag == 0:
|
||||||
msgprint("There are no items of the quotation selected", raise_exception=1)
|
msgprint("There are no items of the quotation selected", raise_exception=1)
|
||||||
|
|
||||||
# validate sales/ maintenance quotation against order type
|
|
||||||
#------------------------------------------------------------------
|
|
||||||
def validate_sales_mntc_quotation(self):
|
def validate_sales_mntc_quotation(self):
|
||||||
for d in getlist(self.doclist, 'sales_order_details'):
|
for d in getlist(self.doclist, 'sales_order_details'):
|
||||||
if d.prevdoc_docname:
|
if d.prevdoc_docname:
|
||||||
@ -255,18 +196,13 @@ class DocType(TransactionBase):
|
|||||||
|
|
||||||
self.validate_sales_mntc_quotation()
|
self.validate_sales_mntc_quotation()
|
||||||
|
|
||||||
#check for does customer belong to same project as entered..
|
|
||||||
#-------------------------------------------------------------------------------------------------
|
|
||||||
def validate_proj_cust(self):
|
def validate_proj_cust(self):
|
||||||
if self.doc.project_name and self.doc.customer_name:
|
if self.doc.project_name and self.doc.customer_name:
|
||||||
res = sql("select name from `tabProject` where name = '%s' and (customer = '%s' or ifnull(customer,'')='')"%(self.doc.project_name, self.doc.customer))
|
res = sql("select name from `tabProject` where name = '%s' and (customer = '%s' or ifnull(customer,'')='')"%(self.doc.project_name, self.doc.customer))
|
||||||
if not res:
|
if not res:
|
||||||
msgprint("Customer - %s does not belong to project - %s. \n\nIf you want to use project for multiple customers then please make customer details blank in project - %s."%(self.doc.customer,self.doc.project_name,self.doc.project_name))
|
msgprint("Customer - %s does not belong to project - %s. \n\nIf you want to use project for multiple customers then please make customer details blank in project - %s."%(self.doc.customer,self.doc.project_name,self.doc.project_name))
|
||||||
raise Exception
|
raise Exception
|
||||||
|
|
||||||
|
|
||||||
# Validate
|
|
||||||
# ---------
|
|
||||||
def validate(self):
|
def validate(self):
|
||||||
self.validate_fiscal_year()
|
self.validate_fiscal_year()
|
||||||
self.validate_order_type()
|
self.validate_order_type()
|
||||||
@ -295,11 +231,6 @@ class DocType(TransactionBase):
|
|||||||
if not self.doc.billing_status: self.doc.billing_status = 'Not Billed'
|
if not self.doc.billing_status: self.doc.billing_status = 'Not Billed'
|
||||||
if not self.doc.delivery_status: self.doc.delivery_status = 'Not Delivered'
|
if not self.doc.delivery_status: self.doc.delivery_status = 'Not Delivered'
|
||||||
|
|
||||||
|
|
||||||
# ON SUBMIT
|
|
||||||
# ===============================================================================================
|
|
||||||
# Checks Quotation Status
|
|
||||||
# ------------------------
|
|
||||||
def check_prev_docstatus(self):
|
def check_prev_docstatus(self):
|
||||||
for d in getlist(self.doclist, 'sales_order_details'):
|
for d in getlist(self.doclist, 'sales_order_details'):
|
||||||
cancel_quo = sql("select name from `tabQuotation` where docstatus = 2 and name = '%s'" % d.prevdoc_docname)
|
cancel_quo = sql("select name from `tabQuotation` where docstatus = 2 and name = '%s'" % d.prevdoc_docname)
|
||||||
@ -312,8 +243,6 @@ class DocType(TransactionBase):
|
|||||||
if enq:
|
if enq:
|
||||||
sql("update `tabOpportunity` set status = %s where name=%s",(flag,enq[0][0]))
|
sql("update `tabOpportunity` set status = %s where name=%s",(flag,enq[0][0]))
|
||||||
|
|
||||||
#update status of quotation, enquiry
|
|
||||||
#----------------------------------------
|
|
||||||
def update_prevdoc_status(self, flag):
|
def update_prevdoc_status(self, flag):
|
||||||
for d in getlist(self.doclist, 'sales_order_details'):
|
for d in getlist(self.doclist, 'sales_order_details'):
|
||||||
if d.prevdoc_docname:
|
if d.prevdoc_docname:
|
||||||
@ -354,8 +283,6 @@ class DocType(TransactionBase):
|
|||||||
|
|
||||||
webnotes.conn.set(self.doc, 'status', 'Cancelled')
|
webnotes.conn.set(self.doc, 'status', 'Cancelled')
|
||||||
|
|
||||||
# does not allow to cancel document if DN or RV made against it is SUBMITTED
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
def check_nextdoc_docstatus(self):
|
def check_nextdoc_docstatus(self):
|
||||||
# Checks Delivery Note
|
# Checks Delivery Note
|
||||||
submit_dn = sql("select t1.name from `tabDelivery Note` t1,`tabDelivery Note Item` t2 where t1.name = t2.parent and t2.prevdoc_docname = '%s' and t1.docstatus = 1" % (self.doc.name))
|
submit_dn = sql("select t1.name from `tabDelivery Note` t1,`tabDelivery Note Item` t2 where t1.name = t2.parent and t2.prevdoc_docname = '%s' and t1.docstatus = 1" % (self.doc.name))
|
||||||
|
@ -1,49 +0,0 @@
|
|||||||
[
|
|
||||||
{
|
|
||||||
"owner": "harshada@webnotestech.com",
|
|
||||||
"docstatus": 0,
|
|
||||||
"creation": "2010-09-01 15:47:59",
|
|
||||||
"modified_by": "Administrator",
|
|
||||||
"modified": "2011-09-15 15:04:43"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"match_id": 0,
|
|
||||||
"parent": "Project-Delivery Note",
|
|
||||||
"name": "__common__",
|
|
||||||
"doctype": "Table Mapper Detail",
|
|
||||||
"parenttype": "DocType Mapper",
|
|
||||||
"from_table": "Project",
|
|
||||||
"to_table": "Delivery Note",
|
|
||||||
"validation_logic": "name is not null",
|
|
||||||
"parentfield": "table_mapper_details"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"map": "Yes",
|
|
||||||
"match_id": 0,
|
|
||||||
"parent": "Project-Delivery Note",
|
|
||||||
"name": "__common__",
|
|
||||||
"to_field": "customer",
|
|
||||||
"doctype": "Field Mapper Detail",
|
|
||||||
"parenttype": "DocType Mapper",
|
|
||||||
"checking_operator": "=",
|
|
||||||
"from_field": "customer",
|
|
||||||
"parentfield": "field_mapper_details"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "__common__",
|
|
||||||
"to_doctype": "Delivery Note",
|
|
||||||
"module": "Stock",
|
|
||||||
"doctype": "DocType Mapper",
|
|
||||||
"from_doctype": "Project"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Project-Delivery Note",
|
|
||||||
"doctype": "DocType Mapper"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"doctype": "Field Mapper Detail"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"doctype": "Table Mapper Detail"
|
|
||||||
}
|
|
||||||
]
|
|
@ -78,13 +78,6 @@ class DocType(TransactionBase):
|
|||||||
def get_tc_details(self):
|
def get_tc_details(self):
|
||||||
return get_obj('Sales Common').get_tc_details(self)
|
return get_obj('Sales Common').get_tc_details(self)
|
||||||
|
|
||||||
|
|
||||||
def pull_project_customer(self):
|
|
||||||
res = sql("select customer from `tabProject` where name = '%s'" % self.doc.project_name)
|
|
||||||
if res and res[0][0]:
|
|
||||||
get_obj('DocType Mapper', 'Project-Delivery Note').dt_map('Project', 'Delivery Note', self.doc.project_name, self.doc, self.doclist, "[['Project', 'Delivery Note']]")
|
|
||||||
|
|
||||||
|
|
||||||
def get_item_details(self, args=None):
|
def get_item_details(self, args=None):
|
||||||
import json
|
import json
|
||||||
args = args and json.loads(args) or {}
|
args = args and json.loads(args) or {}
|
||||||
|
@ -284,15 +284,17 @@ class DocType(TransactionBase):
|
|||||||
|
|
||||||
# on submit
|
# on submit
|
||||||
def on_submit(self):
|
def on_submit(self):
|
||||||
|
purchase_controller = webnotes.get_obj("Purchase Common")
|
||||||
|
purchase_controller.is_item_table_empty(self)
|
||||||
|
|
||||||
# Check for Approving Authority
|
# Check for Approving Authority
|
||||||
get_obj('Authorization Control').validate_approving_authority(self.doc.doctype, self.doc.company, self.doc.grand_total)
|
get_obj('Authorization Control').validate_approving_authority(self.doc.doctype, self.doc.company, self.doc.grand_total)
|
||||||
|
|
||||||
# Set status as Submitted
|
# Set status as Submitted
|
||||||
webnotes.conn.set(self.doc,'status', 'Submitted')
|
webnotes.conn.set(self.doc,'status', 'Submitted')
|
||||||
pc_obj = get_obj('Purchase Common')
|
|
||||||
|
|
||||||
# Update Previous Doc i.e. update pending_qty and Status accordingly
|
# Update Previous Doc i.e. update pending_qty and Status accordingly
|
||||||
pc_obj.update_prevdoc_detail(self, is_submit = 1)
|
purchase_controller.update_prevdoc_detail(self, is_submit = 1)
|
||||||
|
|
||||||
# Update Serial Record
|
# Update Serial Record
|
||||||
get_obj('Stock Ledger').update_serial_record(self, 'purchase_receipt_details', is_submit = 1, is_incoming = 1)
|
get_obj('Stock Ledger').update_serial_record(self, 'purchase_receipt_details', is_submit = 1, is_incoming = 1)
|
||||||
@ -301,7 +303,7 @@ class DocType(TransactionBase):
|
|||||||
self.update_stock(is_submit = 1)
|
self.update_stock(is_submit = 1)
|
||||||
|
|
||||||
# Update last purchase rate
|
# Update last purchase rate
|
||||||
pc_obj.update_last_purchase_rate(self, 1)
|
purchase_controller.update_last_purchase_rate(self, 1)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user