Get valuation rate from historical SLE even if it is zero (#13129)
* Don't overwrite start and end date comes from payroll entry * Get valuation rate from historical SLE even if it is zero, if records exists * Valid till should be autoset if not any default value * Set status of expense claim based on is_paid check
This commit is contained in:
parent
332a17ee86
commit
a645f36b2b
@ -45,10 +45,11 @@ class ExpenseClaim(AccountsController):
|
||||
}[cstr(self.docstatus or 0)]
|
||||
|
||||
paid_amount = flt(self.total_amount_reimbursed) + flt(self.total_advance_amount)
|
||||
if self.total_sanctioned_amount > 0 and self.total_sanctioned_amount == paid_amount\
|
||||
if (self.is_paid or (flt(self.total_sanctioned_amount) > 0
|
||||
and flt(self.total_sanctioned_amount) == paid_amount)) \
|
||||
and self.docstatus == 1 and self.approval_status == 'Approved':
|
||||
self.status = "Paid"
|
||||
elif self.total_sanctioned_amount > 0 and self.docstatus == 1 and self.approval_status == 'Approved':
|
||||
self.status = "Paid"
|
||||
elif flt(self.total_sanctioned_amount) > 0 and self.docstatus == 1 and self.approval_status == 'Approved':
|
||||
self.status = "Unpaid"
|
||||
elif self.docstatus == 1 and self.approval_status == 'Rejected':
|
||||
self.status = 'Rejected'
|
||||
|
@ -156,9 +156,10 @@ class SalarySlip(TransactionBase):
|
||||
})
|
||||
|
||||
def get_date_details(self):
|
||||
date_details = get_start_end_dates(self.payroll_frequency, self.start_date or self.posting_date)
|
||||
self.start_date = date_details.start_date
|
||||
self.end_date = date_details.end_date
|
||||
if not self.end_date:
|
||||
date_details = get_start_end_dates(self.payroll_frequency, self.start_date or self.posting_date)
|
||||
self.start_date = date_details.start_date
|
||||
self.end_date = date_details.end_date
|
||||
|
||||
def check_sal_struct(self, joining_date, relieving_date):
|
||||
cond = ''
|
||||
|
@ -41,7 +41,7 @@ erpnext.selling.QuotationController = erpnext.selling.SellingController.extend({
|
||||
|
||||
var me = this;
|
||||
|
||||
if (doc.__islocal) {
|
||||
if (doc.__islocal && !doc.valid_till) {
|
||||
this.frm.set_value('valid_till', frappe.datetime.add_months(doc.transaction_date, 1))
|
||||
}
|
||||
|
||||
|
@ -452,22 +452,22 @@ def get_valuation_rate(item_code, warehouse, voucher_type, voucher_no,
|
||||
where item_code = %s and valuation_rate > 0
|
||||
order by posting_date desc, posting_time desc, name desc limit 1""", item_code)
|
||||
|
||||
valuation_rate = flt(last_valuation_rate[0][0]) if last_valuation_rate else 0
|
||||
if last_valuation_rate:
|
||||
return flt(last_valuation_rate[0][0]) # as there is previous records, it might come with zero rate
|
||||
|
||||
# If negative stock allowed, and item delivered without any incoming entry,
|
||||
# system does not found any SLE, then take valuation rate from Item
|
||||
valuation_rate = frappe.db.get_value("Item", item_code, "valuation_rate")
|
||||
|
||||
if not valuation_rate:
|
||||
# If negative stock allowed, and item delivered without any incoming entry,
|
||||
# syste does not found any SLE, then take valuation rate from Item
|
||||
valuation_rate = frappe.db.get_value("Item", item_code, "valuation_rate")
|
||||
# try Item Standard rate
|
||||
valuation_rate = frappe.db.get_value("Item", item_code, "standard_rate")
|
||||
|
||||
if not valuation_rate:
|
||||
# try Item Standard rate
|
||||
valuation_rate = frappe.db.get_value("Item", item_code, "standard_rate")
|
||||
|
||||
if not valuation_rate:
|
||||
# try in price list
|
||||
valuation_rate = frappe.db.get_value('Item Price',
|
||||
dict(item_code=item_code, buying=1, currency=currency),
|
||||
'price_list_rate')
|
||||
# try in price list
|
||||
valuation_rate = frappe.db.get_value('Item Price',
|
||||
dict(item_code=item_code, buying=1, currency=currency),
|
||||
'price_list_rate')
|
||||
|
||||
if not allow_zero_rate and not valuation_rate \
|
||||
and cint(erpnext.is_perpetual_inventory_enabled(company)):
|
||||
|
Loading…
x
Reference in New Issue
Block a user