frappe / crm

The future of open source CRM
https://frappe.io/crm
GNU Affero General Public License v3.0
197 stars 101 forks source link

FCRM Exception: While changing status in Frappe CRM #206

Closed arsalanmudni2 closed 4 weeks ago

arsalanmudni2 commented 1 month ago

https://github.com/frappe/crm/blob/e7ca90df51e99d29a41fba74e6b18f0b6642adc4/crm/fcrm/doctype/crm_status_change_log/crm_status_change_log.py#L30

TypeError: unsupported operand type(s) for -: 'datetime.datetime' and 'str'","exc_type":"TypeError","exc_source":"crm (app)","exc":"[\"Traceback (most recent call last):\ File \\"apps/frappe/frappe/app.py\\", line 110, in application\ response = frappe.api.handle(request)\ File \\"apps/frappe/frappe/api/init.py\\", line 49, in handle\ data = endpoint(arguments)\ File \\"apps/frappe/frappe/api/v1.py\\", line 36, in handle_rpc_call\ return frappe.handler.handle()\ File \\"apps/frappe/frappe/handler.py\\", line 49, in handle\ data = execute_cmd(cmd)\ File \\"apps/frappe/frappe/handler.py\\", line 85, in execute_cmd\ return frappe.call(method, frappe.formdict)\ File \\"apps/frappe/frappe/init.py\\", line 1768, in call\ return fn(*args, newargs)\ File \\"apps/frappe/frappe/utils/typing_validations.py\\", line 31, in wrapper\ return func(*args, *kwargs)\ File \\"apps/frappe/frappe/desk/form/save.py\\", line 39, in savedocs\ doc.save()\ File \\"apps/frappe/frappe/model/document.py\\", line 337, in save\ return self._save(args, kwargs)\ File \\"apps/frappe/frappe/model/document.py\\", line 373, in _save\ self.run_before_save_methods()\ File \\"apps/frappe/frappe/model/document.py\\", line 1091, in run_before_save_methods\ self.run_method(\\"validate\\")\ File \\"apps/frappe/frappe/model/document.py\\", line 962, in run_method\ out = Document.hook(fn)(self, *args, kwargs)\ File \\"apps/frappe/frappe/model/document.py\\", line 1322, in composer\ return composed(self, method, *args, *kwargs)\ File \\"apps/frappe/frappe/model/document.py\\", line 1304, in runner\ add_to_return_value(self, fn(self, args, kwargs))\ File \\"apps/frappe/frappe/model/document.py\\", line 959, in fn\ return method_object(*args, **kwargs)\ File \\"apps/crm/crm/fcrm/doctype/crm_lead/crm_lead.py\\", line 28, in validate\ add_status_change_log(self)\ File \\"apps/crm/crm/fcrm/doctype/crm_status_change_log/crm_status_change_log.py\\", line 30, in add_status_change_log\ last_status_change.duration = (last_status_change.to_date - last_status_change.from_date).total_seconds()\ TypeError: unsupported operand type(s) for -: 'datetime.datetime' and 'str'\

shariquerik commented 1 month ago

@arsalanmudni2 Add steps to reproduce the above description doesnt help

arsalanmudni2 commented 4 weeks ago

Steps to Reproduce: Go to CRM Lead List. Add New CRM Lead Select the Lead. Go to Other Tab, change the status and save. I have also attached screenshots for reference. ![Uploading Screenshot from 2024-06-06 18-19-55.png…]()

arsalanmudni2 commented 4 weeks ago

Screenshot from 2024-06-06 18-20-10 Screenshot from 2024-06-06 18-20-32 Screenshot from 2024-06-06 18-21-38

shariquerik commented 4 weeks ago

@arsalanmudni2 Why are you using Desk View? you are not supposed to use it. Try from portal and let me know if you are facing the issue

shariquerik commented 4 weeks ago

Fixed: fix: compare date while calculating duration