[issues #437] [fix] pulling terms and conditions

This commit is contained in:
Anand Doshi 2013-06-05 14:11:32 +05:30
parent 8f81623240
commit bf3e54a45b
21 changed files with 37 additions and 71 deletions

View File

@ -247,7 +247,7 @@ class DocType(SellingController):
# fetch terms
if self.doc.tc_name and not self.doc.terms:
self.get_tc_details()
self.doc.terms = webnotes.conn.get_value("Terms and Conditions", self.doc.tc_name, "terms")
# fetch charges
if self.doc.charge and not len(self.doclist.get({"parentfield": "other_charges"})):
@ -339,11 +339,6 @@ class DocType(SellingController):
"""Get Commission rate of Sales Partner"""
return get_obj('Sales Common').get_comm_rate(sales_partner, self)
def get_tc_details(self):
return get_obj('Sales Common').get_tc_details(self)
def get_advances(self):
super(DocType, self).get_advances(self.doc.debit_to,
"Sales Invoice Advance", "advance_adjustment_details", "credit")

View File

@ -2,7 +2,7 @@
{
"creation": "2013-05-24 19:29:05",
"docstatus": 0,
"modified": "2013-05-29 18:53:26",
"modified": "2013-05-29 18:53:30",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -727,7 +727,6 @@
"fieldtype": "Button",
"label": "Get Terms and Conditions",
"oldfieldtype": "Button",
"options": "get_tc_details",
"print_hide": 1,
"read_only": 0
},

View File

@ -435,7 +435,7 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
$.each(field_label_map, function(fname, label) {
$wrapper.find('[data-grid-fieldname="'+fname+'"]').text(label);
});
}
},
});
// to save previous state of cur_frm.cscript

View File

@ -88,13 +88,6 @@ class DocType(BuyingController):
msgprint("Supplier : %s does not exists" % (name))
raise Exception
# Get TERMS AND CONDITIONS
# =======================================================================================
def get_tc_details(self,obj):
r = sql("select terms from `tabTerms and Conditions` where name = %s", obj.doc.tc_name)
if r: obj.doc.terms = r[0][0]
# Get Available Qty at Warehouse
def get_bin_details( self, arg = ''):
arg = eval(arg)

View File

@ -102,10 +102,6 @@ class DocType(BuyingController):
d.schedule_date = webnotes.conn.get_value("Material Request Item",
d.prevdoc_detail_docname, "schedule_date")
def get_tc_details(self):
"""get terms & conditions"""
return get_obj('Purchase Common').get_tc_details(self)
def get_last_purchase_rate(self):
get_obj('Purchase Common').get_last_purchase_rate(self)

View File

