From fdff4bf88d66f0bddffb8481dedfa817d925a508 Mon Sep 17 00:00:00 2001 From: Aditya Duggal Date: Wed, 9 Sep 2020 14:28:28 +0530 Subject: [PATCH] Fixes to Sales Order - Can book orders in Future Date - Delivery Date is now equal to transaction_date if lower than transaction_date - Sales Person table is getting pulled properly for multiple sales persons --- .../rigpl_erpnext/validations/sales_order.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/rigpl_erpnext/rigpl_erpnext/validations/sales_order.py b/rigpl_erpnext/rigpl_erpnext/validations/sales_order.py index 27ef89af..60f0994a 100755 --- a/rigpl_erpnext/rigpl_erpnext/validations/sales_order.py +++ b/rigpl_erpnext/rigpl_erpnext/validations/sales_order.py @@ -51,16 +51,17 @@ def update_fields(doc): for d in cust_doc.sales_team: steam_dict["sales_person"] = d.sales_person steam_dict["allocated_percentage"] = d.allocated_percentage + doc.append("sales_team", steam_dict.copy()) - doc.append('sales_team', steam_dict) doc.shipping_address_title = frappe.get_value("Address", doc.shipping_address_name, "address_title") - doc.transaction_date = nowdate() - if doc.delivery_date < nowdate(): - doc.delivery_date = nowdate() + if doc.transaction_date < nowdate(): + doc.transaction_date = nowdate() + if doc.delivery_date < doc.transaction_date: + doc.delivery_date = doc.transaction_date for d in doc.items: - if d.delivery_date < nowdate(): - d.delivery_date = nowdate() + if d.delivery_date < doc.transaction_date: + d.delivery_date = doc.transaction_date letter_head_tax = frappe.db.get_value("Sales Taxes and Charges Template", doc.taxes_and_charges, "letter_head")