Merge pull request #19591 from 0Pranav/FR-ISS-152101

fix: add status "expired" to doctype quotation
This commit is contained in:
Deepesh Garg 2019-11-26 09:08:30 +05:30 committed by GitHub
commit 5558ee8597
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 1058 additions and 3513 deletions

View File

@ -301,7 +301,8 @@ scheduler_events = {
"erpnext.quality_management.doctype.quality_review.quality_review.review",
"erpnext.support.doctype.service_level_agreement.service_level_agreement.check_agreement_status",
"erpnext.crm.doctype.email_campaign.email_campaign.send_email_to_leads_or_contacts",
"erpnext.crm.doctype.email_campaign.email_campaign.set_email_campaign_status"
"erpnext.crm.doctype.email_campaign.email_campaign.set_email_campaign_status",
"erpnext.selling.doctype.quotation.set_expired_status"
],
"daily_long": [
"erpnext.setup.doctype.email_digest.email_digest.send",

File diff suppressed because it is too large Load Diff

View File

@ -185,6 +185,10 @@ def _make_sales_order(source_name, target_doc=None, ignore_permissions=False):
return doclist
def set_expired_status():
frappe.db.sql("""UPDATE `tabQuotation` SET `status` = 'Expired'
WHERE `status` != "Expired" AND `valid_till` < %s""", (nowdate()))
@frappe.whitelist()
def make_sales_invoice(source_name, target_doc=None):
return _make_sales_invoice(source_name, target_doc)

View File

@ -14,15 +14,13 @@ frappe.listview_settings['Quotation'] = {
get_indicator: function(doc) {
if(doc.status==="Open") {
if (doc.valid_till && doc.valid_till < frappe.datetime.nowdate()) {
return [__("Expired"), "darkgrey", "valid_till,<," + frappe.datetime.nowdate()];
} else {
return [__("Open"), "orange", "status,=,Open"];
}
} else if(doc.status==="Ordered") {
return [__("Ordered"), "green", "status,=,Ordered"];
} else if(doc.status==="Lost") {
return [__("Lost"), "darkgrey", "status,=,Lost"];
} else if(doc.status==="Expired") {
return [__("Expired"), "darkgrey", "status,=,Expired"];
}
}
};

View File

@ -201,6 +201,28 @@ class TestQuotation(unittest.TestCase):
sec_qo = make_quotation(item_list=qo_item2, do_not_submit=True)
sec_qo.submit()
def test_quotation_expiry(self):
from erpnext.selling.doctype.quotation.quotation import set_expired_status
quotation_item = [
{
"item_code": "_Test Item",
"warehouse":"",
"qty": 1,
"rate": 500
}
]
yesterday = add_days(nowdate(), -1)
expired_quotation = make_quotation(item_list=quotation_item, transaction_date=yesterday, do_not_submit=True)
expired_quotation.valid_till = yesterday
expired_quotation.save()
expired_quotation.submit()
set_expired_status()
expired_quotation.reload()
self.assertEqual(expired_quotation.status, "Expired")
test_records = frappe.get_test_records('Quotation')
def get_quotation_dict(party_name=None, item_code=None):
@ -258,3 +280,5 @@ def make_quotation(**args):
qo.submit()
return qo