fix in get other charges of sales_common.py
This commit is contained in:
parent
4792f51e2a
commit
2ad2426610
@ -207,21 +207,32 @@ class DocType(TransactionBase):
|
|||||||
if default: add_cond = 'ifnull(t2.is_default,0) = 1'
|
if default: add_cond = 'ifnull(t2.is_default,0) = 1'
|
||||||
else: add_cond = 't1.parent = "'+cstr(obj.doc.charge)+'"'
|
else: add_cond = 't1.parent = "'+cstr(obj.doc.charge)+'"'
|
||||||
idx = 0
|
idx = 0
|
||||||
other_charge = webnotes.conn.sql("select t1.charge_type,t1.row_id,t1.description,t1.account_head,t1.rate,t1.tax_amount,t1.included_in_print_rate, t1.cost_center_other_charges from `tabSales Taxes and Charges` t1, `tabSales Taxes and Charges Master` t2 where t1.parent = t2.name and t2.company = '%s' and %s order by t1.idx" % (obj.doc.company, add_cond), as_dict = 1)
|
other_charge = webnotes.conn.sql("""\
|
||||||
|
select t1.*
|
||||||
|
from
|
||||||
|
`tabSales Taxes and Charges` t1,
|
||||||
|
`tabSales Taxes and Charges Master` t2
|
||||||
|
where
|
||||||
|
t1.parent = t2.name and
|
||||||
|
t2.company = '%s' and
|
||||||
|
%s
|
||||||
|
order by t1.idx""" % (obj.doc.company, add_cond), as_dict=1)
|
||||||
|
from webnotes.model import default_fields
|
||||||
for other in other_charge:
|
for other in other_charge:
|
||||||
d = addchild(obj.doc, 'other_charges', 'Sales Taxes and Charges', 1, obj.doclist)
|
# remove default fields like parent, parenttype etc.
|
||||||
d.charge_type = other['charge_type']
|
# from query results
|
||||||
d.row_id = other['row_id']
|
for field in default_fields:
|
||||||
d.description = other['description']
|
if field in other: del other[field]
|
||||||
d.account_head = other['account_head']
|
|
||||||
d.cost_center_other_charges = other['cost_center_other_charges']
|
d = addchild(obj.doc, 'other_charges', 'Sales Taxes and Charges', 1,
|
||||||
d.rate = flt(other['rate'])
|
obj.doclist)
|
||||||
d.tax_amount = flt(other['tax_amount'])
|
d.fields.update(other)
|
||||||
d.included_in_print_rate = cint(other['included_in_print_rate'])
|
d.rate = flt(d.rate)
|
||||||
|
d.tax_amount = flt(d.tax_rate)
|
||||||
|
d.included_in_print_rate = cint(d.included_in_print_rate)
|
||||||
d.idx = idx
|
d.idx = idx
|
||||||
idx += 1
|
idx += 1
|
||||||
|
|
||||||
|
|
||||||
# Get TERMS AND CONDITIONS
|
# Get TERMS AND CONDITIONS
|
||||||
# =======================================================================================
|
# =======================================================================================
|
||||||
def get_tc_details(self,obj):
|
def get_tc_details(self,obj):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user