diff --git a/bloomstack_core/__init__.py b/bloomstack_core/__init__.py index d35d99f00..d413624a0 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.1' +__version__ = '2.2.2' 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": "
\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\nTemplates 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/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 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/images/favicon.ico b/bloomstack_core/public/images/favicon.ico old mode 100755 new mode 100644 index f41d7ee03..b6251a877 Binary files a/bloomstack_core/public/images/favicon.ico and b/bloomstack_core/public/images/favicon.ico differ diff --git a/bloomstack_core/public/images/icon.png b/bloomstack_core/public/images/icon.png old mode 100755 new mode 100644 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" -};