@ -2,7 +2,7 @@
{
"creation": "2013-05-21 16:16:39",
"docstatus": 0,
"modified": "2013-05-28 12:20:33",
"modified": "2013-05-28 12:20:40",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -538,8 +538,7 @@
"fieldname": "get_terms",
"fieldtype": "Button",
"label": "Get Terms and Conditions",
"oldfieldtype": "Button",
"options": "get_tc_details"
"oldfieldtype": "Button"
},
{
"doctype": "DocField",

View File

@ -2,7 +2,7 @@
{
"creation": "2013-05-21 16:16:45",
"docstatus": 0,
"modified": "2013-05-28 12:19:41",
"modified": "2013-05-28 12:19:50",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -504,8 +504,7 @@
"fieldname": "get_terms",
"fieldtype": "Button",
"label": "Get Terms and Conditions",
"oldfieldtype": "Button",
"options": "get_tc_details"
"oldfieldtype": "Button"
},
{
"doctype": "DocField",

View File

@ -50,7 +50,7 @@ class BuyingController(StockController):
self.set_missing_item_details(get_item_details)
def set_supplier_defaults(self):
self.get_default_supplier_address(self.doc.fields)
self.doc.fields.update(self.get_default_supplier_address(self.doc.fields))
def get_purchase_tax_details(self):
self.doclist = self.doc.clear_table(self.doclist, "purchase_tax_details")

View File

@ -507,4 +507,18 @@ erpnext.TransactionController = wn.ui.form.Controller.extend({
item[base_field] = flt(item[print_field] * this.frm.doc.conversion_rate,
precision(base_field, item));
},
get_terms: function() {
var me = this;
if(this.frm.doc.tc_name) {
this.frm.call({
method: "webnotes.client.get_value",
args: {
doctype: "Terms and Conditions",
fieldname: "terms",
filters: { name: this.frm.doc.tc_name },
},
});
}
},
});

View File

@ -95,12 +95,6 @@ class DocType(SellingController):
def get_rate(self,arg):
return get_obj('Sales Common').get_rate(arg)
# GET TERMS AND CONDITIONS
# ====================================================================================
def get_tc_details(self):
return get_obj('Sales Common').get_tc_details(self)
# VALIDATE
# ==============================================================================================

View File

@ -2,7 +2,7 @@
{
"creation": "2013-05-24 19:29:08",
"docstatus": 0,
"modified": "2013-05-28 14:50:59",
"modified": "2013-05-28 14:51:00",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -591,7 +591,6 @@
"fieldtype": "Button",
"label": "Get Terms and Conditions",
"oldfieldtype": "Button",
"options": "get_tc_details",
"read_only": 0
},
{

View File

@ -81,12 +81,6 @@ class DocType(TransactionBase):
acc_head = webnotes.conn.sql("select name from `tabAccount` where name = '%s' and docstatus != 2" % (cstr(obj.doc.customer) + " - " + webnotes.conn.get_value('Company', obj.doc.company, 'abbr')))
obj.doc.debit_to = acc_head and acc_head[0][0] or ''
# Get TERMS AND CONDITIONS
# =======================================================================================
def get_tc_details(self,obj):
r = webnotes.conn.sql("select terms from `tabTerms and Conditions` where name = %s", obj.doc.tc_name)
if r: obj.doc.terms = r[0][0]
#---------------------------------------- Get Tax Details -------------------------------#
def get_tax_details(self, item_code, obj):
import json

View File

@ -67,9 +67,6 @@ class DocType(SellingController):
def get_rate(self,arg):
return get_obj('Sales Common').get_rate(arg)
def get_tc_details(self):
return get_obj('Sales Common').get_tc_details(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 = nm and nm[0][0] or ''

View File

@ -2,7 +2,7 @@
{
"creation": "2013-05-24 19:29:08",
"docstatus": 0,
"modified": "2013-05-28 15:05:38",
"modified": "2013-05-28 15:05:40",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -579,7 +579,6 @@
"fieldtype": "Button",
"label": "Get Terms and Conditions",
"oldfieldtype": "Button",
"options": "get_tc_details",
"print_hide": 1
},
{

View File

@ -91,9 +91,6 @@ class DocType(SellingController):
d.actual_qty = actual_qty and flt(actual_qty[0][0]) or 0
def get_tc_details(self):
return get_obj('Sales Common').get_tc_details(self)
def get_barcode_details(self, barcode):
return get_obj('Sales Common').get_barcode_details(barcode)

View File

@ -2,7 +2,7 @@
{
"creation": "2013-05-24 19:29:09",
"docstatus": 0,
"modified": "2013-05-28 12:26:04",
"modified": "2013-05-28 12:26:10",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -602,7 +602,6 @@
"fieldtype": "Button",
"label": "Get Terms and Conditions",
"oldfieldtype": "Button",
"options": "get_tc_details",
"print_hide": 1,
"read_only": 0
},

View File

@ -64,11 +64,6 @@ class DocType(BuyingController):
def validate_fiscal_year(self):
get_obj(dt = 'Purchase Common').validate_fiscal_year(self.doc.fiscal_year,self.doc.transaction_date,'Material Request Date')
# GET TERMS & CONDITIONS
#-----------------------------
def get_tc_details(self):
return get_obj('Purchase Common').get_tc_details(self)
# Validate Schedule Date
#--------------------------------
def validate_schedule_date(self):

View File

@ -2,7 +2,7 @@
{
"creation": "2013-03-07 14:48:38",
"docstatus": 0,
"modified": "2013-04-24 10:47:50",
"modified": "2013-04-24 10:47:55",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -311,8 +311,7 @@
"fieldname": "get_terms",
"fieldtype": "Button",
"label": "Get Terms and Conditions",
"oldfieldtype": "Button",
"options": "get_tc_details"
"oldfieldtype": "Button"
},
{
"doctype": "DocField",

View File

@ -48,12 +48,6 @@ class DocType(BuyingController):
def validate_fiscal_year(self):
get_obj(dt = 'Purchase Common').validate_fiscal_year(self.doc.fiscal_year,self.doc.posting_date,'Transaction Date')
# GET TERMS & CONDITIONS
# =====================================================================================
def get_tc_details(self):
return get_obj('Purchase Common').get_tc_details(self)
# get available qty at warehouse
def get_bin_details(self, arg = ''):
return get_obj(dt='Purchase Common').get_bin_details(arg)

View File

@ -2,7 +2,7 @@
{
"creation": "2013-05-21 16:16:39",
"docstatus": 0,
"modified": "2013-05-28 12:21:17",
"modified": "2013-05-28 12:21:20",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -553,8 +553,7 @@
"fieldname": "get_terms",
"fieldtype": "Button",
"label": "Get Terms and Conditions",
"oldfieldtype": "Button",
"options": "get_tc_details"
"oldfieldtype": "Button"
},
{
"doctype": "DocField",

View File

@ -6,3 +6,8 @@ import webnotes
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
def on_update(self):
# make js and css
from website.helpers.make_web_include_files import make
make()