Merge branch 'develop' into membership-enhancements-2
This commit is contained in:
commit
f3e3f80102
@ -216,8 +216,13 @@ def get_earning_deduction_components(doctype, txt, searchfield, start, page_len,
|
|||||||
return frappe.db.sql("""
|
return frappe.db.sql("""
|
||||||
select t1.salary_component
|
select t1.salary_component
|
||||||
from `tabSalary Component` t1, `tabSalary Component Account` t2
|
from `tabSalary Component` t1, `tabSalary Component Account` t2
|
||||||
where t1.name = t2.parent
|
where (t1.name = t2.parent
|
||||||
and t1.type = %s
|
and t1.type = %(type)s
|
||||||
and t2.company = %s
|
and t2.company = %(company)s)
|
||||||
|
or (t1.type = %(type)s
|
||||||
|
and t1.statistical_component = 1)
|
||||||
order by salary_component
|
order by salary_component
|
||||||
""", (filters['type'], filters['company']) )
|
""",{
|
||||||
|
"type": filters['type'],
|
||||||
|
"company": filters['company']
|
||||||
|
})
|
||||||
|
|||||||
@ -161,9 +161,9 @@ def get_item_list(invoice):
|
|||||||
|
|
||||||
item.qty = abs(item.qty)
|
item.qty = abs(item.qty)
|
||||||
item.discount_amount = abs(item.discount_amount * item.qty)
|
item.discount_amount = abs(item.discount_amount * item.qty)
|
||||||
item.unit_rate = abs(item.base_amount / item.qty)
|
item.unit_rate = abs(item.base_net_amount / item.qty)
|
||||||
item.gross_amount = abs(item.base_amount)
|
item.gross_amount = abs(item.base_net_amount)
|
||||||
item.taxable_value = abs(item.base_amount)
|
item.taxable_value = abs(item.base_net_amount)
|
||||||
|
|
||||||
item.batch_expiry_date = frappe.db.get_value('Batch', d.batch_no, 'expiry_date') if d.batch_no else None
|
item.batch_expiry_date = frappe.db.get_value('Batch', d.batch_no, 'expiry_date') if d.batch_no else None
|
||||||
item.batch_expiry_date = format_date(item.batch_expiry_date, 'dd/mm/yyyy') if item.batch_expiry_date else None
|
item.batch_expiry_date = format_date(item.batch_expiry_date, 'dd/mm/yyyy') if item.batch_expiry_date else None
|
||||||
@ -198,7 +198,7 @@ def update_item_taxes(invoice, item):
|
|||||||
if t.account_head in gst_accounts_list:
|
if t.account_head in gst_accounts_list:
|
||||||
item_tax_rate = item_tax_detail[0]
|
item_tax_rate = item_tax_detail[0]
|
||||||
# item tax amount excluding discount amount
|
# item tax amount excluding discount amount
|
||||||
item_tax_amount = (item_tax_rate / 100) * item.base_amount
|
item_tax_amount = (item_tax_rate / 100) * item.base_net_amount
|
||||||
|
|
||||||
if t.account_head in gst_accounts.cess_account:
|
if t.account_head in gst_accounts.cess_account:
|
||||||
item_tax_amount_after_discount = item_tax_detail[1]
|
item_tax_amount_after_discount = item_tax_detail[1]
|
||||||
@ -217,7 +217,10 @@ def update_item_taxes(invoice, item):
|
|||||||
|
|
||||||
def get_invoice_value_details(invoice):
|
def get_invoice_value_details(invoice):
|
||||||
invoice_value_details = frappe._dict(dict())
|
invoice_value_details = frappe._dict(dict())
|
||||||
invoice_value_details.base_total = abs(invoice.base_total)
|
if invoice.apply_discount_on == 'Net Total' and invoice.discount_amount:
|
||||||
|
invoice_value_details.base_total = abs(invoice.base_total)
|
||||||
|
else:
|
||||||
|
invoice_value_details.base_total = abs(invoice.base_net_total)
|
||||||
invoice_value_details.invoice_discount_amt = invoice.base_discount_amount
|
invoice_value_details.invoice_discount_amt = invoice.base_discount_amount
|
||||||
invoice_value_details.round_off = invoice.base_rounding_adjustment
|
invoice_value_details.round_off = invoice.base_rounding_adjustment
|
||||||
invoice_value_details.base_grand_total = abs(invoice.base_rounded_total) or abs(invoice.base_grand_total)
|
invoice_value_details.base_grand_total = abs(invoice.base_rounded_total) or abs(invoice.base_grand_total)
|
||||||
@ -473,7 +476,7 @@ class GSPConnector():
|
|||||||
"data": json.dumps(data, indent=4) if isinstance(data, dict) else data,
|
"data": json.dumps(data, indent=4) if isinstance(data, dict) else data,
|
||||||
"response": json.dumps(res, indent=4) if res else None
|
"response": json.dumps(res, indent=4) if res else None
|
||||||
})
|
})
|
||||||
request_log.insert(ignore_permissions=True)
|
request_log.save(ignore_permissions=True)
|
||||||
frappe.db.commit()
|
frappe.db.commit()
|
||||||
|
|
||||||
def fetch_auth_token(self):
|
def fetch_auth_token(self):
|
||||||
@ -486,7 +489,8 @@ class GSPConnector():
|
|||||||
res = self.make_request('post', self.authenticate_url, headers)
|
res = self.make_request('post', self.authenticate_url, headers)
|
||||||
self.e_invoice_settings.auth_token = "{} {}".format(res.get('token_type'), res.get('access_token'))
|
self.e_invoice_settings.auth_token = "{} {}".format(res.get('token_type'), res.get('access_token'))
|
||||||
self.e_invoice_settings.token_expiry = add_to_date(None, seconds=res.get('expires_in'))
|
self.e_invoice_settings.token_expiry = add_to_date(None, seconds=res.get('expires_in'))
|
||||||
self.e_invoice_settings.save()
|
self.e_invoice_settings.save(ignore_permissions=True)
|
||||||
|
self.e_invoice_settings.reload()
|
||||||
|
|
||||||
except Exception:
|
except Exception:
|
||||||
self.log_error(res)
|
self.log_error(res)
|
||||||
@ -757,7 +761,7 @@ class GSPConnector():
|
|||||||
'label': _('IRN Generated')
|
'label': _('IRN Generated')
|
||||||
}
|
}
|
||||||
self.update_invoice()
|
self.update_invoice()
|
||||||
|
|
||||||
def attach_qrcode_image(self):
|
def attach_qrcode_image(self):
|
||||||
qrcode = self.invoice.signed_qr_code
|
qrcode = self.invoice.signed_qr_code
|
||||||
doctype = self.invoice.doctype
|
doctype = self.invoice.doctype
|
||||||
@ -768,7 +772,7 @@ class GSPConnector():
|
|||||||
'file_name': 'QRCode_{}.png'.format(docname.replace('/', '-')),
|
'file_name': 'QRCode_{}.png'.format(docname.replace('/', '-')),
|
||||||
'attached_to_doctype': doctype,
|
'attached_to_doctype': doctype,
|
||||||
'attached_to_name': docname,
|
'attached_to_name': docname,
|
||||||
'content': 'qrcode',
|
'content': str(base64.b64encode(os.urandom(64))),
|
||||||
'is_private': 1
|
'is_private': 1
|
||||||
})
|
})
|
||||||
_file.insert()
|
_file.insert()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user