Implemented the Auto JV posting upon Loan Installment posting
This commit is contained in:
parent
37fec6e219
commit
5e1d504483
@ -5,23 +5,14 @@
|
||||
{
|
||||
'creation': '2010-08-08 17:09:06',
|
||||
'docstatus': 0,
|
||||
'modified': '2011-04-06 14:41:47',
|
||||
'modified': '2011-07-15 14:37:05',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'name': '__common__',
|
||||
'parent': 'Journal Voucher',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'_last_update': '1305714002',
|
||||
'_last_update': '1310533805',
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'module': 'Accounts',
|
||||
@ -32,15 +23,15 @@
|
||||
'show_in_menu': 0,
|
||||
'subject': ' ',
|
||||
'tag_fields': 'voucher_type',
|
||||
'version': 307
|
||||
'version': 308
|
||||
},
|
||||
|
||||
# These values are common for all DocFormat
|
||||
# These values are common for all DocField
|
||||
{
|
||||
'doctype': 'DocFormat',
|
||||
'doctype': 'DocField',
|
||||
'name': '__common__',
|
||||
'parent': 'Journal Voucher',
|
||||
'parentfield': 'formats',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType'
|
||||
},
|
||||
|
||||
@ -112,20 +103,6 @@
|
||||
'write': 0
|
||||
},
|
||||
|
||||
# DocFormat
|
||||
{
|
||||
'doctype': 'DocFormat',
|
||||
'format': 'Payment Receipt Voucher',
|
||||
'idx': 1
|
||||
},
|
||||
|
||||
# DocFormat
|
||||
{
|
||||
'doctype': 'DocFormat',
|
||||
'format': 'Cheque Printing Format',
|
||||
'idx': 2
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
@ -167,7 +144,7 @@
|
||||
'label': 'Voucher Type',
|
||||
'oldfieldname': 'voucher_type',
|
||||
'oldfieldtype': 'Select',
|
||||
'options': '\nJournal Entry\nBank Voucher\nCash Voucher\nCredit Card Voucher\nDebit Note\nCredit Note\nContra Voucher\nExcise Voucher\nWrite Off Voucher',
|
||||
'options': '\nJournal Entry\nBank Voucher\nCash Voucher\nCredit Card Voucher\nDebit Note\nCredit Note\nContra Voucher\nExcise Voucher\nWrite Off Voucher\nLoan Receipt',
|
||||
'permlevel': 0,
|
||||
'print_hide': 0,
|
||||
'search_index': 1
|
||||
|
@ -13,9 +13,10 @@ $.extend(cur_frm.cscript, {
|
||||
},
|
||||
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) {
|
||||
@ -30,17 +31,19 @@ $.extend(cur_frm.cscript, {
|
||||
width: 500,
|
||||
title: 'Add a new payment installment',
|
||||
fields: [
|
||||
{fieldtype:'Data', label:'Check Number', fieldname:'check_number', reqd:1},
|
||||
{fieldtype:'Date', label:'Check Date', fieldname:'check_date', reqd:1},
|
||||
{fieldtype:'Data', label:'Cheque Number', fieldname:'cheque_number', reqd:1},
|
||||
{fieldtype:'Date', label:'Cheque Date', fieldname:'cheque_date', reqd:1},
|
||||
{fieldtype:'Link', label:'Bank Account', fieldname:'bank_account', reqd:1, options:'Account'},
|
||||
{fieldtype:'Button', label:'Update',fieldname:'update'}
|
||||
]
|
||||
})
|
||||
d.show();
|
||||
d.fields_dict.update.input.onclick = function() {
|
||||
var data = d.get_values();
|
||||
|
||||
if(data) {
|
||||
$c_obj()
|
||||
$c_obj(make_doclist(dt,dn),'loan_post',data,function(){cur_frm.refresh(); d.hide();});
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
|
@ -1,5 +1,9 @@
|
||||
import webnotes
|
||||
from webnotes.model.doc import make_autoname, Document
|
||||
from webnotes.model.doc import make_autoname, Document, addchild
|
||||
from webnotes import msgprint
|
||||
from webnotes.utils import get_defaults
|
||||
import json
|
||||
sql = webnotes.conn.sql
|
||||
|
||||
class DocType:
|
||||
def __init__(self, doc, doclist):
|
||||
@ -10,4 +14,38 @@ class DocType:
|
||||
Create Loan Id using naming_series pattern
|
||||
"""
|
||||
self.doc.name = make_autoname(self.doc.naming_series+ '.#####')
|
||||
|
||||
def loan_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()
|
||||
|
||||
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]))
|
||||
|
||||
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 10:35:26',
|
||||
'modified': '2011-07-15 15:51:10',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'_last_update': '1310622631',
|
||||
'_last_update': '1310706327',
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'module': 'Accounts',
|
||||
'name': '__common__',
|
||||
'section_style': 'Simple',
|
||||
'show_in_menu': 0,
|
||||
'version': 11
|
||||
'version': 12
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
@ -34,19 +34,13 @@
|
||||
|
||||
# These values are common for all DocPerm
|
||||
{
|
||||
'cancel': 1,
|
||||
'create': 1,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 1,
|
||||
'name': '__common__',
|
||||
'parent': 'Loan',
|
||||
'parentfield': 'permissions',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0,
|
||||
'read': 1,
|
||||
'role': 'Accounts User',
|
||||
'submit': 1,
|
||||
'write': 1
|
||||
'role': 'Accounts User'
|
||||
},
|
||||
|
||||
# DocType, Loan
|
||||
@ -57,7 +51,20 @@
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm'
|
||||
'cancel': 1,
|
||||
'create': 1,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 1,
|
||||
'permlevel': 0,
|
||||
'submit': 1,
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 2,
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
|
@ -5,7 +5,7 @@
|
||||
{
|
||||
'creation': '2011-07-15 10:36:42',
|
||||
'docstatus': 0,
|
||||
'modified': '2011-07-15 10:36:42',
|
||||
'modified': '2011-07-15 15:48:34',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
@ -19,7 +19,7 @@
|
||||
'name': '__common__',
|
||||
'section_style': 'Simple',
|
||||
'show_in_menu': 0,
|
||||
'version': 1
|
||||
'version': 4
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
@ -28,8 +28,7 @@
|
||||
'name': '__common__',
|
||||
'parent': 'Loan Installment',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0
|
||||
'parenttype': 'DocType'
|
||||
},
|
||||
|
||||
# DocType, Loan Installment
|
||||
@ -44,7 +43,8 @@
|
||||
'fieldname': 'amount',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 1,
|
||||
'label': 'Amount'
|
||||
'label': 'Amount',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
@ -53,25 +53,28 @@
|
||||
'fieldname': 'due_date',
|
||||
'fieldtype': 'Date',
|
||||
'idx': 2,
|
||||
'label': 'Due Date'
|
||||
'label': 'Due Date',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'check_number',
|
||||
'fieldtype': 'Int',
|
||||
'fieldname': 'cheque_number',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 3,
|
||||
'label': 'Check Number'
|
||||
'label': 'Cheque Number',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'check_date',
|
||||
'fieldname': 'cheque_date',
|
||||
'fieldtype': 'Date',
|
||||
'idx': 4,
|
||||
'label': 'Check Date'
|
||||
'label': 'Cheque Date',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
@ -80,7 +83,8 @@
|
||||
'fieldname': 'deposit_date',
|
||||
'fieldtype': 'Date',
|
||||
'idx': 5,
|
||||
'label': 'Deposit Date'
|
||||
'label': 'Deposit Date',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
@ -89,6 +93,19 @@
|
||||
'fieldname': 'realized_date',
|
||||
'fieldtype': 'Date',
|
||||
'idx': 6,
|
||||
'label': 'Realized Date'
|
||||
'label': 'Realized Date',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'jv_number',
|
||||
'fieldtype': 'Link',
|
||||
'hidden': 0,
|
||||
'idx': 7,
|
||||
'label': 'JV Number',
|
||||
'options': 'Journal Voucher',
|
||||
'permlevel': 1
|
||||
}
|
||||
]
|
Loading…
x
Reference in New Issue
Block a user