From 849f0f1027094d634c99b03a4529942ad3fda868 Mon Sep 17 00:00:00 2001 From: Neha Sacher <45919049+nehasacher143@users.noreply.github.com> Date: Tue, 18 May 2021 14:04:36 +0530 Subject: [PATCH 1/4] fix: changed the favicon as per website (#596) * fix: changed the favicon as per website * fix: fixed the ico file --- bloomstack_core/public/images/favicon.ico | Bin 1150 -> 15406 bytes bloomstack_core/public/images/icon.png | Bin 2 files changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 bloomstack_core/public/images/favicon.ico mode change 100755 => 100644 bloomstack_core/public/images/icon.png diff --git a/bloomstack_core/public/images/favicon.ico b/bloomstack_core/public/images/favicon.ico old mode 100755 new mode 100644 index f41d7ee03902189a50f85c7dd506ba039e204bdb..b6251a8779bebdf9b1726ee6d34bb31f03c8c2b6 GIT binary patch literal 15406 zcmeI3f0SKSb;nWDbqO}xU;{wuT4Vm|ACX6I3D;6z2 zGVk5{CJ8?lgaVaf4HPkU*}y_t4M?bhQLy|9VEDaA2odsY=G}YWOn%*dzUSWa=Ds)g zy?H}M_=mUFUH9B`_St8jefHjG?|sh8WM*X!%N%`lhWG4D@$gLMq)a9=dv^3a=XWxh zYpFZogt+~xaDlc5Q{iuQ)Tw195_w>0V?@hK3l!JHWUH=){E=bnr zoU!8yPVJAAb@{6IRcP6&@l1WG^cwKqPXAk>|1}miU#Wd6>-gvAz?pUH^K5-43}->- zI-Z{hK3DPQQ{E5W4_X+Fn|Fex)c?0|7plQvl8(GHK8Ln_d1v(R3$Aw~<&Czl-UY|I zK40;d6y0Dg{jbkEwJ!;-3C0cXq~G^>w!+tywyobCdk=L_^ZdGhX!L#gp*?>{d3)aR zpVGJ%j`@|r`6BZ^2(4dI{lFFB>w&$JXJ4@roNi&E<5cJvhrib>DD8Zs>cLk4F67xy z{Vk#szV4)a5S-tzeeIjE&QlxkyMVoc_qym?^9UXj|21di=i6E%+t0q?$+>yQ`wsnz zJU;;6W4wQ6+wB`!yFmEuw|&$1-{E7$ez$vr_hj(y$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BR_>W^@YB{@=1kHz6)wq2!>NZyB*UDrK(>kuflA&LM=7?2_DvJ^%J?4t_0sO(9}2bUeV44N9}8{D z?^wB(PH$XX-t&G_>G=1HSFT0wp>^dI$xdY(cRxFR4 Uge_|1L%YH8D$J`KcsV%m{}ILGI{*Lx literal 1150 zcmaJ=%}*0S6n{h`k#OLoC!>Z)h>3rIUW}gfK=fu}j8{;ifL}pHy`Uf}@>M`-C?FrL zAO%Yyq6LZ(tymza5eN|yMW9&ZvOBXoovrW1OtKnbH?!}(-}}wHuUUWud{a^Yzq=r7 zGr%?gNXLZ`B7blc0O@*VoT@3nc;jxR-J+QN$5 zYsdOV%={~r`U1rxTv`^~Z()IQ5A&0*xKs17L;g3$RXX#_T$jGE_&XXlhOv0!xv@5EZZbp(ui$`@IcyQvqK%C%*TlZJLG z>DQ|DuVgD;*N{zI9xw+4%q1-~B#Rq Date: Wed, 19 May 2021 14:12:16 +0550 Subject: [PATCH 2/4] bumped to version 2.2.1 --- bloomstack_core/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bloomstack_core/__init__.py b/bloomstack_core/__init__.py index 0835a446f..d35d99f00 100644 --- a/bloomstack_core/__init__.py +++ b/bloomstack_core/__init__.py @@ -1,4 +1,4 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -__version__ = '2.2.0' +__version__ = '2.2.1' From af88189df5cc13fe685be5d3ad0979a79dffab67 Mon Sep 17 00:00:00 2001 From: Myuddin Khatri <53251406+MyuddinKhatri@users.noreply.github.com> Date: Wed, 19 May 2021 17:42:47 +0530 Subject: [PATCH 3/4] fix: fixed error on submission of sales order to send email for delivery window time (#595) * fix: fixed error on submission of sales order to send email for delivery window time * fix: fixed error on submission of sales order to send email for delivery window time * fix: chaned sql query to ORM to fetch users to send mail * fix: chaned sql query to ORM to fetch users to send mail * fix: chaned sql query to ORM to fetch users to send mail --- bloomstack_core/hook_events/utils.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/bloomstack_core/hook_events/utils.py b/bloomstack_core/hook_events/utils.py index a2f2de950..e5b353a04 100644 --- a/bloomstack_core/hook_events/utils.py +++ b/bloomstack_core/hook_events/utils.py @@ -4,7 +4,6 @@ from frappe.core.utils import find from frappe.desk.form.linked_with import get_linked_docs, get_linked_doctypes from frappe.utils import date_diff, get_time, getdate, nowdate, to_timedelta, today -from frappe.utils.user import get_users_with_role def validate_default_license(doc, method): @@ -85,3 +84,16 @@ def validate_delivery_window(doc, method): )) frappe.sendmail(recipients=recipients, subject=subject, message=message) + +def get_users_with_role(role): + # returns users with the specified role + user_list = frappe.get_all("User", fields=["`tabUser`.name"], + filters = [ + ["Has Role", "role", "=", role], + ["User", "name", "not in", ["Guest", "Administrator"]], + ["User", "enabled", "=", 1] + ], + as_list=1 + ) + + return [user for users in user_list for user in users] \ No newline at end of file From dc497249f79e001a751370ec79e373c1975da63e Mon Sep 17 00:00:00 2001 From: Vishal Dhayagude Date: Wed, 26 May 2021 18:00:52 +0530 Subject: [PATCH 4/4] fix: move contract to erpnext (#601) --- .../bloomstack_core/custom/contract.json | 644 ------------------ bloomstack_core/hook_events/contract.py | 197 ------ bloomstack_core/hooks.py | 13 - bloomstack_core/public/js/contract.js | 87 --- .../public/js/contract_calendar.js | 11 - 5 files changed, 952 deletions(-) delete mode 100644 bloomstack_core/bloomstack_core/custom/contract.json delete mode 100644 bloomstack_core/hook_events/contract.py delete mode 100644 bloomstack_core/public/js/contract.js delete mode 100644 bloomstack_core/public/js/contract_calendar.js diff --git a/bloomstack_core/bloomstack_core/custom/contract.json b/bloomstack_core/bloomstack_core/custom/contract.json deleted file mode 100644 index 20af5e0f1..000000000 --- a/bloomstack_core/bloomstack_core/custom/contract.json +++ /dev/null @@ -1,644 +0,0 @@ -{ - "custom_fields": [ - { - "_assign": null, - "_comments": null, - "_liked_by": null, - "_user_tags": null, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 1, - "collapsible_depends_on": null, - "columns": 0, - "creation": "2019-07-09 02:57:45.079868", - "default": null, - "depends_on": "eval:doc.customer_signature", - "description": null, - "docstatus": 0, - "dt": "Contract", - "fetch_from": null, - "fetch_if_empty": 0, - "fieldname": "sb_signature", - "fieldtype": "Section Break", - "hidden": 0, - "idx": 11, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "insert_after": "fulfilment_status", - "label": "Signature", - "length": 0, - "modified": "2019-07-09 02:57:45.079868", - "modified_by": "Administrator", - "name": "Contract-sb_signature", - "no_copy": 0, - "options": null, - "owner": "Administrator", - "parent": null, - "parentfield": null, - "parenttype": null, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "print_width": null, - "read_only": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "translatable": 0, - "unique": 0, - "width": null - }, - { - "_assign": null, - "_comments": null, - "_liked_by": null, - "_user_tags": null, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "collapsible_depends_on": null, - "columns": 0, - "creation": "2019-07-23 03:24:38.704056", - "default": null, - "depends_on": null, - "description": "Creates a new Project for the selected Party once the document is signed", - "docstatus": 0, - "dt": "Contract", - "fetch_from": null, - "fetch_if_empty": 0, - "fieldname": "project_template", - "fieldtype": "Link", - "hidden": 0, - "idx": 14, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "insert_after": "start_date", - "label": "Project Template", - "length": 0, - "modified": "2019-07-23 03:24:38.704056", - "modified_by": "Administrator", - "name": "Contract-project_template", - "no_copy": 0, - "options": "Project Template", - "owner": "Administrator", - "parent": null, - "parentfield": null, - "parenttype": null, - "permlevel": 0, - "precision": "", - "print_hide": 1, - "print_hide_if_no_value": 0, - "print_width": null, - "read_only": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "translatable": 0, - "unique": 0, - "width": null - }, - { - "_assign": null, - "_comments": null, - "_liked_by": null, - "_user_tags": null, - "allow_in_quick_entry": 0, - "allow_on_submit": 1, - "bold": 0, - "collapsible": 0, - "collapsible_depends_on": null, - "columns": 0, - "creation": "2019-07-09 02:57:45.266126", - "default": null, - "depends_on": null, - "description": "Party Signature", - "docstatus": 0, - "dt": "Contract", - "fetch_from": null, - "fetch_if_empty": 0, - "fieldname": "customer_signature", - "fieldtype": "Signature", - "hidden": 0, - "idx": 36, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "insert_after": "cb_user", - "label": "Customer Signature", - "length": 0, - "modified": "2019-09-30 02:33:21.889680", - "modified_by": "Administrator", - "name": "Contract-customer_signature", - "no_copy": 1, - "options": null, - "owner": "Administrator", - "parent": null, - "parentfield": null, - "parenttype": null, - "permlevel": 0, - "precision": "", - "print_hide": 1, - "print_hide_if_no_value": 0, - "print_width": null, - "read_only": 1, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "translatable": 0, - "unique": 0, - "width": null - }, - { - "_assign": null, - "_comments": null, - "_liked_by": null, - "_user_tags": null, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "collapsible_depends_on": null, - "columns": 0, - "creation": "2019-07-23 08:42:57.553038", - "default": null, - "depends_on": "eval:doc.project", - "description": null, - "docstatus": 0, - "dt": "Contract", - "fetch_from": null, - "fetch_if_empty": 0, - "fieldname": "project", - "fieldtype": "Link", - "hidden": 0, - "idx": 17, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "insert_after": "end_date", - "label": "Project", - "length": 0, - "modified": "2019-09-30 02:33:23.309146", - "modified_by": "Administrator", - "name": "Contract-project", - "no_copy": 1, - "options": "Project", - "owner": "Administrator", - "parent": null, - "parentfield": null, - "parenttype": null, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "print_width": null, - "read_only": 1, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "translatable": 0, - "unique": 0, - "width": null - }, - { - "_assign": null, - "_comments": null, - "_liked_by": null, - "_user_tags": null, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "collapsible_depends_on": null, - "columns": 0, - "creation": "2019-11-07 23:01:48.475498", - "default": null, - "depends_on": null, - "description": null, - "docstatus": 0, - "dt": "Contract", - "fetch_from": null, - "fetch_if_empty": 0, - "fieldname": "contract_terms_display", - "fieldtype": "Text", - "hidden": 0, - "idx": 24, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "insert_after": "contract_terms", - "label": "Contract Terms Display", - "length": 0, - "modified": "2019-11-07 23:01:48.475498", - "modified_by": "Administrator", - "name": "Contract-contract_terms_display", - "no_copy": 0, - "options": null, - "owner": "Administrator", - "parent": null, - "parentfield": null, - "parenttype": null, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "print_width": null, - "read_only": 1, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "translatable": 0, - "unique": 0, - "width": null - }, - { - "_assign": null, - "_comments": null, - "_liked_by": null, - "_user_tags": null, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "collapsible_depends_on": null, - "columns": 0, - "creation": "2019-11-18 01:58:35.410842", - "default": null, - "depends_on": null, - "description": null, - "docstatus": 0, - "dt": "Contract", - "fetch_from": null, - "fetch_if_empty": 0, - "fieldname": "contract_terms_help", - "fieldtype": "HTML", - "hidden": 0, - "idx": 25, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "insert_after": "contract_terms_display", - "label": "Contract Terms Help", - "length": 0, - "modified": "2019-11-18 01:58:35.410842", - "modified_by": "Administrator", - "name": "Contract-contract_terms_help", - "no_copy": 0, - "options": "

Contract Terms Example

\n\n
\nThis contract is binding between the Company and '{{ doc.party_name }}'. Once signed, the contract will begin on '{{ doc.start_date }}'.\n\nDetails:\n\n\u2022 Contract: {{ doc.name }}\n\u2022 Party: {{ doc.party_name }}\n\u2022 Project: {{ doc.project }}\n\u2022 ...\n
\n\n

You can insert values from all the Contract fields into the terms. To view all the fields, go to Setup > Customize Form View and select Contract.

\n\n

Templating

\n\n

Templates are compiled using the Jinja Templating Langauge. To learn more about Jinja, read this documentation.

", - "owner": "Administrator", - "parent": null, - "parentfield": null, - "parenttype": null, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "print_width": null, - "read_only": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "translatable": 0, - "unique": 0, - "width": null - }, - { - "_assign": null, - "_comments": null, - "_liked_by": null, - "_user_tags": null, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "collapsible_depends_on": null, - "columns": 0, - "creation": "2020-05-27 00:22:50.435495", - "default": null, - "depends_on": "", - "description": null, - "docstatus": 0, - "dt": "Contract", - "fetch_from": "", - "fetch_if_empty": 0, - "fieldname": "employee_name", - "fieldtype": "Data", - "hidden": 1, - "idx": 4, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "insert_after": "party_name", - "label": "Employee Name", - "length": 0, - "modified": "2020-05-27 00:22:50.435495", - "modified_by": "Administrator", - "name": "Contract-employee_name", - "no_copy": 0, - "options": null, - "owner": "Administrator", - "parent": null, - "parentfield": null, - "parenttype": null, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "print_width": null, - "read_only": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "translatable": 0, - "unique": 0, - "width": null - }, - { - "_assign": null, - "_comments": null, - "_liked_by": null, - "_user_tags": null, - "allow_in_quick_entry": 0, - "allow_on_submit": 1, - "bold": 0, - "collapsible": 0, - "collapsible_depends_on": null, - "columns": 0, - "creation": "2020-06-24 02:44:23.704505", - "default": null, - "depends_on": null, - "description": null, - "docstatus": 0, - "dt": "Contract", - "fetch_from": null, - "fetch_if_empty": 0, - "fieldname": "designation", - "fieldtype": "Data", - "hidden": 0, - "idx": 34, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "insert_after": "party_business_type", - "label": "Designation", - "length": 0, - "modified": "2020-06-24 02:44:23.704505", - "modified_by": "Administrator", - "name": "Contract-designation", - "no_copy": 0, - "options": null, - "owner": "Administrator", - "parent": null, - "parentfield": null, - "parenttype": null, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "print_width": null, - "read_only": 1, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "translatable": 0, - "unique": 0, - "width": null - }, - { - "_assign": null, - "_comments": null, - "_liked_by": null, - "_user_tags": null, - "allow_in_quick_entry": 0, - "allow_on_submit": 1, - "bold": 0, - "collapsible": 0, - "collapsible_depends_on": null, - "columns": 0, - "creation": "2020-06-25 00:17:31.772206", - "default": null, - "depends_on": null, - "description": null, - "docstatus": 0, - "dt": "Contract", - "fetch_from": null, - "fetch_if_empty": 0, - "fieldname": "party_business_type", - "fieldtype": "Select", - "hidden": 0, - "idx": 33, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "insert_after": "signed_on", - "label": "Party Business Type", - "length": 0, - "modified": "2020-06-25 00:17:31.772206", - "modified_by": "Administrator", - "name": "Contract-party_business_type", - "no_copy": 0, - "options": "Individual\nCompany", - "owner": "Administrator", - "parent": null, - "parentfield": null, - "parenttype": null, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "print_width": null, - "read_only": 1, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "translatable": 0, - "unique": 0, - "width": null - }, - { - "_assign": null, - "_comments": null, - "_liked_by": null, - "_user_tags": null, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "collapsible_depends_on": null, - "columns": 0, - "creation": "2020-07-22 00:49:35.624676", - "default": null, - "depends_on": null, - "description": null, - "docstatus": 0, - "dt": "Contract", - "fetch_from": null, - "fetch_if_empty": 0, - "fieldname": "signed_by_company_date", - "fieldtype": "Data", - "hidden": 0, - "idx": 39, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "insert_after": "signed_by_company", - "label": "Signed By Company Date", - "length": 0, - "modified": "2020-07-22 00:49:35.624676", - "modified_by": "Administrator", - "name": "Contract-signed_by_company_date", - "no_copy": 0, - "options": null, - "owner": "Administrator", - "parent": null, - "parentfield": null, - "parenttype": null, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "print_width": null, - "read_only": 1, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "translatable": 1, - "unique": 0, - "width": null - }, - { - "_assign": null, - "_comments": null, - "_liked_by": null, - "_user_tags": null, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "collapsible_depends_on": null, - "columns": 0, - "creation": "2020-11-09 23:15:19.240427", - "default": "0", - "depends_on": null, - "description": null, - "docstatus": 0, - "dt": "Contract", - "fetch_from": null, - "fetch_if_empty": 0, - "fieldname": "amount_in_figures", - "fieldtype": "Currency", - "hidden": 0, - "idx": 20, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "insert_after": "contract_amount", - "label": "Amount In Figure", - "length": 0, - "modified": "2020-11-09 23:15:19.240427", - "modified_by": "Administrator", - "name": "Contract-amount_in_figures", - "no_copy": 0, - "options": null, - "owner": "Administrator", - "parent": null, - "parentfield": null, - "parenttype": null, - "permlevel": 0, - "precision": "0", - "print_hide": 0, - "print_hide_if_no_value": 0, - "print_width": null, - "read_only": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "translatable": 0, - "unique": 0, - "width": null - }, - { - "_assign": null, - "_comments": null, - "_liked_by": null, - "_user_tags": null, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "collapsible_depends_on": null, - "columns": 0, - "creation": "2020-11-09 23:20:16.098722", - "default": null, - "depends_on": null, - "description": null, - "docstatus": 0, - "dt": "Contract", - "fetch_from": null, - "fetch_if_empty": 0, - "fieldname": "contract_amount", - "fieldtype": "Section Break", - "hidden": 0, - "idx": 19, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "insert_after": "ip_address", - "label": "Contract Amount", - "length": 0, - "modified": "2020-11-09 23:20:16.098722", - "modified_by": "Administrator", - "name": "Contract-contract_amount", - "no_copy": 0, - "options": null, - "owner": "Administrator", - "parent": null, - "parentfield": null, - "parenttype": null, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "print_width": null, - "read_only": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "translatable": 0, - "unique": 0, - "width": null - } - ], - "custom_perms": [], - "doctype": "Contract", - "property_setters": [], - "sync_on_migrate": 1 -} \ No newline at end of file diff --git a/bloomstack_core/hook_events/contract.py b/bloomstack_core/hook_events/contract.py deleted file mode 100644 index cf92073b5..000000000 --- a/bloomstack_core/hook_events/contract.py +++ /dev/null @@ -1,197 +0,0 @@ -import json - -import frappe -from erpnext import get_default_company -from erpnext.selling.doctype.quotation.quotation import make_sales_order -from frappe import _ -from frappe.model.mapper import get_mapped_doc -from frappe.utils import add_days, getdate, now -from frappe.utils.jinja import render_template - - -def generate_contract_terms_display(contract, method): - if contract.contract_terms: - contract.contract_terms_display = render_template(contract.contract_terms, {"doc": contract.as_dict()}) - - -def create_project_against_contract(contract, method): - if contract.project: - return - - if not contract.project_template: - return - - if not contract.is_signed: - return - - # Get the tasks for the project - base_date = getdate(now()) - project_template = frappe.get_doc("Project Template", contract.project_template) - - # Get project and party details - project_name = "{} - {}".format(contract.party_name, project_template.template_name) - if frappe.db.exists("Project", project_name): - count = len(frappe.get_all("Project", filters={"name": ["like", "%{}%".format(project_name)]})) - project_name = "{} - {}".format(project_name, count) - - project = frappe.new_doc("Project") - project.update({ - "project_name": project_name, - "customer": contract.party_name if contract.party_type == "Customer" else None, - }) - - project.insert(ignore_permissions=True) - - project_dates = [] - project_name = project.name - for task in project_template.tasks: - project_task = frappe.new_doc("Task") - start_date = add_days(base_date, task.days_to_task_start) - end_date = add_days(base_date, task.days_to_task_end) - project_task.update({ - "subject": task.task_name, - "start_date": start_date, - "end_date": end_date, - "task_weight": task.weight, - "description": task.description, - "project": project_name - }) - project_task.insert(ignore_permissions=True) - project_dates.extend([start_date, end_date]) - - expected_start_date = min(project_dates) - expected_end_date = max(project_dates) - - project.update({ - "expected_start_date": expected_start_date, - "expected_end_date": expected_end_date - }) - - project.save(ignore_permissions=True) - - - # Link the contract with the project - contract.db_set("project", project.name) - - -def create_order_against_contract(contract, method): - if frappe.db.exists("Sales Order", {"contract": contract.name}): - return - - if not contract.is_signed: - return - - if contract.document_type == "Quotation" and contract.document_name: - sales_order = make_sales_order(contract.document_name) - sales_order.contract = contract.name - sales_order.project = contract.project - sales_order.delivery_date = frappe.db.get_value("Project", contract.project, "expected_end_date") - sales_order.save() - sales_order.submit() - - -def create_event_against_contract(contract, method): - if method == "on_cancel": - event_name = frappe.db.exists('Event', {'subject': contract.name}) - if event_name: - frappe.delete_doc('Event', event_name) - elif method == "on_submit": - if not contract.end_date: - return - - employee_id = frappe.db.get_value('Employee', {'user_id': contract.signed_by_company}, 'name') - event = frappe.new_doc('Event') - event.subject = contract.name - event.ends_on = contract.end_date - event.description = contract.contract_terms - event.all_day = 1 - event.append("event_participants", { - "reference_doctype": contract.party_type, - "reference_docname": contract.party_name - }) - - if employee_id: - event.append("event_participants", { - "reference_doctype": 'Employee', - "reference_docname": employee_id - }) - - event.save() - - -@frappe.whitelist() -def get_party_users(doctype, txt, searchfield, start, page_len, filters): - if filters.get("party_type") in ("Customer", "Supplier"): - party_links = frappe.get_all("Dynamic Link", - filters={"parenttype": "Contact", - "link_doctype": filters.get("party_type"), - "link_name": filters.get("party_name")}, - fields=["parent"]) - - party_users = [frappe.db.get_value("Contact", link.parent, "user") for link in party_links] - - return frappe.get_all("User", filters={"email": ["in", party_users]}, as_list=True) - - -def get_data(data): - return frappe._dict({ - 'fieldname': 'contract', - 'internal_links': { - 'Project': 'project' - }, - 'transactions': [ - { - 'label': _('Sales'), - 'items': ['Sales Order'] - }, - { - 'label': _('Projects'), - 'items': ['Project'] - } - ] - }) - - -def set_contract_company(contract, method): - contract.signed_by_company = frappe.session.user - if contract.company: - contract.letter_head = frappe.db.get_value("Company", contract.company, "default_letter_head") - -@frappe.whitelist() -def get_events(start, end, filters=None): - """ - Returns events for Gantt / Calendar view rendering. - - Args: - start (str): Start date-time. - end (str): End date-time. - filters (str, optional): Filters (JSON). Defaults to None. - - Returns: - list of dict: The list of Contract events - """ - - filters = json.loads(filters) - from frappe.desk.calendar import get_event_conditions - conditions = get_event_conditions("Contract", filters) - - events = frappe.db.sql(""" - SELECT - name, - start_date, - end_date - FROM - `tabContract` - WHERE - (start_date <= %(end)s - AND end_date >= %(start)s) - AND docstatus < 2 - {conditions} - """.format(conditions=conditions), { - "start": start, - "end": end - }, - as_dict=True, - update={"allDay": 0} - ) - return events diff --git a/bloomstack_core/hooks.py b/bloomstack_core/hooks.py index 4fb1b3cba..e0ea19059 100755 --- a/bloomstack_core/hooks.py +++ b/bloomstack_core/hooks.py @@ -70,7 +70,6 @@ doctype_js = { "Batch": "public/js/batch.js", "Compliance Settings": "public/js/compliance_settings.js", - "Contract": "public/js/contract.js", "Delivery Note": "public/js/delivery_note.js", "Delivery Trip": "public/js/delivery_trip.js", "Driver": "public/js/driver.js", @@ -94,13 +93,11 @@ } override_doctype_dashboards = { - "Contract": "bloomstack_core.hook_events.contract.get_data", "Employee": "bloomstack_core.hook_events.employee.get_data" } # doctype_tree_js = {"doctype" : "public/js/doctype_tree.js"} doctype_calendar_js = { - "Contract": "public/js/contract_calendar.js", "Work Order": "public/js/work_order_calendar.js" } @@ -159,16 +156,6 @@ "Compliance Settings": { "validate": "bloomstack_core.hook_events.compliance_settings.sync_bloomtrace" }, - "Contract": { - "validate": "bloomstack_core.hook_events.contract.generate_contract_terms_display", - "on_update_after_submit": [ - "bloomstack_core.hook_events.contract.create_project_against_contract", - "bloomstack_core.hook_events.contract.create_order_against_contract" - ], - "on_submit": "bloomstack_core.hook_events.contract.create_event_against_contract", - "before_submit": "bloomstack_core.hook_events.contract.set_contract_company", - "on_cancel": "bloomstack_core.hook_events.contract.create_event_against_contract" - }, "Customer": { "validate": [ "bloomstack_core.hook_events.customer.update_lead_acc_open_date" diff --git a/bloomstack_core/public/js/contract.js b/bloomstack_core/public/js/contract.js deleted file mode 100644 index b309a0316..000000000 --- a/bloomstack_core/public/js/contract.js +++ /dev/null @@ -1,87 +0,0 @@ -frappe.ui.form.on("Contract", { - onload: (frm) => { - // Setting company field as Empty by default (Only for draft Contracts), - // so that it only populates on submit - if (frm.doc.docstatus == 0) { - frm.set_value("company", ""); - } - }, - - refresh: (frm) => { - // pull users for the set party - frm.set_query("party_user", (doc) => { - return { - query: "bloomstack_core.hook_events.contract.get_party_users", - filters: { - "party_type": doc.party_type, - "party_name": doc.party_name - } - } - }); - - if (frm.doc.docstatus === 1 && !frm.doc.customer_signature) { - frm.add_custom_button(__("Authorize"), () => { - frappe.prompt([ - { - "label": "Contact Email", - "fieldtype": "Data", - "options": "Email", - "fieldname": "contact_email", - "default": frm.doc.party_user, - "reqd": 1 - }, - { - "label": "Contact Person", - "fieldtype": "Data", - "fieldname": "contact_person", - "default": frm.doc.party_name, - "reqd": 1 - } - ], - function (data) { - frappe.call({ - method: "bloomstack_core.utils.create_authorization_request", - args: { - dt: frm.doc.doctype, - dn: frm.doc.name, - contact_email: data.contact_email, - contact_name: data.contact_person - }, - callback: (r) => { - if (!r.exc) { - frappe.msgprint(__(`${frm.doc.name} has been successfully sent to ${data.contact_email}`)) - } - } - }) - }, - __("Send Authorization Request")) - }).addClass("btn-primary"); - } - }, - - before_submit: (frm) => { - if(!frm.doc.signee_company) { - frm.scroll_to_field('signee_company'); - frappe.throw("Please sign the contract before submiting it.") - } - }, - - signee_company: (frm) =>{ - frm.set_value("signed_by_company_date", frappe.datetime.nowdate()); - - }, - - party_name: (frm) => { - if (frm.doc.party_type == 'Employee' && frm.doc.party_name) { - frappe.db.get_value("Employee", { "name": frm.doc.party_name }, "employee_name", (r) => { - if (r && r.employee_name) { - frm.set_value("employee_name", r.employee_name); - } else { - frm.set_value("employee_name", null); - } - }) - } else { - frm.set_value("employee_name", null); - } - } -}); diff --git a/bloomstack_core/public/js/contract_calendar.js b/bloomstack_core/public/js/contract_calendar.js deleted file mode 100644 index 4d70d0d93..000000000 --- a/bloomstack_core/public/js/contract_calendar.js +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors -// License: GNU General Public License v3. See license.txt - -frappe.views.calendar["Contract"] = { - field_map: { - "start": "end_date", - "end": "end_date", - "title": "name" - }, - get_events_method: "bloomstack_core.hook_events.contract.get_events" -};