diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..ce2d0c74 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,106 @@ + +name: CI + +on: + push: + branches: + - develop + pull_request: + +concurrency: + group: develop-csf_tz-${{ github.event.number }} + cancel-in-progress: true + +jobs: + tests: + runs-on: ubuntu-latest + strategy: + fail-fast: false + name: Server + + services: + redis-cache: + image: redis:alpine + ports: + - 13000:6379 + redis-queue: + image: redis:alpine + ports: + - 11000:6379 + mariadb: + image: mariadb:10.6 + env: + MYSQL_ROOT_PASSWORD: root + ports: + - 3306:3306 + options: --health-cmd="mariadb-admin ping" --health-interval=5s --health-timeout=2s --health-retries=3 + + steps: + - name: Clone + uses: actions/checkout@v3 + + - name: Find tests + run: | + echo "Finding tests" + grep -rn "def test" > /dev/null + + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: '3.10' + + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: 18 + check-latest: true + + - name: Cache pip + uses: actions/cache@v4 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ hashFiles('**/*requirements.txt', '**/pyproject.toml', '**/setup.py', '**/setup.cfg') }} + restore-keys: | + ${{ runner.os }}-pip- + ${{ runner.os }}- + + - name: Get yarn cache directory path + id: yarn-cache-dir-path + run: 'echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT' + + - uses: actions/cache@v4 + id: yarn-cache + with: + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- + + - name: Install MariaDB Client + run: sudo apt-get install mariadb-client-10.6 + + - name: Setup + run: | + pip install frappe-bench + bench init --skip-redis-config-generation --skip-assets --python "$(which python)" ~/frappe-bench + mariadb --host 127.0.0.1 --port 3306 -u root -proot -e "SET GLOBAL character_set_server = 'utf8mb4'" + mariadb --host 127.0.0.1 --port 3306 -u root -proot -e "SET GLOBAL collation_server = 'utf8mb4_unicode_ci'" + + - name: Install + working-directory: /home/runner/frappe-bench + run: | + bench get-app csf_tz $GITHUB_WORKSPACE + bench setup requirements --dev + bench new-site --db-root-password root --admin-password admin test_site + bench --site test_site install-app csf_tz + bench build + env: + CI: 'Yes' + + - name: Run Tests + working-directory: /home/runner/frappe-bench + run: | + bench --site test_site set-config allow_tests true + bench --site test_site run-tests --app csf_tz + env: + TYPE: server diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml new file mode 100644 index 00000000..6d38c64a --- /dev/null +++ b/.github/workflows/linter.yml @@ -0,0 +1,61 @@ + +name: Linters + +on: + pull_request: + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + linter: + name: 'Frappe Linter' + runs-on: ubuntu-latest + if: github.event_name == 'pull_request' + + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: '3.10' + cache: pip + - uses: pre-commit/action@v3.0.0 + + - name: Download Semgrep rules + run: git clone --depth 1 https://github.com/frappe/semgrep-rules.git frappe-semgrep-rules + + - name: Run Semgrep rules + run: | + pip install semgrep + semgrep ci --config ./frappe-semgrep-rules/rules --config r/python.lang.correctness + + deps-vulnerable-check: + name: 'Vulnerable Dependency Check' + runs-on: ubuntu-latest + + steps: + - uses: actions/setup-python@v5 + with: + python-version: '3.10' + + - uses: actions/checkout@v4 + + - name: Cache pip + uses: actions/cache@v3 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ hashFiles('**/*requirements.txt', '**/pyproject.toml', '**/setup.py') }} + restore-keys: | + ${{ runner.os }}-pip- + ${{ runner.os }}- + + - name: Install and run pip-audit + run: | + pip install pip-audit + cd ${GITHUB_WORKSPACE} + pip-audit --desc on . diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..968f3911 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,53 @@ +name: Release + +on: + push: + tags: + - "v*" + workflow_dispatch: + +permissions: + contents: write + +concurrency: + group: release-${{ github.ref }} + cancel-in-progress: true + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: + python-version: "3.10" + + - name: Build package + run: | + python -m pip install --upgrade pip build + python -m build + + - name: Upload build artifacts + uses: actions/upload-artifact@v4 + with: + name: csf_tz-dist + path: dist/* + + publish-release: + if: startsWith(github.ref, 'refs/tags/') + needs: build + runs-on: ubuntu-latest + + steps: + - name: Download build artifacts + uses: actions/download-artifact@v4 + with: + name: csf_tz-dist + path: dist + + - name: Publish GitHub release + uses: softprops/action-gh-release@v2 + with: + files: dist/* diff --git a/README.md b/README.md index 3af1985b..ac956e96 100755 --- a/README.md +++ b/README.md @@ -22,8 +22,9 @@ This repository contains the customizations and configurations necessary to adap ### **Enhanced Inventory and Stock Management** -* **Stock Management Tools** \- Utilise the Item Barcode Update Tool and Dynamic Price List Assignment for precise inventory control. +* **Stock Management Tools** \- Utilise the Item Barcode Update Tool for precise inventory control. * **Inter-Company Stock Transfers** \- Simplify stock movements between branches or entities with the Inter Company Stock Transfer feature. +* **Stock Management Tools** \- Utilise the Item Barcode Update Tool and Dynamic Price List Assignment for precise inventory control. ### **Comprehensive Payroll and HR Management** @@ -32,7 +33,6 @@ This repository contains the customizations and configurations necessary to adap ### **Document and Record Management** -* **Secure Document Handling** \- Manage document attachments securely with Attachment Type and File Attachment features, ensuring safe storage and retrieval. * **Visitor and Vehicle Management** \- Efficiently track visitors and manage vehicle-related activities with Visitors Registration Card, Vehicle Fine Record, and Vehicle Service Log. ### **Localised Data and Settings** @@ -43,7 +43,6 @@ This repository contains the customizations and configurations necessary to adap ### **Project and Maintenance Management** * **Project Tracking** \- Manage projects with tools like Mokasi Project, Mokasi Equipment Name, and Mokasi Activity, ideal for project-based businesses. -* **Maintenance Services** \- Track and manage maintenance requests and services with Maintenance Request and Maintenance Services Table. ### **Automated Reporting and Logs** diff --git a/csf_tz/authotp/__init__.py b/csf_tz/authotp/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/authotp/api/customer.js b/csf_tz/authotp/api/customer.js deleted file mode 100644 index 00231521..00000000 --- a/csf_tz/authotp/api/customer.js +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) 2023, Aakvatech and contributors -// For license information, please see license.txt - -frappe.ui.form.on('Customer', { - refresh: function (frm) { - // Set query for default authotp method - frm.set_query("default_authotp_method", function () { - return { - filters: { - "party_type": "Customer", - "party": frm.doc.name, - "docstatus": 1, - } - }; - }); - }, -}); - diff --git a/csf_tz/authotp/api/sales_invoice.js b/csf_tz/authotp/api/sales_invoice.js deleted file mode 100644 index bad47d91..00000000 --- a/csf_tz/authotp/api/sales_invoice.js +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) 2023, Aakvatech and contributors -// For license information, please see license.txt - -frappe.ui.form.on('Sales Invoice', { - refresh: function (frm) { - // add custom button to validate OTP - if (frm.doc.docstatus == 0 && !frm.doc.authotp_validated) { - frm.add_custom_button(__("Validate OTP"), function () { - // check if doc is not saved - if (frm.is_dirty()) { - frappe.show_alert({ - message: __("Please save the document first"), - indicator: 'red' - }); - return; - } - // show popup to validate OTP - show_popup_for_otp_validation(frm); - }); - } - frm.set_query("authotp_method", function () { - return { - filters: { - "party_type": "Customer", - "party": frm.doc.customer, - "docstatus": 1, - } - }; - }); - }, - customer: function (frm) { - // clear authotp_method and authotp_validated fields on customer change - frm.set_value("authotp_validated", 0); - } -}); - -function show_popup_for_otp_validation (frm) { - // show popup to dispaly QR code and validate OTP - const fields = [ - { - "fieldtype": "Data", - "fieldname": "otp_code", - "label": __("OTP Code"), - "reqd": 1 - } - ]; - const d = new frappe.ui.Dialog({ - title: __("Validate OTP"), - fields: fields - }); - d.set_primary_action(__("Validate OTP"), function () { - if (!frm.doc.authotp_method) { - frappe.show_alert({ - message: __("Please set AuthOTP Method in the document"), - indicator: 'red' - }); - return; - } - const otp_code = d.get_value("otp_code"); - if (otp_code) { - frappe.call({ - method: "csf_tz.authotp.doctype.otp_register.otp_register.validate_doc_otp", - args: { - "otp_register_name": frm.doc.authotp_method, - "otp_code": otp_code - }, - callback: function (r) { - if (r.message) { - frappe.show_alert({ - message: __("OTP Validated Successfully"), - indicator: 'green' - }); - frm.set_value("authotp_validated", 1); - d.hide(); - frm.save(); - // frm.reload_doc(); - } - } - }); - } - }); - d.show(); -} diff --git a/csf_tz/authotp/api/sales_invoice.py b/csf_tz/authotp/api/sales_invoice.py deleted file mode 100644 index 664074dc..00000000 --- a/csf_tz/authotp/api/sales_invoice.py +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright (c) 2023, Aakvatech and contributors -# For license information, please see license.txt - - -import frappe -from frappe import _ - -def before_submit(doc, method): - settings = frappe.get_single("AuthOTP Settings") - if not settings: - frappe.msgprint(_("Please configure AuthOTP Settings"), title=_("AuthOTP Settings"), indicator="red", alert=True) - return - - is_authotp_applied = frappe.get_cached_value("Customer", doc.customer, "is_authotp_applied") - otp_active = settings.get("active") - if otp_active and is_authotp_applied and not doc.authotp_validated: - frappe.throw(_("OTP not validated, please validated OTP first")) \ No newline at end of file diff --git a/csf_tz/authotp/doctype/__init__.py b/csf_tz/authotp/doctype/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/authotp/doctype/authotp_settings/__init__.py b/csf_tz/authotp/doctype/authotp_settings/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/authotp/doctype/authotp_settings/authotp_settings.js b/csf_tz/authotp/doctype/authotp_settings/authotp_settings.js deleted file mode 100644 index 2cbd0e7d..00000000 --- a/csf_tz/authotp/doctype/authotp_settings/authotp_settings.js +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright (c) 2023, Aakvatech and contributors -// For license information, please see license.txt - -frappe.ui.form.on('AuthOTP Settings', { - // refresh: function(frm) { - - // } -}); diff --git a/csf_tz/authotp/doctype/authotp_settings/authotp_settings.json b/csf_tz/authotp/doctype/authotp_settings/authotp_settings.json deleted file mode 100644 index c14d096c..00000000 --- a/csf_tz/authotp/doctype/authotp_settings/authotp_settings.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "actions": [], - "allow_rename": 1, - "creation": "2023-03-07 00:18:27.873682", - "default_view": "List", - "doctype": "DocType", - "editable_grid": 1, - "engine": "InnoDB", - "field_order": [ - "active", - "otp_issuer_name" - ], - "fields": [ - { - "default": "Aakvatech Limited", - "fieldname": "otp_issuer_name", - "fieldtype": "Data", - "in_list_view": 1, - "label": "OTP Issuer Name", - "reqd": 1 - }, - { - "default": "0", - "fieldname": "active", - "fieldtype": "Check", - "label": "Active" - } - ], - "index_web_pages_for_search": 1, - "issingle": 1, - "links": [], - "modified": "2023-03-10 22:29:37.951688", - "modified_by": "Administrator", - "module": "AuthOTP", - "name": "AuthOTP Settings", - "owner": "Administrator", - "permissions": [ - { - "create": 1, - "delete": 1, - "email": 1, - "print": 1, - "read": 1, - "role": "System Manager", - "share": 1, - "write": 1 - } - ], - "sort_field": "modified", - "sort_order": "DESC", - "states": [] -} \ No newline at end of file diff --git a/csf_tz/authotp/doctype/authotp_settings/authotp_settings.py b/csf_tz/authotp/doctype/authotp_settings/authotp_settings.py deleted file mode 100644 index 24651853..00000000 --- a/csf_tz/authotp/doctype/authotp_settings/authotp_settings.py +++ /dev/null @@ -1,8 +0,0 @@ -# Copyright (c) 2023, Aakvatech and contributors -# For license information, please see license.txt - -# import frappe -from frappe.model.document import Document - -class AuthOTPSettings(Document): - pass diff --git a/csf_tz/authotp/doctype/authotp_settings/test_authotp_settings.py b/csf_tz/authotp/doctype/authotp_settings/test_authotp_settings.py deleted file mode 100644 index 08e97169..00000000 --- a/csf_tz/authotp/doctype/authotp_settings/test_authotp_settings.py +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (c) 2023, Aakvatech and Contributors -# See license.txt - -# import frappe -from frappe.tests.utils import FrappeTestCase - - -class TestAuthOTPSettings(FrappeTestCase): - pass diff --git a/csf_tz/authotp/doctype/otp_register/__init__.py b/csf_tz/authotp/doctype/otp_register/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/authotp/doctype/otp_register/otp_register.js b/csf_tz/authotp/doctype/otp_register/otp_register.js deleted file mode 100644 index 3aeb9692..00000000 --- a/csf_tz/authotp/doctype/otp_register/otp_register.js +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright (c) 2023, Aakvatech and contributors -// For license information, please see license.txt - -frappe.ui.form.on('OTP Register', { - refresh: function (frm) { - // set filter for on party_type field - frm.set_query("party_type", function () { - return { - filters: { - "name": ["in", ["Customer", "Supplier", "Employee", "User", "Lead", "Student", "Guardian", "Instructor", "Member", "Sales Partner", "Sales Person", "Teacher", "Tenant", "Visitor", "Patient"]] - } - }; - }); - // if not Validate == 1 add custom button to validate OTP - if (!frm.doc.registered && frm.doc.party_type && frm.doc.party && frm.doc.docstatus == 0) { - frm.add_custom_button(__("Register OTP"), function () { - // check if doc is not saved - if (frm.is_dirty()) { - frappe.show_alert({ - message: __("Please save the document first"), - indicator: 'red' - }); - return; - } - frappe.call({ - method: "csf_tz.authotp.doctype.otp_register.otp_register.register_otp", - args: { - "otp_doc": frm.doc - }, - callback: function (r) { - if (r.message) { - show_popup_for_otp_validation(frm, r.message); - } - } - }); - }); - } - - }, - party_type: function (frm) { - // clear party, party_name and user_name fields - frm.set_value("party", ""); - frm.set_value("party_name", ""); - frm.set_value("user_name", ""); - }, -}); - - -function show_popup_for_otp_validation (frm, qr_code_link) { - // show popup to dispaly QR code and validate OTP - const fields = [ - { - "fieldtype": "Data", - "fieldname": "otp_code", - "label": __("OTP Code"), - "reqd": 1 - }, - { - "fieldtype": "Button", - "fieldname": "validate_otp", - "label": __("Validate OTP"), - "click": function () { - // validate OTP - validate_otp(frm, d); - } - }, - ]; - if (qr_code_link) { - // add field to show QR code image as first field - fields.unshift({ - "fieldtype": "HTML", - "fieldname": "qr_code", - "label": __("QR Code"), - "options": `` - - }); - } - var d = new frappe.ui.Dialog({ - title: __("Validate OTP"), - fields: fields, - }); - d.show(); -} - -function validate_otp (frm, d) { - // validate OTP - frappe.call({ - method: "csf_tz.authotp.doctype.otp_register.otp_register.validate_otp", - args: { - "otp_doc": frm.doc, - "otp_code": d.get_value("otp_code"), - "submit": true - }, - callback: function (r) { - if (r.message) { - frm.reload_doc(); - // close popup - d.hide(); - } - } - }); -} \ No newline at end of file diff --git a/csf_tz/authotp/doctype/otp_register/otp_register.json b/csf_tz/authotp/doctype/otp_register/otp_register.json deleted file mode 100644 index 6b4c4c94..00000000 --- a/csf_tz/authotp/doctype/otp_register/otp_register.json +++ /dev/null @@ -1,161 +0,0 @@ -{ - "actions": [], - "autoname": "OTPR-.YY.-.MM.-.######", - "creation": "2023-03-06 14:11:31.898807", - "default_view": "List", - "doctype": "DocType", - "editable_grid": 1, - "engine": "InnoDB", - "field_order": [ - "party_type", - "party", - "party_name", - "user_name", - "column_break_v9xc2", - "disabled", - "otp_type", - "otp_secret", - "registered", - "amended_from" - ], - "fields": [ - { - "fieldname": "party_type", - "fieldtype": "Link", - "in_list_view": 1, - "in_preview": 1, - "in_standard_filter": 1, - "label": "Party Type", - "options": "DocType" - }, - { - "fieldname": "party", - "fieldtype": "Dynamic Link", - "in_list_view": 1, - "in_preview": 1, - "in_standard_filter": 1, - "label": "Party", - "options": "party_type", - "reqd": 1 - }, - { - "fieldname": "party_name", - "fieldtype": "Data", - "in_list_view": 1, - "in_preview": 1, - "in_standard_filter": 1, - "label": "Party Name", - "read_only": 1 - }, - { - "fieldname": "user_name", - "fieldtype": "Data", - "in_list_view": 1, - "in_preview": 1, - "in_standard_filter": 1, - "label": "User Name" - }, - { - "fieldname": "column_break_v9xc2", - "fieldtype": "Column Break" - }, - { - "fieldname": "otp_type", - "fieldtype": "Select", - "in_list_view": 1, - "in_preview": 1, - "in_standard_filter": 1, - "label": "OTP Type", - "options": "\nOTP APP\nSMS\nEmail", - "reqd": 1 - }, - { - "fieldname": "otp_secret", - "fieldtype": "Password", - "label": "OTP Secret", - "no_copy": 1, - "read_only": 1 - }, - { - "default": "0", - "fieldname": "registered", - "fieldtype": "Check", - "in_list_view": 1, - "in_preview": 1, - "in_standard_filter": 1, - "label": "Registered", - "no_copy": 1, - "read_only": 1 - }, - { - "fieldname": "amended_from", - "fieldtype": "Link", - "label": "Amended From", - "no_copy": 1, - "options": "OTP Register", - "print_hide": 1, - "read_only": 1 - }, - { - "allow_on_submit": 1, - "default": "0", - "depends_on": "eval:doc.docstatus == 1", - "fieldname": "disabled", - "fieldtype": "Check", - "label": "Disabled" - } - ], - "index_web_pages_for_search": 1, - "is_submittable": 1, - "links": [], - "modified": "2023-03-21 23:16:56.250511", - "modified_by": "Administrator", - "module": "AuthOTP", - "name": "OTP Register", - "naming_rule": "Expression (old style)", - "owner": "Administrator", - "permissions": [ - { - "create": 1, - "delete": 1, - "email": 1, - "export": 1, - "print": 1, - "read": 1, - "report": 1, - "role": "System Manager", - "share": 1, - "write": 1 - }, - { - "create": 1, - "delete": 1, - "email": 1, - "export": 1, - "print": 1, - "read": 1, - "report": 1, - "role": "Accounts Manager", - "share": 1, - "write": 1 - }, - { - "create": 1, - "delete": 1, - "email": 1, - "export": 1, - "print": 1, - "read": 1, - "report": 1, - "role": "Sales Manager", - "share": 1, - "write": 1 - } - ], - "search_fields": "party, party_name, user_name", - "show_title_field_in_link": 1, - "sort_field": "modified", - "sort_order": "DESC", - "states": [], - "title_field": "party" -} \ No newline at end of file diff --git a/csf_tz/authotp/doctype/otp_register/otp_register.py b/csf_tz/authotp/doctype/otp_register/otp_register.py deleted file mode 100644 index bcf8cf76..00000000 --- a/csf_tz/authotp/doctype/otp_register/otp_register.py +++ /dev/null @@ -1,159 +0,0 @@ -# Copyright (c) 2023, Aakvatech and contributors -# For license information, please see license.txt - - -import pyotp -import frappe -from frappe import _ -from frappe.model.document import Document - - -class OTPRegister(Document): - def before_insert(self): - self.registered = 0 - self.set_otp_secret() - - def validate(self): - self.set_party_name() - - def on_submit(self): - if not self.registered: - frappe.throw(_("OTP not registered, please register OTP first")) - - def set_party_name(self): - if not self.party: - return - if self.party_type == "Customer": - self.party_name = frappe.get_cached_value( - "Customer", self.party, "customer_name" - ) - elif self.party_type == "Supplier": - self.party_name = frappe.get_cached_value( - "Supplier", self.party, "supplier_name" - ) - elif self.party_type == "Employee": - self.party_name = frappe.get_cached_value( - "Employee", self.party, "employee_name" - ) - elif self.party_type == "User": - self.party_name = frappe.get_cached_value("User", self.party, "full_name") - elif self.party_type == "Contact": - self.party_name = frappe.get_cached_value( - "Contact", self.party, "first_name" - ) - elif self.party_type == "Lead": - self.party_name = frappe.get_cached_value("Lead", self.party, "lead_name") - elif self.party_type == "Sales Partner": - self.party_name = self.party - elif self.party_type == "Student": - first_name, middle_name, last_name = frappe.get_cached_value( - "Student", self.party, ["first_name", "middle_name", "last_name"] - ) - self.party_name = " ".join( - filter(None, [first_name, middle_name, last_name]) - ) - elif self.party_type == "Guardian": - self.party_name = frappe.get_cached_value( - "Guardian", self.party, "guardian_name" - ) - elif self.party_type == "Donor": - self.party_name = frappe.get_cached_value("Donor", self.party, "donor_name") - elif self.party_type == "Member": - self.party_name = frappe.get_cached_value( - "Member", self.party, "member_name" - ) - elif self.party_type == "Patient": - self.party_name = frappe.get_cached_value( - "Patient", self.party, "patient_name" - ) - elif self.party_type == "Instructor": - self.party_name = frappe.get_cached_value( - "Instructor", self.party, "instructor_name" - ) - elif self.party_type == "Sales Person": - self.party_name = frappe.get_cached_value( - "Sales Person", self.party, "sales_person_name" - ) - elif self.party_type == "Teacher": - self.party_name = frappe.get_cached_value( - "Teacher", self.party, "teacher_name" - ) - elif self.party_type == "Tenant": - self.party_name = frappe.get_cached_value( - "Tenant", self.party, "tenant_name" - ) - elif self.party_type == "Visitor": - self.party_name = frappe.get_cached_value( - "Visitor", self.party, "visitor_name" - ) - - if not self.party_name: - self.party_name = self.party - - if not self.user_name: - self.user_name = self.party_name - - def set_otp_secret(self): - self.otp_secret = pyotp.random_base32() - - def get_otp_secret(self): - return self.get_password("otp_secret") - - -@frappe.whitelist() -def register_otp(otp_doc): - otp_doc = frappe._dict(frappe.parse_json(otp_doc)) - otp_doc = frappe.get_doc(otp_doc) - if otp_doc.docstatus == 1: - frappe.throw(_("Document is already submitted")) - if otp_doc.registered: - frappe.throw(_("OTP already registered")) - if otp_doc.otp_type == "OTP APP": - return register_otp_app(otp_doc) - elif otp_doc.otp_type == "SMS": - return register_otp_sms(otp_doc) - elif otp_doc.otp_type == "Email": - return register_otp_email(otp_doc) - - -def register_otp_sms(otp_doc=None): - frappe.throw(_("SMS OTP not implemented")) - return - - -def register_otp_email(otp_doc=None): - frappe.throw(_("Email OTP not implemented")) - return - - -def register_otp_app(otp_doc): - issuer_name = frappe.get_cached_value("AuthOTP Settings", "AuthOTP Settings", "otp_issuer_name") - uri = pyotp.totp.TOTP(otp_doc.get_otp_secret()).provisioning_uri(name= f"( {otp_doc.user_name} )", issuer_name=issuer_name) - qr_link = f"https://api.qrserver.com/v1/create-qr-code/?data={uri}&size=220x220&margin=0" - return qr_link - - -@frappe.whitelist() -def validate_otp(otp_doc, otp_code, submit=False): - otp_doc = frappe._dict(frappe.parse_json(otp_doc)) - otp_doc = frappe.get_doc(otp_doc) - totp = pyotp.TOTP(otp_doc.get_otp_secret()) - if totp.verify(otp_code): - otp_doc.registered = 1 - otp_doc.save() - if submit: - otp_doc.submit() - frappe.msgprint(_("OTP Registered successfully"), alert=True) - return True - else: - frappe.throw(_("Invalid OTP Code")) - - -@frappe.whitelist() -def validate_doc_otp(otp_register_name, otp_code): - otp_doc = frappe.get_cached_doc("OTP Register", otp_register_name) - totp = pyotp.TOTP(otp_doc.get_otp_secret()) - if totp.verify(otp_code): - return True - else: - frappe.throw(_("Invalid OTP Code")) \ No newline at end of file diff --git a/csf_tz/authotp/doctype/otp_register/test_otp_register.py b/csf_tz/authotp/doctype/otp_register/test_otp_register.py deleted file mode 100644 index 2fbd3d2c..00000000 --- a/csf_tz/authotp/doctype/otp_register/test_otp_register.py +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (c) 2023, Aakvatech and Contributors -# See license.txt - -# import frappe -from frappe.tests.utils import FrappeTestCase - - -class TestOTPRegister(FrappeTestCase): - pass diff --git a/csf_tz/config/csf_tz.py b/csf_tz/config/csf_tz.py index 590550c2..274c5385 100644 --- a/csf_tz/config/csf_tz.py +++ b/csf_tz/config/csf_tz.py @@ -89,18 +89,6 @@ def get_data(): "doctype": "Sales Invoice", "is_query_report": True }, - { - "type": "report", - "name": "Purchase Reports by Tax Category", - "doctype": "Purchase Invoice", - "is_query_report": True - }, - { - "type": "report", - "name": "Purchases by Tax Category Summary", - "doctype": "Purchase Invoice", - "is_query_report": True - }, ], }, { diff --git a/csf_tz/config/hr.py b/csf_tz/config/hr.py deleted file mode 100644 index 6922e116..00000000 --- a/csf_tz/config/hr.py +++ /dev/null @@ -1,21 +0,0 @@ -from __future__ import unicode_literals -from frappe import _ - -def get_data(): - return [ - { - "label": _("Piecework"), - "items": [ - { - "label": "Piecework Type", - "name": "Piecework Type", - "type": "doctype" - }, - { - "label": "Piecework", - "name": "Piecework", - "type": "doctype" - } - ] - } - ] \ No newline at end of file diff --git a/csf_tz/config/payroll.py b/csf_tz/config/payroll.py deleted file mode 100644 index 6922e116..00000000 --- a/csf_tz/config/payroll.py +++ /dev/null @@ -1,21 +0,0 @@ -from __future__ import unicode_literals -from frappe import _ - -def get_data(): - return [ - { - "label": _("Piecework"), - "items": [ - { - "label": "Piecework Type", - "name": "Piecework Type", - "type": "doctype" - }, - { - "label": "Piecework", - "name": "Piecework", - "type": "doctype" - } - ] - } - ] \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/attachment_type/__init__.py b/csf_tz/csf_tz/doctype/attachment_type/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/csf_tz/doctype/attachment_type/attachment_type.js b/csf_tz/csf_tz/doctype/attachment_type/attachment_type.js deleted file mode 100644 index 8286b7eb..00000000 --- a/csf_tz/csf_tz/doctype/attachment_type/attachment_type.js +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright (c) 2020, Aakvatech and contributors -// For license information, please see license.txt - -frappe.ui.form.on('Attachment Type', { - // refresh: function(frm) { - - // } -}); diff --git a/csf_tz/csf_tz/doctype/attachment_type/attachment_type.json b/csf_tz/csf_tz/doctype/attachment_type/attachment_type.json deleted file mode 100644 index 72c8efb8..00000000 --- a/csf_tz/csf_tz/doctype/attachment_type/attachment_type.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "autoname": "field:description", - "creation": "2020-10-26 15:27:00.269115", - "doctype": "DocType", - "editable_grid": 1, - "engine": "InnoDB", - "field_order": [ - "description" - ], - "fields": [ - { - "fieldname": "description", - "fieldtype": "Data", - "label": "Description", - "unique": 1 - } - ], - "modified": "2020-10-28 09:24:26.104263", - "modified_by": "Administrator", - "module": "CSF TZ", - "name": "Attachment Type", - "name_case": "Title Case", - "owner": "Administrator", - "permissions": [ - { - "create": 1, - "delete": 1, - "email": 1, - "export": 1, - "print": 1, - "read": 1, - "report": 1, - "role": "System Manager", - "share": 1, - "write": 1 - } - ], - "quick_entry": 1, - "sort_field": "modified", - "sort_order": "DESC", - "track_changes": 1 -} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/attachment_type/attachment_type.py b/csf_tz/csf_tz/doctype/attachment_type/attachment_type.py deleted file mode 100644 index d177101b..00000000 --- a/csf_tz/csf_tz/doctype/attachment_type/attachment_type.py +++ /dev/null @@ -1,10 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (c) 2020, Aakvatech and contributors -# For license information, please see license.txt - -from __future__ import unicode_literals -# import frappe -from frappe.model.document import Document - -class AttachmentType(Document): - pass diff --git a/csf_tz/csf_tz/doctype/attachment_type/test_attachment_type.py b/csf_tz/csf_tz/doctype/attachment_type/test_attachment_type.py deleted file mode 100644 index d5becdad..00000000 --- a/csf_tz/csf_tz/doctype/attachment_type/test_attachment_type.py +++ /dev/null @@ -1,10 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (c) 2020, Aakvatech and Contributors -# See license.txt -from __future__ import unicode_literals - -# import frappe -import unittest - -class TestAttachmentType(unittest.TestCase): - pass diff --git a/csf_tz/csf_tz/doctype/bom_additional_costs/__init__.py b/csf_tz/csf_tz/doctype/bom_additional_costs/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/csf_tz/doctype/bom_additional_costs/bom_additional_costs.json b/csf_tz/csf_tz/doctype/bom_additional_costs/bom_additional_costs.json deleted file mode 100644 index 16ece1f9..00000000 --- a/csf_tz/csf_tz/doctype/bom_additional_costs/bom_additional_costs.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "actions": [], - "allow_rename": 1, - "creation": "2024-07-15 15:17:40.248080", - "default_view": "List", - "doctype": "DocType", - "editable_grid": 1, - "engine": "InnoDB", - "field_order": [ - "cost_type", - "cost_per_unit", - "expense_account" - ], - "fields": [ - { - "fieldname": "cost_type", - "fieldtype": "Data", - "in_list_view": 1, - "label": "Cost Type", - "reqd": 1 - }, - { - "fieldname": "cost_per_unit", - "fieldtype": "Currency", - "in_list_view": 1, - "label": "Cost Per Unit", - "reqd": 1 - }, - { - "fieldname": "expense_account", - "fieldtype": "Link", - "in_list_view": 1, - "label": "Expense Account", - "options": "Account", - "reqd": 1 - } - ], - "index_web_pages_for_search": 1, - "istable": 1, - "links": [], - "modified": "2024-07-15 15:17:40.248080", - "modified_by": "Administrator", - "module": "CSF TZ", - "name": "BOM Additional Costs", - "owner": "Administrator", - "permissions": [], - "sort_field": "modified", - "sort_order": "DESC", - "states": [] -} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/bom_additional_costs/bom_additional_costs.py b/csf_tz/csf_tz/doctype/bom_additional_costs/bom_additional_costs.py deleted file mode 100644 index f168e161..00000000 --- a/csf_tz/csf_tz/doctype/bom_additional_costs/bom_additional_costs.py +++ /dev/null @@ -1,8 +0,0 @@ -# Copyright (c) 2024, Aakvatech and contributors -# For license information, please see license.txt - -# import frappe -from frappe.model.document import Document - -class BOMAdditionalCosts(Document): - pass diff --git a/csf_tz/csf_tz/doctype/csf_tz_settings/csf_tz_settings.json b/csf_tz/csf_tz/doctype/csf_tz_settings/csf_tz_settings.json index 4c438468..d00f23fc 100644 --- a/csf_tz/csf_tz/doctype/csf_tz_settings/csf_tz_settings.json +++ b/csf_tz/csf_tz/doctype/csf_tz_settings/csf_tz_settings.json @@ -8,7 +8,6 @@ "unique_records", "validate_net_rate", "fetch_default_tax_category", - "enable_dependent_auto_permission", "limit_uom_as_item_uom", "show_customer_outstanding_in_sales_order", "allow_reopen_of_po_based_on_role", @@ -16,7 +15,6 @@ "allow_reopen_of_material_request_based_on_role", "role_to_reopen_material_request", "disable_get_outstanding_functionality", - "allow_inter_company_stock_transfer", "column_break_3", "auto_pos_for_role", "is_manufacture", @@ -24,7 +22,6 @@ "allow_batch_splitting", "item_qty_poppup_message", "validate_grand_total_vs_payment_amount_on_sales_invoice", - "target_warehouse_based_price_list", "enable_write_off_jv_si", "auto_stock_reconciliation", "enable_write_off_jv_pi", @@ -131,12 +128,6 @@ "fieldtype": "Button", "label": "Start SLE GLE Reporting" }, - { - "default": "1", - "fieldname": "enable_dependent_auto_permission", - "fieldtype": "Check", - "label": "Enable Dependent Auto Permission" - }, { "default": "0", "description": "if ticked, a popup message showing description will appear on sales invoice when item qty remaining is less to 0", @@ -220,12 +211,6 @@ "fieldtype": "Check", "label": "Override Fetch Shift Details" }, - { - "default": "0", - "fieldname": "target_warehouse_based_price_list", - "fieldtype": "Check", - "label": "Enable Target Warehouse Based Buying Price List" - }, { "default": "0", "fieldname": "override_salary_slip_email_message", @@ -361,12 +346,6 @@ "label": "TZ Regions Data Populated", "read_only": 1 }, - { - "default": "0", - "fieldname": "allow_inter_company_stock_transfer", - "fieldtype": "Check", - "label": "Allow Inter company stock transfer" - }, { "default": "0", "fieldname": "enable_write_off_jv_si", @@ -494,4 +473,4 @@ "sort_order": "DESC", "states": [], "track_changes": 1 -} \ No newline at end of file +} diff --git a/csf_tz/csf_tz/doctype/delivery_exchange_item/__init__.py b/csf_tz/csf_tz/doctype/delivery_exchange_item/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/csf_tz/doctype/delivery_exchange_item/delivery_exchange_item.js b/csf_tz/csf_tz/doctype/delivery_exchange_item/delivery_exchange_item.js deleted file mode 100644 index 16d7c1c5..00000000 --- a/csf_tz/csf_tz/doctype/delivery_exchange_item/delivery_exchange_item.js +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright (c) 2024, Aakvatech and contributors -// For license information, please see license.txt - -frappe.ui.form.on('Delivery Exchange Item', { - refresh: (frm) => { - frm.set_query("item_exchange", "stock_items", function () { - var data = { - filters: { - 'is_stock_item': 1, - } - }; - return data - }); - frm.set_query("item_exchange", "non_stock_items", function () { - var data = { - filters: { - 'is_stock_item': 0, - } - }; - return data - }); - }, - - ref_docname: (frm) => { - if (frm.doc.ref_docname) { - fetch_item_details(frm) - } - } - -}); - -function fetch_item_details(frm) { - frappe.call({ - method: 'csf_tz.csf_tz.doctype.delivery_exchange_item.delivery_exchange_item.get_item_details', - args: { - 'doctype': frm.doc.ref_doctype, - 'doctype_id': frm.doc.ref_docname, - 'packed': false, - // 'item_code': row.item_sold_or_delivered, - }, - callback: function (r) { - if (!r.exc) { - console.log(r.message); - frm.doc.stock_items = [] - frm.doc.non_stock_items = [] - frm.refresh_field("stock_items"); - frm.refresh_field("non_stock_items"); - for (let d of r.message) { - if (d.is_stock_item) { - let row = frm.add_child("stock_items", { - "item_sold_or_delivered": d.item_code, - "amount_exchange": d.amount, - "warehouse": d.warehouse, - "qty_sold_or_delivered": d.qty, - "rate_sold_or_delivered": d.rate, - "uom": d.uom, - "amount_sold_or_delivered": d.amount, - }); - } else { - let row = frm.add_child("non_stock_items", { - "item_sold_or_delivered": d.item_code, - "amount_exchange": d.amount, - "warehouse": d.warehouse, - "qty_sold_or_delivered": d.qty, - "rate_sold_or_delivered": d.rate, - "uom": d.uom, - "amount_sold_or_delivered": d.amount, - }); - } - - frm.refresh_field("stock_items"); - frm.refresh_field("non_stock_items"); - } - } - } - }); -} - - diff --git a/csf_tz/csf_tz/doctype/delivery_exchange_item/delivery_exchange_item.json b/csf_tz/csf_tz/doctype/delivery_exchange_item/delivery_exchange_item.json deleted file mode 100644 index 0d72c1c2..00000000 --- a/csf_tz/csf_tz/doctype/delivery_exchange_item/delivery_exchange_item.json +++ /dev/null @@ -1,121 +0,0 @@ -{ - "actions": [], - "allow_rename": 1, - "autoname": "format:DEI-{YYYY}-{####}", - "creation": "2024-01-02 11:08:07.241357", - "default_view": "List", - "doctype": "DocType", - "editable_grid": 1, - "engine": "InnoDB", - "field_order": [ - "company", - "section_break_5c7ku", - "ref_doctype", - "column_break_4tsfy", - "ref_docname", - "section_break_cslzt", - "stock_items", - "non_stock_items", - "section_break_ade0i", - "remarks", - "column_break_qw1gs", - "amended_from" - ], - "fields": [ - { - "fieldname": "column_break_4tsfy", - "fieldtype": "Column Break" - }, - { - "fieldname": "section_break_cslzt", - "fieldtype": "Section Break" - }, - { - "fieldname": "company", - "fieldtype": "Link", - "in_list_view": 1, - "label": "Company", - "options": "Company", - "reqd": 1 - }, - { - "fieldname": "section_break_5c7ku", - "fieldtype": "Section Break" - }, - { - "fieldname": "remarks", - "fieldtype": "Text", - "label": "Remarks", - "max_height": "60px" - }, - { - "fieldname": "column_break_qw1gs", - "fieldtype": "Column Break" - }, - { - "fieldname": "section_break_ade0i", - "fieldtype": "Section Break" - }, - { - "fieldname": "stock_items", - "fieldtype": "Table", - "label": "Stock Items", - "options": "Delivery Exchange Item Details" - }, - { - "fieldname": "non_stock_items", - "fieldtype": "Table", - "label": "Non Stock Items", - "options": "Delivery Exchange Non Stock Item Details" - }, - { - "fieldname": "amended_from", - "fieldtype": "Link", - "label": "Amended From", - "no_copy": 1, - "options": "Delivery Exchange Item", - "print_hide": 1, - "read_only": 1 - }, - { - "fieldname": "ref_doctype", - "fieldtype": "Select", - "label": "Reference Doctype", - "options": "Sales Invoice\nDelivery Note" - }, - { - "fieldname": "ref_docname", - "fieldtype": "Dynamic Link", - "in_list_view": 1, - "label": "Reference Docname", - "options": "ref_doctype", - "reqd": 1 - } - ], - "index_web_pages_for_search": 1, - "is_submittable": 1, - "links": [], - "modified": "2024-09-23 12:38:40.465860", - "modified_by": "Administrator", - "module": "CSF TZ", - "name": "Delivery Exchange Item", - "naming_rule": "Expression", - "owner": "Administrator", - "permissions": [ - { - "create": 1, - "delete": 1, - "email": 1, - "export": 1, - "print": 1, - "read": 1, - "report": 1, - "role": "System Manager", - "share": 1, - "write": 1 - } - ], - "sort_field": "modified", - "sort_order": "DESC", - "states": [] -} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/delivery_exchange_item/delivery_exchange_item.py b/csf_tz/csf_tz/doctype/delivery_exchange_item/delivery_exchange_item.py deleted file mode 100644 index b7639769..00000000 --- a/csf_tz/csf_tz/doctype/delivery_exchange_item/delivery_exchange_item.py +++ /dev/null @@ -1,123 +0,0 @@ -# Copyright (c) 2024, Aakvatech and contributors -# For license information, please see license.txt - -import frappe -from frappe.model.document import Document -from frappe.utils import flt, today - - -class DeliveryExchangeItem(Document): - def validate(self): - msg = "" - - for index, row in enumerate(self.stock_items): - table_name = self.stock_items[0].parentfield.replace("_", " ").title() - validate = get_item_details( - self.ref_doctype, self.ref_docname, item_code=row.item_sold_or_delivered - ) - if not validate: - msg += f"In table {table_name}, Row {index + 1}, Item {row.item_sold_or_delivered} does not exist in {self.ref_doctype} {self.ref_docname}
" - item_exchange_rate = frappe.db.get_value( - "Item Price", - { - "price_list": validate[0].selling_price_list, - "item_code": row.item_exchange, - }, - "price_list_rate", - ) - if (flt(item_exchange_rate) * flt(row.qty_sold_or_delivered)) != flt( - row.amount_sold_or_delivered - ): - msg += f"In table {table_name}, Row {index + 1}, Amounts for Item {row.item_sold_or_delivered} and {row.item_exchange} do not match at selling rate {validate[0].selling_price_list}" - - for index, row in enumerate(self.non_stock_items): - table_name = self.non_stock_items[0].parentfield.replace("_", " ").title() - validate = get_item_details( - self.ref_doctype, self.ref_docname, item_code=row.item_sold_or_delivered - ) - if not validate: - msg += f"In table {table_name}, Row {index + 1}, Item {row.item_sold_or_delivered} does not exist in {self.ref_doctype} {self.ref_docname}
" - item_exchange_rate = frappe.db.get_value( - "Item Price", - { - "price_list": validate[0].selling_price_list, - "item_code": row.item_exchange, - }, - "price_list_rate", - ) - if (flt(item_exchange_rate) * flt(row.qty_sold_or_delivered)) != flt( - row.amount_sold_or_delivered - ): - msg += f"In table {table_name}, Row {index + 1}, Amounts for Item {row.item_sold_or_delivered} and {row.item_exchange} do not match at selling rate {validate[0].selling_price_list}" - - if msg: - frappe.throw(f"{msg}") - - def on_submit(self): - stock_items = [] - if len(self.stock_items) > 0: - for row in self.stock_items: - stock_items.append( - { - "s_warehouse": row.warehouse, - "t_warehouse": "", - "item_code": row.item_exchange, - "qty": row.qty_sold_or_delivered, - "basic_rate": row.rate_sold_or_delivered, - "uom": row.uom, - } - ) - stock_items.append( - { - "s_warehouse": "", - "t_warehouse": row.warehouse, - "item_code": row.item_sold_or_delivered, - "qty": row.qty_sold_or_delivered, - "basic_rate": row.rate_sold_or_delivered, - "set_basic_rate_manually": 1, - "uom": row.uom, - "basic_amount": row.amount_sold_or_delivered, - } - ) - doc = frappe.get_doc( - { - "doctype": "Stock Entry", - "company": self.company, - "stock_entry_type": "Delivery Exchange", - "posting_date": today(), - "items": stock_items, - # "ref_doctype": self.doctype, - # "ref_docname": self.name, - } - ) - doc.insert(ignore_permissions=True) - - -@frappe.whitelist() -def get_item_details(doctype, doctype_id, item_code=None): - condition = "" - if item_code: - condition += f"AND cdt.item_code = '{item_code}'" - - return frappe.db.sql( - f""" - SELECT - cdt.item_code, - cdt.amount, - cdt.warehouse, - cdt.qty, - cdt.rate, - cdt.uom, - pdt.selling_price_list, - i.is_stock_item - FROM `tab{doctype}` pdt - INNER JOIN `tab{doctype} Item` cdt - ON pdt.name = cdt.parent - INNER JOIN `tabItem` i - ON i.name = cdt.item_code - WHERE pdt.name = '{doctype_id}' - - {condition} - """, - as_dict=1, - ) diff --git a/csf_tz/csf_tz/doctype/delivery_exchange_item/test_delivery_exchange_item.py b/csf_tz/csf_tz/doctype/delivery_exchange_item/test_delivery_exchange_item.py deleted file mode 100644 index 931c9abe..00000000 --- a/csf_tz/csf_tz/doctype/delivery_exchange_item/test_delivery_exchange_item.py +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (c) 2024, Aakvatech and Contributors -# See license.txt - -# import frappe -from frappe.tests.utils import FrappeTestCase - - -class TestDeliveryExchangeItem(FrappeTestCase): - pass diff --git a/csf_tz/csf_tz/doctype/delivery_exchange_item_details/__init__.py b/csf_tz/csf_tz/doctype/delivery_exchange_item_details/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/csf_tz/doctype/delivery_exchange_item_details/delivery_exchange_item_details.json b/csf_tz/csf_tz/doctype/delivery_exchange_item_details/delivery_exchange_item_details.json deleted file mode 100644 index 6663106f..00000000 --- a/csf_tz/csf_tz/doctype/delivery_exchange_item_details/delivery_exchange_item_details.json +++ /dev/null @@ -1,105 +0,0 @@ -{ - "actions": [], - "allow_rename": 1, - "creation": "2024-01-02 11:18:19.135187", - "default_view": "List", - "doctype": "DocType", - "editable_grid": 1, - "engine": "InnoDB", - "field_order": [ - "item_sold_or_delivered", - "rate_sold_or_delivered", - "qty_sold_or_delivered", - "amount_sold_or_delivered", - "warehouse", - "column_break_frc89", - "item_exchange", - "amount_exchange", - "uom", - "amended_from" - ], - "fields": [ - { - "fieldname": "item_sold_or_delivered", - "fieldtype": "Link", - "in_list_view": 1, - "label": "Item Sold/Delivered", - "options": "Item", - "read_only": 1 - }, - { - "fieldname": "amount_sold_or_delivered", - "fieldtype": "Data", - "in_list_view": 1, - "label": "Amount Sold/Delivered ", - "read_only": 1 - }, - { - "fieldname": "item_exchange", - "fieldtype": "Link", - "in_list_view": 1, - "label": "Item Exchange", - "options": "Item", - "reqd": 1 - }, - { - "fieldname": "amount_exchange", - "fieldtype": "Data", - "in_list_view": 1, - "label": "Amount Exchange", - "read_only": 1 - }, - { - "fieldname": "warehouse", - "fieldtype": "Link", - "label": "Warehouse", - "options": "Warehouse", - "read_only": 1 - }, - { - "fieldname": "rate_sold_or_delivered", - "fieldtype": "Data", - "label": "Rate Sold/Delivered", - "read_only": 1 - }, - { - "fieldname": "qty_sold_or_delivered", - "fieldtype": "Data", - "label": "Qty Sold/Delivered", - "read_only": 1 - }, - { - "fieldname": "column_break_frc89", - "fieldtype": "Column Break" - }, - { - "fieldname": "uom", - "fieldtype": "Link", - "label": "UOM", - "options": "UOM", - "read_only": 1 - }, - { - "fieldname": "amended_from", - "fieldtype": "Link", - "label": "Amended From", - "no_copy": 1, - "options": "Delivery Exchange Item Details", - "print_hide": 1, - "read_only": 1 - } - ], - "index_web_pages_for_search": 1, - "is_submittable": 1, - "istable": 1, - "links": [], - "modified": "2024-01-08 17:30:11.929988", - "modified_by": "Administrator", - "module": "CSF TZ", - "name": "Delivery Exchange Item Details", - "owner": "Administrator", - "permissions": [], - "sort_field": "modified", - "sort_order": "DESC", - "states": [] -} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/delivery_exchange_item_details/delivery_exchange_item_details.py b/csf_tz/csf_tz/doctype/delivery_exchange_item_details/delivery_exchange_item_details.py deleted file mode 100644 index 5100aca3..00000000 --- a/csf_tz/csf_tz/doctype/delivery_exchange_item_details/delivery_exchange_item_details.py +++ /dev/null @@ -1,8 +0,0 @@ -# Copyright (c) 2024, Aakvatech and contributors -# For license information, please see license.txt - -# import frappe -from frappe.model.document import Document - -class DeliveryExchangeItemDetails(Document): - pass diff --git a/csf_tz/csf_tz/doctype/delivery_exchange_non_stock_item_details/__init__.py b/csf_tz/csf_tz/doctype/delivery_exchange_non_stock_item_details/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/csf_tz/doctype/delivery_exchange_non_stock_item_details/delivery_exchange_non_stock_item_details.json b/csf_tz/csf_tz/doctype/delivery_exchange_non_stock_item_details/delivery_exchange_non_stock_item_details.json deleted file mode 100644 index d7b46e0b..00000000 --- a/csf_tz/csf_tz/doctype/delivery_exchange_non_stock_item_details/delivery_exchange_non_stock_item_details.json +++ /dev/null @@ -1,94 +0,0 @@ -{ - "actions": [], - "allow_rename": 1, - "creation": "2024-01-08 12:21:31.843374", - "default_view": "List", - "doctype": "DocType", - "editable_grid": 1, - "engine": "InnoDB", - "field_order": [ - "item_sold_or_delivered", - "rate_sold_or_delivered", - "qty_sold_or_delivered", - "amount_sold_or_delivered", - "warehouse", - "column_break_frc89", - "item_exchange", - "amount_exchange", - "uom" - ], - "fields": [ - { - "fieldname": "item_sold_or_delivered", - "fieldtype": "Link", - "in_list_view": 1, - "label": "Item Sold/Delivered", - "options": "Item", - "read_only": 1 - }, - { - "fieldname": "rate_sold_or_delivered", - "fieldtype": "Data", - "label": "Rate Sold/Delivered", - "read_only": 1 - }, - { - "fieldname": "qty_sold_or_delivered", - "fieldtype": "Data", - "label": "Qty Sold/Delivered", - "read_only": 1 - }, - { - "fieldname": "amount_sold_or_delivered", - "fieldtype": "Data", - "in_list_view": 1, - "label": "Amount Sold/Delivered ", - "read_only": 1 - }, - { - "fieldname": "warehouse", - "fieldtype": "Link", - "label": "Warehouse", - "options": "Warehouse", - "read_only": 1 - }, - { - "fieldname": "column_break_frc89", - "fieldtype": "Column Break" - }, - { - "fieldname": "item_exchange", - "fieldtype": "Link", - "in_list_view": 1, - "label": "Item Exchange", - "options": "Item", - "reqd": 1 - }, - { - "fieldname": "amount_exchange", - "fieldtype": "Data", - "in_list_view": 1, - "label": "Amount Exchange", - "read_only": 1 - }, - { - "fieldname": "uom", - "fieldtype": "Link", - "label": "UOM", - "options": "UOM", - "read_only": 1 - } - ], - "index_web_pages_for_search": 1, - "istable": 1, - "links": [], - "modified": "2024-01-08 15:47:56.471503", - "modified_by": "Administrator", - "module": "CSF TZ", - "name": "Delivery Exchange Non Stock Item Details", - "owner": "Administrator", - "permissions": [], - "sort_field": "modified", - "sort_order": "DESC", - "states": [] -} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/delivery_exchange_non_stock_item_details/delivery_exchange_non_stock_item_details.py b/csf_tz/csf_tz/doctype/delivery_exchange_non_stock_item_details/delivery_exchange_non_stock_item_details.py deleted file mode 100644 index b547961c..00000000 --- a/csf_tz/csf_tz/doctype/delivery_exchange_non_stock_item_details/delivery_exchange_non_stock_item_details.py +++ /dev/null @@ -1,8 +0,0 @@ -# Copyright (c) 2024, Aakvatech and contributors -# For license information, please see license.txt - -# import frappe -from frappe.model.document import Document - -class DeliveryExchangeNonStockItemDetails(Document): - pass diff --git a/csf_tz/csf_tz/doctype/document_attachment/__init__.py b/csf_tz/csf_tz/doctype/document_attachment/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/csf_tz/doctype/document_attachment/document_attachment.json b/csf_tz/csf_tz/doctype/document_attachment/document_attachment.json deleted file mode 100644 index 4bf1037d..00000000 --- a/csf_tz/csf_tz/doctype/document_attachment/document_attachment.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "creation": "2020-10-26 15:28:13.866148", - "doctype": "DocType", - "editable_grid": 1, - "engine": "InnoDB", - "field_order": [ - "document_name", - "document_number", - "issue_date", - "expiry_date", - "attachment" - ], - "fields": [ - { - "columns": 2, - "fieldname": "document_name", - "fieldtype": "Link", - "in_list_view": 1, - "label": "Document Name", - "options": "Attachment Type" - }, - { - "columns": 2, - "fieldname": "document_number", - "fieldtype": "Data", - "in_list_view": 1, - "label": "Document Number" - }, - { - "columns": 1, - "fieldname": "issue_date", - "fieldtype": "Date", - "in_list_view": 1, - "label": "Issue Date" - }, - { - "columns": 1, - "fieldname": "expiry_date", - "fieldtype": "Date", - "in_list_view": 1, - "label": "Expiry Date" - }, - { - "fieldname": "attachment", - "fieldtype": "Attach", - "in_list_view": 1, - "label": "Attachment" - } - ], - "istable": 1, - "modified": "2020-10-28 09:08:31.608278", - "modified_by": "Administrator", - "module": "CSF TZ", - "name": "Document Attachment", - "owner": "Administrator", - "permissions": [], - "quick_entry": 1, - "sort_field": "modified", - "sort_order": "DESC", - "track_changes": 1 -} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/document_attachment/document_attachment.py b/csf_tz/csf_tz/doctype/document_attachment/document_attachment.py deleted file mode 100644 index b9ee29a6..00000000 --- a/csf_tz/csf_tz/doctype/document_attachment/document_attachment.py +++ /dev/null @@ -1,10 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (c) 2020, Aakvatech and contributors -# For license information, please see license.txt - -from __future__ import unicode_literals -# import frappe -from frappe.model.document import Document - -class DocumentAttachment(Document): - pass diff --git a/csf_tz/csf_tz/doctype/dynamic_price_list_assignment/__init__.py b/csf_tz/csf_tz/doctype/dynamic_price_list_assignment/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/csf_tz/doctype/dynamic_price_list_assignment/dynamic_price_list_assignment.js b/csf_tz/csf_tz/doctype/dynamic_price_list_assignment/dynamic_price_list_assignment.js deleted file mode 100644 index e1b6e9e6..00000000 --- a/csf_tz/csf_tz/doctype/dynamic_price_list_assignment/dynamic_price_list_assignment.js +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright (c) 2024, Aakvatech and contributors -// For license information, please see license.txt - -frappe.ui.form.on('Dynamic Price List Assignment', { - // refresh: function(frm) { - - // } -}); diff --git a/csf_tz/csf_tz/doctype/dynamic_price_list_assignment/dynamic_price_list_assignment.json b/csf_tz/csf_tz/doctype/dynamic_price_list_assignment/dynamic_price_list_assignment.json deleted file mode 100644 index e8ccaec1..00000000 --- a/csf_tz/csf_tz/doctype/dynamic_price_list_assignment/dynamic_price_list_assignment.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "actions": [], - "allow_rename": 1, - "autoname": "format:DPLA-{MM}-{YYYY}-{###}", - "creation": "2024-02-23 13:19:59.200936", - "default_view": "List", - "doctype": "DocType", - "editable_grid": 1, - "engine": "InnoDB", - "field_order": [ - "warehouse", - "supplier", - "price_list" - ], - "fields": [ - { - "fieldname": "warehouse", - "fieldtype": "Link", - "in_list_view": 1, - "label": "Warehouse", - "options": "Warehouse", - "reqd": 1 - }, - { - "fieldname": "supplier", - "fieldtype": "Link", - "in_list_view": 1, - "label": "Supplier", - "options": "Supplier", - "reqd": 1 - }, - { - "fieldname": "price_list", - "fieldtype": "Link", - "in_list_view": 1, - "label": "Price List", - "options": "Price List", - "reqd": 1 - } - ], - "index_web_pages_for_search": 1, - "links": [], - "modified": "2024-02-23 21:32:23.267758", - "modified_by": "Administrator", - "module": "CSF TZ", - "name": "Dynamic Price List Assignment", - "naming_rule": "Expression", - "owner": "Administrator", - "permissions": [ - { - "create": 1, - "delete": 1, - "email": 1, - "export": 1, - "print": 1, - "read": 1, - "report": 1, - "role": "System Manager", - "share": 1, - "write": 1 - } - ], - "sort_field": "modified", - "sort_order": "DESC", - "states": [] -} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/dynamic_price_list_assignment/dynamic_price_list_assignment.py b/csf_tz/csf_tz/doctype/dynamic_price_list_assignment/dynamic_price_list_assignment.py deleted file mode 100644 index f99f8292..00000000 --- a/csf_tz/csf_tz/doctype/dynamic_price_list_assignment/dynamic_price_list_assignment.py +++ /dev/null @@ -1,8 +0,0 @@ -# Copyright (c) 2024, Aakvatech and contributors -# For license information, please see license.txt - -# import frappe -from frappe.model.document import Document - -class DynamicPriceListAssignment(Document): - pass diff --git a/csf_tz/csf_tz/doctype/dynamic_price_list_assignment/test_dynamic_price_list_assignment.py b/csf_tz/csf_tz/doctype/dynamic_price_list_assignment/test_dynamic_price_list_assignment.py deleted file mode 100644 index 8a943eb3..00000000 --- a/csf_tz/csf_tz/doctype/dynamic_price_list_assignment/test_dynamic_price_list_assignment.py +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (c) 2024, Aakvatech and Contributors -# See license.txt - -# import frappe -from frappe.tests.utils import FrappeTestCase - - -class TestDynamicPriceListAssignment(FrappeTestCase): - pass diff --git a/csf_tz/csf_tz/doctype/email_employee_salary_slip/__init__.py b/csf_tz/csf_tz/doctype/email_employee_salary_slip/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/csf_tz/doctype/email_employee_salary_slip/email_employee_salary_slip.json b/csf_tz/csf_tz/doctype/email_employee_salary_slip/email_employee_salary_slip.json deleted file mode 100644 index 29765b22..00000000 --- a/csf_tz/csf_tz/doctype/email_employee_salary_slip/email_employee_salary_slip.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "actions": [], - "allow_rename": 1, - "creation": "2022-01-03 10:33:07.861488", - "doctype": "DocType", - "editable_grid": 1, - "engine": "InnoDB", - "field_order": [ - "employee", - "employee_name", - "column_break_3", - "department", - "designation", - "send_email" - ], - "fields": [ - { - "fieldname": "employee", - "fieldtype": "Link", - "in_list_view": 1, - "label": "Employee", - "options": "Employee" - }, - { - "fetch_from": "employee.employee_name", - "fieldname": "employee_name", - "fieldtype": "Data", - "in_list_view": 1, - "label": "Employee Name", - "read_only": 1 - }, - { - "fieldname": "column_break_3", - "fieldtype": "Column Break" - }, - { - "fetch_from": "employee.department", - "fieldname": "department", - "fieldtype": "Link", - "in_list_view": 1, - "label": "Department", - "options": "Department", - "read_only": 1 - }, - { - "fetch_from": "employee.designation", - "fieldname": "designation", - "fieldtype": "Data", - "in_list_view": 1, - "label": "Designation", - "read_only": 1 - }, - { - "default": "0", - "fieldname": "send_email", - "fieldtype": "Check", - "in_list_view": 1, - "label": "Send Email" - } - ], - "index_web_pages_for_search": 1, - "istable": 1, - "links": [], - "modified": "2022-01-03 14:49:29.028819", - "modified_by": "Administrator", - "module": "CSF TZ", - "name": "Email Employee Salary Slip", - "owner": "Administrator", - "permissions": [], - "sort_field": "modified", - "sort_order": "DESC" -} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/email_employee_salary_slip/email_employee_salary_slip.py b/csf_tz/csf_tz/doctype/email_employee_salary_slip/email_employee_salary_slip.py deleted file mode 100644 index facf137f..00000000 --- a/csf_tz/csf_tz/doctype/email_employee_salary_slip/email_employee_salary_slip.py +++ /dev/null @@ -1,8 +0,0 @@ -# Copyright (c) 2022, Aakvatech and contributors -# For license information, please see license.txt - -# import frappe -from frappe.model.document import Document - -class EmailEmployeeSalarySlip(Document): - pass diff --git a/csf_tz/csf_tz/doctype/email_employee_salary_slip/email_salary_slips/__init__.py b/csf_tz/csf_tz/doctype/email_employee_salary_slip/email_salary_slips/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/csf_tz/doctype/email_employee_salary_slip/email_salary_slips/email_salary_slips.js b/csf_tz/csf_tz/doctype/email_employee_salary_slip/email_salary_slips/email_salary_slips.js deleted file mode 100644 index ffc821df..00000000 --- a/csf_tz/csf_tz/doctype/email_employee_salary_slip/email_salary_slips/email_salary_slips.js +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) 2022, Aakvatech and contributors -// For license information, please see license.txt - -frappe.ui.form.on('Email Salary Slips', { - // refresh: function(frm) { - - // } - - // onload: function(frm) { - // frm.get_field("employees").grid.cannot_add_rows = true; - // }, - - setup: function(frm) { - frm.set_query("payroll_entry", function() { - return { - filters: [ - ["Payroll Entry","docstatus", "=", "1"] - ] - } - }); - } -}); diff --git a/csf_tz/csf_tz/doctype/email_employee_salary_slip/email_salary_slips/email_salary_slips.json b/csf_tz/csf_tz/doctype/email_employee_salary_slip/email_salary_slips/email_salary_slips.json deleted file mode 100644 index b8625965..00000000 --- a/csf_tz/csf_tz/doctype/email_employee_salary_slip/email_salary_slips/email_salary_slips.json +++ /dev/null @@ -1,63 +0,0 @@ -{ - "actions": [], - "allow_rename": 1, - "creation": "2022-01-03 10:28:13.710129", - "doctype": "DocType", - "editable_grid": 1, - "engine": "InnoDB", - "field_order": [ - "payroll_entry_section", - "payroll_entry", - "employees_section", - "employees" - ], - "fields": [ - { - "fieldname": "payroll_entry_section", - "fieldtype": "Section Break", - "label": "Payroll Entry" - }, - { - "fieldname": "payroll_entry", - "fieldtype": "Link", - "label": "Payroll Entry", - "options": "Payroll Entry" - }, - { - "fieldname": "employees_section", - "fieldtype": "Section Break", - "label": "Employees" - }, - { - "fieldname": "employees", - "fieldtype": "Table", - "label": "Employee Details", - "options": "Email Employee Salary Slip" - } - ], - "index_web_pages_for_search": 1, - "is_submittable": 1, - "links": [], - "modified": "2022-01-03 10:34:53.384380", - "modified_by": "Administrator", - "module": "CSF TZ", - "name": "Email Salary Slips", - "owner": "Administrator", - "permissions": [ - { - "create": 1, - "delete": 1, - "email": 1, - "export": 1, - "print": 1, - "read": 1, - "report": 1, - "role": "System Manager", - "share": 1, - "write": 1 - } - ], - "sort_field": "modified", - "sort_order": "DESC", - "track_changes": 1 -} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/email_employee_salary_slip/email_salary_slips/email_salary_slips.py b/csf_tz/csf_tz/doctype/email_employee_salary_slip/email_salary_slips/email_salary_slips.py deleted file mode 100644 index a769d25e..00000000 --- a/csf_tz/csf_tz/doctype/email_employee_salary_slip/email_salary_slips/email_salary_slips.py +++ /dev/null @@ -1,8 +0,0 @@ -# Copyright (c) 2022, Aakvatech and contributors -# For license information, please see license.txt - -# import frappe -from frappe.model.document import Document - -class EmailSalarySlips(Document): - pass diff --git a/csf_tz/csf_tz/doctype/email_employee_salary_slip/email_salary_slips/test_email_salary_slips.py b/csf_tz/csf_tz/doctype/email_employee_salary_slip/email_salary_slips/test_email_salary_slips.py deleted file mode 100644 index 89be67d7..00000000 --- a/csf_tz/csf_tz/doctype/email_employee_salary_slip/email_salary_slips/test_email_salary_slips.py +++ /dev/null @@ -1,8 +0,0 @@ -# Copyright (c) 2022, Aakvatech and Contributors -# See license.txt - -# import frappe -import unittest - -class TestEmailSalarySlips(unittest.TestCase): - pass diff --git a/csf_tz/csf_tz/doctype/email_salary_slips/__init__.py b/csf_tz/csf_tz/doctype/email_salary_slips/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/csf_tz/doctype/email_salary_slips/email_salary_slips.js b/csf_tz/csf_tz/doctype/email_salary_slips/email_salary_slips.js deleted file mode 100644 index a8b6421f..00000000 --- a/csf_tz/csf_tz/doctype/email_salary_slips/email_salary_slips.js +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) 2022, Aakvatech and contributors -// For license information, please see license.txt - -frappe.ui.form.on('Email Salary Slips', { - // refresh: function(frm) { - - // } - - onload: function(frm) { - frm.get_field("employees").grid.cannot_add_rows = true; - }, - - setup: function(frm) { - frm.set_query("payroll_entry", function() { - return { - filters: [ - ["Payroll Entry","docstatus", "=", "1"] - ] - } - }); - }, - - "payroll_entry": function(frm) { - frm.doc.employees = [] - refresh_field("employees"); - let payroll_entry = frm.doc.payroll_entry; - if(payroll_entry){ - frappe.call({ - method: "csf_tz.custom_api.validate_payroll_entry_field", - args: {payroll_entry: payroll_entry} - }).done((r) => { - if(r.message == false){ - frm.fields_dict.payroll_entry.set_input(undefined); - frappe.msgprint({ - title: __('Invalid Payroll selection'), - indicator: 'red', - message: __('Please select the submitted Payroll Entry') - }); - } - }) - } - }, - - get_employees: function(frm) { - let payroll_entry = frm.doc.payroll_entry; - if(payroll_entry){ - frappe.call({ - method: "csf_tz.custom_api.get_payroll_employees", - args: {payroll_entry: payroll_entry} - }).done((r) => { - frm.doc.employees = [] - $.each(r.message, function(_i, e){ - let entry = frm.add_child("employees"); - entry.employee = e.employee; - }) - refresh_field("employees") - frm.dirty(); - frm.save(); - frm.refresh(); - }) - } - else{ - frappe.msgprint({ - title: __('Missing Fields'), - indicator: 'red', - message: __('Please select the Payroll Entry field') - }); - } - } -}); diff --git a/csf_tz/csf_tz/doctype/email_salary_slips/email_salary_slips.json b/csf_tz/csf_tz/doctype/email_salary_slips/email_salary_slips.json deleted file mode 100644 index b9946996..00000000 --- a/csf_tz/csf_tz/doctype/email_salary_slips/email_salary_slips.json +++ /dev/null @@ -1,82 +0,0 @@ -{ - "actions": [], - "allow_rename": 1, - "creation": "2022-01-03 10:28:13.710129", - "doctype": "DocType", - "editable_grid": 1, - "engine": "InnoDB", - "field_order": [ - "payroll_entry_section", - "payroll_entry", - "get_employees", - "employees_section", - "employees", - "amended_from" - ], - "fields": [ - { - "fieldname": "payroll_entry_section", - "fieldtype": "Section Break", - "label": "Payroll Entry" - }, - { - "fieldname": "payroll_entry", - "fieldtype": "Link", - "in_list_view": 1, - "label": "Payroll Entry", - "options": "Payroll Entry", - "reqd": 1 - }, - { - "fieldname": "employees_section", - "fieldtype": "Section Break", - "label": "Employees" - }, - { - "fieldname": "employees", - "fieldtype": "Table", - "label": "Employee Details", - "options": "Email Employee Salary Slip" - }, - { - "fieldname": "amended_from", - "fieldtype": "Link", - "label": "Amended From", - "no_copy": 1, - "options": "Email Salary Slips", - "print_hide": 1, - "read_only": 1 - }, - { - "depends_on": "eval: doc.docstatus !== 1", - "fieldname": "get_employees", - "fieldtype": "Button", - "label": "Get Employees" - } - ], - "index_web_pages_for_search": 1, - "is_submittable": 1, - "links": [], - "modified": "2022-01-03 18:05:49.812983", - "modified_by": "Administrator", - "module": "CSF TZ", - "name": "Email Salary Slips", - "owner": "Administrator", - "permissions": [ - { - "create": 1, - "delete": 1, - "email": 1, - "export": 1, - "print": 1, - "read": 1, - "report": 1, - "role": "System Manager", - "share": 1, - "write": 1 - } - ], - "sort_field": "modified", - "sort_order": "DESC", - "track_changes": 1 -} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/email_salary_slips/email_salary_slips.py b/csf_tz/csf_tz/doctype/email_salary_slips/email_salary_slips.py deleted file mode 100644 index ff1c895e..00000000 --- a/csf_tz/csf_tz/doctype/email_salary_slips/email_salary_slips.py +++ /dev/null @@ -1,25 +0,0 @@ -# Copyright (c) 2022, Aakvatech and contributors -# For license information, please see license.txt - -import frappe -from frappe.model.document import Document - -class EmailSalarySlips(Document): - def on_submit(self): - self.send_salary_slip_email() - - def send_salary_slip_email(self): - # Employees selected to send mail - selected_employees = filter(lambda x: x.send_email == True, self.employees) - selected_employees = list(selected_employees) - employees = [] - for employee in selected_employees: - employees.append(employee.employee) - salary_slips = frappe.db.get_list('Salary Slip', filters=[ - ["employee", "in", employees], - ["payroll_entry", "=", self.payroll_entry] - ], pluck='name') - if frappe.db.get_single_value("Payroll Settings", "email_salary_slip_to_employee"): - for ss in salary_slips: - doc = frappe.get_doc('Salary Slip', ss) - doc.email_salary_slip() diff --git a/csf_tz/csf_tz/doctype/email_salary_slips/test_email_salary_slips.py b/csf_tz/csf_tz/doctype/email_salary_slips/test_email_salary_slips.py deleted file mode 100644 index 89be67d7..00000000 --- a/csf_tz/csf_tz/doctype/email_salary_slips/test_email_salary_slips.py +++ /dev/null @@ -1,8 +0,0 @@ -# Copyright (c) 2022, Aakvatech and Contributors -# See license.txt - -# import frappe -import unittest - -class TestEmailSalarySlips(unittest.TestCase): - pass diff --git a/csf_tz/csf_tz/doctype/employee_ot_component/__init__.py b/csf_tz/csf_tz/doctype/employee_ot_component/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/csf_tz/doctype/employee_ot_component/employee_ot_component.json b/csf_tz/csf_tz/doctype/employee_ot_component/employee_ot_component.json deleted file mode 100644 index 30410d16..00000000 --- a/csf_tz/csf_tz/doctype/employee_ot_component/employee_ot_component.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "actions": [], - "autoname": "EOTC.#", - "creation": "2019-02-18 09:46:35.383853", - "doctype": "DocType", - "editable_grid": 1, - "engine": "InnoDB", - "field_order": [ - "salary_component", - "no_of_hours" - ], - "fields": [ - { - "fieldname": "salary_component", - "fieldtype": "Link", - "in_list_view": 1, - "label": "Salary Component", - "options": "Salary Component" - }, - { - "fieldname": "no_of_hours", - "fieldtype": "Float", - "in_list_view": 1, - "label": "No of Hours" - } - ], - "istable": 1, - "links": [], - "modified": "2023-11-27 14:56:40.451485", - "modified_by": "Administrator", - "module": "CSF TZ", - "name": "Employee OT Component", - "naming_rule": "Expression (old style)", - "owner": "Administrator", - "permissions": [], - "quick_entry": 1, - "sort_field": "modified", - "sort_order": "DESC", - "states": [], - "track_changes": 1 -} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/employee_ot_component/employee_ot_component.py b/csf_tz/csf_tz/doctype/employee_ot_component/employee_ot_component.py deleted file mode 100644 index b7dc1189..00000000 --- a/csf_tz/csf_tz/doctype/employee_ot_component/employee_ot_component.py +++ /dev/null @@ -1,8 +0,0 @@ -# Copyright (c) 2023, Aakvatech and contributors -# For license information, please see license.txt - -# import frappe -from frappe.model.document import Document - -class EmployeeOTComponent(Document): - pass diff --git a/csf_tz/csf_tz/doctype/employee_piecework_additional_salary/__init__.py b/csf_tz/csf_tz/doctype/employee_piecework_additional_salary/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/csf_tz/doctype/employee_piecework_additional_salary/employee_piecework_additional_salary.json b/csf_tz/csf_tz/doctype/employee_piecework_additional_salary/employee_piecework_additional_salary.json deleted file mode 100644 index ca7633c7..00000000 --- a/csf_tz/csf_tz/doctype/employee_piecework_additional_salary/employee_piecework_additional_salary.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "actions": [], - "creation": "2021-07-01 18:12:28.104243", - "doctype": "DocType", - "editable_grid": 1, - "engine": "InnoDB", - "field_order": [ - "employee", - "employee_name", - "amount", - "additional_salary" - ], - "fields": [ - { - "fieldname": "employee", - "fieldtype": "Link", - "label": "Employee", - "options": "Employee" - }, - { - "fieldname": "amount", - "fieldtype": "Currency", - "label": "Amount" - }, - { - "fetch_from": "employee.employee_name", - "fieldname": "employee_name", - "fieldtype": "Data", - "label": "Employee Name" - }, - { - "fieldname": "additional_salary", - "fieldtype": "Link", - "label": "Additional Salary", - "options": "Additional Salary" - } - ], - "index_web_pages_for_search": 1, - "istable": 1, - "links": [], - "modified": "2021-07-01 18:13:45.444494", - "modified_by": "Administrator", - "module": "CSF TZ", - "name": "Employee Piecework Additional Salary", - "owner": "Administrator", - "permissions": [], - "sort_field": "modified", - "sort_order": "DESC", - "track_changes": 1 -} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/employee_piecework_additional_salary/employee_piecework_additional_salary.py b/csf_tz/csf_tz/doctype/employee_piecework_additional_salary/employee_piecework_additional_salary.py deleted file mode 100644 index 187b7339..00000000 --- a/csf_tz/csf_tz/doctype/employee_piecework_additional_salary/employee_piecework_additional_salary.py +++ /dev/null @@ -1,8 +0,0 @@ -# Copyright (c) 2021, Aakvatech and contributors -# For license information, please see license.txt - -# import frappe -from frappe.model.document import Document - -class EmployeePieceworkAdditionalSalary(Document): - pass diff --git a/csf_tz/csf_tz/doctype/expense_record/__init__.py b/csf_tz/csf_tz/doctype/expense_record/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/csf_tz/doctype/expense_record/expense_record.js b/csf_tz/csf_tz/doctype/expense_record/expense_record.js deleted file mode 100644 index 635ed84a..00000000 --- a/csf_tz/csf_tz/doctype/expense_record/expense_record.js +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) 2019, Aakvatech Limited and contributors -// For license information, please see license.txt - -frappe.ui.form.on('Expense Record', { - onload: function(frm,cdt,cdn) { - - }, - setup: function(frm) { - frm.set_query('expense_type', function() { - return { - filters: { - 'section': frm.doc.section - } - } - }); - } -}); - diff --git a/csf_tz/csf_tz/doctype/expense_record/expense_record.json b/csf_tz/csf_tz/doctype/expense_record/expense_record.json deleted file mode 100644 index a9e948f5..00000000 --- a/csf_tz/csf_tz/doctype/expense_record/expense_record.json +++ /dev/null @@ -1,202 +0,0 @@ -{ - "autoname": "naming_series:", - "creation": "2020-06-17 02:37:43.275143", - "doctype": "DocType", - "editable_grid": 1, - "engine": "InnoDB", - "field_order": [ - "naming_series", - "main_info_section", - "date", - "column_break_3", - "section", - "purchase_invoice", - "section_break_5", - "supplier", - "expense_type", - "item", - "bill_no", - "column_break_8", - "amount", - "attach_receipt", - "section_break_11", - "journal_entry", - "column_break_15", - "section_break_15", - "section_manager", - "section_break_19", - "amended_from" - ], - "fields": [ - { - "fieldname": "naming_series", - "fieldtype": "Select", - "label": "naming_series", - "options": "ER-.YYYY.-.#######" - }, - { - "collapsible": 1, - "fieldname": "main_info_section", - "fieldtype": "Section Break", - "label": "Main Info" - }, - { - "default": "Today", - "fetch_from": "shift.date", - "fieldname": "date", - "fieldtype": "Date", - "in_standard_filter": 1, - "label": "Date", - "reqd": 1 - }, - { - "fieldname": "column_break_3", - "fieldtype": "Column Break" - }, - { - "fetch_from": "shift.fuel_station", - "fieldname": "section", - "fieldtype": "Link", - "in_standard_filter": 1, - "label": "Section", - "options": "Section", - "reqd": 1 - }, - { - "fieldname": "section_break_5", - "fieldtype": "Section Break" - }, - { - "fieldname": "supplier", - "fieldtype": "Link", - "label": "Supplier", - "options": "Supplier" - }, - { - "fieldname": "expense_type", - "fieldtype": "Link", - "in_list_view": 1, - "in_standard_filter": 1, - "label": "Expense Type", - "options": "Expense Type", - "reqd": 1 - }, - { - "fieldname": "bill_no", - "fieldtype": "Data", - "in_standard_filter": 1, - "label": "Bill No", - "reqd": 1 - }, - { - "fieldname": "column_break_8", - "fieldtype": "Column Break" - }, - { - "fieldname": "amount", - "fieldtype": "Currency", - "in_list_view": 1, - "in_standard_filter": 1, - "label": "Amount", - "reqd": 1 - }, - { - "fieldname": "attach_receipt", - "fieldtype": "Attach Image", - "in_preview": 1, - "label": "Attach Receipt" - }, - { - "fieldname": "section_break_11", - "fieldtype": "Section Break" - }, - { - "fieldname": "journal_entry", - "fieldtype": "Data", - "label": "Journal Entry", - "options": "Journal Entry", - "read_only": 1 - }, - { - "fieldname": "section_break_15", - "fieldtype": "Section Break" - }, - { - "fetch_from": "fuel_station.station_manager", - "fieldname": "section_manager", - "fieldtype": "Link", - "label": "Section Manager", - "options": "User", - "read_only": 1 - }, - { - "fieldname": "section_break_19", - "fieldtype": "Section Break" - }, - { - "fieldname": "amended_from", - "fieldtype": "Link", - "label": "Amended From", - "no_copy": 1, - "options": "Expense Record", - "print_hide": 1, - "read_only": 1 - }, - { - "fieldname": "column_break_15", - "fieldtype": "Column Break" - }, - { - "fetch_from": "expense_type.item", - "fieldname": "item", - "fieldtype": "Link", - "label": "Expense Item", - "options": "Item", - "read_only": 1, - "reqd": 1 - }, - { - "fieldname": "purchase_invoice", - "fieldtype": "Link", - "label": "Purchase Invoice", - "options": "Purchase Invoice", - "read_only": 1 - } - ], - "is_submittable": 1, - "modified": "2020-06-19 00:11:50.044255", - "modified_by": "Administrator", - "module": "CSF TZ", - "name": "Expense Record", - "owner": "Administrator", - "permissions": [ - { - "cancel": 1, - "create": 1, - "delete": 1, - "email": 1, - "export": 1, - "print": 1, - "read": 1, - "report": 1, - "role": "System Manager", - "share": 1, - "submit": 1, - "write": 1 - }, - { - "create": 1, - "email": 1, - "export": 1, - "print": 1, - "read": 1, - "report": 1, - "role": "Section Manager", - "share": 1, - "write": 1 - } - ], - "sort_field": "modified", - "sort_order": "DESC", - "track_changes": 1 -} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/expense_record/expense_record.py b/csf_tz/csf_tz/doctype/expense_record/expense_record.py deleted file mode 100644 index ccfbc38c..00000000 --- a/csf_tz/csf_tz/doctype/expense_record/expense_record.py +++ /dev/null @@ -1,127 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (c) 2020, Aakvatech and contributors -# For license information, please see license.txt - -from __future__ import unicode_literals -import frappe ,erpnext -from frappe import _ -from frappe.model.document import Document -# from csf_tz.custom_api import get_linked_docs_info,cancle_linked_docs,cancel_doc,delete_doc,delete_linked_docs -from erpnext.controllers.accounts_controller import get_taxes_and_charges - -class ExpenseRecord(Document): - # def on_cancel(self): - # linked_doc_list = get_linked_docs_info(self.doctype,self.name) - # cancle_linked_docs(linked_doc_list) - # if self.journal_entry: - # cancel_doc("Journal Entry",self.journal_entry) - - - # def on_trash(self): - # linked_doc_list = get_linked_docs_info(self.doctype,self.name) - # delete_linked_docs(linked_doc_list) - # if self.journal_entry: - # delete_doc("Journal Entry",self.journal_entry) - - def validate(self): - pass - - - def on_submit(self): - if self.supplier: - self.create_purchase_invoice() - else: - self.create_journal_entry() - - - def create_purchase_invoice(self): - company = frappe.get_value("Expense Type",self.expense_type,"company") - items = [{ - "item_code": self.item, - "rate": self.amount, - "qty": 1, - "description": self.name +" - "+ self.expense_type - }] - pi = frappe.get_doc({ - "doctype": "Purchase Invoice", - "company": company, - "currency": erpnext.get_company_currency(company), - "cost_center": frappe.get_value("Section",self.section,"cost_center"), - "supplier": self.supplier, - "posting_date": self.date, - "set_posting_time": 1, - "bill_no": self.bill_no, - "bill_date": self.date, - "document_type": self.doctype, - "disable_rounded_total": 0, - "expense_record": self.name, - "items": items, - "is_paid": 1, - "cash_bank_account": frappe.get_value("Section",self.section,"default_cash_account"), - "taxes_and_charges": frappe.get_value("Section",self.section,"purchase_taxes_and_charges_template"), - }) - frappe.flags.ignore_account_permission = True - pi.set_missing_values() - getTax(pi) - pi.calculate_taxes_and_totals() - pi.insert(ignore_permissions=True) - pi.save() - self.purchase_invoice = pi.name - invoice_url = frappe.utils.get_url_to_form(pi.doctype, pi.name) - si_msgprint = "Purchase Invoice Created {1}".format(invoice_url,pi.name) - frappe.msgprint(_(si_msgprint)) - return pi.name - - - def create_journal_entry(self): - account_details = make_account_row( - debit_account = frappe.get_value("Expense Type",self.expense_type,"expense_account"), - credit_account = frappe.get_value("Section",self.section,"default_cash_account"), - amount = self.amount, - cost_center = frappe.get_value("Section",self.section,"cost_center") - ) - company = frappe.get_value("Section",self.section,"company") - user_remark = self.name + " " + self.doctype + " was created at " + self.section + " for " + self.expense_type - jv_doc = frappe.get_doc(dict( - doctype = "Journal Entry", - posting_date = self.date, - accounts = account_details, - bill_no = self.bill_no, - company = company, - expense_record = self.name, - user_remark = user_remark - )) - jv_doc.flags.ignore_permissions = True - frappe.flags.ignore_account_permission = True - jv_doc.save() - self.journal_entry = jv_doc.name - jv_url = frappe.utils.get_url_to_form(jv_doc.doctype, jv_doc.name) - si_msgprint = "Journal Entry Created {1}".format(jv_url,jv_doc.name) - frappe.msgprint(_(si_msgprint)) - return jv_doc.name - - - - -def getTax(purchase_invoice): - taxes = get_taxes_and_charges('Purchase Taxes and Charges Template',purchase_invoice.taxes_and_charges) - for tax in taxes: - purchase_invoice.append('taxes', tax) - - - -def make_account_row(debit_account,credit_account,amount,cost_center): - accounts = [] - debit_row = dict( - account = debit_account, - debit_in_account_currency = amount, - cost_center = cost_center - ) - accounts.append(debit_row) - credit_row = dict( - account = credit_account, - credit_in_account_currency = amount, - cost_center = cost_center - ) - accounts.append(credit_row) - return accounts \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/expense_record/test_expense_record.py b/csf_tz/csf_tz/doctype/expense_record/test_expense_record.py deleted file mode 100644 index c8ef95c1..00000000 --- a/csf_tz/csf_tz/doctype/expense_record/test_expense_record.py +++ /dev/null @@ -1,10 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (c) 2020, Aakvatech and Contributors -# See license.txt -from __future__ import unicode_literals - -# import frappe -import unittest - -class TestExpenseRecord(unittest.TestCase): - pass diff --git a/csf_tz/csf_tz/doctype/expense_type/__init__.py b/csf_tz/csf_tz/doctype/expense_type/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/csf_tz/doctype/expense_type/expense_type.js b/csf_tz/csf_tz/doctype/expense_type/expense_type.js deleted file mode 100644 index cd86a809..00000000 --- a/csf_tz/csf_tz/doctype/expense_type/expense_type.js +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (c) 2020, Aakvatech and contributors -// For license information, please see license.txt - -frappe.ui.form.on('Expense Type', { - setup: function(frm) { - frm.set_query('expense_account', function() { - return { - filters: { - 'company': frm.doc.company, - "root_type": "Expense", - 'is_group': 0 - }, - order_by: "name" - } - }); - } -}); diff --git a/csf_tz/csf_tz/doctype/expense_type/expense_type.json b/csf_tz/csf_tz/doctype/expense_type/expense_type.json deleted file mode 100644 index 105a7dd1..00000000 --- a/csf_tz/csf_tz/doctype/expense_type/expense_type.json +++ /dev/null @@ -1,96 +0,0 @@ -{ - "allow_rename": 1, - "autoname": "format:{expense_type}-{section}", - "creation": "2020-06-17 02:35:34.988142", - "doctype": "DocType", - "editable_grid": 1, - "engine": "InnoDB", - "field_order": [ - "expense_type", - "section", - "column_break_3", - "company", - "expense_account", - "item" - ], - "fields": [ - { - "fieldname": "expense_type", - "fieldtype": "Data", - "in_list_view": 1, - "label": "Expense Type", - "reqd": 1 - }, - { - "fieldname": "column_break_3", - "fieldtype": "Column Break" - }, - { - "fetch_from": "section.company", - "fieldname": "company", - "fieldtype": "Link", - "in_list_view": 1, - "in_standard_filter": 1, - "label": "Company", - "options": "Company", - "read_only": 1 - }, - { - "fieldname": "expense_account", - "fieldtype": "Link", - "in_list_view": 1, - "label": "Expense Account", - "options": "Account", - "reqd": 1 - }, - { - "fieldname": "section", - "fieldtype": "Link", - "in_list_view": 1, - "in_standard_filter": 1, - "label": "Section", - "options": "Section", - "reqd": 1 - }, - { - "fetch_from": "expense_account.item", - "fieldname": "item", - "fieldtype": "Link", - "label": "Expense Item", - "options": "Item", - "read_only": 1, - "reqd": 1 - } - ], - "modified": "2020-06-17 18:07:19.746952", - "modified_by": "Administrator", - "module": "CSF TZ", - "name": "Expense Type", - "owner": "Administrator", - "permissions": [ - { - "create": 1, - "delete": 1, - "email": 1, - "export": 1, - "print": 1, - "read": 1, - "report": 1, - "role": "System Manager", - "share": 1, - "write": 1 - }, - { - "email": 1, - "export": 1, - "print": 1, - "read": 1, - "report": 1, - "role": "Section Manager", - "share": 1 - } - ], - "sort_field": "modified", - "sort_order": "DESC", - "track_changes": 1 -} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/expense_type/expense_type.py b/csf_tz/csf_tz/doctype/expense_type/expense_type.py deleted file mode 100644 index fcdfb9fc..00000000 --- a/csf_tz/csf_tz/doctype/expense_type/expense_type.py +++ /dev/null @@ -1,10 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (c) 2020, Aakvatech and contributors -# For license information, please see license.txt - -from __future__ import unicode_literals -# import frappe -from frappe.model.document import Document - -class ExpenseType(Document): - pass diff --git a/csf_tz/csf_tz/doctype/expense_type/test_expense_type.py b/csf_tz/csf_tz/doctype/expense_type/test_expense_type.py deleted file mode 100644 index ff5256d4..00000000 --- a/csf_tz/csf_tz/doctype/expense_type/test_expense_type.py +++ /dev/null @@ -1,10 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (c) 2020, Aakvatech and Contributors -# See license.txt -from __future__ import unicode_literals - -# import frappe -import unittest - -class TestExpenseType(unittest.TestCase): - pass diff --git a/csf_tz/csf_tz/doctype/file_attachment/__init__.py b/csf_tz/csf_tz/doctype/file_attachment/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/csf_tz/doctype/file_attachment/file_attachment.js b/csf_tz/csf_tz/doctype/file_attachment/file_attachment.js deleted file mode 100644 index 6464d9e8..00000000 --- a/csf_tz/csf_tz/doctype/file_attachment/file_attachment.js +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright (c) 2020, Aakvatech and contributors -// For license information, please see license.txt - -frappe.ui.form.on('File Attachment', { - // refresh: function(frm) { - - // } -}); diff --git a/csf_tz/csf_tz/doctype/file_attachment/file_attachment.json b/csf_tz/csf_tz/doctype/file_attachment/file_attachment.json deleted file mode 100644 index 824fad1b..00000000 --- a/csf_tz/csf_tz/doctype/file_attachment/file_attachment.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "actions": [], - "creation": "2020-08-25 13:11:30.921286", - "doctype": "DocType", - "editable_grid": 1, - "engine": "InnoDB", - "field_order": [ - "file_attachment" - ], - "fields": [ - { - "fieldname": "file_attachment", - "fieldtype": "Attach", - "label": "File Attachment" - } - ], - "istable": 1, - "links": [], - "modified": "2025-02-02 00:10:33.819284", - "modified_by": "Administrator", - "module": "CSF TZ", - "name": "File Attachment", - "owner": "Administrator", - "permissions": [], - "quick_entry": 1, - "sort_field": "modified", - "sort_order": "DESC", - "states": [], - "track_changes": 1 -} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/file_attachment/file_attachment.py b/csf_tz/csf_tz/doctype/file_attachment/file_attachment.py deleted file mode 100644 index 7b4dd3bd..00000000 --- a/csf_tz/csf_tz/doctype/file_attachment/file_attachment.py +++ /dev/null @@ -1,10 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (c) 2020, Aakvatech and contributors -# For license information, please see license.txt - -from __future__ import unicode_literals -# import frappe -from frappe.model.document import Document - -class FileAttachment(Document): - pass diff --git a/csf_tz/csf_tz/doctype/file_attachment/test_file_attachment.py b/csf_tz/csf_tz/doctype/file_attachment/test_file_attachment.py deleted file mode 100644 index c0d08a9b..00000000 --- a/csf_tz/csf_tz/doctype/file_attachment/test_file_attachment.py +++ /dev/null @@ -1,10 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (c) 2020, Aakvatech and Contributors -# See license.txt -from __future__ import unicode_literals - -# import frappe -import unittest - -class TestFileAttachment(unittest.TestCase): - pass diff --git a/csf_tz/csf_tz/doctype/inter_company_material_request/__init__.py b/csf_tz/csf_tz/doctype/inter_company_material_request/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/csf_tz/doctype/inter_company_material_request/inter_company_material_request.js b/csf_tz/csf_tz/doctype/inter_company_material_request/inter_company_material_request.js deleted file mode 100644 index 8c3e665f..00000000 --- a/csf_tz/csf_tz/doctype/inter_company_material_request/inter_company_material_request.js +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) 2025, Aakvatech and contributors -// For license information, please see license.txt - -frappe.ui.form.on("Inter Company Material Request", { - refresh: function (frm) { - - frm.set_query('default_from_warehouse', () => { - return { - filters: { - company: frm.doc.from_company - } - }; - }); - frm.set_query('default_to_warehouse', () => { - return { - filters: { - company: frm.doc.to_company - } - }; - }); - frm.fields_dict['items_child'].grid.get_field('batch_no').get_query = function(doc, cdt, cdn) { - let row = locals[cdt][cdn]; - return { - filters: { - item_name: row.item_name - } - }; - }; - } -}); diff --git a/csf_tz/csf_tz/doctype/inter_company_material_request/inter_company_material_request.json b/csf_tz/csf_tz/doctype/inter_company_material_request/inter_company_material_request.json deleted file mode 100644 index 6b033eb7..00000000 --- a/csf_tz/csf_tz/doctype/inter_company_material_request/inter_company_material_request.json +++ /dev/null @@ -1,156 +0,0 @@ -{ - "actions": [], - "allow_rename": 1, - "autoname": "naming_series:", - "creation": "2025-02-27 16:37:23.903411", - "default_view": "List", - "doctype": "DocType", - "editable_grid": 1, - "engine": "InnoDB", - "field_order": [ - "naming_series", - "section_break_pusfp", - "from_company", - "default_from_warehouse", - "column_break_xks6g", - "to_company", - "default_to_warehouse", - "items_section", - "items_child", - "section_break_byxrx", - "inter_company_stock_transfer", - "column_break_tsfq", - "amended_from" - ], - "fields": [ - { - "fieldname": "naming_series", - "fieldtype": "Select", - "label": "Naming Series", - "options": "ICMT-.YY.-", - "print_hide": 1, - "set_only_once": 1 - }, - { - "fieldname": "section_break_pusfp", - "fieldtype": "Section Break" - }, - { - "fieldname": "from_company", - "fieldtype": "Link", - "in_list_view": 1, - "label": "From Company", - "options": "Company", - "reqd": 1 - }, - { - "fetch_from": "from_company.default_warehouse_for_sales_return", - "fetch_if_empty": 1, - "fieldname": "default_from_warehouse", - "fieldtype": "Link", - "ignore_user_permissions": 1, - "in_list_view": 1, - "label": "Default From Warehouse", - "options": "Warehouse", - "reqd": 1 - }, - { - "fieldname": "column_break_xks6g", - "fieldtype": "Column Break" - }, - { - "fieldname": "to_company", - "fieldtype": "Link", - "in_list_view": 1, - "label": "To Company", - "options": "Company", - "reqd": 1 - }, - { - "fetch_from": "to_company.default_warehouse_for_sales_return", - "fetch_if_empty": 1, - "fieldname": "default_to_warehouse", - "fieldtype": "Link", - "ignore_user_permissions": 1, - "in_list_view": 1, - "label": "Default To Warehouse", - "options": "Warehouse", - "reqd": 1 - }, - { - "fieldname": "items_section", - "fieldtype": "Section Break", - "label": "Items" - }, - { - "fieldname": "items_child", - "fieldtype": "Table", - "label": "Items", - "options": "Inter Company Material Request Details" - }, - { - "fieldname": "section_break_byxrx", - "fieldtype": "Section Break" - }, - { - "fieldname": "amended_from", - "fieldtype": "Link", - "label": "Amended From", - "no_copy": 1, - "options": "Inter Company Stock Transfer", - "print_hide": 1, - "read_only": 1 - }, - { - "fieldname": "amended_from", - "fieldtype": "Link", - "label": "Amended From", - "no_copy": 1, - "options": "Inter Company Stock Transfer", - "print_hide": 1, - "read_only": 1 - }, - { - "fieldname": "inter_company_stock_transfer", - "fieldtype": "Data", - "label": "Inter Company Stock Transfer" - }, - { - "fieldname": "column_break_tsfq", - "fieldtype": "Column Break" - } - ], - "index_web_pages_for_search": 1, - "is_submittable": 1, - "links": [ - { - "link_doctype": "Inter Company Stock Transfer", - "link_fieldname": "inter_company_material_request" - } - ], - "modified": "2025-03-06 17:19:22.221283", - "modified_by": "Administrator", - "module": "CSF TZ", - "name": "Inter Company Material Request", - "naming_rule": "By \"Naming Series\" field", - "owner": "Administrator", - "permissions": [ - { - "cancel": 1, - "create": 1, - "delete": 1, - "email": 1, - "export": 1, - "print": 1, - "read": 1, - "report": 1, - "role": "System Manager", - "share": 1, - "submit": 1, - "write": 1 - } - ], - "sort_field": "modified", - "sort_order": "DESC", - "states": [] -} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/inter_company_material_request/inter_company_material_request.py b/csf_tz/csf_tz/doctype/inter_company_material_request/inter_company_material_request.py deleted file mode 100644 index 37c0f729..00000000 --- a/csf_tz/csf_tz/doctype/inter_company_material_request/inter_company_material_request.py +++ /dev/null @@ -1,49 +0,0 @@ -# Copyright (c) 2025, Aakvatech and contributors -# For license information, please see license.txt - -import frappe -from frappe.model.document import Document -from erpnext.stock.get_item_details import get_valuation_rate - - -class InterCompanyMaterialRequest(Document): - def before_submit(self,warehouse=None): - - if self.from_company == self.to_company: - frappe.throw("From and To Company cannot be same") - - item_list = [] - - for item in self.items_child: - - valuation_rate_data = get_valuation_rate(item.item_code, self.from_company, self.default_from_warehouse) - if not valuation_rate_data or valuation_rate_data.valuation_rate is None or valuation_rate_data.valuation_rate == 0: - frappe.throw(f"Valuation rate is zero or not found for Item {item.item_code} in warehouse {self.default_from_warehouse}") - else: - item_list.append({ - "item_name": item.item_name, - "item_code": item.item_code, - "uom": item.uom, - "qty": item.qty, - "s_warehouse": self.default_from_warehouse, - "t_warehouse": self.default_to_warehouse, - "basic_rate": valuation_rate_data.valuation_rate, - "batch_no": item.batch_no, - }) - - # Create Inter Company Stock Transfer - - inter_company_stock_transfer = frappe.get_doc({ - "doctype": "Inter Company Stock Transfer", - "from_company": self.from_company, - "to_company": self.to_company, - "default_from_warehouse": self.default_from_warehouse, - "default_to_warehouse": self.default_to_warehouse, - "inter_company_material_request": self.name, - "items_child": item_list, - "transfer_goods_between_company": self.name - }) - inter_company_stock_transfer.insert(ignore_permissions=True) - inter_company_stock_transfer.save() - - self.inter_company_stock_transfer = inter_company_stock_transfer.name \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/inter_company_material_request/test_inter_company_material_request.py b/csf_tz/csf_tz/doctype/inter_company_material_request/test_inter_company_material_request.py deleted file mode 100644 index aede6109..00000000 --- a/csf_tz/csf_tz/doctype/inter_company_material_request/test_inter_company_material_request.py +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (c) 2025, Aakvatech and Contributors -# See license.txt - -# import frappe -from frappe.tests.utils import FrappeTestCase - - -class TestInterCompanyMaterialRequest(FrappeTestCase): - pass diff --git a/csf_tz/csf_tz/doctype/inter_company_material_request_details/__init__.py b/csf_tz/csf_tz/doctype/inter_company_material_request_details/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/csf_tz/doctype/inter_company_material_request_details/inter_company_material_request_details.json b/csf_tz/csf_tz/doctype/inter_company_material_request_details/inter_company_material_request_details.json deleted file mode 100644 index aafc538f..00000000 --- a/csf_tz/csf_tz/doctype/inter_company_material_request_details/inter_company_material_request_details.json +++ /dev/null @@ -1,90 +0,0 @@ -{ - "actions": [], - "allow_rename": 1, - "creation": "2025-03-04 17:24:38.925966", - "default_view": "List", - "doctype": "DocType", - "editable_grid": 1, - "engine": "InnoDB", - "field_order": [ - "item_name", - "item_code", - "uom", - "qty", - "batch_no", - "bom_no", - "transfer_qty", - "s_warehouse", - "t_warehouse" - ], - "fields": [ - { - "fieldname": "item_name", - "fieldtype": "Link", - "in_list_view": 1, - "label": "Item Name", - "options": "Item" - }, - { - "fetch_from": "item_name.item_code", - "fieldname": "item_code", - "fieldtype": "Data", - "in_list_view": 1, - "label": "Item code" - }, - { - "fetch_from": "item_name.stock_uom", - "fieldname": "uom", - "fieldtype": "Data", - "in_list_view": 1, - "label": "UOM" - }, - { - "fieldname": "qty", - "fieldtype": "Float", - "in_list_view": 1, - "label": "QTY" - }, - { - "fieldname": "batch_no", - "fieldtype": "Link", - "in_list_view": 1, - "label": "Batch No", - "options": "Batch" - }, - { - "fieldname": "bom_no", - "fieldtype": "Data", - "label": "BOM" - }, - { - "fieldname": "transfer_qty", - "fieldtype": "Float", - "label": "Qty as per Stock UOM" - }, - { - "fieldname": "s_warehouse", - "fieldtype": "Link", - "label": "Source Warehouse", - "options": "Warehouse" - }, - { - "fieldname": "t_warehouse", - "fieldtype": "Link", - "label": "Target Warehouse", - "options": "Warehouse" - } - ], - "index_web_pages_for_search": 1, - "istable": 1, - "links": [], - "modified": "2025-03-04 17:24:38.925966", - "modified_by": "Administrator", - "module": "CSF TZ", - "name": "Inter Company Material Request Details", - "owner": "Administrator", - "permissions": [], - "sort_field": "modified", - "sort_order": "DESC", - "states": [] -} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/inter_company_material_request_details/inter_company_material_request_details.py b/csf_tz/csf_tz/doctype/inter_company_material_request_details/inter_company_material_request_details.py deleted file mode 100644 index 3a54c9e1..00000000 --- a/csf_tz/csf_tz/doctype/inter_company_material_request_details/inter_company_material_request_details.py +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (c) 2025, Aakvatech and contributors -# For license information, please see license.txt - -# import frappe -from frappe.model.document import Document - - -class InterCompanyMaterialRequestDetails(Document): - pass diff --git a/csf_tz/csf_tz/doctype/inter_company_stock_transfer/__init__.py b/csf_tz/csf_tz/doctype/inter_company_stock_transfer/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/csf_tz/doctype/inter_company_stock_transfer/inter_company_stock_transfer.js b/csf_tz/csf_tz/doctype/inter_company_stock_transfer/inter_company_stock_transfer.js deleted file mode 100644 index 98ea924e..00000000 --- a/csf_tz/csf_tz/doctype/inter_company_stock_transfer/inter_company_stock_transfer.js +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) 2023, Aakvatech and contributors -// For license information, please see license.txt - -frappe.ui.form.on('Inter Company Stock Transfer', { - refresh: function (frm) { - frm.set_query('default_from_warehouse', () => { - return { - filters: { - company: frm.doc.from_company - } - }; - }); - frm.set_query('default_to_warehouse', () => { - return { - filters: { - company: frm.doc.to_company - } - }; - }); - frm.fields_dict['items_child'].grid.get_field('batch_no').get_query = function(doc, cdt, cdn) { - let row = locals[cdt][cdn]; - return { - filters: { - item_name: row.item_name - } - }; - }; - } -}); - diff --git a/csf_tz/csf_tz/doctype/inter_company_stock_transfer/inter_company_stock_transfer.json b/csf_tz/csf_tz/doctype/inter_company_stock_transfer/inter_company_stock_transfer.json deleted file mode 100644 index 35f3a879..00000000 --- a/csf_tz/csf_tz/doctype/inter_company_stock_transfer/inter_company_stock_transfer.json +++ /dev/null @@ -1,161 +0,0 @@ -{ - "actions": [], - "allow_rename": 1, - "autoname": "naming_series:", - "creation": "2023-12-21 17:12:09.387324", - "default_view": "List", - "doctype": "DocType", - "editable_grid": 1, - "engine": "InnoDB", - "field_order": [ - "naming_series", - "section_break_pusfp", - "from_company", - "default_from_warehouse", - "column_break_xks6g", - "to_company", - "default_to_warehouse", - "items_section", - "items_child", - "section_break_byxrx", - "material_receipt", - "inter_company_material_request", - "column_break_kcxib", - "material_issue", - "section_break_fntqt", - "amended_from" - ], - "fields": [ - { - "fieldname": "naming_series", - "fieldtype": "Select", - "label": "Naming Series", - "options": "ICST-.YY.-", - "print_hide": 1, - "set_only_once": 1 - }, - { - "fieldname": "section_break_pusfp", - "fieldtype": "Section Break" - }, - { - "fieldname": "from_company", - "fieldtype": "Link", - "label": "From Company", - "options": "Company" - }, - { - "fetch_from": "from_company.default_warehouse_for_sales_return", - "fetch_if_empty": 1, - "fieldname": "default_from_warehouse", - "fieldtype": "Link", - "ignore_user_permissions": 1, - "label": "Default From Warehouse", - "options": "Warehouse" - }, - { - "fieldname": "column_break_xks6g", - "fieldtype": "Column Break" - }, - { - "fieldname": "to_company", - "fieldtype": "Link", - "label": "To Company", - "options": "Company" - }, - { - "fetch_from": "to_company.default_warehouse_for_sales_return", - "fetch_if_empty": 1, - "fieldname": "default_to_warehouse", - "fieldtype": "Link", - "ignore_user_permissions": 1, - "label": "Default To Warehouse", - "options": "Warehouse" - }, - { - "fieldname": "items_section", - "fieldtype": "Section Break", - "label": "Items" - }, - { - "fieldname": "items_child", - "fieldtype": "Table", - "label": "Items", - "options": "Inter Company Stock Transfer Details" - }, - { - "fieldname": "section_break_byxrx", - "fieldtype": "Section Break" - }, - { - "fieldname": "material_receipt", - "fieldtype": "Data", - "label": "Material Receipt" - }, - { - "fieldname": "column_break_kcxib", - "fieldtype": "Column Break" - }, - { - "fieldname": "material_issue", - "fieldtype": "Data", - "label": "Material Issue" - }, - { - "fieldname": "section_break_fntqt", - "fieldtype": "Section Break" - }, - { - "fieldname": "amended_from", - "fieldtype": "Link", - "label": "Amended From", - "no_copy": 1, - "options": "Inter Company Stock Transfer", - "print_hide": 1, - "read_only": 1 - }, - { - "fieldname": "inter_company_material_request", - "fieldtype": "Data", - "label": "Inter Company Material Request", - "read_only": 1 - } - ], - "index_web_pages_for_search": 1, - "is_submittable": 1, - "links": [ - { - "link_doctype": "Stock Entry", - "link_fieldname": "stock_entry_type" - }, - { - "link_doctype": "Inter Company Material Request", - "link_fieldname": "inter_company_stock_transfer" - } - ], - "modified": "2025-03-06 17:21:40.333581", - "modified_by": "Administrator", - "module": "CSF TZ", - "name": "Inter Company Stock Transfer", - "naming_rule": "By \"Naming Series\" field", - "owner": "Administrator", - "permissions": [ - { - "cancel": 1, - "create": 1, - "delete": 1, - "email": 1, - "export": 1, - "print": 1, - "read": 1, - "report": 1, - "role": "System Manager", - "share": 1, - "submit": 1, - "write": 1 - } - ], - "sort_field": "modified", - "sort_order": "DESC", - "states": [] -} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/inter_company_stock_transfer/inter_company_stock_transfer.py b/csf_tz/csf_tz/doctype/inter_company_stock_transfer/inter_company_stock_transfer.py deleted file mode 100644 index 7ca159d7..00000000 --- a/csf_tz/csf_tz/doctype/inter_company_stock_transfer/inter_company_stock_transfer.py +++ /dev/null @@ -1,96 +0,0 @@ -# Copyright (c) 2023, Aakvatech and contributors -# For license information, please see license.txt - -import frappe -from frappe.model.document import Document -import erpnext -from erpnext.stock.stock_ledger import get_valuation_rate -from frappe.utils import flt - -class InterCompanyStockTransfer(Document): - def validate(self): - allow_inter_company_stock_transfer = frappe.db.get_value("CSF TZ Settings", "CSF TZ Settings", "allow_inter_company_stock_transfer") - if not allow_inter_company_stock_transfer: - frappe.throw("

Inter Company Stock Transfer is not enabled, please contact system administrator

") - if self.from_company == self.to_company: - frappe.throw("From and To Company cannot be same") - self._set_missing_basic_rates() - - - def before_submit(self,warehouse=None): - item_list_from, item_list_to = [], [] - self._set_missing_basic_rates(throw_if_missing=True) - - for item in self.items_child: - valuation_rate = flt(item.get("basic_rate")) - if not valuation_rate: - frappe.throw(f"Valuation rate is zero or not found for Item {item.item_code} in warehouse {self.default_from_warehouse}") - else: - item_list_from.append({ - "item_code": item.item_code, - "uom": item.uom, - "qty": item.qty, - "s_warehouse": self.default_from_warehouse, - "basic_rate": valuation_rate, - "batch_no": item.batch_no, - }) - - item_list_to.append({ - "item_code": item.item_code, - "uom": item.uom, - "qty": item.qty, - "t_warehouse": self.default_to_warehouse, - "basic_rate": valuation_rate, - "batch_no": item.batch_no, - "cost_center": "" - }) - - entry_from = frappe.get_doc({ - "doctype": "Stock Entry", - "company": self.from_company, - "stock_entry_type": "From Company", - "from_warehouse": self.default_from_warehouse, - "items": item_list_from, - "transfer_goods_between_company": self.name - }) - entry_from.insert(ignore_permissions=True) - entry_from.submit() - - entry_to = frappe.get_doc({ - "doctype": "Stock Entry", - "company": self.to_company, - "stock_entry_type": "To Company", - "to_warehouse": self.default_to_warehouse, - "items": item_list_to, - "transfer_goods_between_company": self.name - }) - entry_to.insert(ignore_permissions=True) - entry_to.submit() - - self.material_issue = entry_from.name - self.material_receipt = entry_to.name - - def _set_missing_basic_rates(self, throw_if_missing=False): - if not self.from_company or not self.default_from_warehouse: - return - - for item in self.items_child: - if not item.item_code or flt(item.basic_rate): - continue - - valuation_rate = get_valuation_rate( - item.item_code, - self.default_from_warehouse, - self.doctype, - self.name, - currency=erpnext.get_company_currency(self.from_company), - company=self.from_company, - raise_error_if_no_rate=False, - batch_no=item.batch_no, - ) - if valuation_rate: - item.basic_rate = valuation_rate - elif throw_if_missing: - frappe.throw( - f"Valuation rate is zero or not found for Item {item.item_code} in warehouse {self.default_from_warehouse}" - ) diff --git a/csf_tz/csf_tz/doctype/inter_company_stock_transfer/test_inter_company_stock_transfer.py b/csf_tz/csf_tz/doctype/inter_company_stock_transfer/test_inter_company_stock_transfer.py deleted file mode 100644 index 1f514ab5..00000000 --- a/csf_tz/csf_tz/doctype/inter_company_stock_transfer/test_inter_company_stock_transfer.py +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (c) 2024, Aakvatech and Contributors -# See license.txt - -# import frappe -from frappe.tests.utils import FrappeTestCase - - -class TestInterCompanyStockTransfer(FrappeTestCase): - pass diff --git a/csf_tz/csf_tz/doctype/inter_company_stock_transfer_details/__init__.py b/csf_tz/csf_tz/doctype/inter_company_stock_transfer_details/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/csf_tz/doctype/inter_company_stock_transfer_details/inter_company_stock_transfer_details.json b/csf_tz/csf_tz/doctype/inter_company_stock_transfer_details/inter_company_stock_transfer_details.json deleted file mode 100644 index 332b101f..00000000 --- a/csf_tz/csf_tz/doctype/inter_company_stock_transfer_details/inter_company_stock_transfer_details.json +++ /dev/null @@ -1,90 +0,0 @@ -{ - "actions": [], - "allow_rename": 1, - "creation": "2024-01-03 10:57:44.135837", - "default_view": "List", - "doctype": "DocType", - "editable_grid": 1, - "engine": "InnoDB", - "field_order": [ - "item_code", - "uom", - "basic_rate", - "qty", - "batch_no", - "bom_no", - "transfer_qty", - "s_warehouse", - "t_warehouse" - ], - "fields": [ - { - "fieldname": "item_code", - "fieldtype": "Link", - "in_list_view": 1, - "label": "Item Code", - "options": "Item" - }, - { - "fetch_from": "item_code.stock_uom", - "fetch_if_empty": 1, - "fieldname": "uom", - "fieldtype": "Data", - "in_list_view": 1, - "label": "UOM" - }, - { - "fieldname": "basic_rate", - "fieldtype": "Currency", - "in_list_view": 1, - "label": "Basic Rate" - }, - { - "fieldname": "qty", - "fieldtype": "Float", - "in_list_view": 1, - "label": "QTY" - }, - { - "fieldname": "batch_no", - "fieldtype": "Link", - "options": "Batch", - "in_list_view": 1, - "label": "Batch No" - }, - { - "fieldname": "bom_no", - "fieldtype": "Data", - "label": "BOM" - }, - { - "fieldname": "transfer_qty", - "fieldtype": "Float", - "label": "Qty as per Stock UOM" - }, - { - "fieldname": "s_warehouse", - "fieldtype": "Link", - "label": "Source Warehouse", - "options": "Warehouse" - }, - { - "fieldname": "t_warehouse", - "fieldtype": "Link", - "label": "Target Warehouse", - "options": "Warehouse" - } - ], - "index_web_pages_for_search": 1, - "istable": 1, - "links": [], - "modified": "2024-01-03 10:57:44.135837", - "modified_by": "Administrator", - "module": "CSF TZ", - "name": "Inter Company Stock Transfer Details", - "owner": "Administrator", - "permissions": [], - "sort_field": "modified", - "sort_order": "DESC", - "states": [] -} diff --git a/csf_tz/csf_tz/doctype/inter_company_stock_transfer_details/inter_company_stock_transfer_details.py b/csf_tz/csf_tz/doctype/inter_company_stock_transfer_details/inter_company_stock_transfer_details.py deleted file mode 100644 index cabf2f32..00000000 --- a/csf_tz/csf_tz/doctype/inter_company_stock_transfer_details/inter_company_stock_transfer_details.py +++ /dev/null @@ -1,8 +0,0 @@ -# Copyright (c) 2024, Aakvatech and contributors -# For license information, please see license.txt - -# import frappe -from frappe.model.document import Document - -class InterCompanyStockTransferDetails(Document): - pass diff --git a/csf_tz/csf_tz/doctype/inv_err_detail/__init__.py b/csf_tz/csf_tz/doctype/inv_err_detail/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/csf_tz/doctype/inv_err_detail/inv_err_detail.json b/csf_tz/csf_tz/doctype/inv_err_detail/inv_err_detail.json deleted file mode 100644 index 1d5c48a3..00000000 --- a/csf_tz/csf_tz/doctype/inv_err_detail/inv_err_detail.json +++ /dev/null @@ -1,74 +0,0 @@ -{ - "creation": "2019-02-18 23:25:41.743404", - "doctype": "DocType", - "editable_grid": 1, - "engine": "InnoDB", - "field_order": [ - "invoice_type", - "invoice_number", - "invoice_currency", - "column_break_4", - "invoice_amount", - "invoice_exchange_rate", - "invoice_gain_or_loss" - ], - "fields": [ - { - "fieldname": "invoice_type", - "fieldtype": "Select", - "in_list_view": 1, - "label": "Invoice Type", - "options": "Sales Invoice\nPurchase Invoice" - }, - { - "description": "Should work like Party Type / Party Name", - "fieldname": "invoice_number", - "fieldtype": "Dynamic Link", - "in_list_view": 1, - "label": "Invoice Number", - "options": "invoice_type" - }, - { - "fieldname": "invoice_currency", - "fieldtype": "Link", - "in_list_view": 1, - "label": "Invoice Currency", - "options": "Currency" - }, - { - "fieldname": "invoice_amount", - "fieldtype": "Float", - "in_list_view": 1, - "label": "Invoice Amount", - "options": "invoice_currency" - }, - { - "fieldname": "invoice_exchange_rate", - "fieldtype": "Float", - "in_list_view": 1, - "label": "Invoice Exchange Rate" - }, - { - "fieldname": "invoice_gain_or_loss", - "fieldtype": "Currency", - "in_list_view": 1, - "label": "Invoice Gain or Loss", - "options": "invoice_curency" - }, - { - "fieldname": "column_break_4", - "fieldtype": "Column Break" - } - ], - "istable": 1, - "modified": "2020-10-11 22:47:10.437743", - "modified_by": "Administrator", - "module": "CSF TZ", - "name": "Inv ERR Detail", - "owner": "Administrator", - "permissions": [], - "quick_entry": 1, - "sort_field": "modified", - "sort_order": "DESC", - "track_changes": 1 -} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/inv_err_detail/inv_err_detail.py b/csf_tz/csf_tz/doctype/inv_err_detail/inv_err_detail.py deleted file mode 100644 index d4cdf877..00000000 --- a/csf_tz/csf_tz/doctype/inv_err_detail/inv_err_detail.py +++ /dev/null @@ -1,9 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (c) 2019, Aakvatech and contributors -# For license information, please see license.txt - -from __future__ import unicode_literals -from frappe.model.document import Document - -class InvERRDetail(Document): - pass diff --git a/csf_tz/csf_tz/doctype/maintenance_request/__init__.py b/csf_tz/csf_tz/doctype/maintenance_request/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/csf_tz/doctype/maintenance_request/maintenance_request.js b/csf_tz/csf_tz/doctype/maintenance_request/maintenance_request.js deleted file mode 100644 index 17f30669..00000000 --- a/csf_tz/csf_tz/doctype/maintenance_request/maintenance_request.js +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright (c) 2021, Aakvatech and contributors -// For license information, please see license.txt - -frappe.ui.form.on('Maintenance Request', { - // refresh: function(frm) { - - // } -}); diff --git a/csf_tz/csf_tz/doctype/maintenance_request/maintenance_request.json b/csf_tz/csf_tz/doctype/maintenance_request/maintenance_request.json deleted file mode 100644 index 41183a39..00000000 --- a/csf_tz/csf_tz/doctype/maintenance_request/maintenance_request.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "actions": [], - "creation": "2021-06-23 11:50:54.836437", - "doctype": "DocType", - "editable_grid": 1, - "engine": "InnoDB", - "field_order": [ - "maintenance_request" - ], - "fields": [ - { - "fieldname": "maintenance_request", - "fieldtype": "Data", - "label": "Maintenance Request" - } - ], - "index_web_pages_for_search": 1, - "links": [], - "modified": "2021-06-23 11:50:54.836437", - "modified_by": "Administrator", - "module": "CSF TZ", - "name": "Maintenance Request", - "owner": "Administrator", - "permissions": [ - { - "create": 1, - "delete": 1, - "email": 1, - "export": 1, - "print": 1, - "read": 1, - "report": 1, - "role": "System Manager", - "share": 1, - "write": 1 - } - ], - "sort_field": "modified", - "sort_order": "DESC", - "track_changes": 1 -} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/maintenance_request/maintenance_request.py b/csf_tz/csf_tz/doctype/maintenance_request/maintenance_request.py deleted file mode 100644 index fc480a37..00000000 --- a/csf_tz/csf_tz/doctype/maintenance_request/maintenance_request.py +++ /dev/null @@ -1,8 +0,0 @@ -# Copyright (c) 2021, Aakvatech and contributors -# For license information, please see license.txt - -# import frappe -from frappe.model.document import Document - -class MaintenanceRequest(Document): - pass diff --git a/csf_tz/csf_tz/doctype/maintenance_request/test_maintenance_request.py b/csf_tz/csf_tz/doctype/maintenance_request/test_maintenance_request.py deleted file mode 100644 index 3b1d31ec..00000000 --- a/csf_tz/csf_tz/doctype/maintenance_request/test_maintenance_request.py +++ /dev/null @@ -1,8 +0,0 @@ -# Copyright (c) 2021, Aakvatech and Contributors -# See license.txt - -# import frappe -import unittest - -class TestMaintenanceRequest(unittest.TestCase): - pass diff --git a/csf_tz/csf_tz/doctype/otp_register/__init__.py b/csf_tz/csf_tz/doctype/otp_register/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/csf_tz/doctype/otp_register/otp_register.js b/csf_tz/csf_tz/doctype/otp_register/otp_register.js deleted file mode 100644 index ab8c537d..00000000 --- a/csf_tz/csf_tz/doctype/otp_register/otp_register.js +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright (c) 2023, Aakvatech and contributors -// For license information, please see license.txt - -frappe.ui.form.on('OTP Register', { - // refresh: function(frm) { - - // } -}); diff --git a/csf_tz/csf_tz/doctype/otp_register/otp_register.json b/csf_tz/csf_tz/doctype/otp_register/otp_register.json deleted file mode 100644 index 1db16fab..00000000 --- a/csf_tz/csf_tz/doctype/otp_register/otp_register.json +++ /dev/null @@ -1,113 +0,0 @@ -{ - "actions": [], - "autoname": "OTPR-.YY.-.MM.-.######", - "creation": "2023-03-06 14:11:31.898807", - "default_view": "List", - "doctype": "DocType", - "editable_grid": 1, - "engine": "InnoDB", - "field_order": [ - "party_type", - "party", - "party_name", - "user_name", - "column_break_v9xc2", - "otp_type", - "validated" - ], - "fields": [ - { - "fieldname": "party_type", - "fieldtype": "Link", - "label": "Party Type", - "options": "DocType" - }, - { - "fieldname": "party", - "fieldtype": "Dynamic Link", - "in_list_view": 1, - "label": "Party", - "options": "party_type", - "reqd": 1 - }, - { - "fieldname": "party_name", - "fieldtype": "Data", - "label": "Party Name" - }, - { - "fieldname": "user_name", - "fieldtype": "Data", - "label": "User Name" - }, - { - "fieldname": "column_break_v9xc2", - "fieldtype": "Column Break" - }, - { - "fieldname": "otp_type", - "fieldtype": "Select", - "label": "OTP Type", - "options": "\nOTP APP\nSMS\nEmail", - "reqd": 1 - }, - { - "default": "0", - "fieldname": "validated", - "fieldtype": "Check", - "label": "Validated" - } - ], - "index_web_pages_for_search": 1, - "links": [], - "modified": "2023-03-06 14:39:16.231207", - "modified_by": "Administrator", - "module": "CSF TZ", - "name": "OTP Register", - "naming_rule": "Expression (old style)", - "owner": "Administrator", - "permissions": [ - { - "create": 1, - "delete": 1, - "email": 1, - "export": 1, - "print": 1, - "read": 1, - "report": 1, - "role": "System Manager", - "share": 1, - "write": 1 - }, - { - "create": 1, - "delete": 1, - "email": 1, - "export": 1, - "print": 1, - "read": 1, - "report": 1, - "role": "Accounts Manager", - "share": 1, - "write": 1 - }, - { - "create": 1, - "delete": 1, - "email": 1, - "export": 1, - "print": 1, - "read": 1, - "report": 1, - "role": "Sales Manager", - "share": 1, - "write": 1 - } - ], - "search_fields": "party, party_name, user_name", - "show_title_field_in_link": 1, - "sort_field": "modified", - "sort_order": "DESC", - "states": [], - "title_field": "party" -} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/otp_register/otp_register.py b/csf_tz/csf_tz/doctype/otp_register/otp_register.py deleted file mode 100644 index 13bf3177..00000000 --- a/csf_tz/csf_tz/doctype/otp_register/otp_register.py +++ /dev/null @@ -1,8 +0,0 @@ -# Copyright (c) 2023, Aakvatech and contributors -# For license information, please see license.txt - -# import frappe -from frappe.model.document import Document - -class OTPRegister(Document): - pass diff --git a/csf_tz/csf_tz/doctype/otp_register/test_otp_register.py b/csf_tz/csf_tz/doctype/otp_register/test_otp_register.py deleted file mode 100644 index 2fbd3d2c..00000000 --- a/csf_tz/csf_tz/doctype/otp_register/test_otp_register.py +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (c) 2023, Aakvatech and Contributors -# See license.txt - -# import frappe -from frappe.tests.utils import FrappeTestCase - - -class TestOTPRegister(FrappeTestCase): - pass diff --git a/csf_tz/csf_tz/doctype/parking_bill/__init__.py b/csf_tz/csf_tz/doctype/parking_bill/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/csf_tz/doctype/parking_bill/parking_bill.js b/csf_tz/csf_tz/doctype/parking_bill/parking_bill.js deleted file mode 100644 index 553fb374..00000000 --- a/csf_tz/csf_tz/doctype/parking_bill/parking_bill.js +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright (c) 2021, Aakvatech and contributors -// For license information, please see license.txt - -frappe.ui.form.on('Parking Bill', { - // refresh: function(frm) { - - // } -}); diff --git a/csf_tz/csf_tz/doctype/parking_bill/parking_bill.json b/csf_tz/csf_tz/doctype/parking_bill/parking_bill.json deleted file mode 100644 index d821935f..00000000 --- a/csf_tz/csf_tz/doctype/parking_bill/parking_bill.json +++ /dev/null @@ -1,278 +0,0 @@ -{ - "actions": [], - "autoname": "field:billreference", - "creation": "2021-09-18 23:15:04.291031", - "doctype": "DocType", - "editable_grid": 1, - "engine": "InnoDB", - "field_order": [ - "vehicle", - "billstatus", - "billid", - "approvedby", - "billdescription", - "billpayed", - "billreference", - "billedamount", - "billcontrolnumber", - "billequivalentamount", - "expirydate", - "generateddate", - "miscellaneousamount", - "column_break_16", - "payeremail", - "remarks", - "payerphone", - "payername", - "reminderflag", - "spsystemid", - "billpaytype", - "receivedtime", - "billcurrency", - "applicationid", - "collectioncode", - "type", - "createdby", - "itemid", - "parkingdetailsid", - "section_break_29", - "bilitems", - "parkingdetails" - ], - "fields": [ - { - "fieldname": "billstatus", - "fieldtype": "Data", - "label": "billStatus", - "read_only": 1 - }, - { - "fieldname": "billid", - "fieldtype": "Data", - "label": "billId", - "read_only": 1 - }, - { - "fieldname": "approvedby", - "fieldtype": "Data", - "label": "approvedBy", - "read_only": 1 - }, - { - "fieldname": "billdescription", - "fieldtype": "Data", - "in_list_view": 1, - "in_standard_filter": 1, - "label": "billDescription", - "read_only": 1 - }, - { - "default": "0", - "fieldname": "billpayed", - "fieldtype": "Check", - "in_list_view": 1, - "in_standard_filter": 1, - "label": "billPayed", - "read_only": 1 - }, - { - "fieldname": "billreference", - "fieldtype": "Data", - "in_standard_filter": 1, - "label": "billReference", - "read_only": 1, - "unique": 1 - }, - { - "fieldname": "billedamount", - "fieldtype": "Float", - "in_list_view": 1, - "in_standard_filter": 1, - "label": "billedAmount", - "read_only": 1 - }, - { - "fieldname": "billcontrolnumber", - "fieldtype": "Data", - "label": "billControlNumber", - "read_only": 1 - }, - { - "fieldname": "billequivalentamount", - "fieldtype": "Float", - "label": "billEquivalentAmount", - "read_only": 1 - }, - { - "fieldname": "expirydate", - "fieldtype": "Date", - "in_list_view": 1, - "in_standard_filter": 1, - "label": "expiryDate", - "read_only": 1 - }, - { - "fieldname": "generateddate", - "fieldtype": "Date", - "in_list_view": 1, - "in_standard_filter": 1, - "label": "generatedDate", - "read_only": 1 - }, - { - "fieldname": "miscellaneousamount", - "fieldtype": "Float", - "label": "miscellaneousAmount", - "read_only": 1 - }, - { - "fieldname": "payeremail", - "fieldtype": "Data", - "label": "payerEmail", - "read_only": 1 - }, - { - "fieldname": "remarks", - "fieldtype": "Data", - "in_list_view": 1, - "label": "remarks", - "read_only": 1 - }, - { - "fieldname": "payerphone", - "fieldtype": "Data", - "label": "payerPhone", - "read_only": 1 - }, - { - "fieldname": "payername", - "fieldtype": "Data", - "label": "payerName", - "read_only": 1 - }, - { - "fieldname": "reminderflag", - "fieldtype": "Data", - "label": "reminderFlag", - "read_only": 1 - }, - { - "fieldname": "spsystemid", - "fieldtype": "Data", - "label": "spSystemId", - "read_only": 1 - }, - { - "fieldname": "billpaytype", - "fieldtype": "Data", - "label": "billPayType", - "read_only": 1 - }, - { - "fieldname": "receivedtime", - "fieldtype": "Data", - "label": "receivedTime", - "read_only": 1 - }, - { - "fieldname": "applicationid", - "fieldtype": "Data", - "label": "applicationId", - "read_only": 1 - }, - { - "fieldname": "collectioncode", - "fieldtype": "Data", - "label": "collectionCode", - "read_only": 1 - }, - { - "fieldname": "type", - "fieldtype": "Data", - "label": "type", - "read_only": 1 - }, - { - "fieldname": "createdby", - "fieldtype": "Data", - "label": "createdBy", - "read_only": 1 - }, - { - "fieldname": "itemid", - "fieldtype": "Data", - "label": "itemId", - "read_only": 1 - }, - { - "fieldname": "parkingdetailsid", - "fieldtype": "Data", - "label": "parkingDetailsId", - "read_only": 1 - }, - { - "fieldname": "bilitems", - "fieldtype": "Table", - "label": "BilItems", - "options": "Parking Bill Items", - "read_only": 1 - }, - { - "fieldname": "column_break_16", - "fieldtype": "Column Break", - "read_only": 1 - }, - { - "fieldname": "section_break_29", - "fieldtype": "Section Break", - "read_only": 1 - }, - { - "fieldname": "vehicle", - "fieldtype": "Link", - "label": "Vehicle", - "options": "Vehicle", - "read_only": 1 - }, - { - "fieldname": "parkingdetails", - "fieldtype": "Table", - "label": "parkingDetails", - "options": "Parking Bill Details", - "read_only": 1 - }, - { - "fieldname": "billcurrency", - "fieldtype": "Data", - "label": "currency", - "read_only": 1 - } - ], - "index_web_pages_for_search": 1, - "links": [], - "modified": "2021-09-20 01:04:22.385365", - "modified_by": "Administrator", - "module": "CSF TZ", - "name": "Parking Bill", - "owner": "Administrator", - "permissions": [ - { - "create": 1, - "delete": 1, - "email": 1, - "export": 1, - "print": 1, - "read": 1, - "report": 1, - "role": "System Manager", - "share": 1, - "write": 1 - } - ], - "sort_field": "modified", - "sort_order": "DESC", - "title_field": "vehicle", - "track_changes": 0, - "track_seen": 0, - "track_views": 0 -} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/parking_bill/parking_bill.py b/csf_tz/csf_tz/doctype/parking_bill/parking_bill.py deleted file mode 100644 index c1cd7b95..00000000 --- a/csf_tz/csf_tz/doctype/parking_bill/parking_bill.py +++ /dev/null @@ -1,155 +0,0 @@ -# Copyright (c) 2021, Aakvatech and contributors -# For license information, please see license.txt - -import json -import re -import frappe -from frappe import _ -from frappe.utils import getdate -import requests -from requests.exceptions import Timeout -from frappe.model.document import Document - - -class ParkingBill(Document): - pass - -@frappe.whitelist() -def check_bills_all_vehicles(): - plate_list = frappe.get_all("Vehicle", fields=['name', 'number_plate', 'license_plate']) - - for vehicle in plate_list: - number_plate = vehicle.get("number_plate") or vehicle.get("license_plate") - vehicle_name = vehicle.get("name") - - if number_plate: - try: - bill = get_bills(number_plate) - - # If bills are found (code 6000) - if bill and bill.code == 6000: - update_bill(vehicle_name, bill) - - # If all bills are paid or no record found (code 6004) - elif bill and bill.code == 6004: - mark_all_bills_as_paid(vehicle_name) - frappe.log_error(f"Vehicle {vehicle_name} ({number_plate}) has no unpaid bills. Marked as paid.") - - except Exception as e: - frappe.log_error(frappe.get_traceback(), str(e)) - - frappe.db.commit() - - -def get_bills(number_plate): - headers = { - 'x-transfer-key': 'e9f3e572-db87-4eff-9ed6-66922f1f7f24', - } - - url = ( - "http://termis.tarura.go.tz:6003/termis-parking-service/api/v1/parkingDetails/debts/plateNumber/" - + number_plate - ) - try: - response = requests.get(url=url, headers=headers, timeout=5) - - if response.status_code == 200: - return frappe._dict(json.loads(response.text)) - else: - res = None - try: - res = json.loads(response.text) - except: - res = response.text - frappe.log_error(res) - return None - - except Timeout: - frappe.log_error(_("Timeout error for plate {0}").format(number_plate)) - return None - except Exception as e: - frappe.log_error(e) - return None - - -def update_bill(name, bills): - if not bills.get("data"): - return - for row in bills.data: - row = frappe._dict(row) - data = frappe._dict(row.bill) - - if frappe.db.exists("Parking Bill", data.billReference): - doc = frappe.get_doc("Parking Bill", data.billReference) - else: - doc = frappe.new_doc("Parking Bill") - doc.billreference = data.billReference - - doc.vehicle = name - doc.billstatus = row.billStatus - doc.billid = data.billId - doc.approvedby = data.approvedBy - doc.billdescription = data.billDescription - doc.billpayed = 1 if data.billPayed else 0 - doc.billedamount = data.billedAmount - doc.billcontrolnumber = data.billControlNumber - doc.billequivalentamount = data.billEquivalentAmount - doc.expirydate = getdate(data.expiryDate) - doc.generateddate = getdate(data.generatedDate) - doc.miscellaneousamount = data.miscellaneousAmount - doc.payeremail = data.payerEmail - doc.remarks = data.remarks - doc.payerphone = data.payerPhone - doc.payername = data.payerName - doc.reminderflag = data.reminderFlag - doc.spsystemid = data.spSystemId - doc.billpaytype = data.billPayType - doc.receivedtime = data.receivedTime - doc.billcurrency = data.currency - doc.applicationid = data.applicationId - doc.collectioncode = data.collectionCode - doc.type = data.type - doc.createdby = data.createdBy - doc.itemid = data.itemId - doc.parkingdetailsid = data.parkingDetailsId - - doc.bilitems = [] - for item in data.billItems: - item = frappe._dict(item) - bill_item = doc.append("bilitems", {}) - bill_item.billitemrefid = item.billItemRefId - bill_item.billitemref = item.billItemRef - bill_item.billitemamount = item.billItemAmount - bill_item.billitemmiscamount = item.billItemMiscAmount - bill_item.billitemeqvamount = item.billItemEqvAmount - bill_item.billitemdescription = item.billItemDescription - bill_item.date = item.date - bill_item.sourcename = item.isourceName - bill_item.gsfcode = item.gsfCode - bill_item.parkingdetailsid = item.parkingDetailsId - - doc.parkingdetails = [] - for det in row.parkingDetails: - det = frappe._dict(det) - detail = doc.append("parkingdetails", {}) - detail.id = det.id - detail.collectorid = det.icollectorIdd - detail.councilcode = det.councilCode - detail.intime = det.inTime - detail.outtime = det.outTime - detail.detailinsertionstatus = det.detailInsertionStatus.get("description") - detail.coordinates = det.coordinates - - doc.save(ignore_permissions=True) - - -def mark_all_bills_as_paid(vehicle_name): - """ - Marks all unpaid bills for the given vehicle as paid when the API response indicates all bills are cleared. - """ - unpaid_bills = frappe.get_all("Parking Bill", filters={'vehicle': vehicle_name, 'billpayed': 0}) - - for bill in unpaid_bills: - doc = frappe.get_doc("Parking Bill", bill['name']) - doc.billpayed = 1 # Mark the bill as paid - doc.save(ignore_permissions=True) diff --git a/csf_tz/csf_tz/doctype/parking_bill/test_parking_bill.py b/csf_tz/csf_tz/doctype/parking_bill/test_parking_bill.py deleted file mode 100644 index 9e125d13..00000000 --- a/csf_tz/csf_tz/doctype/parking_bill/test_parking_bill.py +++ /dev/null @@ -1,8 +0,0 @@ -# Copyright (c) 2021, Aakvatech and Contributors -# See license.txt - -# import frappe -import unittest - -class TestParkingBill(unittest.TestCase): - pass diff --git a/csf_tz/csf_tz/doctype/parking_bill_details/__init__.py b/csf_tz/csf_tz/doctype/parking_bill_details/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/csf_tz/doctype/parking_bill_details/parking_bill_details.json b/csf_tz/csf_tz/doctype/parking_bill_details/parking_bill_details.json deleted file mode 100644 index b75677c8..00000000 --- a/csf_tz/csf_tz/doctype/parking_bill_details/parking_bill_details.json +++ /dev/null @@ -1,76 +0,0 @@ -{ - "actions": [], - "creation": "2021-09-18 23:39:04.042497", - "doctype": "DocType", - "editable_grid": 1, - "engine": "InnoDB", - "field_order": [ - "id", - "collectorid", - "councilcode", - "intime", - "outtime", - "detailinsertionstatus", - "coordinates" - ], - "fields": [ - { - "fieldname": "id", - "fieldtype": "Data", - "label": "id", - "read_only": 1 - }, - { - "fieldname": "collectorid", - "fieldtype": "Data", - "label": "collectorId", - "read_only": 1 - }, - { - "fieldname": "councilcode", - "fieldtype": "Data", - "label": "councilCode", - "read_only": 1 - }, - { - "fieldname": "intime", - "fieldtype": "Datetime", - "in_list_view": 1, - "label": "inTime", - "read_only": 1 - }, - { - "fieldname": "outtime", - "fieldtype": "Datetime", - "in_list_view": 1, - "label": "outTime", - "read_only": 1 - }, - { - "fieldname": "detailinsertionstatus", - "fieldtype": "Data", - "in_list_view": 1, - "label": "detailInsertionStatus", - "read_only": 1 - }, - { - "fieldname": "coordinates", - "fieldtype": "Data", - "in_list_view": 1, - "label": "coordinates", - "read_only": 1 - } - ], - "index_web_pages_for_search": 1, - "istable": 1, - "links": [], - "modified": "2021-09-18 23:45:04.557419", - "modified_by": "Administrator", - "module": "CSF TZ", - "name": "Parking Bill Details", - "owner": "Administrator", - "permissions": [], - "sort_field": "modified", - "sort_order": "DESC", - "track_changes": 1 -} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/parking_bill_details/parking_bill_details.py b/csf_tz/csf_tz/doctype/parking_bill_details/parking_bill_details.py deleted file mode 100644 index 07f4d23a..00000000 --- a/csf_tz/csf_tz/doctype/parking_bill_details/parking_bill_details.py +++ /dev/null @@ -1,8 +0,0 @@ -# Copyright (c) 2021, Aakvatech and contributors -# For license information, please see license.txt - -# import frappe -from frappe.model.document import Document - -class ParkingBillDetails(Document): - pass diff --git a/csf_tz/csf_tz/doctype/parking_bill_items/__init__.py b/csf_tz/csf_tz/doctype/parking_bill_items/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/csf_tz/doctype/parking_bill_items/parking_bill_items.json b/csf_tz/csf_tz/doctype/parking_bill_items/parking_bill_items.json deleted file mode 100644 index 29cc0821..00000000 --- a/csf_tz/csf_tz/doctype/parking_bill_items/parking_bill_items.json +++ /dev/null @@ -1,100 +0,0 @@ -{ - "actions": [], - "creation": "2021-09-18 23:17:43.420193", - "doctype": "DocType", - "editable_grid": 1, - "engine": "InnoDB", - "field_order": [ - "billitemrefid", - "billitemref", - "billitemamount", - "billitemmiscamount", - "billitemeqvamount", - "billitemdescription", - "date", - "sourcename", - "gsfcode", - "parkingdetailsid" - ], - "fields": [ - { - "fieldname": "billitemrefid", - "fieldtype": "Data", - "in_list_view": 1, - "label": "billItemRefId", - "read_only": 1 - }, - { - "fieldname": "billitemref", - "fieldtype": "Data", - "in_list_view": 1, - "label": "billItemRef", - "read_only": 1 - }, - { - "fieldname": "billitemamount", - "fieldtype": "Float", - "in_list_view": 1, - "label": "billItemAmount", - "read_only": 1 - }, - { - "fieldname": "billitemmiscamount", - "fieldtype": "Float", - "label": "billItemMiscAmount", - "read_only": 1 - }, - { - "fieldname": "billitemeqvamount", - "fieldtype": "Float", - "label": "billItemEqvAmount", - "read_only": 1 - }, - { - "fieldname": "billitemdescription", - "fieldtype": "Data", - "in_list_view": 1, - "label": "billItemDescription", - "read_only": 1 - }, - { - "fieldname": "date", - "fieldtype": "Date", - "in_list_view": 1, - "label": "date", - "read_only": 1 - }, - { - "fieldname": "sourcename", - "fieldtype": "Data", - "in_list_view": 1, - "label": "sourceName", - "read_only": 1 - }, - { - "fieldname": "gsfcode", - "fieldtype": "Data", - "in_list_view": 1, - "label": "gsfCode", - "read_only": 1 - }, - { - "fieldname": "parkingdetailsid", - "fieldtype": "Data", - "label": "parkingDetailsId", - "read_only": 1 - } - ], - "index_web_pages_for_search": 1, - "istable": 1, - "links": [], - "modified": "2021-09-18 23:19:27.317425", - "modified_by": "Administrator", - "module": "CSF TZ", - "name": "Parking Bill Items", - "owner": "Administrator", - "permissions": [], - "sort_field": "modified", - "sort_order": "DESC", - "track_changes": 1 -} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/parking_bill_items/parking_bill_items.py b/csf_tz/csf_tz/doctype/parking_bill_items/parking_bill_items.py deleted file mode 100644 index 5f58448f..00000000 --- a/csf_tz/csf_tz/doctype/parking_bill_items/parking_bill_items.py +++ /dev/null @@ -1,8 +0,0 @@ -# Copyright (c) 2021, Aakvatech and contributors -# For license information, please see license.txt - -# import frappe -from frappe.model.document import Document - -class ParkingBillItems(Document): - pass diff --git a/csf_tz/csf_tz/doctype/piecework/__init__.py b/csf_tz/csf_tz/doctype/piecework/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/csf_tz/doctype/piecework/piecework.js b/csf_tz/csf_tz/doctype/piecework/piecework.js deleted file mode 100644 index 73954746..00000000 --- a/csf_tz/csf_tz/doctype/piecework/piecework.js +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) 2021, Aakvatech and contributors -// For license information, please see license.txt - -frappe.ui.form.on("Piecework", { - task: (frm) => setTotal(frm), - quantity: (frm) => setTotal(frm), - task_rate: (frm) => setTotal(frm), - - setup: (frm) => { - frm.set_query("task", () => { - return { - filters: { - disabled: 0, - }, - }; - }); - }, -}); - -const setTotal = (frm) => { - const total = frm.doc.task_rate * frm.doc.quantity || 0; - frm.set_value("total", total); - const count = frm.doc.employees.length; - frm.doc.employees.forEach((row) => { - frappe.model.set_value(row.doctype, row.name, "amount", total / count); - }); -}; diff --git a/csf_tz/csf_tz/doctype/piecework/piecework.json b/csf_tz/csf_tz/doctype/piecework/piecework.json deleted file mode 100644 index ad1b55c0..00000000 --- a/csf_tz/csf_tz/doctype/piecework/piecework.json +++ /dev/null @@ -1,157 +0,0 @@ -{ - "autoname": "format:{date}-{task}-{######}", - "creation": "2021-01-17 00:13:39.930551", - "doctype": "DocType", - "editable_grid": 1, - "engine": "InnoDB", - "field_order": [ - "date", - "column_break_2", - "company", - "section_break_3", - "task", - "quantity", - "column_break_6", - "task_name", - "task_rate", - "total", - "section_break_9", - "employees", - "amended_from" - ], - "fields": [ - { - "fieldname": "date", - "fieldtype": "Date", - "in_list_view": 1, - "label": "Date", - "reqd": 1 - }, - { - "fieldname": "column_break_2", - "fieldtype": "Column Break" - }, - { - "fieldname": "section_break_3", - "fieldtype": "Section Break" - }, - { - "fieldname": "task", - "fieldtype": "Link", - "in_list_view": 1, - "label": "Task", - "options": "Piecework Type", - "reqd": 1 - }, - { - "fieldname": "quantity", - "fieldtype": "Float", - "in_list_view": 1, - "label": "Quantity", - "reqd": 1 - }, - { - "fieldname": "column_break_6", - "fieldtype": "Column Break" - }, - { - "fetch_from": "task.rate", - "fieldname": "task_rate", - "fieldtype": "Currency", - "in_list_view": 1, - "label": "Task Rate", - "precision": "2", - "read_only": 1 - }, - { - "fieldname": "total", - "fieldtype": "Currency", - "label": "Total", - "read_only": 1 - }, - { - "fieldname": "section_break_9", - "fieldtype": "Section Break" - }, - { - "fieldname": "employees", - "fieldtype": "Table", - "label": "Employees", - "options": "Piecework Payment Allocation", - "reqd": 1 - }, - { - "fieldname": "company", - "fieldtype": "Link", - "label": "Company", - "options": "Company", - "reqd": 1 - }, - { - "fieldname": "amended_from", - "fieldtype": "Link", - "label": "Amended From", - "no_copy": 1, - "options": "Piecework", - "print_hide": 1, - "read_only": 1 - }, - { - "fetch_from": "task.task_name", - "fieldname": "task_name", - "fieldtype": "Data", - "label": "Task Name", - "read_only": 1 - } - ], - "is_submittable": 1, - "modified": "2021-04-23 23:42:01.650310", - "modified_by": "Administrator", - "module": "CSF TZ", - "name": "Piecework", - "owner": "Administrator", - "permissions": [ - { - "cancel": 1, - "create": 1, - "delete": 1, - "email": 1, - "export": 1, - "print": 1, - "read": 1, - "report": 1, - "role": "System Manager", - "share": 1, - "submit": 1, - "write": 1 - }, - { - "create": 1, - "delete": 1, - "email": 1, - "export": 1, - "print": 1, - "read": 1, - "report": 1, - "role": "HR Manager", - "share": 1, - "write": 1 - }, - { - "create": 1, - "delete": 1, - "email": 1, - "export": 1, - "print": 1, - "read": 1, - "report": 1, - "role": "HR User", - "share": 1, - "write": 1 - } - ], - "quick_entry": 1, - "sort_field": "modified", - "sort_order": "DESC", - "track_changes": 1 -} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/piecework/piecework.py b/csf_tz/csf_tz/doctype/piecework/piecework.py deleted file mode 100644 index 816509c5..00000000 --- a/csf_tz/csf_tz/doctype/piecework/piecework.py +++ /dev/null @@ -1,42 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (c) 2021, Aakvatech and contributors -# For license information, please see license.txt - -from __future__ import unicode_literals -import frappe -from frappe import _ -from frappe.model.document import Document - - -class Piecework(Document): - def before_submit(self): - create_additional_salaries(self) - - def validate(self): - self.total = self.quantity * frappe.db.get_value('Piecework Type', self.task, 'rate') - employees = [] - amount = self.total / len(self.employees) - for row in self.employees: - if row.employee not in employees: - employees.append(row.employee) - row.amount = amount - else: - frappe.throw( - "The employee '{0}' is this duplicate in the table in row {1}".format(row.employee, row.idx)) - - -def create_additional_salaries(doc): - for row in doc.employees: - if row.employee and row.amount: - as_doc = frappe.new_doc("Additional Salary") - as_doc.employee = row.employee - as_doc.salary_component = 'Piecework' - as_doc.amount = row.amount - as_doc.payroll_date = doc.date - as_doc.company = doc.company - as_doc.overwrite_salary_structure_amount = 0 - as_doc.insert(ignore_permissions=True) - row.additional_salary = as_doc.name - as_doc.submit() - frappe.msgprint(_("Additional Salary {0} created for employee {1}").format( - as_doc.name, row.employee), alert=True) diff --git a/csf_tz/csf_tz/doctype/piecework/test_piecework.py b/csf_tz/csf_tz/doctype/piecework/test_piecework.py deleted file mode 100644 index 76d80cdf..00000000 --- a/csf_tz/csf_tz/doctype/piecework/test_piecework.py +++ /dev/null @@ -1,10 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (c) 2021, Aakvatech and Contributors -# See license.txt -from __future__ import unicode_literals - -# import frappe -import unittest - -class TestPiecework(unittest.TestCase): - pass diff --git a/csf_tz/csf_tz/doctype/piecework_payment_allocation/__init__.py b/csf_tz/csf_tz/doctype/piecework_payment_allocation/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/csf_tz/doctype/piecework_payment_allocation/piecework_payment_allocation.js b/csf_tz/csf_tz/doctype/piecework_payment_allocation/piecework_payment_allocation.js deleted file mode 100644 index f9c867e9..00000000 --- a/csf_tz/csf_tz/doctype/piecework_payment_allocation/piecework_payment_allocation.js +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright (c) 2021, Aakvatech and contributors -// For license information, please see license.txt - -frappe.ui.form.on('Piecework Payment Allocation', { - // refresh: function(frm) { - - // } -}); diff --git a/csf_tz/csf_tz/doctype/piecework_payment_allocation/piecework_payment_allocation.json b/csf_tz/csf_tz/doctype/piecework_payment_allocation/piecework_payment_allocation.json deleted file mode 100644 index 3e90ccdd..00000000 --- a/csf_tz/csf_tz/doctype/piecework_payment_allocation/piecework_payment_allocation.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "creation": "2021-01-17 00:05:31.021900", - "doctype": "DocType", - "editable_grid": 1, - "engine": "InnoDB", - "field_order": [ - "employee", - "employee_name", - "amount", - "additional_salary" - ], - "fields": [ - { - "fieldname": "employee", - "fieldtype": "Link", - "in_list_view": 1, - "label": "Employee", - "options": "Employee", - "reqd": 1 - }, - { - "fieldname": "amount", - "fieldtype": "Currency", - "in_list_view": 1, - "label": "Amount", - "precision": "2", - "read_only": 1 - }, - { - "fieldname": "additional_salary", - "fieldtype": "Link", - "label": "Additional Salary", - "options": "Additional Salary", - "read_only": 1 - }, - { - "fetch_from": "employee.employee_name", - "fieldname": "employee_name", - "fieldtype": "Data", - "in_list_view": 1, - "label": "Employee Name" - } - ], - "istable": 1, - "modified": "2021-02-12 12:15:58.721685", - "modified_by": "Administrator", - "module": "CSF TZ", - "name": "Piecework Payment Allocation", - "owner": "Administrator", - "permissions": [], - "quick_entry": 1, - "sort_field": "modified", - "sort_order": "DESC", - "track_changes": 1 -} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/piecework_payment_allocation/piecework_payment_allocation.py b/csf_tz/csf_tz/doctype/piecework_payment_allocation/piecework_payment_allocation.py deleted file mode 100644 index 0ac6caaa..00000000 --- a/csf_tz/csf_tz/doctype/piecework_payment_allocation/piecework_payment_allocation.py +++ /dev/null @@ -1,10 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (c) 2021, Aakvatech and contributors -# For license information, please see license.txt - -from __future__ import unicode_literals -# import frappe -from frappe.model.document import Document - -class PieceworkPaymentAllocation(Document): - pass diff --git a/csf_tz/csf_tz/doctype/piecework_payment_allocation/test_piecework_payment_allocation.py b/csf_tz/csf_tz/doctype/piecework_payment_allocation/test_piecework_payment_allocation.py deleted file mode 100644 index 9d219fb2..00000000 --- a/csf_tz/csf_tz/doctype/piecework_payment_allocation/test_piecework_payment_allocation.py +++ /dev/null @@ -1,10 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (c) 2021, Aakvatech and Contributors -# See license.txt -from __future__ import unicode_literals - -# import frappe -import unittest - -class TestPieceworkPaymentAllocation(unittest.TestCase): - pass diff --git a/csf_tz/csf_tz/doctype/piecework_salary_disbursement/__init__.py b/csf_tz/csf_tz/doctype/piecework_salary_disbursement/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/csf_tz/doctype/piecework_salary_disbursement/piecework_salary_disbursement.js b/csf_tz/csf_tz/doctype/piecework_salary_disbursement/piecework_salary_disbursement.js deleted file mode 100644 index 9cd1b1ae..00000000 --- a/csf_tz/csf_tz/doctype/piecework_salary_disbursement/piecework_salary_disbursement.js +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright (c) 2021, Aakvatech and contributors -// For license information, please see license.txt - -frappe.ui.form.on('Piecework Salary Disbursement', { - // refresh: function(frm) { - - // } -}); diff --git a/csf_tz/csf_tz/doctype/piecework_salary_disbursement/piecework_salary_disbursement.json b/csf_tz/csf_tz/doctype/piecework_salary_disbursement/piecework_salary_disbursement.json deleted file mode 100644 index 9b61011d..00000000 --- a/csf_tz/csf_tz/doctype/piecework_salary_disbursement/piecework_salary_disbursement.json +++ /dev/null @@ -1,85 +0,0 @@ -{ - "actions": [], - "autoname": "format:start_date-end_date-######", - "creation": "2021-07-01 18:11:07.506913", - "doctype": "DocType", - "editable_grid": 1, - "engine": "InnoDB", - "field_order": [ - "start_date", - "end_date", - "payroll_date", - "column_break_3", - "earning_salary_component", - "deduction_salary_component", - "section_break_6", - "employee" - ], - "fields": [ - { - "fieldname": "start_date", - "fieldtype": "Date", - "label": "Start Date" - }, - { - "fieldname": "end_date", - "fieldtype": "Date", - "label": "End Date" - }, - { - "fieldname": "column_break_3", - "fieldtype": "Column Break" - }, - { - "fieldname": "payroll_date", - "fieldtype": "Date", - "label": "Payroll Date" - }, - { - "fieldname": "section_break_6", - "fieldtype": "Section Break" - }, - { - "fieldname": "employee", - "fieldtype": "Table", - "label": "Employee", - "options": "Employee Piecework Additional Salary" - }, - { - "fieldname": "earning_salary_component", - "fieldtype": "Link", - "label": "Earning Salary Component ", - "options": "Salary Component" - }, - { - "fieldname": "deduction_salary_component", - "fieldtype": "Link", - "label": "Deduction Salary Component", - "options": "Salary Component" - } - ], - "index_web_pages_for_search": 1, - "links": [], - "modified": "2021-07-03 12:37:00.405085", - "modified_by": "Administrator", - "module": "CSF TZ", - "name": "Piecework Salary Disbursement", - "owner": "Administrator", - "permissions": [ - { - "create": 1, - "delete": 1, - "email": 1, - "export": 1, - "print": 1, - "read": 1, - "report": 1, - "role": "System Manager", - "share": 1, - "write": 1 - } - ], - "sort_field": "modified", - "sort_order": "DESC", - "track_changes": 1 -} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/piecework_salary_disbursement/piecework_salary_disbursement.py b/csf_tz/csf_tz/doctype/piecework_salary_disbursement/piecework_salary_disbursement.py deleted file mode 100644 index aa5d0913..00000000 --- a/csf_tz/csf_tz/doctype/piecework_salary_disbursement/piecework_salary_disbursement.py +++ /dev/null @@ -1,8 +0,0 @@ -# Copyright (c) 2021, Aakvatech and contributors -# For license information, please see license.txt - -# import frappe -from frappe.model.document import Document - -class PieceworkSalaryDisbursement(Document): - pass diff --git a/csf_tz/csf_tz/doctype/piecework_salary_disbursement/test_piecework_salary_disbursement.py b/csf_tz/csf_tz/doctype/piecework_salary_disbursement/test_piecework_salary_disbursement.py deleted file mode 100644 index c9805c0d..00000000 --- a/csf_tz/csf_tz/doctype/piecework_salary_disbursement/test_piecework_salary_disbursement.py +++ /dev/null @@ -1,8 +0,0 @@ -# Copyright (c) 2021, Aakvatech and Contributors -# See license.txt - -# import frappe -import unittest - -class TestPieceworkSalaryDisbursement(unittest.TestCase): - pass diff --git a/csf_tz/csf_tz/doctype/piecework_single/__init__.py b/csf_tz/csf_tz/doctype/piecework_single/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/csf_tz/doctype/piecework_single/piecework_single.js b/csf_tz/csf_tz/doctype/piecework_single/piecework_single.js deleted file mode 100644 index e90676d0..00000000 --- a/csf_tz/csf_tz/doctype/piecework_single/piecework_single.js +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) 2021, Aakvatech and contributors -// For license information, please see license.txt - -frappe.ui.form.on('Piecework Single', { - // refresh: function(frm) { - - // } -}); - -frappe.ui.form.on('Single Piecework Employees', { - task: (frm, cdt, cdn) => { - const row = locals[cdt][cdn]; - setTotal(frm, row); - }, - task_rate: (frm, cdt, cdn) => { - const row = locals[cdt][cdn]; - setTotal(frm, row); - }, - quantity: (frm, cdt, cdn) => { - const row = locals[cdt][cdn]; - setTotal(frm, row); - }, -}); - -const setTotal = (frm, row) => { - const total = row.task_rate * row.quantity || 0; - frappe.model.set_value(row.doctype, row.name, "amount", total); -}; \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/piecework_single/piecework_single.json b/csf_tz/csf_tz/doctype/piecework_single/piecework_single.json deleted file mode 100644 index e7f17284..00000000 --- a/csf_tz/csf_tz/doctype/piecework_single/piecework_single.json +++ /dev/null @@ -1,107 +0,0 @@ -{ - "autoname": "format:{date}-{task}-{######}", - "creation": "2021-04-23 23:12:51.189256", - "doctype": "DocType", - "editable_grid": 1, - "engine": "InnoDB", - "field_order": [ - "date", - "column_break_2", - "company", - "section_break_4", - "employees", - "amended_from" - ], - "fields": [ - { - "default": "Today", - "fieldname": "date", - "fieldtype": "Date", - "label": "Date", - "reqd": 1 - }, - { - "fieldname": "column_break_2", - "fieldtype": "Column Break" - }, - { - "fieldname": "company", - "fieldtype": "Link", - "in_list_view": 1, - "label": "Company", - "options": "Company", - "reqd": 1 - }, - { - "fieldname": "section_break_4", - "fieldtype": "Section Break" - }, - { - "fieldname": "amended_from", - "fieldtype": "Link", - "label": "Amended From", - "no_copy": 1, - "options": "Piecework Single", - "print_hide": 1, - "read_only": 1 - }, - { - "fieldname": "employees", - "fieldtype": "Table", - "label": "Employees", - "options": "Single Piecework Employees", - "reqd": 1 - } - ], - "is_submittable": 1, - "modified": "2021-04-27 00:07:03.606305", - "modified_by": "Administrator", - "module": "CSF TZ", - "name": "Piecework Single", - "owner": "Administrator", - "permissions": [ - { - "cancel": 1, - "create": 1, - "delete": 1, - "email": 1, - "export": 1, - "print": 1, - "read": 1, - "report": 1, - "role": "System Manager", - "share": 1, - "submit": 1, - "write": 1 - }, - { - "cancel": 1, - "create": 1, - "delete": 1, - "email": 1, - "export": 1, - "print": 1, - "read": 1, - "report": 1, - "role": "HR Manager", - "share": 1, - "submit": 1, - "write": 1 - }, - { - "create": 1, - "delete": 1, - "email": 1, - "export": 1, - "print": 1, - "read": 1, - "report": 1, - "role": "HR User", - "share": 1, - "write": 1 - } - ], - "sort_field": "modified", - "sort_order": "DESC", - "track_changes": 1 -} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/piecework_single/piecework_single.py b/csf_tz/csf_tz/doctype/piecework_single/piecework_single.py deleted file mode 100644 index 538f8a67..00000000 --- a/csf_tz/csf_tz/doctype/piecework_single/piecework_single.py +++ /dev/null @@ -1,34 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (c) 2021, Aakvatech and contributors -# For license information, please see license.txt - -from __future__ import unicode_literals -import frappe -from frappe import _ -from frappe.model.document import Document - - -class PieceworkSingle(Document): - def before_submit(self): - create_additional_salaries(self) - - -def create_additional_salaries(doc): - for row in doc.employees: - if row.employee and row.amount: - as_doc = frappe.new_doc("Additional Salary") - as_doc.employee = row.employee - as_doc.salary_component = "Piecework" - as_doc.amount = row.amount - as_doc.payroll_date = doc.date - as_doc.company = doc.company - as_doc.overwrite_salary_structure_amount = 0 - as_doc.insert(ignore_permissions=True) - row.additional_salary = as_doc.name - as_doc.submit() - frappe.msgprint( - _("Additional Salary {0} created for employee {1}").format( - as_doc.name, row.employee - ), - alert=True, - ) diff --git a/csf_tz/csf_tz/doctype/piecework_single/test_piecework_single.py b/csf_tz/csf_tz/doctype/piecework_single/test_piecework_single.py deleted file mode 100644 index d0f6a26f..00000000 --- a/csf_tz/csf_tz/doctype/piecework_single/test_piecework_single.py +++ /dev/null @@ -1,10 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (c) 2021, Aakvatech and Contributors -# See license.txt -from __future__ import unicode_literals - -# import frappe -import unittest - -class TestPieceworkSingle(unittest.TestCase): - pass diff --git a/csf_tz/csf_tz/doctype/piecework_type/__init__.py b/csf_tz/csf_tz/doctype/piecework_type/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/csf_tz/doctype/piecework_type/piecework_type.js b/csf_tz/csf_tz/doctype/piecework_type/piecework_type.js deleted file mode 100644 index b7ec93a3..00000000 --- a/csf_tz/csf_tz/doctype/piecework_type/piecework_type.js +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright (c) 2021, Aakvatech and contributors -// For license information, please see license.txt - -frappe.ui.form.on('Piecework Type', { - // refresh: function(frm) { - - // } -}); diff --git a/csf_tz/csf_tz/doctype/piecework_type/piecework_type.json b/csf_tz/csf_tz/doctype/piecework_type/piecework_type.json deleted file mode 100644 index 70479884..00000000 --- a/csf_tz/csf_tz/doctype/piecework_type/piecework_type.json +++ /dev/null @@ -1,91 +0,0 @@ -{ - "autoname": "format:{task_code}", - "creation": "2021-01-17 00:02:10.540373", - "doctype": "DocType", - "editable_grid": 1, - "engine": "InnoDB", - "field_order": [ - "task_code", - "task_name", - "column_break_3", - "rate", - "uom", - "disabled", - "section_break_6", - "description" - ], - "fields": [ - { - "fieldname": "task_code", - "fieldtype": "Data", - "in_list_view": 1, - "label": "Task Code", - "reqd": 1, - "unique": 1 - }, - { - "fieldname": "task_name", - "fieldtype": "Data", - "in_global_search": 1, - "in_list_view": 1, - "in_standard_filter": 1, - "label": "Task Name", - "reqd": 1 - }, - { - "fieldname": "column_break_3", - "fieldtype": "Column Break" - }, - { - "fieldname": "rate", - "fieldtype": "Currency", - "in_list_view": 1, - "label": "Rate", - "reqd": 1 - }, - { - "fieldname": "uom", - "fieldtype": "Link", - "label": "UOM", - "options": "UOM" - }, - { - "fieldname": "section_break_6", - "fieldtype": "Section Break" - }, - { - "fieldname": "description", - "fieldtype": "Text", - "label": "Description" - }, - { - "default": "0", - "fieldname": "disabled", - "fieldtype": "Check", - "label": "Disabled" - } - ], - "modified": "2021-02-12 12:58:32.138100", - "modified_by": "Administrator", - "module": "CSF TZ", - "name": "Piecework Type", - "owner": "Administrator", - "permissions": [ - { - "create": 1, - "delete": 1, - "email": 1, - "export": 1, - "print": 1, - "read": 1, - "report": 1, - "role": "System Manager", - "share": 1, - "write": 1 - } - ], - "quick_entry": 1, - "sort_field": "modified", - "sort_order": "DESC", - "track_changes": 1 -} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/piecework_type/piecework_type.py b/csf_tz/csf_tz/doctype/piecework_type/piecework_type.py deleted file mode 100644 index ec0e71f1..00000000 --- a/csf_tz/csf_tz/doctype/piecework_type/piecework_type.py +++ /dev/null @@ -1,10 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (c) 2021, Aakvatech and contributors -# For license information, please see license.txt - -from __future__ import unicode_literals -# import frappe -from frappe.model.document import Document - -class PieceworkType(Document): - pass diff --git a/csf_tz/csf_tz/doctype/piecework_type/test_piecework_type.py b/csf_tz/csf_tz/doctype/piecework_type/test_piecework_type.py deleted file mode 100644 index aa7491b3..00000000 --- a/csf_tz/csf_tz/doctype/piecework_type/test_piecework_type.py +++ /dev/null @@ -1,10 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (c) 2021, Aakvatech and Contributors -# See license.txt -from __future__ import unicode_literals - -# import frappe -import unittest - -class TestPieceworkType(unittest.TestCase): - pass diff --git a/csf_tz/csf_tz/doctype/possible_root_cause/__init__.py b/csf_tz/csf_tz/doctype/possible_root_cause/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/csf_tz/doctype/possible_root_cause/possible_root_cause.js b/csf_tz/csf_tz/doctype/possible_root_cause/possible_root_cause.js deleted file mode 100644 index 750e4273..00000000 --- a/csf_tz/csf_tz/doctype/possible_root_cause/possible_root_cause.js +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright (c) 2022, Aakvatech and contributors -// For license information, please see license.txt - -frappe.ui.form.on('Possible Root Cause', { - // refresh: function(frm) { - - // } -}); diff --git a/csf_tz/csf_tz/doctype/possible_root_cause/possible_root_cause.json b/csf_tz/csf_tz/doctype/possible_root_cause/possible_root_cause.json deleted file mode 100644 index 9946c8a6..00000000 --- a/csf_tz/csf_tz/doctype/possible_root_cause/possible_root_cause.json +++ /dev/null @@ -1,165 +0,0 @@ -{ - "actions": [], - "allow_rename": 1, - "creation": "2022-05-28 12:55:52.861403", - "doctype": "DocType", - "editable_grid": 1, - "engine": "InnoDB", - "field_order": [ - "root_cause_of_the_issue", - "rate_probability", - "description", - "category_column_break", - "categorize_root_cause", - "please_specify", - "investigation_section_break", - "investigation", - "investigation_area", - "interview_conducted", - "interview_summary", - "interview_column_break", - "number_of_people_interviewed", - "name_of_interviewer", - "findings_and_evidences_section_break", - "findings_of_investigation", - "evidence_available", - "list_evidence_column_break", - "list_documented_evidence", - "attach_evidence" - ], - "fields": [ - { - "fieldname": "root_cause_of_the_issue", - "fieldtype": "Data", - "in_list_view": 1, - "label": "What is the root cause of the issue?", - "reqd": 1 - }, - { - "fieldname": "rate_probability", - "fieldtype": "Select", - "in_list_view": 1, - "label": "Rate probability as the root cause", - "options": "\nLow\nMedium\nHigh" - }, - { - "fieldname": "category_column_break", - "fieldtype": "Column Break" - }, - { - "fieldname": "categorize_root_cause", - "fieldtype": "Select", - "in_list_view": 1, - "label": "Categorize the root cause", - "options": "\nProcess\nEquipment\nLack of Communication\nLack of Knowledge\nIncorrect Information\n3rd Party Software\nNetwork\nOther", - "reqd": 1 - }, - { - "depends_on": "eval: doc.categorize_root_cause == \"Other\"", - "fieldname": "please_specify", - "fieldtype": "Small Text", - "label": "Please specify", - "mandatory_depends_on": "eval: doc.categorize_root_cause == \"Other\"" - }, - { - "description": "Brief describle the root cause depending on the category of the rout cause", - "fieldname": "description", - "fieldtype": "Small Text", - "label": "Description" - }, - { - "fieldname": "investigation", - "fieldtype": "Select", - "label": "Were any Investigation done?", - "options": "\nNo\nYes" - }, - { - "depends_on": "eval: doc.investigation == \"Yes\"\r\n", - "fieldname": "investigation_area", - "fieldtype": "Data", - "label": "In which area/department did the investigation begin?", - "mandatory_depends_on": "eval: doc.investigation == \"Yes\"\r\n" - }, - { - "depends_on": "eval: doc.interview_conducted == \"Yes\"\r\n", - "fieldname": "number_of_people_interviewed", - "fieldtype": "Data", - "label": "How Many People Interviewed", - "mandatory_depends_on": "eval: doc.interview_conducted == \"Yes\"\r\n" - }, - { - "depends_on": "eval: doc.interview_conducted == \"Yes\"\r\n", - "fieldname": "name_of_interviewer", - "fieldtype": "Small Text", - "label": "Name(s) of Interviewers", - "mandatory_depends_on": "eval: doc.interview_conducted == \"Yes\"\r\n" - }, - { - "depends_on": "eval: doc.interview_conducted == \"Yes\"\r\n", - "fieldname": "interview_summary", - "fieldtype": "Small Text", - "label": "Give a brief summary of the interview.", - "mandatory_depends_on": "eval: doc.interview_conducted == \"Yes\"\r\n" - }, - { - "fieldname": "findings_of_investigation", - "fieldtype": "Small Text", - "label": "List any findings pertinent to the investigation." - }, - { - "fieldname": "evidence_available", - "fieldtype": "Select", - "label": "Was any evidence available that helped determine the root cause?", - "options": "\nNo\nYes" - }, - { - "depends_on": "eval: doc.evidence_available == \"Yes\"\r\n", - "fieldname": "list_documented_evidence", - "fieldtype": "Small Text", - "label": "List the items documented as evidence of the root cause.", - "mandatory_depends_on": "eval: doc.evidence_available == \"Yes\"\r\n" - }, - { - "depends_on": "eval: doc.evidence_available == \"Yes\"\r\n", - "fieldname": "attach_evidence", - "fieldtype": "Attach", - "label": "Attach Evidence", - "mandatory_depends_on": "eval: doc.evidence_available == \"Yes\"\r\n" - }, - { - "fieldname": "investigation_section_break", - "fieldtype": "Section Break", - "label": "Investigation" - }, - { - "fieldname": "interview_conducted", - "fieldtype": "Select", - "label": "Were any interviews conducted?", - "options": "\nNo\nYes" - }, - { - "fieldname": "findings_and_evidences_section_break", - "fieldtype": "Section Break", - "label": "Findings and Evidences" - }, - { - "fieldname": "list_evidence_column_break", - "fieldtype": "Column Break" - }, - { - "fieldname": "interview_column_break", - "fieldtype": "Column Break" - } - ], - "index_web_pages_for_search": 1, - "istable": 1, - "links": [], - "modified": "2022-06-01 18:05:58.567278", - "modified_by": "Administrator", - "module": "CSF TZ", - "name": "Possible Root Cause", - "owner": "Administrator", - "permissions": [], - "sort_field": "modified", - "sort_order": "DESC" -} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/possible_root_cause/possible_root_cause.py b/csf_tz/csf_tz/doctype/possible_root_cause/possible_root_cause.py deleted file mode 100644 index d2aba916..00000000 --- a/csf_tz/csf_tz/doctype/possible_root_cause/possible_root_cause.py +++ /dev/null @@ -1,8 +0,0 @@ -# Copyright (c) 2022, Aakvatech and contributors -# For license information, please see license.txt - -# import frappe -from frappe.model.document import Document - -class PossibleRootCause(Document): - pass diff --git a/csf_tz/csf_tz/doctype/possible_root_cause/test_possible_root_cause.py b/csf_tz/csf_tz/doctype/possible_root_cause/test_possible_root_cause.py deleted file mode 100644 index 16ecef45..00000000 --- a/csf_tz/csf_tz/doctype/possible_root_cause/test_possible_root_cause.py +++ /dev/null @@ -1,8 +0,0 @@ -# Copyright (c) 2022, Aakvatech and Contributors -# See license.txt - -# import frappe -import unittest - -class TestPossibleRootCause(unittest.TestCase): - pass diff --git a/csf_tz/csf_tz/doctype/price_change_request/__init__.py b/csf_tz/csf_tz/doctype/price_change_request/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/csf_tz/doctype/price_change_request/price_change_request.js b/csf_tz/csf_tz/doctype/price_change_request/price_change_request.js deleted file mode 100644 index 24475327..00000000 --- a/csf_tz/csf_tz/doctype/price_change_request/price_change_request.js +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright (c) 2022, Aakvatech and contributors -// For license information, please see license.txt - -frappe.ui.form.on('Price Change Request', { - // refresh: function(frm) { - - // } -}); diff --git a/csf_tz/csf_tz/doctype/price_change_request/price_change_request.json b/csf_tz/csf_tz/doctype/price_change_request/price_change_request.json deleted file mode 100644 index c34e89ee..00000000 --- a/csf_tz/csf_tz/doctype/price_change_request/price_change_request.json +++ /dev/null @@ -1,109 +0,0 @@ -{ - "actions": [], - "allow_rename": 1, - "autoname": "PCR-.YYYY.-.####", - "creation": "2022-11-09 14:26:55.068562", - "doctype": "DocType", - "editable_grid": 1, - "engine": "InnoDB", - "field_order": [ - "company", - "column_break_2", - "posting_date", - "section_break_4", - "items", - "section_break_5", - "requested_by", - "column_break_6", - "approved_by", - "amended_from" - ], - "fields": [ - { - "fieldname": "company", - "fieldtype": "Link", - "in_list_view": 1, - "label": "Company", - "options": "Company", - "reqd": 1 - }, - { - "fieldname": "column_break_2", - "fieldtype": "Column Break" - }, - { - "fieldname": "posting_date", - "fieldtype": "Date", - "label": "Posting Date", - "read_only": 1 - }, - { - "fieldname": "section_break_4", - "fieldtype": "Section Break" - }, - { - "fieldname": "items", - "fieldtype": "Table", - "label": "Items", - "options": "Price Change Request Detail" - }, - { - "fieldname": "section_break_5", - "fieldtype": "Section Break" - }, - { - "fieldname": "requested_by", - "fieldtype": "Data", - "label": "Requested by", - "read_only": 1 - }, - { - "fieldname": "column_break_6", - "fieldtype": "Column Break" - }, - { - "fieldname": "approved_by", - "fieldtype": "Data", - "label": "Approved by", - "read_only": 1 - }, - { - "fieldname": "amended_from", - "fieldtype": "Link", - "label": "Amended From", - "no_copy": 1, - "options": "Price Change Request", - "print_hide": 1, - "read_only": 1 - } - ], - "index_web_pages_for_search": 1, - "is_submittable": 1, - "links": [], - "modified": "2023-11-20 09:13:36.781225", - "modified_by": "Administrator", - "module": "CSF TZ", - "name": "Price Change Request", - "naming_rule": "Expression (old style)", - "owner": "Administrator", - "permissions": [ - { - "create": 1, - "delete": 1, - "email": 1, - "export": 1, - "print": 1, - "read": 1, - "report": 1, - "role": "System Manager", - "share": 1, - "write": 1 - } - ], - "sort_field": "modified", - "sort_order": "DESC", - "states": [], - "track_changes": 1, - "track_seen": 1, - "track_views": 1 -} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/price_change_request/price_change_request.py b/csf_tz/csf_tz/doctype/price_change_request/price_change_request.py deleted file mode 100644 index bcab9743..00000000 --- a/csf_tz/csf_tz/doctype/price_change_request/price_change_request.py +++ /dev/null @@ -1,152 +0,0 @@ -# Copyright (c) 2022, Aakvatech and contributors -# For license information, please see license.txt - -import frappe -from frappe import _ -from frappe.model.document import Document -from csf_tz.api.utils import msgThrow -from frappe.utils import nowdate, get_fullname, get_url_to_form, flt -from erpnext.stock.doctype.item.item import get_last_purchase_details - - -class PriceChangeRequest(Document): - def before_insert(self): - self.posting_date = nowdate() - self.requested_by = get_fullname(frappe.session.user) - - def validate(self): - for row in self.items: - validate_item(row.item_code, "validate") - validate_price_list(row.price_list, "validate") - - row.old_price = set_old_price(row) - - item_details = get_last_purchase_details(row.item_code) - if not item_details: - row.cost = flt( - frappe.get_cached_value("Item", row.item_code, "last_purchase_rate") - ) - - row.cost = flt((flt(item_details.get("base_net_rate")) * 1.0) / 1.0) - - def before_submit(self): - for row in self.items: - validate_item(row.item_code, "throw") - validate_price_list(row.price_list, "throw") - validate_zero_prices(row) - - set_new_price_item(row, nowdate()) - self.approved_by = get_fullname(frappe.session.user) - - -@frappe.whitelist() -def validate_item(item, method): - disabled = frappe.get_cached_value("Item", item, "disabled") - if disabled == 1: - msgThrow(_("Item: {0} is disabled".format(frappe.bold(item))), method) - - -@frappe.whitelist() -def validate_price_list(price_list, method): - if not frappe.get_cached_value("Price List", price_list, "enabled"): - msgThrow( - _("Price List: {0} is disabled".format(frappe.bold(price_list))), method - ) - - -def set_old_price(item): - """set old price of an item from item price""" - - filters = {"item_code": item.item_code, "price_list": item.price_list} - if item.valid_from: - filters["valid_from"] = [">=", item.valid_from] - else: - filters["valid_from"] = ["<=", nowdate()] - - if item.valid_to: - filters["valid_upto"] = ["<=", item.valid_to] - - items = frappe.get_all( - "Item Price", - filters, - ["name", "item_code", "price_list_rate"], - order_by="valid_from desc", - ) - if items: - return items[0].price_list_rate - - -def validate_zero_prices(row): - """Check for zero price, and stopping zero price of an item before updating item price""" - - if not row.new_price: - frappe.throw( - "Zero price is not allowed for an item: {0}, row: #{1}".format( - frappe.bold(row.item_code), frappe.bold(row.idx) - ) - ) - - -def set_new_price_item(row, date): - """Set new price to existing item price or create new item price""" - filters = { - "item_code": row.item_code, - "price_list": row.price_list, - } - if row.valid_from: - filters["valid_from"] = [">=", row.valid_from] - else: - filters["valid_from"] = ["<=", date] - - if row.valid_to: - filters["valid_upto"] = ["<=", row.valid_to] - - item_price = frappe.get_all("Item Price", filters=filters) - - if len(item_price) == 0: - record = create_new_item_price(row, date) - if record.get("name"): - url_to_item_price = get_url_to_form(record.doctype, record.name) - frappe.msgprint( - "New Item Price: {1} is created".format( - url_to_item_price, frappe.bold(record.name) - ) - ) - - return True - - elif len(item_price) > 1: - msg = f"""Multiple Item Prices found for Item: {row.item_code} Price List: {row.price_list}""" - if row.valid_from: - msg += f" Valid From: {row.valid_from}" - if row.valid_to: - msg += f" Valid To: {row.valid_to}" - frappe.throw( - f"{msg}
Please delete one of them or set valid from and valid to date correctly" - ) - - else: - frappe.set_value( - "Item Price", item_price[0].name, "price_list_rate", row.new_price - ) - - -def create_new_item_price(row, date): - """Create new item price if no any item price found for item code and price list""" - - frappe.msgprint( - f"There is no Item price for this Item: {frappe.bold(row.item_code)} and price list: {frappe.bold(row.price_list)}.
New Item price will be created", - alert=True, - ) - new_item_price = frappe.get_doc( - { - "doctype": "Item Price", - "item_code": row.item_code, - "price_list": row.price_list, - "price_list_rate": row.new_price, - "valid_from": row.valid_from if row.valid_from else date, - "valid_upto": row.valid_to if row.valid_to else None, - } - ).insert(ignore_permissions=True) - - return new_item_price diff --git a/csf_tz/csf_tz/doctype/price_change_request/test_price_change_request.py b/csf_tz/csf_tz/doctype/price_change_request/test_price_change_request.py deleted file mode 100644 index 84302143..00000000 --- a/csf_tz/csf_tz/doctype/price_change_request/test_price_change_request.py +++ /dev/null @@ -1,8 +0,0 @@ -# Copyright (c) 2022, Aakvatech and Contributors -# See license.txt - -# import frappe -import unittest - -class TestPriceChangeRequest(unittest.TestCase): - pass diff --git a/csf_tz/csf_tz/doctype/price_change_request_detail/__init__.py b/csf_tz/csf_tz/doctype/price_change_request_detail/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/csf_tz/doctype/price_change_request_detail/price_change_request_detail.json b/csf_tz/csf_tz/doctype/price_change_request_detail/price_change_request_detail.json deleted file mode 100644 index cfa30689..00000000 --- a/csf_tz/csf_tz/doctype/price_change_request_detail/price_change_request_detail.json +++ /dev/null @@ -1,100 +0,0 @@ -{ - "actions": [], - "allow_rename": 1, - "creation": "2022-11-09 14:24:29.175301", - "doctype": "DocType", - "editable_grid": 1, - "engine": "InnoDB", - "field_order": [ - "item_code", - "price_list", - "old_price", - "column_break_4", - "item_name", - "cost", - "new_price", - "valid_from", - "valid_to" - ], - "fields": [ - { - "fieldname": "item_code", - "fieldtype": "Link", - "in_list_view": 1, - "label": "Item Code", - "options": "Item", - "reqd": 1 - }, - { - "fieldname": "price_list", - "fieldtype": "Link", - "in_list_view": 1, - "label": "Price List", - "options": "Price List", - "reqd": 1 - }, - { - "fieldname": "old_price", - "fieldtype": "Currency", - "in_list_view": 1, - "label": "Old Price", - "read_only": 1, - "options": "price_list_currency" - }, - { - "fieldname": "column_break_4", - "fieldtype": "Column Break" - }, - { - "fetch_from": "item_code.item_name", - "fieldname": "item_name", - "fieldtype": "Data", - "label": "Item Name" - }, - { - "fieldname": "new_price", - "fieldtype": "Currency", - "in_list_view": 1, - "label": "New Price", - "options": "price_list_currency" - }, - { - "fieldname": "cost", - "fieldtype": "Currency", - "label": "Cost" - }, - { - "columns": 1, - "fieldname": "valid_from", - "fieldtype": "Date", - "in_list_view": 1, - "label": "Valid From" - }, - { - "columns": 1, - "fieldname": "valid_to", - "fieldtype": "Date", - "in_list_view": 1, - "label": "Valid To" - }, - { - "fieldname": "price_list_currency", - "fieldtype": "Link", - "label": "Price List Currency", - "options": "Currency", - "fetch_from": "price_list.currency" - } - ], - "index_web_pages_for_search": 1, - "istable": 1, - "links": [], - "modified": "2023-12-18 16:12:00.110059", - "modified_by": "Administrator", - "module": "CSF TZ", - "name": "Price Change Request Detail", - "owner": "Administrator", - "permissions": [], - "sort_field": "modified", - "sort_order": "DESC", - "states": [] -} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/price_change_request_detail/price_change_request_detail.py b/csf_tz/csf_tz/doctype/price_change_request_detail/price_change_request_detail.py deleted file mode 100644 index 51f33091..00000000 --- a/csf_tz/csf_tz/doctype/price_change_request_detail/price_change_request_detail.py +++ /dev/null @@ -1,8 +0,0 @@ -# Copyright (c) 2022, Aakvatech and contributors -# For license information, please see license.txt - -# import frappe -from frappe.model.document import Document - -class PriceChangeRequestDetail(Document): - pass diff --git a/csf_tz/csf_tz/doctype/reporting_gl_entry/__init__.py b/csf_tz/csf_tz/doctype/reporting_gl_entry/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/csf_tz/doctype/reporting_gl_entry/reporting_gl_entry.js b/csf_tz/csf_tz/doctype/reporting_gl_entry/reporting_gl_entry.js deleted file mode 100644 index 4660e8cd..00000000 --- a/csf_tz/csf_tz/doctype/reporting_gl_entry/reporting_gl_entry.js +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright (c) 2022, Aakvatech and contributors -// For license information, please see license.txt - -frappe.ui.form.on('Reporting GL Entry', { - // refresh: function(frm) { - - // } -}); diff --git a/csf_tz/csf_tz/doctype/reporting_gl_entry/reporting_gl_entry.json b/csf_tz/csf_tz/doctype/reporting_gl_entry/reporting_gl_entry.json deleted file mode 100644 index 710d4a45..00000000 --- a/csf_tz/csf_tz/doctype/reporting_gl_entry/reporting_gl_entry.json +++ /dev/null @@ -1,83 +0,0 @@ -{ - "actions": [], - "allow_rename": 1, - "creation": "2022-05-28 13:06:59.877801", - "doctype": "DocType", - "editable_grid": 1, - "engine": "InnoDB", - "field_order": [ - "gl_entry", - "posting_date", - "reporting_currency", - "exchange_rate", - "debit_amount", - "credit_amount", - "day_exchange_rate" - ], - "fields": [ - { - "fieldname": "gl_entry", - "fieldtype": "Link", - "label": "GL Entry", - "options": "GL Entry" - }, - { - "fieldname": "reporting_currency", - "fieldtype": "Link", - "label": "Reporting Currency", - "options": "Currency" - }, - { - "fieldname": "exchange_rate", - "fieldtype": "Float", - "label": "Exchange Rate" - }, - { - "fieldname": "debit_amount", - "fieldtype": "Currency", - "label": "Debit Amount", - "options": "reporting_currency" - }, - { - "fieldname": "credit_amount", - "fieldtype": "Currency", - "label": "Credit Amount", - "options": "reporting_currency" - }, - { - "default": "0", - "fieldname": "day_exchange_rate", - "fieldtype": "Check", - "label": "Day Exchange Rate" - }, - { - "fieldname": "posting_date", - "fieldtype": "Date", - "label": "Posting Date" - } - ], - "in_create": 1, - "index_web_pages_for_search": 1, - "links": [], - "modified": "2022-05-28 13:22:09.512246", - "modified_by": "Administrator", - "module": "CSF TZ", - "name": "Reporting GL Entry", - "owner": "Administrator", - "permissions": [ - { - "create": 1, - "delete": 1, - "email": 1, - "export": 1, - "print": 1, - "read": 1, - "report": 1, - "role": "System Manager", - "share": 1, - "write": 1 - } - ], - "sort_field": "modified", - "sort_order": "DESC" -} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/reporting_gl_entry/reporting_gl_entry.py b/csf_tz/csf_tz/doctype/reporting_gl_entry/reporting_gl_entry.py deleted file mode 100644 index 1485d10e..00000000 --- a/csf_tz/csf_tz/doctype/reporting_gl_entry/reporting_gl_entry.py +++ /dev/null @@ -1,8 +0,0 @@ -# Copyright (c) 2022, Aakvatech and contributors -# For license information, please see license.txt - -# import frappe -from frappe.model.document import Document - -class ReportingGLEntry(Document): - pass diff --git a/csf_tz/csf_tz/doctype/reporting_gl_entry/test_reporting_gl_entry.py b/csf_tz/csf_tz/doctype/reporting_gl_entry/test_reporting_gl_entry.py deleted file mode 100644 index 70d1e37f..00000000 --- a/csf_tz/csf_tz/doctype/reporting_gl_entry/test_reporting_gl_entry.py +++ /dev/null @@ -1,8 +0,0 @@ -# Copyright (c) 2022, Aakvatech and Contributors -# See license.txt - -# import frappe -import unittest - -class TestReportingGLEntry(unittest.TestCase): - pass diff --git a/csf_tz/csf_tz/doctype/root_cause_analysis/__init__.py b/csf_tz/csf_tz/doctype/root_cause_analysis/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/csf_tz/doctype/root_cause_analysis/root_cause_analysis.js b/csf_tz/csf_tz/doctype/root_cause_analysis/root_cause_analysis.js deleted file mode 100644 index 6f69fdf6..00000000 --- a/csf_tz/csf_tz/doctype/root_cause_analysis/root_cause_analysis.js +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright (c) 2022, Aakvatech and contributors -// For license information, please see license.txt - -frappe.ui.form.on('Root Cause Analysis', { - // refresh: function(frm) { - - // } -}); diff --git a/csf_tz/csf_tz/doctype/root_cause_analysis/root_cause_analysis.json b/csf_tz/csf_tz/doctype/root_cause_analysis/root_cause_analysis.json deleted file mode 100644 index dd516281..00000000 --- a/csf_tz/csf_tz/doctype/root_cause_analysis/root_cause_analysis.json +++ /dev/null @@ -1,213 +0,0 @@ -{ - "actions": [], - "allow_import": 1, - "allow_rename": 1, - "autoname": "naming_series:", - "creation": "2022-05-28 11:53:20.931555", - "doctype": "DocType", - "editable_grid": 1, - "engine": "InnoDB", - "field_order": [ - "issue_detail", - "title", - "date_issue_happened", - "department_issue_identified", - "impact_to_productivity", - "rate_colum_break", - "is_recurring_issue", - "frequency_of_the_issue", - "department_affected", - "description_section_break", - "description_of_the_issue", - "report_section_break", - "reported_by", - "phone_no", - "status_column_break", - "status", - "reported_date", - "root_cause_section_break", - "possible_root_cause", - "prevention_section_break", - "prevention_strategy", - "solved_by", - "naming_series" - ], - "fields": [ - { - "fieldname": "issue_detail", - "fieldtype": "Section Break", - "label": "Issue Detail" - }, - { - "fieldname": "rate_colum_break", - "fieldtype": "Column Break" - }, - { - "fieldname": "impact_to_productivity", - "fieldtype": "Select", - "label": "Rate the impact to productivity", - "options": "\nLow\nMedium\nHigh", - "reqd": 1 - }, - { - "fieldname": "description_section_break", - "fieldtype": "Section Break", - "label": "Description" - }, - { - "fieldname": "description_of_the_issue", - "fieldtype": "Small Text", - "label": "Brief description of the issue" - }, - { - "description": "List potential reasons why the issue happened\n", - "fieldname": "possible_root_cause", - "fieldtype": "Table", - "options": "Possible Root Cause" - }, - { - "columns": 1, - "fieldname": "status", - "fieldtype": "Select", - "in_list_view": 1, - "in_standard_filter": 1, - "label": "Status", - "options": "\nPending\nSolved", - "reqd": 1 - }, - { - "fieldname": "root_cause_section_break", - "fieldtype": "Section Break", - "label": "Possible Root Cause" - }, - { - "description": "Please keep full name", - "fieldname": "reported_by", - "fieldtype": "Data", - "in_list_view": 1, - "in_standard_filter": 1, - "label": "Reported By", - "reqd": 1 - }, - { - "fieldname": "prevention_section_break", - "fieldtype": "Section Break", - "label": "Root Cause Prevention " - }, - { - "description": "List solution(s) to be applied or implemented", - "fieldname": "prevention_strategy", - "fieldtype": "Table", - "options": "Root Cause Prevention Strategy" - }, - { - "description": "List Name(s) and Phone number of Member(s) participated to solve the Issue", - "fieldname": "solved_by", - "fieldtype": "Small Text", - "in_standard_filter": 1, - "label": "Solved By" - }, - { - "fieldname": "report_section_break", - "fieldtype": "Section Break" - }, - { - "fieldname": "phone_no", - "fieldtype": "Data", - "label": "Reporter Phone No:" - }, - { - "columns": 1, - "fieldname": "is_recurring_issue", - "fieldtype": "Select", - "in_list_view": 1, - "in_standard_filter": 1, - "label": "Is this a recurring issue?", - "options": "\nNo\nYes", - "reqd": 1 - }, - { - "fieldname": "frequency_of_the_issue", - "fieldtype": "Select", - "label": "What is the frequency of the issue?", - "options": "\nAt Randomly\nDaily\nWeekly\nMonthly\nYearly" - }, - { - "description": "List department(s) that affected by the incident ", - "fieldname": "department_affected", - "fieldtype": "Small Text", - "in_standard_filter": 1, - "label": "Department(s) affected by an Issue", - "reqd": 1 - }, - { - "columns": 1, - "fieldname": "date_issue_happened", - "fieldtype": "Date", - "in_list_view": 1, - "in_standard_filter": 1, - "label": "When did it start", - "reqd": 1 - }, - { - "columns": 2, - "fieldname": "title", - "fieldtype": "Data", - "in_standard_filter": 1, - "label": "Title of the Issue/Incident", - "reqd": 1 - }, - { - "fieldname": "status_column_break", - "fieldtype": "Column Break" - }, - { - "fieldname": "reported_date", - "fieldtype": "Date", - "in_standard_filter": 1, - "label": "Reported Date", - "reqd": 1 - }, - { - "fieldname": "department_issue_identified", - "fieldtype": "Data", - "in_standard_filter": 1, - "label": "In which Area/department was the issue identified?", - "reqd": 1 - }, - { - "fieldname": "naming_series", - "fieldtype": "Select", - "hidden": 1, - "label": "Series", - "options": "RCA-.YYYY.-" - } - ], - "index_web_pages_for_search": 1, - "links": [], - "modified": "2022-06-02 11:38:02.185887", - "modified_by": "Administrator", - "module": "CSF TZ", - "name": "Root Cause Analysis", - "owner": "Administrator", - "permissions": [ - { - "create": 1, - "delete": 1, - "email": 1, - "export": 1, - "print": 1, - "read": 1, - "report": 1, - "role": "System Manager", - "share": 1, - "write": 1 - } - ], - "sort_field": "modified", - "sort_order": "DESC", - "title_field": "title", - "track_changes": 1, - "track_seen": 1, - "track_views": 1 -} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/root_cause_analysis/root_cause_analysis.py b/csf_tz/csf_tz/doctype/root_cause_analysis/root_cause_analysis.py deleted file mode 100644 index 288fa500..00000000 --- a/csf_tz/csf_tz/doctype/root_cause_analysis/root_cause_analysis.py +++ /dev/null @@ -1,8 +0,0 @@ -# Copyright (c) 2022, Aakvatech and contributors -# For license information, please see license.txt - -# import frappe -from frappe.model.document import Document - -class RootCauseAnalysis(Document): - pass diff --git a/csf_tz/csf_tz/doctype/root_cause_analysis/test_root_cause_analysis.py b/csf_tz/csf_tz/doctype/root_cause_analysis/test_root_cause_analysis.py deleted file mode 100644 index 59a567a9..00000000 --- a/csf_tz/csf_tz/doctype/root_cause_analysis/test_root_cause_analysis.py +++ /dev/null @@ -1,8 +0,0 @@ -# Copyright (c) 2022, Aakvatech and Contributors -# See license.txt - -# import frappe -import unittest - -class TestRootCauseAnalysis(unittest.TestCase): - pass diff --git a/csf_tz/csf_tz/doctype/root_cause_prevention_strategy/__init__.py b/csf_tz/csf_tz/doctype/root_cause_prevention_strategy/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/csf_tz/doctype/root_cause_prevention_strategy/root_cause_prevention_strategy.json b/csf_tz/csf_tz/doctype/root_cause_prevention_strategy/root_cause_prevention_strategy.json deleted file mode 100644 index 2eb08f95..00000000 --- a/csf_tz/csf_tz/doctype/root_cause_prevention_strategy/root_cause_prevention_strategy.json +++ /dev/null @@ -1,92 +0,0 @@ -{ - "actions": [], - "allow_rename": 1, - "creation": "2022-05-28 13:35:44.821933", - "doctype": "DocType", - "editable_grid": 1, - "engine": "InnoDB", - "field_order": [ - "solution_to_be_implemented", - "consideration", - "specify_considerations", - "is_solution_implemented", - "cost_column_break", - "estimated_cost", - "incidental_findings", - "specify_findings", - "date_of_completion" - ], - "fields": [ - { - "fieldname": "solution_to_be_implemented", - "fieldtype": "Data", - "in_list_view": 1, - "label": "Solution to be implemented", - "length": 1000, - "reqd": 1 - }, - { - "fieldname": "cost_column_break", - "fieldtype": "Column Break" - }, - { - "fieldname": "estimated_cost", - "fieldtype": "Float", - "in_list_view": 1, - "label": "Estimated cost" - }, - { - "fieldname": "consideration", - "fieldtype": "Select", - "label": "Are there special considerations?", - "options": "\nNo\nYes" - }, - { - "depends_on": "eval: doc.consideration == \"Yes\"", - "fieldname": "specify_considerations", - "fieldtype": "Small Text", - "label": "Please specify", - "mandatory_depends_on": "eval: doc.consideration == \"Yes\"" - }, - { - "fieldname": "incidental_findings", - "fieldtype": "Select", - "label": "Are there incidental findings to be reviewed for corrective action?", - "options": "\nNo\nYes" - }, - { - "depends_on": "eval: doc.incidental_findings == \"Yes\"", - "fieldname": "specify_findings", - "fieldtype": "Small Text", - "label": "Please specify", - "mandatory_depends_on": "eval: doc.incidental_findings == \"Yes\"" - }, - { - "depends_on": "eval: doc.is_solution_implemented == \"Yes\"", - "fieldname": "date_of_completion", - "fieldtype": "Date", - "in_list_view": 1, - "label": "Date of Implementation", - "mandatory_depends_on": "eval: doc.is_solution_implemented == \"Yes\"" - }, - { - "fieldname": "is_solution_implemented", - "fieldtype": "Select", - "in_list_view": 1, - "label": "Is the solution implemented", - "options": "\nNo\nYes", - "reqd": 1 - } - ], - "index_web_pages_for_search": 1, - "istable": 1, - "links": [], - "modified": "2022-06-01 16:20:38.015263", - "modified_by": "Administrator", - "module": "CSF TZ", - "name": "Root Cause Prevention Strategy", - "owner": "Administrator", - "permissions": [], - "sort_field": "modified", - "sort_order": "DESC" -} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/root_cause_prevention_strategy/root_cause_prevention_strategy.py b/csf_tz/csf_tz/doctype/root_cause_prevention_strategy/root_cause_prevention_strategy.py deleted file mode 100644 index 1460575e..00000000 --- a/csf_tz/csf_tz/doctype/root_cause_prevention_strategy/root_cause_prevention_strategy.py +++ /dev/null @@ -1,8 +0,0 @@ -# Copyright (c) 2022, Aakvatech and contributors -# For license information, please see license.txt - -# import frappe -from frappe.model.document import Document - -class RootCausePreventionStrategy(Document): - pass diff --git a/csf_tz/csf_tz/doctype/salary_slip_ot_component/__init__.py b/csf_tz/csf_tz/doctype/salary_slip_ot_component/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/csf_tz/doctype/salary_slip_ot_component/salary_slip_ot_component.json b/csf_tz/csf_tz/doctype/salary_slip_ot_component/salary_slip_ot_component.json deleted file mode 100644 index 9ba85fe6..00000000 --- a/csf_tz/csf_tz/doctype/salary_slip_ot_component/salary_slip_ot_component.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "actions": [], - "autoname": "SSOTC.#####", - "creation": "2019-02-18 09:46:16.715714", - "doctype": "DocType", - "editable_grid": 1, - "engine": "InnoDB", - "field_order": [ - "salary_component", - "no_of_hours" - ], - "fields": [ - { - "fieldname": "salary_component", - "fieldtype": "Link", - "in_list_view": 1, - "label": "Salary Component", - "options": "Salary Component" - }, - { - "fieldname": "no_of_hours", - "fieldtype": "Float", - "in_list_view": 1, - "label": "No of Hours" - } - ], - "istable": 1, - "links": [], - "modified": "2023-11-27 14:58:11.001056", - "modified_by": "Administrator", - "module": "CSF TZ", - "name": "Salary Slip OT Component", - "naming_rule": "Expression (old style)", - "owner": "Administrator", - "permissions": [], - "quick_entry": 1, - "sort_field": "modified", - "sort_order": "DESC", - "states": [], - "track_changes": 1 -} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/salary_slip_ot_component/salary_slip_ot_component.py b/csf_tz/csf_tz/doctype/salary_slip_ot_component/salary_slip_ot_component.py deleted file mode 100644 index 786d40ef..00000000 --- a/csf_tz/csf_tz/doctype/salary_slip_ot_component/salary_slip_ot_component.py +++ /dev/null @@ -1,8 +0,0 @@ -# Copyright (c) 2023, Aakvatech and contributors -# For license information, please see license.txt - -# import frappe -from frappe.model.document import Document - -class SalarySlipOTComponent(Document): - pass diff --git a/csf_tz/csf_tz/doctype/scheduled_auto_email_report/__init__.py b/csf_tz/csf_tz/doctype/scheduled_auto_email_report/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/csf_tz/doctype/scheduled_auto_email_report/scheduled_auto_email_report.js b/csf_tz/csf_tz/doctype/scheduled_auto_email_report/scheduled_auto_email_report.js deleted file mode 100644 index dde49eba..00000000 --- a/csf_tz/csf_tz/doctype/scheduled_auto_email_report/scheduled_auto_email_report.js +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright (c) 2023, Aakvatech Limited and contributors -// For license information, please see license.txt - -frappe.ui.form.on('Scheduled Auto Email Report', { - // refresh: function(frm) { - - // } -}); diff --git a/csf_tz/csf_tz/doctype/scheduled_auto_email_report/scheduled_auto_email_report.json b/csf_tz/csf_tz/doctype/scheduled_auto_email_report/scheduled_auto_email_report.json deleted file mode 100644 index 5aee5c82..00000000 --- a/csf_tz/csf_tz/doctype/scheduled_auto_email_report/scheduled_auto_email_report.json +++ /dev/null @@ -1,95 +0,0 @@ -{ - "actions": [], - "allow_rename": 1, - "autoname": "field:auto_email_report", - "creation": "2023-02-26 21:10:46.939476", - "doctype": "DocType", - "editable_grid": 1, - "engine": "InnoDB", - "field_order": [ - "auto_email_report", - "column_break_2", - "enabled", - "section_break_2", - "schedule", - "day_of_month", - "column_break_4", - "schedule_time" - ], - "fields": [ - { - "fieldname": "auto_email_report", - "fieldtype": "Link", - "in_list_view": 1, - "label": "Auto Email Report", - "options": "Auto Email Report", - "reqd": 1, - "unique": 1 - }, - { - "fieldname": "schedule_time", - "fieldtype": "Time", - "in_list_view": 1, - "label": "Schedule Time", - "reqd": 1 - }, - { - "fieldname": "section_break_2", - "fieldtype": "Section Break" - }, - { - "fieldname": "column_break_4", - "fieldtype": "Column Break" - }, - { - "fieldname": "schedule", - "fieldtype": "Select", - "in_list_view": 1, - "label": "Schedule", - "options": "\nSunday\nMonday\nTuesday\nWednesday\nThursday\nFriday\nSaturday\nDaily\nMonthly", - "reqd": 1 - }, - { - "fieldname": "column_break_2", - "fieldtype": "Column Break" - }, - { - "default": "0", - "fieldname": "enabled", - "fieldtype": "Check", - "label": "Enabled" - }, - { - "depends_on": "eval: doc.schedule == \"Monthly\"", - "description": "Type between 1 and 28 only", - "fieldname": "day_of_month", - "fieldtype": "Int", - "label": "Day of Month", - "mandatory_depends_on": "eval: doc.schedule == \"Monthly\"" - } - ], - "index_web_pages_for_search": 1, - "links": [], - "modified": "2023-03-03 13:37:51.687791", - "modified_by": "Administrator", - "module": "csf_tz", - "name": "Scheduled Auto Email Report", - "owner": "Administrator", - "permissions": [ - { - "create": 1, - "delete": 1, - "email": 1, - "export": 1, - "print": 1, - "read": 1, - "report": 1, - "role": "System Manager", - "share": 1, - "write": 1 - } - ], - "sort_field": "modified", - "sort_order": "DESC", - "track_changes": 1 -} diff --git a/csf_tz/csf_tz/doctype/scheduled_auto_email_report/scheduled_auto_email_report.py b/csf_tz/csf_tz/doctype/scheduled_auto_email_report/scheduled_auto_email_report.py deleted file mode 100644 index 654e9a26..00000000 --- a/csf_tz/csf_tz/doctype/scheduled_auto_email_report/scheduled_auto_email_report.py +++ /dev/null @@ -1,74 +0,0 @@ -# Copyright (c) 2023, Aakvatech Limited and contributors -# For license information, please see license.txt - -import frappe -import datetime -from frappe.model.document import Document -from frappe.utils import ( - nowdate, - nowtime, - getdate, - get_datetime, - get_time, - get_timestamp, - now_datetime, - nowtime, - time_diff_in_seconds, -) - - -class ScheduledAutoEmailReport(Document): - def validate(self): - if self.schedule == "Monthly" and ( - self.day_of_month < 1 or self.day_of_month > 28 - ): - frappe.throw( - "Invalid day of month. The Day of Month should be between 1 and 28." - ) - elif self.schedule != "Monthly": - self.day_of_month = None - - -def get_report_list(): - day_of_month = datetime.datetime.today().day - day_of_week = datetime.datetime.today().strftime("%A") - current_time = datetime.datetime.now() - start_time = current_time - datetime.timedelta(seconds=300) - end_time = current_time + datetime.timedelta(seconds=5) - scheduled_list = frappe.get_all( - "Scheduled Auto Email Report", - filters=[ - ["enabled", "=", 1], - ["schedule_time", ">", str(start_time)], - ["schedule_time", "<", str(end_time)], - ["schedule", "=", "Daily"], - ], - ) - scheduled_list += frappe.get_all( - "Scheduled Auto Email Report", - filters=[ - ["enabled", "=", 1], - ["schedule_time", ">", str(start_time)], - ["schedule_time", "<", str(end_time)], - ["schedule", "=", "Monthly"], - ["day_of_month", "=", day_of_month], - ], - ) - scheduled_list += frappe.get_all( - "Scheduled Auto Email Report", - filters=[ - ["enabled", "=", 1], - ["schedule_time", ">", str(start_time)], - ["schedule_time", "<", str(end_time)], - ["schedule", "=", day_of_week], - ], - ) - - return scheduled_list - - -def send_report(): - report_list = get_report_list() - for report in report_list: - report_doc = frappe.get_doc("Auto Email Report", report.name) - report_doc.send() diff --git a/csf_tz/csf_tz/doctype/scheduled_auto_email_report/test_scheduled_auto_email_report.py b/csf_tz/csf_tz/doctype/scheduled_auto_email_report/test_scheduled_auto_email_report.py deleted file mode 100644 index 1c8579a1..00000000 --- a/csf_tz/csf_tz/doctype/scheduled_auto_email_report/test_scheduled_auto_email_report.py +++ /dev/null @@ -1,8 +0,0 @@ -# Copyright (c) 2023, Aakvatech Limited and Contributors -# See license.txt - -# import frappe -import unittest - -class TestScheduledAutoEmailReport(unittest.TestCase): - pass diff --git a/csf_tz/csf_tz/doctype/single_piecework_employees/__init__.py b/csf_tz/csf_tz/doctype/single_piecework_employees/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/csf_tz/doctype/single_piecework_employees/single_piecework_employees.json b/csf_tz/csf_tz/doctype/single_piecework_employees/single_piecework_employees.json deleted file mode 100644 index 744e8729..00000000 --- a/csf_tz/csf_tz/doctype/single_piecework_employees/single_piecework_employees.json +++ /dev/null @@ -1,114 +0,0 @@ -{ - "creation": "2021-04-23 23:21:59.054525", - "doctype": "DocType", - "editable_grid": 1, - "engine": "InnoDB", - "field_order": [ - "employee", - "column_break_2", - "employee_name", - "section_break_4", - "task", - "column_break_6", - "task_name", - "task_rate", - "section_break_9", - "quantity", - "column_break_10", - "amount", - "section_break_11", - "additional_salary" - ], - "fields": [ - { - "fieldname": "employee", - "fieldtype": "Link", - "in_list_view": 1, - "label": "Employee", - "options": "Employee" - }, - { - "fetch_from": "employee.employee_name", - "fieldname": "employee_name", - "fieldtype": "Data", - "in_list_view": 1, - "label": "Employee Name", - "read_only": 1 - }, - { - "fieldname": "quantity", - "fieldtype": "Float", - "in_list_view": 1, - "label": "Quantity" - }, - { - "default": "0", - "fieldname": "amount", - "fieldtype": "Currency", - "in_list_view": 1, - "label": "Amount", - "read_only": 1 - }, - { - "fieldname": "additional_salary", - "fieldtype": "Link", - "label": "Additional Salary", - "options": "Additional Salary", - "read_only": 1 - }, - { - "fieldname": "task", - "fieldtype": "Link", - "in_list_view": 1, - "label": "Task", - "options": "Piecework Type" - }, - { - "fetch_from": "task.task_name", - "fieldname": "task_name", - "fieldtype": "Data", - "label": "Task Name" - }, - { - "fetch_from": "task.rate", - "fieldname": "task_rate", - "fieldtype": "Currency", - "label": "Task Rate" - }, - { - "fieldname": "column_break_2", - "fieldtype": "Column Break" - }, - { - "fieldname": "section_break_4", - "fieldtype": "Section Break" - }, - { - "fieldname": "column_break_6", - "fieldtype": "Column Break" - }, - { - "fieldname": "section_break_11", - "fieldtype": "Section Break" - }, - { - "fieldname": "column_break_10", - "fieldtype": "Column Break" - }, - { - "fieldname": "section_break_9", - "fieldtype": "Section Break" - } - ], - "istable": 1, - "modified": "2021-04-27 00:01:55.824888", - "modified_by": "Administrator", - "module": "CSF TZ", - "name": "Single Piecework Employees", - "owner": "Administrator", - "permissions": [], - "quick_entry": 1, - "sort_field": "modified", - "sort_order": "DESC", - "track_changes": 1 -} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/single_piecework_employees/single_piecework_employees.py b/csf_tz/csf_tz/doctype/single_piecework_employees/single_piecework_employees.py deleted file mode 100644 index 2f8f04b1..00000000 --- a/csf_tz/csf_tz/doctype/single_piecework_employees/single_piecework_employees.py +++ /dev/null @@ -1,10 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (c) 2021, Aakvatech and contributors -# For license information, please see license.txt - -from __future__ import unicode_literals -# import frappe -from frappe.model.document import Document - -class SinglePieceworkEmployees(Document): - pass diff --git a/csf_tz/csf_tz/doctype/station_members/__init__.py b/csf_tz/csf_tz/doctype/station_members/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/csf_tz/doctype/station_members/station_members.json b/csf_tz/csf_tz/doctype/station_members/station_members.json deleted file mode 100644 index 35277fa3..00000000 --- a/csf_tz/csf_tz/doctype/station_members/station_members.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "creation": "2021-04-23 23:17:17.897554", - "doctype": "DocType", - "editable_grid": 1, - "engine": "InnoDB", - "field_order": [ - "employee", - "employee_name" - ], - "fields": [ - { - "fieldname": "employee", - "fieldtype": "Link", - "in_list_view": 1, - "label": "Employee", - "options": "Employee", - "reqd": 1 - }, - { - "fetch_from": "Employee.employee_name", - "fieldname": "employee_name", - "fieldtype": "Data", - "in_list_view": 1, - "label": "Employee Name", - "read_only": 1 - } - ], - "istable": 1, - "modified": "2021-04-23 23:17:26.631969", - "modified_by": "Administrator", - "module": "CSF TZ", - "name": "Station Members", - "owner": "Administrator", - "permissions": [], - "quick_entry": 1, - "sort_field": "modified", - "sort_order": "DESC", - "track_changes": 1 -} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/station_members/station_members.py b/csf_tz/csf_tz/doctype/station_members/station_members.py deleted file mode 100644 index 39ad5cb3..00000000 --- a/csf_tz/csf_tz/doctype/station_members/station_members.py +++ /dev/null @@ -1,10 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (c) 2021, Aakvatech and contributors -# For license information, please see license.txt - -from __future__ import unicode_literals -# import frappe -from frappe.model.document import Document - -class StationMembers(Document): - pass diff --git a/csf_tz/csf_tz/doctype/trip_sheet/__init__.py b/csf_tz/csf_tz/doctype/trip_sheet/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/csf_tz/doctype/trip_sheet/test_trip_sheet.py b/csf_tz/csf_tz/doctype/trip_sheet/test_trip_sheet.py deleted file mode 100644 index fe2fd23b..00000000 --- a/csf_tz/csf_tz/doctype/trip_sheet/test_trip_sheet.py +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (c) 2025, Aakvatech and Contributors -# See license.txt - -# import frappe -from frappe.tests.utils import FrappeTestCase - - -class TestTripSheet(FrappeTestCase): - pass diff --git a/csf_tz/csf_tz/doctype/trip_sheet/trip_sheet.js b/csf_tz/csf_tz/doctype/trip_sheet/trip_sheet.js deleted file mode 100644 index 255c922a..00000000 --- a/csf_tz/csf_tz/doctype/trip_sheet/trip_sheet.js +++ /dev/null @@ -1,129 +0,0 @@ -// Copyright (c) 2025, Aakvatech and contributors -// For license information, please see license.txt - -frappe.ui.form.on("Trip Sheet", { - refresh: function (frm) { - // Dynamically set required fields if status is Completed - frm.set_df_property("end_km", "reqd", frm.doc.status === "Completed"); - frm.set_df_property( - "fuel_consumed", - "reqd", - frm.doc.status === "Completed" - ); - - // Set query for reference_doctype in child table - frm.fields_dict["trip_sheet_reference"].grid.get_field( - "reference_doctype" - ).get_query = function (doc, cdt, cdn) { - return { - filters: [ - [ - "name", - "in", - [ - "Purchase Order", - "Delivery Note", - "Purchase Receipt", - "Purchase Invoice", - "Sales Order", - "Stock Entry", - ], - ], - ], - }; - }; - }, - - status: function (frm) { - // When status changes, update required fields - frm.set_df_property("end_km", "reqd", frm.doc.status === "Completed"); - frm.set_df_property( - "fuel_consumed", - "reqd", - frm.doc.status === "Completed" - ); - }, - - driver: function (frm) { - if (frm.doc.driver) { - frappe.db.get_value( - "Employee", - frm.doc.driver, - "employee_name", - function (r) { - frm.set_value("driver_name", r.employee_name); - } - ); - } else { - frm.set_value("driver_name", ""); - } - }, - - // Custom function to fetch items from selected reference documents - fetch_reference_items: function (frm) { - // Clear the table first - frm.clear_table("item_reference"); - - // Loop through trip_sheet_reference child table - (frm.doc.trip_sheet_reference || []).forEach(function (row) { - if (row.reference_doctype && row.reference_document) { - frappe.call({ - method: - "csf_tz.csf_tz.doctype.trip_sheet.trip_sheet.get_reference_items", - args: { - reference_doctype: row.reference_doctype, - reference_document: row.reference_document, - }, - callback: function (r) { - if (r.message && Array.isArray(r.message)) { - // Add all items for this reference doc - r.message.forEach(function (item) { - // Add child and set reference_doctype first - var child = frm.add_child("item_reference"); - child.reference_doctype = row.reference_doctype; - // then set the dynamic link field - child.reference_document_id = row.reference_document; - child.item_name = item.item_name; - child.qty = item.qty; - child.amount = item.amount; - }); - // refresh once after adding items - frm.refresh_field("item_reference"); - } - }, - }); - } - }); - }, -}); - -// For filtering Stock Entry by stock_entry_type, update the handler to use the renamed child doctype -frappe.ui.form.on("Trip Sheet References", { - reference_doctype: function (frm, cdt, cdn) { - var child = locals[cdt][cdn]; - if (child.reference_doctype === "Stock Entry") { - frappe.meta.get_docfield( - "Trip Sheet References", - "reference_document", - frm.doc.name - ).get_query = function () { - return { - filters: { - stock_entry_type: "Material Issue", - }, - }; - }; - } else { - frappe.meta.get_docfield( - "Trip Sheet References", - "reference_document", - frm.doc.name - ).get_query = null; - } - }, - - // Trigger fetch when reference_document changes - reference_document: function (frm, cdt, cdn) { - frm.trigger("fetch_reference_items"); - }, -}); diff --git a/csf_tz/csf_tz/doctype/trip_sheet/trip_sheet.json b/csf_tz/csf_tz/doctype/trip_sheet/trip_sheet.json deleted file mode 100644 index 7d371a9b..00000000 --- a/csf_tz/csf_tz/doctype/trip_sheet/trip_sheet.json +++ /dev/null @@ -1,180 +0,0 @@ -{ - "actions": [], - "allow_rename": 1, - "autoname": "TS-.vehicle.-.####", - "creation": "2025-10-04 12:09:25.744664", - "doctype": "DocType", - "engine": "InnoDB", - "field_order": [ - "section_break_6a9a", - "amended_from", - "vehicle", - "transporter_type", - "driver", - "driver_name", - "external_driver_name", - "start_km", - "end_km", - "fuel_consumed", - "column_break_bdjc", - "status", - "start_location", - "end_location", - "start_time", - "end_time", - "section_break_pqtf", - "trip_sheet_reference", - "item_reference" - ], - "fields": [ - { - "fieldname": "section_break_6a9a", - "fieldtype": "Section Break" - }, - { - "fieldname": "amended_from", - "fieldtype": "Link", - "label": "Amended From", - "no_copy": 1, - "options": "Trip Sheet", - "print_hide": 1, - "read_only": 1, - "search_index": 1 - }, - { - "fieldname": "vehicle", - "fieldtype": "Link", - "label": "Vehicle", - "options": "Vehicle" - }, - { - "fieldname": "transporter_type", - "fieldtype": "Select", - "label": "Transporter Type", - "options": "Internal Transporter\nExternal Transporter" - }, - { - "fieldname": "driver", - "fieldtype": "Link", - "label": "Driver", - "options": "Employee", - "depends_on": "eval:doc.transporter_type=='Internal Transporter'" - }, - { - "fieldname": "driver_name", - "fieldtype": "Data", - "label": "Driver Name", - "fetch_from": "driver.employee_name", - "depends_on": "eval:doc.transporter_type=='Internal Transporter'" - }, - { - "fieldname": "external_driver_name", - "fieldtype": "Data", - "label": "External Driver Name", - "depends_on": "eval:doc.transporter_type=='External Transporter'" - }, - { - "fieldname": "start_location", - "fieldtype": "Data", - "label": "Start Location" - }, - { - "fieldname": "start_km", - "fieldtype": "Float", - "label": "Start KM" - }, - { - "fieldname": "end_km", - "fieldtype": "Float", - "label": "End KM" - }, - { - "fieldname": "fuel_consumed", - "fieldtype": "Float", - "label": "Fuel Consumed" - }, - { - "fieldname": "status", - "fieldtype": "Select", - "label": "Status", - "options": "Draft\nIn Transit\nCompleted" - }, - { - "fieldname": "column_break_bdjc", - "fieldtype": "Column Break" - }, - { - "fieldname": "end_location", - "fieldtype": "Data", - "label": "End Location" - }, - { - "fieldname": "start_time", - "fieldtype": "Datetime", - "label": "Start Time" - }, - { - "fieldname": "end_time", - "fieldtype": "Datetime", - "label": "End Time" - }, - { - "fieldname": "trip_sheet_reference", - "fieldtype": "Table", - "label": "Trip sheet Reference", - "options": "Trip Sheet References" - }, - { - "fieldname": "item_reference", - "fieldtype": "Table", - "label": "Item Reference", - "options": "Trip Sheet Item Reference", - "read_only": 1 - }, - { - "fieldname": "section_break_pqtf", - "fieldtype": "Section Break" - } - ], - "grid_page_length": 50, - "index_web_pages_for_search": 1, - "is_submittable": 1, - "links": [], - "modified": "2025-10-08 15:39:25.097234", - "modified_by": "Administrator", - "module": "CSF TZ", - "name": "Trip Sheet", - "naming_rule": "Expression (old style)", - "owner": "Administrator", - "permissions": [ - { - "create": 1, - "delete": 1, - "email": 1, - "export": 1, - "print": 1, - "read": 1, - "report": 1, - "role": "System Manager", - "share": 1, - "write": 1 - }, - { - "create": 1, - "delete": 1, - "email": 1, - "export": 1, - "print": 1, - "read": 1, - "report": 1, - "role": "Logistic Master", - "share": 1, - "submit": 1, - "write": 1 - } - ], - "row_format": "Dynamic", - "sort_field": "modified", - "sort_order": "DESC", - "states": [] -} diff --git a/csf_tz/csf_tz/doctype/trip_sheet/trip_sheet.py b/csf_tz/csf_tz/doctype/trip_sheet/trip_sheet.py deleted file mode 100644 index 117a3a37..00000000 --- a/csf_tz/csf_tz/doctype/trip_sheet/trip_sheet.py +++ /dev/null @@ -1,102 +0,0 @@ -# Copyright (c) 2025, Aakvatech and contributors -# For license information, please see license.txt -import frappe -from frappe import _ -from frappe.model.document import Document - - -class TripSheet(Document): - def validate(self): - # If status set to Completed in form, ensure required fields are present. - if getattr(self, "status", None) == "Completed": - if not getattr(self, "end_km", None): - frappe.throw(_("End KM must be filled when status is 'Completed'.")) - if not getattr(self, "fuel_consumed", None): - frappe.throw(_("Fuel Consumed must be filled when status is 'Completed'.")) - - def before_submit(self): - # Final checks before submit - if getattr(self, "status", None) != "Completed": - frappe.throw(_("Trip status must be 'Completed' before submitting.")) - if not getattr(self, "end_km", None): - frappe.throw(_("End KM must be filled before submitting.")) - if not getattr(self, "fuel_consumed", None): - frappe.throw(_("Fuel Consumed must be filled before submitting.")) - - def before_save(self): - # Keep item_reference in sync on save - self.set_item_reference_table() - - def set_item_reference_table(self): - """ - Rebuild the item_reference child table from trip_sheet_reference child table. - Uses fields: - - trip_sheet_reference[].reference_doctype - - trip_sheet_reference[].reference_document - Appends rows to item_reference with fields: - - reference_doctype - - reference_document_id - - item_name - - qty - - amount - """ - self.set("item_reference", []) - - for row in self.get("trip_sheet_reference") or []: - ref_doctype = row.get("reference_doctype") - ref_doc = row.get("reference_document") - if not (ref_doctype and ref_doc): - continue - - items = get_reference_items(ref_doctype, ref_doc) or [] - for it in items: - self.append("item_reference", { - "reference_doctype": ref_doctype, - "reference_document_id": ref_doc, - "item_name": it.get("item_name") or "", - "qty": it.get("qty") or 0, - "amount": it.get("amount") or 0, - }) - - -@frappe.whitelist() -def get_reference_items(reference_doctype, reference_document): - """ - Return list of dicts: { item_name, qty, amount } for the given reference. - Accepts reference_document (string id) to match JS. - """ - items = [] - if reference_doctype not in [ - "Purchase Order", - "Delivery Note", - "Purchase Receipt", - "Purchase Invoice", - "Sales Order", - "Stock Entry", - ]: - return items - - try: - doc = frappe.get_doc(reference_doctype, reference_document) - except Exception: - return items - - for i in getattr(doc, "items", []) or []: - amount = getattr(i, "amount", None) - if amount is None: - amount = getattr(i, "base_amount", None) - # qty fallback: qty or transfer_qty or delivered_qty - qty = getattr(i, "qty", None) - if qty is None: - qty = getattr(i, "transfer_qty", None) - if qty is None: - qty = getattr(i, "delivered_qty", 0) - item_name = getattr(i, "item_name", None) or getattr(i, "item_code", "") - - items.append({ - "item_name": item_name, - "qty": qty or 0, - "amount": amount or 0 - }) - - return items diff --git a/csf_tz/csf_tz/doctype/trip_sheet_item_reference/__init__.py b/csf_tz/csf_tz/doctype/trip_sheet_item_reference/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/csf_tz/doctype/trip_sheet_item_reference/trip_sheet_item_reference.json b/csf_tz/csf_tz/doctype/trip_sheet_item_reference/trip_sheet_item_reference.json deleted file mode 100644 index a40a7e5f..00000000 --- a/csf_tz/csf_tz/doctype/trip_sheet_item_reference/trip_sheet_item_reference.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "actions": [], - "allow_rename": 1, - "creation": "2025-10-15 18:07:27.398988", - "doctype": "DocType", - "editable_grid": 1, - "engine": "InnoDB", - "field_order": [ - "reference_doctype", - "reference_document_id", - "item_name", - "qty", - "amount" - ], - "fields": [ - { - "fieldname": "reference_doctype", - "fieldtype": "Select", - "label": "Reference Doctype", - "options": "Purchase Order\nDelivery Note\nPurchase Receipt\nPurchase Invoice\nSales Order\nStock Entry", - "read_only": 1 - }, - { - "fieldname": "reference_document_id", - "fieldtype": "Dynamic Link", - "label": "Reference Document ID", - "options": "reference_doctype", - "read_only": 1 - }, - { - "fieldname": "item_name", - "fieldtype": "Data", - "in_list_view": 1, - "label": "Item Name", - "read_only": 1 - }, - { - "fieldname": "qty", - "fieldtype": "Float", - "in_list_view": 1, - "label": "Quantity", - "read_only": 1 - }, - { - "fieldname": "amount", - "fieldtype": "Currency", - "in_list_view": 1, - "label": "Amount", - "read_only": 1 - } - ], - "grid_page_length": 50, - "index_web_pages_for_search": 1, - "istable": 1, - "links": [], - "modified": "2025-10-15 18:16:55.455472", - "modified_by": "Administrator", - "module": "CSF TZ", - "name": "Trip Sheet Item Reference", - "owner": "Administrator", - "permissions": [], - "row_format": "Dynamic", - "sort_field": "modified", - "sort_order": "DESC", - "states": [] -} diff --git a/csf_tz/csf_tz/doctype/trip_sheet_item_reference/trip_sheet_item_reference.py b/csf_tz/csf_tz/doctype/trip_sheet_item_reference/trip_sheet_item_reference.py deleted file mode 100644 index dc30190d..00000000 --- a/csf_tz/csf_tz/doctype/trip_sheet_item_reference/trip_sheet_item_reference.py +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (c) 2025, Aakvatech and contributors -# For license information, please see license.txt - -# import frappe -from frappe.model.document import Document - - -class TripSheetItemReference(Document): - pass diff --git a/csf_tz/csf_tz/doctype/trip_sheet_references/__init__.py b/csf_tz/csf_tz/doctype/trip_sheet_references/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/csf_tz/doctype/trip_sheet_references/trip_sheet_references.json b/csf_tz/csf_tz/doctype/trip_sheet_references/trip_sheet_references.json deleted file mode 100644 index 3aba0cb9..00000000 --- a/csf_tz/csf_tz/doctype/trip_sheet_references/trip_sheet_references.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "actions": [], - "allow_rename": 1, - "creation": "2025-10-04 12:35:30.189065", - "doctype": "DocType", - "editable_grid": 1, - "engine": "InnoDB", - "field_order": [ - "reference_doctype", - "reference_document", - "part_name", - "note" - ], - "fields": [ - { - "fieldname": "note", - "fieldtype": "Small Text", - "in_list_view": 1, - "label": "Note" - }, - { - "fieldname": "reference_doctype", - "fieldtype": "Link", - "in_list_view": 1, - "label": "Reference Doctype", - "options": "DocType" - }, - { - "fieldname": "reference_document", - "fieldtype": "Dynamic Link", - "in_list_view": 1, - "label": "Reference Document", - "options": "reference_doctype" - }, - { - "fieldname": "part_name", - "fieldtype": "Data", - "in_list_view": 1, - "label": "Part Name" - } - ], - "grid_page_length": 50, - "index_web_pages_for_search": 1, - "istable": 1, - "links": [], - "modified": "2025-10-10 18:08:51.760148", - "modified_by": "Administrator", - "module": "CSF TZ", - "name": "Trip Sheet References", - "owner": "Administrator", - "permissions": [], - "row_format": "Dynamic", - "sort_field": "modified", - "sort_order": "DESC", - "states": [] -} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/trip_sheet_references/trip_sheet_references.py b/csf_tz/csf_tz/doctype/trip_sheet_references/trip_sheet_references.py deleted file mode 100644 index a2a3fef5..00000000 --- a/csf_tz/csf_tz/doctype/trip_sheet_references/trip_sheet_references.py +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (c) 2025, Aakvatech and contributors -# For license information, please see license.txt - -# import frappe -from frappe.model.document import Document - - -class TripSheetReferences(Document): - pass diff --git a/csf_tz/csf_tz/doctype/vehicle_consignment/__init__.py b/csf_tz/csf_tz/doctype/vehicle_consignment/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/csf_tz/doctype/vehicle_consignment/test_vehicle_consignment.py b/csf_tz/csf_tz/doctype/vehicle_consignment/test_vehicle_consignment.py deleted file mode 100644 index 8fc1d42c..00000000 --- a/csf_tz/csf_tz/doctype/vehicle_consignment/test_vehicle_consignment.py +++ /dev/null @@ -1,10 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (c) 2021, Aakvatech and Contributors -# See license.txt -from __future__ import unicode_literals - -# import frappe -import unittest - -class TestVehicleConsignment(unittest.TestCase): - pass diff --git a/csf_tz/csf_tz/doctype/vehicle_consignment/vehicle_consignment.js b/csf_tz/csf_tz/doctype/vehicle_consignment/vehicle_consignment.js deleted file mode 100644 index 23025124..00000000 --- a/csf_tz/csf_tz/doctype/vehicle_consignment/vehicle_consignment.js +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright (c) 2021, Aakvatech and contributors -// For license information, please see license.txt - -frappe.ui.form.on('Vehicle Consignment', { - // refresh: function(frm) { - - // } -}); diff --git a/csf_tz/csf_tz/doctype/vehicle_consignment/vehicle_consignment.json b/csf_tz/csf_tz/doctype/vehicle_consignment/vehicle_consignment.json deleted file mode 100644 index 72d0f887..00000000 --- a/csf_tz/csf_tz/doctype/vehicle_consignment/vehicle_consignment.json +++ /dev/null @@ -1,77 +0,0 @@ -{ - "actions": [], - "autoname": "VCONS-.YYYY.-.###", - "creation": "2021-01-19 11:24:49.205307", - "doctype": "DocType", - "editable_grid": 1, - "engine": "InnoDB", - "field_order": [ - "parent_item", - "column_break_2", - "quantity", - "section_break_5", - "vehicle_consignment_detail", - "amended_from" - ], - "fields": [ - { - "fieldname": "column_break_2", - "fieldtype": "Column Break" - }, - { - "fieldname": "parent_item", - "fieldtype": "Link", - "label": "Parent Item", - "options": "Item" - }, - { - "fieldname": "quantity", - "fieldtype": "Int", - "label": "Quantity" - }, - { - "fieldname": "section_break_5", - "fieldtype": "Section Break" - }, - { - "fieldname": "vehicle_consignment_detail", - "fieldtype": "Table", - "label": "Vehicle Consignment Detail", - "options": "Vehicle Consignment Detail" - }, - { - "fieldname": "amended_from", - "fieldtype": "Link", - "label": "Amended From", - "no_copy": 1, - "options": "Vehicle Consignment", - "print_hide": 1, - "read_only": 1 - } - ], - "index_web_pages_for_search": 1, - "is_submittable": 1, - "links": [], - "modified": "2021-01-19 11:34:41.517181", - "modified_by": "Administrator", - "module": "CSF TZ", - "name": "Vehicle Consignment", - "owner": "Administrator", - "permissions": [ - { - "create": 1, - "delete": 1, - "email": 1, - "export": 1, - "print": 1, - "read": 1, - "report": 1, - "role": "System Manager", - "share": 1, - "write": 1 - } - ], - "sort_field": "modified", - "sort_order": "DESC", - "track_changes": 1 -} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/vehicle_consignment/vehicle_consignment.py b/csf_tz/csf_tz/doctype/vehicle_consignment/vehicle_consignment.py deleted file mode 100644 index 4957bfc9..00000000 --- a/csf_tz/csf_tz/doctype/vehicle_consignment/vehicle_consignment.py +++ /dev/null @@ -1,10 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (c) 2021, Aakvatech and contributors -# For license information, please see license.txt - -from __future__ import unicode_literals -# import frappe -from frappe.model.document import Document - -class VehicleConsignment(Document): - pass diff --git a/csf_tz/csf_tz/doctype/vehicle_consignment_detail/__init__.py b/csf_tz/csf_tz/doctype/vehicle_consignment_detail/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/csf_tz/doctype/vehicle_consignment_detail/vehicle_consignment_detail.json b/csf_tz/csf_tz/doctype/vehicle_consignment_detail/vehicle_consignment_detail.json deleted file mode 100644 index fbcb6aaf..00000000 --- a/csf_tz/csf_tz/doctype/vehicle_consignment_detail/vehicle_consignment_detail.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "actions": [], - "creation": "2021-01-19 11:24:20.882509", - "doctype": "DocType", - "editable_grid": 1, - "engine": "InnoDB", - "field_order": [ - "bom" - ], - "fields": [ - { - "fieldname": "bom", - "fieldtype": "Link", - "in_list_view": 1, - "label": "BOM", - "options": "BOM" - } - ], - "index_web_pages_for_search": 1, - "istable": 1, - "links": [], - "modified": "2021-01-19 11:24:20.882509", - "modified_by": "Administrator", - "module": "CSF TZ", - "name": "Vehicle Consignment Detail", - "owner": "Administrator", - "permissions": [], - "quick_entry": 1, - "sort_field": "modified", - "sort_order": "DESC", - "track_changes": 1 -} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/vehicle_consignment_detail/vehicle_consignment_detail.py b/csf_tz/csf_tz/doctype/vehicle_consignment_detail/vehicle_consignment_detail.py deleted file mode 100644 index 25d88e48..00000000 --- a/csf_tz/csf_tz/doctype/vehicle_consignment_detail/vehicle_consignment_detail.py +++ /dev/null @@ -1,10 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (c) 2021, Aakvatech and contributors -# For license information, please see license.txt - -from __future__ import unicode_literals -# import frappe -from frappe.model.document import Document - -class VehicleConsignmentDetail(Document): - pass diff --git a/csf_tz/csf_tz/doctype/vehicle_inspection_record/__init__.py b/csf_tz/csf_tz/doctype/vehicle_inspection_record/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/csf_tz/doctype/vehicle_inspection_record/test_vehicle_inspection_record.py b/csf_tz/csf_tz/doctype/vehicle_inspection_record/test_vehicle_inspection_record.py deleted file mode 100644 index 076e9deb..00000000 --- a/csf_tz/csf_tz/doctype/vehicle_inspection_record/test_vehicle_inspection_record.py +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (c) 2025, Aakvatech and Contributors -# See license.txt - -# import frappe -from frappe.tests.utils import FrappeTestCase - - -class TestVehicleInspectionRecord(FrappeTestCase): - pass diff --git a/csf_tz/csf_tz/doctype/vehicle_inspection_record/vehicle_inspection_record.js b/csf_tz/csf_tz/doctype/vehicle_inspection_record/vehicle_inspection_record.js deleted file mode 100644 index d032b3a2..00000000 --- a/csf_tz/csf_tz/doctype/vehicle_inspection_record/vehicle_inspection_record.js +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright (c) 2025, Aakvatech and contributors -// For license information, please see license.txt - -// frappe.ui.form.on("Vehicle Inspection Record", { -// refresh(frm) { - -// }, -// }); diff --git a/csf_tz/csf_tz/doctype/vehicle_inspection_record/vehicle_inspection_record.json b/csf_tz/csf_tz/doctype/vehicle_inspection_record/vehicle_inspection_record.json deleted file mode 100644 index 6b345936..00000000 --- a/csf_tz/csf_tz/doctype/vehicle_inspection_record/vehicle_inspection_record.json +++ /dev/null @@ -1,340 +0,0 @@ -{ - "actions": [], - "allow_rename": 1, - "autoname": "field:vir_no", - "creation": "2025-09-01 23:06:46.649431", - "doctype": "DocType", - "editable_grid": 1, - "engine": "InnoDB", - "field_order": [ - "vir_no", - "inspection_id", - "vid", - "noplate", - "licence", - "vehicle_doc", - "section_break_1", - "inspection_date", - "valid_until", - "final_result", - "section_break_2", - "inspector", - "inspector_id", - "email", - "column_break_1", - "region", - "district", - "section_break_3", - "driver_name", - "driver_address", - "vehicle_passed_for", - "column_break_2", - "weight", - "prohibition_on_use", - "originates", - "section_break_4", - "speed_test", - "electrical_system", - "fitting_equipment", - "braking_system", - "column_break_3", - "wheels", - "suspension", - "steering", - "engine", - "section_break_5", - "exhaust", - "transmission", - "instruments_panel", - "dimensions", - "radiation", - "section_break_6", - "remarks", - "created_at", - "updated_at" - ], - "fields": [ - { - "fieldname": "vir_no", - "fieldtype": "Data", - "label": "VIR Number", - "reqd": 1, - "unique": 1, - "in_list_view": 1 - }, - { - "fieldname": "inspection_id", - "fieldtype": "Int", - "label": "Inspection ID", - "read_only": 1 - }, - { - "fieldname": "vid", - "fieldtype": "Int", - "label": "Vehicle ID", - "read_only": 1 - }, - { - "fieldname": "noplate", - "fieldtype": "Data", - "label": "Vehicle Plate", - "in_list_view": 1, - "in_standard_filter": 1 - }, - { - "fieldname": "licence", - "fieldtype": "Data", - "label": "License Number" - }, - { - "fieldname": "vehicle_doc", - "fieldtype": "Link", - "label": "Vehicle", - "options": "Vehicle" - }, - { - "fieldname": "section_break_1", - "fieldtype": "Section Break", - "label": "Inspection Details" - }, - { - "fieldname": "inspection_date", - "fieldtype": "Date", - "label": "Inspection Date", - "in_list_view": 1 - }, - { - "fieldname": "valid_until", - "fieldtype": "Date", - "label": "Valid Until", - "in_list_view": 1 - }, - { - "fieldname": "final_result", - "fieldtype": "Select", - "label": "Final Result", - "options": "\nPass\nFail", - "in_list_view": 1, - "in_standard_filter": 1 - }, - { - "fieldname": "section_break_2", - "fieldtype": "Section Break", - "label": "Inspector Information" - }, - { - "fieldname": "inspector", - "fieldtype": "Data", - "label": "Inspector Name" - }, - { - "fieldname": "inspector_id", - "fieldtype": "Data", - "label": "Inspector ID" - }, - { - "fieldname": "email", - "fieldtype": "Data", - "label": "Inspector Email" - }, - { - "fieldname": "column_break_1", - "fieldtype": "Column Break" - }, - { - "fieldname": "region", - "fieldtype": "Data", - "label": "Region", - "in_standard_filter": 1 - }, - { - "fieldname": "district", - "fieldtype": "Data", - "label": "District", - "in_standard_filter": 1 - }, - { - "fieldname": "section_break_3", - "fieldtype": "Section Break", - "label": "Vehicle & Driver Information" - }, - { - "fieldname": "driver_name", - "fieldtype": "Data", - "label": "Driver Name" - }, - { - "fieldname": "driver_address", - "fieldtype": "Text", - "label": "Driver Address" - }, - { - "fieldname": "vehicle_passed_for", - "fieldtype": "Data", - "label": "Vehicle Passed For" - }, - { - "fieldname": "column_break_2", - "fieldtype": "Column Break" - }, - { - "fieldname": "weight", - "fieldtype": "Data", - "label": "Weight Category" - }, - { - "fieldname": "prohibition_on_use", - "fieldtype": "Select", - "label": "Prohibition on Use", - "options": "\nYes\nNo" - }, - { - "fieldname": "originates", - "fieldtype": "Data", - "label": "Originates" - }, - { - "fieldname": "section_break_4", - "fieldtype": "Section Break", - "label": "Test Results - Part 1" - }, - { - "fieldname": "speed_test", - "fieldtype": "Select", - "label": "Speed Test", - "options": "\nPass\nFail" - }, - { - "fieldname": "electrical_system", - "fieldtype": "Select", - "label": "Electrical System", - "options": "\nPass\nFail" - }, - { - "fieldname": "fitting_equipment", - "fieldtype": "Select", - "label": "Fitting Equipment", - "options": "\nPass\nFail" - }, - { - "fieldname": "braking_system", - "fieldtype": "Select", - "label": "Braking System", - "options": "\nPass\nFail" - }, - { - "fieldname": "column_break_3", - "fieldtype": "Column Break" - }, - { - "fieldname": "wheels", - "fieldtype": "Select", - "label": "Wheels", - "options": "\nPass\nFail" - }, - { - "fieldname": "suspension", - "fieldtype": "Select", - "label": "Suspension", - "options": "\nPass\nFail" - }, - { - "fieldname": "steering", - "fieldtype": "Select", - "label": "Steering", - "options": "\nPass\nFail" - }, - { - "fieldname": "engine", - "fieldtype": "Select", - "label": "Engine", - "options": "\nPass\nFail" - }, - { - "fieldname": "section_break_5", - "fieldtype": "Section Break", - "label": "Test Results - Part 2" - }, - { - "fieldname": "exhaust", - "fieldtype": "Select", - "label": "Exhaust", - "options": "\nPass\nFail" - }, - { - "fieldname": "transmission", - "fieldtype": "Select", - "label": "Transmission", - "options": "\nPass\nFail" - }, - { - "fieldname": "instruments_panel", - "fieldtype": "Select", - "label": "Instruments Panel", - "options": "\nPass\nFail" - }, - { - "fieldname": "dimensions", - "fieldtype": "Select", - "label": "Dimensions", - "options": "\nPass\nFail" - }, - { - "fieldname": "radiation", - "fieldtype": "Select", - "label": "Radiation", - "options": "\nPass\nFail" - }, - { - "fieldname": "section_break_6", - "fieldtype": "Section Break", - "label": "Additional Information" - }, - { - "fieldname": "remarks", - "fieldtype": "Long Text", - "label": "Remarks" - }, - { - "fieldname": "created_at", - "fieldtype": "Datetime", - "label": "Created At", - "read_only": 1 - }, - { - "fieldname": "updated_at", - "fieldtype": "Datetime", - "label": "Updated At", - "read_only": 1 - } - ], - "grid_page_length": 50, - "index_web_pages_for_search": 1, - "links": [], - "modified": "2025-09-01 23:07:31.734846", - "modified_by": "Administrator", - "module": "CSF TZ", - "name": "Vehicle Inspection Record", - "naming_rule": "By fieldname", - "owner": "Administrator", - "permissions": [ - { - "create": 1, - "delete": 1, - "email": 1, - "export": 1, - "print": 1, - "read": 1, - "report": 1, - "role": "System Manager", - "share": 1, - "write": 1 - } - ], - "row_format": "Dynamic", - "sort_field": "inspection_date", - "sort_order": "DESC", - "states": [], - "title_field": "noplate", - "track_changes": 1 -} diff --git a/csf_tz/csf_tz/doctype/vehicle_inspection_record/vehicle_inspection_record.py b/csf_tz/csf_tz/doctype/vehicle_inspection_record/vehicle_inspection_record.py deleted file mode 100644 index c5fdb9d1..00000000 --- a/csf_tz/csf_tz/doctype/vehicle_inspection_record/vehicle_inspection_record.py +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (c) 2025, Aakvatech and contributors -# For license information, please see license.txt - -# import frappe -from frappe.model.document import Document - - -class VehicleInspectionRecord(Document): - pass diff --git a/csf_tz/csf_tz/doctype/vehicle_location_log/__init__.py b/csf_tz/csf_tz/doctype/vehicle_location_log/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/csf_tz/doctype/vehicle_location_log/test_vehicle_location_log.py b/csf_tz/csf_tz/doctype/vehicle_location_log/test_vehicle_location_log.py deleted file mode 100644 index bb502f38..00000000 --- a/csf_tz/csf_tz/doctype/vehicle_location_log/test_vehicle_location_log.py +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (c) 2024, Aakvatech and Contributors -# See license.txt - -# import frappe -from frappe.tests.utils import FrappeTestCase - - -class TestVehicleLocationLog(FrappeTestCase): - pass diff --git a/csf_tz/csf_tz/doctype/vehicle_location_log/vehicle_location_log.js b/csf_tz/csf_tz/doctype/vehicle_location_log/vehicle_location_log.js deleted file mode 100644 index 9e7cc2b1..00000000 --- a/csf_tz/csf_tz/doctype/vehicle_location_log/vehicle_location_log.js +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright (c) 2024, Aakvatech and contributors -// For license information, please see license.txt - -frappe.ui.form.on('Vehicle Location Log', { - // refresh: function(frm) { - - // } -}); diff --git a/csf_tz/csf_tz/doctype/vehicle_location_log/vehicle_location_log.json b/csf_tz/csf_tz/doctype/vehicle_location_log/vehicle_location_log.json deleted file mode 100644 index 945d7a7a..00000000 --- a/csf_tz/csf_tz/doctype/vehicle_location_log/vehicle_location_log.json +++ /dev/null @@ -1,125 +0,0 @@ -{ - "actions": [], - "allow_rename": 1, - "autoname": "format:{vehicle}-{timestamp}", - "creation": "2024-05-27 11:04:45.996657", - "default_view": "List", - "doctype": "DocType", - "editable_grid": 1, - "engine": "InnoDB", - "field_order": [ - "type_of_update", - "vehicle", - "location", - "location_details", - "longitude", - "latitude", - "comment", - "column_break_adbpw", - "timestamp", - "map", - "amended_from" - ], - "fields": [ - { - "default": "Manual Update", - "fieldname": "type_of_update", - "fieldtype": "Select", - "in_list_view": 1, - "label": "Type of Update", - "options": "Manual Update\nGPS Update", - "read_only": 1, - "reqd": 1 - }, - { - "fieldname": "location", - "fieldtype": "Data", - "in_list_view": 1, - "label": "Location", - "reqd": 1 - }, - { - "fieldname": "longitude", - "fieldtype": "Data", - "label": "Longitude", - "read_only": 1 - }, - { - "fieldname": "latitude", - "fieldtype": "Data", - "label": "Latitude", - "read_only": 1 - }, - { - "fieldname": "comment", - "fieldtype": "Small Text", - "label": "Comment" - }, - { - "fieldname": "column_break_adbpw", - "fieldtype": "Column Break" - }, - { - "default": "Now", - "fieldname": "timestamp", - "fieldtype": "Datetime", - "in_list_view": 1, - "label": "Date", - "reqd": 1 - }, - { - "fieldname": "map", - "fieldtype": "Geolocation", - "label": "map", - "read_only": 1 - }, - { - "fieldname": "amended_from", - "fieldtype": "Link", - "label": "Amended From", - "no_copy": 1, - "options": "Vehicle Location Log", - "print_hide": 1, - "read_only": 1, - "search_index": 1 - }, - { - "fieldname": "location_details", - "fieldtype": "Data", - "label": "Address", - "read_only": 1 - }, - { - "fieldname": "vehicle", - "fieldtype": "Link", - "label": "Vehicle", - "options": "Vehicle" - } - ], - "index_web_pages_for_search": 1, - "is_submittable": 1, - "links": [], - "modified": "2024-06-12 16:21:27.342865", - "modified_by": "Administrator", - "module": "CSF TZ", - "name": "Vehicle Location Log", - "naming_rule": "Expression", - "owner": "Administrator", - "permissions": [ - { - "create": 1, - "delete": 1, - "email": 1, - "export": 1, - "print": 1, - "read": 1, - "report": 1, - "role": "System Manager", - "share": 1, - "write": 1 - } - ], - "sort_field": "modified", - "sort_order": "DESC", - "states": [] -} \ No newline at end of file diff --git a/csf_tz/csf_tz/doctype/vehicle_location_log/vehicle_location_log.py b/csf_tz/csf_tz/doctype/vehicle_location_log/vehicle_location_log.py deleted file mode 100644 index 2a8a5fd3..00000000 --- a/csf_tz/csf_tz/doctype/vehicle_location_log/vehicle_location_log.py +++ /dev/null @@ -1,65 +0,0 @@ -import frappe -import requests -import json -from frappe.model.document import Document - -class VehicleLocationLog(Document): - def before_save(self): - if not self.location: - frappe.throw("Location name is required.") - - if not self.latitude and not self.longitude: - coordinates = self.fetch_coordinates(self.location) - - if not coordinates: - frappe.throw("Coordinates could not be fetched.") - - self.latitude = coordinates.get('latitude') - self.longitude = coordinates.get('longitude') - self.map = self.construct_map_field(coordinates) - self.location_details = coordinates.get('display_name') - - def fetch_coordinates(self, location_name): - url = "https://nominatim.openstreetmap.org/search" - params = { - 'format': 'json', - 'q': location_name - } - headers = { - 'User-Agent': 'MyApp/1.0 (youremail@example.com)' - } - try: - response = requests.get(url, params=params, headers=headers) - response.raise_for_status() - data = response.json() - - if not data: - return None - - # Select the first entry from the results - location = max(data, key=lambda x: x.get('importance', 0)) - return { - 'latitude': location.get('lat'), - 'longitude': location.get('lon'), - 'display_name': location.get('display_name') - } - except requests.exceptions.RequestException as e: - frappe.throw(f"Error fetching coordinates: {str(e)}") - - def construct_map_field(self, coordinates): - map_data = { - "type": "FeatureCollection", - "features": [ - { - "type": "Feature", - "geometry": { - "type": "Point", - "coordinates": [float(coordinates['longitude']), float(coordinates['latitude'])] - }, - "properties": { - "icon": "vehicle" - } - } - ] - } - return json.dumps(map_data) diff --git a/csf_tz/csf_tz/doctype/vehicle_sync_task/__init__.py b/csf_tz/csf_tz/doctype/vehicle_sync_task/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/csf_tz/doctype/vehicle_sync_task/processor.py b/csf_tz/csf_tz/doctype/vehicle_sync_task/processor.py deleted file mode 100644 index 18a837d4..00000000 --- a/csf_tz/csf_tz/doctype/vehicle_sync_task/processor.py +++ /dev/null @@ -1,768 +0,0 @@ -import requests -from datetime import datetime -from time import sleep -import frappe -from frappe.utils import cint, get_datetime - -# Safe import with fallback -try: - import csf_tz.csf_tz.doctype.vehicle_sync_task.queue as queue -except (ImportError, AttributeError) as e: - frappe.log_error("Queue Import Warning", str(e)) - queue = None - -# ------------ CONFIGURATION ------------ -HOST = "https://tms.tpf.go.tz/api/OffenceCheck" -TASK_DOCTYPE = "Vehicle Sync Task" -SYNC_LAST_RUN_CACHE_KEY = "csf_tz:vehicle_sync:last_batch_run_at" - - -def _get_sync_settings(): - settings = frappe.get_cached_doc("CSF TZ Settings") - enable_sync = cint(settings.get("enable_sync")) - batch_size = cint(settings.get("batch_size")) - sync_interval = cint(settings.get("sync_interval")) - - if batch_size < 1: - batch_size = 1 - if sync_interval < 1: - sync_interval = 1 - - return { - "enable_sync": enable_sync, - "batch_size": batch_size, - "sync_interval": sync_interval, - } - - -def _is_batch_due(sync_interval): - cache = frappe.cache() - last_run_at = cache.get_value(SYNC_LAST_RUN_CACHE_KEY) - if not last_run_at: - return True - - try: - last_run = get_datetime(last_run_at) - except Exception: - return True - - next_allowed_run = frappe.utils.add_to_date(last_run, minutes=sync_interval) - return frappe.utils.now_datetime() >= next_allowed_run - - -def _mark_batch_run(): - frappe.cache().set_value(SYNC_LAST_RUN_CACHE_KEY, frappe.utils.now()) - - -def _schedule_task_by_interval(task_name, sync_interval): - now = frappe.utils.now_datetime() - active_task_count = ( - frappe.db.sql( - f"select count(name) from `tab{TASK_DOCTYPE}` where ifnull(is_deleted, 0) = 0" - )[0][0] - or 1 - ) - next_run = frappe.utils.add_to_date(now, minutes=(sync_interval * active_task_count)) - frappe.db.set_value( - TASK_DOCTYPE, - task_name, - { - "status": "Success", - "last_run_at": now, - "next_run_at": next_run, - "claimed_by": "", - "claimed_at": None, - "last_error": "", - "attempts": 0, - "backoff_exp": 0, - }, - ) - return next_run - -# ------------ FALLBACK QUEUE FUNCTIONS ------------ -def _reset_stuck_tasks_fallback(doctype, timeout_minutes=10): - """Fallback implementation when queue module fails""" - try: - timeout_time = frappe.utils.add_to_date(frappe.utils.now_datetime(), minutes=-timeout_minutes) - Task = frappe.qb.DocType(doctype) - - stuck = ( - frappe.qb.from_(Task) - .select(Task.name) - .where( - (Task.status == "Processing") & - (Task.claimed_at < timeout_time) & - ((Task.is_deleted.isnull()) | (Task.is_deleted == 0)) - ) - ).run(as_dict=True) - - for row in stuck: - frappe.db.set_value(doctype, row["name"], { - "status": "Pending", - "claimed_by": "", - "claimed_at": None, - "next_run_at": frappe.utils.now_datetime() - }) - return len(stuck) - except Exception as e: - frappe.log_error("Reset Stuck Tasks Fallback Failed", str(e)) - return 0 - -def _claim_batch_fallback(doctype, limit=5): - """Fallback claim batch when queue module fails""" - try: - now = frappe.utils.now_datetime() - worker_id = frappe.local.site - Task = frappe.qb.DocType(doctype) - - rows = ( - frappe.qb.from_(Task) - .select(Task.name) - .where( - (Task.status.isin(["Pending", "Success"])) & - ((Task.next_run_at.isnull()) | (Task.next_run_at <= now)) & - ((Task.is_deleted.isnull()) | (Task.is_deleted == 0)) - ) - .orderby(Task.priority, order=frappe.qb.terms.Order.desc) - .orderby(Task.name) - .limit(limit) - ).run(as_dict=True) - - if not rows: - return [] - - claimed = [] - for row in rows: - frappe.db.set_value(doctype, row["name"], { - "status": "Processing", - "claimed_by": worker_id, - "claimed_at": now, - "last_run_at": now, - }) - data = frappe.db.get_value(doctype, row["name"], ["name", "vehicle_no"], as_dict=True) - claimed.append(data) - return claimed - except Exception as e: - frappe.log_error("Claim Batch Fallback Failed", str(e)) - return [] - -def _mark_done_fallback(doctype, task): - """Fallback mark done when queue module fails""" - try: - frappe.db.set_value(doctype, task["name"], { - "status": "Success", - "last_run_at": frappe.utils.now_datetime(), - "claimed_by": "", - "claimed_at": None, - "next_run_at": None, - "last_error": "" - }) - except Exception as e: - frappe.log_error("Mark Done Fallback Failed", str(e)) - -# ------------ API INTEGRATION ------------ -def _call_external_api(vehicle_no): - if not vehicle_no or len(vehicle_no) < 7: - raise Exception(f"Invalid vehicle license plate: {vehicle_no}") - - payload = {"vehicle": vehicle_no} - headers = {"Content-Type": "application/json", "Accept": "application/json"} - try: - sleep(2) - response = requests.post(HOST, json=payload, headers=headers, timeout=10) - response.raise_for_status() - result = response.json() - except Exception as e: - raise Exception(f"API/Parse error for {vehicle_no}: {str(e)}") - - # Process Fine Records - fine_records_created, fine_records_updated = _process_fine_records(vehicle_no, result) - - # Process Inspection Records - inspection_records_created, inspection_records_updated = _process_inspection_records(vehicle_no, result) - - return { - "status": "success", - "vehicle": vehicle_no, - "pending_fines": len(result.get("pending_transactions", [])), - "fine_records_created": fine_records_created, - "fine_records_updated": fine_records_updated, - "inspection_records_created": inspection_records_created, - "inspection_records_updated": inspection_records_updated, - "total_pending_amount": result.get("totalPendingAmount", "0.00"), - "has_inspection_data": bool(result.get("inspection_data")) - } - -def _process_fine_records(vehicle_no, result): - """Process pending transactions into Vehicle Fine Records""" - pending_transactions = result.get("pending_transactions", []) - fine_records_created = 0 - fine_records_updated = 0 - - if pending_transactions: - for tx in pending_transactions: - ref = tx.get("reference", "") - if not ref: - continue - - # Check if record exists by reference (unique field) - existing_record = frappe.db.get_value("Vehicle Fine Record", - {"reference": ref}, - ["name", "charge", "penalty", "total", "status"]) - - if not existing_record: - # CREATE NEW RECORD - try: - rec = frappe.new_doc("Vehicle Fine Record") - - # Proper field mapping from API to DocType - rec.reference = ref # reference - rec.issued_date = tx.get("issued_date", "") # issued_date - rec.officer = tx.get("operator", "") # operator -> officer - rec.vehicle = tx.get("vehicle", vehicle_no) # vehicle - rec.licence = tx.get("licence", "") # licence - rec.location = tx.get("location", "") # location - rec.offence = tx.get("offence", "") # offence - rec.status = tx.get("status", "PENDING") # status - - # Currency fields - convert string to float - charge = float(tx.get("charge", 0)) if tx.get("charge") else 0 - penalty = float(tx.get("penalty", 0)) if tx.get("penalty") else 0 - - rec.charge = charge # charge - rec.penalty = penalty # penalty - rec.total = charge + penalty # total (calculated) - - # Link to Vehicle document if exists - vehicle_doc = frappe.db.get_value("Vehicle", - {"license_plate": vehicle_no}, - "name") - if vehicle_doc: - rec.vehicle_doc = vehicle_doc # vehicle_doc - - rec.insert(ignore_permissions=True) - fine_records_created += 1 - - except Exception as e: - frappe.log_error( - title="Vehicle Fine Record Creation Failed", - message=f"Error creating fine record for vehicle {vehicle_no}, reference {ref}: {str(e)}" - ) - else: - # UPDATE EXISTING RECORD - try: - record_name = existing_record[0] if isinstance(existing_record, tuple) else existing_record - - # Get current values - current_charge = existing_record[1] if isinstance(existing_record, tuple) else frappe.db.get_value("Vehicle Fine Record", record_name, "charge") - current_penalty = existing_record[2] if isinstance(existing_record, tuple) else frappe.db.get_value("Vehicle Fine Record", record_name, "penalty") - current_status = existing_record[4] if isinstance(existing_record, tuple) else frappe.db.get_value("Vehicle Fine Record", record_name, "status") - - # New values from API - new_charge = float(tx.get("charge", 0)) if tx.get("charge") else 0 - new_penalty = float(tx.get("penalty", 0)) if tx.get("penalty") else 0 - new_status = tx.get("status", "PENDING") - new_total = new_charge + new_penalty - - # Check if any field needs update - update_needed = False - update_data = {} - - if current_charge != new_charge: - update_data["charge"] = new_charge - update_needed = True - - if current_penalty != new_penalty: - update_data["penalty"] = new_penalty - update_needed = True - - if current_status != new_status: - update_data["status"] = new_status - update_needed = True - - # Always update total if charge/penalty changed - if "charge" in update_data or "penalty" in update_data: - update_data["total"] = new_total - update_needed = True - - # Update other fields that might change - update_data["issued_date"] = tx.get("issued_date", "") - update_data["officer"] = tx.get("operator", "") - update_data["location"] = tx.get("location", "") - update_data["offence"] = tx.get("offence", "") - - if update_needed or any(update_data.values()): - # Perform bulk update - frappe.db.set_value("Vehicle Fine Record", record_name, update_data) - fine_records_updated += 1 - - frappe.logger().info(f"Updated fine record {ref} - Charge: {current_charge}→{new_charge}, Penalty: {current_penalty}→{new_penalty}, Status: {current_status}→{new_status}") - - except Exception as e: - frappe.log_error( - title="Vehicle Fine Record Update Failed", - message=f"Error updating fine record {ref} for vehicle {vehicle_no}: {str(e)}" - ) - else: - # No pending transactions - mark existing unpaid records as PAID - try: - existing = frappe.get_all("Vehicle Fine Record", - filters={"vehicle": vehicle_no, "status": ["!=", "PAID"]}, - pluck="name") - for record in existing: - frappe.db.set_value("Vehicle Fine Record", record, "status", "PAID") - fine_records_updated += 1 - except Exception as e: - frappe.log_error( - title="Vehicle Fine Record Update Failed", - message=f"Error updating fine records to PAID for vehicle {vehicle_no}: {str(e)}" - ) - - return fine_records_created, fine_records_updated - -def _process_inspection_records(vehicle_no, result): - """Process inspection data into Vehicle Inspection Records""" - inspection_data = result.get("inspection_data", []) - inspection_records_created = 0 - inspection_records_updated = 0 - - if inspection_data: - for inspection in inspection_data: - vir_no = inspection.get("vir_no", "") - if not vir_no: - continue - - # Check if record exists by VIR number (unique field) - existing_record = frappe.db.get_value("Vehicle Inspection Record", - {"vir_no": vir_no}, - ["name", "updated_at"]) - - if not existing_record: - # CREATE NEW INSPECTION RECORD - try: - rec = frappe.new_doc("Vehicle Inspection Record") - - # Basic Information - rec.vir_no = vir_no # VIR Number - rec.inspection_id = inspection.get("id") # Inspection ID - rec.vid = inspection.get("vid") # Vehicle ID - rec.noplate = inspection.get("noplate", vehicle_no) # Vehicle Plate - rec.licence = inspection.get("licence", "") # License Number - rec.inspection_date = inspection.get("inspection_date") # Inspection Date - rec.valid_until = inspection.get("valid_untill") # Valid Until (API typo) - rec.final_result = inspection.get("finalresult") # Final Result - - # Inspector Information - rec.inspector = inspection.get("inspector", "") # Inspector Name - rec.inspector_id = inspection.get("inspector_id", "") # Inspector ID - rec.email = inspection.get("email", "") # Inspector Email - rec.region = inspection.get("region", "") # Region - rec.district = inspection.get("district", "") # District - - # Vehicle & Driver Information - rec.driver_name = inspection.get("driver_name", "") # Driver Name - rec.driver_address = inspection.get("driver_address", "") # Driver Address - rec.vehicle_passed_for = inspection.get("vehicle_passed_for", "") # Vehicle Type - rec.weight = inspection.get("weight", "") # Weight Category - rec.prohibition_on_use = inspection.get("prohibition_on_use", "") # Prohibition - rec.originates = inspection.get("originates", "") # Originates - - # Test Results (Pass/Fail) - rec.speed_test = inspection.get("speed_test", "") # Speed Test - rec.electrical_system = inspection.get("electrical_system", "") # Electrical - rec.fitting_equipment = inspection.get("fitting_equipment", "") # Fitting Equipment - rec.braking_system = inspection.get("braking_system", "") # Braking - rec.wheels = inspection.get("wheels", "") # Wheels - rec.suspension = inspection.get("suspension", "") # Suspension - rec.steering = inspection.get("steering", "") # Steering - rec.engine = inspection.get("engine", "") # Engine - rec.exhaust = inspection.get("exhaust", "") # Exhaust - rec.transmission = inspection.get("transimission", "") # Transmission (API typo) - rec.instruments_panel = inspection.get("instruments_panel", "") # Instruments - rec.dimensions = inspection.get("dimensions", "") # Dimensions - rec.radiation = inspection.get("radiation", "") # Radiation - - # Additional Information - rec.remarks = inspection.get("remarks", "") # Remarks - rec.created_at = inspection.get("created_at", "") # Created At - rec.updated_at = inspection.get("updated_at", "") # Updated At - - # Link to Vehicle document if exists - vehicle_doc = frappe.db.get_value("Vehicle", - {"license_plate": vehicle_no}, - "name") - if vehicle_doc: - rec.vehicle_doc = vehicle_doc - - rec.insert(ignore_permissions=True) - inspection_records_created += 1 - - frappe.logger().info(f"Created inspection record {vir_no} for vehicle {vehicle_no}") - - except Exception as e: - frappe.log_error( - title="Vehicle Inspection Record Creation Failed", - message=f"Error creating inspection record for vehicle {vehicle_no}, VIR: {vir_no}: {str(e)}" - ) - else: - # UPDATE EXISTING INSPECTION RECORD - try: - record_name = existing_record[0] if isinstance(existing_record, tuple) else existing_record - api_updated_at = inspection.get("updated_at", "") - current_updated_at = existing_record[1] if isinstance(existing_record, tuple) else frappe.db.get_value("Vehicle Inspection Record", record_name, "updated_at") - - # Only update if API data is newer - if api_updated_at and (not current_updated_at or api_updated_at > str(current_updated_at)): - - update_data = { - "inspection_date": inspection.get("inspection_date"), - "valid_until": inspection.get("valid_untill"), - "final_result": inspection.get("finalresult"), - "inspector": inspection.get("inspector", ""), - "inspector_id": inspection.get("inspector_id", ""), - "email": inspection.get("email", ""), - "region": inspection.get("region", ""), - "district": inspection.get("district", ""), - "driver_name": inspection.get("driver_name", ""), - "driver_address": inspection.get("driver_address", ""), - "vehicle_passed_for": inspection.get("vehicle_passed_for", ""), - "weight": inspection.get("weight", ""), - "prohibition_on_use": inspection.get("prohibition_on_use", ""), - "originates": inspection.get("originates", ""), - "speed_test": inspection.get("speed_test", ""), - "electrical_system": inspection.get("electrical_system", ""), - "fitting_equipment": inspection.get("fitting_equipment", ""), - "braking_system": inspection.get("braking_system", ""), - "wheels": inspection.get("wheels", ""), - "suspension": inspection.get("suspension", ""), - "steering": inspection.get("steering", ""), - "engine": inspection.get("engine", ""), - "exhaust": inspection.get("exhaust", ""), - "transmission": inspection.get("transimission", ""), # API typo - "instruments_panel": inspection.get("instruments_panel", ""), - "dimensions": inspection.get("dimensions", ""), - "radiation": inspection.get("radiation", ""), - "remarks": inspection.get("remarks", ""), - "updated_at": api_updated_at - } - - frappe.db.set_value("Vehicle Inspection Record", record_name, update_data) - inspection_records_updated += 1 - - frappe.logger().info(f"Updated inspection record {vir_no} for vehicle {vehicle_no}") - - except Exception as e: - frappe.log_error( - title="Vehicle Inspection Record Update Failed", - message=f"Error updating inspection record {vir_no} for vehicle {vehicle_no}: {str(e)}" - ) - - return inspection_records_created, inspection_records_updated - -# ------------ MAIN PROCESSOR ------------ -@frappe.whitelist() -def run_vehicle_batch(): - start = datetime.utcnow() - processed, errors = 0, 0 - - try: - print(f"[Vehicle Sync] run_vehicle_batch triggered at {frappe.utils.now()}") - sync_settings = _get_sync_settings() - if not sync_settings["enable_sync"]: - print("[Vehicle Sync] skipped: sync disabled in settings") - return {"status": "disabled", "message": "Vehicle sync is disabled in CSF TZ Settings"} - - if not _is_batch_due(sync_settings["sync_interval"]): - print(f"[Vehicle Sync] skipped: waiting for interval ({sync_settings['sync_interval']} minute(s))") - return { - "status": "skipped", - "message": f"Waiting for sync interval ({sync_settings['sync_interval']} minute(s))", - } - - # Reset stuck tasks - use queue module or fallback - if queue and hasattr(queue, 'reset_stuck_tasks'): - queue.reset_stuck_tasks(TASK_DOCTYPE, timeout_minutes=10) - else: - _reset_stuck_tasks_fallback(TASK_DOCTYPE, timeout_minutes=10) - - # Claim batch of tasks - if queue and hasattr(queue, 'claim_batch'): - tasks = queue.claim_batch(TASK_DOCTYPE, limit=sync_settings["batch_size"]) - else: - tasks = _claim_batch_fallback(TASK_DOCTYPE, limit=sync_settings["batch_size"]) - - if not tasks: - print("[Vehicle Sync] no tasks to process") - return {"status": "no_tasks", "message": f"No pending tasks at {start}"} - - _mark_batch_run() - print(f"[Vehicle Sync] processing {len(tasks)} task(s)") - - for task in tasks: - try: - _call_external_api(task["vehicle_no"]) - - # Schedule next processing by configured sync interval - _schedule_task_by_interval(task["name"], sync_settings["sync_interval"]) - processed += 1 - except Exception as e: - errors += 1 - error_msg = str(e) - frappe.log_error( - title="Vehicle API Processing Failed", - message=f"Error processing vehicle {task.get('vehicle_no')}: {error_msg}" - ) - - # Handle failed task - use queue or simple fallback - if queue and hasattr(queue, 'bump_attempts'): - current_attempts = frappe.db.get_value(TASK_DOCTYPE, task["name"], "attempts") or 0 - backoff_seconds = getattr(queue, 'BASE_BACKOFF', 300) * (2 ** (current_attempts + 1)) - queue.schedule_next(TASK_DOCTYPE, task, backoff_seconds, error_msg) - else: - # Simple fallback - mark as pending for retry - frappe.db.set_value(TASK_DOCTYPE, task["name"], { - "status": "Pending", - "last_error": error_msg[:500], - "next_run_at": frappe.utils.add_to_date(frappe.utils.now_datetime(), minutes=5) - }) - - # Check time budget - time_budget = getattr(queue, 'TIME_BUDGET_SEC', 50) if queue else 50 - if (datetime.utcnow() - start).total_seconds() > time_budget: - break - - frappe.db.commit() - total_runtime = (datetime.utcnow() - start).total_seconds() - print(f"[Vehicle Sync] completed: processed={processed}, errors={errors}, runtime={total_runtime:.2f}s") - return { - "status": "completed", - "runtime_seconds": total_runtime, - "processed": processed, - "errors": errors, - "total_claimed": len(tasks) - } - except Exception as e: - frappe.log_error( - title="Vehicle Batch Processing Failed", - message=f"Critical error in run_vehicle_batch: {str(e)}" - ) - return {"status": "error", "message": str(e)} - -# ------------ 15-MINUTE CYCLE MANAGEMENT ------------ -@frappe.whitelist() -def reset_cycle(): - try: - Task = frappe.qb.DocType(TASK_DOCTYPE) - - done_tasks = ( - frappe.qb.from_(Task) - .select(Task.name) - .where(Task.status == "Done") - ).run(as_dict=True) - - completed_reset = 0 - for row in done_tasks: - try: - frappe.db.set_value(TASK_DOCTYPE, row["name"], { - "status": "Pending", - "next_run_at": frappe.utils.now(), - "claimed_by": "", - "claimed_at": None, - "last_error": "" - }) - completed_reset += 1 - except Exception as e: - frappe.log_error( - title="Task Reset Failed", - message=f"Error resetting completed task {row['name']}: {str(e)}" - ) - - from frappe.utils import add_to_date, now_datetime - failed_tasks = ( - frappe.qb.from_(Task) - .select(Task.name) - .where((Task.status == "Failed") & - (Task.last_run_at < add_to_date(now_datetime(), hours=-1))) - ).run(as_dict=True) - - failed_reset = 0 - for row in failed_tasks: - try: - frappe.db.set_value(TASK_DOCTYPE, row["name"], { - "status": "Pending", - "next_run_at": frappe.utils.now(), - "attempts": 0, - "backoff_exp": 0, - "claimed_by": "", - "claimed_at": None, - }) - failed_reset += 1 - except Exception as e: - frappe.log_error( - title="Failed Task Reset Error", - message=f"Error resetting failed task {row['name']}: {str(e)}" - ) - - frappe.db.commit() - return { - "cycle_reset": True, - "completed_reset": completed_reset, - "failed_reset": failed_reset, - "total_reset": completed_reset + failed_reset, - } - except Exception as e: - frappe.log_error( - title="Cycle Reset Failed", - message=f"Critical error in reset_cycle: {str(e)}" - ) - return {"status": "error", "message": str(e)} - -@frappe.whitelist() -def create_sync_task(vehicle_no, priority=0, immediate=False): - try: - # Check for existing active tasks (not deleted) - existing = frappe.db.get_value( - TASK_DOCTYPE, - { - "vehicle_no": vehicle_no, - "status": ["in", ["Pending", "Processing", "Success"]], - "is_deleted": ["!=", 1] # Only check non-deleted tasks - }, - "name" - ) - - if existing: - if immediate or priority > 5: - frappe.db.set_value(TASK_DOCTYPE, existing, { - "priority": max(priority, 5), - "next_run_at": frappe.utils.now_datetime() - }) - return existing - - # Check if deleted task exists - reactivate it instead of creating new - deleted_task = frappe.db.get_value( - TASK_DOCTYPE, - {"vehicle_no": vehicle_no, "is_deleted": 1}, - "name" - ) - - if deleted_task: - # Reactivate deleted task - frappe.db.set_value(TASK_DOCTYPE, deleted_task, { - "is_deleted": 0, - "status": "Pending", - "priority": priority, - "attempts": 0, - "backoff_exp": 0, - "next_run_at": frappe.utils.now_datetime() if immediate else None, - "claimed_by": "", - "claimed_at": None, - "last_error": "" - }) - return deleted_task - - # Create new task - task = frappe.new_doc(TASK_DOCTYPE) - task.vehicle_no = vehicle_no - task.status = "Pending" - task.priority = priority - task.attempts = 0 - task.backoff_exp = 0 - task.is_deleted = 0 # Explicitly set to 0 - task.next_run_at = frappe.utils.now_datetime() if immediate else None - task.insert(ignore_permissions=True) - return task.name - - except Exception as e: - frappe.log_error( - title="Sync Task Creation Failed", - message=f"Error creating sync task for vehicle {vehicle_no}: {str(e)}" - ) - return None -@frappe.whitelist() -def seed_vehicle_sync_queue(): - """ - Updated: Handles new vehicles, existing vehicles, and marks deleted ones. - Can be used for initial seeding AND daily sync. - """ - try: - # Current vehicles from Vehicle doctype - current_vehicles = frappe.get_all( - "Vehicle", - fields=["license_plate", "name"], - filters={"license_plate": ["is", "set"]} - ) - - - # All existing sync tasks (including deleted ones) - all_tasks = frappe.get_all( - TASK_DOCTYPE, - fields=["vehicle_no", "name", "is_deleted"] - ) - - - current_plates = { - vehicle.license_plate or vehicle.name - for vehicle in current_vehicles if (vehicle.license_plate or vehicle.name) - } - existing_tasks_map = {task.vehicle_no: task for task in all_tasks} - active_plates = {task.vehicle_no for task in all_tasks if not task.is_deleted} - - - created = skipped = invalid = reactivated = deleted_marked = 0 - - - # Process current vehicles - for vehicle in current_vehicles: - try: - number_plate = vehicle.license_plate or vehicle.name - if number_plate: - if number_plate not in existing_tasks_map: - # New vehicle - create sync task - create_sync_task(number_plate, priority=0) - created += 1 - elif existing_tasks_map[number_plate].is_deleted: - # Previously deleted vehicle is back - reactivate using create_sync_task - create_sync_task(number_plate, priority=0) - reactivated += 1 - else: - # Already exists and active - skipped += 1 - else: - invalid += 1 - except Exception as e: - frappe.log_error( - title="Vehicle Sync Queue Seed Error", - message=f"Error processing vehicle {vehicle.get('license_plate') or vehicle.get('name')}: {str(e)}" - ) - - - # Mark vehicles as deleted if they don't exist in current Vehicle doctype - for plate in active_plates: - if plate not in current_plates: - task_name = existing_tasks_map[plate].name - frappe.db.set_value(TASK_DOCTYPE, task_name, "is_deleted", 1) - deleted_marked += 1 - - - frappe.db.commit() - - - return { - "status": "success", - "created": created, - "skipped": skipped, - "invalid": invalid, - "reactivated": reactivated, - "deleted_marked": deleted_marked, - "total_vehicles": len(current_vehicles), - "total_valid_plates": len(current_plates) - } - - - except Exception as e: - frappe.log_error( - title="Seed Vehicle Sync Queue Failed", - message=f"Critical error in seed_vehicle_sync_queue: {str(e)}" - ) - return {"status": "error", "message": str(e)} diff --git a/csf_tz/csf_tz/doctype/vehicle_sync_task/queue.py b/csf_tz/csf_tz/doctype/vehicle_sync_task/queue.py deleted file mode 100644 index f99e3db7..00000000 --- a/csf_tz/csf_tz/doctype/vehicle_sync_task/queue.py +++ /dev/null @@ -1,162 +0,0 @@ -import secrets -import frappe - -# ------------ CONFIGURATION ------------ -BATCH_SIZE = 5 -TIME_BUDGET_SEC = 50 -MAX_ATTEMPTS = 8 -BASE_BACKOFF = 300 -BACKOFF_JITTER = 0.2 -WORKER_ID = frappe.local.site - -# ------------ INTERNAL HELPERS ------------ -def _now(): - return frappe.utils.now_datetime() - -def _jitter(seconds): - # Generate cryptographically secure random jitter for backoff timing - # Range: -BACKOFF_JITTER to +BACKOFF_JITTER - random_factor = (secrets.randbelow(10000) / 10000.0) * 2 - 1 # -1 to 1 - jitter_factor = 1 + (random_factor * BACKOFF_JITTER) - return int(seconds * jitter_factor) - -# ------------ CORE QUEUE OPERATIONS ------------ -def claim_batch(doctype, limit=BATCH_SIZE): - try: - now = _now() - Task = frappe.qb.DocType(doctype) - - rows = ( - frappe.qb.from_(Task) - .select(Task.name) - .where( - (Task.status.isin(["Pending", "Success"])) & - ((Task.next_run_at.isnull()) | (Task.next_run_at <= now)) & - ((Task.is_deleted.isnull()) | (Task.is_deleted == 0)) # ← IGNORE DELETED TASKS - ) - .orderby(Task.priority, order=frappe.qb.terms.Order.desc) - .orderby(Task.name) - .limit(limit) - ).run(as_dict=True) - - if not rows: - return [] - - claimed = [] - for row in rows: - frappe.db.set_value(doctype, row["name"], { - "status": "Processing", - "claimed_by": WORKER_ID, - "claimed_at": now, - "last_run_at": now, - }) - data = frappe.db.get_value(doctype, row["name"], ["name", "vehicle_no"], as_dict=True) - claimed.append(data) - return claimed - except Exception as e: - frappe.log_error( - title="Queue Claim Batch Failed", - message=f"Error claiming batch from {doctype}: {str(e)}" - ) - return [] - -def mark_done(doctype, task): - try: - frappe.db.set_value(doctype, task["name"], { - "status": "Success", - "last_run_at": _now(), - "claimed_by": "", - "claimed_at": None, - "next_run_at": None, - "last_error": "" - }) - except Exception as e: - frappe.log_error( - title="Queue Mark Done Failed", - message=f"Error marking task {task.get('name')} as done in {doctype}: {str(e)}" - ) - -def mark_failed(doctype, task, err_msg): - try: - frappe.db.set_value(doctype, task["name"], { - "status": "Failed", - "last_error": err_msg[:1000], - "last_run_at": _now(), - "claimed_by": "", - "claimed_at": None, - "next_run_at": None, - }) - except Exception as e: - frappe.log_error( - title="Queue Mark Failed Error", - message=f"Error marking task {task.get('name')} as failed in {doctype}: {str(e)}" - ) - -def bump_attempts(doctype, task): - try: - current = frappe.db.get_value( - doctype, task["name"], ["attempts", "backoff_exp"], as_dict=True - ) - attempts = (current.attempts or 0) + 1 - backoff_exp = min((current.backoff_exp or 0) + 1, 6) - frappe.db.set_value(doctype, task["name"], { - "attempts": attempts, - "backoff_exp": backoff_exp, - "last_run_at": _now() - }) - return attempts, backoff_exp - except Exception as e: - frappe.log_error( - title="Queue Bump Attempts Failed", - message=f"Error bumping attempts for task {task.get('name')} in {doctype}: {str(e)}" - ) - return 1, 1 # Return default values - -def schedule_next(doctype, task, backoff_seconds, error_msg=""): - try: - attempts, _ = bump_attempts(doctype, task) - if attempts >= MAX_ATTEMPTS: - mark_failed(doctype, task, error_msg or "Max attempts exceeded") - return - next_run = frappe.utils.add_to_date(_now(), seconds=_jitter(backoff_seconds)) - frappe.db.set_value(doctype, task["name"], { - "status": "Pending", - "claimed_by": "", - "claimed_at": None, - "next_run_at": next_run, - "last_error": error_msg[:500] if error_msg else "", - }) - except Exception as e: - frappe.log_error( - title="Queue Schedule Next Failed", - message=f"Error scheduling next run for task {task.get('name')} in {doctype}: {str(e)}" - ) - -def reset_stuck_tasks(doctype, timeout_minutes=10): - try: - timeout_time = frappe.utils.add_to_date(_now(), minutes=-timeout_minutes) - Task = frappe.qb.DocType(doctype) - stuck = ( - frappe.qb.from_(Task) - .select(Task.name) - .where( - (Task.status == "Processing") & - (Task.claimed_at < timeout_time) & - ((Task.is_deleted.isnull()) | (Task.is_deleted == 0)) # ← IGNORE DELETED TASKS - ) - ).run(as_dict=True) - - for row in stuck: - frappe.db.set_value(doctype, row["name"], { - "status": "Pending", - "claimed_by": "", - "claimed_at": None, - "next_run_at": _now() - }) - return len(stuck) - except Exception as e: - frappe.log_error( - title="Queue Reset Stuck Tasks Failed", - message=f"Error resetting stuck tasks in {doctype}: {str(e)}" - ) - return 0 diff --git a/csf_tz/csf_tz/doctype/vehicle_sync_task/test_vehicle_sync_task.py b/csf_tz/csf_tz/doctype/vehicle_sync_task/test_vehicle_sync_task.py deleted file mode 100644 index 09069b1e..00000000 --- a/csf_tz/csf_tz/doctype/vehicle_sync_task/test_vehicle_sync_task.py +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (c) 2025, Aakvatech and Contributors -# See license.txt - -# import frappe -from frappe.tests.utils import FrappeTestCase - - -class TestVehicleSyncTask(FrappeTestCase): - pass diff --git a/csf_tz/csf_tz/doctype/vehicle_sync_task/vehicle_sync_task.js b/csf_tz/csf_tz/doctype/vehicle_sync_task/vehicle_sync_task.js deleted file mode 100644 index 5799be16..00000000 --- a/csf_tz/csf_tz/doctype/vehicle_sync_task/vehicle_sync_task.js +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright (c) 2025, Aakvatech and contributors -// For license information, please see license.txt - -// frappe.ui.form.on("Vehicle Sync Task", { -// refresh(frm) { - -// }, -// }); diff --git a/csf_tz/csf_tz/doctype/vehicle_sync_task/vehicle_sync_task.json b/csf_tz/csf_tz/doctype/vehicle_sync_task/vehicle_sync_task.json deleted file mode 100644 index 02bae021..00000000 --- a/csf_tz/csf_tz/doctype/vehicle_sync_task/vehicle_sync_task.json +++ /dev/null @@ -1,178 +0,0 @@ -{ - "actions": [], - "autoname": "autoincrement", - "creation": "2025-08-22 18:55:40.875910", - "doctype": "DocType", - "engine": "InnoDB", - "field_order": [ - "vehicle_details_section", - "vehicle_no", - "column_break_nipc", - "priority", - "status_details_section", - "status", - "attempts", - "backoff_exp", - "column_break_btfh", - "next_run_at", - "last_run_at", - "execution_details_section", - "claimed_at", - "column_break_qlib", - "claimed_by", - "error_details_section", - "last_error", - "is_deleted" - ], - "fields": [ - { - "fieldname": "vehicle_no", - "fieldtype": "Data", - "in_list_view": 1, - "label": "Vehicle No", - "no_copy": 1, - "unique": 1 - }, - { - "fieldname": "status", - "fieldtype": "Select", - "in_list_view": 1, - "label": "Status", - "options": "\nPending\nProcessing\nSuccess\nFailed\nPaused", - "search_index": 1 - }, - { - "default": "0", - "fieldname": "attempts", - "fieldtype": "Int", - "label": "Attempts" - }, - { - "fieldname": "last_error", - "fieldtype": "Small Text", - "label": "Last Error" - }, - { - "fieldname": "vehicle_details_section", - "fieldtype": "Section Break", - "label": "Vehicle Details" - }, - { - "fieldname": "status_details_section", - "fieldtype": "Section Break", - "label": "Status Details" - }, - { - "fieldname": "next_run_at", - "fieldtype": "Datetime", - "in_list_view": 1, - "label": "Next Run at", - "search_index": 1 - }, - { - "default": "0", - "fieldname": "priority", - "fieldtype": "Int", - "label": "Priority", - "search_index": 1 - }, - { - "fieldname": "column_break_btfh", - "fieldtype": "Column Break" - }, - { - "default": "0", - "fieldname": "backoff_exp", - "fieldtype": "Int", - "label": "Backoff Exponent" - }, - { - "fieldname": "last_run_at", - "fieldtype": "Datetime", - "label": "Last Run at", - "search_index": 1 - }, - { - "fieldname": "claimed_by", - "fieldtype": "Data", - "label": "Claimed By" - }, - { - "fieldname": "claimed_at", - "fieldtype": "Datetime", - "label": "Claimed at" - }, - { - "fieldname": "column_break_nipc", - "fieldtype": "Column Break" - }, - { - "fieldname": "execution_details_section", - "fieldtype": "Section Break", - "label": "Execution Details" - }, - { - "fieldname": "column_break_qlib", - "fieldtype": "Column Break" - }, - { - "fieldname": "error_details_section", - "fieldtype": "Section Break", - "label": "Error Details" - }, - { - "default": "0", - "fieldname": "is_deleted", - "fieldtype": "Check", - "label": "is Deleted ?" - } - ], - "grid_page_length": 50, - "index_web_pages_for_search": 1, - "links": [], - "modified": "2025-09-14 21:43:07.623030", - "modified_by": "Administrator", - "module": "CSF TZ", - "name": "Vehicle Sync Task", - "naming_rule": "Autoincrement", - "owner": "Administrator", - "permissions": [ - { - "create": 1, - "delete": 1, - "email": 1, - "export": 1, - "print": 1, - "read": 1, - "report": 1, - "role": "System Manager", - "share": 1, - "write": 1 - } - ], - "row_format": "Dynamic", - "sort_field": "modified", - "sort_order": "DESC", - "states": [ - { - "color": "Yellow", - "title": "Pending" - }, - { - "color": "Blue", - "title": "Processing" - }, - { - "color": "Green", - "title": "Success" - }, - { - "color": "Red", - "title": "Failed" - }, - { - "color": "Gray", - "title": "Paused" - } - ] -} diff --git a/csf_tz/csf_tz/doctype/vehicle_sync_task/vehicle_sync_task.py b/csf_tz/csf_tz/doctype/vehicle_sync_task/vehicle_sync_task.py deleted file mode 100644 index 1d495f70..00000000 --- a/csf_tz/csf_tz/doctype/vehicle_sync_task/vehicle_sync_task.py +++ /dev/null @@ -1,13 +0,0 @@ -# Copyright (c) 2025, Aakvatech and contributors -# For license information, please see license.txt - -import frappe -from frappe.model.document import Document -from frappe.query_builder import Interval -from frappe.query_builder.functions import Now - -class VehicleSyncTask(Document): - @staticmethod - def clear_old_logs(days=7): - table = frappe.qb.DocType("Vehicle Sync Task") - frappe.db.delete(table, filters=(table.creation < (Now() - Interval(days=days)))) \ No newline at end of file diff --git a/csf_tz/csf_tz/print_format/__init__.py b/csf_tz/csf_tz/print_format/__init__.py deleted file mode 100755 index e69de29b..00000000 diff --git a/csf_tz/csf_tz/print_format/av_jounrnal_entry/__init__.py b/csf_tz/csf_tz/print_format/av_jounrnal_entry/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/csf_tz/print_format/av_jounrnal_entry/av_jounrnal_entry.json b/csf_tz/csf_tz/print_format/av_jounrnal_entry/av_jounrnal_entry.json deleted file mode 100644 index e27188d3..00000000 --- a/csf_tz/csf_tz/print_format/av_jounrnal_entry/av_jounrnal_entry.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "align_labels_right": 1, - "creation": "2020-03-04 10:07:22.836521", - "css": "@media screen {\n .print-format {\n padding-left: 10mm;\n padding-right: 10mm;\n padding-top: 5mm;\n padding-bottom: 2mm;\n width: 5.8in;\n min-height: 8.3in;\n font-size: 7pt;\n }\n .print-format td, .print-format th {\n vertical-align: top !important;\n padding: 2px !important;\n }\n\n .print-format h1 { font-size: 19pt;}\n .print-format h2 { font-size: 17pt;}\n .print-format h3 { font-size: 15pt;}\n .print-format h4 { font-size: 13pt;}\n .print-format h5 { font-size: 9pt;}\n .print-format h6 { font-size: 8px;}\n}\n.hr_class {\n margin-top: 6px;\n margin-bottom: 6px;\n}", - "custom_format": 0, - "disabled": 0, - "doc_type": "Journal Entry", - "docstatus": 0, - "doctype": "Print Format", - "font": "Default", - "format_data": "[{\"fieldtype\": \"Custom HTML\", \"fieldname\": \"print_heading_template\", \"options\": \"\\n \\n \\n \\n \\n \\n

VRN {{ frappe.db.get_value(\\\"Company\\\", doc.company, \\\"vrn\\\") }}

JOURNAL ENTRY

TIN {{ frappe.db.get_value(\\\"Company\\\", doc.company, \\\"tin\\\") }}

\\n
\"}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"voucher_type\", \"label\": \"Entry Type\", \"print_hide\": 0}, {\"fieldname\": \"finance_book\", \"label\": \"Finance Book\", \"print_hide\": 0}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"posting_date\", \"label\": \"Posting Date\", \"print_hide\": 0}, {\"fieldtype\": \"HTML\", \"fieldname\": \"_custom_html\", \"label\": \"Custom HTML\", \"print_hide\": 0, \"options\": \"
\\n
\\n \\n
\\n
\\n {{ doc.name}}\\n
\\n
\"}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"visible_columns\": [{\"print_width\": \"250px\", \"fieldname\": \"account\", \"print_hide\": 0}, {\"print_width\": \"\", \"fieldname\": \"party_type\", \"print_hide\": 0}, {\"print_width\": \"\", \"fieldname\": \"party\", \"print_hide\": 0}, {\"print_width\": \"\", \"fieldname\": \"debit_in_account_currency\", \"print_hide\": 0}, {\"print_width\": \"\", \"fieldname\": \"credit_in_account_currency\", \"print_hide\": 0}, {\"print_width\": \"\", \"fieldname\": \"reference_type\", \"print_hide\": 0}, {\"print_width\": \"\", \"fieldname\": \"reference_name\", \"print_hide\": 0}, {\"print_width\": \"\", \"fieldname\": \"reference_due_date\", \"print_hide\": 0}, {\"print_width\": \"\", \"fieldname\": \"project\", \"print_hide\": 0}], \"fieldname\": \"accounts\", \"label\": \"Accounting Entries\", \"print_hide\": 0}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"remark\", \"label\": \"Remark\", \"print_hide\": 0}, {\"fieldtype\": \"Column Break\"}]", - "html": "", - "idx": 0, - "line_breaks": 1, - "modified": "2020-03-09 17:15:20.186043", - "modified_by": "Administrator", - "module": "CSF TZ", - "name": "AV Jounrnal Entry", - "owner": "Administrator", - "parent": "Journal Entry", - "print_format_builder": 1, - "print_format_type": "Jinja", - "raw_printing": 0, - "show_section_headings": 1, - "standard": "Yes" -} \ No newline at end of file diff --git a/csf_tz/csf_tz/print_format/av_payment_entry_voucher/__init__.py b/csf_tz/csf_tz/print_format/av_payment_entry_voucher/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/csf_tz/print_format/av_payment_entry_voucher/av_payment_entry_voucher.json b/csf_tz/csf_tz/print_format/av_payment_entry_voucher/av_payment_entry_voucher.json deleted file mode 100644 index 3b2010c3..00000000 --- a/csf_tz/csf_tz/print_format/av_payment_entry_voucher/av_payment_entry_voucher.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "absolute_value": 0, - "align_labels_right": 1, - "creation": "2020-03-04 10:07:22.784499", - "css": ".print-format td, .print-format th \n{\n \tvertical-align: top !important;\n \tpadding: 5px !important;\n\tvertical-align: bottom !important;\n}\n.print-format {\n padding-left: 10mm;\n padding-right: 5mm;\n padding-top: 5mm;\n\tfont-size: 10pt;\t\n}\n\n .print-format h1 { font-size: 19pt;}\n .print-format h2 { font-size: 17pt;}\n .print-format h3 { font-size: 15pt;}\n .print-format h4 { font-size: 13pt;}\n .print-format h5 { font-size: 9pt;}\n .print-format h6 { font-size: 8px;}\n}\n.hr_class {\n margin-top: 6px;\n margin-bottom: 6px;\n}\n\n.clearfix:after {\n /* clear: both; */\n}", - "custom_format": 0, - "disabled": 0, - "doc_type": "Payment Entry", - "docstatus": 0, - "doctype": "Print Format", - "font": "Default", - "format_data": "[{\"fieldname\": \"print_heading_template\", \"fieldtype\": \"Custom HTML\", \"options\": \"\\n \\n \\n \\n \\n \\n

VRN {{ frappe.db.get_value(\\\"Company\\\", doc.company, \\\"vrn\\\") }}

\\n\\t{% if doc.payment_type == \\\"Receive\\\" %}\\n\\t RECEIPT\\n\\t{% elif doc.payment_type == \\\"Pay\\\" %}\\n PAYMENT VOUCHER\\n\\t{% else %}\\n INTERNAL TRANSFER VOUCHER\\n {% endif %}\\n

TIN {{ frappe.db.get_value(\\\"Company\\\", doc.company, \\\"tin\\\") }}

\\n
\"}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"_custom_html\", \"print_hide\": 0, \"label\": \"Custom HTML\", \"fieldtype\": \"HTML\", \"options\": \"
\\n
\\n \\n
\\n
\\n {{ doc.party_name}}\\n
\\n
\\n
\\n
\\n \\n
\\n
\\n {{ doc.mode_of_payment}}\\n
\\n
\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"_custom_html\", \"print_hide\": 0, \"label\": \"Custom HTML\", \"fieldtype\": \"HTML\", \"options\": \"
\\n
\\n \\n
\\n
\\n {{ doc.name}}\\n
\\n
\\n
\\n
\\n \\n
\\n
\\n {{ doc.posting_date}}\\n
\\n
\"}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"_custom_html\", \"print_hide\": 0, \"label\": \"Custom HTML\", \"fieldtype\": \"HTML\", \"options\": \"
\\n
\\n \\n
\\n
\\n {{ doc.paid_from }}\\n
\\n
\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"_custom_html\", \"print_hide\": 0, \"label\": \"Custom HTML\", \"fieldtype\": \"HTML\", \"options\": \"
\\n
\\n \\n
\\n
\\n {{ doc.paid_to }}\\n
\\n
\"}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"_custom_html\", \"print_hide\": 0, \"label\": \"Custom HTML\", \"fieldtype\": \"HTML\", \"options\": \"
\\r\\n
\\r\\n \\r\\n
\\r\\n
\\r\\n {{ frappe.utils.fmt_money(doc.received_amount, currency=doc.paid_to_account_currency) }}
\\r\\n
\\r\\n
\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"_custom_html\", \"print_hide\": 0, \"label\": \"Custom HTML\", \"fieldtype\": \"HTML\", \"options\": \"
\\n
\\n \\n
\\n
\\n {{ frappe.utils.money_in_words(doc.received_amount, doc.paid_to_account_currency) }}\\n
\\n
\"}, {\"fieldtype\": \"Section Break\", \"label\": \"Transaction\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"_custom_html\", \"print_hide\": 0, \"label\": \"Custom HTML\", \"fieldtype\": \"HTML\", \"options\": \"
\\n
\\n \\n
\\n
\\n {{ doc.reference_no }}\\n
\\n
\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"_custom_html\", \"print_hide\": 0, \"label\": \"Custom HTML\", \"fieldtype\": \"HTML\", \"options\": \"
\\n
\\n \\n
\\n
\\n {{ doc.reference_date }}\\n
\\n
\"}, {\"fieldtype\": \"Section Break\", \"label\": \"Reference\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"_custom_html\", \"print_hide\": 0, \"label\": \"Custom HTML\", \"fieldtype\": \"HTML\", \"options\": \"{% if doc.payment_type != \\\"Internal Transfer\\\" %}\\n\\n{% endif %}\"}, {\"fieldname\": \"references\", \"print_hide\": 0, \"label\": \"Payment References\", \"visible_columns\": [{\"fieldname\": \"reference_doctype\", \"print_width\": \"\", \"print_hide\": 0}, {\"fieldname\": \"reference_name\", \"print_width\": \"\", \"print_hide\": 0}, {\"fieldname\": \"due_date\", \"print_width\": \"\", \"print_hide\": 0}, {\"fieldname\": \"bill_no\", \"print_width\": \"\", \"print_hide\": 0}, {\"fieldname\": \"outstanding_amount\", \"print_width\": \"\", \"print_hide\": 0}, {\"fieldname\": \"allocated_amount\", \"print_width\": \"\", \"print_hide\": 0}]}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"_custom_html\", \"print_hide\": 0, \"label\": \"Custom HTML\", \"fieldtype\": \"HTML\", \"options\": \" \\n \\n \\n \\n \\n
\\n {{ doc.remarks }}\\n \\n for {{ doc.company }}\\n
\\n
\\n Authorised Signatory\\n
\\n
\\n
\"}]", - "html": "\n ", - "idx": 0, - "line_breaks": 0, - "modified": "2021-02-16 09:01:40.643509", - "modified_by": "info@aakvatech.com", - "module": "CSF TZ", - "name": "AV Payment Entry Voucher", - "owner": "Administrator", - "parent": "", - "parentfield": "", - "parenttype": "", - "print_format_builder": 1, - "print_format_type": "Jinja", - "raw_printing": 0, - "show_section_headings": 1, - "standard": "Yes" -} \ No newline at end of file diff --git a/csf_tz/csf_tz/print_format/av_proforma_invoice/__init__.py b/csf_tz/csf_tz/print_format/av_proforma_invoice/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/csf_tz/print_format/av_proforma_invoice/av_proforma_invoice.json b/csf_tz/csf_tz/print_format/av_proforma_invoice/av_proforma_invoice.json deleted file mode 100644 index 9a671d86..00000000 --- a/csf_tz/csf_tz/print_format/av_proforma_invoice/av_proforma_invoice.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "align_labels_right": 1, - "creation": "2020-03-04 10:07:22.675296", - "css": ".print-format {\npadding-left: 10mm;\npadding-right: 10mm;\npadding-top: 5mm;\npadding-bottom: 2mm;\n}\n\n.print-format td, .print-format th \n{\n vertical-align: top !important;\n padding: 3px !important;\n}", - "custom_format": 0, - "disabled": 0, - "doc_type": "Quotation", - "docstatus": 0, - "doctype": "Print Format", - "font": "Default", - "format_data": "[{\"fieldtype\": \"Custom HTML\", \"fieldname\": \"print_heading_template\", \"options\": \"\\n \\n \\n \\n \\n

VRN {{ frappe.db.get_value(\\\"Company\\\", doc.company, \\\"vrn\\\") }}

TIN {{ frappe.db.get_value(\\\"Company\\\", doc.company, \\\"tin\\\") }}

\\n

PROFORMA INVOICE

\\n
\"}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"customer_name\", \"label\": \"Customer Name\", \"print_hide\": 0}, {\"fieldname\": \"address_display\", \"label\": \"Address\", \"print_hide\": 0}, {\"fieldtype\": \"HTML\", \"fieldname\": \"_custom_html\", \"options\": \"
\\n
\\n \\n
\\n
\\n {{ frappe.db.get_value(\\\"Customer\\\", doc.party_name, \\\"vrn\\\") }}\\n
\\n
\\n
\\n
\\n \\n
\\n
\\n {{ frappe.db.get_value(\\\"Customer\\\", doc.party_name, \\\"tax_id\\\") }}\\n
\\n
\\n\", \"print_hide\": 0, \"label\": \"Custom HTML\"}, {\"fieldname\": \"cost_center\", \"label\": \"Cost Center\", \"print_hide\": 0}, {\"fieldtype\": \"Column Break\"}, {\"fieldtype\": \"HTML\", \"fieldname\": \"_custom_html\", \"options\": \"
\\n
\\n \\n
\\n
\\n {{ doc.name}}\\n
\\n
\", \"print_hide\": 0, \"label\": \"Custom HTML\"}, {\"fieldname\": \"transaction_date\", \"label\": \"Date\", \"print_hide\": 0}, {\"fieldname\": \"valid_till\", \"label\": \"Valid Till\", \"print_hide\": 0}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldtype\": \"HTML\", \"fieldname\": \"_custom_html\", \"options\": \"\\n\\n \\n \\n \\n \\n \\n \\n\\n\\n\\n\\t\\n\\n{% for item in doc.items %}\\n\\n\\t\\n\\t\\n\\t\\n\\t\\n\\t\\n\\t\\n\\n{% endfor %}\\n\\n \\n\\t\\n \\n\\t\\n\\n\\n\\t\\n \\n\\t\\n\\t\\n\\n\\n\\t\\n\\t\\n\\t\\n\\n\\n\\t\\n\\t\\n\\n\\n\\t\\n\\n\\n
SI\\n\\tParticulars\\n\\tQTY\\n\\tVAT\\n\\tRate\\n\\tAmount\\n
{{ loop.index }}{{ item.item_name }}\\n {{ item.get_formatted(\\\"qty\\\", 0) }}\\n {{ item.get_formatted(\\\"uom\\\", 0) }}\\n \\n\\t\\t{% set mydict = json.loads(item.item_tax_rate) %}\\n\\t\\t{% if item.item_tax_rate == \\\"{}\\\" %}\\n\\t\\t\\t{% for row in doc.taxes %}\\n\\t\\t\\t\\t{{ row.get_formatted(\\\"rate\\\",0) }}\\n\\t\\t\\t{% endfor %}\\n\\t\\t{% else %}\\n\\t\\t\\t{% for key, value in mydict.items() %}\\n\\t\\t\\t\\t{{ value }}%\\n\\t\\t\\t{% endfor %}\\n\\t\\t{% endif %}\\n\\t{{ item.get_formatted(\\\"rate\\\", doc) }}{{ item.get_formatted(\\\"amount\\\", doc) }}
\\n Amount in Words
\\n {{ doc.in_words }}

\\n \\n {% if doc.currency != \\\"TZS\\\" %}\\n {{ doc.base_in_words }}\\n {% endif %} \\n \\n
SUB. TOTAL\\n {% if doc.currency != \\\"TZS\\\" %}\\n {{ doc.get_formatted(\\\"base_total\\\", doc) }}\\n {% endif %}\\n {{ doc.get_formatted(\\\"total\\\", doc) }}
V.A.T.\\n {% if doc.currency != \\\"TZS\\\" %}\\n {{ doc.get_formatted(\\\"base_total_taxes_and_charges\\\", doc) }}\\n {% endif %}\\n {{ doc.get_formatted(\\\"total_taxes_and_charges\\\", doc) }}
TOTAL\\n {% if doc.currency != \\\"TZS\\\" %}\\n {{ doc.get_formatted(\\\"base_grand_total\\\", doc) }}\\n {% endif %} \\n {{ doc.get_formatted(\\\"grand_total\\\", doc) }}
\\n\\t {{ frappe.db.get_value(\\\"Company\\\", doc.company, \\\"company_bank_details\\\") }}\\n\\t\\n for {{ doc.company }}\\n
\\n
\\n Authorised Signatory\\n
\\n
\\n
\\n Terms and Conditions
\\n\\t {{ doc.terms }}\\n\\t
\\n
\\n
\\n 1mm\\n 1mm\\n 1mm\\n 0mm\\n
\\n
\", \"print_hide\": 0, \"label\": \"Custom HTML\"}]", - "html": "", - "idx": 0, - "line_breaks": 1, - "modified": "2020-03-09 17:13:49.279900", - "modified_by": "Administrator", - "module": "CSF TZ", - "name": "AV Proforma Invoice", - "owner": "Administrator", - "print_format_builder": 1, - "print_format_type": "Jinja", - "raw_printing": 0, - "show_section_headings": 1, - "standard": "Yes" -} \ No newline at end of file diff --git a/csf_tz/csf_tz/print_format/av_purchase_invoice/__init__.py b/csf_tz/csf_tz/print_format/av_purchase_invoice/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/csf_tz/print_format/av_purchase_invoice/av_purchase_invoice.json b/csf_tz/csf_tz/print_format/av_purchase_invoice/av_purchase_invoice.json deleted file mode 100644 index 739ce540..00000000 --- a/csf_tz/csf_tz/print_format/av_purchase_invoice/av_purchase_invoice.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "align_labels_right": 0, - "creation": "2020-03-04 10:07:23.062648", - "css": ".print-format {\npadding-left: 10mm;\npadding-right: 10mm;\npadding-top: 5mm;\npadding-bottom: 2mm;\n}\n\n.print-format td, .print-format th \n{\n vertical-align: top !important;\n padding: 3px !important;\n}", - "custom_format": 0, - "disabled": 0, - "doc_type": "Purchase Invoice", - "docstatus": 0, - "doctype": "Print Format", - "font": "Default", - "format_data": "[{\"fieldtype\": \"Custom HTML\", \"fieldname\": \"print_heading_template\", \"options\": \"\\n \\n \\n \\n \\n

VRN {{ frappe.db.get_value(\\\"Company\\\", doc.company, \\\"vrn\\\") }}

TIN {{ frappe.db.get_value(\\\"Company\\\", doc.company, \\\"tin\\\") }}

\\n

PURCHASE INVOICE

\\n
\"}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"supplier_name\", \"label\": \"Supplier Name\", \"print_hide\": 0}, {\"fieldname\": \"address_display\", \"label\": \"Address\", \"print_hide\": 0}, {\"fieldtype\": \"HTML\", \"fieldname\": \"_custom_html\", \"options\": \"
\\n
\\n \\n
\\n
\\n {{ frappe.db.get_value(\\\"Supplier\\\", doc.supplier, \\\"vrn\\\") }}\\n
\\n
\\n
\\n
\\n \\n
\\n
\\n {{ frappe.db.get_value(\\\"Supplier\\\", doc.supplier, \\\"tax_id\\\") }}\\n
\\n
\", \"print_hide\": 0, \"label\": \"Custom HTML\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldtype\": \"HTML\", \"fieldname\": \"_custom_html\", \"options\": \"
\\n
\\n \\n
\\n
\\n {{ doc.name}}\\n
\\n
\", \"print_hide\": 0, \"label\": \"Custom HTML\"}, {\"fieldname\": \"posting_date\", \"label\": \"Date\", \"print_hide\": 0}, {\"fieldname\": \"cost_center\", \"label\": \"Cost Center\", \"print_hide\": 0}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldtype\": \"HTML\", \"fieldname\": \"_custom_html\", \"options\": \"\\n\\n \\n \\n \\n \\n \\n \\n\\n\\n\\n\\t\\n\\n{% for item in doc.items %}\\n\\n\\t\\n\\t\\n\\t\\n\\t\\n\\t\\n\\t\\n\\n{% endfor %}\\n\\n \\n\\t\\n \\n\\t\\n\\n\\n\\t\\n \\n\\t\\n\\t\\n\\n\\n\\t\\n\\t\\n\\t\\n\\n\\n\\t\\n\\t\\n\\n\\n
SI\\n\\tParticulars\\n\\tQTY\\n\\tVAT\\n\\tRate\\n\\tAmount\\n
{{ loop.index }}{{ item.item_name }}\\n {{ item.get_formatted(\\\"qty\\\", 0) }}\\n {{ item.get_formatted(\\\"uom\\\", 0) }}\\n \\n\\t\\t{% set mydict = json.loads(item.item_tax_rate) %}\\n\\t\\t{% if item.item_tax_rate == \\\"{}\\\" %}\\n\\t\\t\\t{% for row in doc.taxes %}\\n\\t\\t\\t\\t{{ row.get_formatted(\\\"rate\\\",0) }}\\n\\t\\t\\t{% endfor %}\\n\\t\\t{% else %}\\n\\t\\t\\t{% for key, value in mydict.items() %}\\n\\t\\t\\t\\t{{ value }}%\\n\\t\\t\\t{% endfor %}\\n\\t\\t{% endif %}\\n\\t{{ item.get_formatted(\\\"rate\\\", doc) }}{{ item.get_formatted(\\\"amount\\\", doc) }}
\\n Amount in Words
\\n {{ doc.in_words }}

\\n \\n {% if doc.currency != \\\"TZS\\\" %}\\n {{ doc.base_in_words }}\\n {% endif %} \\n \\n
SUB. TOTAL\\n {% if doc.currency != \\\"TZS\\\" %}\\n {{ doc.get_formatted(\\\"base_net_total\\\", doc) }}\\n {% endif %}\\n {{ doc.get_formatted(\\\"net_total\\\", doc) }}
V.A.T.\\n {% if doc.currency != \\\"TZS\\\" %}\\n {{ doc.get_formatted(\\\"base_total_taxes_and_charges\\\", doc) }}\\n {% endif %}\\n {{ doc.get_formatted(\\\"total_taxes_and_charges\\\", doc) }}
TOTAL\\n {% if doc.currency != \\\"TZS\\\" %}\\n {{ doc.get_formatted(\\\"base_grand_total\\\", doc) }}\\n {% endif %} \\n {{ doc.get_formatted(\\\"grand_total\\\", doc) }}
{{ doc.remarks }}\\n for {{ doc.company }}\\n
\\n
\\n Authorised Signatory\\n
\\n
\\n
\\n
\\n
\\n 1mm\\n 1mm\\n 1mm\\n 0mm\\n
\\n
\", \"print_hide\": 0, \"label\": \"Custom HTML\"}]", - "html": "", - "idx": 0, - "line_breaks": 0, - "modified": "2020-03-09 17:13:24.244958", - "modified_by": "Administrator", - "module": "CSF TZ", - "name": "AV Purchase Invoice", - "owner": "Administrator", - "print_format_builder": 1, - "raw_printing": 0, - "show_section_headings": 0, - "standard": "Yes" -} diff --git a/csf_tz/csf_tz/print_format/av_tax_invoice/__init__.py b/csf_tz/csf_tz/print_format/av_tax_invoice/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/csf_tz/print_format/av_tax_invoice/av_tax_invoice.json b/csf_tz/csf_tz/print_format/av_tax_invoice/av_tax_invoice.json deleted file mode 100644 index 176df3ab..00000000 --- a/csf_tz/csf_tz/print_format/av_tax_invoice/av_tax_invoice.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "absolute_value": 0, - "align_labels_right": 1, - "creation": "2020-03-04 10:07:23.010409", - "css": ".print-format td, .print-format th \n{\n \tvertical-align: top !important;\n \tpadding: 5px !important;\n\tvertical-align: bottom !important;\n}\n.print-format {\n padding-left: 10mm;\n padding-right: 5mm;\n padding-top: 5mm;\n\tfont-size: 10pt;\t\n}\n\ntd.tight {\n padding: 0px !important;\n}", - "custom_format": 0, - "disabled": 1, - "doc_type": "Sales Invoice", - "docstatus": 0, - "doctype": "Print Format", - "font": "Default", - "format_data": "[{\"fieldname\": \"print_heading_template\", \"fieldtype\": \"Custom HTML\", \"options\": \"\\n \\n \\n \\n \\n

VRN {{ frappe.db.get_value(\\\"Company\\\", doc.company, \\\"vrn\\\") }}

TIN {{ frappe.db.get_value(\\\"Company\\\", doc.company, \\\"tin\\\") }}

\\n{% if doc.select_print_heading is not none %}\\n

{{ doc.select_print_heading }}

\\n{% else %}\\n

TAX INVOICE

\\n{% endif %}\\n
\"}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"_custom_html\", \"print_hide\": 0, \"label\": \"Custom HTML\", \"fieldtype\": \"HTML\", \"options\": \"
\\n
\\n \\n
\\n
\\n {{ doc.customer_name}}\\n
\\n
\\n
\\n
\\n \\n
\\n
\\n {{ doc.address_display}}\\n
\\n
\\n
\\n
\\n \\n
\\n
\\n {{ frappe.db.get_value(\\\"Customer\\\", doc.customer, \\\"vrn\\\") }}\\n
\\n
\\n
\\n
\\n \\n
\\n
\\n {{ frappe.db.get_value(\\\"Customer\\\", doc.customer, \\\"tax_id\\\") }}\\n
\\n
\\n
\\n
\\n \\n
\\n
\\n\\t{{ doc.cost_center}}\\n
\\n
\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"_custom_html\", \"print_hide\": 0, \"label\": \"Custom HTML\", \"fieldtype\": \"HTML\", \"options\": \"
\\n
\\n {% if (doc.is_return == 0) %}\\n \\n {% else %}\\n \\n {% endif %}\\n
\\n
\\n {{ doc.name}}\\n
\\n
\\n
\\n
\\n \\n
\\n
\\n {{ frappe.utils.formatdate(doc.posting_date, 'dd-MMM-YYYY') }}\\n
\\n
\\n{% if (doc.is_return == 0) %} \\n
\\n
\\n
{{ doc.po_no}}
\\n
\\n
\\n
\\n
{{ frappe.utils.formatdate(doc.po_date, 'dd-MMM-YYYY') }}
\\n
\\n
\\n
\\n
{{ frappe.utils.formatdate(doc.due_date, 'dd-MMM-YYYY') }}
\\n
\\n{% else %}\\n
\\n
\\n
{{ doc.return_against}}
\\n
\\n{% endif %}\"}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"_custom_html\", \"print_hide\": 0, \"label\": \"Custom HTML\", \"fieldtype\": \"HTML\", \"options\": \"\\r\\n\\t\\r\\n\\t\\t\\r\\n\\t\\t\\r\\n\\t\\t\\r\\n\\t\\t\\r\\n\\t\\t\\r\\n\\t\\t\\r\\n\\t\\r\\n\\t\\r\\n\\t\\r\\n\\t\\t\\r\\n\\t\\r\\n\\t{% for item in doc.items %}\\r\\n\\t\\r\\n\\t\\r\\n\\t\\t\\r\\n\\t\\t\\r\\n\\t\\t\\r\\n\\t\\t\\r\\n\\t\\t\\r\\n\\t\\t\\r\\n\\t\\r\\n\\t{% endfor %}\\r\\n\\t\\r\\n \\r\\n \\r\\n\\t\\t\\r\\n\\t\\r\\n\\t\\r\\n\\t\\t\\r\\n\\t\\t\\r\\n\\t\\r\\n\\t\\r\\n\\t\\r\\n\\t\\t\\r\\n\\t\\t\\r\\n\\t\\r\\n\\t\\r\\n\\t\\t\\r\\n\\t\\r\\n\\t\\r\\n\\t\\t{% if (doc.is_return == 0) %}\\r\\n\\t\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t{% else %}\\r\\n\\t\\t\\t\\r\\n\\t\\t{% endif %}\\r\\n\\t\\r\\n\\t\\r\\n\\t\\t{% if (doc.is_return == 0) %}\\r\\n\\t\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t{% endif %}\\r\\n\\t\\r\\n\\t\\r\\n\\t\\t{% if (doc.is_return == 0) %}\\r\\n\\t\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t{% endif %}\\r\\n\\t\\r\\n\\t\\r\\n\\t\\t{% if (doc.is_return == 0) %}\\r\\n\\t\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t{% endif %}\\r\\n\\t\\r\\n\\t\\r\\n\\t\\t{% if (doc.is_return == 0) %}\\r\\n\\t\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t{% endif %}\\r\\n\\t\\r\\n\\t\\r\\n\\t\\t{% if (doc.is_return == 0) %}\\r\\n\\t\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t{% endif %}\\r\\n\\t\\r\\n
SI\\r\\n\\t\\tParticulars\\r\\n\\t\\tQTY\\r\\n\\t\\tVAT\\r\\n\\t\\tRate\\r\\n\\t\\tAmount\\r\\n\\t
{{ loop.index }}\\r\\n\\t\\t\\t{{ item.item_name }}\\r\\n\\t\\t\\t{% if (item.description != item.item_name) %}\\r\\n\\t\\t\\t\\t
{{ item.description }}\\r\\n\\t\\t\\t{% endif %}\\r\\n\\t\\t
\\r\\n\\t\\t {% if item.qty|int != 0 %} \\r\\n\\t\\t {{ item.get_formatted(\\\"qty\\\", 0).replace(\\\"-\\\",\\\"\\\") }}\\r\\n {% else %}\\t\\t \\r\\n\\t\\t {{ item.get_formatted(\\\"qty\\\", 2).replace(\\\"-\\\",\\\"\\\") }}\\r\\n\\t\\t {% endif %}\\r\\n\\t\\t\\t{{ item.get_formatted(\\\"uom\\\", 0) }}\\r\\n\\t\\t\\r\\n\\t\\t\\t{% set mydict = json.loads(item.item_tax_rate) %}\\r\\n\\t\\t\\t{% if item.item_tax_rate == \\\"{}\\\" %}\\r\\n\\t\\t\\t\\t{% for row in doc.taxes %}\\r\\n\\t\\t\\t\\t\\t{{ row.get_formatted(\\\"rate\\\",0) }}%\\r\\n\\t\\t\\t\\t{% endfor %}\\r\\n\\t\\t\\t{% else %}\\r\\n\\t\\t\\t\\t{% set ns = namespace(vat=none) %}\\r\\n\\t\\t\\t\\t{% for key, value in mydict.items() %}\\t\\r\\n\\t\\t\\t\\t\\t{% set ns.vat = value %}\\r\\n\\t\\t\\t\\t\\t{% endfor %}\\r\\n\\t\\t\\t\\t{{ ns.vat }}%\\r\\n\\t\\t\\t{% endif %}\\t\\t\\t\\t\\t\\t\\t\\t\\r\\n\\t\\t{{ item.get_formatted(\\\"net_rate\\\", doc) }}{{ frappe.utils.fmt_money('%0.2f'|format(item.net_amount|float|abs), currency=doc.currency) }}
\\r\\n Amount in Words
\\r\\n {{ doc.in_words }}

\\r\\n \\r\\n {% if doc.currency != \\\"TZS\\\" %}\\r\\n {{ doc.base_in_words }}\\r\\n {% endif %} \\r\\n \\r\\n
SUB. TOTAL{{ frappe.utils.fmt_money('%0.2f'|format(doc.net_total|float|abs), currency=doc.currency) }}
V.A.T.{{ frappe.utils.fmt_money('%0.2f'|format(doc.total_taxes_and_charges|float|abs), currency=doc.currency) }}
TOTAL{{ frappe.utils.fmt_money('%0.2f'|format(doc.grand_total|float|abs), currency=doc.currency) }}
E&OE
Assessable Value:\\r\\n\\t\\t\\t\\t{% if (doc.base_total_taxes_and_charges == 0) %}\\r\\n\\t\\t\\t\\t\\t{{ frappe.utils.fmt_money(0, currency=\\\"\\\") }}\\r\\n\\t\\t\\t\\t{% else %}\\r\\n\\t\\t\\t\\t\\t{% if (doc.base_net_total != doc.base_total) %}\\r\\n\\t\\t\\t\\t\\t\\t{{ frappe.utils.fmt_money(doc.base_net_total, currency=\\\"\\\") }}\\r\\n\\t\\t\\t\\t\\t{% else %}\\r\\n\\t\\t\\t\\t\\t\\t{{ frappe.utils.fmt_money(doc.base_total_taxes_and_charges / 0.18, currency=\\\"\\\") }}\\r\\n\\t\\t\\t\\t\\t{% endif %}\\r\\n\\t\\t\\t\\t{% endif %}\\r\\n\\t\\t\\t 
\\r\\n\\t\\t\\t\\t{% if (doc.from_date != None) %}\\r\\n\\t\\t\\t\\t\\tPERIOD: FROM {{ frappe.utils.formatdate(doc.from_date, 'dd-MMM-YYYY') }} TO {{ frappe.utils.formatdate(doc.to_date, 'dd-MMM-YYYY') }}
\\r\\n\\t\\t\\t\\t{% endif %}\\t\\r\\n\\t\\t\\t\\t{% if (doc.remarks != \\\"No Remarks\\\") %}{{ doc.remarks }}{% endif %}\\r\\n\\t\\t\\t
VAT Amount:{{ frappe.utils.fmt_money(doc.base_total_taxes_and_charges, currency=\\\"\\\") }}
Exempt:\\r\\n\\t\\t\\t\\t{% if (doc.base_total_taxes_and_charges == 0) %}\\r\\n\\t\\t\\t\\t\\t{{ frappe.utils.fmt_money(doc.base_total, currency=\\\"\\\") }}\\r\\n\\t\\t\\t\\t{% else %}\\r\\n\\t\\t\\t\\t\\t{% if (doc.base_net_total != doc.base_total) %}\\r\\n\\t\\t\\t\\t\\t\\t{{ frappe.utils.fmt_money(doc.base_grand_total - (doc.base_net_total + doc.base_total_taxes_and_charges), currency=\\\"\\\") }}\\r\\n\\t\\t\\t\\t\\t{% else %}\\r\\n\\t\\t\\t\\t\\t\\t{{ frappe.utils.fmt_money(doc.base_grand_total - ((doc.base_total_taxes_and_charges / 0.18) + doc.base_total_taxes_and_charges), currency=\\\"\\\") }}\\r\\n\\t\\t\\t\\t\\t{% endif %}\\r\\n\\t\\t\\t\\t{% endif %}\\r\\n\\t\\t\\t
Special Relief: 
Zero Rated: 
Total:\\r\\n\\t\\t\\t\\t{{ frappe.utils.fmt_money(doc.base_grand_total, currency=\\\"\\\") }}\\r\\n\\t\\t\\t
\\r\\n
\\r\\n
\\r\\n 1mm\\r\\n 1mm\\r\\n 1mm\\r\\n 0mm\\r\\n
\\r\\n
\\r\\n\"}, {\"fieldname\": \"_custom_html\", \"print_hide\": 0, \"label\": \"Custom HTML\", \"fieldtype\": \"HTML\", \"options\": \"\\n\\t\\n\\t\\t\\n\\t\\t\\n\\t\\n\\t\\n\\t\\t\\n\\t\\t\\t{% if (doc.is_return == 0) %}\\n\\t\\t\\t\\t\\n\\t\\t\\t{% else %}\\n\\t\\t\\t\\t\\n\\t\\t\\t{% endif %}\\n\\t\\t\\t\\n\\t\\t\\n\\t\\n
\\n\\t\\t\\t\\t\\t{{ frappe.db.get_value(\\\"Company\\\", doc.company, \\\"company_bank_details\\\") }}\\n\\t\\t\\t\\t\\n\\t\\t\\t\\t\\t{{ doc.remarks }}\\n\\t\\t\\t\\t\\n\\t\\t\\t\\t
\\n\\t\\t\\t\\t\\t
for {{ doc.company }}
\\n\\t\\t\\t\\t\\t
Authorised Signatory
\\n\\t\\t\\t\\t
\\n\\t\\t\\t
\"}]", - "html": "", - "idx": 0, - "line_breaks": 1, - "modified": "2021-02-15 09:07:02.443364", - "modified_by": "info@aakvatech.com", - "module": "CSF TZ", - "name": "AV Tax Invoice", - "owner": "Administrator", - "parent": "Sales Invoice", - "print_format_builder": 1, - "print_format_type": "Jinja", - "raw_printing": 0, - "show_section_headings": 1, - "standard": "Yes" -} \ No newline at end of file diff --git a/csf_tz/csf_tz/print_format/payware_loan_agreement/__init__.py b/csf_tz/csf_tz/print_format/payware_loan_agreement/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/csf_tz/print_format/payware_loan_agreement/payware_loan_agreement.json b/csf_tz/csf_tz/print_format/payware_loan_agreement/payware_loan_agreement.json deleted file mode 100644 index 575c578d..00000000 --- a/csf_tz/csf_tz/print_format/payware_loan_agreement/payware_loan_agreement.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "absolute_value": 0, - "align_labels_right": 0, - "creation": "2020-04-03 10:19:26.959893", - "css": ".print-format {\r\n margin-left: -0mm !important;\r\n margin-right: -0mm !important;\r\n margin-top: 0mm !important;\r\n margin-bottom: 0mm !important;\r\n padding-top: 5mm !important;\r\n}\r\n\r\nbody {\r\n margin: 0 !important;\r\n border: 0 !important;\r\n padding: 0mm 0mm 0mm !important;\r\n }\r\n\r\n.print-format td, .print-format th {\r\n vertical-align: top !important;\r\n padding: 1px !important;\r\n}\r\n\r\nh1, .h1, h2, .h2, h3, .h3 {\r\n margin-top: 0px;\r\n margin-bottom: 0px;\r\n}\r\n\r\nhr {\r\n margin-top: 3px;\r\n margin-bottom: 3px;\r\n border: 0;\r\n border-top: 2px solid #d1d8dd;\r\n}", - "custom_format": 0, - "disabled": 0, - "doc_type": "Loan", - "docstatus": 0, - "doctype": "Print Format", - "font": "Default", - "font_size": 0, - "format_data": "[{\"fieldname\": \"print_heading_template\", \"fieldtype\": \"Custom HTML\", \"options\": \"
\\r\\n\\r\\n\\r\\n\\r\\n\\r\\n\\r\\n\\r\\n\\r\\n
\\r\\n

LOAN AGREEMENT

\\r\\n
\\r\\n {{ doc.name }}\\r\\n
\\r\\n
\"}, {\"label\": \"\", \"fieldtype\": \"Section Break\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"applicant_name\", \"label\": \"Applicant Name\", \"print_hide\": 0}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"posting_date\", \"label\": \"Posting Date\", \"print_hide\": 0}, {\"label\": \"Loan Details\", \"fieldtype\": \"Section Break\"}, {\"fieldtype\": \"Column Break\"}, {\"align\": \"left\", \"fieldname\": \"loan_amount\", \"label\": \"Loan Amount\", \"print_hide\": 0}, {\"fieldname\": \"disbursement_date\", \"label\": \"Disbursement Date\", \"print_hide\": 0}, {\"align\": \"left\", \"fieldname\": \"repayment_start_date\", \"label\": \"Repayment Date\", \"print_hide\": 0}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"repayment_method\", \"label\": \"Repayment Method\", \"print_hide\": 0}, {\"align\": \"left\", \"fieldname\": \"repayment_periods\", \"label\": \"Repayment Months\", \"print_hide\": 0}, {\"align\": \"left\", \"fieldname\": \"monthly_repayment_amount\", \"label\": \"Monthly Amount\", \"print_hide\": 0}, {\"label\": \"Account Info\", \"fieldtype\": \"Section Break\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"mode_of_payment\", \"label\": \"Mode of Payment\", \"print_hide\": 0}, {\"fieldtype\": \"Column Break\"}, {\"label\": \"Repayment Schedule\", \"fieldtype\": \"Section Break\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"repayment_schedule\", \"label\": \"Repayment Schedule\", \"visible_columns\": [{\"print_width\": \"\", \"fieldname\": \"payment_date\", \"print_hide\": 0}, {\"print_width\": \"\", \"fieldname\": \"total_payment\", \"print_hide\": 0}, {\"print_width\": \"\", \"fieldname\": \"balance_loan_amount\", \"print_hide\": 0}], \"print_hide\": 0}, {\"label\": \"\", \"fieldtype\": \"Section Break\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldtype\": \"HTML\", \"fieldname\": \"_custom_html\", \"label\": \"Custom HTML\", \"options\": \"\\r\\n\\r\\n\\r\\n\\r\\n\\r\\n\\r\\n\\r\\n\\r\\n\\r\\n\\r\\n\\r\\n\\r\\n\\r\\n\\r\\n\\r\\n\\r\\n\\r\\n\\r\\n\\r\\n\\r\\n\\r\\n\\r\\n\\r\\n\\r\\n
\\r\\n

I _________________________________________________ verify that the above loan and deduction details are correct. I authorise my Employer to deduct the loan amount in installments as mentioned above from my monthly pay. In the event I resign or my contract is terminated I authorise my Employer to deduct the full amount due from my termination pay or salary

\\r\\n
\\r\\n

 

\\r\\n

_____________________________

\\r\\n
\\r\\n

 

\\r\\n

_____________________________

\\r\\n
SignatureDate
\\r\\n
\\r\\n We, the undersigned Gurantors agree to pay the balance loan as per the above schedule from our salaries should the employee fail to pay his loan
\\r\\n

 

\\r\\n

_____________________________

\\r\\n
\\r\\n

 

\\r\\n

_____________________________

\\r\\n
First Gurantrotor Namesm, Signature and DateSecond Gurantrotor Namesm, Signature and Date
\", \"print_hide\": 0}]", - "idx": 0, - "line_breaks": 0, - "margin_bottom": 0.0, - "margin_left": 0.0, - "margin_right": 0.0, - "margin_top": 0.0, - "modified": "2023-12-20 17:47:17.512540", - "modified_by": "Administrator", - "module": "CSF TZ", - "name": "Payware Loan Agreement", - "owner": "Administrator", - "print_format_builder": 1, - "print_format_builder_beta": 0, - "print_format_type": "Jinja", - "raw_printing": 0, - "show_section_headings": 0, - "standard": "Yes" -} \ No newline at end of file diff --git a/csf_tz/csf_tz/print_format/payware_payslip/__init__.py b/csf_tz/csf_tz/print_format/payware_payslip/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/csf_tz/print_format/payware_payslip/payware_payslip.json b/csf_tz/csf_tz/print_format/payware_payslip/payware_payslip.json deleted file mode 100644 index 02129bc0..00000000 --- a/csf_tz/csf_tz/print_format/payware_payslip/payware_payslip.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "absolute_value": 0, - "align_labels_right": 0, - "creation": "2020-03-04 10:07:03.411539", - "css": ".print-format {\n margin-left: -0mm !important;\n margin-right: -0mm !important;\n margin-top: 0mm !important;\n margin-bottom: 0mm !important;\n padding-top: 5mm !important;\n}\n\nbody {\n margin: 0 !important;\n border: 0 !important;\n padding: 0mm 0mm 0mm !important;\n }\n \n.data-field {\n margin-top: 0px !important;\n margin-bottom: 0px !important;\n}\n.print-format th {\n vertical-align: top !important;\n padding: 2px !important;\n}\n\n.print-format td {\n vertical-align: top !important;\n padding: 2px !important;\n}\n\n.print-heading {\n display: none;\n}\n\n", - "custom_format": 0, - "disabled": 0, - "doc_type": "Salary Slip", - "docstatus": 0, - "doctype": "Print Format", - "font": "Arial", - "font_size": 0, - "format_data": "[{\"options\": \"
\\n

Salary Slip
{{ doc.name }}

\\n
\", \"fieldname\": \"print_heading_template\", \"fieldtype\": \"Custom HTML\"}, {\"label\": \"\", \"fieldtype\": \"Section Break\"}, {\"fieldtype\": \"Column Break\"}, {\"options\": \"

{{ doc.company }}

\\n

Payslip

\", \"fieldname\": \"_custom_html\", \"print_hide\": 0, \"fieldtype\": \"HTML\", \"label\": \"Custom HTML\"}, {\"fieldtype\": \"Column Break\"}, {\"options\": \"

{{ doc.company }}

\\n

Payslip

\", \"fieldname\": \"_custom_html\", \"print_hide\": 0, \"fieldtype\": \"HTML\", \"label\": \"Custom HTML\"}, {\"label\": \"\", \"fieldtype\": \"Section Break\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"employee\", \"print_hide\": 0, \"align\": \"left\", \"label\": \"Employee ID\"}, {\"fieldname\": \"employee_name\", \"print_hide\": 0, \"label\": \"Employee Name\"}, {\"fieldname\": \"department\", \"print_hide\": 0, \"label\": \"Department\"}, {\"fieldname\": \"designation\", \"print_hide\": 0, \"label\": \"Designation\"}, {\"fieldname\": \"total_working_days\", \"print_hide\": 0, \"label\": \"Working Days\"}, {\"fieldname\": \"leave_without_pay\", \"print_hide\": 0, \"label\": \"Leave Without Pay\"}, {\"fieldname\": \"payment_days\", \"print_hide\": 0, \"label\": \"Payment Days\"}, {\"fieldname\": \"start_date\", \"print_hide\": 0, \"label\": \"Start Date\"}, {\"fieldname\": \"end_date\", \"print_hide\": 0, \"label\": \"End Date\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"employee\", \"print_hide\": 0, \"align\": \"left\", \"label\": \"Employee ID\"}, {\"fieldname\": \"employee_name\", \"print_hide\": 0, \"label\": \"Employee Name\"}, {\"fieldname\": \"department\", \"print_hide\": 0, \"label\": \"Department\"}, {\"fieldname\": \"designation\", \"print_hide\": 0, \"label\": \"Designation\"}, {\"fieldname\": \"total_working_days\", \"print_hide\": 0, \"label\": \"Working Days\"}, {\"fieldname\": \"leave_without_pay\", \"print_hide\": 0, \"label\": \"Leave Without Pay\"}, {\"fieldname\": \"payment_days\", \"print_hide\": 0, \"label\": \"Payment Days\"}, {\"fieldname\": \"start_date\", \"print_hide\": 0, \"label\": \"Start Date\"}, {\"fieldname\": \"end_date\", \"print_hide\": 0, \"label\": \"End Date\"}, {\"label\": \"Earnings\", \"fieldtype\": \"Section Break\"}, {\"fieldtype\": \"Column Break\"}, {\"options\": \"Earnings\\n\\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n {% for item in doc.earnings %}\\n {% if item.do_not_include_in_total == 0 %}\\n \\n \\n \\n \\n \\n {% endif %}\\n {% endfor %}\\n \\n \\n \\n \\n \\n \\n \\n \\n
SrComponentAmount
{{ loop.index }}{{ item.salary_component }}{{ item.get_formatted(\\\"amount\\\", doc) }}\\n
Total Earnings{{ doc.get_formatted(\\\"gross_pay\\\", doc) }}
\\n\\nDeductions\\n\\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n {% for item in doc.deductions %}\\n {% if item.do_not_include_in_total == 0 %}\\n \\n \\n \\n \\n \\n {% endif %}\\n {% endfor %}\\n \\n \\n \\n \\n \\n \\n \\n \\n
SrComponentAmount
{{ loop.index }}{{ item.salary_component }}{{ item.get_formatted(\\\"amount\\\", doc) }}\\n
Total Deductions{{ doc.get_formatted(\\\"total_deduction\\\", doc) }}
\", \"fieldname\": \"_custom_html\", \"print_hide\": 0, \"fieldtype\": \"HTML\", \"label\": \"Custom HTML\"}, {\"fieldname\": \"total_loan_repayment\", \"print_hide\": 0, \"label\": \"Total Loan Repayment\"}, {\"fieldname\": \"net_pay\", \"print_hide\": 0, \"label\": \"Net Pay\"}, {\"fieldname\": \"total_in_words\", \"print_hide\": 0, \"label\": \"Total in words\"}, {\"fieldtype\": \"Column Break\"}, {\"options\": \"Earnings\\n\\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n {% for item in doc.earnings %}\\n {% if item.do_not_include_in_total == 0 %}\\n \\n \\n \\n \\n \\n {% endif %}\\n {% endfor %}\\n \\n \\n \\n \\n \\n \\n \\n \\n
SrComponentAmount
{{ loop.index }}{{ item.salary_component }}{{ item.get_formatted(\\\"amount\\\", doc) }}\\n
Total Earnings{{ doc.get_formatted(\\\"gross_pay\\\", doc) }}
\\n\\nDeductions\\n\\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n {% for item in doc.deductions %}\\n {% if item.do_not_include_in_total == 0 %}\\n \\n \\n \\n \\n \\n {% endif %}\\n {% endfor %}\\n \\n \\n \\n \\n \\n \\n \\n \\n
SrComponentAmount
{{ loop.index }}{{ item.salary_component }}{{ item.get_formatted(\\\"amount\\\", doc) }}\\n
Total Deductions{{ doc.get_formatted(\\\"total_deduction\\\", doc) }}
\", \"fieldname\": \"_custom_html\", \"print_hide\": 0, \"fieldtype\": \"HTML\", \"label\": \"Custom HTML\"}, {\"fieldname\": \"total_loan_repayment\", \"print_hide\": 0, \"label\": \"Total Loan Repayment\"}, {\"fieldname\": \"net_pay\", \"print_hide\": 0, \"label\": \"Net Pay\"}, {\"fieldname\": \"total_in_words\", \"print_hide\": 0, \"label\": \"Total in words\"}, {\"label\": \"\", \"fieldtype\": \"Section Break\"}, {\"fieldtype\": \"Column Break\"}, {\"options\": \"
\\n
\\n


\\n
\\n
\\n


_______________________\\n
\\n
\", \"fieldname\": \"_custom_html\", \"print_hide\": 0, \"fieldtype\": \"HTML\", \"label\": \"Custom HTML\"}, {\"fieldtype\": \"Column Break\"}]", - "idx": 0, - "line_breaks": 0, - "margin_bottom": 0.0, - "margin_left": 0.0, - "margin_right": 0.0, - "margin_top": 0.0, - "modified": "2023-12-20 17:47:28.014951", - "modified_by": "Administrator", - "module": "CSF TZ", - "name": "Payware Payslip", - "owner": "Administrator", - "print_format_builder": 1, - "print_format_builder_beta": 0, - "print_format_type": "Jinja", - "raw_printing": 0, - "show_section_headings": 0, - "standard": "Yes" -} \ No newline at end of file diff --git a/csf_tz/csf_tz/print_format/tally_format/__init__.py b/csf_tz/csf_tz/print_format/tally_format/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/csf_tz/print_format/tally_format/tally_format.json b/csf_tz/csf_tz/print_format/tally_format/tally_format.json deleted file mode 100644 index 19e3100a..00000000 --- a/csf_tz/csf_tz/print_format/tally_format/tally_format.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "align_labels_right": 0, - "creation": "2020-03-04 10:07:22.936567", - "css": ".print-format {\npadding-left: 5mm;\npadding-right: 5mm;\npadding-top: 10mm;\npadding-bottom: 5mm;\n}\n", - "custom_format": 1, - "disabled": 1, - "doc_type": "Sales Invoice", - "docstatus": 0, - "doctype": "Print Format", - "font": "Default", - "format_data": "[{\"fieldtype\": \"Custom HTML\", \"fieldname\": \"print_heading_template\", \"options\": \"
\\t\\t\\t\\t\\n
Tax Invoice
\\n
\"}, {\"fieldtype\": \"Section Break\", \"label\": \"Address\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"address_display\", \"label\": \"Address\", \"print_hide\": 0}, {\"fieldname\": \"contact_display\", \"label\": \"Contact\", \"print_hide\": 0}, {\"fieldname\": \"contact_mobile\", \"label\": \"Mobile No\", \"print_hide\": 0}, {\"fieldtype\": \"Column Break\"}, {\"fieldtype\": \"Section Break\", \"label\": \"Currency\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"conversion_rate\", \"label\": \"Exchange Rate\", \"print_hide\": 0}, {\"fieldtype\": \"Column Break\"}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"scan_barcode\", \"label\": \"Scan Barcode\", \"print_hide\": 0}, {\"visible_columns\": [{\"print_width\": \"\", \"fieldname\": \"item_code\", \"print_hide\": 0}, {\"print_width\": \"200px\", \"fieldname\": \"description\", \"print_hide\": 0}, {\"print_width\": \"\", \"fieldname\": \"image\", \"print_hide\": 0}, {\"print_width\": \"\", \"fieldname\": \"qty\", \"print_hide\": 0}, {\"print_width\": \"\", \"fieldname\": \"stock_uom\", \"print_hide\": 0}, {\"print_width\": \"\", \"fieldname\": \"uom\", \"print_hide\": 0}, {\"print_width\": \"\", \"fieldname\": \"discount_amount\", \"print_hide\": 0}, {\"print_width\": \"\", \"fieldname\": \"rate\", \"print_hide\": 0}, {\"print_width\": \"\", \"fieldname\": \"amount\", \"print_hide\": 0}, {\"print_width\": \"\", \"fieldname\": \"pricing_rule\", \"print_hide\": 0}, {\"print_width\": \"\", \"fieldname\": \"deferred_revenue_account\", \"print_hide\": 0}, {\"print_width\": \"\", \"fieldname\": \"service_stop_date\", \"print_hide\": 0}, {\"print_width\": \"\", \"fieldname\": \"enable_deferred_revenue\", \"print_hide\": 0}, {\"print_width\": \"\", \"fieldname\": \"service_start_date\", \"print_hide\": 0}, {\"print_width\": \"\", \"fieldname\": \"service_end_date\", \"print_hide\": 0}, {\"print_width\": \"\", \"fieldname\": \"quality_inspection\", \"print_hide\": 0}, {\"print_width\": \"\", \"fieldname\": \"serial_no\", \"print_hide\": 0}, {\"print_width\": \"\", \"fieldname\": \"asset\", \"print_hide\": 0}], \"fieldname\": \"items\", \"label\": \"Items\", \"print_hide\": 0}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"total_qty\", \"label\": \"Total Quantity\", \"print_hide\": 0}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"total\", \"label\": \"Total\", \"print_hide\": 0}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"visible_columns\": [{\"print_width\": \"\", \"fieldname\": \"charge_type\", \"print_hide\": 0}, {\"print_width\": \"\", \"fieldname\": \"row_id\", \"print_hide\": 0}, {\"print_width\": \"\", \"fieldname\": \"account_head\", \"print_hide\": 0}, {\"print_width\": \"\", \"fieldname\": \"cost_center\", \"print_hide\": 0}, {\"print_width\": \"300px\", \"fieldname\": \"description\", \"print_hide\": 0}, {\"print_width\": \"\", \"fieldname\": \"rate\", \"print_hide\": 0}, {\"print_width\": \"\", \"fieldname\": \"tax_amount\", \"print_hide\": 0}, {\"print_width\": \"\", \"fieldname\": \"total\", \"print_hide\": 0}, {\"print_width\": \"\", \"fieldname\": \"tax_amount_after_discount_amount\", \"print_hide\": 0}, {\"print_width\": \"\", \"fieldname\": \"base_tax_amount\", \"print_hide\": 0}, {\"print_width\": \"\", \"fieldname\": \"base_total\", \"print_hide\": 0}, {\"print_width\": \"\", \"fieldname\": \"base_tax_amount_after_discount_amount\", \"print_hide\": 0}, {\"print_width\": \"\", \"fieldname\": \"item_wise_tax_detail\", \"print_hide\": 0}], \"fieldname\": \"taxes\", \"label\": \"Sales Taxes and Charges\", \"print_hide\": 0}, {\"fieldtype\": \"Section Break\", \"label\": \"Loyalty\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"loyalty_redemption_account\", \"label\": \"Redemption Account\", \"print_hide\": 0}, {\"fieldname\": \"loyalty_redemption_cost_center\", \"label\": \"Redemption Cost Center\", \"print_hide\": 0}, {\"fieldtype\": \"Section Break\", \"label\": \"\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"base_grand_total\", \"align\": \"left\", \"print_hide\": 0, \"label\": \"Grand Total (TZS)\"}, {\"fieldname\": \"base_rounded_total\", \"align\": \"left\", \"print_hide\": 0, \"label\": \"Rounded Total (TZS)\"}, {\"fieldname\": \"base_in_words\", \"align\": \"left\", \"print_hide\": 0, \"label\": \"In Words (TZS)\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"grand_total\", \"label\": \"Grand Total\", \"print_hide\": 0}, {\"fieldname\": \"rounded_total\", \"label\": \"Rounded Total\", \"print_hide\": 0}, {\"fieldname\": \"in_words\", \"label\": \"In Words\", \"print_hide\": 0}, {\"fieldtype\": \"Section Break\", \"label\": \"Advance\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"allocate_advances_automatically\", \"label\": \"Allocate Advances Automatically (FIFO)\", \"print_hide\": 0}, {\"fieldname\": \"get_advances\", \"label\": \"Get Advances Received\", \"print_hide\": 0}, {\"fieldtype\": \"Section Break\", \"label\": \"Terms\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"terms\", \"label\": \"Terms and Conditions Details\", \"print_hide\": 0}, {\"fieldtype\": \"Section Break\", \"label\": \"More\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"inter_company_invoice_reference\", \"label\": \"Inter Company Invoice Reference\", \"print_hide\": 0}, {\"fieldtype\": \"Column Break\"}, {\"fieldtype\": \"Section Break\", \"label\": \"Subscription\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldtype\": \"Column Break\"}, {\"fieldname\": \"update_auto_repeat_reference\", \"label\": \"Update Auto Repeat Reference\", \"print_hide\": 0}]", - "html": "

Tax Invoice

\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n {{ doc.company or \"\" }}
\n {{ frappe.db.get_value(\"Company\", doc.company, \"registration_details\") or \"\" }}\n
\n Invoice No.
\n {{ doc.name }}\n
\n Dated
\n\t {{ frappe.utils.formatdate(doc.posting_date) }}\n
\n Delivery Note
\n\t  \n
\n Mode/Terms of Payment
\n\t  \n
\n Supplier's Ref.
\n\t  \n
\n Other Reference(s)
\n\t  \n
\n Customer
\n {{ doc.customer_name or \"\" }}
\n\t {{ doc.address_display or \"\" }}\n
\n Buyer's Order No.
\n\t  \n
\n Dated
\n\t  \n
\n Despatch Document No.
\n\t  \n
\n Dated
\n\t  \n
\n Despatched through
\n\t  \n
\n Destination
\n\t  \n
\n Terms of Delivery
\n\t  \n
\n\n\n\t\n\n{% for item in doc.items %}\n{% set remrows = 10 - loop.revindex %}\n\n\t\n\t\n\t\n\t\n\t\n\t\n\n{% set trate = \"\" %}\n{% endfor %}\n\n\n
Sl\n\tParticulars\n\tQTY\n\tRate\n\tVAT\n\tAmount\n
{{ loop.index }}{{ item.item_name }}{{ item.get_formatted(\"qty\", 0) }}{{ item.get_formatted(\"rate\", doc) }}\n\t\t{% set mydict = json.loads(item.item_tax_rate) %}\n\t\t{% if item.item_tax_rate == \"{}\" %}\n\t\t\t{% for row in doc.taxes %}\n\t\t\t\t{{ row.rate }}.0%\n\t\t\t{% endfor %}\n\t\t{% else %}\n\t\t\t{% for key, value in mydict.items() %}\n\t\t\t\t{{ value }}%\n\t\t\t{% endfor %}\n\t\t{% endif %}\n\n\n {{ item.get_formatted(\"amount\", doc) }}
\n\n\n\n \n\t\n \n\t\n\n\n\t\n \n\t\n\t\n\n\n\t\n\t\n\t\n\n\n\t\n\t\n\n
\n Amount in Words
\n {{ doc.in_words }}

\n {{ doc.base_in_words }}\n
SUB TOTAL{{ doc.get_formatted(\"base_total\", doc) }}{{ doc.get_formatted(\"total\", doc) }}
VAT{{ doc.get_formatted(\"base_total_taxes_and_charges\", doc) }}{{ doc.get_formatted(\"total_taxes_and_charges\", doc) }}
TOTAL{{ doc.get_formatted(\"base_grand_total\", doc) }}{{ doc.get_formatted(\"grand_total\", doc) }}
{{ doc.remarks }}\n for {{ doc.company }}\n
\n
\n Authorised Signatory\n
\n
\n
\n", - "idx": 0, - "line_breaks": 0, - "modified": "2020-03-09 17:10:05.059954", - "modified_by": "Administrator", - "module": "CSF TZ", - "name": "Tally Format", - "owner": "Administrator", - "print_format_builder": 1, - "print_format_type": "Jinja", - "raw_printing": 0, - "show_section_headings": 0, - "standard": "Yes" -} \ No newline at end of file diff --git a/csf_tz/csf_tz/print_format/withholding_certificate/__init__.py b/csf_tz/csf_tz/print_format/withholding_certificate/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/csf_tz/print_format/withholding_certificate/withholding_certificate.json b/csf_tz/csf_tz/print_format/withholding_certificate/withholding_certificate.json deleted file mode 100644 index 6037c072..00000000 --- a/csf_tz/csf_tz/print_format/withholding_certificate/withholding_certificate.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "absolute_value": 0, - "align_labels_right": 0, - "creation": "2020-03-04 10:07:23.114505", - "css": ".print-format {\npadding-left: 25mm;\npadding-right: 25mm;\npadding-top: 5mm;\npadding-bottom: 2mm;\n}\n\n.print-format td, .print-format th \n{\n vertical-align: top !important;\n padding: 3px !important;\n}\n\n[document-status] {\n display: none;\n}", - "custom_format": 0, - "disabled": 1, - "doc_type": "Sales Invoice", - "docstatus": 0, - "doctype": "Print Format", - "font": "Default", - "format_data": "[{\"options\": \"
\", \"fieldtype\": \"Custom HTML\", \"fieldname\": \"print_heading_template\"}, {\"label\": \"\", \"fieldtype\": \"Section Break\"}, {\"fieldtype\": \"Column Break\"}, {\"label\": \"Custom HTML\", \"options\": \"


\\n
\\n
\\nNo:  {{ doc.tra_control_number }}  \\n
\\n

\\n
\\n\\tCERTIFICATE/REMITTANCE SLIP IN RESPECT OF
\\n\\tWITHHOLDING TAX ON RENT FEES\\n
\\n
\\nName of TAXPAYER/WITHHOLDER:   {{doc.customer}}   

\\n\\n{% set cust_tin = frappe.db.get_value(\\\"Customer\\\", doc.customer, \\\"tax_id\\\")| replace(\\\"-\\\", \\\"\\\")|replace(\\\" \\\", \\\"\\\") %}\\n\\n\\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n
TIN:{{ cust_tin[0] }}{{ cust_tin[1] }}{{ cust_tin[2] }} {{ cust_tin[3] }}{{ cust_tin[4] }}{{ cust_tin[5] }} {{ cust_tin[6] }}{{ cust_tin[7] }}{{ cust_tin[8] }}
\\n
\\nName of WITHHOLDEE.   {{doc.company}}   

\\n{% set cmp_tin = frappe.db.get_value(\\\"Company\\\", doc.company, \\\"tin\\\")| replace(\\\"-\\\", \\\"\\\")|replace(\\\" \\\", \\\"\\\") %}\\n\\n\\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n
TIN:{{ cmp_tin[0] }}{{ cmp_tin[1] }}{{ cmp_tin[2] }} {{ cmp_tin[3] }}{{ cmp_tin[4] }}{{ cmp_tin[5] }} {{ cmp_tin[6] }}{{ cmp_tin[7] }}{{ cmp_tin[8] }}
\\n
\\nI hereby certify that, I have this date of  {{ frappe.utils.formatdate(doc.posting_date, \\\"dd\\\")}}  Month of  {{ frappe.utils.formatdate(doc.posting_date, \\\"MMMM YYYY\\\")}}  deducted prior to payment of Rent Fees in favour of the Commissioner of Domestic Revenue Department/Large Taxpayers Department withheld from the above named person as follows:
\\nGross Amount in \\n {{ doc.get_formatted(\\\"base_total\\\", doc) }}  
\\nTax withheld at  10  %\\n\\n{% set wth_amount = doc.base_total * 0.1 %}\\n\\n TZS \\n{{ frappe.format_value(wth_amount, {'fieldtype': 'Currency', 'options': 'TZS'})}}\\n  
\\n
\\nThis payment is for the period covered from  {{ frappe.utils.formatdate(doc.from_date) }} to {{ frappe.utils.formatdate(doc.to_date) }}  

\\nI further certify that the above withholding Tax has been/shall be REMITTED to the Regional Manager  ILALA/   Large Taxpayers Department in the monthly schedule of  {{ frappe.utils.formatdate(doc.posting_date, \\\"MMMM YYYY\\\")}} .

\\n\\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\nTo be completed in triplicate:
\\n(1) Original to Customer
\\n(2)\\tDuplicate to TRA Office
\\n(3)\\tTriplicate \\u2013 Retained by withholder
\\n\", \"print_hide\": 0, \"fieldtype\": \"HTML\", \"fieldname\": \"_custom_html\"}]", - "idx": 0, - "line_breaks": 0, - "modified": "2021-02-15 09:06:33.980767", - "modified_by": "info@aakvatech.com", - "module": "CSF TZ", - "name": "Withholding Certificate", - "owner": "Administrator", - "parent": "", - "parentfield": "", - "parenttype": "", - "print_format_builder": 1, - "raw_printing": 0, - "show_section_headings": 0, - "standard": "Yes" -} \ No newline at end of file diff --git a/csf_tz/csf_tz/print_format/withholding_certificate_multi_items/__init__.py b/csf_tz/csf_tz/print_format/withholding_certificate_multi_items/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/csf_tz/print_format/withholding_certificate_multi_items/withholding_certificate_multi_items.json b/csf_tz/csf_tz/print_format/withholding_certificate_multi_items/withholding_certificate_multi_items.json deleted file mode 100644 index c7d828db..00000000 --- a/csf_tz/csf_tz/print_format/withholding_certificate_multi_items/withholding_certificate_multi_items.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "absolute_value": 0, - "align_labels_right": 0, - "creation": "2020-03-04 10:07:23.165260", - "css": ".print-format {\npadding-left: 25mm;\npadding-right: 25mm;\npadding-top: 5mm;\npadding-bottom: 2mm;\n}\n\n.print-format td, .print-format th \n{\n vertical-align: top !important;\n padding: 3px !important;\n}\n\n[document-status] {\n display: none;\n}", - "custom_format": 0, - "default_print_language": "en", - "disabled": 1, - "doc_type": "Sales Invoice", - "docstatus": 0, - "doctype": "Print Format", - "font": "Default", - "format_data": "[{\"options\": \"\", \"fieldtype\": \"Custom HTML\", \"fieldname\": \"print_heading_template\"}, {\"label\": \"\", \"fieldtype\": \"Section Break\"}, {\"fieldtype\": \"Column Break\"}, {\"label\": \"Custom HTML\", \"options\": \"{% for item in doc.items %}\\r\\n\\t{% if item.item_name == \\\"Residential Rent\\\" or item.item_name == \\\"Commercial Rent\\\" %}\\r\\n\\t\\t{% set wth_rate = 10 %}\\r\\n\\t{% else %}\\r\\n\\t\\t{% set wth_rate = 5 %}\\r\\n\\t{% endif %}\\t\\r\\n\\t\\r\\n\\t{% if item.item_name == \\\"Residential Rent\\\" or item.item_name == \\\"Commercial Rent\\\" or item.item_name == \\\"Customization\\\" %}\\r\\n\\t\\t
\\r\\n\\t\\t


\\r\\n\\t\\t
\\r\\n\\t\\t
\\r\\n\\t\\t\\tNo:  {{ doc.tra_control_number | default('    ', true)}}  \\r\\n\\t\\t
\\r\\n\\t\\t

\\r\\n\\t\\t
\\r\\n\\t\\t\\tCERTIFICATE/REMITTANCE SLIP IN RESPECT OF
\\r\\n\\t\\t\\tWITHHOLDING TAX ON RENT FEES\\r\\n\\t\\t
\\r\\n\\t\\t
\\r\\n\\t\\tName of TAXPAYER/WITHHOLDER:   {{doc.customer}}   

\\r\\n\\t\\t\\r\\n\\t\\t{% set cust_tin = frappe.db.get_value(\\\"Customer\\\", doc.customer, \\\"tax_id\\\") | default('000-000-000', true) | replace(\\\"-\\\", \\\"\\\")|replace(\\\" \\\", \\\"\\\") %}\\r\\n\\t\\t\\r\\n\\t\\t

Name: ___________________

Designation: ___________________

___________________

___________________
SignatureDate

Name: ___________________

Designation: ___________________

___________________

___________________
Countersignature (withholdee)Date
Official Stamp
\\r\\n\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t\\r\\n\\t\\t
TIN:{{ cust_tin[0] }}{{ cust_tin[1] }}{{ cust_tin[2] }} {{ cust_tin[3] }}{{ cust_tin[4] }}{{ cust_tin[5] }} {{ cust_tin[6] }}{{ cust_tin[7] }}{{ cust_tin[8] }}
\\r\\n\\t\\t
\\r\\n\\t\\tName of WITHHOLDEE.   {{doc.company}}   

\\r\\n\\t\\t{% set cmp_tin = frappe.db.get_value(\\\"Company\\\", doc.company, \\\"tin\\\") | default('000-000-000', true) | replace(\\\"-\\\", \\\"\\\")|replace(\\\" \\\", \\\"\\\") %}\\r\\n\\t\\t\\r\\n\\t\\t\\r\\n\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t\\r\\n\\t\\t
TIN:{{ cmp_tin[0] }}{{ cmp_tin[1] }}{{ cmp_tin[2] }} {{ cmp_tin[3] }}{{ cmp_tin[4] }}{{ cmp_tin[5] }} {{ cmp_tin[6] }}{{ cmp_tin[7] }}{{ cmp_tin[8] }}
\\r\\n\\t\\t
\\r\\n\\t\\tI hereby certify that, I have this date of  {{ frappe.utils.formatdate(doc.posting_date, \\\"dd\\\")}}  Month of  {{ frappe.utils.formatdate(doc.posting_date, \\\"MMMM YYYY\\\")}}  deducted prior to payment of Rent Fees in favour of the Commissioner of Domestic Revenue Department/Large Taxpayers Department withheld from the above named person as follows:
\\r\\n\\t\\tGross Amount in \\r\\n\\t\\t {{ item.get_formatted(\\\"base_net_amount\\\", doc) }}  
\\r\\n\\t\\tTax withheld at  {{ wth_rate }}  %\\r\\n\\t\\t\\r\\n\\t\\t{% set wth_amount = item.base_net_amount * (wth_rate / 100) %}\\r\\n\\t\\t\\r\\n\\t\\t TZS \\r\\n\\t\\t{{ frappe.format_value(wth_amount, {'fieldtype': 'Currency', 'options': 'TZS'})}}\\r\\n\\t\\t  
\\r\\n\\t\\t
\\r\\n\\t\\tThis payment is for the period covered from  {{ frappe.utils.formatdate(doc.from_date) }} to {{ frappe.utils.formatdate(doc.to_date) }}  

\\r\\n\\t\\tI further certify that the above withholding Tax has been/shall be REMITTED to the Regional Manager  ILALA/   Large Taxpayers Department in the monthly schedule of  {{ frappe.utils.formatdate(doc.posting_date, \\\"MMMM YYYY\\\")}} .

\\r\\n\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t\\r\\n\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t\\r\\n\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t\\r\\n\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t\\r\\n\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t\\r\\n\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t\\r\\n\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t\\r\\n\\t\\t\\r\\n\\t\\t\\t\\r\\n\\t\\t\\r\\n\\t\\tTo be completed in triplicate:
\\r\\n\\t\\t(1) Original to Customer
\\r\\n\\t\\t(2)\\tDuplicate to TRA Office
\\r\\n\\t\\t(3)\\tTriplicate \\u2013 Retained by withholder
\\r\\n\\t\\t\\r\\n\\t\\t

\\t\\t\\r\\n\\t{% endif %}\\r\\n{% endfor %}\", \"print_hide\": 0, \"fieldtype\": \"HTML\", \"fieldname\": \"_custom_html\"}]", - "html": "", - "idx": 0, - "line_breaks": 0, - "modified": "2021-02-15 09:06:34.047210", - "modified_by": "info@aakvatech.com", - "module": "CSF TZ", - "name": "Withholding Certificate Multi Items", - "owner": "Administrator", - "print_format_builder": 1, - "print_format_type": "Jinja", - "raw_printing": 0, - "show_section_headings": 0, - "standard": "Yes" -} \ No newline at end of file diff --git a/csf_tz/csf_tz/purchase_order.js b/csf_tz/csf_tz/purchase_order.js index 5ac54824..38feadec 100644 --- a/csf_tz/csf_tz/purchase_order.js +++ b/csf_tz/csf_tz/purchase_order.js @@ -51,46 +51,6 @@ frappe.ui.form.on("Purchase Order", { }, }); -frappe.ui.form.on("Purchase Order Item", { - item_code: async function (frm, cdt, cdn) { - var item = locals[cdt][cdn]; - var price_list = await get_price_list(frm, item.item_code, item.warehouse); - frappe.model.set_value(cdt, cdn, "price_list_rate", price_list); - frappe.model.set_value(cdt, cdn, "rate", price_list); - frappe.model.set_value(cdt, cdn, "amount", price_list * item.qty); - }, - warehouse: async function (frm, cdt, cdn) { - var item = locals[cdt][cdn]; - var price_list = await get_price_list(frm, item.item_code, item.warehouse); - frappe.model.set_value(cdt, cdn, "price_list_rate", price_list); - frappe.model.set_value(cdt, cdn, "rate", price_list); - frappe.model.set_value(cdt, cdn, "amount", price_list * item.qty); - }, -}) - -async function get_price_list(frm, item_code, warehouse) { - var check = await frappe.db.get_single_value("CSF TZ Settings", "target_warehouse_based_price_list"); - if (check == 0) { - return null; - } - if (!item_code || !warehouse || !frm.doc.supplier) { - frappe.throw("Item Code, Warehouse and Supplier are required"); - } - - var price_list = await frappe.db.get_value("Dynamic Price List Assignment", { supplier: frm.doc.supplier, warehouse: warehouse }, "price_list"); - console.log(price_list); - if (price_list.message.price_list) { - var price_list_rate = await frappe.db.get_value("Item Price", { item_code: item_code, price_list: price_list.message.price_list }, "price_list_rate"); - if (price_list_rate.message.price_list_rate) { - return price_list_rate.message.price_list_rate; - } else { - frappe.throw("Price List not found for Item " + item.item_code + ". Please create"); - } - } else { - frappe.throw("Price List not found. Please create one in Dynamic Price List Assignment for " + frm.doc.supplier + " and " + warehouse); - } -} - frappe.ui.keys.add_shortcut({ shortcut: 'ctrl+i', action: () => { @@ -111,4 +71,3 @@ frappe.ui.keys.add_shortcut({ description: __('Select Item Price'), ignore_inputs: true, }); - diff --git a/csf_tz/csf_tz/report/customer_gl_entries_by_fiscal_year/__init__.py b/csf_tz/csf_tz/report/customer_gl_entries_by_fiscal_year/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/csf_tz/report/customer_gl_entries_by_fiscal_year/customer_gl_entries_by_fiscal_year.js b/csf_tz/csf_tz/report/customer_gl_entries_by_fiscal_year/customer_gl_entries_by_fiscal_year.js deleted file mode 100644 index 2d421391..00000000 --- a/csf_tz/csf_tz/report/customer_gl_entries_by_fiscal_year/customer_gl_entries_by_fiscal_year.js +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) 2024, Aakvatech and contributors -// For license information, please see license.txt -/* eslint-disable */ - -frappe.query_reports["Customer GL Entries by Fiscal Year"] = { - "filters": [ - { - fieldname: 'from_date', - label: __('From Date'), - fieldtype: 'Date', - mandatory: 1 - }, - { - fieldname: 'to_date', - label: __('To Date'), - fieldtype: 'Date', - mandatory: 1 - }, - { - fieldname: 'company', - label: __('Company'), - fieldtype: 'Link', - options: 'Company', - mandatory: 1 - } - - ] -}; \ No newline at end of file diff --git a/csf_tz/csf_tz/report/customer_gl_entries_by_fiscal_year/customer_gl_entries_by_fiscal_year.json b/csf_tz/csf_tz/report/customer_gl_entries_by_fiscal_year/customer_gl_entries_by_fiscal_year.json deleted file mode 100644 index a4a2d089..00000000 --- a/csf_tz/csf_tz/report/customer_gl_entries_by_fiscal_year/customer_gl_entries_by_fiscal_year.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "add_total_row": 1, - "columns": [], - "creation": "2024-06-11 18:06:42.218612", - "disable_prepared_report": 0, - "disabled": 0, - "docstatus": 0, - "doctype": "Report", - "filters": [ - { - "fieldname": "from_date", - "fieldtype": "Date", - "label": "From Date", - "mandatory": 1, - "wildcard_filter": 0 - }, - { - "fieldname": "to_date", - "fieldtype": "Date", - "label": "To Date", - "mandatory": 1, - "wildcard_filter": 0 - } - ], - "idx": 0, - "is_standard": "Yes", - "letter_head": "", - "modified": "2024-06-11 18:06:42.218612", - "modified_by": "Administrator", - "module": "CSF TZ", - "name": "Customer GL Entries by Fiscal Year", - "owner": "Administrator", - "prepared_report": 0, - "ref_doctype": "GL Entry", - "report_name": "Customer GL Entries by Fiscal Year", - "report_script": "", - "report_type": "Script Report", - "roles": [ - { - "role": "Accounts User" - }, - { - "role": "Accounts Manager" - }, - { - "role": "Auditor" - } - ] -} \ No newline at end of file diff --git a/csf_tz/csf_tz/report/customer_gl_entries_by_fiscal_year/customer_gl_entries_by_fiscal_year.py b/csf_tz/csf_tz/report/customer_gl_entries_by_fiscal_year/customer_gl_entries_by_fiscal_year.py deleted file mode 100644 index 24b56036..00000000 --- a/csf_tz/csf_tz/report/customer_gl_entries_by_fiscal_year/customer_gl_entries_by_fiscal_year.py +++ /dev/null @@ -1,66 +0,0 @@ -# Copyright (c) 2024, Aakvatech and contributors -# For license information, please see license.txt - -import frappe -from frappe import _ - -def execute(filters=None): - raw_data = get_data(filters) - fiscal_years = get_unique_fiscal_years(raw_data) - columns = get_columns(fiscal_years) - result_data = build_data(raw_data, fiscal_years) - return columns, result_data - -def get_unique_fiscal_years(raw_data): - # Extract unique fiscal years from raw data - return sorted(set(row['fiscal_year'] for row in raw_data)) - -def get_columns(fiscal_years): - # Build the columns dynamically based on unique fiscal years - columns = [_("Party") + ":Link/Customer:120", _("Account") + ":Link/Account:120"] - columns.extend(_(year) + ":Currency:100" for year in fiscal_years) - return columns - -def get_data(filters): - # Fetch data from the database - results = frappe.db.sql(""" - SELECT - party, - account, - fiscal_year, - SUM(debit - credit) as balance - FROM - `tabGL Entry` - WHERE - party_type = 'Customer' - AND is_cancelled = 0 - AND posting_date BETWEEN %(from_date)s AND %(to_date)s AND company = %(company)s - GROUP BY - party, account, fiscal_year - """, filters, as_dict=True) - return results - -def build_data(raw_data, fiscal_years): - # Initialize a dictionary to store balances by party, account, and fiscal year - data_dict = {} - - # Populate the dictionary with balances - for row in raw_data: - party = row['party'] - account = row['account'] - fiscal_year = row['fiscal_year'] - balance = row['balance'] - - if (party, account) not in data_dict: - data_dict[(party, account)] = {fy: 0 for fy in fiscal_years} - - data_dict[(party, account)][fiscal_year] = balance - - # Convert the dictionary to a list of lists for the report - data = [] - for (party, account), balances in data_dict.items(): - row = [party, account] - row.extend(balances[fiscal_year] for fiscal_year in fiscal_years) - data.append(row) - - return data diff --git a/csf_tz/csf_tz/report/customer_ledger_summary_multicurrency/__init__.py b/csf_tz/csf_tz/report/customer_ledger_summary_multicurrency/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/csf_tz/report/customer_ledger_summary_multicurrency/customer_ledger_summary_multicurrency.js b/csf_tz/csf_tz/report/customer_ledger_summary_multicurrency/customer_ledger_summary_multicurrency.js deleted file mode 100644 index 5f9de09d..00000000 --- a/csf_tz/csf_tz/report/customer_ledger_summary_multicurrency/customer_ledger_summary_multicurrency.js +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright (c) 2016, Aakvatech Limited and contributors -// For license information, please see license.txt -/* eslint-disable */ - -frappe.query_reports["Customer Ledger Summary Multicurrency"] = { - "filters": [ - { - "fieldname":"company", - "label": __("Company"), - "fieldtype": "Link", - "options": "Company", - "default": frappe.defaults.get_user_default("Company") - }, - { - "fieldname":"from_date", - "label": __("From Date"), - "fieldtype": "Date", - "default": frappe.datetime.add_months(frappe.datetime.get_today(), -1), - "reqd": 1, - "width": "60px" - }, - { - "fieldname":"to_date", - "label": __("To Date"), - "fieldtype": "Date", - "default": frappe.datetime.get_today(), - "reqd": 1, - "width": "60px" - }, - { - "fieldname":"finance_book", - "label": __("Finance Book"), - "fieldtype": "Link", - "options": "Finance Book" - }, - { - "fieldname":"party", - "label": __("Customer"), - "fieldtype": "Link", - "options": "Customer", - on_change: () => { - var party = frappe.query_report.get_filter_value('party'); - if (party) { - frappe.db.get_value('Customer', party, ["tax_id", "customer_name"], function(value) { - frappe.query_report.set_filter_value('tax_id', value["tax_id"]); - frappe.query_report.set_filter_value('customer_name', value["customer_name"]); - }); - } else { - frappe.query_report.set_filter_value('tax_id', ""); - frappe.query_report.set_filter_value('customer_name', ""); - } - } - }, - { - "fieldname":"customer_group", - "label": __("Customer Group"), - "fieldtype": "Link", - "options": "Customer Group" - }, - { - "fieldname":"payment_terms_template", - "label": __("Payment Terms Template"), - "fieldtype": "Link", - "options": "Payment Terms Template" - }, - { - "fieldname":"territory", - "label": __("Territory"), - "fieldtype": "Link", - "options": "Territory" - }, - { - "fieldname":"sales_partner", - "label": __("Sales Partner"), - "fieldtype": "Link", - "options": "Sales Partner" - }, - { - "fieldname":"sales_person", - "label": __("Sales Person"), - "fieldtype": "Link", - "options": "Sales Person" - }, - { - "fieldname":"tax_id", - "label": __("Tax Id"), - "fieldtype": "Data", - "hidden": 1 - }, - { - "fieldname":"customer_name", - "label": __("Customer Name"), - "fieldtype": "Data", - "hidden": 1 - } - ] -}; diff --git a/csf_tz/csf_tz/report/customer_ledger_summary_multicurrency/customer_ledger_summary_multicurrency.json b/csf_tz/csf_tz/report/customer_ledger_summary_multicurrency/customer_ledger_summary_multicurrency.json deleted file mode 100644 index 00998bfa..00000000 --- a/csf_tz/csf_tz/report/customer_ledger_summary_multicurrency/customer_ledger_summary_multicurrency.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "add_total_row": 1, - "columns": [], - "creation": "2022-02-09 20:42:05.628823", - "disable_prepared_report": 0, - "disabled": 0, - "docstatus": 0, - "doctype": "Report", - "filters": [], - "idx": 0, - "is_standard": "Yes", - "letter_head": "Letterhead Official", - "modified": "2022-02-09 20:42:05.628823", - "modified_by": "Administrator", - "module": "CSF TZ", - "name": "Customer Ledger Summary Multicurrency", - "owner": "Administrator", - "prepared_report": 0, - "ref_doctype": "Sales Invoice", - "report_name": "Customer Ledger Summary Multicurrency", - "report_type": "Script Report", - "roles": [ - { - "role": "Accounts Manager" - }, - { - "role": "Accounts User" - } - ] -} \ No newline at end of file diff --git a/csf_tz/csf_tz/report/customer_ledger_summary_multicurrency/customer_ledger_summary_multicurrency.py b/csf_tz/csf_tz/report/customer_ledger_summary_multicurrency/customer_ledger_summary_multicurrency.py deleted file mode 100644 index a188353d..00000000 --- a/csf_tz/csf_tz/report/customer_ledger_summary_multicurrency/customer_ledger_summary_multicurrency.py +++ /dev/null @@ -1,307 +0,0 @@ -# Copyright (c) 2013, Aakvatech Limited and contributors -# For license information, please see license.txt - - -import frappe -from frappe import _, scrub -from frappe.utils import getdate, nowdate - - -class PartyLedgerSummaryReport(object): - def __init__(self, filters=None): - self.filters = frappe._dict(filters or {}) - self.filters.from_date = getdate(self.filters.from_date or nowdate()) - self.filters.to_date = getdate(self.filters.to_date or nowdate()) - - if not self.filters.get("company"): - self.filters["company"] = frappe.db.get_single_value('Global Defaults', 'default_company') - - def run(self, args): - if self.filters.from_date > self.filters.to_date: - frappe.throw(_("From Date must be before To Date")) - - self.filters.party_type = args.get("party_type") - self.party_naming_by = frappe.db.get_value(args.get("naming_by")[0], None, args.get("naming_by")[1]) - - self.get_gl_entries() - self.get_return_invoices() - self.get_party_adjustment_amounts() - - columns = self.get_columns() - data = self.get_data() - return columns, data - - def get_columns(self): - columns = [{ - "label": _(self.filters.party_type), - "fieldtype": "Link", - "fieldname": "party", - "options": self.filters.party_type, - "width": 200 - }] - - if self.party_naming_by == "Naming Series": - columns.append({ - "label": _(self.filters.party_type + "Name"), - "fieldtype": "Data", - "fieldname": "party_name", - "width": 110 - }) - - credit_or_debit_note = "Credit Note" if self.filters.party_type == "Customer" else "Debit Note" - - columns += [ - { - "label": _("Opening Balance"), - "fieldname": "opening_balance", - "fieldtype": "Currency", - "options": "currency", - "width": 120 - }, - { - "label": _("Invoiced Amount"), - "fieldname": "invoiced_amount", - "fieldtype": "Currency", - "options": "currency", - "width": 120 - }, - { - "label": _("Paid Amount"), - "fieldname": "paid_amount", - "fieldtype": "Currency", - "options": "currency", - "width": 120 - }, - { - "label": _(credit_or_debit_note), - "fieldname": "return_amount", - "fieldtype": "Currency", - "options": "currency", - "width": 120 - }, - ] - - for account in self.party_adjustment_accounts: - columns.append({ - "label": account, - "fieldname": "adj_" + scrub(account), - "fieldtype": "Currency", - "options": "currency", - "width": 120, - "is_adjustment": 1 - }) - - columns += [ - { - "label": _("Closing Balance"), - "fieldname": "closing_balance", - "fieldtype": "Currency", - "options": "currency", - "width": 120 - }, - { - "label": _("Currency"), - "fieldname": "currency", - "fieldtype": "Link", - "options": "Currency", - "width": 50 - } - ] - - return columns - - def get_data(self): - invoice_dr_or_cr = "debit_in_account_currency" if self.filters.party_type == "Customer" else "credit_in_account_currency" - reverse_dr_or_cr = "credit_in_account_currency" if self.filters.party_type == "Customer" else "debit_in_account_currency" - - self.party_data = frappe._dict({}) - for gle in self.gl_entries: - self.party_data.setdefault(gle.party, frappe._dict({ - "party": gle.party, - "party_name": gle.party_name, - "opening_balance": 0, - "invoiced_amount": 0, - "paid_amount": 0, - "return_amount": 0, - "closing_balance": 0, - "currency": gle.account_currency - })) - - amount = gle.get(invoice_dr_or_cr) - gle.get(reverse_dr_or_cr) - self.party_data[gle.party].closing_balance += amount - - if gle.posting_date < self.filters.from_date or gle.is_opening == "Yes": - self.party_data[gle.party].opening_balance += amount - else: - if amount > 0: - self.party_data[gle.party].invoiced_amount += amount - elif gle.voucher_no in self.return_invoices: - self.party_data[gle.party].return_amount -= amount - else: - self.party_data[gle.party].paid_amount -= amount - - out = [] - for party, row in self.party_data.items(): - if row.opening_balance or row.invoiced_amount or row.paid_amount or row.return_amount or row.closing_amount: - total_party_adjustment = sum(amount for amount in self.party_adjustment_details.get(party, {}).values()) - row.paid_amount -= total_party_adjustment - - adjustments = self.party_adjustment_details.get(party, {}) - for account in self.party_adjustment_accounts: - row["adj_" + scrub(account)] = adjustments.get(account, 0) - - out.append(row) - - return out - - def get_gl_entries(self): - conditions = self.prepare_conditions() - join = join_field = "" - if self.filters.party_type == "Customer": - join_field = ", p.customer_name as party_name" - join = "left join `tabCustomer` p on gle.party = p.name" - elif self.filters.party_type == "Supplier": - join_field = ", p.supplier_name as party_name" - join = "left join `tabSupplier` p on gle.party = p.name" - - self.gl_entries = frappe.db.sql(""" - select - gle.posting_date, gle.party, gle.voucher_type, gle.voucher_no, gle.against_voucher_type, - gle.against_voucher, gle.debit, gle.credit, gle.is_opening, gle.debit_in_account_currency, - gle.credit_in_account_currency, gle.account_currency {join_field} - from `tabGL Entry` gle - {join} - where - gle.docstatus < 2 and gle.is_cancelled = 0 and gle.party_type=%(party_type)s and - ifnull(gle.party, '') != '' and gle.posting_date <= %(to_date)s {conditions} - order by gle.posting_date - """.format(join=join, join_field=join_field, conditions=conditions), self.filters, as_dict=True) - - def prepare_conditions(self): - conditions = [""] - - if self.filters.company: - conditions.append("gle.company=%(company)s") - - if self.filters.finance_book: - conditions.append("ifnull(finance_book,'') in (%(finance_book)s, '')") - - if self.filters.get("party"): - conditions.append("party=%(party)s") - - if self.filters.party_type == "Customer": - if self.filters.get("customer_group"): - lft, rgt = frappe.db.get_value("Customer Group", - self.filters.get("customer_group"), ["lft", "rgt"]) - - conditions.append("""party in (select name from tabCustomer - where exists(select name from `tabCustomer Group` where lft >= {0} and rgt <= {1} - and name=tabCustomer.customer_group))""".format(lft, rgt)) - - if self.filters.get("territory"): - lft, rgt = frappe.db.get_value("Territory", - self.filters.get("territory"), ["lft", "rgt"]) - - conditions.append("""party in (select name from tabCustomer - where exists(select name from `tabTerritory` where lft >= {0} and rgt <= {1} - and name=tabCustomer.territory))""".format(lft, rgt)) - - if self.filters.get("payment_terms_template"): - conditions.append("party in (select name from tabCustomer where payment_terms=%(payment_terms_template)s)") - - if self.filters.get("sales_partner"): - conditions.append("party in (select name from tabCustomer where default_sales_partner=%(sales_partner)s)") - - if self.filters.get("sales_person"): - lft, rgt = frappe.db.get_value("Sales Person", - self.filters.get("sales_person"), ["lft", "rgt"]) - - conditions.append("""exists(select name from `tabSales Team` steam where - steam.sales_person in (select name from `tabSales Person` where lft >= {0} and rgt <= {1}) - and ((steam.parent = voucher_no and steam.parenttype = voucher_type) - or (steam.parent = against_voucher and steam.parenttype = against_voucher_type) - or (steam.parent = party and steam.parenttype = 'Customer')))""".format(lft, rgt)) - - if self.filters.party_type == "Supplier": - if self.filters.get("supplier_group"): - conditions.append("""party in (select name from tabSupplier - where supplier_group=%(supplier_group)s)""") - - return " and ".join(conditions) - - def get_return_invoices(self): - doctype = "Sales Invoice" if self.filters.party_type == "Customer" else "Purchase Invoice" - self.return_invoices = [d.name for d in frappe.get_all(doctype, filters={"is_return": 1, "docstatus": 1, - "posting_date": ["between", [self.filters.from_date, self.filters.to_date]]})] - - def get_party_adjustment_amounts(self): - conditions = self.prepare_conditions() - income_or_expense = "Expense Account" if self.filters.party_type == "Customer" else "Income Account" - invoice_dr_or_cr = "debit_in_account_currency" if self.filters.party_type == "Customer" else "credit_in_account_currency" - reverse_dr_or_cr = "credit_in_account_currency" if self.filters.party_type == "Customer" else "debit_in_account_currency" - round_off_account = frappe.get_cached_value('Company', self.filters.company, "round_off_account") - - gl_entries = frappe.db.sql(""" - select - posting_date, account, party, voucher_type, voucher_no, debit_in_account_currency, credit_in_account_currency - from - `tabGL Entry` - where - docstatus < 2 and is_cancelled = 0 - and (voucher_type, voucher_no) in ( - select voucher_type, voucher_no from `tabGL Entry` gle, `tabAccount` acc - where acc.name = gle.account and acc.account_type = '{income_or_expense}' - and gle.posting_date between %(from_date)s and %(to_date)s and gle.docstatus < 2 - ) and (voucher_type, voucher_no) in ( - select voucher_type, voucher_no from `tabGL Entry` gle - where gle.party_type=%(party_type)s and ifnull(party, '') != '' - and gle.posting_date between %(from_date)s and %(to_date)s and gle.docstatus < 2 {conditions} - ) - """.format(conditions=conditions, income_or_expense=income_or_expense), self.filters, as_dict=True) - - self.party_adjustment_details = {} - self.party_adjustment_accounts = set() - adjustment_voucher_entries = {} - for gle in gl_entries: - adjustment_voucher_entries.setdefault((gle.voucher_type, gle.voucher_no), []) - adjustment_voucher_entries[(gle.voucher_type, gle.voucher_no)].append(gle) - - for voucher_gl_entries in adjustment_voucher_entries.values(): - parties = {} - accounts = {} - has_irrelevant_entry = False - - for gle in voucher_gl_entries: - if gle.account == round_off_account: - continue - elif gle.party: - parties.setdefault(gle.party, 0) - parties[gle.party] += gle.get(reverse_dr_or_cr) - gle.get(invoice_dr_or_cr) - elif frappe.get_cached_value("Account", gle.account, "account_type") == income_or_expense: - accounts.setdefault(gle.account, 0) - accounts[gle.account] += gle.get(invoice_dr_or_cr) - gle.get(reverse_dr_or_cr) - else: - has_irrelevant_entry = True - - if parties and accounts: - if len(parties) == 1: - party = list(parties.keys())[0] - for account, amount in accounts.items(): - self.party_adjustment_accounts.add(account) - self.party_adjustment_details.setdefault(party, {}) - self.party_adjustment_details[party].setdefault(account, 0) - self.party_adjustment_details[party][account] += amount - elif len(accounts) == 1 and not has_irrelevant_entry: - account = list(accounts.keys())[0] - self.party_adjustment_accounts.add(account) - for party, amount in parties.items(): - self.party_adjustment_details.setdefault(party, {}) - self.party_adjustment_details[party].setdefault(account, 0) - self.party_adjustment_details[party][account] += amount - -def execute(filters=None): - args = { - "party_type": "Customer", - "naming_by": ["Selling Settings", "cust_master_name"], - } - return PartyLedgerSummaryReport(filters).run(args) \ No newline at end of file diff --git a/csf_tz/csf_tz/report/depreciation_transaction_summary/depreciation_transaction_summary.js b/csf_tz/csf_tz/report/depreciation_transaction_summary/depreciation_transaction_summary.js deleted file mode 100644 index c263ec72..00000000 --- a/csf_tz/csf_tz/report/depreciation_transaction_summary/depreciation_transaction_summary.js +++ /dev/null @@ -1,123 +0,0 @@ -// Copyright (c) 2025, Aakvatech and contributors -// For license information, please see license.txt -frappe.query_reports["Depreciation Transaction Summary"] = { - filters: [ - { - fieldname: "company", - label: __("Company"), - fieldtype: "Link", - options: "Company", - default: frappe.defaults.get_user_default("Company"), - reqd: 1, - }, - { - fieldname: "periodicity", - label: __("Periodicity"), - fieldtype: "Select", - options: [ - { value: "Monthly", label: __("Monthly") }, - { value: "Quarterly", label: __("Quarterly") }, - { value: "Yearly", label: __("Yearly") } - ], - default: "Monthly", - reqd: 1, - on_change: function() { - let periodicity = frappe.query_report.get_filter_value('periodicity'); - let today = frappe.datetime.get_today(); - - if(periodicity === "Quarterly") { - // Get current quarter - let quarter = Math.floor((frappe.datetime.str_to_obj(today).getMonth() + 3) / 3); - let from_date; - - // Set date range based on current quarter - switch(quarter) { - case 1: // Jan-Mar - from_date = frappe.datetime.year_start(today); - break; - case 2: // Apr-Jun - from_date = frappe.datetime.add_months(frappe.datetime.year_start(today), 3); - break; - case 3: // Jul-Sep - from_date = frappe.datetime.add_months(frappe.datetime.year_start(today), 6); - break; - case 4: // Oct-Dec - from_date = frappe.datetime.add_months(frappe.datetime.year_start(today), 9); - break; - } - - let to_date = frappe.datetime.add_months(from_date, 3); - to_date = frappe.datetime.add_days(to_date, -1); - - frappe.query_report.set_filter_value('from_date', from_date); - frappe.query_report.set_filter_value('to_date', to_date); - } - else if (periodicity === "Yearly") { - let fiscal_year = frappe.defaults.get_user_default("fiscal_year"); - - if (!fiscal_year) { - // If no fiscal year is set, use calendar year - let from_date = frappe.datetime.year_start(today); - let to_date = frappe.datetime.year_end(today); - - frappe.query_report.set_filter_value('from_date', from_date); - frappe.query_report.set_filter_value('to_date', to_date); - } else { - frappe.db.get_value("Fiscal Year", fiscal_year, ["year_start_date", "year_end_date"], (r) => { - if (r) { - frappe.query_report.set_filter_value('from_date', r.year_start_date); - frappe.query_report.set_filter_value('to_date', r.year_end_date); - } - }); - } - } - else { - // Monthly - default to current month - let from_date = frappe.datetime.month_start(today); - let to_date = frappe.datetime.month_end(today); - - frappe.query_report.set_filter_value('from_date', from_date); - frappe.query_report.set_filter_value('to_date', to_date); - } - } - }, - { - fieldname: "from_date", - label: __("From Date"), - fieldtype: "Date", - default: frappe.datetime.month_start(frappe.datetime.get_today()), - reqd: 1, - }, - { - fieldname: "to_date", - label: __("To Date"), - fieldtype: "Date", - default: frappe.datetime.month_end(frappe.datetime.get_today()), - reqd: 1, - }, - { - fieldname: "asset", - label: __("Asset"), - fieldtype: "Link", - options: "Asset", - }, - { - fieldname: "asset_category", - label: __("Asset Category"), - fieldtype: "Link", - options: "Asset Category", - }, - { - fieldname: "finance_book", - label: __("Finance Book"), - fieldtype: "Link", - options: "Finance Book", - }, - // { - // fieldname: "include_default_book_assets", - // label: __("Include Default FB Assets"), - // fieldtype: "Check", - // default: 1, - // }, - ] - }; \ No newline at end of file diff --git a/csf_tz/csf_tz/report/depreciation_transaction_summary/depreciation_transaction_summary.json b/csf_tz/csf_tz/report/depreciation_transaction_summary/depreciation_transaction_summary.json deleted file mode 100644 index baf8fc23..00000000 --- a/csf_tz/csf_tz/report/depreciation_transaction_summary/depreciation_transaction_summary.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "add_total_row": 0, - "columns": [], - "creation": "2025-03-04 21:09:15.913785", - "disabled": 0, - "docstatus": 0, - "doctype": "Report", - "filters": [], - "idx": 0, - "is_standard": "Yes", - "letterhead": null, - "modified": "2025-03-04 21:09:15.913785", - "modified_by": "Administrator", - "module": "csf_tz", - "name": "Depreciation Transaction Summary", - "owner": "Administrator", - "prepared_report": 0, - "ref_doctype": "Asset", - "report_name": "Depreciation Transaction Summary", - "report_type": "Script Report", - "roles": [ - { - "role": "Accounts User" - }, - { - "role": "Quality Manager" - } - ], - "timeout": 0 - } \ No newline at end of file diff --git a/csf_tz/csf_tz/report/depreciation_transaction_summary/depreciation_transaction_summary.py b/csf_tz/csf_tz/report/depreciation_transaction_summary/depreciation_transaction_summary.py deleted file mode 100644 index e74c876d..00000000 --- a/csf_tz/csf_tz/report/depreciation_transaction_summary/depreciation_transaction_summary.py +++ /dev/null @@ -1,244 +0,0 @@ -# Copyright (c) 2025, Aakvatech and contributors -# For license information, please see license.txt -import frappe -from frappe import _ -from frappe.query_builder import DocType -from frappe.query_builder.functions import Sum - - -def execute(filters=None): - if not filters: - return [], [] - - columns = get_columns() - data = get_data(filters) - - return columns, data - - -def get_columns(): - return [ - { - "fieldname": "asset", - "label": _("Asset"), - "fieldtype": "Link", - "options": "Asset", - "width": 120 - }, - { - "fieldname": "asset_name", - "label": _("Asset Name"), - "fieldtype": "Data", - "width": 120 - }, - { - "fieldname": "asset_category", - "label": _("Asset Category"), - "fieldtype": "Link", - "options": "Asset Category", - "width": 120 - }, - { - "fieldname": "status", - "label": _("Status"), - "fieldtype": "Data", - "width": 100 - }, - { - "fieldname": "purchase_date", - "label": _("Purchase Date"), - "fieldtype": "Date", - "width": 100 - }, - { - "fieldname": "opening_wdv", - "label": _("Opening WDV"), - "fieldtype": "Currency", - "width": 120 - }, - { - "fieldname": "depreciation_amount", - "label": _("Depreciation Amount"), - "fieldtype": "Currency", - "width": 140 - }, - { - "fieldname": "depreciation_date", - "label": _("Depreciation Date"), - "fieldtype": "Date", - "width": 140 - }, - { - "fieldname": "depreciation_entry", - "label": _("Depreciation Entry"), - "fieldtype": "Link", - "options": "Journal Entry", - "width": 140 - }, - { - "fieldname": "total_accumulated_depreciation", - "label": _("Current Period Depreciation"), - "fieldtype": "Currency", - "width": 180 - }, - { - "fieldname": "closing_wdv", - "label": _("Closing WDV"), - "fieldtype": "Currency", - "width": 120 - }, - - { - "fieldname": "rate_of_depreciation", - "label": _("Rate of Depreciation"), - "fieldtype": "Percent", - "width": 150 - } - ] - - -def get_data(filters): - data = [] - - # Fetch depreciation accounts using QB - Account = DocType("Account") - depreciation_accounts = ( - frappe.qb.from_(Account) - .select(Account.name) - .where(Account.account_type == "Depreciation") - .run(pluck=True) - ) - - if not depreciation_accounts: - return data - - # Base filters for GL Entry - filters_data = { - "company": filters.get("company"), - "posting_date": ["between", [filters.get("from_date"), filters.get("to_date")]], - "against_voucher_type": "Asset", - "account": ["in", depreciation_accounts], - "is_cancelled": 0, - } - - # Add asset filter if provided - if filters.get("asset"): - filters_data["against_voucher"] = filters.get("asset") - - # Fetch assets based on asset category using QB - if filters.get("asset_category"): - Asset = DocType("Asset") - assets = ( - frappe.qb.from_(Asset) - .select(Asset.name) - .where( - (Asset.asset_category == filters.get("asset_category")) - & (Asset.docstatus == 1) - ) - .run(pluck=True) - ) - filters_data["against_voucher"] = ["in", assets] - - # Fetch GL Entries using QB - GLEntry = DocType("GL Entry") - gl_entries = ( - frappe.qb.from_(GLEntry) - .select( - GLEntry.against_voucher, - GLEntry.debit_in_account_currency.as_("depreciation_amount"), - GLEntry.voucher_no, - GLEntry.posting_date, - ) - .where( - (GLEntry.company == filters.get("company")) - & (GLEntry.posting_date[filters.get("from_date") : filters.get("to_date")]) - & (GLEntry.against_voucher_type == "Asset") - & (GLEntry.account.isin(depreciation_accounts)) - & (GLEntry.is_cancelled == 0) - ) - .orderby(GLEntry.against_voucher, GLEntry.posting_date) - .run(as_dict=True) - ) - - if not gl_entries: - return data - - # Get unique assets from GL Entries - assets = list(set(d["against_voucher"] for d in gl_entries)) - - # Fetch asset details using QB - assets_details = get_assets_details(assets, filters) - - # Process GL Entries - for d in gl_entries: - asset_data = assets_details.get(d["against_voucher"]) - if asset_data: - if not asset_data.get("accumulated_depreciation_amount"): - asset_data["accumulated_depreciation_amount"] = 0 - - # Calculate opening WDV - asset_data["opening_wdv"] = ( - asset_data["gross_purchase_amount"] - - asset_data["accumulated_depreciation_amount"] - ) - - # Increment accumulated depreciation - asset_data["accumulated_depreciation_amount"] += d["depreciation_amount"] - - # Rename the key after incrementing - asset_data["total_accumulated_depreciation"] = asset_data.pop("accumulated_depreciation_amount") - - # Calculate closing WDV - asset_data["closing_wdv"] = ( - asset_data["gross_purchase_amount"] - - asset_data["total_accumulated_depreciation"] - ) - - # Prepare the row for the report - row = asset_data.copy() - row.update( - { - "depreciation_amount": d["depreciation_amount"], - "depreciation_date": d["posting_date"], - "depreciation_entry": d["voucher_no"], - } - ) - - # Append the row to the data list - data.append(row) - - return data - - -def get_assets_details(assets, filters): - assets_details = {} - - # Fetch asset details using QB - Asset = DocType("Asset") - AssetFinanceBook = DocType("Asset Finance Book") - - assets_data = ( - frappe.qb.from_(Asset) - .left_join(AssetFinanceBook) - .on(Asset.name == AssetFinanceBook.parent) - .select( - Asset.name.as_("asset"), - Asset.asset_name, - Asset.gross_purchase_amount, - Asset.asset_category, - Asset.status, - Asset.purchase_date, - Asset.cost_center, - AssetFinanceBook.rate_of_depreciation, - ) - .where(Asset.name.isin(assets)) - .run(as_dict=True) - ) - - for asset in assets_data: - assets_details[asset["asset"]] = asset - - if not asset.get("rate_of_depreciation"): - asset["rate_of_depreciation"] = 0 - - return assets_details \ No newline at end of file diff --git a/csf_tz/csf_tz/report/price_change_history/__init__.py b/csf_tz/csf_tz/report/price_change_history/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/csf_tz/report/price_change_history/price_change_history.js b/csf_tz/csf_tz/report/price_change_history/price_change_history.js deleted file mode 100644 index 5433bde0..00000000 --- a/csf_tz/csf_tz/report/price_change_history/price_change_history.js +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (c) 2024, Aakvatech and contributors -// For license information, please see license.txt -/* eslint-disable */ - -frappe.query_reports["Price Change History"] = { - "filters": [ - { - "fieldname": "company", - "fieldtype": "Link", - "options": "Company", - "label": __("Company"), - "default": frappe.defaults.get_user_default("company"), - "reqd": 1, - "width": "100px" - }, - { - "fieldname": "item", - "fieldtype": "Link", - "options": "Item", - "label": __("Item"), - "reqd": 0, - "width": "100px", - "get_query": () => { - return { - filters: { - "disabled": 0 - } - } - } - }, - { - "fieldname": "price_list", - "fieldtype": "Link", - "options": "Price List", - "label": __("Price List"), - "reqd": 0, - "width": "100px", - "get_query": () => { - return { - filters: { - "enabled": 1 - } - } - } - }, - { - "fieldname": "from_date", - "fieldtype": "Date", - "label": __("From Date"), - "reqd": 0, - "width": "100px" - }, - { - "fieldname": "to_date", - "fieldtype": "Date", - "label": __("To Date"), - "reqd": 0, - "width": "100px" - } - - ] -}; \ No newline at end of file diff --git a/csf_tz/csf_tz/report/price_change_history/price_change_history.json b/csf_tz/csf_tz/report/price_change_history/price_change_history.json deleted file mode 100644 index fb721539..00000000 --- a/csf_tz/csf_tz/report/price_change_history/price_change_history.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "add_total_row": 0, - "columns": [], - "creation": "2024-06-27 17:16:24.126617", - "disable_prepared_report": 0, - "disabled": 0, - "docstatus": 0, - "doctype": "Report", - "filters": [ - { - "fieldname": "company", - "fieldtype": "Link", - "label": "Company", - "mandatory": 0, - "options": "Company", - "wildcard_filter": 0 - }, - { - "fieldname": "item", - "fieldtype": "Link", - "label": "Item", - "mandatory": 0, - "options": "Item", - "wildcard_filter": 0 - }, - { - "fieldname": "price_list", - "fieldtype": "Link", - "label": "Price List", - "mandatory": 0, - "options": "Price List", - "wildcard_filter": 0 - }, - { - "fieldname": "from_date", - "fieldtype": "Date", - "label": "From Date", - "mandatory": 0, - "wildcard_filter": 0 - }, - { - "fieldname": "to_date", - "fieldtype": "Date", - "label": "To Date", - "mandatory": 0, - "wildcard_filter": 0 - } - ], - "idx": 0, - "is_standard": "Yes", - "letter_head": "No Letterhead", - "modified": "2024-06-27 17:23:50.457313", - "modified_by": "Administrator", - "module": "CSF TZ", - "name": "Price Change History", - "owner": "Administrator", - "prepared_report": 0, - "ref_doctype": "Price Change Request", - "report_name": "Price Change History", - "report_type": "Script Report", - "roles": [] -} \ No newline at end of file diff --git a/csf_tz/csf_tz/report/price_change_history/price_change_history.py b/csf_tz/csf_tz/report/price_change_history/price_change_history.py deleted file mode 100644 index 4fade752..00000000 --- a/csf_tz/csf_tz/report/price_change_history/price_change_history.py +++ /dev/null @@ -1,55 +0,0 @@ -# Copyright (c) 2024, Aakvatech and contributors -# For license information, please see license.txt - -import frappe -from frappe import _ - -def execute(filters=None): - columns = get_columns(filters) - - data = get_data(filters) - - if len(data) == 0: - frappe.msgprint("No record found, Please check you filters") - return - - return columns, data - -def get_data(filters): - conditions = get_conditions(filters) - - return frappe.db.sql(""" - SELECT pr.posting_date as date, pi.item_code as item_code, pi.item_name as item_name, - pi.price_list as price_list, pi.old_price as old_price, pi.new_price as new_price - FROM `tabPrice Change Request` pr - INNER JOIN `tabPrice Change Request Detail` pi ON pr.name = pi.parent - WHERE pr.docstatus = 1 {conditions} - """.format(conditions=conditions), filters, as_dict=1 - ) - -def get_conditions(filters): - conditions = " AND pr.company = %(company)s " - - if filters.item: - conditions += " AND pi.item_code = %(item)s " - - if filters.price_list: - conditions += " AND pi.price_list = %(price_list)s " - - if filters.from_date: - conditions += " AND pr.posting_date >= %(from_date)s " - - if filters.to_date: - conditions += " AND pr.posting_date <= %(to_date)s " - - return conditions - -def get_columns(filters): - return [ - {"fieldname": "date", "fieldtype": "Date", "label": _("Date"), "width": "110px"}, - {"fieldname": "item_code", "fieldtype": "Link", "options": "Item", "label": _("Item Code"), "width": "170px"}, - {"fieldname": "item_name", "fieldtype": "Data", "label": _("Item Name"), "width": "200px"}, - {"fieldname": "price_list", "fieldtype": "Link", "options": "Price List", "label": _("Price List"), "width": "170px"}, - {"fieldname": "old_price", "fieldtype": "Currency", "label": _("Old Price"), "width": "100px"}, - {"fieldname": "new_price", "fieldtype": "Currency", "label": _("New Price"), "width": "100px"} - ] \ No newline at end of file diff --git a/csf_tz/csf_tz/report/purchase_cycle_report/__init__.py b/csf_tz/csf_tz/report/purchase_cycle_report/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/csf_tz/report/purchase_cycle_report/purchase_cycle_report.html b/csf_tz/csf_tz/report/purchase_cycle_report/purchase_cycle_report.html deleted file mode 100644 index 7e1b209c..00000000 --- a/csf_tz/csf_tz/report/purchase_cycle_report/purchase_cycle_report.html +++ /dev/null @@ -1,55 +0,0 @@ -

{%= __("Purchase Cycle Report") %}

-

- {% if (filters.from_date && filters.to_date) { %} - {%= frappe.datetime.str_to_user(filters.from_date) %} {%= __("to") %} {%= frappe.datetime.str_to_user(filters.to_date) %} - {% } %} -

-
- -

Name: ___________________

Designation: ___________________

___________________

___________________
SignatureDate

Name: ___________________

Designation: ___________________

___________________

___________________
Countersignature (withholdee)Date
Official Stamp
- - - - - - - - - - - - - - - - {% - var current_po = null; - for (var i=0, l=data.length; i - - - {% - current_po = data[i].purchase_order; - } - %} - - - - - - - - - - - - - {% } %} - -
{%= __("Purchase Order") %}{%= __("Supplier") %}{%= __("Item Code") %}{%= __("Qty") %}{%= __("Received Qty") %}{%= __("Pending Qty") %}{%= __("Amount") %}{%= __("Billed Amount") %}{%= __("Pending Amount") %}{%= __("Received Qty Amount") %}
{%= __("Warehouses:") %} {%= data[i].warehouse %} {%= __("Status:") %} {%= data[i].status %}
{%= data[i].purchase_order %}{%= data[i].supplier %}{%= data[i].item_code %}{%= data[i].qty %}{%= data[i].received_qty %}{%= data[i].pending_qty %}{%= format_currency(data[i].amount) %}{%= format_currency(data[i].billed_amount) %}{%= format_currency(data[i].pending_amount) %}{%= format_currency(data[i].received_qty_amount) %}
- -

- {%= __("Printed On") %} {%= frappe.datetime.str_to_user(frappe.datetime.get_datetime_as_string()) %} -

diff --git a/csf_tz/csf_tz/report/purchase_cycle_report/purchase_cycle_report.js b/csf_tz/csf_tz/report/purchase_cycle_report/purchase_cycle_report.js deleted file mode 100644 index 2514e461..00000000 --- a/csf_tz/csf_tz/report/purchase_cycle_report/purchase_cycle_report.js +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (c) 2025, Aakvatech and contributors -// For license information, please see license.txt - -frappe.query_reports["Purchase Cycle Report"] = { - "filters": [ - { - "fieldname": "from_date", - "label": __("From Date"), - "fieldtype": "Date", - "default": frappe.datetime.add_months(frappe.datetime.get_today(), -1) - }, - { - "fieldname": "to_date", - "label": __("To Date"), - "fieldtype": "Date", - "default": frappe.datetime.get_today() - } - ] -}; diff --git a/csf_tz/csf_tz/report/purchase_cycle_report/purchase_cycle_report.json b/csf_tz/csf_tz/report/purchase_cycle_report/purchase_cycle_report.json deleted file mode 100644 index 245a7b38..00000000 --- a/csf_tz/csf_tz/report/purchase_cycle_report/purchase_cycle_report.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "add_total_row": 0, - "add_translate_data": 0, - "columns": [], - "creation": "2025-08-28 15:18:58.009466", - "disabled": 0, - "docstatus": 0, - "doctype": "Report", - "filters": [], - "idx": 0, - "is_standard": "Yes", - "letterhead": null, - "modified": "2025-08-28 15:19:43.021055", - "modified_by": "Administrator", - "module": "csf_tz", - "name": "Purchase Cycle Report", - "owner": "Administrator", - "prepared_report": 0, - "ref_doctype": "Purchase Order", - "report_name": "Purchase Cycle Report", - "report_type": "Script Report", - "roles": [], - "timeout": 0 -} \ No newline at end of file diff --git a/csf_tz/csf_tz/report/purchase_cycle_report/purchase_cycle_report.py b/csf_tz/csf_tz/report/purchase_cycle_report/purchase_cycle_report.py deleted file mode 100644 index 404fb37a..00000000 --- a/csf_tz/csf_tz/report/purchase_cycle_report/purchase_cycle_report.py +++ /dev/null @@ -1,68 +0,0 @@ -# Copyright (c) 2025, Aakvatech and contributors -# For license information, please see license.txt - -import frappe -from frappe.utils import getdate - -def execute(filters=None): - if not filters: - filters = {} - - columns = get_columns() - data = get_data(filters) - - return columns, data - - -def get_columns(): - return [ - {"label": "Purchase Order", "fieldname": "purchase_order", "fieldtype": "Link", "options": "Purchase Order", "width": 150}, - {"label": "Supplier", "fieldname": "supplier", "fieldtype": "Link", "options": "Supplier", "width": 180}, - {"label": "Item Code", "fieldname": "item_code", "fieldtype": "Link", "options": "Item", "width": 120}, - {"label": "Warehouse", "fieldname": "warehouse", "fieldtype": "Link", "options": "Warehouse", "width": 150}, - {"label": "Status", "fieldname": "status", "fieldtype": "Data", "width": 120}, - - {"label": "Qty", "fieldname": "qty", "fieldtype": "Float", "width": 100}, - {"label": "Received Qty", "fieldname": "received_qty", "fieldtype": "Float", "width": 110}, - {"label": "Pending Qty", "fieldname": "pending_qty", "fieldtype": "Float", "width": 110}, - # Removed Billed Qty and Qty to Bill columns as billed_qty does not exist - - {"label": "Amount", "fieldname": "amount", "fieldtype": "Currency", "width": 120}, - {"label": "Billed Amount", "fieldname": "billed_amount", "fieldtype": "Currency", "width": 130}, - {"label": "Pending Amount", "fieldname": "pending_amount", "fieldtype": "Currency", "width": 130}, - {"label": "Received Qty Amount", "fieldname": "received_qty_amount", "fieldtype": "Currency", "width": 150}, - ] - - -def get_data(filters): - conditions = "" - if filters.get("from_date"): - conditions += " and po.transaction_date >= %(from_date)s" - if filters.get("to_date"): - conditions += " and po.transaction_date <= %(to_date)s" - - data = frappe.db.sql(f""" - SELECT - po.name as purchase_order, - po.supplier, - poi.item_code, - poi.warehouse, - po.status, - - poi.qty as qty, - poi.received_qty as received_qty, - (poi.qty - poi.received_qty) as pending_qty, - -- Removed billed_qty and qty_to_bill as billed_qty does not exist - - poi.amount as amount, - poi.billed_amt as billed_amount, - (poi.amount - poi.billed_amt) as pending_amount, - (poi.received_qty * poi.rate) as received_qty_amount - - FROM `tabPurchase Order Item` poi - JOIN `tabPurchase Order` po ON poi.parent = po.name - WHERE po.docstatus = 1 {conditions} - ORDER BY po.status, po.name - """, filters, as_dict=True) - - return data diff --git a/csf_tz/csf_tz/report/purchase_report_by_type/__init__.py b/csf_tz/csf_tz/report/purchase_report_by_type/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/csf_tz/report/purchase_report_by_type/purchase_report_by_type.json b/csf_tz/csf_tz/report/purchase_report_by_type/purchase_report_by_type.json deleted file mode 100644 index 7a9c02e0..00000000 --- a/csf_tz/csf_tz/report/purchase_report_by_type/purchase_report_by_type.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "add_total_row": 1, - "columns": [], - "creation": "2021-02-23 10:59:37.822514", - "disable_prepared_report": 0, - "disabled": 0, - "docstatus": 0, - "doctype": "Report", - "filters": [], - "idx": 0, - "is_standard": "Yes", - "modified": "2021-03-19 21:42:28.687134", - "modified_by": "Administrator", - "module": "CSF TZ", - "name": "Purchase Report by Type", - "owner": "Administrator", - "prepared_report": 0, - "query": "SELECT pi.name AS \"Purchase Invoice:Link/Purchase Invoice:150\",\r\n s.name AS \"SUPPLIER_NAME:Link/Supplier:250\",\r\n s.vrn AS \"SUPPLIER_VRN::100\", \r\n pi.bill_no AS \"TAX_INVOICE_NUMBER::100\", \r\n pi.posting_date AS \"DATE_OF_INVOICE:Date:120\", \r\n GROUP_CONCAT(pii.item_name) AS \"ITEMS::250\", \r\n pi.base_net_total AS \"AMOUNT_VAT_EXCL:Currency:150\", \r\n pi.base_total_taxes_and_charges AS \"VAT_AMT:Currency:100\",\r\n IF(pi.base_rounded_total > 0, pi.base_rounded_total, pi.base_grand_total) AS \"AMOUNT_VAT_INCL:Currency:150\"\r\nFROM `tabPurchase Invoice` pi \r\n INNER JOIN `tabPurchase Invoice Item` pii\r\n ON pii.parent = pi.name\r\n INNER JOIN `tabSupplier` s \r\n ON pi.supplier = s.name \r\nWHERE ((pi.posting_date >= %(from_date)s and pi.posting_date <= %(to_date)s))\r\n and pi.docstatus = 1\r\nGROUP BY s.name, s.vrn, pi.bill_no, pi.bill_date, pi.base_net_total, pi.total_taxes_and_charges\r\nORDER BY pi.posting_date", - "ref_doctype": "Purchase Invoice", - "report_name": "Purchase Report by Type", - "report_type": "Query Report", - "roles": [] -} \ No newline at end of file diff --git a/csf_tz/csf_tz/report/purchase_reports_by_tax_category/__init__.py b/csf_tz/csf_tz/report/purchase_reports_by_tax_category/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/csf_tz/report/purchase_reports_by_tax_category/purchase_reports_by_tax_category.js b/csf_tz/csf_tz/report/purchase_reports_by_tax_category/purchase_reports_by_tax_category.js deleted file mode 100644 index ce446ed1..00000000 --- a/csf_tz/csf_tz/report/purchase_reports_by_tax_category/purchase_reports_by_tax_category.js +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) 2016, Aakvatech and contributors -// For license information, please see license.txt -/* eslint-disable */ - -frappe.query_reports["Purchase Reports by Tax Category"] = { - "filters": [ - { - "fieldname":"from_date", - "label": __("From Date"), - "fieldtype": "Date", - "default": frappe.datetime.add_months(frappe.datetime.get_today(), -1), - "reqd": 1, - "width": "60px" - }, - { - "fieldname":"to_date", - "label": __("To Date"), - "fieldtype": "Date", - "default": frappe.datetime.get_today(), - "reqd": 1, - "width": "60px" - }, - { - "fieldname": "taxes_and_charges", - "label": __("Taxes and Charges"), - "fieldtype": "Link", - "width": "120", - "options": "Purchase Taxes and Charges Template", - "default": "Tanzania Tax - VPL" - }, - ] -} \ No newline at end of file diff --git a/csf_tz/csf_tz/report/purchase_reports_by_tax_category/purchase_reports_by_tax_category.json b/csf_tz/csf_tz/report/purchase_reports_by_tax_category/purchase_reports_by_tax_category.json deleted file mode 100644 index 38820bba..00000000 --- a/csf_tz/csf_tz/report/purchase_reports_by_tax_category/purchase_reports_by_tax_category.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "add_total_row": 1, - "creation": "2019-09-27 09:25:21.146387", - "disable_prepared_report": 0, - "disabled": 0, - "docstatus": 0, - "doctype": "Report", - "idx": 0, - "is_standard": "Yes", - "modified": "2019-09-27 12:12:04.173724", - "modified_by": "Administrator", - "module": "CSF TZ", - "name": "Purchase Reports by Tax Category", - "owner": "Administrator", - "prepared_report": 0, - "query": "SELECT pi.posting_date \"Date:Date:80\",\n\tpi.name \"Invoice No:Link/Purchase Invoice:120\",\n\tpi.supplier \"Supplier:Link/Supplier:200\",\n\ts.vrn \"VRN:Data:80\", \n\tGROUP_CONCAT(pid.item_code) \"Item Description:Link/Item:200\", \n\tpi.bill_no \"Supp. Tax Inv:Data:100\", \n\tpi.bill_date \"Supp. Inv Date:Date:80\", \n\tpi.base_net_total \"Amount:Currency:120\", \n\tpi.base_total_taxes_and_charges \"VAT:Currency:120\", \n\tpi.base_grand_total \"Total:Currency:120\"\nFROM `tabPurchase Invoice` pi\n\tINNER JOIN `tabPurchase Invoice Item` pid ON pi.name = pid.parent\n\tINNER JOIN `tabSupplier` s ON pi.supplier = s.name \nWHERE pi.docstatus = 1\nAND pi.posting_date BETWEEN %(from_date)s AND %(to_date)s \nAND pi.taxes_and_charges LIKE %(taxes_and_charges)s \nGROUP BY pi.name", - "ref_doctype": "Purchase Invoice", - "report_name": "Purchase Reports by Tax Category", - "report_type": "Query Report", - "roles": [ - { - "role": "Accounts User" - }, - { - "role": "Purchase User" - }, - { - "role": "Accounts Manager" - }, - { - "role": "Auditor" - } - ] -} \ No newline at end of file diff --git a/csf_tz/csf_tz/report/purchases_by_tax_category_summary/__init__.py b/csf_tz/csf_tz/report/purchases_by_tax_category_summary/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/csf_tz/report/purchases_by_tax_category_summary/purchases_by_tax_category_summary.js b/csf_tz/csf_tz/report/purchases_by_tax_category_summary/purchases_by_tax_category_summary.js deleted file mode 100644 index 0c14d787..00000000 --- a/csf_tz/csf_tz/report/purchases_by_tax_category_summary/purchases_by_tax_category_summary.js +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) 2016, Aakvatech and contributors -// For license information, please see license.txt -/* eslint-disable */ - -frappe.query_reports["Purchases by Tax Category Summary"] = { - "filters": [ - { - "fieldname":"from_date", - "label": __("From Date"), - "fieldtype": "Date", - "default": frappe.datetime.add_months(frappe.datetime.get_today(), -1), - "reqd": 1, - "width": "60px" - }, - { - "fieldname":"to_date", - "label": __("To Date"), - "fieldtype": "Date", - "default": frappe.datetime.get_today(), - "reqd": 1, - "width": "60px" - }, - ] -} \ No newline at end of file diff --git a/csf_tz/csf_tz/report/purchases_by_tax_category_summary/purchases_by_tax_category_summary.json b/csf_tz/csf_tz/report/purchases_by_tax_category_summary/purchases_by_tax_category_summary.json deleted file mode 100644 index d6a31ae1..00000000 --- a/csf_tz/csf_tz/report/purchases_by_tax_category_summary/purchases_by_tax_category_summary.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "add_total_row": 1, - "creation": "2019-09-27 10:07:38.564272", - "disable_prepared_report": 0, - "disabled": 0, - "docstatus": 0, - "doctype": "Report", - "idx": 0, - "is_standard": "Yes", - "json": "{\"add_total_row\": 0}", - "modified": "2019-09-27 12:04:01.754793", - "modified_by": "Administrator", - "module": "CSF TZ", - "name": "Purchases by Tax Category Summary", - "owner": "Administrator", - "prepared_report": 0, - "query": "SELECT pi.taxes_and_charges \"Tax Category:Link/Purchase Taxes and Charges Template:200\",\n\tsum(pi.net_total) \"Amount:Currency:120\", \n\tsum(pi.base_total_taxes_and_charges) \"VAT:Currency:120\", \n\tsum(pi.grand_total) \"Total:Currency:120\"\nFROM `tabPurchase Invoice` pi\nWHERE docstatus = 1\nAND pi.posting_date BETWEEN %(from_date)s AND %(to_date)s \nGROUP BY pi.taxes_and_charges\n\n", - "ref_doctype": "Purchase Invoice", - "report_name": "Purchases by Tax Category Summary", - "report_type": "Query Report", - "roles": [ - { - "role": "Accounts User" - }, - { - "role": "Purchase User" - }, - { - "role": "Accounts Manager" - }, - { - "role": "Auditor" - } - ] -} \ No newline at end of file diff --git a/csf_tz/csf_tz/report/sales_cycle_report/__init__.py b/csf_tz/csf_tz/report/sales_cycle_report/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/csf_tz/report/sales_cycle_report/sales_cycle_report.js b/csf_tz/csf_tz/report/sales_cycle_report/sales_cycle_report.js deleted file mode 100644 index 19ef4255..00000000 --- a/csf_tz/csf_tz/report/sales_cycle_report/sales_cycle_report.js +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) 2025, Aakvatech and contributors -// For license information, please see license.txt - -frappe.query_reports["Sales Cycle Report"] = { - "filters": [ - { - "fieldname": "from_date", - "label": __("From Date"), - "fieldtype": "Date", - "default": frappe.datetime.month_start(), - "reqd": 1 - }, - { - "fieldname": "to_date", - "label": __("To Date"), - "fieldtype": "Date", - "default": frappe.datetime.get_today(), - "reqd": 1 - }, - { - "fieldname": "item_type", - "label": __("Item Type"), - "fieldtype": "Select", - "options": "\nStock\nNon-Stock/Service", - "default": "" - }, - { - "fieldname": "warehouse", - "label": __("Warehouse"), - "fieldtype": "Link", - "options": "Warehouse" - } - ] -}; diff --git a/csf_tz/csf_tz/report/sales_cycle_report/sales_cycle_report.json b/csf_tz/csf_tz/report/sales_cycle_report/sales_cycle_report.json deleted file mode 100644 index e5f713fd..00000000 --- a/csf_tz/csf_tz/report/sales_cycle_report/sales_cycle_report.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "add_total_row": 1, - "add_translate_data": 0, - "columns": [], - "creation": "2025-08-28 10:50:15.863173", - "disabled": 0, - "docstatus": 0, - "doctype": "Report", - "filters": [], - "idx": 0, - "is_standard": "Yes", - "letter_head": "", - "letterhead": null, - "modified": "2025-08-28 10:50:15.863173", - "modified_by": "Administrator", - "module": "CSF TZ", - "name": "Sales Cycle Report", - "owner": "Administrator", - "prepared_report": 0, - "ref_doctype": "Sales Order", - "report_name": "Sales Cycle Report", - "report_type": "Script Report", - "roles": [ - { - "role": "Purchase User" - }, - { - "role": "Purchase Manager" - }, - { - "role": "Stock User" - }, - { - "role": "Accounts User" - }, - { - "role": "Accounts Manager" - }, - { - "role": "Auditor" - }, - { - "role": "Sales User" - }, - { - "role": "System Manager" - } - ], - "timeout": 0 -} \ No newline at end of file diff --git a/csf_tz/csf_tz/report/sales_cycle_report/sales_cycle_report.py b/csf_tz/csf_tz/report/sales_cycle_report/sales_cycle_report.py deleted file mode 100644 index 621157d0..00000000 --- a/csf_tz/csf_tz/report/sales_cycle_report/sales_cycle_report.py +++ /dev/null @@ -1,171 +0,0 @@ -# Copyright (c) 2025, Aakvatech and contributors -# For license information, please see license.txt - -import frappe -from frappe import _ -from frappe.query_builder import DocType -from frappe.query_builder.functions import Sum - - -def execute(filters=None): - columns = get_columns() - data = get_data(filters) - return columns, data - - -def get_columns(): - return [ - { - "label": _("Warehouse"), - "fieldname": "warehouse", - "fieldtype": "Data", - "width": 150, - }, - { - "label": _("Status"), - "fieldname": "status", - "fieldtype": "Data", - "width": 150, - }, - { - "label": _("Row Labels"), - "fieldname": "row_labels", - "fieldtype": "Link", - "options": "Sales Order", - "width": 200, - }, - { - "label": _("Customer"), - "fieldname": "customer", - "fieldtype": "Link", - "options": "Customer", - "width": 150, - }, - { - "label": _("Item Code"), - "fieldname": "item_code", - "fieldtype": "Link", - "options": "Item", - "width": 150, - }, - { - "label": _("Sum of Qty"), - "fieldname": "sum_qty", - "fieldtype": "Float", - "width": 100, - }, - { - "label": _("Sum of Delivered Qty"), - "fieldname": "sum_delivered_qty", - "fieldtype": "Float", - "width": 100, - }, - { - "label": _("Sum of Pending Delivery Qty"), - "fieldname": "sum_pending_delivery_qty", - "fieldtype": "Float", - "width": 150, - }, - { - "label": _("Sum of Billed Qty"), - "fieldname": "sum_billed_qty", - "fieldtype": "Float", - "width": 100, - }, - { - "label": _("Sum of Qty to Invoice"), - "fieldname": "sum_qty_to_invoice", - "fieldtype": "Float", - "width": 150, - }, - { - "label": _("Sum of Amount"), - "fieldname": "sum_amount", - "fieldtype": "Currency", - "width": 150, - }, - { - "label": _("Sum of Billed Amount"), - "fieldname": "sum_billed_amount", - "fieldtype": "Currency", - "width": 150, - }, - { - "label": _("Sum of Pending Amount"), - "fieldname": "sum_pending_amount", - "fieldtype": "Currency", - "width": 150, - }, - { - "label": _("Sum of Delivered Amount"), - "fieldname": "sum_delivered_amount", - "fieldtype": "Currency", - "width": 150, - }, - ] - - -def get_data(filters): - from_date = filters.get("from_date") - to_date = filters.get("to_date") - item_type = filters.get("item_type") # 'Stock' or 'Non-Stock/Service' - warehouse = filters.get("warehouse") - - # Ensure from_date starts from the first day of the month - if from_date: - from_date_obj = frappe.utils.getdate(from_date) - from_date = frappe.utils.get_first_day(from_date_obj).strftime('%Y-%m-%d') - - # Use Query Builder for complex joins and sums - SO = DocType("Sales Order") - SOI = DocType("Sales Order Item") - Item = DocType("Item") - - qb = frappe.qb - query = ( - qb.from_(SO) - .inner_join(SOI) - .on(SOI.parent == SO.name) - .inner_join(Item) - .on(Item.name == SOI.item_code) - .where(SO.docstatus == 1) - .where(SO.transaction_date.between(from_date, to_date)) - .select( - SOI.warehouse.as_("warehouse"), - SO.status.as_("status"), - SO.name.as_("row_labels"), - SO.customer.as_("customer"), - SOI.item_code.as_("item_code"), - Sum(SOI.qty).as_("sum_qty"), - Sum(SOI.delivered_qty).as_("sum_delivered_qty"), - Sum(SOI.qty - SOI.delivered_qty).as_("sum_pending_delivery_qty"), - Sum(SOI.billed_amt / SOI.rate).as_("sum_billed_qty"), - Sum(SOI.delivered_qty - (SOI.billed_amt / SOI.rate)).as_("sum_qty_to_invoice"), - Sum(SOI.amount).as_("sum_amount"), - Sum(SOI.billed_amt).as_("sum_billed_amount"), - Sum(SOI.amount - SOI.billed_amt).as_("sum_pending_amount"), - Sum(SOI.delivered_qty * SOI.rate).as_("sum_delivered_amount"), - ) - .groupby(SOI.warehouse, SO.status, SO.name, SO.customer, SOI.item_code) - .orderby(SOI.warehouse, SO.status, SO.name, SOI.item_code) - ) - - # Apply optional filters - if item_type == "Stock": - query = query.where(Item.is_stock_item == 1) - elif item_type == "Non-Stock/Service": - query = query.where(Item.is_stock_item == 0) - if warehouse: - query = query.where(SOI.warehouse == warehouse) - - data = query.run(as_dict=True) - - # Post-process with ORM if needed (e.g., fetch additional details) - if not data: # Fallback or additional simple fetches - data = frappe.get_all( - "Sales Order", - filters={"transaction_date": ["between", [from_date, to_date]]}, - fields=["name", "status"], - ) - - return data diff --git a/csf_tz/csf_tz/report/sales_report_by_type/__init__.py b/csf_tz/csf_tz/report/sales_report_by_type/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/csf_tz/report/sales_report_by_type/sales_report_by_type.js b/csf_tz/csf_tz/report/sales_report_by_type/sales_report_by_type.js deleted file mode 100644 index 8a023a03..00000000 --- a/csf_tz/csf_tz/report/sales_report_by_type/sales_report_by_type.js +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) 2016, Aakvatech and contributors -// For license information, please see license.txt -/* eslint-disable */ - -frappe.query_reports["Sales Report by Type"] = { - filters: [ - { - fieldname: "from_date", - fieldtype: "Date", - label: "From Date", - mandatory: 1, - wildcard_filter: 0, - }, - { - fieldname: "to_date", - fieldtype: "Date", - label: "To Date", - mandatory: 1, - wildcard_filter: 0, - }, - { - fieldname: "is_pos", - fieldtype: "Select", - label: "Is POS", - mandatory: 1, - options: "No\nYes", - wildcard_filter: 0, - } - ] -} diff --git a/csf_tz/csf_tz/report/sales_report_by_type/sales_report_by_type.json b/csf_tz/csf_tz/report/sales_report_by_type/sales_report_by_type.json deleted file mode 100644 index 7e203350..00000000 --- a/csf_tz/csf_tz/report/sales_report_by_type/sales_report_by_type.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "add_total_row": 1, - "columns": [], - "creation": "2021-02-23 10:59:12.652346", - "disable_prepared_report": 0, - "disabled": 0, - "docstatus": 0, - "doctype": "Report", - "idx": 0, - "is_standard": "Yes", - "modified": "2021-03-19 21:47:38.110605", - "modified_by": "Administrator", - "module": "CSF TZ", - "name": "Sales Report by Type", - "owner": "Administrator", - "prepared_report": 0, - "query": "SELECT c.name AS \"Customer:Link/Supplier:250\",\r\n si.name AS \"Invoice Number::150\",\r\n si.vfd_rctvnum AS \"VFD No::75\",\r\n si.posting_date AS \"Invoice Date::100\",\r\n si.vfd_date AS \"VFD Date::100\",\r\n si.base_net_total AS \"AMOUNT_VAT_EXCL:Currency:200\",\r\n si.total_taxes_and_charges AS \"VAT_AMT:Currency:150\",\r\n si.base_rounded_total AS \"AMOUNT_VAT_INCL:Currency:200\",\r\n si.taxes_and_charges AS \"Sales Taxes and Charges Template:Link/Sales Taxes and Charges Template:350\"\r\nFROM `tabSales Invoice` si\r\n INNER JOIN `tabSales Invoice Item` sii\r\n ON sii.parent = si.name\r\n INNER JOIN `tabCustomer` c\r\n ON si.customer = c.name\r\nWHERE (si.posting_date >= %(from_date)s and si.posting_date <= %(to_date)s)\r\n and si.docstatus = 1\r\n and si.is_pos = if(%(is_pos)s = \"No\", 0, 1)\r\nGROUP BY si.posting_date, si.vfd_rctvnum, c.name, si.name\r\nORDER BY si.name", - "ref_doctype": "Sales Invoice", - "report_name": "Sales Report by Type", - "report_type": "Query Report", - "roles": [] -} \ No newline at end of file diff --git a/csf_tz/csf_tz/report/sales_transaction_currency_recon/__init__.py b/csf_tz/csf_tz/report/sales_transaction_currency_recon/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/csf_tz/report/sales_transaction_currency_recon/sales_transaction_currency_recon.js b/csf_tz/csf_tz/report/sales_transaction_currency_recon/sales_transaction_currency_recon.js deleted file mode 100644 index 11964c65..00000000 --- a/csf_tz/csf_tz/report/sales_transaction_currency_recon/sales_transaction_currency_recon.js +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) 2025, Aakvatech and contributors -// For license information, please see license.txt - -frappe.query_reports["Sales Transaction Currency Recon"] = { - filters: [ - { - fieldname: "company", - label: __("Company"), - fieldtype: "Link", - options: "Company", - default: frappe.defaults.get_user_default("Company"), - }, - { - fieldname: "from_date", - label: __("From Date"), - fieldtype: "Date", - reqd: 1, - default: frappe.datetime.add_months(frappe.datetime.get_today(), -1), - }, - { - fieldname: "to_date", - label: __("To Date"), - fieldtype: "Date", - reqd: 1, - default: frappe.datetime.get_today(), - }, - { - fieldname: "customer", - label: __("Customer"), - fieldtype: "Link", - options: "Customer", - }, - { - fieldname: "view", - label: __("View"), - fieldtype: "Select", - options: ["Detailed", "Grouped by Customer"], - default: "Detailed", - reqd: 1, - }, - ], - - formatter: function (value, row, column, data, default_formatter) { - value = default_formatter(value, row, column, data); - - if (!data) return value; - - // Calmer pastel palette (sober) - const COLORS = { - SO_CLOSED: "#F8D7DA", // soft rose - SO_HOLD: "#FFF3CD", // soft amber - SO_OTHER: "#D1F2EB", // soft mint - SI: "#FFFBE6", // soft cream - PE: "#DFF5E1", // soft teal/green (slightly more visible) - }; - - const wrap = (html, background) => { - return `${html}`; - }; - - if (data.doc_type === "Payment Entry") { - return wrap(value, COLORS.PE); - } - - if (data.doc_type === "Sales Invoice") { - return wrap(value, COLORS.SI); - } - - if (data.doc_type === "Sales Order") { - if (data.status === "Closed") return wrap(value, COLORS.SO_CLOSED); - if (data.status === "On Hold") return wrap(value, COLORS.SO_HOLD); - return wrap(value, COLORS.SO_OTHER); - } - - return value; - } -}; diff --git a/csf_tz/csf_tz/report/sales_transaction_currency_recon/sales_transaction_currency_recon.json b/csf_tz/csf_tz/report/sales_transaction_currency_recon/sales_transaction_currency_recon.json deleted file mode 100644 index 2028d25b..00000000 --- a/csf_tz/csf_tz/report/sales_transaction_currency_recon/sales_transaction_currency_recon.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "add_total_row": 1, - "add_translate_data": 0, - "columns": [], - "creation": "2025-12-23 18:57:51.098939", - "disabled": 0, - "docstatus": 0, - "doctype": "Report", - "filters": [], - "idx": 0, - "is_standard": "Yes", - "javascript": "frappe.query_reports[\"Sales Transaction Currency Recon\"] = {\r\n filters: [\r\n {\r\n fieldname: \"company\",\r\n label: __(\"Company\"),\r\n fieldtype: \"Link\",\r\n options: \"Company\",\r\n default: frappe.defaults.get_user_default(\"Company\"),\r\n },\r\n {\r\n fieldname: \"from_date\",\r\n label: __(\"From Date\"),\r\n fieldtype: \"Date\",\r\n reqd: 1,\r\n default: frappe.datetime.add_months(frappe.datetime.get_today(), -1),\r\n },\r\n {\r\n fieldname: \"to_date\",\r\n label: __(\"To Date\"),\r\n fieldtype: \"Date\",\r\n reqd: 1,\r\n default: frappe.datetime.get_today(),\r\n },\r\n {\r\n fieldname: \"customer\",\r\n label: __(\"Customer\"),\r\n fieldtype: \"Link\",\r\n options: \"Customer\",\r\n },\r\n {\r\n fieldname: \"view\",\r\n label: __(\"View\"),\r\n fieldtype: \"Select\",\r\n options: [\"Detailed\", \"Grouped by Customer\"],\r\n default: \"Detailed\",\r\n reqd: 1,\r\n },\r\n ],\r\n};\r\n", - "letter_head": "Standard Letter Head", - "letterhead": null, - "modified": "2025-12-23 23:12:02.436318", - "modified_by": "Administrator", - "module": "CSF TZ", - "name": "Sales Transaction Currency Recon", - "owner": "mchoksi@aakvatech.com", - "prepared_report": 0, - "ref_doctype": "Sales Invoice", - "report_name": "Sales Transaction Currency Recon", - "report_script": "def validate_filters(filters):\r\n if not filters.get(\"from_date\") or not filters.get(\"to_date\"):\r\n frappe.throw(\"From Date and To Date are required.\")\r\n\r\n if filters.from_date > filters.to_date:\r\n frappe.throw(\"From Date cannot be after To Date.\")\r\n\r\n\r\ndef get_columns(filters):\r\n currency_fields = [\r\n {\r\n \"label\": \"Ordered Amount (Txn)\",\r\n \"fieldname\": \"ordered_amount\",\r\n \"fieldtype\": \"Currency\",\r\n \"options\": \"currency\",\r\n \"width\": 150,\r\n },\r\n {\r\n \"label\": \"Ordered Amount (Company)\",\r\n \"fieldname\": \"ordered_amount_company\",\r\n \"fieldtype\": \"Currency\",\r\n \"options\": \"company_currency\",\r\n \"width\": 170,\r\n },\r\n {\r\n \"label\": \"Received Amount (Txn)\",\r\n \"fieldname\": \"received_amount\",\r\n \"fieldtype\": \"Currency\",\r\n \"options\": \"currency\",\r\n \"width\": 150,\r\n },\r\n {\r\n \"label\": \"Received Amount (Company)\",\r\n \"fieldname\": \"received_amount_company\",\r\n \"fieldtype\": \"Currency\",\r\n \"options\": \"company_currency\",\r\n \"width\": 170,\r\n },\r\n {\r\n \"label\": \"Billed Amount (Txn)\",\r\n \"fieldname\": \"billed_amount\",\r\n \"fieldtype\": \"Currency\",\r\n \"options\": \"currency\",\r\n \"width\": 150,\r\n },\r\n {\r\n \"label\": \"Billed Amount (Company)\",\r\n \"fieldname\": \"billed_amount_company\",\r\n \"fieldtype\": \"Currency\",\r\n \"options\": \"company_currency\",\r\n \"width\": 170,\r\n },\r\n {\r\n \"label\": \"Ordered - Received (Txn)\",\r\n \"fieldname\": \"ordered_minus_received\",\r\n \"fieldtype\": \"Currency\",\r\n \"options\": \"currency\",\r\n \"width\": 180,\r\n },\r\n {\r\n \"label\": \"Ordered - Billed (Txn)\",\r\n \"fieldname\": \"ordered_minus_billed\",\r\n \"fieldtype\": \"Currency\",\r\n \"options\": \"currency\",\r\n \"width\": 180,\r\n },\r\n {\r\n \"label\": \"Billed - Received (Txn)\",\r\n \"fieldname\": \"billed_minus_received\",\r\n \"fieldtype\": \"Currency\",\r\n \"options\": \"currency\",\r\n \"width\": 180,\r\n },\r\n ]\r\n\r\n return [\r\n {\"label\": \"Customer\", \"fieldname\": \"customer\", \"fieldtype\": \"Link\", \"options\": \"Customer\", \"width\": 180},\r\n {\"label\": \"Doc Type\", \"fieldname\": \"doc_type\", \"fieldtype\": \"Data\", \"width\": 130},\r\n {\"label\": \"Doc No\", \"fieldname\": \"doc_no\", \"fieldtype\": \"Dynamic Link\", \"options\": \"doc_type\", \"width\": 180},\r\n {\"label\": \"Date\", \"fieldname\": \"posting_date\", \"fieldtype\": \"Date\", \"width\": 110},\r\n {\"label\": \"Currency\", \"fieldname\": \"currency\", \"fieldtype\": \"Link\", \"options\": \"Currency\", \"width\": 90},\r\n {\"label\": \"Company Currency\", \"fieldname\": \"company_currency\", \"fieldtype\": \"Link\", \"options\": \"Currency\", \"width\": 120},\r\n {\"label\": \"Exchange Rate\", \"fieldname\": \"exchange_rate\", \"fieldtype\": \"Float\", \"width\": 110},\r\n {\"label\": \"Item Code\", \"fieldname\": \"item_code\", \"fieldtype\": \"Link\", \"options\": \"Item\", \"width\": 140},\r\n {\"label\": \"Item Name\", \"fieldname\": \"item_name\", \"fieldtype\": \"Data\", \"width\": 180},\r\n *currency_fields,\r\n ]\r\n\r\n\r\n\r\ndef get_common_conditions(filters, date_field, customer_field):\r\n conditions = [f\"{date_field} BETWEEN %(from_date)s AND %(to_date)s\"]\r\n values = {\r\n \"from_date\": filters.from_date,\r\n \"to_date\": filters.to_date,\r\n }\r\n\r\n if filters.get(\"customer\"):\r\n conditions.append(f\"{customer_field} = %(customer)s\")\r\n values[\"customer\"] = filters.customer\r\n\r\n if filters.get(\"company\"):\r\n # Each doctype uses company field name:\r\n # - Sales Order: company\r\n # - Sales Invoice: company\r\n # - Payment Entry: company\r\n conditions.append(\"company = %(company)s\")\r\n values[\"company\"] = filters.company\r\n\r\n return \" AND \".join(conditions), values\r\n\r\n\r\ndef group_by_customer(rows):\r\n grouped = {}\r\n\r\n for r in rows:\r\n key = (r.get(\"customer\") or \"\")\r\n if key not in grouped:\r\n grouped[key] = {\r\n \"customer\": r.get(\"customer\"),\r\n \"doc_type\": \"Grouped\",\r\n \"doc_no\": None,\r\n \"posting_date\": None,\r\n \"currency\": None,\r\n \"company_currency\": r.get(\"company_currency\"),\r\n \"exchange_rate\": None,\r\n \"item_code\": None,\r\n \"item_name\": None,\r\n \"ordered_amount\": 0,\r\n \"ordered_amount_company\": 0,\r\n \"received_amount\": 0,\r\n \"received_amount_company\": 0,\r\n \"billed_amount\": 0,\r\n \"billed_amount_company\": 0,\r\n }\r\n\r\n g = grouped[key]\r\n g[\"ordered_amount\"] = g[\"ordered_amount\"] + flt(r.get(\"ordered_amount\"))\r\n g[\"ordered_amount_company\"] = g[\"ordered_amount_company\"] + flt(r.get(\"ordered_amount_company\"))\r\n g[\"received_amount\"] = g[\"received_amount\"] + flt(r.get(\"received_amount\"))\r\n g[\"received_amount_company\"] = g[\"received_amount_company\"] + flt(r.get(\"received_amount_company\"))\r\n g[\"billed_amount\"] = g[\"billed_amount\"] + flt(r.get(\"billed_amount\"))\r\n g[\"billed_amount_company\"] = g[\"billed_amount_company\"] + flt(r.get(\"billed_amount_company\"))\r\n\r\n return list(grouped.values())\r\n\r\ndef get_sales_order_rows(filters, company_currency):\r\n conditions, values = get_common_conditions(filters, date_field=\"so.transaction_date\", customer_field=\"so.customer\")\r\n\r\n # Sales Order Item amounts:\r\n # - Transaction currency: soi.net_amount\r\n # - Company currency: soi.base_net_amount\r\n q = f\"\"\"\r\n SELECT\r\n so.customer AS customer,\r\n 'Sales Order' AS doc_type,\r\n so.name AS doc_no,\r\n so.transaction_date AS posting_date,\r\n so.currency AS currency,\r\n %(company_currency)s AS company_currency,\r\n so.conversion_rate AS exchange_rate,\r\n soi.item_code AS item_code,\r\n soi.item_name AS item_name,\r\n soi.net_amount AS ordered_amount,\r\n soi.base_net_amount AS ordered_amount_company,\r\n 0 AS received_amount,\r\n 0 AS received_amount_company,\r\n 0 AS billed_amount,\r\n 0 AS billed_amount_company\r\n FROM `tabSales Order` so\r\n INNER JOIN `tabSales Order Item` soi ON soi.parent = so.name\r\n WHERE so.docstatus = 1\r\n AND {conditions}\r\n \"\"\"\r\n values[\"company_currency\"] = company_currency\r\n return frappe.db.sql(q, values, as_dict=True)\r\n\r\n\r\ndef get_sales_invoice_rows(filters, company_currency):\r\n conditions, values = get_common_conditions(filters, date_field=\"si.posting_date\", customer_field=\"si.customer\")\r\n\r\n # Sales Invoice Item amounts:\r\n # - Transaction currency: sii.net_amount\r\n # - Company currency: sii.base_net_amount\r\n # Note: returns (credit notes) are part of Sales Invoice with is_return=1; net_amount will typically be negative.\r\n q = f\"\"\"\r\n SELECT\r\n si.customer AS customer,\r\n 'Sales Invoice' AS doc_type,\r\n si.name AS doc_no,\r\n si.posting_date AS posting_date,\r\n si.currency AS currency,\r\n %(company_currency)s AS company_currency,\r\n si.conversion_rate AS exchange_rate,\r\n sii.item_code AS item_code,\r\n sii.item_name AS item_name,\r\n 0 AS ordered_amount,\r\n 0 AS ordered_amount_company,\r\n 0 AS received_amount,\r\n 0 AS received_amount_company,\r\n sii.net_amount AS billed_amount,\r\n sii.base_net_amount AS billed_amount_company\r\n FROM `tabSales Invoice` si\r\n INNER JOIN `tabSales Invoice Item` sii ON sii.parent = si.name\r\n WHERE si.docstatus = 1\r\n AND {conditions}\r\n \"\"\"\r\n values[\"company_currency\"] = company_currency\r\n return frappe.db.sql(q, values, as_dict=True)\r\n\r\n\r\ndef get_payment_rows(filters, company_currency):\r\n # We use Payment Entry Reference to relate payments to Sales Invoices (most common reconciliation use case).\r\n # Sign convention requested:\r\n # - received = negative value if received\r\n # - received = positive value if refunded\r\n #\r\n # Mapping:\r\n # - Payment Entry.payment_type = 'Receive' => received money => negative\r\n # - Payment Entry.payment_type = 'Pay' => refund money => positive\r\n #\r\n # Amount selection:\r\n # - per reference: `tabPayment Entry Reference`.`allocated_amount`\r\n # - company currency: allocated_amount * exchange_rate (best-effort)\r\n #\r\n # If your setup uses multi-currency bank accounts heavily, you may want to enhance this using\r\n # paid_from_account_currency/paid_to_account_currency and base_* fields.\r\n conditions, values = get_common_conditions(filters, date_field=\"pe.posting_date\", customer_field=\"pe.party\")\r\n\r\n q = f\"\"\"\r\n SELECT\r\n pe.party AS customer,\r\n 'Payment Entry' AS doc_type,\r\n pe.name AS doc_no,\r\n pe.posting_date AS posting_date,\r\n pe.paid_from_account_currency AS currency,\r\n %(company_currency)s AS company_currency,\r\n pe.source_exchange_rate AS exchange_rate,\r\n NULL AS item_code,\r\n NULL AS item_name,\r\n 0 AS ordered_amount,\r\n 0 AS ordered_amount_company,\r\n (\r\n CASE\r\n WHEN pe.payment_type = 'Receive' THEN -per.allocated_amount\r\n WHEN pe.payment_type = 'Pay' THEN per.allocated_amount\r\n ELSE 0\r\n END\r\n ) AS received_amount,\r\n (\r\n CASE\r\n WHEN pe.payment_type = 'Receive' THEN -per.allocated_amount * IFNULL(pe.source_exchange_rate, 1)\r\n WHEN pe.payment_type = 'Pay' THEN per.allocated_amount * IFNULL(pe.source_exchange_rate, 1)\r\n ELSE 0\r\n END\r\n ) AS received_amount_company,\r\n 0 AS billed_amount,\r\n 0 AS billed_amount_company\r\n FROM `tabPayment Entry` pe\r\n INNER JOIN `tabPayment Entry Reference` per ON per.parent = pe.name\r\n WHERE pe.docstatus = 1\r\n AND pe.party_type = 'Customer'\r\n AND per.reference_doctype IN ('Sales Invoice')\r\n AND {conditions}\r\n \"\"\"\r\n values[\"company_currency\"] = company_currency\r\n return frappe.db.sql(q, values, as_dict=True)\r\n\r\n\r\ndef get_rows(filters):\r\n company = filters.get(\"company\") or frappe.defaults.get_user_default(\"Company\")\r\n company_currency = frappe.db.get_value(\"Company\", company, \"default_currency\")\r\n\r\n rows = []\r\n rows.extend(get_sales_order_rows(filters, company_currency))\r\n rows.extend(get_sales_invoice_rows(filters, company_currency))\r\n rows.extend(get_payment_rows(filters, company_currency))\r\n\r\n # Optional: sort by date then doc\r\n rows.sort(key=lambda r: (r.get(\"posting_date\") or \"\", r.get(\"doc_type\") or \"\", r.get(\"doc_no\") or \"\"))\r\n return rows\r\n\r\n\r\nvalidate_filters(filters)\r\n\r\ncolumns = get_columns(filters)\r\nrows = get_rows(filters)\r\n\r\nif filters.get(\"view\") == \"Grouped by Customer\":\r\n rows = group_by_customer(rows)\r\n\r\nfor r in rows:\r\n r[\"ordered_minus_received\"] = flt(r.get(\"ordered_amount\")) - flt(r.get(\"received_amount\"))\r\n r[\"ordered_minus_billed\"] = flt(r.get(\"ordered_amount\")) - flt(r.get(\"billed_amount\"))\r\n r[\"billed_minus_received\"] = flt(r.get(\"billed_amount\")) - flt(r.get(\"received_amount\"))\r\n\r\ndata = columns, rows\r\n", - "report_type": "Script Report", - "roles": [ - { - "role": "Accounts Manager" - }, - { - "role": "System Manager" - }, - { - "role": "Site Setup" - }, - { - "role": "Employee Self Service" - }, - { - "role": "Employee" - }, - { - "role": "Technical Team" - }, - { - "role": "AV Sales Admin" - } - ], - "timeout": 0 -} \ No newline at end of file diff --git a/csf_tz/csf_tz/report/sales_transaction_currency_recon/sales_transaction_currency_recon.py b/csf_tz/csf_tz/report/sales_transaction_currency_recon/sales_transaction_currency_recon.py deleted file mode 100644 index 7f6861f4..00000000 --- a/csf_tz/csf_tz/report/sales_transaction_currency_recon/sales_transaction_currency_recon.py +++ /dev/null @@ -1,406 +0,0 @@ -import frappe -from frappe.utils import flt - - -def execute(filters=None): - filters = frappe._dict(filters or {}) - validate_filters(filters) - - columns = get_columns(filters) - rows = get_rows(filters) - - if filters.get("view") == "Grouped by Customer": - rows = group_by_customer(rows) - - # Differences MUST ALWAYS be in company currency - for r in rows: - r["ordered_minus_received"] = flt(r.get("ordered_amount_company")) - flt(r.get("received_amount_company")) - r["ordered_minus_billed"] = flt(r.get("ordered_amount_company")) - flt(r.get("billed_amount_company")) - r["billed_minus_received"] = flt(r.get("billed_amount_company")) - flt(r.get("received_amount_company")) - - return columns, rows - - -def validate_filters(filters): - if not filters.get("from_date") or not filters.get("to_date"): - frappe.throw("From Date and To Date are required.") - - if filters.from_date > filters.to_date: - frappe.throw("From Date cannot be after To Date.") - - -def get_columns(filters): - currency_fields = [ - { - "label": "Ordered Amount (Txn)", - "fieldname": "ordered_amount", - "fieldtype": "Currency", - "options": "currency", - "width": 150, - }, - { - "label": "Ordered Amount (Company)", - "fieldname": "ordered_amount_company", - "fieldtype": "Currency", - "options": "company_currency", - "width": 170, - }, - { - "label": "Received Amount (Txn)", - "fieldname": "received_amount", - "fieldtype": "Currency", - "options": "currency", - "width": 150, - }, - { - "label": "Received Amount (Company)", - "fieldname": "received_amount_company", - "fieldtype": "Currency", - "options": "company_currency", - "width": 170, - }, - { - "label": "Billed Amount (Txn)", - "fieldname": "billed_amount", - "fieldtype": "Currency", - "options": "currency", - "width": 150, - }, - { - "label": "Billed Amount (Company)", - "fieldname": "billed_amount_company", - "fieldtype": "Currency", - "options": "company_currency", - "width": 170, - }, - - # IMPORTANT: Differences ALWAYS in company currency - { - "label": "Ordered - Received (Company)", - "fieldname": "ordered_minus_received", - "fieldtype": "Currency", - "options": "company_currency", - "width": 190, - }, - { - "label": "Ordered - Billed (Company)", - "fieldname": "ordered_minus_billed", - "fieldtype": "Currency", - "options": "company_currency", - "width": 190, - }, - { - "label": "Billed - Received (Company)", - "fieldname": "billed_minus_received", - "fieldtype": "Currency", - "options": "company_currency", - "width": 190, - }, - ] - - return [ - {"label": "Customer", "fieldname": "customer", "fieldtype": "Link", "options": "Customer", "width": 180}, - {"label": "Doc Type", "fieldname": "doc_type", "fieldtype": "Data", "width": 130}, - {"label": "Doc No", "fieldname": "doc_no", "fieldtype": "Dynamic Link", "options": "doc_type", "width": 180}, - {"label": "Status", "fieldname": "status", "fieldtype": "Data", "width": 110}, - {"label": "Date", "fieldname": "posting_date", "fieldtype": "Date", "width": 110}, - {"label": "Currency", "fieldname": "currency", "fieldtype": "Link", "options": "Currency", "width": 90}, - {"label": "Company Currency", "fieldname": "company_currency", "fieldtype": "Link", "options": "Currency", "width": 120}, - {"label": "Exchange Rate", "fieldname": "exchange_rate", "fieldtype": "Float", "width": 110}, - {"label": "Item Code", "fieldname": "item_code", "fieldtype": "Link", "options": "Item", "width": 140}, - {"label": "Item Name", "fieldname": "item_name", "fieldtype": "Data", "width": 220}, - *currency_fields, - ] - - -def get_rows(filters): - company = filters.get("company") or frappe.defaults.get_user_default("Company") - company_currency = frappe.get_cached_value("Company", company, "default_currency") - - rows = [] - - # Sales Order lines + tax row(s) - rows.extend(get_sales_order_rows(filters, company_currency)) - rows.extend(get_sales_order_tax_rows(filters, company_currency)) - - # Sales Invoice lines + tax row(s) - rows.extend(get_sales_invoice_rows(filters, company_currency)) - rows.extend(get_sales_invoice_tax_rows(filters, company_currency)) - - # Payments - rows.extend(get_payment_rows(filters, company_currency)) - - rows.sort(key=lambda r: (r.get("posting_date") or "", r.get("doc_type") or "", r.get("doc_no") or "")) - return rows - - -def get_sales_order_rows(filters, company_currency): - conditions, values = get_common_conditions( - filters, - date_field="so.transaction_date", - customer_field="so.customer", - company_field="so.company", - ) - - q = f""" - SELECT - so.customer AS customer, - 'Sales Order' AS doc_type, - so.name AS doc_no, - so.status AS status, - so.transaction_date AS posting_date, - so.currency AS currency, - %(company_currency)s AS company_currency, - so.conversion_rate AS exchange_rate, - soi.item_code AS item_code, - soi.item_name AS item_name, - - -- Ordered Amount (Txn) - CASE - WHEN so.status = 'Closed' - THEN soi.net_amount * (IFNULL(so.per_billed, 0) / 100) - ELSE soi.net_amount - END AS ordered_amount, - - -- Ordered Amount (Company) - CASE - WHEN so.status = 'Closed' - THEN soi.base_net_amount * (IFNULL(so.per_billed, 0) / 100) - ELSE soi.base_net_amount - END AS ordered_amount_company, - - 0 AS received_amount, - 0 AS received_amount_company, - 0 AS billed_amount, - 0 AS billed_amount_company - - FROM `tabSales Order` so - INNER JOIN `tabSales Order Item` soi ON soi.parent = so.name - WHERE so.docstatus = 1 - AND {conditions} - """ - values["company_currency"] = company_currency - return frappe.db.sql(q, values, as_dict=True) - - -def get_sales_order_tax_rows(filters, company_currency): - conditions, values = get_common_conditions( - filters, - date_field="so.transaction_date", - customer_field="so.customer", - company_field="so.company", - ) - - q = f""" - SELECT - so.customer AS customer, - 'Sales Order' AS doc_type, - so.name AS doc_no, - so.status AS status, - so.transaction_date AS posting_date, - so.currency AS currency, - %(company_currency)s AS company_currency, - so.conversion_rate AS exchange_rate, - NULL AS item_code, - 'TOTAL TAXES AND CHARGES' AS item_name, - - CASE - WHEN so.status = 'Closed' - THEN so.total_taxes_and_charges * (IFNULL(so.per_billed, 0) / 100) - ELSE so.total_taxes_and_charges - END AS ordered_amount, - - CASE - WHEN so.status = 'Closed' - THEN so.base_total_taxes_and_charges * (IFNULL(so.per_billed, 0) / 100) - ELSE so.base_total_taxes_and_charges - END AS ordered_amount_company, - - 0 AS received_amount, - 0 AS received_amount_company, - 0 AS billed_amount, - 0 AS billed_amount_company - - FROM `tabSales Order` so - WHERE so.docstatus = 1 - AND IFNULL(so.total_taxes_and_charges, 0) != 0 - AND {conditions} - """ - values["company_currency"] = company_currency - return frappe.db.sql(q, values, as_dict=True) - - -def get_sales_invoice_rows(filters, company_currency): - conditions, values = get_common_conditions( - filters, - date_field="si.posting_date", - customer_field="si.customer", - company_field="si.company", - ) - - q = f""" - SELECT - si.customer AS customer, - 'Sales Invoice' AS doc_type, - si.name AS doc_no, - si.status AS status, - si.posting_date AS posting_date, - si.currency AS currency, - %(company_currency)s AS company_currency, - si.conversion_rate AS exchange_rate, - sii.item_code AS item_code, - sii.item_name AS item_name, - 0 AS ordered_amount, - 0 AS ordered_amount_company, - 0 AS received_amount, - 0 AS received_amount_company, - sii.net_amount AS billed_amount, - sii.base_net_amount AS billed_amount_company - FROM `tabSales Invoice` si - INNER JOIN `tabSales Invoice Item` sii ON sii.parent = si.name - WHERE si.docstatus = 1 - AND {conditions} - """ - values["company_currency"] = company_currency - return frappe.db.sql(q, values, as_dict=True) - - -def get_sales_invoice_tax_rows(filters, company_currency): - """Adds tax row per Sales Invoice since payments clear debtors inclusive of tax.""" - conditions, values = get_common_conditions( - filters, - date_field="si.posting_date", - customer_field="si.customer", - company_field="si.company", - ) - - q = f""" - SELECT - si.customer AS customer, - 'Sales Invoice' AS doc_type, - si.name AS doc_no, - si.status AS status, - si.posting_date AS posting_date, - si.currency AS currency, - %(company_currency)s AS company_currency, - si.conversion_rate AS exchange_rate, - NULL AS item_code, - 'TOTAL TAXES AND CHARGES' AS item_name, - 0 AS ordered_amount, - 0 AS ordered_amount_company, - 0 AS received_amount, - 0 AS received_amount_company, - si.total_taxes_and_charges AS billed_amount, - si.base_total_taxes_and_charges AS billed_amount_company - FROM `tabSales Invoice` si - WHERE si.docstatus = 1 - AND IFNULL(si.total_taxes_and_charges, 0) != 0 - AND {conditions} - """ - values["company_currency"] = company_currency - return frappe.db.sql(q, values, as_dict=True) - - -def get_payment_rows(filters, company_currency): - conditions, values = get_common_conditions( - filters, - date_field="pe.posting_date", - customer_field="pe.party", - company_field="pe.company", - ) - - # IMPORTANT SIGN CHANGE: - # - Receive -> positive - # - Pay (refund) -> negative - q = f""" - SELECT - pe.party AS customer, - 'Payment Entry' AS doc_type, - pe.name AS doc_no, - pe.status AS status, - pe.posting_date AS posting_date, - pe.paid_from_account_currency AS currency, - %(company_currency)s AS company_currency, - pe.source_exchange_rate AS exchange_rate, - NULL AS item_code, - NULL AS item_name, - 0 AS ordered_amount, - 0 AS ordered_amount_company, - ( - CASE - WHEN pe.payment_type = 'Receive' THEN per.allocated_amount - WHEN pe.payment_type = 'Pay' THEN -per.allocated_amount - ELSE 0 - END - ) AS received_amount, - ( - CASE - WHEN pe.payment_type = 'Receive' THEN per.allocated_amount * IFNULL(pe.source_exchange_rate, 1) - WHEN pe.payment_type = 'Pay' THEN -per.allocated_amount * IFNULL(pe.source_exchange_rate, 1) - ELSE 0 - END - ) AS received_amount_company, - 0 AS billed_amount, - 0 AS billed_amount_company - FROM `tabPayment Entry` pe - INNER JOIN `tabPayment Entry Reference` per ON per.parent = pe.name - WHERE pe.docstatus = 1 - AND pe.party_type = 'Customer' - AND per.reference_doctype IN ('Sales Invoice') - AND {conditions} - """ - values["company_currency"] = company_currency - return frappe.db.sql(q, values, as_dict=True) - - -def get_common_conditions(filters, date_field, customer_field, company_field): - conditions = [f"{date_field} BETWEEN %(from_date)s AND %(to_date)s"] - values = { - "from_date": filters.from_date, - "to_date": filters.to_date, - } - - if filters.get("customer"): - conditions.append(f"{customer_field} = %(customer)s") - values["customer"] = filters.customer - - if filters.get("company"): - conditions.append(f"{company_field} = %(company)s") - values["company"] = filters.company - - return " AND ".join(conditions), values - - -def group_by_customer(rows): - grouped = {} - - for r in rows: - key = (r.get("customer") or "") - if key not in grouped: - grouped[key] = { - "customer": r.get("customer"), - "doc_type": "Grouped", - "doc_no": None, - "posting_date": None, - "currency": None, - "company_currency": r.get("company_currency"), - "exchange_rate": None, - "item_code": None, - "item_name": None, - "ordered_amount": 0, - "ordered_amount_company": 0, - "received_amount": 0, - "received_amount_company": 0, - "billed_amount": 0, - "billed_amount_company": 0, - } - - g = grouped[key] - g["ordered_amount"] += flt(r.get("ordered_amount")) - g["ordered_amount_company"] += flt(r.get("ordered_amount_company")) - g["received_amount"] += flt(r.get("received_amount")) - g["received_amount_company"] += flt(r.get("received_amount_company")) - g["billed_amount"] += flt(r.get("billed_amount")) - g["billed_amount_company"] += flt(r.get("billed_amount_company")) - - return list(grouped.values()) diff --git a/csf_tz/csf_tz/report/supplier_gl_entries_by_fiscal_year/__init__.py b/csf_tz/csf_tz/report/supplier_gl_entries_by_fiscal_year/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/csf_tz/report/supplier_gl_entries_by_fiscal_year/supplier_gl_entries_by_fiscal_year.js b/csf_tz/csf_tz/report/supplier_gl_entries_by_fiscal_year/supplier_gl_entries_by_fiscal_year.js deleted file mode 100644 index d89663d7..00000000 --- a/csf_tz/csf_tz/report/supplier_gl_entries_by_fiscal_year/supplier_gl_entries_by_fiscal_year.js +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) 2024, Aakvatech and contributors -// For license information, please see license.txt -/* eslint-disable */ - -frappe.query_reports["Supplier GL Entries by Fiscal Year"] = { - "filters": [ - { - fieldname: 'from_date', - label: __('From Date'), - fieldtype: 'Date', - mandatory: 1 - }, - { - fieldname: 'to_date', - label: __('To Date'), - fieldtype: 'Date', - mandatory: 1 - }, - { - fieldname: 'company', - label: __('Company'), - fieldtype: 'Link', - options: 'Company', - mandatory: 1 - } - - ] -}; diff --git a/csf_tz/csf_tz/report/supplier_gl_entries_by_fiscal_year/supplier_gl_entries_by_fiscal_year.json b/csf_tz/csf_tz/report/supplier_gl_entries_by_fiscal_year/supplier_gl_entries_by_fiscal_year.json deleted file mode 100644 index 24678727..00000000 --- a/csf_tz/csf_tz/report/supplier_gl_entries_by_fiscal_year/supplier_gl_entries_by_fiscal_year.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "add_total_row": 1, - "columns": [], - "creation": "2024-06-11 18:06:11.208415", - "disable_prepared_report": 0, - "disabled": 0, - "docstatus": 0, - "doctype": "Report", - "filters": [ - { - "fieldname": "from_date", - "fieldtype": "Date", - "label": "From Date", - "mandatory": 1, - "wildcard_filter": 0 - }, - { - "fieldname": "to_date", - "fieldtype": "Date", - "label": "To Date", - "mandatory": 1, - "wildcard_filter": 0 - } - ], - "idx": 0, - "is_standard": "Yes", - "letter_head": "", - "modified": "2024-06-11 18:06:11.208415", - "modified_by": "Administrator", - "module": "CSF TZ", - "name": "Supplier GL Entries by Fiscal Year", - "owner": "Administrator", - "prepared_report": 0, - "ref_doctype": "GL Entry", - "report_name": "Supplier GL Entries by Fiscal Year", - "report_script": "", - "report_type": "Script Report", - "roles": [ - { - "role": "Accounts User" - }, - { - "role": "Accounts Manager" - }, - { - "role": "Auditor" - } - ] -} \ No newline at end of file diff --git a/csf_tz/csf_tz/report/supplier_gl_entries_by_fiscal_year/supplier_gl_entries_by_fiscal_year.py b/csf_tz/csf_tz/report/supplier_gl_entries_by_fiscal_year/supplier_gl_entries_by_fiscal_year.py deleted file mode 100644 index 49742e35..00000000 --- a/csf_tz/csf_tz/report/supplier_gl_entries_by_fiscal_year/supplier_gl_entries_by_fiscal_year.py +++ /dev/null @@ -1,67 +0,0 @@ -# Copyright (c) 2024, Aakvatech and contributors -# For license information, please see license.txt - -import frappe -from frappe import _ - - -def execute(filters=None): - raw_data = get_data(filters) - fiscal_years = get_unique_fiscal_years(raw_data) - columns = get_columns(fiscal_years) - result_data = build_data(raw_data, fiscal_years) - return columns, result_data - -def get_unique_fiscal_years(raw_data): - # Extract unique fiscal years from raw data - return sorted(set(row['fiscal_year'] for row in raw_data)) - -def get_columns(fiscal_years): - # Build the columns dynamically based on unique fiscal years - columns = [_("Party") + ":Link/Supplier:120", _("Account") + ":Link/Account:120"] - columns.extend(_(year) + ":Currency:100" for year in fiscal_years) - return columns - -def get_data(filters): - # Fetch data from the database - results = frappe.db.sql(""" - SELECT - party, - account, - fiscal_year, - SUM(debit - credit) * -1 as balance - FROM - `tabGL Entry` - WHERE - party_type = "Supplier" - AND is_cancelled = 0 - AND posting_date BETWEEN %(from_date)s AND %(to_date)s AND company = %(company)s - GROUP BY - party, account, fiscal_year - """, filters, as_dict=True) - return results - -def build_data(raw_data, fiscal_years): - # Initialize a dictionary to store balances by party, account, and fiscal year - data_dict = {} - - # Populate the dictionary with balances - for row in raw_data: - party = row['party'] - account = row['account'] - fiscal_year = row['fiscal_year'] - balance = row['balance'] - - if (party, account) not in data_dict: - data_dict[(party, account)] = {fy: 0 for fy in fiscal_years} - - data_dict[(party, account)][fiscal_year] = balance - - # Convert the dictionary to a list of lists for the report - data = [] - for (party, account), balances in data_dict.items(): - row = [party, account] - row.extend(balances[fiscal_year] for fiscal_year in fiscal_years) - data.append(row) - - return data diff --git a/csf_tz/csf_tz/report/supplier_ledger_summary_multicurrency/__init__.py b/csf_tz/csf_tz/report/supplier_ledger_summary_multicurrency/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/csf_tz/report/supplier_ledger_summary_multicurrency/supplier_ledger_summary_multicurrency.js b/csf_tz/csf_tz/report/supplier_ledger_summary_multicurrency/supplier_ledger_summary_multicurrency.js deleted file mode 100644 index 18905e28..00000000 --- a/csf_tz/csf_tz/report/supplier_ledger_summary_multicurrency/supplier_ledger_summary_multicurrency.js +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright (c) 2016, Aakvatech and contributors -// For license information, please see license.txt -/* eslint-disable */ - -frappe.query_reports["Supplier Ledger Summary Multicurrency"] = { - "filters": [ - { - "fieldname":"company", - "label": __("Company"), - "fieldtype": "Link", - "options": "Company", - "default": frappe.defaults.get_user_default("Company") - }, - { - "fieldname":"from_date", - "label": __("From Date"), - "fieldtype": "Date", - "default": frappe.datetime.add_months(frappe.datetime.get_today(), -1), - "reqd": 1, - "width": "60px" - }, - { - "fieldname":"to_date", - "label": __("To Date"), - "fieldtype": "Date", - "default": frappe.datetime.get_today(), - "reqd": 1, - "width": "60px" - }, - { - "fieldname":"finance_book", - "label": __("Finance Book"), - "fieldtype": "Link", - "options": "Finance Book" - }, - { - "fieldname":"party", - "label": __("Supplier"), - "fieldtype": "Link", - "options": "Supplier", - on_change: () => { - var party = frappe.query_report.get_filter_value('party'); - if (party) { - frappe.db.get_value('Supplier', party, ["tax_id", "supplier_name"], function(value) { - frappe.query_report.set_filter_value('tax_id', value["tax_id"]); - frappe.query_report.set_filter_value('supplier_name', value["supplier_name"]); - }); - } else { - frappe.query_report.set_filter_value('tax_id', ""); - frappe.query_report.set_filter_value('supplier_name', ""); - } - } - }, - { - "fieldname":"supplier_group", - "label": __("Supplier Group"), - "fieldtype": "Link", - "options": "Supplier Group" - }, - { - "fieldname":"payment_terms_template", - "label": __("Payment Terms Template"), - "fieldtype": "Link", - "options": "Payment Terms Template" - }, - { - "fieldname":"territory", - "label": __("Territory"), - "fieldtype": "Link", - "options": "Territory" - }, - { - "fieldname":"sales_partner", - "label": __("Sales Partner"), - "fieldtype": "Link", - "options": "Sales Partner" - }, - { - "fieldname":"sales_person", - "label": __("Sales Person"), - "fieldtype": "Link", - "options": "Sales Person" - }, - { - "fieldname":"tax_id", - "label": __("Tax Id"), - "fieldtype": "Data", - "hidden": 1 - }, - { - "fieldname":"supplier_name", - "label": __("Supplier Name"), - "fieldtype": "Data", - "hidden": 1 - } - ] -}; diff --git a/csf_tz/csf_tz/report/supplier_ledger_summary_multicurrency/supplier_ledger_summary_multicurrency.json b/csf_tz/csf_tz/report/supplier_ledger_summary_multicurrency/supplier_ledger_summary_multicurrency.json deleted file mode 100644 index 2f5cfc6f..00000000 --- a/csf_tz/csf_tz/report/supplier_ledger_summary_multicurrency/supplier_ledger_summary_multicurrency.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "add_total_row": 1, - "columns": [], - "creation": "2022-02-10 02:53:10.255563", - "disable_prepared_report": 0, - "disabled": 0, - "docstatus": 0, - "doctype": "Report", - "filters": [], - "idx": 0, - "is_standard": "Yes", - "letter_head": "Letterhead Official", - "modified": "2022-02-10 02:53:10.255563", - "modified_by": "Administrator", - "module": "CSF TZ", - "name": "Supplier Ledger Summary Multicurrency", - "owner": "Administrator", - "prepared_report": 0, - "ref_doctype": "Purchase Invoice", - "report_name": "Supplier Ledger Summary Multicurrency", - "report_type": "Script Report", - "roles": [ - { - "role": "Accounts Manager" - }, - { - "role": "Accounts User" - } - ] -} \ No newline at end of file diff --git a/csf_tz/csf_tz/report/supplier_ledger_summary_multicurrency/supplier_ledger_summary_multicurrency.py b/csf_tz/csf_tz/report/supplier_ledger_summary_multicurrency/supplier_ledger_summary_multicurrency.py deleted file mode 100644 index 983b8ce1..00000000 --- a/csf_tz/csf_tz/report/supplier_ledger_summary_multicurrency/supplier_ledger_summary_multicurrency.py +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright (c) 2013, Aakvatech and contributors -# For license information, please see license.txt - -from csf_tz.csf_tz.report.customer_ledger_summary_multicurrency.customer_ledger_summary_multicurrency import ( - PartyLedgerSummaryReport, -) - - -def execute(filters=None): - args = { - "party_type": "Supplier", - "naming_by": ["Buying Settings", "supp_master_name"], - } - return PartyLedgerSummaryReport(filters).run(args) diff --git a/csf_tz/csf_tz/report/supplier_quotation_comparison_vertical/__init__.py b/csf_tz/csf_tz/report/supplier_quotation_comparison_vertical/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/csf_tz/report/supplier_quotation_comparison_vertical/supplier_quotation_comparison_vertical.html b/csf_tz/csf_tz/report/supplier_quotation_comparison_vertical/supplier_quotation_comparison_vertical.html deleted file mode 100644 index 198c775b..00000000 --- a/csf_tz/csf_tz/report/supplier_quotation_comparison_vertical/supplier_quotation_comparison_vertical.html +++ /dev/null @@ -1,257 +0,0 @@ -

Printed On {{ frappe.datetime.str_to_user(frappe.datetime.get_datetime_as_string()) }}

- -{% var supplierName = [] %} -{% var itemCode = [] %} -{% var total_by_supplier = {} %} -{% var vat_by_supplier = {} %} -{% var supplier_payment_terms = {} %} -{% var supplier_warranty = {} %} -{% var remarks_right = {} %} -{% var remarks_bottom = {} %} -{% var fix_supplier_name = '' %} - - -{% for (var i = 0, l = data.length; i < l; i++) { %} - {% var supplier_name = data[i]['supplier_name'] %} - {% var item_code = data[i]['item_code'] %} - - {% if (supplier_name !== "" ) { %} - {% fix_supplier_name = supplier_name %} - {% } %} - - {% if (data[i]['supplier_name'] === "" ) { %} - {% data[i]['supplier_name'] = fix_supplier_name %} - {% } %} - - {% if (!supplierName.includes(supplier_name) && supplier_name !== "" ) { %} - {% supplierName.push(supplier_name) %} - {% } %} - - {% if (!itemCode.includes(item_code)) { %} - {% itemCode.push(item_code) %} - {% } %} - - {% if (!supplier_payment_terms.hasOwnProperty(supplier_name)) { %} - {% supplier_payment_terms[supplier_name] = data[i]['terms'] %} - {% } %} - - {% if (!supplier_warranty.hasOwnProperty(supplier_name)) { %} - {% supplier_warranty[supplier_name] = data[i]['custom_warranty'] %} - {% } %} - - {% if (data[i]['custom_right'] !== "" ) { %} - {% if (!remarks_right.hasOwnProperty(data[i]['supplier_name'])) { %} - {% remarks_right[data[i]['supplier_name']] = data[i]['custom_right'] %} - {% } %} - {% } %} - - {% if (data[i]['custom_bottom'] !== "" ) { %} - {% if (!remarks_bottom.hasOwnProperty(data[i]['supplier_name'])) { %} - {% remarks_bottom[data[i]['supplier_name']] = data[i]['custom_bottom'] %} - {% } %} - {% } %} -{% } %} - -{% var first_right_remark = remarks_right[supplierName[0]] %} -{% var different_right_remarks = false %} - -{% for (var b = 0; b < supplierName.length; b++) { %} - {% if (remarks_right[supplierName[b]] === first_right_remark) { %} - {% different_right_remarks = true %} - {% break %} - {% } %} -{% } %} - -{% var first_bottom_remark = remarks_right[supplierName[0]] %} -{% var different_bottom_remarks = false %} - -{% for (var b = 0; b < supplierName.length; b++) { %} - {% if (remarks_right[supplierName[b]] === first_bottom_remark) { %} - {% different_bottom_remarks = true %} - {% break %} - {% } %} -{% } %} - -

COMPARISON SHEET

- - - - - - {% for (var i = 0, l = supplierName.length; i < l; i++) { %} - - {% } %} - - - - - {% for (var k = 0, l = supplierName.length; k < l; k++) { %} - - - - - {% } %} - - - - {% for (var z = 0, x = data.length; z < x; z++) { %} - {% var supplier_name = data[z]['supplier_name'] %} - {% var taxes_and_charges = data[z]['taxes_and_charges'] %} - {% if (total_by_supplier.hasOwnProperty(supplier_name)) { %} - {% total_by_supplier[supplier_name] += data[z]['price'] %} - {% } else { %} - {% total_by_supplier[supplier_name] = data[z]['price'] %} - {% if(taxes_and_charges == "Tanzania Tax - KSL"){ %} - {% vat_by_supplier[supplier_name] = true %} - {% } %} - - {% } %} - {% } %} - - {% for (var k = 0, n = itemCode.length; k < n; k++) { %} - - - {% for (var x = 0, p = supplierName.length; x < p; x++) { %} - {% var sortedData = data.filter(f => f.supplier_name === supplierName[x] && f.item_code === itemCode[k]) %} - {% if (sortedData.length > 0) { %} - {% if (sortedData.length > 1) { %} - - - - - {% } else { %} - - - - - {% } %} - {% } else { %} - - - - - {% } %} - {% } %} - - {% if ((k + 1) == n) { %} - - {% } else { %} - - {% } %} - - {% } %} - - - - {% for (var m = 0; m < supplierName.length; m++) { %} - - {% } %} - - - - - {% for (var m = 0; m < supplierName.length; m++) { %} - - {% } %} - - - - - {% for (var m = 0; m < supplierName.length; m++) { %} - - {% } %} - - - - - {% for (var m = 0; m < supplierName.length; m++) { %} - -{% } %} - - - - - {% for (var m = 0; m < supplierName.length; m++) { %} - - {% } %} - - - - - - - - - - - - - - - - - - - - - - - - - -
Supplier{{ supplierName[i] }}REMARKS
Item CodeUOMQtyRateAmount
{{ itemCode[k] }} - {% for (var i = 0, l = sortedData.length; i < l; i++) { %} -
{{ sortedData[i]['uom'] }}

- {% } %} -
- {% for (var i = 0, l = sortedData.length; i < l; i++) { %} -
{{ sortedData[i]['qty'] }}

- {% } %} -
- {% for (var i = 0, l = sortedData.length; i < l; i++) { %} -
{{ (sortedData[i]['price_per_unit']).toLocaleString('en-TZ', {style: 'currency', currency: 'TZS'}) }}

- {% } %} -
- {% for (var i = 0, l = sortedData.length; i < l; i++) { %} -
{{ (sortedData[i]['price']).toLocaleString('en-TZ', {style: 'currency', currency: 'TZS'}) }}

- {% } %} -
{{ sortedData[0]['uom'] }}{{ sortedData[0]['qty'] }}{{ sortedData[0]['price_per_unit'] }}{{ sortedData[0]['price'] }} - {% if (different_right_remarks) { %} - {% for (var d = 0, h = supplierName.length; d < h; d++) { %} - {{ remarks_right[supplierName[d]] }}
- {% } %} - {% } else { %} - {{ remarks_right[supplierName[0]] }}
- {% } %} -
PAYMENT TERMS - {{ supplier_payment_terms[supplierName[m]] }} -
WARRANTY - {{ supplier_warranty[supplierName[m]] }} -
TOTAL - {% const formattedMoney = ((total_by_supplier[supplierName[m]])).toLocaleString('en-TZ', {style: 'currency', currency: 'TZS'}) %} - {{ formattedMoney }} -
VAT 18% - {% if (vat_by_supplier[supplierName[m]]){ %} - {% const vatRate = 0.18 %} - {% const vatAmount = total_by_supplier[supplierName[m]] * vatRate %} - {% const formattedMoney = vatAmount.toLocaleString('en-TZ', {style: 'currency', currency: 'TZS'}) %} - {{ formattedMoney }} - {% }else{ %} - {% } %} -
GRAND TOTAL - {% if vat_by_supplier[supplierName[m]] %} - {% const formattedMoney = ((total_by_supplier[supplierName[m]] + (total_by_supplier[supplierName[m]] * 0.18))).toLocaleString('en-TZ', {style: 'currency', currency: 'TZS'}) %} - {{ formattedMoney }} - {% else %} - {% const formattedMoney = total_by_supplier[supplierName[m]].toLocaleString('en-TZ', {style: 'currency', currency: 'TZS'}) %} - {{ formattedMoney }} - {% endif %} -
REMARKS - {% if (different_bottom_remarks) { %} - {% for (var d = 0, h = supplierName.length; d < h; d++) { %} - {{ remarks_bottom[supplierName[d]] }}
- {% } %} - {% } else { %} - {{ remarks_bottom[supplierName[0]] }}
- {% } %} -
PREPARED BYCHECKED BYAUTHORISED BY
Name:Name:Name:
Signature:Signature:Signature:
diff --git a/csf_tz/csf_tz/report/supplier_quotation_comparison_vertical/supplier_quotation_comparison_vertical.js b/csf_tz/csf_tz/report/supplier_quotation_comparison_vertical/supplier_quotation_comparison_vertical.js deleted file mode 100644 index d7d135f8..00000000 --- a/csf_tz/csf_tz/report/supplier_quotation_comparison_vertical/supplier_quotation_comparison_vertical.js +++ /dev/null @@ -1,178 +0,0 @@ -// Copyright (c) 2023, Aakvatech and contributors -// For license information, please see license.txt -/* eslint-disable */ - -frappe.query_reports["Supplier Quotation Comparison Vertical"] = { - filters: [ - { - fieldtype: "Link", - label: __("Company"), - options: "Company", - fieldname: "company", - default: frappe.defaults.get_user_default("Company"), - "reqd": 1 - }, - { - "fieldname": "from_date", - "label": __("From Date"), - "fieldtype": "Date", - "width": "80", - "reqd": 1, - "default": frappe.datetime.add_months(frappe.datetime.get_today(), -1), - }, - { - "fieldname": "to_date", - "label": __("To Date"), - "fieldtype": "Date", - "width": "80", - "reqd": 1, - "default": frappe.datetime.get_today() - }, - { - default: "", - options: "Item", - label: __("Item"), - fieldname: "item_code", - fieldtype: "Link", - get_query: () => { - let quote = frappe.query_report.get_filter_value('supplier_quotation'); - if (quote != "") { - return { - query: "erpnext.stock.doctype.quality_inspection.quality_inspection.item_query", - filters: { - "from": "Supplier Quotation Item", - "parent": quote - } - } - } - else { - return { - filters: { "disabled": 0 } - } - } - } - }, - { - fieldname: "supplier", - label: __("Supplier"), - fieldtype: "MultiSelectList", - get_data: function (txt) { - return frappe.db.get_link_options('Supplier', txt); - } - }, - { - fieldtype: "MultiSelectList", - label: __("Supplier Quotation"), - fieldname: "supplier_quotation", - default: "", - get_data: function (txt) { - return frappe.db.get_link_options('Supplier Quotation', txt, { 'docstatus': ["<", 2] }); - } - }, - { - fieldtype: "Link", - label: __("Request for Quotation"), - options: "Request for Quotation", - fieldname: "request_for_quotation", - default: "", - get_query: () => { - return { filters: { "docstatus": ["<", 2] } } - } - }, - { - "fieldname": "group_by", - "label": __("Group by"), - "fieldtype": "Select", - "options": [__("Group by Supplier")], - "default": __("Group by Supplier") - }, - { - fieldtype: "Check", - label: __("Include Expired"), - fieldname: "include_expired", - default: 0 - } - ], - - formatter: (value, row, column, data, default_formatter) => { - value = default_formatter(value, row, column, data); - - if (column.fieldname === "valid_till" && data.valid_till) { - if (frappe.datetime.get_diff(data.valid_till, frappe.datetime.nowdate()) <= 1) { - value = `
${value}
`; - } - else if (frappe.datetime.get_diff(data.valid_till, frappe.datetime.nowdate()) <= 7) { - value = `
${value}
`; - } - } - - if (column.fieldname === "price_per_unit" && data.price_per_unit && data.min && data.min === 1) { - value = `
${value}
`; - } - return value; - }, - - onload: (report) => { - // Create a button for setting the default supplier - report.page.add_inner_button(__("Select Default Supplier"), () => { - let reporter = frappe.query_reports["Supplier Quotation Comparison"]; - - //Always make a new one so that the latest values get updated - reporter.make_default_supplier_dialog(report); - }, __("Tools")); - - }, - make_default_supplier_dialog: (report) => { - // Get the name of the item to change - if (!report.data) return; - - let filters = report.get_values(); - let item_code = filters.item_code; - - // Get a list of the suppliers (with a blank as well) for the user to select - let suppliers = $.map(report.data, (row, idx) => { return row.supplier_name }) - - // Create a dialog window for the user to pick their supplier - let dialog = new frappe.ui.Dialog({ - title: __('Select Default Supplier'), - fields: [ - { - reqd: 1, - label: 'Supplier', - fieldtype: 'Link', - options: 'Supplier', - fieldname: 'supplier', - get_query: () => { - return { - filters: { - 'name': ['in', suppliers] - } - } - } - } - ] - }); - - dialog.set_primary_action(__("Set Default Supplier"), () => { - let values = dialog.get_values(); - if (values) { - // Set the default_supplier field of the appropriate Item to the selected supplier - frappe.call({ - method: "frappe.client.set_value", - args: { - doctype: "Item", - name: item_code, - fieldname: "default_supplier", - value: values.supplier, - }, - freeze: true, - callback: (r) => { - frappe.msgprint(__("Successfully Set Supplier")); - dialog.hide(); - } - }); - } - }); - dialog.show(); - } -}; diff --git a/csf_tz/csf_tz/report/supplier_quotation_comparison_vertical/supplier_quotation_comparison_vertical.json b/csf_tz/csf_tz/report/supplier_quotation_comparison_vertical/supplier_quotation_comparison_vertical.json deleted file mode 100644 index 2b3993b2..00000000 --- a/csf_tz/csf_tz/report/supplier_quotation_comparison_vertical/supplier_quotation_comparison_vertical.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "add_total_row": 0, - "columns": [], - "creation": "2023-08-31 11:19:38.802928", - "disable_prepared_report": 0, - "disabled": 0, - "docstatus": 0, - "doctype": "Report", - "filters": [], - "idx": 0, - "is_standard": "Yes", - "letter_head": "Horizon", - "modified": "2023-08-31 11:19:38.802928", - "modified_by": "Administrator", - "module": "CSF TZ", - "name": "Supplier Quotation Comparison Vertical", - "owner": "Administrator", - "prepared_report": 0, - "ref_doctype": "Supplier Quotation", - "report_name": "Supplier Quotation Comparison Vertical", - "report_type": "Script Report", - "roles": [ - { - "role": "Sales Manager" - }, - { - "role": "Catalog Service" - }, - { - "role": "Projects User" - }, - { - "role": "Purchase User" - } - ] -} \ No newline at end of file diff --git a/csf_tz/csf_tz/report/supplier_quotation_comparison_vertical/supplier_quotation_comparison_vertical.py b/csf_tz/csf_tz/report/supplier_quotation_comparison_vertical/supplier_quotation_comparison_vertical.py deleted file mode 100644 index c2dde2ce..00000000 --- a/csf_tz/csf_tz/report/supplier_quotation_comparison_vertical/supplier_quotation_comparison_vertical.py +++ /dev/null @@ -1,301 +0,0 @@ -# Copyright (c) 2023, Aakvatech and contributors -# For license information, please see license.txt - -from collections import defaultdict - -import frappe -from frappe import _ -from frappe.utils import cint, flt - -from erpnext.setup.utils import get_exchange_rate - - -def execute(filters=None): - if not filters: - return [], [] - - columns = get_columns(filters) - supplier_quotation_data = get_data(filters) - - data, chart_data = prepare_data(supplier_quotation_data, filters) - message = get_message() - - return columns, data, message, chart_data - - -def get_data(filters): - sq = frappe.qb.DocType("Supplier Quotation") - sq_item = frappe.qb.DocType("Supplier Quotation Item") - - query = ( - frappe.qb.from_(sq_item) - .from_(sq) - .select( - sq_item.parent, - sq_item.item_code, - sq_item.qty, - sq_item.stock_qty, - sq_item.amount, - sq_item.uom, - sq_item.stock_uom, - sq_item.request_for_quotation, - sq_item.lead_time_days, - sq.supplier.as_("supplier_name"), - sq.valid_till, - sq.terms, - sq.taxes_and_charges, - sq.custom_warranty, - sq.custom_bottom, - sq.custom_right, - ) - .where( - (sq_item.parent == sq.name) - & (sq_item.docstatus < 2) - & (sq.company == filters.get("company")) - & ( - sq.transaction_date.between( - filters.get("from_date"), filters.get("to_date") - ) - ) - ) - .orderby(sq.transaction_date, sq_item.item_code) - ) - - if filters.get("item_code"): - query = query.where(sq_item.item_code == filters.get("item_code")) - - if filters.get("supplier_quotation"): - query = query.where(sq_item.parent.isin(filters.get("supplier_quotation"))) - - if filters.get("request_for_quotation"): - query = query.where( - sq_item.request_for_quotation == filters.get("request_for_quotation") - ) - - if filters.get("supplier"): - query = query.where(sq.supplier.isin(filters.get("supplier"))) - - if not filters.get("include_expired"): - query = query.where(sq.status != "Expired") - - supplier_quotation_data = query.run(as_dict=True) - - return supplier_quotation_data - - -def prepare_data(supplier_quotation_data, filters): - out, groups, qty_list, suppliers, chart_data = [], [], [], [], [] - group_wise_map = defaultdict(list) - supplier_qty_price_map = {} - - group_by_field = ( - "supplier_name" - if filters.get("group_by") == "Group by Supplier" - else "item_code" - ) - company_currency = frappe.db.get_default("currency") - float_precision = cint(frappe.db.get_default("float_precision")) or 2 - - for data in supplier_quotation_data: - group = data.get(group_by_field) # get item or supplier value for this row - - supplier_currency = frappe.db.get_value( - "Supplier", data.get("supplier_name"), "default_currency" - ) - - if supplier_currency: - exchange_rate = get_exchange_rate(supplier_currency, company_currency) - else: - exchange_rate = 1 - - row = { - "item_code": "" - if group_by_field == "item_code" - else data.get("item_code"), # leave blank if group by field - "supplier_name": "" - if group_by_field == "supplier_name" - else data.get("supplier_name"), - "quotation": data.get("parent"), - "qty": data.get("qty"), - "price": flt(data.get("amount") * exchange_rate, float_precision), - "uom": data.get("uom"), - "stock_uom": data.get("stock_uom"), - "request_for_quotation": data.get("request_for_quotation"), - "valid_till": data.get("valid_till"), - "lead_time_days": data.get("lead_time_days"), - "terms": data.get("terms"), - "custom_warranty": data.get("custom_warranty"), - "custom_bottom": data.get("custom_bottom"), - "custom_right": data.get("custom_right"), - "taxes_and_charges": data.get("taxes_and_charges"), - } - row["price_per_unit"] = flt(row["price"]) / (flt(data.get("stock_qty")) or 1) - - # map for report view of form {'supplier1'/'item1':[{},{},...]} - group_wise_map[group].append(row) - - # map for chart preparation of the form {'supplier1': {'qty': 'price'}} - supplier = data.get("supplier_name") - if filters.get("item_code"): - if not supplier in supplier_qty_price_map: - supplier_qty_price_map[supplier] = {} - supplier_qty_price_map[supplier][row["qty"]] = row["price"] - - groups.append(group) - suppliers.append(supplier) - qty_list.append(data.get("qty")) - - groups = list(set(groups)) - suppliers = list(set(suppliers)) - qty_list = list(set(qty_list)) - - highlight_min_price = group_by_field == "item_code" or filters.get("item_code") - - # final data format for report view - for group in groups: - group_entries = group_wise_map[group] # all entries pertaining to item/supplier - group_entries[0].update( - {group_by_field: group} - ) # Add item/supplier name in first group row - - if highlight_min_price: - prices = [group_entry["price_per_unit"] for group_entry in group_entries] - min_price = min(prices) - - for entry in group_entries: - if highlight_min_price and entry["price_per_unit"] == min_price: - entry["min"] = 1 - out.append(entry) - - if filters.get("item_code"): - # render chart only for one item comparison - chart_data = prepare_chart_data(suppliers, qty_list, supplier_qty_price_map) - - return out, chart_data - - -def prepare_chart_data(suppliers, qty_list, supplier_qty_price_map): - data_points_map = {} - qty_list.sort() - - # create qty wise values map of the form {'qty1':[value1, value2]} - for supplier in suppliers: - entry = supplier_qty_price_map[supplier] - for qty in qty_list: - if not qty in data_points_map: - data_points_map[qty] = [] - if qty in entry: - data_points_map[qty].append(entry[qty]) - else: - data_points_map[qty].append(None) - - dataset = [] - currency_symbol = frappe.db.get_value( - "Currency", frappe.db.get_default("currency"), "symbol" - ) - for qty in qty_list: - datapoints = { - "name": currency_symbol + " (Qty " + str(qty) + " )", - "values": data_points_map[qty], - } - dataset.append(datapoints) - - chart_data = {"data": {"labels": suppliers, "datasets": dataset}, "type": "bar"} - - return chart_data - - -def get_columns(filters): - group_by_columns = [ - { - "fieldname": "supplier_name", - "label": _("Supplier"), - "fieldtype": "Link", - "options": "Supplier", - "width": 150, - }, - { - "fieldname": "item_code", - "label": _("Item"), - "fieldtype": "Link", - "options": "Item", - "width": 150, - }, - ] - - columns = [ - { - "fieldname": "uom", - "label": _("UOM"), - "fieldtype": "Link", - "options": "UOM", - "width": 90, - }, - {"fieldname": "qty", "label": _("Quantity"), "fieldtype": "Float", "width": 80}, - { - "fieldname": "price", - "label": _("Price"), - "fieldtype": "Currency", - "options": "Company:company:default_currency", - "width": 110, - }, - { - "fieldname": "stock_uom", - "label": _("Stock UOM"), - "fieldtype": "Link", - "options": "UOM", - "width": 90, - }, - { - "fieldname": "price_per_unit", - "label": _("Price per Unit (Stock UOM)"), - "fieldtype": "Currency", - "options": "Company:company:default_currency", - "width": 120, - }, - { - "fieldname": "quotation", - "label": _("Supplier Quotation"), - "fieldtype": "Link", - "options": "Supplier Quotation", - "width": 200, - }, - { - "fieldname": "valid_till", - "label": _("Valid Till"), - "fieldtype": "Date", - "width": 100, - }, - { - "fieldname": "lead_time_days", - "label": _("Lead Time (Days)"), - "fieldtype": "Int", - "width": 100, - }, - { - "fieldname": "request_for_quotation", - "label": _("Request for Quotation"), - "fieldtype": "Link", - "options": "Request for Quotation", - "width": 150, - }, - ] - - if filters.get("group_by") == "Group by Item": - group_by_columns.reverse() - - columns[0:0] = group_by_columns # add positioned group by columns to the report - return columns - - -def get_message(): - return """ - Valid till :    - - - Expires in a week or less - -    - - Expires today / Already Expired - """ diff --git a/csf_tz/csftz_hooks/custom_docperm.py b/csf_tz/csftz_hooks/custom_docperm.py deleted file mode 100644 index 054df43b..00000000 --- a/csf_tz/csftz_hooks/custom_docperm.py +++ /dev/null @@ -1,66 +0,0 @@ -import frappe -from frappe import _ -from frappe.utils.csvutils import getlink -from frappe.model import core_doctypes_list - -# List of excluded doctypes -excluded_doctype_list = ["Address", "Contact"] - -def grant_dependant_access(doc, method): - if frappe.flags.in_install or frappe.flags.in_migrate: - return - enable_dependent_auto_permission = frappe.db.get_single_value( - "CSF TZ Settings", "enable_dependent_auto_permission" - ) - if not enable_dependent_auto_permission: - return - if doc.dependent: - frappe.msgprint( - _( - "Warning! {0} is a dependant doctype. If you wish to change access to it, remove it and add again." - ).format(getlink("DocType", doc.parent)) - ) - return - fields = frappe.get_meta(doc.parent).fields - doctypes_granted_access = [] - for field in fields: - if field.get("fieldtype") in ["Link"]: - if create_custom_docperm(field.options, doc.role, doc.parent): - doctypes_granted_access += [field.options] - if field.get("fieldtype") in ["Table"]: - child_fields = frappe.get_meta(field.options).fields - for child_field in child_fields: - if child_field.get("fieldtype") in ["Link"]: - if create_custom_docperm(child_field.options, doc.role, doc.parent): - doctypes_granted_access += [child_field.options] - - if len(doctypes_granted_access) > 0: - frappe.msgprint( - _( - "Auto granted SELECT access to the following doctypes: " - + str(doctypes_granted_access) - ) - ) - -def create_custom_docperm(doctype, role, parent): - # Return if doctype is in the excluded list - if doctype in excluded_doctype_list: - return - - if doctype == parent or doctype in core_doctypes_list: - return - is_permission_exists = frappe.get_all( - "Custom DocPerm", filters={"parent": doctype, "role": role} - ) - if len(is_permission_exists) > 0: - return False - custom_docperm = frappe.new_doc("Custom DocPerm") - custom_docperm.parent = doctype - custom_docperm.role = role - custom_docperm.permlevel = 0 - custom_docperm.select = 1 - custom_docperm.read = 0 - custom_docperm.export = 0 - custom_docperm.dependent = 1 - custom_docperm.save() - return True diff --git a/csf_tz/csftz_hooks/payroll.py b/csf_tz/csftz_hooks/payroll.py index 51826de2..fb836969 100644 --- a/csf_tz/csftz_hooks/payroll.py +++ b/csf_tz/csftz_hooks/payroll.py @@ -310,95 +310,6 @@ def enqueue_apply_workflow_for_salary_slips(kwargs): continue -@frappe.whitelist() -def generate_component_in_salary_slip_update(doc, method): - if not doc.name.upper().startswith("NEW") and frappe.db.get_single_value( - "CSF TZ Settings", "ot_module" - ): - base = 0 - list = [] - - for component in doc.earnings: - if str(component.salary_component).upper() == "BASIC": - base = component.amount / doc.payment_days * doc.total_working_days - list.append(component) - if base == 0: - f"Basic Component not Found on this Salary Slip: {doc.name}" - - for component in doc.salary_slip_ot_component: - earning_dict = frappe.new_doc("Salary Detail") - earning_dict.parent = doc.name - earning_dict.parenttype = doc.doctype - earning_dict.parentfield = "earnings" - earning_dict.salary_component = component.salary_component - earning_dict.amount = calculate_amount( - base, component.no_of_hours, component.salary_component - ) - list.append(earning_dict) - - doc.earnings = [] - doc.earnings.extend(list) - doc.calculate_net_pay() - - -@frappe.whitelist() -def generate_component_in_salary_slip_insert(doc, method): - if frappe.db.get_single_value("CSF TZ Settings", "ot_module"): - doc.salary_slip_ot_component = [] - employee = frappe.get_doc("Employee", doc.employee) - doc.run_method("get_emp_and_leave_details") - base = 0 - list = [] - for component in doc.earnings: - if str(component.salary_component).upper() == "BASIC": - base = component.amount / doc.payment_days * doc.total_working_days - list.append(component) - if base == 0: - frappe.throw( - f"Basic Component not Found on this Salary Slip: {doc.name}" - ) - - for component in employee.employee_ot_component: - component.doctype = "Salary Slip OT Component" - component.parentfield = "salary_slip_ot_component" - doc.salary_slip_ot_component.append(component) - - earning_dict = frappe.new_doc("Salary Detail") - earning_dict.parent = doc.name - earning_dict.parenttype = doc.doctype - earning_dict.parentfield = "earnings" - earning_dict.salary_component = component.salary_component - earning_dict.amount = calculate_amount( - base, component.no_of_hours, component.salary_component - ) - list.append(earning_dict) - - doc.earnings = [] - doc.earnings.extend(list) - doc.calculate_net_pay() - - -@frappe.whitelist() -def calculate_amount(base, no_of_hours, salary_component): - working_hours_per_month = frappe.db.get_single_value( - "CSF TZ Settings", "working_hours_per_month" - ) - based_on_hourly_rate, hourly_rate = frappe.db.get_value( - "Salary Component", salary_component, ["based_on_hourly_rate", "hourly_rate"] - ) - if based_on_hourly_rate: - calc = ( - (flt(base) / flt(working_hours_per_month)) - * flt(no_of_hours) - * (flt(hourly_rate) / 100) - ) - return calc - else: - frappe.throw( - f"Hourly Rate not set on this Salary Component: {salary_component}, Please set it and try again." - ) - - @frappe.whitelist() def get_amounts_summary(payroll_entry): summary = { diff --git a/csf_tz/custom_api.py b/csf_tz/custom_api.py index 8b44bacf..337a6352 100644 --- a/csf_tz/custom_api.py +++ b/csf_tz/custom_api.py @@ -1749,23 +1749,6 @@ def make_withholding_tax_gl_entries_for_sales(doc, method): frappe.msgprint(_(si_msgprint)) -# Email Salary Slip -@frappe.whitelist() -def get_payroll_employees(payroll_entry): - employees = frappe.db.sql( - f""" SELECT employee FROM `tabPayroll Employee Detail` WHERE parent='{payroll_entry}' """, - as_dict=True, - ) - return employees - - -@frappe.whitelist() -def validate_payroll_entry_field(payroll_entry): - payroll_entry = frappe.get_doc("Payroll Entry", payroll_entry) - if payroll_entry.docstatus != 1: - return False - - def auto_close_dn(): """ Mark delivery note as closed per customer, depending on the days specified on customer @@ -2729,39 +2712,6 @@ def make_salary_components_and_structure(abbr ): frappe.msgprint('Salary Components and Structure are already created.') -def target_warehouse_based_price_list(doc, method): - check = frappe.db.get_single_value( - "CSF TZ Settings", "target_warehouse_based_price_list" - ) - if check: - for item in doc.items: - if item.item_code is None or item.warehouse is None: - frappe.throw( - f"Both Item Code {item.item_code} and Warehouse {item.warehouse} are required." - ) - price_list = frappe.db.get_value( - "Dynamic Price List Assignment", - {"supplier": doc.supplier, "warehouse": item.warehouse}, - "price_list", - ) - if not price_list: - frappe.throw( - f"Price List not found. Please create one in Dynamic Price List Assignment for Supplier {doc.supplier} and Warehouse {item.warehouse}" - ) - - rate = frappe.db.get_value( - "Item Price", - {"item_code": item.item_code, "price_list": price_list}, - "price_list_rate", - ) - if not rate: - frappe.throw( - f"Price List not found for Item {item.item_code}. Please create one." - ) - item.price_list_rate = rate - item.rate = rate - item.amount = item.qty * rate - @frappe.whitelist() def get_item_prices_custom_po(filters=None, start=0, limit=20): if isinstance(filters, str): # If filters is a string, deserialize it diff --git a/csf_tz/feedback/__init__.py b/csf_tz/feedback/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/feedback/doctype/__init__.py b/csf_tz/feedback/doctype/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/feedback/doctype/feedback_form/__init__.py b/csf_tz/feedback/doctype/feedback_form/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/feedback/doctype/feedback_form/feedback_form.js b/csf_tz/feedback/doctype/feedback_form/feedback_form.js deleted file mode 100644 index a2950326..00000000 --- a/csf_tz/feedback/doctype/feedback_form/feedback_form.js +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright (c) 2025, Aakvatech and contributors -// For license information, please see license.txt - -// frappe.ui.form.on("Feedback Form", { -// refresh(frm) { - -// }, -// }); diff --git a/csf_tz/feedback/doctype/feedback_form/feedback_form.json b/csf_tz/feedback/doctype/feedback_form/feedback_form.json deleted file mode 100644 index 8cb34fb8..00000000 --- a/csf_tz/feedback/doctype/feedback_form/feedback_form.json +++ /dev/null @@ -1,104 +0,0 @@ -{ - "actions": [], - "allow_rename": 1, - "autoname": "format:Feedback-{DD}-{MM}-{YY}-{####}", - "creation": "2025-07-07 21:41:09.616396", - "doctype": "DocType", - "engine": "InnoDB", - "field_order": [ - "template", - "section_break_gfnv", - "participant_name", - "column_break_wncp", - "designation", - "column_break_ldsy", - "contact_no", - "section_break_itfe", - "responses", - "dynamic_questions", - "dynamic_html" - ], - "fields": [ - { - "fieldname": "template", - "fieldtype": "Link", - "label": "Template", - "options": "Feedback Template" - }, - { - "fieldname": "participant_name", - "fieldtype": "Data", - "label": "Participant Name" - }, - { - "fieldname": "responses", - "fieldtype": "Table", - "label": "Responses", - "options": "Feedback Response" - }, - { - "fieldname": "dynamic_questions", - "fieldtype": "HTML", - "label": "Dynamic Questions" - }, - { - "fieldname": "section_break_gfnv", - "fieldtype": "Section Break" - }, - { - "fieldname": "designation", - "fieldtype": "Data", - "label": "Designation" - }, - { - "fieldname": "contact_no", - "fieldtype": "Data", - "label": "Contact No" - }, - { - "fieldname": "section_break_itfe", - "fieldtype": "Section Break" - }, - { - "fieldname": "column_break_wncp", - "fieldtype": "Column Break" - }, - { - "fieldname": "column_break_ldsy", - "fieldtype": "Column Break" - }, - { - "fieldname": "dynamic_html", - "fieldtype": "Data", - "hidden": 1, - "label": "Dynamic HTML" - } - ], - "grid_page_length": 50, - "index_web_pages_for_search": 1, - "links": [], - "modified": "2025-09-19 16:41:16.429427", - "modified_by": "Administrator", - "module": "Feedback", - "name": "Feedback Form", - "naming_rule": "Expression", - "owner": "Administrator", - "permissions": [ - { - "create": 1, - "delete": 1, - "email": 1, - "export": 1, - "print": 1, - "read": 1, - "report": 1, - "role": "System Manager", - "share": 1, - "write": 1 - } - ], - "row_format": "Dynamic", - "sort_field": "modified", - "sort_order": "DESC", - "states": [] -} \ No newline at end of file diff --git a/csf_tz/feedback/doctype/feedback_form/feedback_form.py b/csf_tz/feedback/doctype/feedback_form/feedback_form.py deleted file mode 100644 index 0f766d6c..00000000 --- a/csf_tz/feedback/doctype/feedback_form/feedback_form.py +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (c) 2025, Aakvatech and contributors -# For license information, please see license.txt - -# import frappe -from frappe.model.document import Document - - -class FeedbackForm(Document): - pass diff --git a/csf_tz/feedback/doctype/feedback_form/test_feedback_form.py b/csf_tz/feedback/doctype/feedback_form/test_feedback_form.py deleted file mode 100644 index c7c0eb5c..00000000 --- a/csf_tz/feedback/doctype/feedback_form/test_feedback_form.py +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (c) 2025, Aakvatech and Contributors -# See license.txt - -# import frappe -from frappe.tests.utils import FrappeTestCase - - -class TestFeedbackForm(FrappeTestCase): - pass diff --git a/csf_tz/feedback/doctype/feedback_question/__init__.py b/csf_tz/feedback/doctype/feedback_question/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/feedback/doctype/feedback_question/feedback_question.json b/csf_tz/feedback/doctype/feedback_question/feedback_question.json deleted file mode 100644 index 7569ac42..00000000 --- a/csf_tz/feedback/doctype/feedback_question/feedback_question.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "actions": [], - "allow_rename": 1, - "creation": "2025-07-07 21:28:50.496524", - "doctype": "DocType", - "editable_grid": 1, - "engine": "InnoDB", - "field_order": [ - "question", - "fieldtype", - "options", - "reqd" - ], - "fields": [ - { - "columns": 2, - "fieldname": "question", - "fieldtype": "Small Text", - "in_list_view": 1, - "label": "Question", - "reqd": 1 - }, - { - "columns": 1, - "fieldname": "fieldtype", - "fieldtype": "Select", - "in_list_view": 1, - "label": "Fieldtype", - "options": "\nMultiple Choice\nCheckboxes\nDropdown\nRating\nParagraph\nShort Text", - "reqd": 1 - }, - { - "columns": 3, - "fieldname": "options", - "fieldtype": "Text", - "in_list_view": 1, - "label": "Options" - }, - { - "columns": 1, - "default": "0", - "fieldname": "reqd", - "fieldtype": "Check", - "in_list_view": 1, - "label": "Mandatory" - } - ], - "grid_page_length": 50, - "index_web_pages_for_search": 1, - "istable": 1, - "links": [], - "modified": "2025-07-28 01:19:20.533329", - "modified_by": "Administrator", - "module": "Feedback", - "name": "Feedback Question", - "owner": "Administrator", - "permissions": [], - "row_format": "Dynamic", - "sort_field": "modified", - "sort_order": "DESC", - "states": [] -} \ No newline at end of file diff --git a/csf_tz/feedback/doctype/feedback_question/feedback_question.py b/csf_tz/feedback/doctype/feedback_question/feedback_question.py deleted file mode 100644 index a34c9b7a..00000000 --- a/csf_tz/feedback/doctype/feedback_question/feedback_question.py +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (c) 2025, Aakvatech and contributors -# For license information, please see license.txt - -# import frappe -from frappe.model.document import Document - - -class FeedbackQuestion(Document): - pass diff --git a/csf_tz/feedback/doctype/feedback_response/__init__.py b/csf_tz/feedback/doctype/feedback_response/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/feedback/doctype/feedback_response/feedback_response.json b/csf_tz/feedback/doctype/feedback_response/feedback_response.json deleted file mode 100644 index db7d903a..00000000 --- a/csf_tz/feedback/doctype/feedback_response/feedback_response.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "actions": [], - "allow_rename": 1, - "creation": "2025-07-07 21:55:27.165867", - "doctype": "DocType", - "editable_grid": 1, - "engine": "InnoDB", - "field_order": [ - "question", - "answer" - ], - "fields": [ - { - "fieldname": "question", - "fieldtype": "Small Text", - "in_list_view": 1, - "label": "Question" - }, - { - "fieldname": "answer", - "fieldtype": "Text", - "in_list_view": 1, - "label": "Answer" - } - ], - "grid_page_length": 50, - "index_web_pages_for_search": 1, - "istable": 1, - "links": [], - "modified": "2025-07-07 21:57:19.847691", - "modified_by": "Administrator", - "module": "Feedback", - "name": "Feedback Response", - "owner": "Administrator", - "permissions": [], - "row_format": "Dynamic", - "sort_field": "modified", - "sort_order": "DESC", - "states": [] -} \ No newline at end of file diff --git a/csf_tz/feedback/doctype/feedback_response/feedback_response.py b/csf_tz/feedback/doctype/feedback_response/feedback_response.py deleted file mode 100644 index bc693ab0..00000000 --- a/csf_tz/feedback/doctype/feedback_response/feedback_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (c) 2025, Aakvatech and contributors -# For license information, please see license.txt - -# import frappe -from frappe.model.document import Document - - -class FeedbackResponse(Document): - pass diff --git a/csf_tz/feedback/doctype/feedback_template/__init__.py b/csf_tz/feedback/doctype/feedback_template/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/feedback/doctype/feedback_template/feedback_template.js b/csf_tz/feedback/doctype/feedback_template/feedback_template.js deleted file mode 100644 index e0bec3f6..00000000 --- a/csf_tz/feedback/doctype/feedback_template/feedback_template.js +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright (c) 2025, Aakvatech and contributors -// For license information, please see license.txt - -frappe.ui.form.on("Feedback Template", { - refresh(frm) { - // Placeholder for future enhancements - }, -}); diff --git a/csf_tz/feedback/doctype/feedback_template/feedback_template.json b/csf_tz/feedback/doctype/feedback_template/feedback_template.json deleted file mode 100644 index 14c3267c..00000000 --- a/csf_tz/feedback/doctype/feedback_template/feedback_template.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "actions": [], - "allow_rename": 1, - "creation": "2025-07-07 21:26:21.518771", - "doctype": "DocType", - "engine": "InnoDB", - "field_order": [ - "template_name", - "is_active", - "feedback_question" - ], - "fields": [ - { - "fieldname": "template_name", - "fieldtype": "Data", - "label": "Template Name" - }, - { - "default": "0", - "fieldname": "is_active", - "fieldtype": "Check", - "label": "is Active" - }, - { - "fieldname": "feedback_question", - "fieldtype": "Table", - "label": "Feedback Question", - "options": "Feedback Question" - } - ], - "grid_page_length": 50, - "index_web_pages_for_search": 1, - "links": [], - "modified": "2025-07-07 21:38:43.401658", - "modified_by": "Administrator", - "module": "Feedback", - "name": "Feedback Template", - "owner": "Administrator", - "permissions": [ - { - "create": 1, - "delete": 1, - "email": 1, - "export": 1, - "print": 1, - "read": 1, - "report": 1, - "role": "System Manager", - "share": 1, - "write": 1 - } - ], - "row_format": "Dynamic", - "sort_field": "modified", - "sort_order": "DESC", - "states": [] -} \ No newline at end of file diff --git a/csf_tz/feedback/doctype/feedback_template/feedback_template.py b/csf_tz/feedback/doctype/feedback_template/feedback_template.py deleted file mode 100644 index fb0be740..00000000 --- a/csf_tz/feedback/doctype/feedback_template/feedback_template.py +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (c) 2025, Aakvatech and contributors -# For license information, please see license.txt - -# import frappe -from frappe.model.document import Document - - -class FeedbackTemplate(Document): - pass diff --git a/csf_tz/feedback/doctype/feedback_template/test_feedback_template.py b/csf_tz/feedback/doctype/feedback_template/test_feedback_template.py deleted file mode 100644 index d4630ef6..00000000 --- a/csf_tz/feedback/doctype/feedback_template/test_feedback_template.py +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (c) 2025, Aakvatech and Contributors -# See license.txt - -# import frappe -from frappe.tests.utils import FrappeTestCase - - -class TestFeedbackTemplate(FrappeTestCase): - pass diff --git a/csf_tz/feedback/web_form/__init__.py b/csf_tz/feedback/web_form/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/feedback/web_form/training_feedback_form/__init__.py b/csf_tz/feedback/web_form/training_feedback_form/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/csf_tz/feedback/web_form/training_feedback_form/training_feedback_form.js b/csf_tz/feedback/web_form/training_feedback_form/training_feedback_form.js deleted file mode 100644 index 45377870..00000000 --- a/csf_tz/feedback/web_form/training_feedback_form/training_feedback_form.js +++ /dev/null @@ -1,654 +0,0 @@ -frappe.ready(() => { - // Load Font Awesome CSS first - frappe.require( - [ - "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css", - ], - initializeForm - ); - - function initializeForm() { - frappe.web_form.on("template", (_, value) => { - showLoadingState(); - fetchTemplate(value); - }); - - function showLoadingState() { - frappe.web_form.set_df_property( - "dynamic_html", - "options", - ` -
-
- Loading... -
-

Loading questions...

-
- ` - ); - } - - function fetchTemplate(templateName) { - frappe.call({ - method: "frappe.client.get", - args: { - doctype: "Feedback Template", - name: templateName, - }, - callback: handleTemplateResponse, - error: showErrorState, - }); - } - - function handleTemplateResponse(response) { - if (response.message) { - window._feedback_questions = response.message.feedback_question || []; - renderQuestions(window._feedback_questions); - } - } - - function showErrorState() { - frappe.web_form.set_df_property( - "dynamic_html", - "options", - ` -
- -

Failed to load questions. Please try again.

-
- ` - ); - } - - function renderQuestions(questions) { - let html = createFormContainer(); - - questions.forEach((q, index) => { - html += createQuestionBlock(q, index); - }); - - html += `
`; // Close container - - frappe.web_form.set_df_property("dynamic_html", "options", html); - addQuestionBlockHoverEffects(); - initializeStarRatings(); - initializeClearButtons(); - setTimeout(checkAllRequiredFilled, 100); - } - - function createFormContainer() { - return ` -