mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-06 06:58:27 +00:00
added voucher import tool
This commit is contained in:
@@ -15,30 +15,16 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from __future__ import unicode_literals
|
||||
from webnotes.model.doc import make_autoname, Document, addchild
|
||||
# Posts JV
|
||||
|
||||
def post_jv(data):
|
||||
jv = Document('Journal Voucher')
|
||||
jv.voucher_type = data.get('voucher_type')
|
||||
jv.naming_series = data.get('naming_series')
|
||||
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 = data.get('fiscal_year') # To be modified to take care
|
||||
jv.company = data.get('company')
|
||||
import webnotes
|
||||
|
||||
jv.save(1)
|
||||
|
||||
jc = addchild(jv,'entries','Journal Voucher Detail',0)
|
||||
jc.account = data.get('debit_account')
|
||||
jc.debit = data.get('amount')
|
||||
jc.save()
|
||||
|
||||
jc = addchild(jv,'entries','Journal Voucher Detail',0)
|
||||
jc.account = data.get('credit_account')
|
||||
jc.credit = data.get('amount')
|
||||
jc.save()
|
||||
|
||||
return jv.name
|
||||
def get_fiscal_year_from_date(date):
|
||||
from webnotes.utils import formatdate
|
||||
fy = webnotes.conn.sql("""select name from `tabFiscal Year`
|
||||
where %s between year_start_date and adddate(year_start_date,
|
||||
interval 1 year)""", date)
|
||||
|
||||
if not fy:
|
||||
webnotes.msgprint("""%s not in any Fiscal Year""" % formatdate(date), raise_exception=1)
|
||||
|
||||
return fy[0][0]
|
||||
Reference in New Issue
Block a user