diff --git a/muezzin/api/property_contract.py b/muezzin/api/property_contract.py index 7c2ab5d..3f142ba 100644 --- a/muezzin/api/property_contract.py +++ b/muezzin/api/property_contract.py @@ -1,7 +1,7 @@ -import frappe +import xhiveframework import json -@frappe.whitelist() +@xhiveframework.whitelist() def change_contract_status(doc, status): """ Validates if property already on rent between the from and to dates @@ -9,11 +9,11 @@ def change_contract_status(doc, status): doc = json.loads(doc) if status == "Hold": - doc = frappe.get_doc("Property Contract", doc["name"]) + doc = xhiveframework.get_doc("Property Contract", doc["name"]) doc.status = status doc.save() - unit_doc = frappe.get_doc("Unit", doc.unit) + unit_doc = xhiveframework.get_doc("Unit", doc.unit) unit_doc.status = "Vacant" unit_doc.save() return @@ -25,13 +25,13 @@ def change_contract_status(doc, status): "unit_name": doc["unit_name"], "status": ["!=", "Hold"] } - - property_contract = frappe.get_list("Property Contract", + + property_contract = xhiveframework.get_list("Property Contract", fields = ["name"], filters = filters) if len(property_contract)> 0: - frappe.throw(f"This property unit already contain a contract {property_contract[0].name} that not ended yet.") + xhiveframework.throw(f"This property unit already contain a contract {property_contract[0].name} that not ended yet.") # Get Property Contaract if to date is between new from and new to date @@ -41,13 +41,13 @@ def change_contract_status(doc, status): "unit_name": doc["unit_name"], "status": ["!=", "Hold"] } - - property_contract = frappe.get_list("Property Contract", + + property_contract = xhiveframework.get_list("Property Contract", fields = ["name"], filters = filters) if len(property_contract)> 0: - frappe.throw(f"This property unit already contain a contract {property_contract[0].name} that not ended yet.") + xhiveframework.throw(f"This property unit already contain a contract {property_contract[0].name} that not ended yet.") # Get Property Contaract if from date is after new from date and to date is before new to date @@ -58,19 +58,19 @@ def change_contract_status(doc, status): "unit_name": doc["unit_name"], "status": ["!=", "Hold"] } - - property_contract = frappe.get_list("Property Contract", + + property_contract = xhiveframework.get_list("Property Contract", fields = ["name"], filters = filters) if len(property_contract)> 0: - frappe.throw(f"This property unit already contain a contract {property_contract[0].name} that not ended yet.") + xhiveframework.throw(f"This property unit already contain a contract {property_contract[0].name} that not ended yet.") - doc = frappe.get_doc("Property Contract", doc["name"]) + doc = xhiveframework.get_doc("Property Contract", doc["name"]) doc.status = status doc.save() - unit_doc = frappe.get_doc("Unit", doc.unit_name) + unit_doc = xhiveframework.get_doc("Unit", doc.unit_name) unit_doc.status = "Leased" unit_doc.save() diff --git a/muezzin/api/property_dashboard.py b/muezzin/api/property_dashboard.py index c881aec..fb2c599 100644 --- a/muezzin/api/property_dashboard.py +++ b/muezzin/api/property_dashboard.py @@ -1,17 +1,17 @@ -import frappe +import xhiveframework -@frappe.whitelist() +@xhiveframework.whitelist() def get_tiles_data(): ''' function will use to get property dashboard's tiles data ''' - properties = frappe.db.count("Property") - units = frappe.db.count("Unit") - sold_units = frappe.db.count("Unit", {"status": "Sold"}) - rented_units = frappe.db.count("Unit", {"status": "Rented"}) - available_units = frappe.db.count("Unit", {"status": "Available"}) + properties = xhiveframework.db.count("Property") + units = xhiveframework.db.count("Unit") + sold_units = xhiveframework.db.count("Unit", {"status": "Sold"}) + rented_units = xhiveframework.db.count("Unit", {"status": "Rented"}) + available_units = xhiveframework.db.count("Unit", {"status": "Available"}) data = { "total_property": properties, diff --git a/muezzin/config/desktop.py b/muezzin/config/desktop.py index dc142a5..401296d 100644 --- a/muezzin/config/desktop.py +++ b/muezzin/config/desktop.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from frappe import _ +from xhiveframework import _ def get_data(): return [ diff --git a/muezzin/config/property_management.py b/muezzin/config/property_management.py index eedbe0f..07048a2 100644 --- a/muezzin/config/property_management.py +++ b/muezzin/config/property_management.py @@ -1,5 +1,5 @@ from __future__ import unicode_literals -from frappe import _ +from xhiveframework import _ def get_data(): @@ -66,7 +66,7 @@ def get_data(): "type": "doctype", "name": "Property Type", "onboard": 1 - }, + }, { "type": "doctype", "name": "Unit Activity", diff --git a/muezzin/events/sales_invoice.py b/muezzin/events/sales_invoice.py index 7f9c5f6..8bf443c 100644 --- a/muezzin/events/sales_invoice.py +++ b/muezzin/events/sales_invoice.py @@ -1,25 +1,25 @@ -import frappe +import xhiveframework def submit(doc, method): if hasattr(doc, 'property') and doc.property: - prop = frappe.get_doc('Property', doc.property) + prop = xhiveframework.get_doc('Property', doc.property) prop.customer = doc.customer prop.customer_name = doc.customer_name prop.save() if hasattr(doc, 'unit') and doc.unit: - unit = frappe.get_doc('Unit', doc.unit) + unit = xhiveframework.get_doc('Unit', doc.unit) unit.customer = doc.customer unit.customer_name = doc.customer_name unit.save() def cancel(doc, method): if hasattr(doc, 'property') and doc.property: - prop = frappe.get_doc('Property', doc.property) + prop = xhiveframework.get_doc('Property', doc.property) prop.customer = None prop.customer_name = None prop.save() if hasattr(doc, 'unit') and doc.unit: - unit = frappe.get_doc('Unit', doc.unit) + unit = xhiveframework.get_doc('Unit', doc.unit) unit.customer = None unit.customer_name = None - unit.save() \ No newline at end of file + unit.save() diff --git a/muezzin/hooks.py b/muezzin/hooks.py index f45056d..4bd1440 100644 --- a/muezzin/hooks.py +++ b/muezzin/hooks.py @@ -62,7 +62,7 @@ doctype_js = { # Desk Notifications # ------------------ -# See frappe.core.notifications.get_notification_config +# See xhiveframework.core.notifications.get_notification_config # notification_config = "muezzin.notifications.get_notification_config" @@ -71,11 +71,11 @@ doctype_js = { # Permissions evaluated in scripted ways # permission_query_conditions = { -# "Event": "frappe.desk.doctype.event.event.get_permission_query_conditions", +# "Event": "xhiveframework.desk.doctype.event.event.get_permission_query_conditions", # } # # has_permission = { -# "Event": "frappe.desk.doctype.event.event.has_permission", +# "Event": "xhiveframework.desk.doctype.event.event.has_permission", # } # Document Events @@ -120,12 +120,12 @@ scheduler_events = { # ------------------------------ # # override_whitelisted_methods = { -# "frappe.desk.doctype.event.event.get_events": "muezzin.event.get_events" +# "xhiveframework.desk.doctype.event.event.get_events": "muezzin.event.get_events" # } # # each overriding function accepts a `data` argument; # generated from the base implementation of the doctype dashboard, -# along with any modifications made in other Frappe apps +# along with any modifications made in other Xhiveframework apps # override_doctype_dashboards = { # "Task": "muezzin.task.get_dashboard_data" # } diff --git a/muezzin/property_management/doctype/auction/auction.js b/muezzin/property_management/doctype/auction/auction.js index c21f82a..0ce0dbf 100644 --- a/muezzin/property_management/doctype/auction/auction.js +++ b/muezzin/property_management/doctype/auction/auction.js @@ -1,7 +1,7 @@ // Copyright (c) 2021, Havenir Solutions and contributors // For license information, please see license.txt -frappe.ui.form.on('Auction', { +xhiveframework.ui.form.on('Auction', { refresh: function(frm) { frm.set_query('property', () => { return { @@ -19,7 +19,7 @@ frappe.ui.form.on('Auction', { property: function(frm) { if (frm.doc.property) { - frappe.db.get_value('Property', frm.doc.property, 'property_type') + xhiveframework.db.get_value('Property', frm.doc.property, 'property_type') .then( r=> { if (r.message) { frm.doc.property_type = r.message.property_type; diff --git a/muezzin/property_management/doctype/auction/auction.py b/muezzin/property_management/doctype/auction/auction.py index 7db6da4..5ad815f 100644 --- a/muezzin/property_management/doctype/auction/auction.py +++ b/muezzin/property_management/doctype/auction/auction.py @@ -3,8 +3,8 @@ # For license information, please see license.txt from __future__ import unicode_literals -# import frappe -from frappe.model.document import Document +# import xhiveframework +from xhiveframework.model.document import Document class Auction(Document): pass diff --git a/muezzin/property_management/doctype/auction/test_auction.py b/muezzin/property_management/doctype/auction/test_auction.py index 469204e..0cf6c32 100644 --- a/muezzin/property_management/doctype/auction/test_auction.py +++ b/muezzin/property_management/doctype/auction/test_auction.py @@ -3,7 +3,7 @@ # See license.txt from __future__ import unicode_literals -# import frappe +# import xhiveframework import unittest class TestAuction(unittest.TestCase): diff --git a/muezzin/property_management/doctype/auction_free_card/auction_free_card.js b/muezzin/property_management/doctype/auction_free_card/auction_free_card.js index c88e026..7f18044 100644 --- a/muezzin/property_management/doctype/auction_free_card/auction_free_card.js +++ b/muezzin/property_management/doctype/auction_free_card/auction_free_card.js @@ -1,7 +1,7 @@ // Copyright (c) 2021, Havenir Solutions and contributors // For license information, please see license.txt -frappe.ui.form.on('Auction Free Card', { +xhiveframework.ui.form.on('Auction Free Card', { refresh: function(frm) { frm.set_query('units', () => { if (frm.doc.auction) { diff --git a/muezzin/property_management/doctype/auction_free_card/auction_free_card.py b/muezzin/property_management/doctype/auction_free_card/auction_free_card.py index 40ce817..eb91c08 100644 --- a/muezzin/property_management/doctype/auction_free_card/auction_free_card.py +++ b/muezzin/property_management/doctype/auction_free_card/auction_free_card.py @@ -3,22 +3,22 @@ # For license information, please see license.txt from __future__ import unicode_literals -import frappe -from frappe.model.document import Document +import xhiveframework +from xhiveframework.model.document import Document class AuctionFreeCard(Document): def set_unit(self): - result = frappe.db.get_list('Auction Unit', {'parent': self.auction}, 'unit') + result = xhiveframework.db.get_list('Auction Unit', {'parent': self.auction}, 'unit') for row in result: self.append('units', { 'unit': row.unit }) -@frappe.whitelist() +@xhiveframework.whitelist() def get_unit(doctype, txt, searchfield, start, page_len, filters): - return frappe.db.sql("""select unit + return xhiveframework.db.sql("""select unit from `tabAuction Unit` where parent = {auction}""" - .format(auction = frappe.db.escape(filters.get("auction")) - )) \ No newline at end of file + .format(auction = xhiveframework.db.escape(filters.get("auction")) + )) diff --git a/muezzin/property_management/doctype/auction_free_card/test_auction_free_card.py b/muezzin/property_management/doctype/auction_free_card/test_auction_free_card.py index cac967d..487e7d8 100644 --- a/muezzin/property_management/doctype/auction_free_card/test_auction_free_card.py +++ b/muezzin/property_management/doctype/auction_free_card/test_auction_free_card.py @@ -3,7 +3,7 @@ # See license.txt from __future__ import unicode_literals -# import frappe +# import xhiveframework import unittest class TestAuctionFreeCard(unittest.TestCase): diff --git a/muezzin/property_management/doctype/auction_unit/auction_unit.py b/muezzin/property_management/doctype/auction_unit/auction_unit.py index 4dab8d5..330577d 100644 --- a/muezzin/property_management/doctype/auction_unit/auction_unit.py +++ b/muezzin/property_management/doctype/auction_unit/auction_unit.py @@ -3,8 +3,8 @@ # For license information, please see license.txt from __future__ import unicode_literals -# import frappe -from frappe.model.document import Document +# import xhiveframework +from xhiveframework.model.document import Document class AuctionUnit(Document): pass diff --git a/muezzin/property_management/doctype/contract_annual_raise/contract_annual_raise.py b/muezzin/property_management/doctype/contract_annual_raise/contract_annual_raise.py index 7d77653..99a8a71 100644 --- a/muezzin/property_management/doctype/contract_annual_raise/contract_annual_raise.py +++ b/muezzin/property_management/doctype/contract_annual_raise/contract_annual_raise.py @@ -3,8 +3,8 @@ # For license information, please see license.txt from __future__ import unicode_literals -# import frappe -from frappe.model.document import Document +# import xhiveframework +from xhiveframework.model.document import Document class ContractAnnualRaise(Document): pass diff --git a/muezzin/property_management/doctype/contract_payments/contract_payments.py b/muezzin/property_management/doctype/contract_payments/contract_payments.py index 973d682..c0534e3 100644 --- a/muezzin/property_management/doctype/contract_payments/contract_payments.py +++ b/muezzin/property_management/doctype/contract_payments/contract_payments.py @@ -3,8 +3,8 @@ # For license information, please see license.txt from __future__ import unicode_literals -# import frappe -from frappe.model.document import Document +# import xhiveframework +from xhiveframework.model.document import Document class ContractPayments(Document): pass diff --git a/muezzin/property_management/doctype/court/court.js b/muezzin/property_management/doctype/court/court.js index 5669a66..64b6de3 100644 --- a/muezzin/property_management/doctype/court/court.js +++ b/muezzin/property_management/doctype/court/court.js @@ -1,7 +1,7 @@ // Copyright (c) 2021, Havenir Solutions and contributors // For license information, please see license.txt -frappe.ui.form.on('Court', { +xhiveframework.ui.form.on('Court', { // refresh: function(frm) { // } diff --git a/muezzin/property_management/doctype/court/court.py b/muezzin/property_management/doctype/court/court.py index 6cb5929..9624293 100644 --- a/muezzin/property_management/doctype/court/court.py +++ b/muezzin/property_management/doctype/court/court.py @@ -3,8 +3,8 @@ # For license information, please see license.txt from __future__ import unicode_literals -# import frappe -from frappe.model.document import Document +# import xhiveframework +from xhiveframework.model.document import Document class Court(Document): pass diff --git a/muezzin/property_management/doctype/court/test_court.py b/muezzin/property_management/doctype/court/test_court.py index d0d77f7..d4aa113 100644 --- a/muezzin/property_management/doctype/court/test_court.py +++ b/muezzin/property_management/doctype/court/test_court.py @@ -3,7 +3,7 @@ # See license.txt from __future__ import unicode_literals -# import frappe +# import xhiveframework import unittest class TestCourt(unittest.TestCase): diff --git a/muezzin/property_management/doctype/discount_request/discount_request.js b/muezzin/property_management/doctype/discount_request/discount_request.js index 0429675..abcfe9c 100644 --- a/muezzin/property_management/doctype/discount_request/discount_request.js +++ b/muezzin/property_management/doctype/discount_request/discount_request.js @@ -1,7 +1,7 @@ // Copyright (c) 2021, Havenir Solutions and contributors // For license information, please see license.txt -frappe.ui.form.on('Discount Request', { +xhiveframework.ui.form.on('Discount Request', { refresh: function (frm) { get_brand_names(frm) }, @@ -24,7 +24,7 @@ frappe.ui.form.on('Discount Request', { let get_brand_names = function (frm) { if (frm.doc.customer) { - frappe.call({ + xhiveframework.call({ method: "get_brand_names", doc: frm.doc, callback: function (data) { @@ -36,4 +36,4 @@ let get_brand_names = function (frm) { } }) } -} \ No newline at end of file +} diff --git a/muezzin/property_management/doctype/discount_request/discount_request.py b/muezzin/property_management/doctype/discount_request/discount_request.py index 0cc95fc..783b1e0 100644 --- a/muezzin/property_management/doctype/discount_request/discount_request.py +++ b/muezzin/property_management/doctype/discount_request/discount_request.py @@ -3,9 +3,9 @@ # For license information, please see license.txt from __future__ import unicode_literals -import frappe -from frappe.model.document import Document -from frappe.utils import flt +import xhiveframework +from xhiveframework.model.document import Document +from xhiveframework.utils import flt class DiscountRequest(Document): @@ -17,7 +17,7 @@ class DiscountRequest(Document): def get_brand_names(self): list_items = [] - brands = frappe.get_all("Tenant Brand Name", filters={"parent": self.customer}, fields=['tenant_brand_name'], + brands = xhiveframework.get_all("Tenant Brand Name", filters={"parent": self.customer}, fields=['tenant_brand_name'], order_by="tenant_brand_name") if brands: for item in brands: @@ -30,9 +30,9 @@ class DiscountRequest(Document): "invoice": ["=", '']} if self.apply_discount_on != "All": filters['reason'] = self.apply_discount_on - payments = frappe.db.get_all("Contract Payments", filters=filters, order_by="date") + payments = xhiveframework.db.get_all("Contract Payments", filters=filters, order_by="date") for row in payments: - doc = frappe.get_doc("Contract Payments", row["name"]) + doc = xhiveframework.get_doc("Contract Payments", row["name"]) if type == 'Add': doc.amount -= ( ((flt(self.percentage) / 100) * flt(doc.amount)) if self.discount_type == 'Percentage' else flt( @@ -49,4 +49,4 @@ class DiscountRequest(Document): doc.flags.ignore_validate_update_after_submit = True doc.save() - frappe.db.commit() + xhiveframework.db.commit() diff --git a/muezzin/property_management/doctype/discount_request/test_discount_request.py b/muezzin/property_management/doctype/discount_request/test_discount_request.py index 2cb40d7..8d7bcbe 100644 --- a/muezzin/property_management/doctype/discount_request/test_discount_request.py +++ b/muezzin/property_management/doctype/discount_request/test_discount_request.py @@ -3,7 +3,7 @@ # See license.txt from __future__ import unicode_literals -# import frappe +# import xhiveframework import unittest class TestDiscountRequest(unittest.TestCase): diff --git a/muezzin/property_management/doctype/document/document.py b/muezzin/property_management/doctype/document/document.py index 87e6956..3974d8a 100644 --- a/muezzin/property_management/doctype/document/document.py +++ b/muezzin/property_management/doctype/document/document.py @@ -3,8 +3,8 @@ # For license information, please see license.txt from __future__ import unicode_literals -# import frappe -from frappe.model.document import Document +# import xhiveframework +from xhiveframework.model.document import Document class Document(Document): pass diff --git a/muezzin/property_management/doctype/document_type/document_type.js b/muezzin/property_management/doctype/document_type/document_type.js index 697af09..56bf60d 100644 --- a/muezzin/property_management/doctype/document_type/document_type.js +++ b/muezzin/property_management/doctype/document_type/document_type.js @@ -1,7 +1,7 @@ // Copyright (c) 2021, Havenir Solutions and contributors // For license information, please see license.txt -frappe.ui.form.on('Document Type', { +xhiveframework.ui.form.on('Document Type', { // refresh: function(frm) { // } diff --git a/muezzin/property_management/doctype/document_type/document_type.py b/muezzin/property_management/doctype/document_type/document_type.py index ddb4afb..9317dde 100644 --- a/muezzin/property_management/doctype/document_type/document_type.py +++ b/muezzin/property_management/doctype/document_type/document_type.py @@ -3,8 +3,8 @@ # For license information, please see license.txt from __future__ import unicode_literals -# import frappe -from frappe.model.document import Document +# import xhiveframework +from xhiveframework.model.document import Document class DocumentType(Document): pass diff --git a/muezzin/property_management/doctype/document_type/test_document_type.py b/muezzin/property_management/doctype/document_type/test_document_type.py index c66a673..937d722 100644 --- a/muezzin/property_management/doctype/document_type/test_document_type.py +++ b/muezzin/property_management/doctype/document_type/test_document_type.py @@ -3,7 +3,7 @@ # See license.txt from __future__ import unicode_literals -# import frappe +# import xhiveframework import unittest class TestDocumentType(unittest.TestCase): diff --git a/muezzin/property_management/doctype/maintenance_ticket/maintenance_ticket.js b/muezzin/property_management/doctype/maintenance_ticket/maintenance_ticket.js index ce7fae8..9fb1ad6 100644 --- a/muezzin/property_management/doctype/maintenance_ticket/maintenance_ticket.js +++ b/muezzin/property_management/doctype/maintenance_ticket/maintenance_ticket.js @@ -1,7 +1,7 @@ // Copyright (c) 2021, Havenir Solutions and contributors // For license information, please see license.txt -frappe.ui.form.on('Maintenance Ticket', { +xhiveframework.ui.form.on('Maintenance Ticket', { refresh: function(frm) { queries(frm); }, @@ -44,4 +44,4 @@ function queries(frm) { // frm.doc.latitude = frm.fields_dict.property_location.map.getCenter()['lat']; // frm.doc.longitude = frm.fields_dict.property_location.map.getCenter()['lng']; // } -// } \ No newline at end of file +// } diff --git a/muezzin/property_management/doctype/maintenance_ticket/maintenance_ticket.py b/muezzin/property_management/doctype/maintenance_ticket/maintenance_ticket.py index c17c7ad..8d3dedf 100644 --- a/muezzin/property_management/doctype/maintenance_ticket/maintenance_ticket.py +++ b/muezzin/property_management/doctype/maintenance_ticket/maintenance_ticket.py @@ -3,8 +3,8 @@ # For license information, please see license.txt from __future__ import unicode_literals -# import frappe -from frappe.model.document import Document +# import xhiveframework +from xhiveframework.model.document import Document class MaintenanceTicket(Document): pass diff --git a/muezzin/property_management/doctype/maintenance_ticket/test_maintenance_ticket.py b/muezzin/property_management/doctype/maintenance_ticket/test_maintenance_ticket.py index 2e7c599..4630f5d 100644 --- a/muezzin/property_management/doctype/maintenance_ticket/test_maintenance_ticket.py +++ b/muezzin/property_management/doctype/maintenance_ticket/test_maintenance_ticket.py @@ -3,7 +3,7 @@ # See license.txt from __future__ import unicode_literals -# import frappe +# import xhiveframework import unittest class TestMaintenanceTicket(unittest.TestCase): diff --git a/muezzin/property_management/doctype/opening_phase/opening_phase.js b/muezzin/property_management/doctype/opening_phase/opening_phase.js index 1fbcbe0..d8f00a5 100644 --- a/muezzin/property_management/doctype/opening_phase/opening_phase.js +++ b/muezzin/property_management/doctype/opening_phase/opening_phase.js @@ -1,7 +1,7 @@ // Copyright (c) 2021, Havenir Solutions and contributors // For license information, please see license.txt -frappe.ui.form.on('Opening Phase', { +xhiveframework.ui.form.on('Opening Phase', { // refresh: function(frm) { // } diff --git a/muezzin/property_management/doctype/opening_phase/opening_phase.py b/muezzin/property_management/doctype/opening_phase/opening_phase.py index 6995e2b..8ff338f 100644 --- a/muezzin/property_management/doctype/opening_phase/opening_phase.py +++ b/muezzin/property_management/doctype/opening_phase/opening_phase.py @@ -3,8 +3,8 @@ # For license information, please see license.txt from __future__ import unicode_literals -# import frappe -from frappe.model.document import Document +# import xhiveframework +from xhiveframework.model.document import Document class OpeningPhase(Document): pass diff --git a/muezzin/property_management/doctype/opening_phase/test_opening_phase.py b/muezzin/property_management/doctype/opening_phase/test_opening_phase.py index 262c120..34dfacb 100644 --- a/muezzin/property_management/doctype/opening_phase/test_opening_phase.py +++ b/muezzin/property_management/doctype/opening_phase/test_opening_phase.py @@ -3,7 +3,7 @@ # See license.txt from __future__ import unicode_literals -# import frappe +# import xhiveframework import unittest class TestOpeningPhase(unittest.TestCase): diff --git a/muezzin/property_management/doctype/property/property.js b/muezzin/property_management/doctype/property/property.js index 59867df..5d5c21b 100644 --- a/muezzin/property_management/doctype/property/property.js +++ b/muezzin/property_management/doctype/property/property.js @@ -1,7 +1,7 @@ // Copyright (c) 2021, Havenir Solutions and contributors // For license information, please see license.txt -frappe.ui.form.on('Property', { +xhiveframework.ui.form.on('Property', { refresh: function(frm) { if (!frm.is_dirty()) { create_custom_buttons(frm); @@ -12,8 +12,8 @@ frappe.ui.form.on('Property', { const create_custom_buttons = function(frm) { frm.add_custom_button(__('Journal Entry'), () => { let doc = frm.doc - frappe.run_serially([ - () => frappe.new_doc('Journal Entry'), + xhiveframework.run_serially([ + () => xhiveframework.new_doc('Journal Entry'), () => { cur_frm.doc.cost_center = doc.cost_center; cur_frm.doc.property = doc.name; @@ -24,8 +24,8 @@ const create_custom_buttons = function(frm) { frm.add_custom_button(__('Sales Invoice'), () => { let doc = frm.doc - frappe.run_serially([ - () => frappe.new_doc('Sales Invoice'), + xhiveframework.run_serially([ + () => xhiveframework.new_doc('Sales Invoice'), () => { cur_frm.doc.cost_center = doc.cost_center; cur_frm.doc.property = doc.name; @@ -36,8 +36,8 @@ const create_custom_buttons = function(frm) { frm.add_custom_button(__('Payment Entry'), () => { let doc = frm.doc - frappe.run_serially([ - () => frappe.new_doc('Payment Entry'), + xhiveframework.run_serially([ + () => xhiveframework.new_doc('Payment Entry'), () => { cur_frm.doc.cost_center = doc.cost_center; cur_frm.doc.property = doc.name; @@ -55,4 +55,4 @@ const create_custom_buttons = function(frm) { } ]); }, __('Create')); -} \ No newline at end of file +} diff --git a/muezzin/property_management/doctype/property/property.py b/muezzin/property_management/doctype/property/property.py index 0088cd4..316c62b 100644 --- a/muezzin/property_management/doctype/property/property.py +++ b/muezzin/property_management/doctype/property/property.py @@ -3,8 +3,8 @@ # For license information, please see license.txt from __future__ import unicode_literals -# import frappe -from frappe.model.document import Document +# import xhiveframework +from xhiveframework.model.document import Document class Property(Document): pass diff --git a/muezzin/property_management/doctype/property/test_property.py b/muezzin/property_management/doctype/property/test_property.py index c1982b9..4c490f9 100644 --- a/muezzin/property_management/doctype/property/test_property.py +++ b/muezzin/property_management/doctype/property/test_property.py @@ -3,7 +3,7 @@ # See license.txt from __future__ import unicode_literals -# import frappe +# import xhiveframework import unittest class TestProperty(unittest.TestCase): diff --git a/muezzin/property_management/doctype/property_contract/property_contract (copy).py b/muezzin/property_management/doctype/property_contract/property_contract (copy).py index 7ad8ed2..2074cef 100644 --- a/muezzin/property_management/doctype/property_contract/property_contract (copy).py +++ b/muezzin/property_management/doctype/property_contract/property_contract (copy).py @@ -3,8 +3,8 @@ # For license information, please see license.txt from __future__ import unicode_literals -import frappe -from frappe import _ +import xhiveframework +from xhiveframework import _ import datetime # from datetime import datetime, timedelta import dateutil @@ -13,8 +13,8 @@ from calendar import weekday, monthrange from collections import Counter from dateutil.relativedelta import relativedelta from dateutil.rrule import rrule, MONTHLY, YEARLY -from frappe.model.document import Document -from frappe.utils import flt, date_diff, getdate, cint, nowdate,get_datetime +from xhiveframework.model.document import Document +from xhiveframework.utils import flt, date_diff, getdate, cint, nowdate,get_datetime class PropertyContract(Document): @@ -35,13 +35,13 @@ class PropertyContract(Document): "unit": self.unit, "status": ["!=", "Hold"] } - - property_contract = frappe.get_list("Property Contract", + + property_contract = xhiveframework.get_list("Property Contract", fields = ["name"], filters = filters) if len(property_contract)> 0: - frappe.throw(f"This property unit already contain a contract {property_contract[0].name} that not ended yet.") + xhiveframework.throw(f"This property unit already contain a contract {property_contract[0].name} that not ended yet.") # Get Property Contaract if to date is between new from and new to date @@ -51,13 +51,13 @@ class PropertyContract(Document): "unit": self.unit, "status": ["!=", "Hold"] } - - property_contract = frappe.get_list("Property Contract", + + property_contract = xhiveframework.get_list("Property Contract", fields = ["name"], filters = filters) if len(property_contract)> 0: - frappe.throw(f"This property unit already contain a contract {property_contract[0].name} that not ended yet.") + xhiveframework.throw(f"This property unit already contain a contract {property_contract[0].name} that not ended yet.") # Get Property Contaract if from date is after new from date and to date is before new to date @@ -68,17 +68,17 @@ class PropertyContract(Document): "unit": self.unit, "status": ["!=", "Hold"] } - - property_contract = frappe.get_list("Property Contract", + + property_contract = xhiveframework.get_list("Property Contract", fields = ["name"], filters = filters) if len(property_contract)> 0: - frappe.throw(f"This property unit already contain a contract {property_contract[0].name} that not ended yet.") + xhiveframework.throw(f"This property unit already contain a contract {property_contract[0].name} that not ended yet.") diff_days = date_diff(self.rent_end_date,getdate()) if flt(diff_days) > 0: - frappe.db.set_value("Unit", self.unit, "status", "Leased") + xhiveframework.db.set_value("Unit", self.unit, "status", "Leased") def add_contract_annual_raise(self): self.contract_annual_raise = [] @@ -100,7 +100,7 @@ class PropertyContract(Document): duration = self.duration - 1 if self.duration > 1 else self.duration month = dateutil.relativedelta.relativedelta(months=duration) end_date = start_date + month - + if not self.annual_raise_start_date: duration_to_add = 13 - start_date.month months = dateutil.relativedelta.relativedelta(months = duration_to_add) @@ -109,7 +109,7 @@ class PropertyContract(Document): annual_raise_start_date = datetime.datetime.strptime(str(self.annual_raise_start_date), "%Y-%m-%d") service_charge_start_date = datetime.datetime.strptime(str(self.service_charge_start_date), "%Y-%m-%d") - + frequency = 0 if self.type == 'Customized c': if self.payments_scheduling: @@ -319,14 +319,14 @@ class PropertyContract(Document): self.save() def on_cancel(self): - frappe.db.set_value("Unit", self.unit, "status", "Vacant") + xhiveframework.db.set_value("Unit", self.unit, "status", "Vacant") def create_row_invoice(self,rowid): create_sales_invoice(self.name,rowid) def get_brand_names(self): list_items = [] - brands = frappe.get_all("Tenant Brand Name", filters={"parent": self.renter}, fields=['tenant_brand_name'], order_by="tenant_brand_name") + brands = xhiveframework.get_all("Tenant Brand Name", filters={"parent": self.renter}, fields=['tenant_brand_name'], order_by="tenant_brand_name") if brands: for item in brands: list_items.append(item["tenant_brand_name"]) @@ -335,10 +335,10 @@ class PropertyContract(Document): def update_duration(self): duration = self.get_dates_diff(self.rent_start_date,self.rent_end_date) - # frappe.msgprint(str(duration)) + # xhiveframework.msgprint(str(duration)) duration_months = (cint(duration["years"]) * 12) + cint(duration["months"]) + (1 if cint(duration["days"]) > 0 or getdate(self.rent_end_date).day == 1 else 0) - # frappe.msgprint(str(duration_months)) + # xhiveframework.msgprint(str(duration_months)) self.duration = duration_months return duration_months @@ -360,15 +360,15 @@ def create_sales_invoice(docname="",rowid=""): print("Starting Creation..........") condiction = "" if docname and rowid: - row_doc = frappe.get_doc("Contract Payments",rowid) + row_doc = xhiveframework.get_doc("Contract Payments",rowid) condiction = " and C.parent = '%s' " % docname # condiction += " and C.`name` = '%s' " % rowid condiction += " and C.date = '%s' " % row_doc.date - invoices = frappe.db.sql(""" + invoices = xhiveframework.db.sql(""" select *,P.`name` contract_name,C.date invoice_date,C.amount row_amount from `tabProperty Contract` P inner JOIN - `tabContract Payments` C + `tabContract Payments` C on P.`name` = C.parent -- and CURRENT_DATE() >= C.date and P.rent_item is not NULL @@ -388,30 +388,30 @@ def create_sales_invoice(docname="",rowid=""): print("Finished.") def create_sales_invoices(invoices): - # frappe.throw(str(args)) - default_company = frappe.db.get_default("Company") - si = frappe.new_doc("Sales Invoice") + # xhiveframework.throw(str(args)) + default_company = xhiveframework.db.get_default("Company") + si = xhiveframework.new_doc("Sales Invoice") if isinstance(invoices,list): - args = frappe._dict(invoices[0]) + args = xhiveframework._dict(invoices[0]) else: - args = frappe._dict(invoices) + args = xhiveframework._dict(invoices) invoice_date = args.date or nowdate() si.posting_date = invoice_date - debit_to = frappe.db.get_value("Company", default_company, 'default_receivable_account') + debit_to = xhiveframework.db.get_value("Company", default_company, 'default_receivable_account') if debit_to: si.debit_to = debit_to # Default Receivable Account else: - frappe.throw(_("Please set Default Receivable Account in Company " + default_company)) + xhiveframework.throw(_("Please set Default Receivable Account in Company " + default_company)) si.set_posting_time = 1 si.postint_date = args.invoice_date si.due_date = args.invoice_date si.customer = args.renter - si.tax_id = frappe.db.get_value("Customer",args.renter,"tax_id") + si.tax_id = xhiveframework.db.get_value("Customer",args.renter,"tax_id") si.debit_to = debit_to print(str(si.postint_date)+"================================================="+str(si.due_date)) @@ -420,7 +420,7 @@ def create_sales_invoices(invoices): si.property = args.property_name si.unit = args.unit si.property_contract = args.contract_name - invoice_curerncy = frappe.db.get_value('Customer', args.renter, "default_currency") or frappe.get_cached_value('Company', default_company, "default_currency") + invoice_curerncy = xhiveframework.db.get_value('Customer', args.renter, "default_currency") or xhiveframework.get_cached_value('Company', default_company, "default_currency") si.currency=invoice_curerncy conversion_rate = 1 @@ -428,26 +428,26 @@ def create_sales_invoices(invoices): conversion_rate = get_conversion_rate(invoice_curerncy,invoice_date) if conversion_rate == 0: message = _("Please Insert Currency Exchange for day {0}".format(invoice_date)) - frappe.throw(frappe.bold(message)) + xhiveframework.throw(xhiveframework.bold(message)) si.conversion_rate = conversion_rate tax_list = [] old_template = "" for item in invoices: default_income_account = None - item_income_account = frappe.db.get_value("Item Default", {"parent":(item.rent_item if item.reason =="Rent" else item.service_item)}, 'income_account') - company_default_income_account = frappe.db.get_value("Company", default_company, 'default_income_account') + item_income_account = xhiveframework.db.get_value("Item Default", {"parent":(item.rent_item if item.reason =="Rent" else item.service_item)}, 'income_account') + company_default_income_account = xhiveframework.db.get_value("Company", default_company, 'default_income_account') if item_income_account: default_income_account = item_income_account elif company_default_income_account: default_income_account = company_default_income_account else: - frappe.throw(_("Please set Default Income Account in Company " + default_company)) + xhiveframework.throw(_("Please set Default Income Account in Company " + default_company)) - cost_center = frappe.db.get_value("Company", default_company, 'cost_center') + cost_center = xhiveframework.db.get_value("Company", default_company, 'cost_center') if not cost_center: - frappe.throw(_("Please set Default Cost Center in Company " + default_company)) + xhiveframework.throw(_("Please set Default Cost Center in Company " + default_company)) tax_template_name = "" @@ -475,11 +475,11 @@ def create_sales_invoices(invoices): if old_template=="": old_template = tax_template_name - tax_data = frappe.db.sql(""" + tax_data = xhiveframework.db.sql(""" select * from `tabItem Tax Template Detail` where parent='{tax_template_name}' - + """.format(tax_template_name=tax_template_name),as_dict=True,debug=False) if tax_data: @@ -505,20 +505,20 @@ def create_sales_invoices(invoices): try: Sinv_ID = si.insert(ignore_mandatory = True) for row in invoices: - frappe.db.sql("""update `tabContract Payments` set invoice = '{0}' where `name` = '{1}' """.format(Sinv_ID.name,row.name),debug=True) + xhiveframework.db.sql("""update `tabContract Payments` set invoice = '{0}' where `name` = '{1}' """.format(Sinv_ID.name,row.name),debug=True) return Sinv_ID except Exception as e: print("Error......"+str(e)) - frappe.throw(_(e)) + xhiveframework.throw(_(e)) def get_conversion_rate(invoice_curerncy,invoice_date): conversion_rate = 0 - exchange_rate = frappe.db.sql(""" - select exchange_rate - from `tabCurrency Exchange` - where from_currency ='{invoice_curerncy}' - and to_currency='EGP' + exchange_rate = xhiveframework.db.sql(""" + select exchange_rate + from `tabCurrency Exchange` + where from_currency ='{invoice_curerncy}' + and to_currency='EGP' and date ='{invoice_date}' """.format(invoice_curerncy=invoice_curerncy,invoice_date=invoice_date),as_dict=True) if exchange_rate: @@ -529,17 +529,17 @@ def get_conversion_rate(invoice_curerncy,invoice_date): def update_unit_status(): - units = frappe.db.get_list("Property Contract",filters={"docstatus":1,"rent_end_date":getdate()},fields=["unit"]) + units = xhiveframework.db.get_list("Property Contract",filters={"docstatus":1,"rent_end_date":getdate()},fields=["unit"]) if units: for unit in units: - frappe.db.set_value("Unit", unit["unit"], "status", "Vacant") + xhiveframework.db.set_value("Unit", unit["unit"], "status", "Vacant") def update_unit_status_basd_on_reservation(): print("==========================starting============================") - units = frappe.db.get_list("Reservations",filters={"docstatus":1,"reservation_end":["<",get_datetime()]},fields=["unit"]) + units = xhiveframework.db.get_list("Reservations",filters={"docstatus":1,"reservation_end":["<",get_datetime()]},fields=["unit"]) if units: for unit in units: - frappe.db.set_value("Unit", unit["unit"], "status", "Vacant") - print("==========================Finished============================") \ No newline at end of file + xhiveframework.db.set_value("Unit", unit["unit"], "status", "Vacant") + print("==========================Finished============================") diff --git a/muezzin/property_management/doctype/property_contract/property_contract.js b/muezzin/property_management/doctype/property_contract/property_contract.js index bab9bd6..50e1450 100644 --- a/muezzin/property_management/doctype/property_contract/property_contract.js +++ b/muezzin/property_management/doctype/property_contract/property_contract.js @@ -1,17 +1,17 @@ // Copyright (c) 2021, Havenir Solutions and contributors // For license information, please see license.txt -frappe.ui.form.on('Property Contract', { +xhiveframework.ui.form.on('Property Contract', { onload: function (frm) { get_brand_names(frm) }, generate_payment_scheduale: function (frm) { frm.doc.payment = [] - frappe.call({ + xhiveframework.call({ method: 'add_payment', doc: frm.doc, callback: function (res) { - frappe.show_alert('Generated Successfully') + xhiveframework.show_alert('Generated Successfully') cur_frm.reload_doc() } @@ -61,7 +61,7 @@ frappe.ui.form.on('Property Contract', { if (frm.doc.docstatus == 1 && frm.doc.status != "Hold") { frm.add_custom_button("Hold Contract", () => { - frappe.call({ + xhiveframework.call({ method: "muezzin.api.property_contract.change_contract_status", args: { doc: frm.doc, @@ -75,7 +75,7 @@ frappe.ui.form.on('Property Contract', { } if (frm.doc.docstatus == 1 && frm.doc.status == "Hold") { frm.add_custom_button("Release Contract", () => { - frappe.call({ + xhiveframework.call({ method: "muezzin.api.property_contract.change_contract_status", args: { doc: frm.doc, @@ -203,7 +203,7 @@ frappe.ui.form.on('Property Contract', { } } }); -frappe.ui.form.on('Contract Payments', { +xhiveframework.ui.form.on('Contract Payments', { create_invoice: function (frm, cdt, cdn) { var row = locals[cdt][cdn]; if (!row.invoice) { @@ -216,7 +216,7 @@ frappe.ui.form.on('Contract Payments', { } }) } else { - frappe.throw(__('Invoice Already Created..')) + xhiveframework.throw(__('Invoice Already Created..')) } } }) @@ -225,7 +225,7 @@ const update_payment = function (frm) { if (!frm.doc.rent_start_date) { frm.doc.duration = null; frm.refresh_field('duration'); - frappe.msgprint('Enter Rent Start Date.') + xhiveframework.msgprint('Enter Rent Start Date.') } else { if (frm.doc.type && frm.doc.duration) { frm.call('add_payment'); @@ -241,7 +241,7 @@ const update_annual_raise_amount = function (frm) { if (!frm.doc.rent_start_date) { frm.doc.duration = null; frm.refresh_field('duration'); - frappe.msgprint('Enter Rent Start Date.') + xhiveframework.msgprint('Enter Rent Start Date.') } else { if (frm.doc.annual_raise === 'Annual Irregular' && frm.doc.duration) { frm.call('add_contract_annual_raise'); @@ -310,7 +310,7 @@ const update_duration = function (frm) { // let duration = get_time_diff(frm.doc.rent_end_date, frm.doc.rent_start_date) // frm.set_value('duration', duration) - frappe.call({ + xhiveframework.call({ method:'update_duration', doc:frm.doc, callback:function(r){ @@ -334,7 +334,7 @@ const get_time_diff = (end, start) => { let get_brand_names = function (frm) { if (frm.doc.renter) { - frappe.call({ + xhiveframework.call({ method: "muezzin.property_management.doctype.property_contract.property_contract.get_brand_names", args: { renter:frm.doc.renter @@ -348,4 +348,4 @@ let get_brand_names = function (frm) { } }) } -} \ No newline at end of file +} diff --git a/muezzin/property_management/doctype/property_contract/property_contract.py b/muezzin/property_management/doctype/property_contract/property_contract.py index 75d4715..15df933 100644 --- a/muezzin/property_management/doctype/property_contract/property_contract.py +++ b/muezzin/property_management/doctype/property_contract/property_contract.py @@ -3,8 +3,8 @@ # For license information, please see license.txt from __future__ import unicode_literals -import frappe -from frappe import _ +import xhiveframework +from xhiveframework import _ import datetime # from datetime import datetime, timedelta import dateutil @@ -13,8 +13,8 @@ from calendar import weekday, monthrange from collections import Counter from dateutil.relativedelta import relativedelta from dateutil.rrule import rrule, MONTHLY, YEARLY -from frappe.model.document import Document -from frappe.utils import flt, date_diff, getdate, cint, nowdate +from xhiveframework.model.document import Document +from xhiveframework.utils import flt, date_diff, getdate, cint, nowdate class PropertyContract(Document): @@ -36,12 +36,12 @@ class PropertyContract(Document): "status": ["!=", "Hold"] } - property_contract = frappe.get_list("Property Contract", + property_contract = xhiveframework.get_list("Property Contract", fields=["name"], filters=filters) if len(property_contract) > 0: - frappe.throw( + xhiveframework.throw( f"This property unit already contain a contract {property_contract[0].name} that not ended yet.") # Get Property Contaract if to date is between new from and new to date @@ -52,12 +52,12 @@ class PropertyContract(Document): "status": ["!=", "Hold"] } - property_contract = frappe.get_list("Property Contract", + property_contract = xhiveframework.get_list("Property Contract", fields=["name"], filters=filters) if len(property_contract) > 0: - frappe.throw( + xhiveframework.throw( f"This property unit already contain a contract {property_contract[0].name} that not ended yet.") # Get Property Contaract if from date is after new from date and to date is before new to date @@ -69,19 +69,19 @@ class PropertyContract(Document): "status": ["!=", "Hold"] } - property_contract = frappe.get_list("Property Contract", + property_contract = xhiveframework.get_list("Property Contract", fields=["name"], filters=filters) if len(property_contract) > 0: - frappe.throw( + xhiveframework.throw( f"This property unit already contain a contract {property_contract[0].name} that not ended yet.") diff_days = date_diff(self.rent_end_date, getdate()) if flt(diff_days) > 0: - frappe.db.set_value("Unit", self.unit, "status", "Leased") + xhiveframework.db.set_value("Unit", self.unit, "status", "Leased") - @frappe.whitelist() + @xhiveframework.whitelist() def add_contract_annual_raise(self): self.contract_annual_raise = [] start_date = datetime.datetime.strptime(self.rent_start_date, "%Y-%m-%d") @@ -95,7 +95,7 @@ class PropertyContract(Document): 'amount': 0, }) - @frappe.whitelist() + @xhiveframework.whitelist() def add_payment(self): self.payments = [] @@ -321,15 +321,15 @@ class PropertyContract(Document): self.save() def on_cancel(self): - frappe.db.set_value("Unit", self.unit, "status", "Vacant") + xhiveframework.db.set_value("Unit", self.unit, "status", "Vacant") - @frappe.whitelist() + @xhiveframework.whitelist() def create_row_invoice(self, rowid): create_sales_invoice(self.name, rowid) def get_brand_names(self): list_items = [] - brands = frappe.get_all("Tenant Brand Name", filters={"parent": self.renter}, fields=['tenant_brand_name'], + brands = xhiveframework.get_all("Tenant Brand Name", filters={"parent": self.renter}, fields=['tenant_brand_name'], order_by="tenant_brand_name") if brands: for item in brands: @@ -337,14 +337,14 @@ class PropertyContract(Document): return list_items - @frappe.whitelist() + @xhiveframework.whitelist() def update_duration(self): duration = self.get_dates_diff(self.rent_start_date, self.rent_end_date) - # frappe.msgprint(str(duration)) + # xhiveframework.msgprint(str(duration)) duration_months = (cint(duration["years"]) * 12) + cint(duration["months"]) + ( 1 if cint(duration["days"]) > 0 or getdate(self.rent_end_date).day == 1 else 0) - # frappe.msgprint(str(duration_months)) + # xhiveframework.msgprint(str(duration_months)) self.duration = duration_months return duration_months @@ -367,15 +367,15 @@ def create_sales_invoice(docname="", rowid=""): print("Starting Creation..........") condiction = "" if docname and rowid: - row_doc = frappe.get_doc("Contract Payments", rowid) + row_doc = xhiveframework.get_doc("Contract Payments", rowid) #condiction = " and P.`name` = '%s' " % docname condiction += " and C.`name` = '%s' " % rowid condiction += " and C.date = '%s' " % row_doc.date - invoices = frappe.db.sql(""" + invoices = xhiveframework.db.sql(""" select *,P.`name` contract_name,C.date invoice_date from `tabProperty Contract` P inner JOIN - `tabContract Payments` C + `tabContract Payments` C on P.`name` = C.parent -- and CURRENT_DATE() >= C.date and P.rent_item is not NULL @@ -395,26 +395,26 @@ def create_sales_invoice(docname="", rowid=""): def create_sales_invoices(args): - # frappe.throw(str(args)) - default_company = frappe.db.get_default("Company") - si = frappe.new_doc("Sales Invoice") - args = frappe._dict(args) + # xhiveframework.throw(str(args)) + default_company = xhiveframework.db.get_default("Company") + si = xhiveframework.new_doc("Sales Invoice") + args = xhiveframework._dict(args) si.posting_date = args.date or nowdate() invoice_date = args.date or nowdate() - debit_to = frappe.db.get_value("Company", default_company, 'default_receivable_account') + debit_to = xhiveframework.db.get_value("Company", default_company, 'default_receivable_account') if debit_to: si.debit_to = debit_to # Default Receivable Account else: - frappe.throw(_("Please set Default Receivable Account in Company " + default_company)) + xhiveframework.throw(_("Please set Default Receivable Account in Company " + default_company)) si.set_posting_time = 1 si.postint_date = args.invoice_date si.due_date = args.invoice_date si.customer = args.renter - si.tax_id = frappe.db.get_value("Customer", args.renter, "tax_id") + si.tax_id = xhiveframework.db.get_value("Customer", args.renter, "tax_id") si.debit_to = debit_to print(str(si.postint_date) + "=================================================" + str(si.due_date)) @@ -423,7 +423,7 @@ def create_sales_invoices(args): si.property = args.property_name si.unit = args.unit si.property_contract = args.contract_name - invoice_curerncy = frappe.get_cached_value('Customer', args.renter, "default_currency") or frappe.get_cached_value( + invoice_curerncy = xhiveframework.get_cached_value('Customer', args.renter, "default_currency") or xhiveframework.get_cached_value( 'Company', default_company, "default_currency") si.currency = invoice_curerncy conversion_rate = 1 @@ -431,25 +431,25 @@ def create_sales_invoices(args): conversion_rate = get_conversion_rate(invoice_curerncy,invoice_date) if conversion_rate == 0: message = _("Please Insert Currency Exchange for day {0}".format(invoice_date)) - frappe.throw(frappe.bold(message)) + xhiveframework.throw(xhiveframework.bold(message)) si.conversion_rate = conversion_rate default_income_account = None - item_income_account = frappe.db.get_value("Item Default", { + item_income_account = xhiveframework.db.get_value("Item Default", { "parent": (args.rent_item if args.reason == "Rent" else args.service_item)}, 'income_account') - company_default_income_account = frappe.db.get_value("Company", default_company, 'default_income_account') + company_default_income_account = xhiveframework.db.get_value("Company", default_company, 'default_income_account') if item_income_account: default_income_account = item_income_account elif company_default_income_account: default_income_account = company_default_income_account else: - frappe.throw(_("Please set Default Income Account in Company " + default_company)) + xhiveframework.throw(_("Please set Default Income Account in Company " + default_company)) - cost_center = frappe.db.get_value("Company", default_company, 'cost_center') + cost_center = xhiveframework.db.get_value("Company", default_company, 'cost_center') if not cost_center: - frappe.throw(_("Please set Default Cost Center in Company " + default_company)) + xhiveframework.throw(_("Please set Default Cost Center in Company " + default_company)) si.append("items", { "item_code": (args.rent_item if args.reason == "Rent" else args.service_item), @@ -471,17 +471,17 @@ def create_sales_invoices(args): tax_template_name = args.rent_sales_taxes_and_charges_template if tax_template_name: - tax_data = frappe.db.sql(""" + tax_data = xhiveframework.db.sql(""" select T.`name` taxes_and_charges,S.charge_type,S.description,S.rate,S.account_head from `tabSales Taxes and Charges Template` T - INNER JOIN + INNER JOIN `tabSales Taxes and Charges` S on T.`name` = S.parent and S.parenttype='Sales Taxes and Charges Template' and T.`name`='{tax_template_name}' """.format(tax_template_name=tax_template_name), as_dict=True, debug=False) - # frappe.throw(str(args.service_sales_taxes_and_charges_template)) + # xhiveframework.throw(str(args.service_sales_taxes_and_charges_template)) if tax_data: tax_data = tax_data[0] si.taxes_and_charges = tax_data["taxes_and_charges"] @@ -499,24 +499,24 @@ def create_sales_invoices(args): Sinv_ID = None try: Sinv_ID = si.insert(ignore_mandatory=True) - frappe.db.sql("""update `tabContract Payments` set invoice = '{0}' where `name` = '{1}' """.format(Sinv_ID.name, + xhiveframework.db.sql("""update `tabContract Payments` set invoice = '{0}' where `name` = '{1}' """.format(Sinv_ID.name, args.name), debug=True) return Sinv_ID except Exception as e: print("Error......" + str(e)) - frappe.throw(_(e)) + xhiveframework.throw(_(e)) def get_conversion_rate(invoice_curerncy,invoice_date): conversion_rate = 0 - exchange_rate = frappe.db.sql(""" - select exchange_rate - from `tabCurrency Exchange` - where from_currency ='{invoice_curerncy}' - and to_currency='EGP' + exchange_rate = xhiveframework.db.sql(""" + select exchange_rate + from `tabCurrency Exchange` + where from_currency ='{invoice_curerncy}' + and to_currency='EGP' -- and date ='{invoice_date}' - ORDER BY date desc + ORDER BY date desc limit 1 """.format(invoice_curerncy=invoice_curerncy,invoice_date=invoice_date),as_dict=True) if exchange_rate: @@ -526,20 +526,20 @@ def get_conversion_rate(invoice_curerncy,invoice_date): def update_unit_status(): - units = frappe.db.get_list("Property Contract", filters={"docstatus": 1, "rent_end_date": getdate()}, + units = xhiveframework.db.get_list("Property Contract", filters={"docstatus": 1, "rent_end_date": getdate()}, fields=["unit"]) if units: for unit in units: - frappe.db.set_value("Unit", unit["unit"], "status", "Vacant") + xhiveframework.db.set_value("Unit", unit["unit"], "status", "Vacant") -@frappe.whitelist() +@xhiveframework.whitelist() def get_brand_names(renter): list_items = [] - brands = frappe.get_all("Tenant Brand Name", filters={"parent": renter}, fields=['tenant_brand_name'], + brands = xhiveframework.get_all("Tenant Brand Name", filters={"parent": renter}, fields=['tenant_brand_name'], order_by="tenant_brand_name") if brands: for item in brands: list_items.append(item["tenant_brand_name"]) - return list_items \ No newline at end of file + return list_items diff --git a/muezzin/property_management/doctype/property_contract/test_property_contract.py b/muezzin/property_management/doctype/property_contract/test_property_contract.py index 1a976d2..e050747 100644 --- a/muezzin/property_management/doctype/property_contract/test_property_contract.py +++ b/muezzin/property_management/doctype/property_contract/test_property_contract.py @@ -3,7 +3,7 @@ # See license.txt from __future__ import unicode_literals -# import frappe +# import xhiveframework import unittest class TestPropertyContract(unittest.TestCase): diff --git a/muezzin/property_management/doctype/property_type/property_type.js b/muezzin/property_management/doctype/property_type/property_type.js index 4c78aae..d8b6da7 100644 --- a/muezzin/property_management/doctype/property_type/property_type.js +++ b/muezzin/property_management/doctype/property_type/property_type.js @@ -1,7 +1,7 @@ // Copyright (c) 2021, Havenir Solutions and contributors // For license information, please see license.txt -frappe.ui.form.on('Property Type', { +xhiveframework.ui.form.on('Property Type', { // refresh: function(frm) { // } diff --git a/muezzin/property_management/doctype/property_type/property_type.py b/muezzin/property_management/doctype/property_type/property_type.py index 32008bb..c1349db 100644 --- a/muezzin/property_management/doctype/property_type/property_type.py +++ b/muezzin/property_management/doctype/property_type/property_type.py @@ -3,8 +3,8 @@ # For license information, please see license.txt from __future__ import unicode_literals -# import frappe -from frappe.model.document import Document +# import xhiveframework +from xhiveframework.model.document import Document class PropertyType(Document): pass diff --git a/muezzin/property_management/doctype/property_type/test_property_type.py b/muezzin/property_management/doctype/property_type/test_property_type.py index c32f541..ef9ee9f 100644 --- a/muezzin/property_management/doctype/property_type/test_property_type.py +++ b/muezzin/property_management/doctype/property_type/test_property_type.py @@ -3,7 +3,7 @@ # See license.txt from __future__ import unicode_literals -# import frappe +# import xhiveframework import unittest class TestPropertyType(unittest.TestCase): diff --git a/muezzin/property_management/doctype/property_unit_detail/property_unit_detail.py b/muezzin/property_management/doctype/property_unit_detail/property_unit_detail.py index 133a3cd..91cefdf 100644 --- a/muezzin/property_management/doctype/property_unit_detail/property_unit_detail.py +++ b/muezzin/property_management/doctype/property_unit_detail/property_unit_detail.py @@ -3,8 +3,8 @@ # For license information, please see license.txt from __future__ import unicode_literals -# import frappe -from frappe.model.document import Document +# import xhiveframework +from xhiveframework.model.document import Document class PropertyUnitDetail(Document): pass diff --git a/muezzin/property_management/doctype/real_estate_offer/real_estate_offer.js b/muezzin/property_management/doctype/real_estate_offer/real_estate_offer.js index 77b2a48..f756316 100644 --- a/muezzin/property_management/doctype/real_estate_offer/real_estate_offer.js +++ b/muezzin/property_management/doctype/real_estate_offer/real_estate_offer.js @@ -1,7 +1,7 @@ // Copyright (c) 2021, Havenir Solutions and contributors // For license information, please see license.txt -frappe.ui.form.on('Real Estate Offer', { +xhiveframework.ui.form.on('Real Estate Offer', { // refresh: function(frm) { // } diff --git a/muezzin/property_management/doctype/real_estate_offer/real_estate_offer.py b/muezzin/property_management/doctype/real_estate_offer/real_estate_offer.py index 519e89b..1045b7f 100644 --- a/muezzin/property_management/doctype/real_estate_offer/real_estate_offer.py +++ b/muezzin/property_management/doctype/real_estate_offer/real_estate_offer.py @@ -3,8 +3,8 @@ # For license information, please see license.txt from __future__ import unicode_literals -# import frappe -from frappe.model.document import Document +# import xhiveframework +from xhiveframework.model.document import Document class RealEstateOffer(Document): pass diff --git a/muezzin/property_management/doctype/real_estate_offer/test_real_estate_offer.py b/muezzin/property_management/doctype/real_estate_offer/test_real_estate_offer.py index cb5ac3b..fd05b61 100644 --- a/muezzin/property_management/doctype/real_estate_offer/test_real_estate_offer.py +++ b/muezzin/property_management/doctype/real_estate_offer/test_real_estate_offer.py @@ -3,7 +3,7 @@ # See license.txt from __future__ import unicode_literals -# import frappe +# import xhiveframework import unittest class TestRealEstateOffer(unittest.TestCase): diff --git a/muezzin/property_management/doctype/real_estate_order/real_estate_order.js b/muezzin/property_management/doctype/real_estate_order/real_estate_order.js index bbf1245..0ab9e5a 100644 --- a/muezzin/property_management/doctype/real_estate_order/real_estate_order.js +++ b/muezzin/property_management/doctype/real_estate_order/real_estate_order.js @@ -1,7 +1,7 @@ // Copyright (c) 2021, Havenir Solutions and contributors // For license information, please see license.txt -frappe.ui.form.on('Real Estate Order', { +xhiveframework.ui.form.on('Real Estate Order', { // refresh: function(frm) { // } diff --git a/muezzin/property_management/doctype/real_estate_order/real_estate_order.py b/muezzin/property_management/doctype/real_estate_order/real_estate_order.py index 26763c4..8e64f40 100644 --- a/muezzin/property_management/doctype/real_estate_order/real_estate_order.py +++ b/muezzin/property_management/doctype/real_estate_order/real_estate_order.py @@ -3,8 +3,8 @@ # For license information, please see license.txt from __future__ import unicode_literals -# import frappe -from frappe.model.document import Document +# import xhiveframework +from xhiveframework.model.document import Document class RealEstateOrder(Document): pass diff --git a/muezzin/property_management/doctype/real_estate_order/test_real_estate_order.py b/muezzin/property_management/doctype/real_estate_order/test_real_estate_order.py index c645e95..486765d 100644 --- a/muezzin/property_management/doctype/real_estate_order/test_real_estate_order.py +++ b/muezzin/property_management/doctype/real_estate_order/test_real_estate_order.py @@ -3,7 +3,7 @@ # See license.txt from __future__ import unicode_literals -# import frappe +# import xhiveframework import unittest class TestRealEstateOrder(unittest.TestCase): diff --git a/muezzin/property_management/doctype/reservation_repayment_schedule/reservation_repayment_schedule.py b/muezzin/property_management/doctype/reservation_repayment_schedule/reservation_repayment_schedule.py index 9c3e322..f763b5a 100644 --- a/muezzin/property_management/doctype/reservation_repayment_schedule/reservation_repayment_schedule.py +++ b/muezzin/property_management/doctype/reservation_repayment_schedule/reservation_repayment_schedule.py @@ -3,8 +3,8 @@ # For license information, please see license.txt from __future__ import unicode_literals -# import frappe -from frappe.model.document import Document +# import xhiveframework +from xhiveframework.model.document import Document class ReservationRepaymentSchedule(Document): pass diff --git a/muezzin/property_management/doctype/reservations/reservations.js b/muezzin/property_management/doctype/reservations/reservations.js index 5df5fc3..6c5ed52 100644 --- a/muezzin/property_management/doctype/reservations/reservations.js +++ b/muezzin/property_management/doctype/reservations/reservations.js @@ -1,7 +1,7 @@ // Copyright (c) 2021, Havenir Solutions and contributors // For license information, please see license.txt -frappe.ui.form.on('Reservations', { +xhiveframework.ui.form.on('Reservations', { refresh: function (frm) { if (frm.doc.docstatus == 1) { frm.add_custom_button(__("Contract"), () => { @@ -27,12 +27,12 @@ frappe.ui.form.on('Reservations', { }, create_new_contract: function (frm) { if (frm.doc.reservation_type == 'Selling') { - frappe.model.open_mapped_doc({ + xhiveframework.model.open_mapped_doc({ method: "muezzin.property_management.doctype.reservations.reservations.make_unit_sale_contract", frm: cur_frm }) } else { - frappe.model.open_mapped_doc({ + xhiveframework.model.open_mapped_doc({ method: "muezzin.property_management.doctype.reservations.reservations.make_property_contract", frm: cur_frm }) @@ -55,8 +55,8 @@ frappe.ui.form.on('Reservations', { }, customer_primary_address: function (frm) { if (frm.doc.customer_primary_address) { - frappe.call({ - method: 'frappe.contacts.doctype.address.address.get_address_display', + xhiveframework.call({ + method: 'xhiveframework.contacts.doctype.address.address.get_address_display', args: { "address_dict": frm.doc.customer_primary_address }, diff --git a/muezzin/property_management/doctype/reservations/reservations.py b/muezzin/property_management/doctype/reservations/reservations.py index 55a63c8..a71feb0 100644 --- a/muezzin/property_management/doctype/reservations/reservations.py +++ b/muezzin/property_management/doctype/reservations/reservations.py @@ -3,13 +3,13 @@ # For license information, please see license.txt from __future__ import unicode_literals -import frappe, math, json -from frappe import _ -import erpnext -from frappe.model.document import Document -from frappe.utils import flt, rounded, add_months, nowdate, getdate,get_datetime -from erpnext.controllers.accounts_controller import AccountsController -from frappe.model.mapper import get_mapped_doc +import xhiveframework, math, json +from xhiveframework import _ +import xhiveerp +from xhiveframework.model.document import Document +from xhiveframework.utils import flt, rounded, add_months, nowdate, getdate,get_datetime +from xhiveerp.controllers.accounts_controller import AccountsController +from xhiveframework.model.mapper import get_mapped_doc class Reservations(Document): @@ -22,12 +22,12 @@ class Reservations(Document): def on_submit(self): if(get_datetime() < get_datetime(self.reservation_end)): - frappe.db.set_value("Unit", self.unit, "status", "Reserved") + xhiveframework.db.set_value("Unit", self.unit, "status", "Reserved") else: - frappe.db.set_value("Unit", self.unit, "status", "Vacant") + xhiveframework.db.set_value("Unit", self.unit, "status", "Vacant") def on_cancel(self): - frappe.db.set_value("Unit", self.unit, "status", "Vacant") + xhiveframework.db.set_value("Unit", self.unit, "status", "Vacant") def set_missing_fields(self): if self.repayment_method == "Repay Over Number of Periods": @@ -65,13 +65,13 @@ class Reservations(Document): def validate_repayment_method(repayment_method, amount, monthly_repayment_amount, repayment_periods): if repayment_method == "Repay Over Number of Periods" and not repayment_periods: - frappe.throw(_("Please enter Repayment Periods")) + xhiveframework.throw(_("Please enter Repayment Periods")) if repayment_method == "Repay Fixed Amount per Period": if not monthly_repayment_amount: - frappe.throw(_("Please enter repayment Amount")) + xhiveframework.throw(_("Please enter repayment Amount")) if monthly_repayment_amount > amount: - frappe.throw(_("Monthly Repayment Amount cannot be greater than Amount")) + xhiveframework.throw(_("Monthly Repayment Amount cannot be greater than Amount")) def get_monthly_repayment_amount(repayment_method, amount, rate_of_interest, repayment_periods,advance_payment): if rate_of_interest: @@ -81,12 +81,12 @@ def get_monthly_repayment_amount(repayment_method, amount, rate_of_interest, rep / ((1 + monthly_interest_rate)**repayment_periods - 1)) else: monthly_repayment_amount = math.ceil(flt((amount-advance_payment)) / repayment_periods) - # frappe.msgprint(str(repayment_periods)) + # xhiveframework.msgprint(str(repayment_periods)) return monthly_repayment_amount -@frappe.whitelist() +@xhiveframework.whitelist() def make_unit_sale_contract(source_name, target_doc=None): doclist = get_mapped_doc("Reservations", source_name, { "Reservations": { @@ -107,7 +107,7 @@ def make_unit_sale_contract(source_name, target_doc=None): return doclist -@frappe.whitelist() +@xhiveframework.whitelist() def make_property_contract(source_name, target_doc=None): doclist = get_mapped_doc("Reservations", source_name, { "Reservations": { @@ -125,4 +125,4 @@ def make_property_contract(source_name, target_doc=None): } }, target_doc) - return doclist \ No newline at end of file + return doclist diff --git a/muezzin/property_management/doctype/reservations/test_reservations.py b/muezzin/property_management/doctype/reservations/test_reservations.py index efc10dc..5dc8f22 100644 --- a/muezzin/property_management/doctype/reservations/test_reservations.py +++ b/muezzin/property_management/doctype/reservations/test_reservations.py @@ -3,7 +3,7 @@ # See license.txt from __future__ import unicode_literals -# import frappe +# import xhiveframework import unittest class TestReservations(unittest.TestCase): diff --git a/muezzin/property_management/doctype/script/script.js b/muezzin/property_management/doctype/script/script.js index 9d22575..796a1fb 100644 --- a/muezzin/property_management/doctype/script/script.js +++ b/muezzin/property_management/doctype/script/script.js @@ -1,7 +1,7 @@ // Copyright (c) 2021, Havenir Solutions and contributors // For license information, please see license.txt -frappe.ui.form.on('Script', { +xhiveframework.ui.form.on('Script', { // refresh: function(frm) { // } diff --git a/muezzin/property_management/doctype/script/script.py b/muezzin/property_management/doctype/script/script.py index e33cd73..eb2c29a 100644 --- a/muezzin/property_management/doctype/script/script.py +++ b/muezzin/property_management/doctype/script/script.py @@ -3,8 +3,8 @@ # For license information, please see license.txt from __future__ import unicode_literals -# import frappe -from frappe.model.document import Document +# import xhiveframework +from xhiveframework.model.document import Document class Script(Document): pass diff --git a/muezzin/property_management/doctype/script/test_script.py b/muezzin/property_management/doctype/script/test_script.py index ffd8997..721526c 100644 --- a/muezzin/property_management/doctype/script/test_script.py +++ b/muezzin/property_management/doctype/script/test_script.py @@ -3,7 +3,7 @@ # See license.txt from __future__ import unicode_literals -# import frappe +# import xhiveframework import unittest class TestScript(unittest.TestCase): diff --git a/muezzin/property_management/doctype/tenant_brand_name/tenant_brand_name.js b/muezzin/property_management/doctype/tenant_brand_name/tenant_brand_name.js index ceb6ca5..32efd2d 100644 --- a/muezzin/property_management/doctype/tenant_brand_name/tenant_brand_name.js +++ b/muezzin/property_management/doctype/tenant_brand_name/tenant_brand_name.js @@ -1,7 +1,7 @@ // Copyright (c) 2021, Havenir Solutions and contributors // For license information, please see license.txt -frappe.ui.form.on('Tenant Brand Name', { +xhiveframework.ui.form.on('Tenant Brand Name', { // refresh: function(frm) { // } diff --git a/muezzin/property_management/doctype/tenant_brand_name/tenant_brand_name.py b/muezzin/property_management/doctype/tenant_brand_name/tenant_brand_name.py index 7b0c51a..98b53c2 100644 --- a/muezzin/property_management/doctype/tenant_brand_name/tenant_brand_name.py +++ b/muezzin/property_management/doctype/tenant_brand_name/tenant_brand_name.py @@ -3,8 +3,8 @@ # For license information, please see license.txt from __future__ import unicode_literals -# import frappe -from frappe.model.document import Document +# import xhiveframework +from xhiveframework.model.document import Document class TenantBrandName(Document): pass diff --git a/muezzin/property_management/doctype/tenant_brand_name/test_tenant_brand_name.py b/muezzin/property_management/doctype/tenant_brand_name/test_tenant_brand_name.py index c117f09..28d1fdd 100644 --- a/muezzin/property_management/doctype/tenant_brand_name/test_tenant_brand_name.py +++ b/muezzin/property_management/doctype/tenant_brand_name/test_tenant_brand_name.py @@ -3,7 +3,7 @@ # See license.txt from __future__ import unicode_literals -# import frappe +# import xhiveframework import unittest class TestTenantBrandName(unittest.TestCase): diff --git a/muezzin/property_management/doctype/unit/test_unit.py b/muezzin/property_management/doctype/unit/test_unit.py index 61c61c8..9a6d72c 100644 --- a/muezzin/property_management/doctype/unit/test_unit.py +++ b/muezzin/property_management/doctype/unit/test_unit.py @@ -3,7 +3,7 @@ # See license.txt from __future__ import unicode_literals -# import frappe +# import xhiveframework import unittest class TestUnit(unittest.TestCase): diff --git a/muezzin/property_management/doctype/unit/unit.js b/muezzin/property_management/doctype/unit/unit.js index 37889fa..818dffd 100644 --- a/muezzin/property_management/doctype/unit/unit.js +++ b/muezzin/property_management/doctype/unit/unit.js @@ -1,7 +1,7 @@ // Copyright (c) 2021, Havenir Solutions and contributors // For license information, please see license.txt -frappe.ui.form.on('Unit', { +xhiveframework.ui.form.on('Unit', { onload(frm) { frm.set_query("sub_activity", () => { return { @@ -30,7 +30,7 @@ frappe.ui.form.on('Unit', { frm.doc.unit_price = null; frm.doc.gla = null; frm.refresh_field('gla'); - frappe.msgprint('Unit Area must be greater than zero.') + xhiveframework.msgprint('Unit Area must be greater than zero.') } else if (frm.doc.gla && frm.doc.price_psm) { frm.doc.unit_price = frm.doc.gla * frm.doc.price_psm; } @@ -42,7 +42,7 @@ frappe.ui.form.on('Unit', { frm.doc.price_psm = null; frm.doc.unit_price = null; frm.refresh_field('price_psm'); - frappe.msgprint('Price must be greater than zero.') + xhiveframework.msgprint('Price must be greater than zero.') } else if (frm.doc.gla && frm.doc.price_psm) { frm.doc.unit_price = frm.doc.gla * frm.doc.price_psm; } @@ -53,8 +53,8 @@ frappe.ui.form.on('Unit', { const create_custom_buttons = function(frm) { frm.add_custom_button(__('Journal Entry'), () => { let doc = frm.doc - frappe.run_serially([ - () => frappe.new_doc('Journal Entry'), + xhiveframework.run_serially([ + () => xhiveframework.new_doc('Journal Entry'), () => { cur_frm.doc.cost_center = doc.cost_center; cur_frm.doc.property = doc.property; @@ -68,14 +68,14 @@ const create_custom_buttons = function(frm) { // frm.add_custom_button(__('Sales Invoice'), () => { // let doc = frm.doc - // frappe.run_serially([ - // () => frappe.new_doc('Sales Invoice'), + // xhiveframework.run_serially([ + // () => xhiveframework.new_doc('Sales Invoice'), // () => { // cur_frm.doc.cost_center = doc.cost_center; // cur_frm.doc.property = doc.property; // cur_frm.doc.unit = doc.name; // let customer = doc.property_owner_customer; - // frappe.model.set_value(cur_frm.doc.doctype, cur_frm.doc.name, "customer", customer); + // xhiveframework.model.set_value(cur_frm.doc.doctype, cur_frm.doc.name, "customer", customer); // cur_frm.refresh(); // } // ]); @@ -83,40 +83,40 @@ const create_custom_buttons = function(frm) { frm.add_custom_button(__('Payment Entry'), () => { let doc = frm.doc - frappe.run_serially([ - () => frappe.new_doc('Payment Entry'), + xhiveframework.run_serially([ + () => xhiveframework.new_doc('Payment Entry'), () => { cur_frm.doc.cost_center = doc.cost_center; cur_frm.doc.property = doc.property; cur_frm.doc.unit = doc.name; - + if (doc.property_owner_customer) { cur_frm.doc.party_type = 'Customer'; let party = doc.property_owner_customer; - frappe.model.set_value("Payment Entry", cur_frm.doc.name, "party", party) + xhiveframework.model.set_value("Payment Entry", cur_frm.doc.name, "party", party) } if (doc.property_owner_supplier) { cur_frm.doc.party_type = 'Supplier'; let party = doc.property_owner_supplier; - frappe.model.set_value("Payment Entry", cur_frm.doc.name, "party", party) + xhiveframework.model.set_value("Payment Entry", cur_frm.doc.name, "party", party) } cur_frm.refresh(); } ]); - + }, __('Create')); frm.add_custom_button(__('Purchase Invoice'), () => { let doc = frm.doc - frappe.run_serially([ - () => frappe.new_doc('Purchase Invoice'), + xhiveframework.run_serially([ + () => xhiveframework.new_doc('Purchase Invoice'), () => { cur_frm.doc.cost_center = doc.cost_center; cur_frm.doc.property = doc.property; cur_frm.doc.unit = doc.name; let supplier = doc.property_owner_supplier; - frappe.model.set_value(cur_frm.doc.doctype, cur_frm.doc.name, "supplier", supplier); + xhiveframework.model.set_value(cur_frm.doc.doctype, cur_frm.doc.name, "supplier", supplier); cur_frm.refresh(); } ]); @@ -124,8 +124,8 @@ const create_custom_buttons = function(frm) { frm.add_custom_button(__('Contract'), () => { let doc = frm.doc - frappe.run_serially([ - () => frappe.new_doc('Property Contract'), + xhiveframework.run_serially([ + () => xhiveframework.new_doc('Property Contract'), () => { cur_frm.doc.property_name = doc.property; cur_frm.doc.unit_name = doc.name; @@ -143,8 +143,8 @@ const update_gla = function(frm) { var make_sales_invoice = function () { - frappe.model.open_mapped_doc({ + xhiveframework.model.open_mapped_doc({ method: "muezzin.property_management.doctype.unit.unit.make_sales_invoice", frm: cur_frm }); - } \ No newline at end of file + } diff --git a/muezzin/property_management/doctype/unit/unit.py b/muezzin/property_management/doctype/unit/unit.py index 00db3e4..6c1d836 100644 --- a/muezzin/property_management/doctype/unit/unit.py +++ b/muezzin/property_management/doctype/unit/unit.py @@ -3,17 +3,17 @@ # For license information, please see license.txt from __future__ import unicode_literals -import frappe -from frappe.model.document import Document +import xhiveframework +from xhiveframework.model.document import Document class Unit(Document): pass -@frappe.whitelist() +@xhiveframework.whitelist() def make_sales_invoice(source_name, target_doc=None): - from frappe.model.mapper import get_mapped_doc + from xhiveframework.model.mapper import get_mapped_doc doclist = get_mapped_doc("Unit", source_name, { "Unit": { @@ -24,4 +24,4 @@ def make_sales_invoice(source_name, target_doc=None): } }, target_doc) - return doclist \ No newline at end of file + return doclist diff --git a/muezzin/property_management/doctype/unit/unit_dashboard.py b/muezzin/property_management/doctype/unit/unit_dashboard.py index 0ca9836..85978c2 100644 --- a/muezzin/property_management/doctype/unit/unit_dashboard.py +++ b/muezzin/property_management/doctype/unit/unit_dashboard.py @@ -1,5 +1,5 @@ from __future__ import unicode_literals -from frappe import _ +from xhiveframework import _ def get_data(): return { diff --git a/muezzin/property_management/doctype/unit_activity/test_unit_activity.py b/muezzin/property_management/doctype/unit_activity/test_unit_activity.py index 3ea0138..58ba38a 100644 --- a/muezzin/property_management/doctype/unit_activity/test_unit_activity.py +++ b/muezzin/property_management/doctype/unit_activity/test_unit_activity.py @@ -3,7 +3,7 @@ # See license.txt from __future__ import unicode_literals -# import frappe +# import xhiveframework import unittest class TestUnitActivity(unittest.TestCase): diff --git a/muezzin/property_management/doctype/unit_activity/unit_activity.js b/muezzin/property_management/doctype/unit_activity/unit_activity.js index 1911001..ec4d448 100644 --- a/muezzin/property_management/doctype/unit_activity/unit_activity.js +++ b/muezzin/property_management/doctype/unit_activity/unit_activity.js @@ -1,7 +1,7 @@ // Copyright (c) 2021, Havenir Solutions and contributors // For license information, please see license.txt -frappe.ui.form.on('Unit Activity', { +xhiveframework.ui.form.on('Unit Activity', { // refresh: function(frm) { // } diff --git a/muezzin/property_management/doctype/unit_activity/unit_activity.py b/muezzin/property_management/doctype/unit_activity/unit_activity.py index 97e42b8..f9ee77b 100644 --- a/muezzin/property_management/doctype/unit_activity/unit_activity.py +++ b/muezzin/property_management/doctype/unit_activity/unit_activity.py @@ -3,8 +3,8 @@ # For license information, please see license.txt from __future__ import unicode_literals -# import frappe -from frappe.model.document import Document +# import xhiveframework +from xhiveframework.model.document import Document class UnitActivity(Document): pass diff --git a/muezzin/property_management/doctype/unit_sale_contract/test_unit_sale_contract.py b/muezzin/property_management/doctype/unit_sale_contract/test_unit_sale_contract.py index ea81219..3970875 100644 --- a/muezzin/property_management/doctype/unit_sale_contract/test_unit_sale_contract.py +++ b/muezzin/property_management/doctype/unit_sale_contract/test_unit_sale_contract.py @@ -3,7 +3,7 @@ # See license.txt from __future__ import unicode_literals -# import frappe +# import xhiveframework import unittest class TestUnitSaleContract(unittest.TestCase): diff --git a/muezzin/property_management/doctype/unit_sale_contract/unit_sale_contract.js b/muezzin/property_management/doctype/unit_sale_contract/unit_sale_contract.js index 9387a6f..ff7fc6c 100644 --- a/muezzin/property_management/doctype/unit_sale_contract/unit_sale_contract.js +++ b/muezzin/property_management/doctype/unit_sale_contract/unit_sale_contract.js @@ -1,7 +1,7 @@ // Copyright (c) 2021, Havenir Solutions and contributors // For license information, please see license.txt -frappe.ui.form.on('Unit Sale Contract', { +xhiveframework.ui.form.on('Unit Sale Contract', { refresh: function (frm) { frm.add_custom_button(__("Print Cheque"), () => { frm.events.print_cheques(frm) @@ -14,7 +14,7 @@ frappe.ui.form.on('Unit Sale Contract', { let show_dialog = function (frm) { - var d = new frappe.ui.Dialog({ + var d = new xhiveframework.ui.Dialog({ title: __('Select Bank'), fields: [ { @@ -32,4 +32,4 @@ let show_dialog = function (frm) { primary_action_label: __('Print Bank Cheque') }); d.show(); -} \ No newline at end of file +} diff --git a/muezzin/property_management/doctype/unit_sale_contract/unit_sale_contract.py b/muezzin/property_management/doctype/unit_sale_contract/unit_sale_contract.py index 8700242..ff1aa2e 100644 --- a/muezzin/property_management/doctype/unit_sale_contract/unit_sale_contract.py +++ b/muezzin/property_management/doctype/unit_sale_contract/unit_sale_contract.py @@ -3,8 +3,8 @@ # For license information, please see license.txt from __future__ import unicode_literals -# import frappe -from frappe.model.document import Document +# import xhiveframework +from xhiveframework.model.document import Document class UnitSaleContract(Document): pass diff --git a/muezzin/property_management/doctype/unit_type/test_unit_type.py b/muezzin/property_management/doctype/unit_type/test_unit_type.py index 7af2d8f..9436471 100644 --- a/muezzin/property_management/doctype/unit_type/test_unit_type.py +++ b/muezzin/property_management/doctype/unit_type/test_unit_type.py @@ -3,7 +3,7 @@ # See license.txt from __future__ import unicode_literals -# import frappe +# import xhiveframework import unittest class TestUnitType(unittest.TestCase): diff --git a/muezzin/property_management/doctype/unit_type/unit_type.js b/muezzin/property_management/doctype/unit_type/unit_type.js index f040cd6..b22a208 100644 --- a/muezzin/property_management/doctype/unit_type/unit_type.js +++ b/muezzin/property_management/doctype/unit_type/unit_type.js @@ -1,7 +1,7 @@ // Copyright (c) 2021, Havenir Solutions and contributors // For license information, please see license.txt -frappe.ui.form.on('Unit Type', { +xhiveframework.ui.form.on('Unit Type', { // refresh: function(frm) { // } diff --git a/muezzin/property_management/doctype/unit_type/unit_type.py b/muezzin/property_management/doctype/unit_type/unit_type.py index b624c03..6df38c2 100644 --- a/muezzin/property_management/doctype/unit_type/unit_type.py +++ b/muezzin/property_management/doctype/unit_type/unit_type.py @@ -3,8 +3,8 @@ # For license information, please see license.txt from __future__ import unicode_literals -# import frappe -from frappe.model.document import Document +# import xhiveframework +from xhiveframework.model.document import Document class UnitType(Document): pass diff --git a/muezzin/property_management/page/property_dashboard/property_dashboard.js b/muezzin/property_management/page/property_dashboard/property_dashboard.js index f48193d..2821e90 100644 --- a/muezzin/property_management/page/property_dashboard/property_dashboard.js +++ b/muezzin/property_management/page/property_dashboard/property_dashboard.js @@ -1,12 +1,12 @@ -frappe.pages["property-dashboard"].on_page_load = function (wrapper) { - frappe.property_dashboard = new PropertyDashboard(wrapper); +xhiveframework.pages["property-dashboard"].on_page_load = function (wrapper) { + xhiveframework.property_dashboard = new PropertyDashboard(wrapper); }; class PropertyDashboard { constructor(wrapper) { this.page = wrapper.page; - frappe.run_serially([ + xhiveframework.run_serially([ () => this.make_page(wrapper), () => this.make_action_bar(wrapper), () => this.make_charts(wrapper), @@ -14,7 +14,7 @@ class PropertyDashboard { } make_page(wrapper) { - this.page = frappe.ui.make_app_page({ + this.page = xhiveframework.ui.make_app_page({ parent: wrapper, title: "Property Dashboard", single_column: true, @@ -33,14 +33,14 @@ class PropertyDashboard { const layout = $(wrapper).find(".layout-main-section"); // server call to get data - frappe.call({ + xhiveframework.call({ method: "muezzin.api.property_dashboard.get_tiles_data", freeze: true, callback: (r) => { const data = r.message; const context = { tiles: data }; - const tiles = frappe.render_template("dashboard-tiles", context); + const tiles = xhiveframework.render_template("dashboard-tiles", context); layout.html(""); layout.html(tiles); }, diff --git a/muezzin/property_management/report/property_management_revenue/property_management_revenue.js b/muezzin/property_management/report/property_management_revenue/property_management_revenue.js index fdcafa9..ade5956 100644 --- a/muezzin/property_management/report/property_management_revenue/property_management_revenue.js +++ b/muezzin/property_management/report/property_management_revenue/property_management_revenue.js @@ -2,26 +2,26 @@ // For license information, please see license.txt /* eslint-disable */ -frappe.query_reports["Property Management Revenue"] = { +xhiveframework.query_reports["Property Management Revenue"] = { "filters": [ { "label": "Company", "fieldname": "company", "fieldtype": "Link", "options": "Company", - "default": frappe.defaults.get_user_default("Company"), + "default": xhiveframework.defaults.get_user_default("Company"), }, { "label": "From Date", "fieldname": "from_date", "fieldtype": "Date", - "default": frappe.datetime.year_start() + "default": xhiveframework.datetime.year_start() }, { "label": "To Date", "fieldname": "to_date", "fieldtype": "Date", - "default": frappe.datetime.year_end() + "default": xhiveframework.datetime.year_end() }, { "label": "Status", diff --git a/muezzin/property_management/report/property_management_revenue/property_management_revenue.py b/muezzin/property_management/report/property_management_revenue/property_management_revenue.py index 2d97529..90899ea 100644 --- a/muezzin/property_management/report/property_management_revenue/property_management_revenue.py +++ b/muezzin/property_management/report/property_management_revenue/property_management_revenue.py @@ -2,12 +2,12 @@ # For license information, please see license.txt from __future__ import unicode_literals -import frappe -from frappe import _ +import xhiveframework +from xhiveframework import _ from dateutil import relativedelta import datetime from dateutil.rrule import rrule, MONTHLY -from frappe.utils import date_diff, flt +from xhiveframework.utils import date_diff, flt def execute(filters=None): columns = [ @@ -273,13 +273,13 @@ def get_data(filters): else: q_filter = {"docstatus": ["!=", "2"]} - result = frappe.get_list('Property Contract', q_filter, ['name']) + result = xhiveframework.get_list('Property Contract', q_filter, ['name']) for row in result: - contract = frappe.get_doc('Property Contract', row) + contract = xhiveframework.get_doc('Property Contract', row) if not contract.unit: continue - unit = frappe.get_doc('Unit', contract.unit) - prop = frappe.get_doc('Property', contract.property_name) + unit = xhiveframework.get_doc('Unit', contract.unit) + prop = xhiveframework.get_doc('Property', contract.property_name) # Calculate Month Left date1 = datetime.datetime.strptime(str(contract.rent_end_date), '%Y-%m-%d') @@ -287,7 +287,7 @@ def get_data(filters): date_diffrance = date_diff(date2, date1) r = relativedelta.relativedelta(date1, date2) - # frappe.msgprint(str(r)) + # xhiveframework.msgprint(str(r)) months_left = abs(r.months) years_left = abs(r.years) @@ -369,10 +369,10 @@ def get_data(filters): fieldname = f'{day}-{month}-{row.year}' if fieldname in contract_months and contract_months[fieldname]: - # frappe.msgprint(str(contract_months[fieldname])) + # xhiveframework.msgprint(str(contract_months[fieldname])) col_data[fieldname] = contract_months[fieldname] - # frappe.msgprint(str(col_data)) + # xhiveframework.msgprint(str(col_data)) ## NOTE # check if this label exists in dict of payments made above # if exists then payment for this contract is there so append it in columns diff --git a/muezzin/property_management/report/rent_roll/rent_roll.js b/muezzin/property_management/report/rent_roll/rent_roll.js index 328ac08..4505db8 100644 --- a/muezzin/property_management/report/rent_roll/rent_roll.js +++ b/muezzin/property_management/report/rent_roll/rent_roll.js @@ -1,26 +1,26 @@ // Copyright (c) 2016, Havenir Solutions and contributors // For license information, please see license.txt /* eslint-disable */ -frappe.query_reports["Rent Roll"] = { +xhiveframework.query_reports["Rent Roll"] = { "filters": [ { "label": "Company", "fieldname": "company", "fieldtype": "Link", "options": "Company", - "default": frappe.defaults.get_user_default("Company"), + "default": xhiveframework.defaults.get_user_default("Company"), }, { "label": "From Date", "fieldname": "from_date", "fieldtype": "Date", - "default": frappe.datetime.year_start() + "default": xhiveframework.datetime.year_start() }, { "label": "To Date", "fieldname": "to_date", "fieldtype": "Date", - "default": frappe.datetime.year_end() + "default": xhiveframework.datetime.year_end() }, { "label": "Status", diff --git a/muezzin/property_management/report/rent_roll/rent_roll.py b/muezzin/property_management/report/rent_roll/rent_roll.py index 7649476..6bc3313 100644 --- a/muezzin/property_management/report/rent_roll/rent_roll.py +++ b/muezzin/property_management/report/rent_roll/rent_roll.py @@ -2,8 +2,8 @@ # For license information, please see license.txt from __future__ import unicode_literals -import frappe -from frappe import _ +import xhiveframework +from xhiveframework import _ from dateutil import relativedelta import datetime import dateutil @@ -11,7 +11,7 @@ import calendar from calendar import weekday, monthrange from collections import Counter from dateutil.rrule import rrule, MONTHLY, YEARLY -from frappe.utils import date_diff, flt +from xhiveframework.utils import date_diff, flt def execute(filters=None): @@ -232,7 +232,7 @@ def execute(filters=None): start_date = datetime.datetime.strptime(str(filters.from_date), "%Y-%m-%d") end_date = datetime.datetime.strptime(str(filters.to_date), "%Y-%m-%d") - + # date_diffrance = date_diff(start_date, end_date) # if date_diffrance < 0: # end_date += relativedelta.relativedelta(days= abs(date_diffrance)) @@ -243,7 +243,7 @@ def execute(filters=None): month = '{:02d}'.format(row.month) day = '{:02d}'.format(row.day) - + label = f'{day}-{month_name}-{row.year}' fieldname = f'{day}-{month}-{row.year}' columns.append( @@ -266,13 +266,13 @@ def get_data(filters): else: q_filter = { "docstatus" : ["!=","2"]} - result = frappe.get_list('Property Contract', q_filter, ['name']) + result = xhiveframework.get_list('Property Contract', q_filter, ['name']) for row in result: - contract = frappe.get_doc('Property Contract', row) + contract = xhiveframework.get_doc('Property Contract', row) if not contract.unit: continue - unit = frappe.get_doc('Unit', contract.unit) - prop = frappe.get_doc('Property', contract.property_name) + unit = xhiveframework.get_doc('Unit', contract.unit) + prop = xhiveframework.get_doc('Property', contract.property_name) # Calculate Month Left date1 = datetime.datetime.strptime(str(contract.rent_end_date), '%Y-%m-%d') @@ -280,14 +280,14 @@ def get_data(filters): date_diffrance = date_diff(date2, date1) r = relativedelta.relativedelta(date1, date2) - # frappe.msgprint(str(r)) + # xhiveframework.msgprint(str(r)) months_left = abs(r.months) years_left = abs(r.years) if date_diffrance > 0: months_left = 0 years_left = 0 - + col_data = { 'location': prop.property_location, 'brand_name': contract.brand_name, @@ -363,15 +363,15 @@ def get_data(filters): if fieldname in contract_months and contract_months[fieldname]: - #frappe.msgprint(str(contract_months[fieldname])) + #xhiveframework.msgprint(str(contract_months[fieldname])) col_data[fieldname] = contract_months[fieldname] - # frappe.msgprint(str(col_data)) + # xhiveframework.msgprint(str(col_data)) ## NOTE # check if this label exists in dict of payments made above # if exists then payment for this contract is there so append it in columns # all that's left is correct syntax to append in columns where date is same as column label # And calculation of yearly payment if required - + data.append(col_data) return data diff --git a/muezzin/property_management/report/service_charge_roll/service_charge_roll.js b/muezzin/property_management/report/service_charge_roll/service_charge_roll.js index bacb744..c1bd1d4 100644 --- a/muezzin/property_management/report/service_charge_roll/service_charge_roll.js +++ b/muezzin/property_management/report/service_charge_roll/service_charge_roll.js @@ -2,26 +2,26 @@ // For license information, please see license.txt /* eslint-disable */ -frappe.query_reports["Service Charge Roll"] = { +xhiveframework.query_reports["Service Charge Roll"] = { "filters": [ { "label": "Company", "fieldname": "company", "fieldtype": "Link", "options": "Company", - "default": frappe.defaults.get_user_default("Company"), + "default": xhiveframework.defaults.get_user_default("Company"), }, { "label": "From Date", "fieldname": "from_date", "fieldtype": "Date", - "default": frappe.datetime.year_start() + "default": xhiveframework.datetime.year_start() }, { "label": "To Date", "fieldname": "to_date", "fieldtype": "Date", - "default": frappe.datetime.year_end() + "default": xhiveframework.datetime.year_end() }, { "label": "Status", diff --git a/muezzin/property_management/report/service_charge_roll/service_charge_roll.py b/muezzin/property_management/report/service_charge_roll/service_charge_roll.py index 12f1903..5397aad 100644 --- a/muezzin/property_management/report/service_charge_roll/service_charge_roll.py +++ b/muezzin/property_management/report/service_charge_roll/service_charge_roll.py @@ -2,8 +2,8 @@ # For license information, please see license.txt from __future__ import unicode_literals -import frappe -from frappe import _ +import xhiveframework +from xhiveframework import _ from dateutil import relativedelta import datetime import dateutil @@ -11,7 +11,7 @@ import calendar from calendar import weekday, monthrange from collections import Counter from dateutil.rrule import rrule, MONTHLY, YEARLY -from frappe.utils import date_diff +from xhiveframework.utils import date_diff def execute(filters=None): @@ -278,13 +278,13 @@ def get_data(filters): else: q_filter = { "docstatus" : ["!=","2"]} - result = frappe.get_list('Property Contract', q_filter, ['name']) + result = xhiveframework.get_list('Property Contract', q_filter, ['name']) for row in result: - contract = frappe.get_doc('Property Contract', row) + contract = xhiveframework.get_doc('Property Contract', row) if not contract.unit: continue - unit = frappe.get_doc('Unit', contract.unit) - prop = frappe.get_doc('Property', contract.property_name) + unit = xhiveframework.get_doc('Unit', contract.unit) + prop = xhiveframework.get_doc('Property', contract.property_name) # Calculate Month Left date1 = datetime.datetime.strptime(str(contract.rent_end_date), '%Y-%m-%d') @@ -292,7 +292,7 @@ def get_data(filters): date_diffrance = date_diff(date2, date1) r = relativedelta.relativedelta(date1, date2) - # frappe.msgprint(str(r)) + # xhiveframework.msgprint(str(r)) months_left = abs(r.months) years_left = abs(r.years) @@ -373,9 +373,9 @@ def get_data(filters): fieldname = f'{day}-{month}-{row.year}' if fieldname in contract_months and contract_months[fieldname]: - # frappe.msgprint(str(contract_months[fieldname])) + # xhiveframework.msgprint(str(contract_months[fieldname])) col_data[fieldname] = contract_months[fieldname] - # frappe.msgprint(str(col_data)) + # xhiveframework.msgprint(str(col_data)) ## NOTE # check if this label exists in dict of payments made above # if exists then payment for this contract is there so append it in columns diff --git a/muezzin/property_management/report/sold_unit/sold_unit.js b/muezzin/property_management/report/sold_unit/sold_unit.js index 4007619..e1f836c 100644 --- a/muezzin/property_management/report/sold_unit/sold_unit.js +++ b/muezzin/property_management/report/sold_unit/sold_unit.js @@ -2,7 +2,7 @@ // For license information, please see license.txt /* eslint-disable */ -frappe.query_reports["Sold Unit"] = { +xhiveframework.query_reports["Sold Unit"] = { "filters": [ ] diff --git a/muezzin/property_management/report/sold_unit/sold_unit.py b/muezzin/property_management/report/sold_unit/sold_unit.py index be9372b..8560ac1 100644 --- a/muezzin/property_management/report/sold_unit/sold_unit.py +++ b/muezzin/property_management/report/sold_unit/sold_unit.py @@ -2,7 +2,7 @@ # For license information, please see license.txt from __future__ import unicode_literals -import frappe +import xhiveframework def execute(filters=None): columns = get_columns(filters) @@ -11,111 +11,111 @@ def execute(filters=None): def get_columns(filters): columns = [ - { + { "label": "Sr", "fieldname": "serial_number", "fieldtype": "Int", "width": 50 }, - { + { "label": "Name", "fieldname": "unit", "fieldtype": "Link", "options": "Unit", "width": 100 }, - { + { "label": "Docstatus", "fieldname": "docstatus", "fieldtype": "Int", "width": 100 }, - { + { "label": "Unit Number", "fieldname": "unit_number", "fieldtype": "Data", "width": 100 }, - { + { "label": "Role (Floor Number)", "fieldname": "role_floor_number", "fieldtype": "Data", "width": 150 }, - { + { "label": "Contract Year", "fieldname": "contract_year", "fieldtype": "Data", "width": 100 }, - { + { "label": "Unit Type", "fieldname": "unit_type", "fieldtype": "Link", "options": "Unit Type", "width": 100 }, - { + { "label": "Property Owner (Customer)", "fieldname": "property_owner", "fieldtype": "Data", "width": 200 }, - { + { "label": "Unit Area (per Square Meter)", "fieldname": "unit_area", "fieldtype": "Int", "width": 200 }, - { + { "label": "Price (per Square Meter)", "fieldname": "price_psm", "fieldtype": "Data", "width": 200 }, - { + { "label": "Unit Price", "fieldname": "unit_price", "fieldtype": "Float", "width": 100 }, - { + { "label": "Unit Total Cost", "fieldname": "unit_valuation_rate", "fieldtype": "Float", "width": 100 }, - { + { "label": "Total Invoiced", "fieldname": "total_invoiced", "fieldtype": "Float", "width": 100 }, - { + { "label": "Total Paid", "fieldname": "total_paid", "fieldtype": "Float", "width": 100 }, - { + { "label": "Unit Profit", "fieldname":"unit_profit", "fieldtype": "Float", "width": 100 }, - { + { "label": "Total Outstanding", "fieldname": "total_outstanding", "fieldtype": "Float", "width": 150 }, ] - + return columns - + def build_data(filters): data = [] - + sub_filters = {} fields = [ "name", @@ -129,8 +129,8 @@ def build_data(filters): "unit_price", "unit_valuation_rate", ] - units = frappe.get_list("Unit", sub_filters, fields) - + units = xhiveframework.get_list("Unit", sub_filters, fields) + i = 1 for row in units: sub_filters = { @@ -142,20 +142,20 @@ def build_data(filters): "grand_total", "outstanding_amount", ] - + invoiced = 0 outstanding = 0 paid = 0 - - invoices = frappe.get_list("Sales Invoice", sub_filters, fields) + + invoices = xhiveframework.get_list("Sales Invoice", sub_filters, fields) for invoice in invoices: invoiced += invoice.grand_total outstanding += invoice.outstanding_amount - + paid = invoiced - outstanding - + unit_profit = row.unit_valuation_rate-invoiced - + record = { "serial_number": i, "unit": row.name, @@ -173,8 +173,8 @@ def build_data(filters): "unit_profit":unit_profit, "total_outstanding": outstanding, } - + i = i + 1 - + data.append(record) - return data \ No newline at end of file + return data diff --git a/muezzin/public/js/payment_entry.js b/muezzin/public/js/payment_entry.js index e588e3e..f2ceee4 100644 --- a/muezzin/public/js/payment_entry.js +++ b/muezzin/public/js/payment_entry.js @@ -1,16 +1,16 @@ -frappe.ui.form.on("Payment Entry", { +xhiveframework.ui.form.on("Payment Entry", { onload(frm, dt, dn) { if (frm.is_new()) { const item = frm.doc.references[0]; let doctype = "Sales Invoice"; let doc_name = item.reference_name; - frappe.db.get_value(doctype, doc_name, "unit").then((r) => { - frappe.model.set_value(dt, dn, "unit", r.message.unit); + xhiveframework.db.get_value(doctype, doc_name, "unit").then((r) => { + xhiveframework.model.set_value(dt, dn, "unit", r.message.unit); }); - frappe.db.get_value(doctype, doc_name, "property").then((r) => { - frappe.model.set_value(dt, dn, "property", r.message.property); + xhiveframework.db.get_value(doctype, doc_name, "property").then((r) => { + xhiveframework.model.set_value(dt, dn, "property", r.message.property); }); } },