fix wrong vouchers due to Valuation charges
This commit is contained in:
parent
c09de35ba5
commit
5e66ce121b
@ -481,7 +481,8 @@ class DocType(TransactionBase):
|
|||||||
pc_obj = get_obj(dt='Purchase Common')
|
pc_obj = get_obj(dt='Purchase Common')
|
||||||
|
|
||||||
# get total in words
|
# get total in words
|
||||||
self.doc.in_words = pc_obj.get_total_in_words('Rs', self.doc.grand_total)
|
dcc = TransactionBase().get_company_currency(self.doc.company)
|
||||||
|
self.doc.in_words = pc_obj.get_total_in_words(dcc, self.doc.grand_total)
|
||||||
self.doc.in_words_import = pc_obj.get_total_in_words(self.doc.currency, self.doc.grand_total_import)
|
self.doc.in_words_import = pc_obj.get_total_in_words(self.doc.currency, self.doc.grand_total_import)
|
||||||
# ***************************** SUBMIT *****************************
|
# ***************************** SUBMIT *****************************
|
||||||
# Check Ref Document docstatus
|
# Check Ref Document docstatus
|
||||||
|
@ -2,6 +2,7 @@ def execute():
|
|||||||
import webnotes
|
import webnotes
|
||||||
from webnotes.utils import flt
|
from webnotes.utils import flt
|
||||||
from webnotes.model.code import get_obj
|
from webnotes.model.code import get_obj
|
||||||
|
from webnotes.utils import money_in_words
|
||||||
|
|
||||||
vouchers = webnotes.conn.sql("""
|
vouchers = webnotes.conn.sql("""
|
||||||
select
|
select
|
||||||
@ -45,14 +46,6 @@ def execute():
|
|||||||
""" % (d['parenttype'], '%s', '%s', '%s', '%s'),
|
""" % (d['parenttype'], '%s', '%s', '%s', '%s'),
|
||||||
(correct_total_tax, d['tax_added'], d['tax_ded'], d['parent']))
|
(correct_total_tax, d['tax_added'], d['tax_ded'], d['parent']))
|
||||||
|
|
||||||
# post gl entry
|
|
||||||
if d['docstatus'] == 1:
|
|
||||||
webnotes.conn.sql("""update `tabGL Entry` set is_cancelled = 'No'
|
|
||||||
where voucher_type = %s and voucher_no = %s""",
|
|
||||||
(d['parenttype'], d['parent']))
|
|
||||||
obj = get_obj(d['parenttype'], d['parent'], with_children=1)
|
|
||||||
obj.make_gl_entries()
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
webnotes.conn.sql("""
|
webnotes.conn.sql("""
|
||||||
update `tab%s`
|
update `tab%s`
|
||||||
@ -63,3 +56,22 @@ def execute():
|
|||||||
where
|
where
|
||||||
name = %s
|
name = %s
|
||||||
""" % (d[1], '%s', '%s'), (correct_total_tax, d['parent']))
|
""" % (d[1], '%s', '%s'), (correct_total_tax, d['parent']))
|
||||||
|
|
||||||
|
# set in words
|
||||||
|
obj = get_obj(d['parenttype'], d['parent'], with_children=1)
|
||||||
|
|
||||||
|
base_currency = webnotes.conn.get_value('Company', obj.doc.company, 'default_currency')\
|
||||||
|
or get_defaults('default_currency')
|
||||||
|
|
||||||
|
webnotes.conn.set_value(d['parenttype'], d['parent'], \
|
||||||
|
'in_words', money_in_words(obj.doc.grand_total, base_currency))
|
||||||
|
webnotes.conn.set_value(d['parenttype'], d['parent'], \
|
||||||
|
'in_words_import', money_in_words(obj.doc.grand_total_import, obj.doc.currency))
|
||||||
|
|
||||||
|
# fix gl entries
|
||||||
|
if d['parenttype'] == 'Purchase Invoice' and d['docstatus'] == 1:
|
||||||
|
webnotes.conn.sql("""update `tabGL Entry` set is_cancelled = 'No'
|
||||||
|
where voucher_type = %s and voucher_no = %s""",
|
||||||
|
(d['parenttype'], d['parent']))
|
||||||
|
|
||||||
|
obj.make_gl_entries()
|
Loading…
x
Reference in New Issue
Block a user