loan file modification
This commit is contained in:
parent
5e1d504483
commit
62a7b3cd4a
@ -425,3 +425,4 @@ In Account := %s User := %s has Repaired Outstanding Amount For %s : %s and foll
|
||||
fy_obj = get_obj('Fiscal Year', fy[0])
|
||||
for a in set(ac_list):
|
||||
fy_obj.repost(a)
|
||||
|
||||
|
@ -8,15 +8,20 @@ $.extend(cur_frm.cscript, {
|
||||
}
|
||||
cur_frm.refresh();
|
||||
},
|
||||
/* submit:function(doc){
|
||||
data=doc.get_values();
|
||||
|
||||
data['']=
|
||||
$c_obj(make_doclist(dt,dn),'loan_post',data,function(){});
|
||||
},*/
|
||||
refresh: function(doc) {
|
||||
cur_frm.cscript.hide_show_buttons(doc);
|
||||
},
|
||||
hide_show_buttons: function(doc) {
|
||||
if(doc.docstatus==0) {
|
||||
hide_field('Installment Reciept');// show_field('Generate');
|
||||
hide_field('Installment Reciept'); show_field('Generate');
|
||||
} else if (doc.docstatus==1) {
|
||||
// show_field('Installment Reciept');
|
||||
hide_field('Generate');
|
||||
show_field('Installment Reciept');hide_field('Generate');
|
||||
}
|
||||
},
|
||||
clear_installments: function(doc) {
|
||||
@ -42,7 +47,7 @@ hide_field('Generate');
|
||||
var data = d.get_values();
|
||||
|
||||
if(data) {
|
||||
$c_obj(make_doclist(dt,dn),'loan_post',data,function(){cur_frm.refresh(); d.hide();});
|
||||
$c_obj(make_doclist(dt,dn),'loan_installment_post',data,function(){cur_frm.refresh(); d.hide();});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ from webnotes.model.doc import make_autoname, Document, addchild
|
||||
from webnotes import msgprint
|
||||
from webnotes.utils import get_defaults
|
||||
import json
|
||||
from accounts.utils import post_jv
|
||||
sql = webnotes.conn.sql
|
||||
|
||||
class DocType:
|
||||
@ -15,37 +16,33 @@ class DocType:
|
||||
"""
|
||||
self.doc.name = make_autoname(self.doc.naming_series+ '.#####')
|
||||
|
||||
def loan_post(self, args):
|
||||
def loan_post(self):
|
||||
data['voucher_type']='Loan Issue'
|
||||
data['naming_series']='JV'
|
||||
data['fiscal_year'] = get_defaults()['fiscal_year'] # To be modified to take care
|
||||
data['company'] = get_defaults()['company']
|
||||
data['debit_account'] = self.doc['receivable_account']
|
||||
data['credit_account'] = self.doc['account']
|
||||
data['amount'] = self.doc.loan_amount
|
||||
jv_name=post_jv(data)
|
||||
|
||||
def loan_installment_post(self, args):
|
||||
"""
|
||||
Posts the loan receipt into Journal Voucher
|
||||
"""
|
||||
data = json.loads(args)
|
||||
|
||||
jv = Document('Journal Voucher')
|
||||
jv.voucher_type = 'Loan Receipt'
|
||||
jv.naming_series = 'JV'
|
||||
jv.voucher_date = data.get('cheque_date')
|
||||
jv.posting_date = data.get('cheque_date')
|
||||
jv.cheque_no = data.get('cheque_number')
|
||||
jv.cheque_date = data.get('cheque_date')
|
||||
jv.fiscal_year = get_defaults()['fiscal_year'] # To be modified to take care
|
||||
jv.company = get_defaults()['company']
|
||||
|
||||
jv.save(1)
|
||||
|
||||
next_inst = sql("select amount,name from `tabLoan Installment` where parent=%s and ifnull(cheque_number,'')='' order by due_date limit 1",self.doc.name)
|
||||
|
||||
jc = addchild(jv,'entries','Journal Voucher Detail',0)
|
||||
jc.account = data.get('bank_account')
|
||||
jc.debit = next_inst[0][0]
|
||||
jc.save()
|
||||
data = json.loads(args)
|
||||
data['voucher_type']='Loan Receipt'
|
||||
data['naming_series']='JV'
|
||||
data['amount']=next_inst[0][0]
|
||||
data['debit_account']=data.get('bank_account')
|
||||
data['credit_account']=self.doc.account
|
||||
data['fiscal_year']=get_defaults()['fiscal_year']
|
||||
data['company']=get_defaults()['company']
|
||||
jv_name=post_jv(data)
|
||||
|
||||
jc = addchild(jv,'entries','Journal Voucher Detail',0)
|
||||
jc.account = self.doc.account
|
||||
jc.credit = next_inst[0][0]
|
||||
jc.save()
|
||||
|
||||
sql("update `tabLoan Installment` set cheque_number=%s, cheque_date=%s, jv_number=%s where name=%s",(data.get('cheque_number'),data.get('cheque_date'),jv.name,next_inst[0][1]))
|
||||
sql("update `tabLoan Installment` set cheque_number=%s, cheque_date=%s, jv_number=%s where name=%s",(data.get('cheque_number'),data.get('cheque_date'),jv_name,next_inst[0][1]))
|
||||
|
||||
self.doclist = [Document(d.doctype, d.name) for d in self.doclist]
|
||||
|
||||
|
@ -5,21 +5,21 @@
|
||||
{
|
||||
'creation': '2011-07-15 10:35:26',
|
||||
'docstatus': 0,
|
||||
'modified': '2011-07-15 15:51:10',
|
||||
'modified': '2011-07-18 12:12:19',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'_last_update': '1310706327',
|
||||
'_last_update': '1310963215',
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'module': 'Accounts',
|
||||
'name': '__common__',
|
||||
'section_style': 'Simple',
|
||||
'show_in_menu': 0,
|
||||
'version': 12
|
||||
'version': 15
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
@ -89,12 +89,33 @@
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'receivable_account',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 3,
|
||||
'label': 'Receivable Account',
|
||||
'options': 'Account'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'invoice',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 4,
|
||||
'label': 'Invoice',
|
||||
'options': 'Receivable Voucher',
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'loan_amount',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 3,
|
||||
'idx': 5,
|
||||
'label': 'Loan Amount',
|
||||
'reqd': 1
|
||||
},
|
||||
@ -104,7 +125,7 @@
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'start_date',
|
||||
'fieldtype': 'Date',
|
||||
'idx': 4,
|
||||
'idx': 6,
|
||||
'label': 'Start Date',
|
||||
'reqd': 1
|
||||
},
|
||||
@ -114,7 +135,7 @@
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'no_of_installments',
|
||||
'fieldtype': 'Int',
|
||||
'idx': 5,
|
||||
'idx': 7,
|
||||
'label': 'No of Installments',
|
||||
'reqd': 1
|
||||
},
|
||||
@ -124,7 +145,7 @@
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Button',
|
||||
'idx': 6,
|
||||
'idx': 8,
|
||||
'label': 'Generate',
|
||||
'trigger': 'Client'
|
||||
},
|
||||
@ -134,7 +155,7 @@
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'installments',
|
||||
'fieldtype': 'Table',
|
||||
'idx': 7,
|
||||
'idx': 9,
|
||||
'label': 'Installments',
|
||||
'options': 'Loan Installment'
|
||||
},
|
||||
@ -145,7 +166,7 @@
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Button',
|
||||
'idx': 8,
|
||||
'idx': 10,
|
||||
'label': 'Installment Reciept'
|
||||
}
|
||||
]
|
Loading…
x
Reference in New Issue
Block a user