blob: 05d2391f2a58fbdddcf3278771c2af58109ddaa6 [file] [log] [blame]
Rushabh Mehta3966f1d2012-02-23 12:35:32 +05301# ERPNext - web based ERP (http://erpnext.com)
2# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
3#
4# This program is free software: you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by
6# the Free Software Foundation, either version 3 of the License, or
7# (at your option) any later version.
8#
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with this program. If not, see <http://www.gnu.org/licenses/>.
16
Anand Doshi486f9df2012-07-19 13:40:31 +053017from __future__ import unicode_literals
Brahma Kd7db2ea2011-07-26 19:04:13 +053018from webnotes.model.doc import make_autoname, Document, addchild
19# Posts JV
20
21def post_jv(data):
22 jv = Document('Journal Voucher')
23 jv.voucher_type = data.get('voucher_type')
24 jv.naming_series = data.get('naming_series')
25 jv.voucher_date = data.get('cheque_date')
26 jv.posting_date = data.get('cheque_date')
27 jv.cheque_no = data.get('cheque_number')
28 jv.cheque_date = data.get('cheque_date')
29 jv.fiscal_year = data.get('fiscal_year') # To be modified to take care
30 jv.company = data.get('company')
31
32 jv.save(1)
33
34 jc = addchild(jv,'entries','Journal Voucher Detail',0)
35 jc.account = data.get('debit_account')
36 jc.debit = data.get('amount')
37 jc.save()
38
39 jc = addchild(jv,'entries','Journal Voucher Detail',0)
40 jc.account = data.get('credit_account')
41 jc.credit = data.get('amount')
42 jc.save()
43
44 return jv.name