mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-16 13:25:10 +00:00
Merge branch 'develop' into project-link-for-all-accounts
This commit is contained in:
19
CODEOWNERS
Normal file
19
CODEOWNERS
Normal file
@@ -0,0 +1,19 @@
|
||||
# Each line is a file pattern followed by one or more owners.
|
||||
|
||||
# These owners will be the default owners for everything in
|
||||
# the repo. Unless a later match takes precedence,
|
||||
|
||||
* @nabinhait
|
||||
manufacturing/ @rohitwaghchaure
|
||||
accounts/ @deepeshgarg007 @nextchamp-saqib
|
||||
loan_management/ @deepeshgarg007
|
||||
pos* @nextchamp-saqib
|
||||
assets/ @nextchamp-saqib
|
||||
stock/ @marination @rohitwaghchaure
|
||||
buying/ @marination @rohitwaghchaure
|
||||
hr/ @Anurag810
|
||||
projects/ @hrwX
|
||||
support/ @hrwX
|
||||
healthcare/ @ruchamahabal
|
||||
erpnext_integrations/ @Mangesh-Khairnar
|
||||
requirements.txt @gavindsouza
|
||||
@@ -1,83 +1,96 @@
|
||||
{
|
||||
"cards": [
|
||||
{
|
||||
"links": "[\n {\n \"description\": \"Company (not Customer or Supplier) master.\",\n \"label\": \"Company\",\n \"name\": \"Company\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Tree of financial accounts.\",\n \"icon\": \"fa fa-sitemap\",\n \"label\": \"Chart of Accounts\",\n \"name\": \"Account\",\n \"onboard\": 1,\n \"route\": \"#Tree/Account\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Accounts Settings\",\n \"name\": \"Accounts Settings\",\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Financial / accounting year.\",\n \"label\": \"Fiscal Year\",\n \"name\": \"Fiscal Year\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Accounting Dimension\",\n \"name\": \"Accounting Dimension\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Finance Book\",\n \"name\": \"Finance Book\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Accounting Period\",\n \"name\": \"Accounting Period\",\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Payment Terms based on conditions\",\n \"label\": \"Payment Term\",\n \"name\": \"Payment Term\",\n \"type\": \"doctype\"\n }\n]",
|
||||
"title": "Accounting Masters"
|
||||
"hidden": 0,
|
||||
"label": "Accounting Masters",
|
||||
"links": "[\n {\n \"description\": \"Company (not Customer or Supplier) master.\",\n \"label\": \"Company\",\n \"name\": \"Company\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Tree of financial accounts.\",\n \"icon\": \"fa fa-sitemap\",\n \"label\": \"Chart of Accounts\",\n \"name\": \"Account\",\n \"onboard\": 1,\n \"route\": \"#Tree/Account\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Accounts Settings\",\n \"name\": \"Accounts Settings\",\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Financial / accounting year.\",\n \"label\": \"Fiscal Year\",\n \"name\": \"Fiscal Year\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Accounting Dimension\",\n \"name\": \"Accounting Dimension\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Finance Book\",\n \"name\": \"Finance Book\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Accounting Period\",\n \"name\": \"Accounting Period\",\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Payment Terms based on conditions\",\n \"label\": \"Payment Term\",\n \"name\": \"Payment Term\",\n \"type\": \"doctype\"\n }\n]"
|
||||
},
|
||||
{
|
||||
"links": "[\n {\n \"description\": \"Accounting journal entries.\",\n \"label\": \"Journal Entry\",\n \"name\": \"Journal Entry\",\n \"type\": \"doctype\"\n },\n {\n \"dependencies\": [\n \"GL Entry\"\n ],\n \"doctype\": \"GL Entry\",\n \"is_query_report\": true,\n \"label\": \"General Ledger\",\n \"name\": \"General Ledger\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"Sales Invoice\"\n ],\n \"doctype\": \"Sales Invoice\",\n \"is_query_report\": true,\n \"label\": \"Customer Ledger Summary\",\n \"name\": \"Customer Ledger Summary\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"Sales Invoice\"\n ],\n \"doctype\": \"Sales Invoice\",\n \"is_query_report\": true,\n \"label\": \"Supplier Ledger Summary\",\n \"name\": \"Supplier Ledger Summary\",\n \"type\": \"report\"\n }\n]",
|
||||
"title": "General Ledger"
|
||||
"hidden": 0,
|
||||
"label": "General Ledger",
|
||||
"links": "[\n {\n \"description\": \"Accounting journal entries.\",\n \"label\": \"Journal Entry\",\n \"name\": \"Journal Entry\",\n \"type\": \"doctype\"\n },\n {\n \"dependencies\": [\n \"GL Entry\"\n ],\n \"doctype\": \"GL Entry\",\n \"is_query_report\": true,\n \"label\": \"General Ledger\",\n \"name\": \"General Ledger\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"Sales Invoice\"\n ],\n \"doctype\": \"Sales Invoice\",\n \"is_query_report\": true,\n \"label\": \"Customer Ledger Summary\",\n \"name\": \"Customer Ledger Summary\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"Sales Invoice\"\n ],\n \"doctype\": \"Sales Invoice\",\n \"is_query_report\": true,\n \"label\": \"Supplier Ledger Summary\",\n \"name\": \"Supplier Ledger Summary\",\n \"type\": \"report\"\n }\n]"
|
||||
},
|
||||
{
|
||||
"links": "[\n {\n \"description\": \"Bills raised to Customers.\",\n \"label\": \"Sales Invoice\",\n \"name\": \"Sales Invoice\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Customer database.\",\n \"label\": \"Customer\",\n \"name\": \"Customer\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Bank/Cash transactions against party or for internal transfer\",\n \"label\": \"Payment Entry\",\n \"name\": \"Payment Entry\",\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Payment Request\",\n \"label\": \"Payment Request\",\n \"name\": \"Payment Request\",\n \"type\": \"doctype\"\n },\n {\n \"dependencies\": [\n \"Sales Invoice\"\n ],\n \"doctype\": \"Sales Invoice\",\n \"is_query_report\": true,\n \"label\": \"Accounts Receivable\",\n \"name\": \"Accounts Receivable\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"Sales Invoice\"\n ],\n \"doctype\": \"Sales Invoice\",\n \"is_query_report\": true,\n \"label\": \"Accounts Receivable Summary\",\n \"name\": \"Accounts Receivable Summary\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"Sales Invoice\"\n ],\n \"doctype\": \"Sales Invoice\",\n \"is_query_report\": true,\n \"label\": \"Sales Register\",\n \"name\": \"Sales Register\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"Sales Invoice\"\n ],\n \"doctype\": \"Sales Invoice\",\n \"is_query_report\": true,\n \"label\": \"Item-wise Sales Register\",\n \"name\": \"Item-wise Sales Register\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"Sales Invoice\"\n ],\n \"doctype\": \"Sales Invoice\",\n \"is_query_report\": true,\n \"label\": \"Ordered Items To Be Billed\",\n \"name\": \"Ordered Items To Be Billed\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"Sales Invoice\"\n ],\n \"doctype\": \"Sales Invoice\",\n \"is_query_report\": true,\n \"label\": \"Delivered Items To Be Billed\",\n \"name\": \"Delivered Items To Be Billed\",\n \"type\": \"report\"\n }\n]",
|
||||
"title": "Accounts Receivable"
|
||||
"hidden": 0,
|
||||
"label": "Accounts Receivable",
|
||||
"links": "[\n {\n \"description\": \"Bills raised to Customers.\",\n \"label\": \"Sales Invoice\",\n \"name\": \"Sales Invoice\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Customer database.\",\n \"label\": \"Customer\",\n \"name\": \"Customer\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Bank/Cash transactions against party or for internal transfer\",\n \"label\": \"Payment Entry\",\n \"name\": \"Payment Entry\",\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Payment Request\",\n \"label\": \"Payment Request\",\n \"name\": \"Payment Request\",\n \"type\": \"doctype\"\n },\n {\n \"dependencies\": [\n \"Sales Invoice\"\n ],\n \"doctype\": \"Sales Invoice\",\n \"is_query_report\": true,\n \"label\": \"Accounts Receivable\",\n \"name\": \"Accounts Receivable\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"Sales Invoice\"\n ],\n \"doctype\": \"Sales Invoice\",\n \"is_query_report\": true,\n \"label\": \"Accounts Receivable Summary\",\n \"name\": \"Accounts Receivable Summary\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"Sales Invoice\"\n ],\n \"doctype\": \"Sales Invoice\",\n \"is_query_report\": true,\n \"label\": \"Sales Register\",\n \"name\": \"Sales Register\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"Sales Invoice\"\n ],\n \"doctype\": \"Sales Invoice\",\n \"is_query_report\": true,\n \"label\": \"Item-wise Sales Register\",\n \"name\": \"Item-wise Sales Register\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"Sales Invoice\"\n ],\n \"doctype\": \"Sales Invoice\",\n \"is_query_report\": true,\n \"label\": \"Ordered Items To Be Billed\",\n \"name\": \"Ordered Items To Be Billed\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"Sales Invoice\"\n ],\n \"doctype\": \"Sales Invoice\",\n \"is_query_report\": true,\n \"label\": \"Delivered Items To Be Billed\",\n \"name\": \"Delivered Items To Be Billed\",\n \"type\": \"report\"\n }\n]"
|
||||
},
|
||||
{
|
||||
"links": "[\n {\n \"description\": \"Bills raised by Suppliers.\",\n \"label\": \"Purchase Invoice\",\n \"name\": \"Purchase Invoice\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Supplier database.\",\n \"label\": \"Supplier\",\n \"name\": \"Supplier\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Bank/Cash transactions against party or for internal transfer\",\n \"label\": \"Payment Entry\",\n \"name\": \"Payment Entry\",\n \"type\": \"doctype\"\n },\n {\n \"dependencies\": [\n \"Purchase Invoice\"\n ],\n \"doctype\": \"Purchase Invoice\",\n \"is_query_report\": true,\n \"label\": \"Accounts Payable\",\n \"name\": \"Accounts Payable\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"Purchase Invoice\"\n ],\n \"doctype\": \"Purchase Invoice\",\n \"is_query_report\": true,\n \"label\": \"Accounts Payable Summary\",\n \"name\": \"Accounts Payable Summary\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"Purchase Invoice\"\n ],\n \"doctype\": \"Purchase Invoice\",\n \"is_query_report\": true,\n \"label\": \"Purchase Register\",\n \"name\": \"Purchase Register\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"Purchase Invoice\"\n ],\n \"doctype\": \"Purchase Invoice\",\n \"is_query_report\": true,\n \"label\": \"Item-wise Purchase Register\",\n \"name\": \"Item-wise Purchase Register\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"Purchase Invoice\"\n ],\n \"doctype\": \"Purchase Invoice\",\n \"is_query_report\": true,\n \"label\": \"Purchase Order Items To Be Billed\",\n \"name\": \"Purchase Order Items To Be Billed\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"Purchase Invoice\"\n ],\n \"doctype\": \"Purchase Invoice\",\n \"is_query_report\": true,\n \"label\": \"Received Items To Be Billed\",\n \"name\": \"Received Items To Be Billed\",\n \"type\": \"report\"\n }\n]",
|
||||
"title": "Accounts Payable"
|
||||
"hidden": 0,
|
||||
"label": "Accounts Payable",
|
||||
"links": "[\n {\n \"description\": \"Bills raised by Suppliers.\",\n \"label\": \"Purchase Invoice\",\n \"name\": \"Purchase Invoice\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Supplier database.\",\n \"label\": \"Supplier\",\n \"name\": \"Supplier\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Bank/Cash transactions against party or for internal transfer\",\n \"label\": \"Payment Entry\",\n \"name\": \"Payment Entry\",\n \"type\": \"doctype\"\n },\n {\n \"dependencies\": [\n \"Purchase Invoice\"\n ],\n \"doctype\": \"Purchase Invoice\",\n \"is_query_report\": true,\n \"label\": \"Accounts Payable\",\n \"name\": \"Accounts Payable\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"Purchase Invoice\"\n ],\n \"doctype\": \"Purchase Invoice\",\n \"is_query_report\": true,\n \"label\": \"Accounts Payable Summary\",\n \"name\": \"Accounts Payable Summary\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"Purchase Invoice\"\n ],\n \"doctype\": \"Purchase Invoice\",\n \"is_query_report\": true,\n \"label\": \"Purchase Register\",\n \"name\": \"Purchase Register\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"Purchase Invoice\"\n ],\n \"doctype\": \"Purchase Invoice\",\n \"is_query_report\": true,\n \"label\": \"Item-wise Purchase Register\",\n \"name\": \"Item-wise Purchase Register\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"Purchase Invoice\"\n ],\n \"doctype\": \"Purchase Invoice\",\n \"is_query_report\": true,\n \"label\": \"Purchase Order Items To Be Billed\",\n \"name\": \"Purchase Order Items To Be Billed\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"Purchase Invoice\"\n ],\n \"doctype\": \"Purchase Invoice\",\n \"is_query_report\": true,\n \"label\": \"Received Items To Be Billed\",\n \"name\": \"Received Items To Be Billed\",\n \"type\": \"report\"\n }\n]"
|
||||
},
|
||||
{
|
||||
"icon": "fa fa-table",
|
||||
"links": "[\n {\n \"dependencies\": [\n \"GL Entry\"\n ],\n \"doctype\": \"GL Entry\",\n \"is_query_report\": true,\n \"label\": \"Trial Balance for Party\",\n \"name\": \"Trial Balance for Party\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"Journal Entry\"\n ],\n \"doctype\": \"Journal Entry\",\n \"is_query_report\": true,\n \"label\": \"Payment Period Based On Invoice Date\",\n \"name\": \"Payment Period Based On Invoice Date\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"Sales Invoice\"\n ],\n \"doctype\": \"Sales Invoice\",\n \"is_query_report\": true,\n \"label\": \"Sales Partners Commission\",\n \"name\": \"Sales Partners Commission\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"Customer\"\n ],\n \"doctype\": \"Customer\",\n \"is_query_report\": true,\n \"label\": \"Customer Credit Balance\",\n \"name\": \"Customer Credit Balance\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"Sales Invoice\"\n ],\n \"doctype\": \"Sales Invoice\",\n \"is_query_report\": true,\n \"label\": \"Sales Payment Summary\",\n \"name\": \"Sales Payment Summary\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"Address\"\n ],\n \"doctype\": \"Address\",\n \"is_query_report\": true,\n \"label\": \"Address And Contacts\",\n \"name\": \"Address And Contacts\",\n \"type\": \"report\"\n }\n]",
|
||||
"title": "Reports"
|
||||
"hidden": 0,
|
||||
"label": "Reports",
|
||||
"links": "[\n {\n \"dependencies\": [\n \"GL Entry\"\n ],\n \"doctype\": \"GL Entry\",\n \"is_query_report\": true,\n \"label\": \"Trial Balance for Party\",\n \"name\": \"Trial Balance for Party\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"Journal Entry\"\n ],\n \"doctype\": \"Journal Entry\",\n \"is_query_report\": true,\n \"label\": \"Payment Period Based On Invoice Date\",\n \"name\": \"Payment Period Based On Invoice Date\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"Sales Invoice\"\n ],\n \"doctype\": \"Sales Invoice\",\n \"is_query_report\": true,\n \"label\": \"Sales Partners Commission\",\n \"name\": \"Sales Partners Commission\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"Customer\"\n ],\n \"doctype\": \"Customer\",\n \"is_query_report\": true,\n \"label\": \"Customer Credit Balance\",\n \"name\": \"Customer Credit Balance\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"Sales Invoice\"\n ],\n \"doctype\": \"Sales Invoice\",\n \"is_query_report\": true,\n \"label\": \"Sales Payment Summary\",\n \"name\": \"Sales Payment Summary\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"Address\"\n ],\n \"doctype\": \"Address\",\n \"is_query_report\": true,\n \"label\": \"Address And Contacts\",\n \"name\": \"Address And Contacts\",\n \"type\": \"report\"\n }\n]"
|
||||
},
|
||||
{
|
||||
"links": "[\n {\n \"dependencies\": [\n \"GL Entry\"\n ],\n \"doctype\": \"GL Entry\",\n \"is_query_report\": true,\n \"label\": \"Trial Balance\",\n \"name\": \"Trial Balance\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"GL Entry\"\n ],\n \"doctype\": \"GL Entry\",\n \"is_query_report\": true,\n \"label\": \"Profit and Loss Statement\",\n \"name\": \"Profit and Loss Statement\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"GL Entry\"\n ],\n \"doctype\": \"GL Entry\",\n \"is_query_report\": true,\n \"label\": \"Balance Sheet\",\n \"name\": \"Balance Sheet\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"GL Entry\"\n ],\n \"doctype\": \"GL Entry\",\n \"is_query_report\": true,\n \"label\": \"Cash Flow\",\n \"name\": \"Cash Flow\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"GL Entry\"\n ],\n \"doctype\": \"GL Entry\",\n \"is_query_report\": true,\n \"label\": \"Consolidated Financial Statement\",\n \"name\": \"Consolidated Financial Statement\",\n \"type\": \"report\"\n }\n]",
|
||||
"title": "Financial Statements"
|
||||
"hidden": 0,
|
||||
"label": "Financial Statements",
|
||||
"links": "[\n {\n \"dependencies\": [\n \"GL Entry\"\n ],\n \"doctype\": \"GL Entry\",\n \"is_query_report\": true,\n \"label\": \"Trial Balance\",\n \"name\": \"Trial Balance\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"GL Entry\"\n ],\n \"doctype\": \"GL Entry\",\n \"is_query_report\": true,\n \"label\": \"Profit and Loss Statement\",\n \"name\": \"Profit and Loss Statement\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"GL Entry\"\n ],\n \"doctype\": \"GL Entry\",\n \"is_query_report\": true,\n \"label\": \"Balance Sheet\",\n \"name\": \"Balance Sheet\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"GL Entry\"\n ],\n \"doctype\": \"GL Entry\",\n \"is_query_report\": true,\n \"label\": \"Cash Flow\",\n \"name\": \"Cash Flow\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"GL Entry\"\n ],\n \"doctype\": \"GL Entry\",\n \"is_query_report\": true,\n \"label\": \"Consolidated Financial Statement\",\n \"name\": \"Consolidated Financial Statement\",\n \"type\": \"report\"\n }\n]"
|
||||
},
|
||||
{
|
||||
"links": "[\n {\n \"description\": \"Enable / disable currencies.\",\n \"label\": \"Currency\",\n \"name\": \"Currency\",\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Currency exchange rate master.\",\n \"label\": \"Currency Exchange\",\n \"name\": \"Currency Exchange\",\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Exchange Rate Revaluation master.\",\n \"label\": \"Exchange Rate Revaluation\",\n \"name\": \"Exchange Rate Revaluation\",\n \"type\": \"doctype\"\n }\n]",
|
||||
"title": "Multi Currency"
|
||||
"hidden": 0,
|
||||
"label": "Multi Currency",
|
||||
"links": "[\n {\n \"description\": \"Enable / disable currencies.\",\n \"label\": \"Currency\",\n \"name\": \"Currency\",\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Currency exchange rate master.\",\n \"label\": \"Currency Exchange\",\n \"name\": \"Currency Exchange\",\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Exchange Rate Revaluation master.\",\n \"label\": \"Exchange Rate Revaluation\",\n \"name\": \"Exchange Rate Revaluation\",\n \"type\": \"doctype\"\n }\n]"
|
||||
},
|
||||
{
|
||||
"icon": "fa fa-cog",
|
||||
"links": "[\n {\n \"description\": \"Setup Gateway accounts.\",\n \"label\": \"Payment Gateway Account\",\n \"name\": \"Payment Gateway Account\",\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Template of terms or contract.\",\n \"label\": \"Terms and Conditions Template\",\n \"name\": \"Terms and Conditions\",\n \"type\": \"doctype\"\n },\n {\n \"description\": \"e.g. Bank, Cash, Credit Card\",\n \"label\": \"Mode of Payment\",\n \"name\": \"Mode of Payment\",\n \"type\": \"doctype\"\n }\n]",
|
||||
"title": "Settings"
|
||||
"hidden": 0,
|
||||
"label": "Settings",
|
||||
"links": "[\n {\n \"description\": \"Setup Gateway accounts.\",\n \"label\": \"Payment Gateway Account\",\n \"name\": \"Payment Gateway Account\",\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Template of terms or contract.\",\n \"label\": \"Terms and Conditions Template\",\n \"name\": \"Terms and Conditions\",\n \"type\": \"doctype\"\n },\n {\n \"description\": \"e.g. Bank, Cash, Credit Card\",\n \"label\": \"Mode of Payment\",\n \"name\": \"Mode of Payment\",\n \"type\": \"doctype\"\n }\n]"
|
||||
},
|
||||
{
|
||||
"links": "[\n {\n \"label\": \"Bank\",\n \"name\": \"Bank\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Bank Account\",\n \"name\": \"Bank Account\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Bank Statement Transaction Entry\",\n \"name\": \"Bank Statement Transaction Entry\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Bank Statement Settings\",\n \"name\": \"Bank Statement Settings\",\n \"type\": \"doctype\"\n }\n]",
|
||||
"title": "Bank Statement"
|
||||
"hidden": 0,
|
||||
"label": "Bank Statement",
|
||||
"links": "[\n {\n \"label\": \"Bank\",\n \"name\": \"Bank\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Bank Account\",\n \"name\": \"Bank Account\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Bank Statement Transaction Entry\",\n \"name\": \"Bank Statement Transaction Entry\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Bank Statement Settings\",\n \"name\": \"Bank Statement Settings\",\n \"type\": \"doctype\"\n }\n]"
|
||||
},
|
||||
{
|
||||
"links": "[\n {\n \"description\": \"Match non-linked Invoices and Payments.\",\n \"label\": \"Match Payments with Invoices\",\n \"name\": \"Payment Reconciliation\",\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Update bank payment dates with journals.\",\n \"label\": \"Update Bank Transaction Dates\",\n \"name\": \"Bank Reconciliation\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Invoice Discounting\",\n \"name\": \"Invoice Discounting\",\n \"type\": \"doctype\"\n },\n {\n \"dependencies\": [\n \"Journal Entry\"\n ],\n \"doctype\": \"Journal Entry\",\n \"is_query_report\": true,\n \"label\": \"Bank Reconciliation Statement\",\n \"name\": \"Bank Reconciliation Statement\",\n \"type\": \"report\"\n },\n {\n \"icon\": \"fa fa-bar-chart\",\n \"label\": \"Bank Reconciliation\",\n \"name\": \"bank-reconciliation\",\n \"type\": \"page\"\n },\n {\n \"dependencies\": [\n \"Journal Entry\"\n ],\n \"doctype\": \"Journal Entry\",\n \"is_query_report\": true,\n \"label\": \"Bank Clearance Summary\",\n \"name\": \"Bank Clearance Summary\",\n \"type\": \"report\"\n },\n {\n \"label\": \"Bank Guarantee\",\n \"name\": \"Bank Guarantee\",\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Setup cheque dimensions for printing\",\n \"label\": \"Cheque Print Template\",\n \"name\": \"Cheque Print Template\",\n \"type\": \"doctype\"\n }\n]",
|
||||
"title": "Banking and Payments"
|
||||
"hidden": 0,
|
||||
"label": "Banking and Payments",
|
||||
"links": "[\n {\n \"description\": \"Match non-linked Invoices and Payments.\",\n \"label\": \"Match Payments with Invoices\",\n \"name\": \"Payment Reconciliation\",\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Update bank payment dates with journals.\",\n \"label\": \"Update Bank Transaction Dates\",\n \"name\": \"Bank Reconciliation\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Invoice Discounting\",\n \"name\": \"Invoice Discounting\",\n \"type\": \"doctype\"\n },\n {\n \"dependencies\": [\n \"Journal Entry\"\n ],\n \"doctype\": \"Journal Entry\",\n \"is_query_report\": true,\n \"label\": \"Bank Reconciliation Statement\",\n \"name\": \"Bank Reconciliation Statement\",\n \"type\": \"report\"\n },\n {\n \"icon\": \"fa fa-bar-chart\",\n \"label\": \"Bank Reconciliation\",\n \"name\": \"bank-reconciliation\",\n \"type\": \"page\"\n },\n {\n \"dependencies\": [\n \"Journal Entry\"\n ],\n \"doctype\": \"Journal Entry\",\n \"is_query_report\": true,\n \"label\": \"Bank Clearance Summary\",\n \"name\": \"Bank Clearance Summary\",\n \"type\": \"report\"\n },\n {\n \"label\": \"Bank Guarantee\",\n \"name\": \"Bank Guarantee\",\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Setup cheque dimensions for printing\",\n \"label\": \"Cheque Print Template\",\n \"name\": \"Cheque Print Template\",\n \"type\": \"doctype\"\n }\n]"
|
||||
},
|
||||
{
|
||||
"links": "[\n {\n \"label\": \"Subscription Plan\",\n \"name\": \"Subscription Plan\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Subscription\",\n \"name\": \"Subscription\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Subscription Settings\",\n \"name\": \"Subscription Settings\",\n \"type\": \"doctype\"\n }\n]",
|
||||
"title": "Subscription Management"
|
||||
"hidden": 0,
|
||||
"label": "Subscription Management",
|
||||
"links": "[\n {\n \"label\": \"Subscription Plan\",\n \"name\": \"Subscription Plan\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Subscription\",\n \"name\": \"Subscription\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Subscription Settings\",\n \"name\": \"Subscription Settings\",\n \"type\": \"doctype\"\n }\n]"
|
||||
},
|
||||
{
|
||||
"links": "[\n {\n \"label\": \"GST Settings\",\n \"name\": \"GST Settings\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"GST HSN Code\",\n \"name\": \"GST HSN Code\",\n \"type\": \"doctype\"\n },\n {\n \"is_query_report\": true,\n \"label\": \"GSTR-1\",\n \"name\": \"GSTR-1\",\n \"type\": \"report\"\n },\n {\n \"is_query_report\": true,\n \"label\": \"GSTR-2\",\n \"name\": \"GSTR-2\",\n \"type\": \"report\"\n },\n {\n \"label\": \"GSTR 3B Report\",\n \"name\": \"GSTR 3B Report\",\n \"type\": \"doctype\"\n },\n {\n \"is_query_report\": true,\n \"label\": \"GST Sales Register\",\n \"name\": \"GST Sales Register\",\n \"type\": \"report\"\n },\n {\n \"is_query_report\": true,\n \"label\": \"GST Purchase Register\",\n \"name\": \"GST Purchase Register\",\n \"type\": \"report\"\n },\n {\n \"is_query_report\": true,\n \"label\": \"GST Itemised Sales Register\",\n \"name\": \"GST Itemised Sales Register\",\n \"type\": \"report\"\n },\n {\n \"is_query_report\": true,\n \"label\": \"GST Itemised Purchase Register\",\n \"name\": \"GST Itemised Purchase Register\",\n \"type\": \"report\"\n },\n {\n \"country\": \"India\",\n \"description\": \"C-Form records\",\n \"label\": \"C-Form\",\n \"name\": \"C-Form\",\n \"type\": \"doctype\"\n }\n]",
|
||||
"title": "Goods and Services Tax (GST India)"
|
||||
"hidden": 0,
|
||||
"label": "Goods and Services Tax (GST India)",
|
||||
"links": "[\n {\n \"label\": \"GST Settings\",\n \"name\": \"GST Settings\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"GST HSN Code\",\n \"name\": \"GST HSN Code\",\n \"type\": \"doctype\"\n },\n {\n \"is_query_report\": true,\n \"label\": \"GSTR-1\",\n \"name\": \"GSTR-1\",\n \"type\": \"report\"\n },\n {\n \"is_query_report\": true,\n \"label\": \"GSTR-2\",\n \"name\": \"GSTR-2\",\n \"type\": \"report\"\n },\n {\n \"label\": \"GSTR 3B Report\",\n \"name\": \"GSTR 3B Report\",\n \"type\": \"doctype\"\n },\n {\n \"is_query_report\": true,\n \"label\": \"GST Sales Register\",\n \"name\": \"GST Sales Register\",\n \"type\": \"report\"\n },\n {\n \"is_query_report\": true,\n \"label\": \"GST Purchase Register\",\n \"name\": \"GST Purchase Register\",\n \"type\": \"report\"\n },\n {\n \"is_query_report\": true,\n \"label\": \"GST Itemised Sales Register\",\n \"name\": \"GST Itemised Sales Register\",\n \"type\": \"report\"\n },\n {\n \"is_query_report\": true,\n \"label\": \"GST Itemised Purchase Register\",\n \"name\": \"GST Itemised Purchase Register\",\n \"type\": \"report\"\n },\n {\n \"country\": \"India\",\n \"description\": \"C-Form records\",\n \"label\": \"C-Form\",\n \"name\": \"C-Form\",\n \"type\": \"doctype\"\n }\n]"
|
||||
},
|
||||
{
|
||||
"icon": "fa fa-microchip ",
|
||||
"links": "[\n {\n \"description\": \"List of available Shareholders with folio numbers\",\n \"label\": \"Shareholder\",\n \"name\": \"Shareholder\",\n \"type\": \"doctype\"\n },\n {\n \"description\": \"List of all share transactions\",\n \"label\": \"Share Transfer\",\n \"name\": \"Share Transfer\",\n \"type\": \"doctype\"\n },\n {\n \"dependencies\": [\n \"Share Transfer\"\n ],\n \"doctype\": \"Share Transfer\",\n \"is_query_report\": true,\n \"label\": \"Share Ledger\",\n \"name\": \"Share Ledger\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"Share Transfer\"\n ],\n \"doctype\": \"Share Transfer\",\n \"is_query_report\": true,\n \"label\": \"Share Balance\",\n \"name\": \"Share Balance\",\n \"type\": \"report\"\n }\n]",
|
||||
"title": "Share Management"
|
||||
"hidden": 0,
|
||||
"label": "Share Management",
|
||||
"links": "[\n {\n \"description\": \"List of available Shareholders with folio numbers\",\n \"label\": \"Shareholder\",\n \"name\": \"Shareholder\",\n \"type\": \"doctype\"\n },\n {\n \"description\": \"List of all share transactions\",\n \"label\": \"Share Transfer\",\n \"name\": \"Share Transfer\",\n \"type\": \"doctype\"\n },\n {\n \"dependencies\": [\n \"Share Transfer\"\n ],\n \"doctype\": \"Share Transfer\",\n \"is_query_report\": true,\n \"label\": \"Share Ledger\",\n \"name\": \"Share Ledger\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"Share Transfer\"\n ],\n \"doctype\": \"Share Transfer\",\n \"is_query_report\": true,\n \"label\": \"Share Balance\",\n \"name\": \"Share Balance\",\n \"type\": \"report\"\n }\n]"
|
||||
},
|
||||
{
|
||||
"links": "[\n {\n \"description\": \"Tree of financial Cost Centers.\",\n \"icon\": \"fa fa-sitemap\",\n \"label\": \"Chart of Cost Centers\",\n \"name\": \"Cost Center\",\n \"route\": \"#Tree/Cost Center\",\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Define budget for a financial year.\",\n \"label\": \"Budget\",\n \"name\": \"Budget\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Accounting Dimension\",\n \"name\": \"Accounting Dimension\",\n \"type\": \"doctype\"\n },\n {\n \"dependencies\": [\n \"Cost Center\"\n ],\n \"doctype\": \"Cost Center\",\n \"is_query_report\": true,\n \"label\": \"Budget Variance Report\",\n \"name\": \"Budget Variance Report\",\n \"type\": \"report\"\n },\n {\n \"description\": \"Seasonality for setting budgets, targets etc.\",\n \"label\": \"Monthly Distribution\",\n \"name\": \"Monthly Distribution\",\n \"type\": \"doctype\"\n }\n]",
|
||||
"title": "Cost Center and Budgeting"
|
||||
"hidden": 0,
|
||||
"label": "Cost Center and Budgeting",
|
||||
"links": "[\n {\n \"description\": \"Tree of financial Cost Centers.\",\n \"icon\": \"fa fa-sitemap\",\n \"label\": \"Chart of Cost Centers\",\n \"name\": \"Cost Center\",\n \"route\": \"#Tree/Cost Center\",\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Define budget for a financial year.\",\n \"label\": \"Budget\",\n \"name\": \"Budget\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Accounting Dimension\",\n \"name\": \"Accounting Dimension\",\n \"type\": \"doctype\"\n },\n {\n \"dependencies\": [\n \"Cost Center\"\n ],\n \"doctype\": \"Cost Center\",\n \"is_query_report\": true,\n \"label\": \"Budget Variance Report\",\n \"name\": \"Budget Variance Report\",\n \"type\": \"report\"\n },\n {\n \"description\": \"Seasonality for setting budgets, targets etc.\",\n \"label\": \"Monthly Distribution\",\n \"name\": \"Monthly Distribution\",\n \"type\": \"doctype\"\n }\n]"
|
||||
},
|
||||
{
|
||||
"links": "[\n {\n \"label\": \"Opening Invoice Creation Tool\",\n \"name\": \"Opening Invoice Creation Tool\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Chart of Accounts Importer\",\n \"name\": \"Chart of Accounts Importer\",\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Close Balance Sheet and book Profit or Loss.\",\n \"label\": \"Period Closing Voucher\",\n \"name\": \"Period Closing Voucher\",\n \"type\": \"doctype\"\n }\n]",
|
||||
"title": "Opening and Closing"
|
||||
"hidden": 0,
|
||||
"label": "Opening and Closing",
|
||||
"links": "[\n {\n \"label\": \"Opening Invoice Creation Tool\",\n \"name\": \"Opening Invoice Creation Tool\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Chart of Accounts Importer\",\n \"name\": \"Chart of Accounts Importer\",\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Close Balance Sheet and book Profit or Loss.\",\n \"label\": \"Period Closing Voucher\",\n \"name\": \"Period Closing Voucher\",\n \"type\": \"doctype\"\n }\n]"
|
||||
},
|
||||
{
|
||||
"links": "[\n {\n \"description\": \"Tax template for selling transactions.\",\n \"label\": \"Sales Taxes and Charges Template\",\n \"name\": \"Sales Taxes and Charges Template\",\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Tax template for buying transactions.\",\n \"label\": \"Purchase Taxes and Charges Template\",\n \"name\": \"Purchase Taxes and Charges Template\",\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Tax template for item tax rates.\",\n \"label\": \"Item Tax Template\",\n \"name\": \"Item Tax Template\",\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Tax Category for overriding tax rates.\",\n \"label\": \"Tax Category\",\n \"name\": \"Tax Category\",\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Tax Rule for transactions.\",\n \"label\": \"Tax Rule\",\n \"name\": \"Tax Rule\",\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Tax Withholding rates to be applied on transactions.\",\n \"label\": \"Tax Withholding Category\",\n \"name\": \"Tax Withholding Category\",\n \"type\": \"doctype\"\n }\n]",
|
||||
"title": "Taxes"
|
||||
"hidden": 0,
|
||||
"label": "Taxes",
|
||||
"links": "[\n {\n \"description\": \"Tax template for selling transactions.\",\n \"label\": \"Sales Taxes and Charges Template\",\n \"name\": \"Sales Taxes and Charges Template\",\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Tax template for buying transactions.\",\n \"label\": \"Purchase Taxes and Charges Template\",\n \"name\": \"Purchase Taxes and Charges Template\",\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Tax template for item tax rates.\",\n \"label\": \"Item Tax Template\",\n \"name\": \"Item Tax Template\",\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Tax Category for overriding tax rates.\",\n \"label\": \"Tax Category\",\n \"name\": \"Tax Category\",\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Tax Rule for transactions.\",\n \"label\": \"Tax Rule\",\n \"name\": \"Tax Rule\",\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Tax Withholding rates to be applied on transactions.\",\n \"label\": \"Tax Withholding Category\",\n \"name\": \"Tax Withholding Category\",\n \"type\": \"doctype\"\n }\n]"
|
||||
},
|
||||
{
|
||||
"links": "[\n {\n \"dependencies\": [\n \"Sales Invoice\"\n ],\n \"doctype\": \"Sales Invoice\",\n \"is_query_report\": true,\n \"label\": \"Gross Profit\",\n \"name\": \"Gross Profit\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"GL Entry\"\n ],\n \"doctype\": \"GL Entry\",\n \"is_query_report\": true,\n \"label\": \"Profitability Analysis\",\n \"name\": \"Profitability Analysis\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"Sales Invoice\"\n ],\n \"doctype\": \"Sales Invoice\",\n \"is_query_report\": true,\n \"label\": \"Sales Invoice Trends\",\n \"name\": \"Sales Invoice Trends\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"Purchase Invoice\"\n ],\n \"doctype\": \"Purchase Invoice\",\n \"is_query_report\": true,\n \"label\": \"Purchase Invoice Trends\",\n \"name\": \"Purchase Invoice Trends\",\n \"type\": \"report\"\n }\n]",
|
||||
"title": "Profitability"
|
||||
"hidden": 0,
|
||||
"label": "Profitability",
|
||||
"links": "[\n {\n \"dependencies\": [\n \"Sales Invoice\"\n ],\n \"doctype\": \"Sales Invoice\",\n \"is_query_report\": true,\n \"label\": \"Gross Profit\",\n \"name\": \"Gross Profit\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"GL Entry\"\n ],\n \"doctype\": \"GL Entry\",\n \"is_query_report\": true,\n \"label\": \"Profitability Analysis\",\n \"name\": \"Profitability Analysis\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"Sales Invoice\"\n ],\n \"doctype\": \"Sales Invoice\",\n \"is_query_report\": true,\n \"label\": \"Sales Invoice Trends\",\n \"name\": \"Sales Invoice Trends\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"Purchase Invoice\"\n ],\n \"doctype\": \"Purchase Invoice\",\n \"is_query_report\": true,\n \"label\": \"Purchase Invoice Trends\",\n \"name\": \"Purchase Invoice Trends\",\n \"type\": \"report\"\n }\n]"
|
||||
}
|
||||
],
|
||||
"category": "Modules",
|
||||
"charts": [
|
||||
{
|
||||
"chart_name": "Bank Balance",
|
||||
"label": "Bank Balance",
|
||||
"size": "Full"
|
||||
"label": "Bank Balance"
|
||||
}
|
||||
],
|
||||
"creation": "2020-03-02 15:41:59.515192",
|
||||
@@ -90,7 +103,7 @@
|
||||
"idx": 0,
|
||||
"is_standard": 1,
|
||||
"label": "Accounting",
|
||||
"modified": "2020-03-12 16:30:35.580450",
|
||||
"modified": "2020-04-01 11:28:50.925719",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Accounting",
|
||||
@@ -99,37 +112,37 @@
|
||||
"pin_to_top": 0,
|
||||
"shortcuts": [
|
||||
{
|
||||
"is_query_report": 0,
|
||||
"label": "Account",
|
||||
"link_to": "Account",
|
||||
"type": "DocType"
|
||||
},
|
||||
{
|
||||
"is_query_report": 0,
|
||||
"label": "Journal Entry",
|
||||
"link_to": "Journal Entry",
|
||||
"type": "DocType"
|
||||
},
|
||||
{
|
||||
"is_query_report": 0,
|
||||
"label": "Payment Entry",
|
||||
"link_to": "Payment Entry",
|
||||
"type": "DocType"
|
||||
},
|
||||
{
|
||||
"is_query_report": 1,
|
||||
"label": "Accounts Receivable",
|
||||
"link_to": "Accounts Receivable",
|
||||
"type": "Report"
|
||||
},
|
||||
{
|
||||
"is_query_report": 0,
|
||||
"label": "General Ledger",
|
||||
"link_to": "General Ledger",
|
||||
"type": "Report"
|
||||
},
|
||||
{
|
||||
"is_query_report": 0,
|
||||
"label": "Profit and Loss Statement",
|
||||
"link_to": "Profit and Loss Statement",
|
||||
"type": "Report"
|
||||
},
|
||||
{
|
||||
"is_query_report": 0,
|
||||
"label": "Trial Balance",
|
||||
"link_to": "Trial Balance",
|
||||
"type": "Report"
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
frappe.provide("frappe.treeview_settings")
|
||||
|
||||
frappe.treeview_settings["Account"] = {
|
||||
breadcrumbs: "Accounts",
|
||||
breadcrumb: "Accounts",
|
||||
title: __("Chart Of Accounts"),
|
||||
get_tree_root: false,
|
||||
filters: [
|
||||
|
||||
@@ -193,7 +193,7 @@ def get_dimension_with_children(doctype, dimension):
|
||||
|
||||
all_dimensions = []
|
||||
lft, rgt = frappe.db.get_value(doctype, dimension, ["lft", "rgt"])
|
||||
children = frappe.get_all(doctype, filters={"lft": [">=", lft], "rgt": ["<=", rgt]})
|
||||
children = frappe.get_all(doctype, filters={"lft": [">=", lft], "rgt": ["<=", rgt]}, order_by="lft")
|
||||
all_dimensions += [c.name for c in children]
|
||||
|
||||
return all_dimensions
|
||||
|
||||
@@ -164,7 +164,7 @@ def build_forest(data):
|
||||
error_messages = []
|
||||
|
||||
for i in data:
|
||||
account_name, _, account_number, is_group, account_type, root_type = i
|
||||
account_name, dummy, account_number, is_group, account_type, root_type = i
|
||||
|
||||
if not account_name:
|
||||
error_messages.append("Row {0}: Please enter Account Name".format(line_no))
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
frappe.treeview_settings["Cost Center"] = {
|
||||
breadcrumbs: "Accounts",
|
||||
breadcrumb: "Accounts",
|
||||
get_tree_root: false,
|
||||
filters: [{
|
||||
fieldname: "company",
|
||||
|
||||
@@ -30,18 +30,10 @@ frappe.ui.form.on('Exchange Rate Revaluation', {
|
||||
frm.doc.accounts.forEach(d=> {
|
||||
total_amt = total_amt + d['new_balance_in_base_currency'];
|
||||
});
|
||||
if(total_amt === r.sum) {
|
||||
frm.add_custom_button(__("Journal Entry"), function(){
|
||||
frappe.route_options = {
|
||||
'reference_type': 'Exchange Rate Revaluation',
|
||||
'reference_name': frm.doc.name
|
||||
};
|
||||
frappe.set_route("List", "Journal Entry");
|
||||
}, __("View"));
|
||||
} else {
|
||||
frm.add_custom_button(__('Create Journal Entry'), function() {
|
||||
if(total_amt !== r.sum) {
|
||||
frm.add_custom_button(__('Journal Entry'), function() {
|
||||
return frm.events.make_jv(frm);
|
||||
});
|
||||
}, __('Create'));
|
||||
}
|
||||
}, 'Journal Entry');
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
def get_data():
|
||||
return {
|
||||
'fieldname': 'reference_name',
|
||||
'transactions': [
|
||||
{
|
||||
'items': ['Journal Entry']
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -156,8 +156,11 @@ frappe.ui.form.on('Payment Entry', {
|
||||
|
||||
frm.toggle_display("base_paid_amount", frm.doc.paid_from_account_currency != company_currency);
|
||||
|
||||
frm.toggle_display("base_received_amount", (frm.doc.paid_to_account_currency != company_currency &&
|
||||
frm.doc.paid_from_account_currency != frm.doc.paid_to_account_currency));
|
||||
frm.toggle_display("base_received_amount", (
|
||||
frm.doc.paid_to_account_currency != company_currency
|
||||
&& frm.doc.paid_from_account_currency != frm.doc.paid_to_account_currency
|
||||
&& frm.doc.base_paid_amount != frm.doc.base_received_amount
|
||||
));
|
||||
|
||||
frm.toggle_display("received_amount", (frm.doc.payment_type=="Internal Transfer" ||
|
||||
frm.doc.paid_from_account_currency != frm.doc.paid_to_account_currency))
|
||||
@@ -501,6 +504,7 @@ frappe.ui.form.on('Payment Entry', {
|
||||
paid_amount: function(frm) {
|
||||
frm.set_value("base_paid_amount", flt(frm.doc.paid_amount) * flt(frm.doc.source_exchange_rate));
|
||||
frm.trigger("reset_received_amount");
|
||||
frm.events.hide_unhide_fields(frm);
|
||||
},
|
||||
|
||||
received_amount: function(frm) {
|
||||
@@ -524,6 +528,7 @@ frappe.ui.form.on('Payment Entry', {
|
||||
frm.events.set_unallocated_amount(frm);
|
||||
|
||||
frm.set_paid_amount_based_on_received_amount = false;
|
||||
frm.events.hide_unhide_fields(frm);
|
||||
},
|
||||
|
||||
reset_received_amount: function(frm) {
|
||||
|
||||
@@ -81,7 +81,12 @@ class PaymentEntry(AccountsController):
|
||||
self.update_advance_paid()
|
||||
self.update_expense_claim()
|
||||
self.delink_advance_entry_references()
|
||||
self.set_payment_req_status()
|
||||
self.set_status()
|
||||
|
||||
def set_payment_req_status(self):
|
||||
from erpnext.accounts.doctype.payment_request.payment_request import update_payment_req_status
|
||||
update_payment_req_status(self, None)
|
||||
|
||||
def update_outstanding_amounts(self):
|
||||
self.set_missing_ref_details(force=True)
|
||||
|
||||
@@ -15,11 +15,11 @@ frappe.ui.form.on('Payment Order', {
|
||||
if (frm.doc.docstatus == 0) {
|
||||
frm.add_custom_button(__('Payment Request'), function() {
|
||||
frm.trigger("get_from_payment_request");
|
||||
}, __("Get from"));
|
||||
}, __("Get Payments from"));
|
||||
|
||||
frm.add_custom_button(__('Payment Entry'), function() {
|
||||
frm.trigger("get_from_payment_entry");
|
||||
}, __("Get from"));
|
||||
}, __("Get Payments from"));
|
||||
|
||||
frm.trigger('remove_button');
|
||||
}
|
||||
|
||||
@@ -59,7 +59,6 @@
|
||||
"fieldtype": "Section Break"
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 1,
|
||||
"fieldname": "references",
|
||||
"fieldtype": "Table",
|
||||
"label": "Payment Order Reference",
|
||||
@@ -108,7 +107,7 @@
|
||||
}
|
||||
],
|
||||
"is_submittable": 1,
|
||||
"modified": "2019-05-14 17:12:24.912666",
|
||||
"modified": "2020-04-06 18:00:56.022642",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Payment Order",
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -66,6 +66,8 @@ class PaymentRequest(Document):
|
||||
if self.payment_request_type == 'Outward':
|
||||
self.db_set('status', 'Initiated')
|
||||
return
|
||||
elif self.payment_request_type == 'Inward':
|
||||
self.db_set('status', 'Requested')
|
||||
|
||||
send_mail = self.payment_gateway_validation()
|
||||
ref_doc = frappe.get_doc(self.reference_doctype, self.reference_name)
|
||||
@@ -88,6 +90,7 @@ class PaymentRequest(Document):
|
||||
if (hasattr(ref_doc, "order_type") and getattr(ref_doc, "order_type") == "Shopping Cart"):
|
||||
from erpnext.selling.doctype.sales_order.sales_order import make_sales_invoice
|
||||
si = make_sales_invoice(self.reference_name, ignore_permissions=True)
|
||||
si.allocate_advances_automatically = True
|
||||
si = si.insert(ignore_permissions=True)
|
||||
si.submit()
|
||||
|
||||
@@ -415,17 +418,31 @@ def make_payment_entry(docname):
|
||||
doc = frappe.get_doc("Payment Request", docname)
|
||||
return doc.create_payment_entry(submit=False).as_dict()
|
||||
|
||||
def make_status_as_paid(doc, method):
|
||||
def update_payment_req_status(doc, method):
|
||||
from erpnext.accounts.doctype.payment_entry.payment_entry import get_reference_details
|
||||
|
||||
for ref in doc.references:
|
||||
payment_request_name = frappe.db.get_value("Payment Request",
|
||||
{"reference_doctype": ref.reference_doctype, "reference_name": ref.reference_name,
|
||||
"docstatus": 1})
|
||||
|
||||
if payment_request_name:
|
||||
doc = frappe.get_doc("Payment Request", payment_request_name)
|
||||
if doc.status != "Paid":
|
||||
doc.db_set('status', 'Paid')
|
||||
frappe.db.commit()
|
||||
ref_details = get_reference_details(ref.reference_doctype, ref.reference_name, doc.party_account_currency)
|
||||
pay_req_doc = frappe.get_doc('Payment Request', payment_request_name)
|
||||
status = pay_req_doc.status
|
||||
|
||||
if status != "Paid" and not ref_details.outstanding_amount:
|
||||
status = 'Paid'
|
||||
elif status != "Partially Paid" and ref_details.outstanding_amount != ref_details.total_amount:
|
||||
status = 'Partially Paid'
|
||||
elif ref_details.outstanding_amount == ref_details.total_amount:
|
||||
if pay_req_doc.payment_request_type == 'Outward':
|
||||
status = 'Initiated'
|
||||
elif pay_req_doc.payment_request_type == 'Inward':
|
||||
status = 'Requested'
|
||||
|
||||
pay_req_doc.db_set('status', status)
|
||||
frappe.db.commit()
|
||||
|
||||
def get_dummy_message(doc):
|
||||
return frappe.render_template("""{% if doc.contact_person -%}
|
||||
|
||||
@@ -4,14 +4,20 @@ frappe.listview_settings['Payment Request'] = {
|
||||
if(doc.status == "Draft") {
|
||||
return [__("Draft"), "darkgrey", "status,=,Draft"];
|
||||
}
|
||||
if(doc.status == "Requested") {
|
||||
return [__("Requested"), "green", "status,=,Requested"];
|
||||
}
|
||||
else if(doc.status == "Initiated") {
|
||||
return [__("Initiated"), "green", "status,=,Initiated"];
|
||||
}
|
||||
else if(doc.status == "Partially Paid") {
|
||||
return [__("Partially Paid"), "orange", "status,=,Partially Paid"];
|
||||
}
|
||||
else if(doc.status == "Paid") {
|
||||
return [__("Paid"), "blue", "status,=,Paid"];
|
||||
}
|
||||
else if(doc.status == "Cancelled") {
|
||||
return [__("Cancelled"), "orange", "status,=,Cancelled"];
|
||||
return [__("Cancelled"), "red", "status,=,Cancelled"];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,6 +101,23 @@ class TestPaymentRequest(unittest.TestCase):
|
||||
self.assertEqual(expected_gle[gle.account][2], gle.credit)
|
||||
self.assertEqual(expected_gle[gle.account][3], gle.against_voucher)
|
||||
|
||||
def test_status(self):
|
||||
si_usd = create_sales_invoice(customer="_Test Customer USD", debit_to="_Test Receivable USD - _TC",
|
||||
currency="USD", conversion_rate=50)
|
||||
|
||||
pr = make_payment_request(dt="Sales Invoice", dn=si_usd.name, recipient_id="saurabh@erpnext.com",
|
||||
mute_email=1, payment_gateway="_Test Gateway - USD", submit_doc=1, return_doc=1)
|
||||
|
||||
pe = pr.create_payment_entry()
|
||||
pr.load_from_db()
|
||||
|
||||
self.assertEqual(pr.status, 'Paid')
|
||||
|
||||
pe.cancel()
|
||||
pr.load_from_db()
|
||||
|
||||
self.assertEqual(pr.status, 'Requested')
|
||||
|
||||
def test_multiple_payment_entries_against_sales_order(self):
|
||||
# Make Sales Order, grand_total = 1000
|
||||
so = make_sales_order()
|
||||
|
||||
@@ -178,7 +178,8 @@ def filter_pricing_rules(args, pricing_rules, doc=None):
|
||||
|
||||
if pricing_rules[0].mixed_conditions and doc:
|
||||
stock_qty, amount, items = get_qty_and_rate_for_mixed_conditions(doc, pr_doc, args)
|
||||
pricing_rules[0].apply_rule_on_other_items = items
|
||||
for pricing_rule_args in pricing_rules:
|
||||
pricing_rule_args.apply_rule_on_other_items = items
|
||||
|
||||
elif pricing_rules[0].is_cumulative:
|
||||
items = [args.get(frappe.scrub(pr_doc.get('apply_on')))]
|
||||
@@ -329,9 +330,9 @@ def get_qty_and_rate_for_mixed_conditions(doc, pr_doc, args):
|
||||
if pr_doc.mixed_conditions:
|
||||
amt = args.get('qty') * args.get("price_list_rate")
|
||||
if args.get("item_code") != row.get("item_code"):
|
||||
amt = row.get('qty') * row.get("price_list_rate")
|
||||
amt = row.get('qty') * (row.get("price_list_rate") or args.get("rate"))
|
||||
|
||||
sum_qty += row.get("stock_qty") or args.get("stock_qty")
|
||||
sum_qty += row.get("stock_qty") or args.get("stock_qty") or args.get("qty")
|
||||
sum_amt += amt
|
||||
|
||||
if pr_doc.is_cumulative:
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe, erpnext
|
||||
from frappe.utils import cint, cstr, formatdate, flt, getdate, nowdate
|
||||
from frappe.utils import cint, cstr, formatdate, flt, getdate, nowdate, get_link_to_form
|
||||
from frappe import _, throw
|
||||
import frappe.defaults
|
||||
|
||||
@@ -146,10 +146,14 @@ class PurchaseInvoice(BuyingController):
|
||||
["account_type", "report_type", "account_currency"], as_dict=True)
|
||||
|
||||
if account.report_type != "Balance Sheet":
|
||||
frappe.throw(_("Credit To account must be a Balance Sheet account"))
|
||||
frappe.throw(_("Please ensure {} account is a Balance Sheet account. \
|
||||
You can change the parent account to a Balance Sheet account or select a different account.")
|
||||
.format(frappe.bold("Credit To")), title=_("Invalid Account"))
|
||||
|
||||
if self.supplier and account.account_type != "Payable":
|
||||
frappe.throw(_("Credit To account must be a Payable account"))
|
||||
frappe.throw(_("Please ensure {} account is a Payable account. \
|
||||
Change the account type to Payable or select a different account.")
|
||||
.format(frappe.bold("Credit To")), title=_("Invalid Account"))
|
||||
|
||||
self.party_account_currency = account.account_currency
|
||||
|
||||
@@ -267,16 +271,30 @@ class PurchaseInvoice(BuyingController):
|
||||
|
||||
def po_required(self):
|
||||
if frappe.db.get_value("Buying Settings", None, "po_required") == 'Yes':
|
||||
|
||||
if frappe.get_value('Supplier', self.supplier, 'allow_purchase_invoice_creation_without_purchase_order'):
|
||||
return
|
||||
|
||||
for d in self.get('items'):
|
||||
if not d.purchase_order:
|
||||
throw(_("As per the Buying Settings if Purchase Order Required == 'YES', then for creating Purchase Invoice, user need to create Purchase Order first for item {0}").format(d.item_code))
|
||||
throw(_("""Purchase Order Required for item {0}
|
||||
To submit the invoice without purchase order please set
|
||||
{1} as {2} in {3}""").format(frappe.bold(d.item_code), frappe.bold(_('Purchase Order Required')),
|
||||
frappe.bold('No'), get_link_to_form('Buying Settings', 'Buying Settings', 'Buying Settings')))
|
||||
|
||||
def pr_required(self):
|
||||
stock_items = self.get_stock_items()
|
||||
if frappe.db.get_value("Buying Settings", None, "pr_required") == 'Yes':
|
||||
|
||||
if frappe.get_value('Supplier', self.supplier, 'allow_purchase_invoice_creation_without_purchase_receipt'):
|
||||
return
|
||||
|
||||
for d in self.get('items'):
|
||||
if not d.purchase_receipt and d.item_code in stock_items:
|
||||
throw(_("As per the Buying Settings if Purchase Reciept Required == 'YES', then for creating Purchase Invoice, user need to create Purchase Receipt first for item {0}").format(d.item_code))
|
||||
throw(_("""Purchase Receipt Required for item {0}
|
||||
To submit the invoice without purchase receipt please set
|
||||
{1} as {2} in {3}""").format(frappe.bold(d.item_code), frappe.bold(_('Purchase Receipt Required')),
|
||||
frappe.bold('No'), get_link_to_form('Buying Settings', 'Buying Settings', 'Buying Settings')))
|
||||
|
||||
def validate_write_off_account(self):
|
||||
if self.write_off_amount and not self.write_off_account:
|
||||
|
||||
@@ -794,7 +794,7 @@ frappe.ui.form.on('Sales Invoice', {
|
||||
},
|
||||
|
||||
refresh: function(frm) {
|
||||
if (frappe.boot.active_domains.includes("Healthcare")){
|
||||
if (frappe.boot.active_domains.includes("Healthcare")) {
|
||||
frm.set_df_property("patient", "hidden", 0);
|
||||
frm.set_df_property("patient_name", "hidden", 0);
|
||||
frm.set_df_property("ref_practitioner", "hidden", 0);
|
||||
@@ -807,7 +807,7 @@ frappe.ui.form.on('Sales Invoice', {
|
||||
},"Get items from");
|
||||
}
|
||||
}
|
||||
else{
|
||||
else {
|
||||
frm.set_df_property("patient", "hidden", 1);
|
||||
frm.set_df_property("patient_name", "hidden", 1);
|
||||
frm.set_df_property("ref_practitioner", "hidden", 1);
|
||||
|
||||
@@ -437,13 +437,17 @@ class SalesInvoice(SellingController):
|
||||
if (not for_validate) or (for_validate and not self.get(fieldname)):
|
||||
self.set(fieldname, pos.get(fieldname))
|
||||
|
||||
customer_price_list = frappe.get_value("Customer", self.customer, 'default_price_list')
|
||||
|
||||
if pos.get("company_address"):
|
||||
self.company_address = pos.get("company_address")
|
||||
|
||||
if not customer_price_list:
|
||||
self.set('selling_price_list', pos.get('selling_price_list'))
|
||||
customer_price_list, customer_group = frappe.get_value("Customer", self.customer, ['default_price_list', 'customer_group'])
|
||||
|
||||
customer_group_price_list = frappe.get_value("Customer Group", customer_group, 'default_price_list')
|
||||
|
||||
selling_price_list = customer_price_list or customer_group_price_list or pos.get('selling_price_list')
|
||||
|
||||
if selling_price_list:
|
||||
self.set('selling_price_list', selling_price_list)
|
||||
|
||||
if not for_validate:
|
||||
self.update_stock = cint(pos.get("update_stock"))
|
||||
@@ -474,13 +478,17 @@ class SalesInvoice(SellingController):
|
||||
["account_type", "report_type", "account_currency"], as_dict=True)
|
||||
|
||||
if not account:
|
||||
frappe.throw(_("Debit To is required"))
|
||||
frappe.throw(_("Debit To is required"), title=_("Account Missing"))
|
||||
|
||||
if account.report_type != "Balance Sheet":
|
||||
frappe.throw(_("Debit To account must be a Balance Sheet account"))
|
||||
frappe.throw(_("Please ensure {} account is a Balance Sheet account. \
|
||||
You can change the parent account to a Balance Sheet account or select a different account.")
|
||||
.format(frappe.bold("Debit To")), title=_("Invalid Account"))
|
||||
|
||||
if self.customer and account.account_type != "Receivable":
|
||||
frappe.throw(_("Debit To account must be a Receivable account"))
|
||||
frappe.throw(_("Please ensure {} account is a Receivable account. \
|
||||
Change the account type to Receivable or select a different account.")
|
||||
.format(frappe.bold("Debit To")), title=_("Invalid Account"))
|
||||
|
||||
self.party_account_currency = account.account_currency
|
||||
|
||||
@@ -542,12 +550,17 @@ class SalesInvoice(SellingController):
|
||||
"""check in manage account if sales order / delivery note required or not."""
|
||||
if self.is_return:
|
||||
return
|
||||
dic = {'Sales Order':['so_required', 'is_pos'],'Delivery Note':['dn_required', 'update_stock']}
|
||||
for i in dic:
|
||||
if frappe.db.get_single_value('Selling Settings', dic[i][0]) == 'Yes':
|
||||
|
||||
prev_doc_field_map = {'Sales Order': ['so_required', 'is_pos'],'Delivery Note': ['dn_required', 'update_stock']}
|
||||
for key, value in iteritems(prev_doc_field_map):
|
||||
if frappe.db.get_single_value('Selling Settings', value[0]) == 'Yes':
|
||||
|
||||
if frappe.get_value('Customer', self.customer, value[0]):
|
||||
continue
|
||||
|
||||
for d in self.get('items'):
|
||||
if (d.item_code and not d.get(i.lower().replace(' ','_')) and not self.get(dic[i][1])):
|
||||
msgprint(_("{0} is mandatory for Item {1}").format(i,d.item_code), raise_exception=1)
|
||||
if (d.item_code and not d.get(key.lower().replace(' ', '_')) and not self.get(value[1])):
|
||||
msgprint(_("{0} is mandatory for Item {1}").format(key, d.item_code), raise_exception=1)
|
||||
|
||||
|
||||
def validate_proj_cust(self):
|
||||
|
||||
@@ -1953,6 +1953,16 @@ class TestSalesInvoice(unittest.TestCase):
|
||||
item.taxes = []
|
||||
item.save()
|
||||
|
||||
def test_customer_provided_parts_si(self):
|
||||
create_item('CUST-0987', is_customer_provided_item = 1, customer = '_Test Customer', is_purchase_item = 0)
|
||||
si = create_sales_invoice(item_code='CUST-0987', rate=0)
|
||||
self.assertEqual(si.get("items")[0].allow_zero_valuation_rate, 1)
|
||||
self.assertEqual(si.get("items")[0].amount, 0)
|
||||
|
||||
# test if Sales Invoice with rate is allowed
|
||||
si2 = create_sales_invoice(item_code='CUST-0987', do_not_save=True)
|
||||
self.assertRaises(frappe.ValidationError, si2.save)
|
||||
|
||||
def create_sales_invoice(**args):
|
||||
si = frappe.new_doc("Sales Invoice")
|
||||
args = frappe._dict(args)
|
||||
@@ -1975,7 +1985,7 @@ def create_sales_invoice(**args):
|
||||
"gst_hsn_code": "999800",
|
||||
"warehouse": args.warehouse or "_Test Warehouse - _TC",
|
||||
"qty": args.qty or 1,
|
||||
"rate": args.rate or 100,
|
||||
"rate": args.rate if args.get("rate") is not None else 100,
|
||||
"income_account": args.income_account or "Sales - _TC",
|
||||
"expense_account": args.expense_account or "Cost of Goods Sold - _TC",
|
||||
"cost_center": args.cost_center or "_Test Cost Center - _TC",
|
||||
|
||||
@@ -82,7 +82,7 @@ class ShippingRule(Document):
|
||||
if not shipping_country:
|
||||
frappe.throw(_('Shipping Address does not have country, which is required for this Shipping Rule'))
|
||||
if shipping_country not in [d.country for d in self.countries]:
|
||||
frappe.throw(_('Shipping rule not applicable for country {0}').format(shipping_country))
|
||||
frappe.throw(_('Shipping rule not applicable for country {0} in Shipping Address').format(shipping_country))
|
||||
|
||||
def add_shipping_rule_to_tax_table(self, doc, shipping_amount):
|
||||
shipping_charge = {
|
||||
|
||||
@@ -11,7 +11,7 @@ from frappe.utils import (add_days, getdate, formatdate, date_diff,
|
||||
add_years, get_timestamp, nowdate, flt, cstr, add_months, get_last_day)
|
||||
from frappe.contacts.doctype.address.address import (get_address_display,
|
||||
get_default_address, get_company_address)
|
||||
from frappe.contacts.doctype.contact.contact import get_contact_details, get_default_contact
|
||||
from frappe.contacts.doctype.contact.contact import get_contact_details
|
||||
from erpnext.exceptions import PartyFrozen, PartyDisabled, InvalidAccountCurrency
|
||||
from erpnext.accounts.utils import get_fiscal_year
|
||||
from erpnext import get_company_currency
|
||||
@@ -162,8 +162,9 @@ def get_default_price_list(party):
|
||||
def set_price_list(party_details, party, party_type, given_price_list, pos=None):
|
||||
# price list
|
||||
price_list = get_permitted_documents('Price List')
|
||||
|
||||
if price_list:
|
||||
|
||||
# if there is only one permitted document based on user permissions, set it
|
||||
if price_list and len(price_list) == 1:
|
||||
price_list = price_list[0]
|
||||
elif pos and party_type == 'Customer':
|
||||
customer_price_list = frappe.get_value('Customer', party.name, 'default_price_list')
|
||||
@@ -613,3 +614,26 @@ def get_partywise_advanced_payment_amount(party_type, posting_date = None):
|
||||
|
||||
if data:
|
||||
return frappe._dict(data)
|
||||
|
||||
def get_default_contact(doctype, name):
|
||||
"""
|
||||
Returns default contact for the given doctype and name.
|
||||
Can be ordered by `contact_type` to either is_primary_contact or is_billing_contact.
|
||||
"""
|
||||
out = frappe.db.sql("""
|
||||
SELECT dl.parent, c.is_primary_contact, c.is_billing_contact
|
||||
FROM `tabDynamic Link` dl
|
||||
INNER JOIN tabContact c ON c.name = dl.parent
|
||||
WHERE
|
||||
dl.link_doctype=%s AND
|
||||
dl.link_name=%s AND
|
||||
dl.parenttype = "Contact"
|
||||
ORDER BY is_primary_contact DESC, is_billing_contact DESC
|
||||
""", (doctype, name))
|
||||
if out:
|
||||
try:
|
||||
return out[0][0]
|
||||
except:
|
||||
return None
|
||||
else:
|
||||
return None
|
||||
|
||||
@@ -9,6 +9,7 @@ from erpnext.accounts.report.financial_statements import (get_period_list, get_c
|
||||
|
||||
def execute(filters=None):
|
||||
period_list = get_period_list(filters.from_fiscal_year, filters.to_fiscal_year,
|
||||
filters.period_start_date, filters.period_end_date, filters.filter_based_on,
|
||||
filters.periodicity, company=filters.company)
|
||||
|
||||
currency = filters.presentation_currency or frappe.get_cached_value('Company', filters.company, "default_currency")
|
||||
@@ -58,7 +59,10 @@ def execute(filters=None):
|
||||
|
||||
chart = get_chart_data(filters, columns, asset, liability, equity)
|
||||
|
||||
return columns, data, message, chart
|
||||
report_summary = get_report_summary(period_list, asset, liability, equity, provisional_profit_loss,
|
||||
total_credit, currency, filters)
|
||||
|
||||
return columns, data, message, chart, report_summary
|
||||
|
||||
def get_provisional_profit_loss(asset, liability, equity, period_list, company, currency=None, consolidated=False):
|
||||
provisional_profit_loss = {}
|
||||
@@ -120,6 +124,56 @@ def check_opening_balance(asset, liability, equity):
|
||||
return _("Previous Financial Year is not closed"),opening_balance
|
||||
return None,None
|
||||
|
||||
def get_report_summary(period_list, asset, liability, equity, provisional_profit_loss, total_credit, currency,
|
||||
filters, consolidated=False):
|
||||
|
||||
net_asset, net_liability, net_equity, net_provisional_profit_loss = 0.0, 0.0, 0.0, 0.0
|
||||
|
||||
if filters.get('accumulated_values'):
|
||||
period_list = [period_list[-1]]
|
||||
|
||||
for period in period_list:
|
||||
key = period if consolidated else period.key
|
||||
if asset:
|
||||
net_asset += asset[-2].get(key)
|
||||
if liability:
|
||||
net_liability += liability[-2].get(key)
|
||||
if equity:
|
||||
net_equity += equity[-2].get(key)
|
||||
if provisional_profit_loss:
|
||||
net_provisional_profit_loss += provisional_profit_loss.get(key)
|
||||
|
||||
return [
|
||||
{
|
||||
"value": net_asset,
|
||||
"label": "Total Asset",
|
||||
"indicator": "Green",
|
||||
"datatype": "Currency",
|
||||
"currency": currency
|
||||
},
|
||||
{
|
||||
"value": net_liability,
|
||||
"label": "Total Liability",
|
||||
"datatype": "Currency",
|
||||
"indicator": "Red",
|
||||
"currency": currency
|
||||
},
|
||||
{
|
||||
"value": net_equity,
|
||||
"label": "Total Equity",
|
||||
"datatype": "Currency",
|
||||
"indicator": "Blue",
|
||||
"currency": currency
|
||||
},
|
||||
{
|
||||
"value": net_provisional_profit_loss,
|
||||
"label": "Provisional Profit / Loss (Credit)",
|
||||
"indicator": "Green" if net_provisional_profit_loss > 0 else "Red",
|
||||
"datatype": "Currency",
|
||||
"currency": currency
|
||||
}
|
||||
]
|
||||
|
||||
def get_chart_data(filters, columns, asset, liability, equity):
|
||||
labels = [d.get("label") for d in columns[2:]]
|
||||
|
||||
|
||||
@@ -9,14 +9,9 @@ frappe.require("assets/erpnext/js/financial_statements.js", function() {
|
||||
// filter. It won't be used in cash flow for now so we pop it. Please take
|
||||
// of this if you are working here.
|
||||
|
||||
frappe.query_reports["Cash Flow"]["filters"].splice(5, 1);
|
||||
frappe.query_reports["Cash Flow"]["filters"].splice(8, 1);
|
||||
|
||||
frappe.query_reports["Cash Flow"]["filters"].push(
|
||||
{
|
||||
"fieldname": "accumulated_values",
|
||||
"label": __("Accumulated Values"),
|
||||
"fieldtype": "Check"
|
||||
},
|
||||
{
|
||||
"fieldname": "include_default_book_entries",
|
||||
"label": __("Include Default Book Entries"),
|
||||
|
||||
@@ -8,6 +8,7 @@ from frappe.utils import cint, cstr
|
||||
from erpnext.accounts.report.financial_statements import (get_period_list, get_columns, get_data)
|
||||
from erpnext.accounts.report.profit_and_loss_statement.profit_and_loss_statement import get_net_profit_loss
|
||||
from erpnext.accounts.utils import get_fiscal_year
|
||||
from six import iteritems
|
||||
|
||||
|
||||
def execute(filters=None):
|
||||
@@ -16,7 +17,8 @@ def execute(filters=None):
|
||||
return execute_custom(filters=filters)
|
||||
|
||||
period_list = get_period_list(filters.from_fiscal_year, filters.to_fiscal_year,
|
||||
filters.periodicity, filters.accumulated_values, filters.company)
|
||||
filters.period_start_date, filters.period_end_date, filters.filter_based_on,
|
||||
filters.periodicity, company=filters.company)
|
||||
|
||||
cash_flow_accounts = get_cash_flow_accounts()
|
||||
|
||||
@@ -29,6 +31,7 @@ def execute(filters=None):
|
||||
net_profit_loss = get_net_profit_loss(income, expense, period_list, filters.company)
|
||||
|
||||
data = []
|
||||
summary_data = {}
|
||||
company_currency = frappe.get_cached_value('Company', filters.company, "default_currency")
|
||||
|
||||
for cash_flow_account in cash_flow_accounts:
|
||||
@@ -64,14 +67,16 @@ def execute(filters=None):
|
||||
section_data.append(account_data)
|
||||
|
||||
add_total_row_account(data, section_data, cash_flow_account['section_footer'],
|
||||
period_list, company_currency)
|
||||
period_list, company_currency, summary_data)
|
||||
|
||||
add_total_row_account(data, data, _("Net Change in Cash"), period_list, company_currency)
|
||||
add_total_row_account(data, data, _("Net Change in Cash"), period_list, company_currency, summary_data)
|
||||
columns = get_columns(filters.periodicity, period_list, filters.accumulated_values, filters.company)
|
||||
|
||||
chart = get_chart_data(columns, data)
|
||||
|
||||
return columns, data, None, chart
|
||||
report_summary = get_report_summary(summary_data, company_currency)
|
||||
|
||||
return columns, data, None, chart, report_summary
|
||||
|
||||
def get_cash_flow_accounts():
|
||||
operation_accounts = {
|
||||
@@ -157,7 +162,7 @@ def get_start_date(period, accumulated_values, company):
|
||||
|
||||
return start_date
|
||||
|
||||
def add_total_row_account(out, data, label, period_list, currency, consolidated = False):
|
||||
def add_total_row_account(out, data, label, period_list, currency, summary_data, consolidated = False):
|
||||
total_row = {
|
||||
"account_name": "'" + _("{0}").format(label) + "'",
|
||||
"account": "'" + _("{0}").format(label) + "'",
|
||||
@@ -176,6 +181,24 @@ def add_total_row_account(out, data, label, period_list, currency, consolidated
|
||||
out.append(total_row)
|
||||
out.append({})
|
||||
|
||||
summary_data[label] = total_row["total"]
|
||||
|
||||
def get_report_summary(summary_data, currency):
|
||||
report_summary = []
|
||||
|
||||
for label, value in iteritems(summary_data):
|
||||
report_summary.append(
|
||||
{
|
||||
"value": value,
|
||||
"label": label,
|
||||
"datatype": "Currency",
|
||||
"currency": currency
|
||||
}
|
||||
)
|
||||
|
||||
return report_summary
|
||||
|
||||
|
||||
def get_chart_data(columns, data):
|
||||
labels = [d.get("label") for d in columns[2:]]
|
||||
datasets = [{'name':account.get('account').replace("'", ""), 'values': [account.get('total')]} for account in data if account.get('parent_account') == None and account.get('currency')]
|
||||
|
||||
@@ -12,6 +12,39 @@ frappe.query_reports["Consolidated Financial Statement"] = {
|
||||
"default": frappe.defaults.get_user_default("Company"),
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname":"filter_based_on",
|
||||
"label": __("Filter Based On"),
|
||||
"fieldtype": "Select",
|
||||
"options": ["Fiscal Year", "Date Range"],
|
||||
"default": ["Fiscal Year"],
|
||||
"reqd": 1,
|
||||
on_change: function() {
|
||||
let filter_based_on = frappe.query_report.get_filter_value('filter_based_on');
|
||||
frappe.query_report.toggle_filter_display('from_fiscal_year', filter_based_on === 'Date Range');
|
||||
frappe.query_report.toggle_filter_display('to_fiscal_year', filter_based_on === 'Date Range');
|
||||
frappe.query_report.toggle_filter_display('period_start_date', filter_based_on === 'Fiscal Year');
|
||||
frappe.query_report.toggle_filter_display('period_end_date', filter_based_on === 'Fiscal Year');
|
||||
|
||||
frappe.query_report.refresh();
|
||||
}
|
||||
},
|
||||
{
|
||||
"fieldname":"period_start_date",
|
||||
"label": __("Start Date"),
|
||||
"fieldtype": "Date",
|
||||
"default": frappe.datetime.nowdate(),
|
||||
"hidden": 1,
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname":"period_end_date",
|
||||
"label": __("End Date"),
|
||||
"fieldtype": "Date",
|
||||
"default": frappe.datetime.add_months(frappe.datetime.nowdate(), 12),
|
||||
"hidden": 1,
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname":"from_fiscal_year",
|
||||
"label": __("Start Year"),
|
||||
@@ -61,5 +94,17 @@ frappe.query_reports["Consolidated Financial Statement"] = {
|
||||
"fieldtype": "Check",
|
||||
"default": 1
|
||||
}
|
||||
]
|
||||
],
|
||||
"formatter": function(value, row, column, data, default_formatter) {
|
||||
value = default_formatter(value, row, column, data);
|
||||
|
||||
if (!data.parent_account) {
|
||||
value = $(`<span>${value}</span>`);
|
||||
|
||||
var $value = $(value).css("font-weight", "bold");
|
||||
|
||||
value = $value.wrap("<p></p>").parent().html();
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,15 +4,15 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe, erpnext
|
||||
from frappe import _
|
||||
from frappe.utils import flt, cint
|
||||
from frappe.utils import flt, cint, getdate
|
||||
from erpnext.accounts.report.utils import get_currency, convert_to_presentation_currency
|
||||
from erpnext.accounts.report.financial_statements import get_fiscal_year_data, sort_accounts
|
||||
from erpnext.accounts.report.balance_sheet.balance_sheet import (get_provisional_profit_loss,
|
||||
check_opening_balance, get_chart_data)
|
||||
check_opening_balance, get_chart_data, get_report_summary as get_bs_summary)
|
||||
from erpnext.accounts.report.profit_and_loss_statement.profit_and_loss_statement import (get_net_profit_loss,
|
||||
get_chart_data as get_pl_chart_data)
|
||||
get_chart_data as get_pl_chart_data, get_report_summary as get_pl_summary)
|
||||
from erpnext.accounts.report.cash_flow.cash_flow import (get_cash_flow_accounts, get_account_type_based_gl_data,
|
||||
add_total_row_account)
|
||||
add_total_row_account, get_report_summary as get_cash_flow_summary)
|
||||
|
||||
def execute(filters=None):
|
||||
columns, data, message, chart = [], [], [], []
|
||||
@@ -25,17 +25,17 @@ def execute(filters=None):
|
||||
columns = get_columns(companies_column)
|
||||
|
||||
if filters.get('report') == "Balance Sheet":
|
||||
data, message, chart = get_balance_sheet_data(fiscal_year, companies, columns, filters)
|
||||
data, message, chart, report_summary = get_balance_sheet_data(fiscal_year, companies, columns, filters)
|
||||
elif filters.get('report') == "Profit and Loss Statement":
|
||||
data, message, chart = get_profit_loss_data(fiscal_year, companies, columns, filters)
|
||||
data, message, chart, report_summary = get_profit_loss_data(fiscal_year, companies, columns, filters)
|
||||
else:
|
||||
if cint(frappe.db.get_single_value('Accounts Settings', 'use_custom_cash_flow')):
|
||||
from erpnext.accounts.report.cash_flow.custom_cash_flow import execute as execute_custom
|
||||
return execute_custom(filters=filters)
|
||||
|
||||
data = get_cash_flow_data(fiscal_year, companies, filters)
|
||||
data, report_summary = get_cash_flow_data(fiscal_year, companies, filters)
|
||||
|
||||
return columns, data, message, chart
|
||||
return columns, data, message, chart, report_summary
|
||||
|
||||
def get_balance_sheet_data(fiscal_year, companies, columns, filters):
|
||||
asset = get_data(companies, "Asset", "Debit", fiscal_year, filters=filters)
|
||||
@@ -75,9 +75,12 @@ def get_balance_sheet_data(fiscal_year, companies, columns, filters):
|
||||
if total_credit:
|
||||
data.append(total_credit)
|
||||
|
||||
report_summary = get_bs_summary(companies, asset, liability, equity, provisional_profit_loss, total_credit,
|
||||
company_currency, filters, True)
|
||||
|
||||
chart = get_chart_data(filters, columns, asset, liability, equity)
|
||||
|
||||
return data, message, chart
|
||||
return data, message, chart, report_summary
|
||||
|
||||
def get_profit_loss_data(fiscal_year, companies, columns, filters):
|
||||
income, expense, net_profit_loss = get_income_expense_data(companies, fiscal_year, filters)
|
||||
@@ -90,7 +93,9 @@ def get_profit_loss_data(fiscal_year, companies, columns, filters):
|
||||
|
||||
chart = get_pl_chart_data(filters, columns, income, expense, net_profit_loss)
|
||||
|
||||
return data, None, chart
|
||||
report_summary = get_pl_summary(companies, '', income, expense, net_profit_loss, True)
|
||||
|
||||
return data, None, chart, report_summary
|
||||
|
||||
def get_income_expense_data(companies, fiscal_year, filters):
|
||||
company_currency = get_company_currency(filters)
|
||||
@@ -108,6 +113,7 @@ def get_cash_flow_data(fiscal_year, companies, filters):
|
||||
income, expense, net_profit_loss = get_income_expense_data(companies, fiscal_year, filters)
|
||||
|
||||
data = []
|
||||
summary_data = {}
|
||||
company_currency = get_company_currency(filters)
|
||||
|
||||
for cash_flow_account in cash_flow_accounts:
|
||||
@@ -142,11 +148,13 @@ def get_cash_flow_data(fiscal_year, companies, filters):
|
||||
section_data.append(account_data)
|
||||
|
||||
add_total_row_account(data, section_data, cash_flow_account['section_footer'],
|
||||
companies, company_currency, True)
|
||||
companies, company_currency, summary_data, True)
|
||||
|
||||
add_total_row_account(data, data, _("Net Change in Cash"), companies, company_currency, True)
|
||||
add_total_row_account(data, data, _("Net Change in Cash"), companies, company_currency, summary_data, True)
|
||||
|
||||
return data
|
||||
report_summary = get_cash_flow_summary(summary_data, company_currency)
|
||||
|
||||
return data, report_summary
|
||||
|
||||
def get_account_type_based_data(account_type, companies, fiscal_year, filters):
|
||||
data = {}
|
||||
@@ -200,17 +208,24 @@ def get_data(companies, root_type, balance_must_be, fiscal_year, filters=None, i
|
||||
|
||||
company_currency = get_company_currency(filters)
|
||||
|
||||
if filters.filter_based_on == 'Fiscal Year':
|
||||
start_date = fiscal_year.year_start_date
|
||||
end_date = fiscal_year.year_end_date
|
||||
else:
|
||||
start_date = filters.period_start_date
|
||||
end_date = filters.period_end_date
|
||||
|
||||
gl_entries_by_account = {}
|
||||
for root in frappe.db.sql("""select lft, rgt from tabAccount
|
||||
where root_type=%s and ifnull(parent_account, '') = ''""", root_type, as_dict=1):
|
||||
|
||||
set_gl_entries_by_account(fiscal_year.year_start_date,
|
||||
fiscal_year.year_end_date, root.lft, root.rgt, filters,
|
||||
set_gl_entries_by_account(start_date,
|
||||
end_date, root.lft, root.rgt, filters,
|
||||
gl_entries_by_account, accounts_by_name, ignore_closing_entries=False)
|
||||
|
||||
calculate_values(accounts_by_name, gl_entries_by_account, companies, fiscal_year, filters)
|
||||
calculate_values(accounts_by_name, gl_entries_by_account, companies, start_date, filters)
|
||||
accumulate_values_into_parents(accounts, accounts_by_name, companies)
|
||||
out = prepare_data(accounts, fiscal_year, balance_must_be, companies, company_currency)
|
||||
out = prepare_data(accounts, start_date, end_date, balance_must_be, companies, company_currency)
|
||||
|
||||
if out:
|
||||
add_total_row(out, root_type, balance_must_be, companies, company_currency)
|
||||
@@ -221,7 +236,7 @@ def get_company_currency(filters=None):
|
||||
return (filters.get('presentation_currency')
|
||||
or frappe.get_cached_value('Company', filters.company, "default_currency"))
|
||||
|
||||
def calculate_values(accounts_by_name, gl_entries_by_account, companies, fiscal_year, filters):
|
||||
def calculate_values(accounts_by_name, gl_entries_by_account, companies, start_date, filters):
|
||||
for entries in gl_entries_by_account.values():
|
||||
for entry in entries:
|
||||
key = entry.account_number or entry.account_name
|
||||
@@ -233,7 +248,7 @@ def calculate_values(accounts_by_name, gl_entries_by_account, companies, fiscal_
|
||||
and entry.company in companies.get(company)):
|
||||
d[company] = d.get(company, 0.0) + flt(entry.debit) - flt(entry.credit)
|
||||
|
||||
if entry.posting_date < fiscal_year.year_start_date:
|
||||
if entry.posting_date < getdate(start_date):
|
||||
d["opening_balance"] = d.get("opening_balance", 0.0) + flt(entry.debit) - flt(entry.credit)
|
||||
|
||||
def accumulate_values_into_parents(accounts, accounts_by_name, companies):
|
||||
@@ -287,10 +302,8 @@ def get_accounts(root_type, filters):
|
||||
`tabAccount` where company = %s and root_type = %s
|
||||
""" , (filters.get('company'), root_type), as_dict=1)
|
||||
|
||||
def prepare_data(accounts, fiscal_year, balance_must_be, companies, company_currency):
|
||||
def prepare_data(accounts, start_date, end_date, balance_must_be, companies, company_currency):
|
||||
data = []
|
||||
year_start_date = fiscal_year.year_start_date
|
||||
year_end_date = fiscal_year.year_end_date
|
||||
|
||||
for d in accounts:
|
||||
# add to output
|
||||
@@ -301,8 +314,8 @@ def prepare_data(accounts, fiscal_year, balance_must_be, companies, company_curr
|
||||
"account": _(d.account_name),
|
||||
"parent_account": _(d.parent_account),
|
||||
"indent": flt(d.indent),
|
||||
"year_start_date": year_start_date,
|
||||
"year_end_date": year_end_date,
|
||||
"year_start_date": start_date,
|
||||
"year_end_date": end_date,
|
||||
"currency": company_currency,
|
||||
"opening_balance": d.get("opening_balance", 0.0) * (1 if balance_must_be == "Debit" else -1)
|
||||
})
|
||||
|
||||
@@ -18,17 +18,20 @@ from frappe.utils import (flt, getdate, get_first_day, add_months, add_days, for
|
||||
from six import itervalues
|
||||
from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import get_accounting_dimensions, get_dimension_with_children
|
||||
|
||||
def get_period_list(from_fiscal_year, to_fiscal_year, periodicity, accumulated_values=False,
|
||||
def get_period_list(from_fiscal_year, to_fiscal_year, period_start_date, period_end_date, filter_based_on, periodicity, accumulated_values=False,
|
||||
company=None, reset_period_on_fy_change=True):
|
||||
"""Get a list of dict {"from_date": from_date, "to_date": to_date, "key": key, "label": label}
|
||||
Periodicity can be (Yearly, Quarterly, Monthly)"""
|
||||
|
||||
fiscal_year = get_fiscal_year_data(from_fiscal_year, to_fiscal_year)
|
||||
validate_fiscal_year(fiscal_year, from_fiscal_year, to_fiscal_year)
|
||||
|
||||
# start with first day, so as to avoid year to_dates like 2-April if ever they occur]
|
||||
year_start_date = getdate(fiscal_year.year_start_date)
|
||||
year_end_date = getdate(fiscal_year.year_end_date)
|
||||
if filter_based_on == 'Fiscal Year':
|
||||
fiscal_year = get_fiscal_year_data(from_fiscal_year, to_fiscal_year)
|
||||
validate_fiscal_year(fiscal_year, from_fiscal_year, to_fiscal_year)
|
||||
year_start_date = getdate(fiscal_year.year_start_date)
|
||||
year_end_date = getdate(fiscal_year.year_end_date)
|
||||
else:
|
||||
validate_dates(period_start_date, period_end_date)
|
||||
year_start_date = getdate(period_start_date)
|
||||
year_end_date = getdate(period_end_date)
|
||||
|
||||
months_to_add = {
|
||||
"Yearly": 12,
|
||||
@@ -42,6 +45,9 @@ def get_period_list(from_fiscal_year, to_fiscal_year, periodicity, accumulated_v
|
||||
start_date = year_start_date
|
||||
months = get_months(year_start_date, year_end_date)
|
||||
|
||||
if (months // months_to_add) != (months / months_to_add):
|
||||
months += months_to_add
|
||||
|
||||
for i in range(months // months_to_add):
|
||||
period = frappe._dict({
|
||||
"from_date": start_date
|
||||
@@ -103,9 +109,18 @@ def get_fiscal_year_data(from_fiscal_year, to_fiscal_year):
|
||||
|
||||
|
||||
def validate_fiscal_year(fiscal_year, from_fiscal_year, to_fiscal_year):
|
||||
if not fiscal_year.get('year_start_date') and not fiscal_year.get('year_end_date'):
|
||||
if not fiscal_year.get('year_start_date') or not fiscal_year.get('year_end_date'):
|
||||
frappe.throw(_("Start Year and End Year are mandatory"))
|
||||
|
||||
if getdate(fiscal_year.get('year_end_date')) < getdate(fiscal_year.get('year_start_date')):
|
||||
frappe.throw(_("End Year cannot be before Start Year"))
|
||||
|
||||
def validate_dates(from_date, to_date):
|
||||
if not from_date or not to_date:
|
||||
frappe.throw("From Date and To Date are mandatory")
|
||||
|
||||
if to_date < from_date:
|
||||
frappe.throw("To Date cannot be less than From Date")
|
||||
|
||||
def get_months(start_date, end_date):
|
||||
diff = (12 * end_date.year + end_date.month) - (12 * start_date.year + start_date.month)
|
||||
@@ -151,7 +166,7 @@ def get_data(
|
||||
|
||||
calculate_values(
|
||||
accounts_by_name, gl_entries_by_account, period_list, accumulated_values, ignore_accumulated_values_for_fy)
|
||||
accumulate_values_into_parents(accounts, accounts_by_name, period_list, accumulated_values)
|
||||
accumulate_values_into_parents(accounts, accounts_by_name, period_list)
|
||||
out = prepare_data(accounts, balance_must_be, period_list, company_currency)
|
||||
out = filter_out_zero_value_rows(out, parent_children_map)
|
||||
|
||||
@@ -191,7 +206,7 @@ def calculate_values(
|
||||
d["opening_balance"] = d.get("opening_balance", 0.0) + flt(entry.debit) - flt(entry.credit)
|
||||
|
||||
|
||||
def accumulate_values_into_parents(accounts, accounts_by_name, period_list, accumulated_values):
|
||||
def accumulate_values_into_parents(accounts, accounts_by_name, period_list):
|
||||
"""accumulate children's values in parent accounts"""
|
||||
for d in reversed(accounts):
|
||||
if d.parent_account:
|
||||
@@ -419,7 +434,9 @@ def get_additional_conditions(from_date, ignore_closing_entries, filters):
|
||||
if frappe.get_cached_value('DocType', dimension.document_type, 'is_tree'):
|
||||
filters[dimension.fieldname] = get_dimension_with_children(dimension.document_type,
|
||||
filters.get(dimension.fieldname))
|
||||
additional_conditions.append("{0} in %({0})s".format(dimension.fieldname))
|
||||
additional_conditions.append("{0} in %({0})s".format(dimension.fieldname))
|
||||
else:
|
||||
additional_conditions.append("{0} in (%({0})s)".format(dimension.fieldname))
|
||||
|
||||
return " and {}".format(" and ".join(additional_conditions)) if additional_conditions else ""
|
||||
|
||||
|
||||
@@ -202,7 +202,9 @@ def get_conditions(filters):
|
||||
if frappe.get_cached_value('DocType', dimension.document_type, 'is_tree'):
|
||||
filters[dimension.fieldname] = get_dimension_with_children(dimension.document_type,
|
||||
filters.get(dimension.fieldname))
|
||||
conditions.append("{0} in %({0})s".format(dimension.fieldname))
|
||||
conditions.append("{0} in %({0})s".format(dimension.fieldname))
|
||||
else:
|
||||
conditions.append("{0} in (%({0})s)".format(dimension.fieldname))
|
||||
|
||||
return "and {}".format(" and ".join(conditions)) if conditions else ""
|
||||
|
||||
|
||||
@@ -15,11 +15,6 @@ frappe.require("assets/erpnext/js/financial_statements.js", function() {
|
||||
return frappe.db.get_link_options('Project', txt);
|
||||
}
|
||||
},
|
||||
{
|
||||
"fieldname": "accumulated_values",
|
||||
"label": __("Accumulated Values"),
|
||||
"fieldtype": "Check"
|
||||
},
|
||||
{
|
||||
"fieldname": "include_default_book_entries",
|
||||
"label": __("Include Default Book Entries"),
|
||||
|
||||
@@ -9,7 +9,8 @@ from erpnext.accounts.report.financial_statements import (get_period_list, get_c
|
||||
|
||||
def execute(filters=None):
|
||||
period_list = get_period_list(filters.from_fiscal_year, filters.to_fiscal_year,
|
||||
filters.periodicity, filters.accumulated_values, filters.company)
|
||||
filters.period_start_date, filters.period_end_date, filters.filter_based_on, filters.periodicity,
|
||||
company=filters.company)
|
||||
|
||||
income = get_data(filters.company, "Income", "Credit", period_list, filters = filters,
|
||||
accumulated_values=filters.accumulated_values,
|
||||
@@ -31,20 +32,22 @@ def execute(filters=None):
|
||||
|
||||
chart = get_chart_data(filters, columns, income, expense, net_profit_loss)
|
||||
|
||||
report_summary = get_report_summary(columns, income, expense, net_profit_loss, filters.periodicity, period_list)
|
||||
default_currency = frappe.get_cached_value('Company', filters.company, "default_currency")
|
||||
report_summary = get_report_summary(period_list, filters.periodicity, income, expense, net_profit_loss, default_currency)
|
||||
|
||||
return columns, data, None, chart, report_summary
|
||||
|
||||
def get_report_summary(columns, income, expense, net_profit_loss, period_list, periodicity):
|
||||
income_data, expense_data, net_profit = [], [], []
|
||||
def get_report_summary(period_list, periodicity, income, expense, net_profit_loss, default_currency, consolidated=False):
|
||||
net_income, net_expense, net_profit = 0.0, 0.0, 0.0
|
||||
|
||||
for p in columns[2:]:
|
||||
for period in period_list:
|
||||
key = period if consolidated else period.key
|
||||
if income:
|
||||
income_data.append(income[-2].get(p.get("fieldname")))
|
||||
net_income += income[-2].get(key)
|
||||
if expense:
|
||||
expense_data.append(expense[-2].get(p.get("fieldname")))
|
||||
net_expense += expense[-2].get(key)
|
||||
if net_profit_loss:
|
||||
net_profit.append(net_profit_loss.get(p.get("fieldname")))
|
||||
net_profit += net_profit_loss.get(key)
|
||||
|
||||
if (len(period_list) == 1 and periodicity== 'Yearly'):
|
||||
profit_label = _("Profit This Year")
|
||||
@@ -57,23 +60,23 @@ def get_report_summary(columns, income, expense, net_profit_loss, period_list, p
|
||||
|
||||
return [
|
||||
{
|
||||
"value": net_profit[-1],
|
||||
"indicator": "Green" if net_profit[-1] > 0 else "Red",
|
||||
"value": net_profit,
|
||||
"indicator": "Green" if net_profit > 0 else "Red",
|
||||
"label": profit_label,
|
||||
"datatype": "Currency",
|
||||
"currency": net_profit_loss.get("currency")
|
||||
"currency": net_profit_loss.get("currency") if net_profit_loss else default_currency
|
||||
},
|
||||
{
|
||||
"value": income_data[-1],
|
||||
"value": net_income,
|
||||
"label": income_label,
|
||||
"datatype": "Currency",
|
||||
"currency": income[-1].get('currency')
|
||||
"currency": income[-1].get('currency') if income else default_currency
|
||||
},
|
||||
{
|
||||
"value": expense_data[-1],
|
||||
"value": net_expense,
|
||||
"label": expense_label,
|
||||
"datatype": "Currency",
|
||||
"currency": expense[-1].get('currency')
|
||||
"currency": expense[-1].get('currency') if expense else default_currency
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
@@ -34,6 +34,33 @@ frappe.query_reports["Purchase Register"] = {
|
||||
"label": __("Mode of Payment"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Mode of Payment"
|
||||
},
|
||||
{
|
||||
"fieldname":"cost_center",
|
||||
"label": __("Cost Center"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Cost Center"
|
||||
},
|
||||
{
|
||||
"fieldname":"warehouse",
|
||||
"label": __("Warehouse"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Warehouse"
|
||||
},
|
||||
{
|
||||
"fieldname":"item_group",
|
||||
"label": __("Item Group"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Item Group"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
erpnext.dimension_filters.forEach((dimension) => {
|
||||
frappe.query_reports["Purchase Register"].filters.splice(7, 0 ,{
|
||||
"fieldname": dimension["fieldname"],
|
||||
"label": __(dimension["label"]),
|
||||
"fieldtype": "Link",
|
||||
"options": dimension["document_type"]
|
||||
});
|
||||
});
|
||||
@@ -5,6 +5,7 @@ from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe.utils import flt
|
||||
from frappe import msgprint, _
|
||||
from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import get_accounting_dimensions, get_dimension_with_children
|
||||
|
||||
def execute(filters=None):
|
||||
return _execute(filters)
|
||||
@@ -66,7 +67,7 @@ def _execute(filters=None, additional_table_columns=None, additional_query_colum
|
||||
total_tax += tax_amount
|
||||
row.append(tax_amount)
|
||||
|
||||
# total tax, grand total, rounded total & outstanding amount
|
||||
# total tax, grand total, rounded total & outstanding amount
|
||||
row += [total_tax, inv.base_grand_total, flt(inv.base_grand_total, 0), inv.outstanding_amount]
|
||||
data.append(row)
|
||||
|
||||
@@ -134,6 +135,38 @@ def get_conditions(filters):
|
||||
|
||||
if filters.get("mode_of_payment"): conditions += " and ifnull(mode_of_payment, '') = %(mode_of_payment)s"
|
||||
|
||||
if filters.get("cost_center"):
|
||||
conditions += """ and exists(select name from `tabPurchase Invoice Item`
|
||||
where parent=`tabPurchase Invoice`.name
|
||||
and ifnull(`tabPurchase Invoice Item`.cost_center, '') = %(cost_center)s)"""
|
||||
|
||||
if filters.get("warehouse"):
|
||||
conditions += """ and exists(select name from `tabPurchase Invoice Item`
|
||||
where parent=`tabPurchase Invoice`.name
|
||||
and ifnull(`tabPurchase Invoice Item`.warehouse, '') = %(warehouse)s)"""
|
||||
|
||||
if filters.get("item_group"):
|
||||
conditions += """ and exists(select name from `tabPurchase Invoice Item`
|
||||
where parent=`tabPurchase Invoice`.name
|
||||
and ifnull(`tabPurchase Invoice Item`.item_group, '') = %(item_group)s)"""
|
||||
|
||||
accounting_dimensions = get_accounting_dimensions(as_list=False)
|
||||
|
||||
if accounting_dimensions:
|
||||
common_condition = """
|
||||
and exists(select name from `tabPurchase Invoice Item`
|
||||
where parent=`tabPurchase Invoice`.name
|
||||
"""
|
||||
for dimension in accounting_dimensions:
|
||||
if filters.get(dimension.fieldname):
|
||||
if frappe.get_cached_value('DocType', dimension.document_type, 'is_tree'):
|
||||
filters[dimension.fieldname] = get_dimension_with_children(dimension.document_type,
|
||||
filters.get(dimension.fieldname))
|
||||
|
||||
conditions += common_condition + "and ifnull(`tabPurchase Invoice Item`.{0}, '') in %({0})s)".format(dimension.fieldname)
|
||||
else:
|
||||
conditions += common_condition + "and ifnull(`tabPurchase Invoice Item`.{0}, '') in (%({0})s))".format(dimension.fieldname)
|
||||
|
||||
return conditions
|
||||
|
||||
def get_invoices(filters, additional_query_columns):
|
||||
|
||||
@@ -344,16 +344,19 @@ def get_conditions(filters):
|
||||
accounting_dimensions = get_accounting_dimensions(as_list=False)
|
||||
|
||||
if accounting_dimensions:
|
||||
common_condition = """
|
||||
and exists(select name from `tabSales Invoice Item`
|
||||
where parent=`tabSales Invoice`.name
|
||||
"""
|
||||
for dimension in accounting_dimensions:
|
||||
if filters.get(dimension.fieldname):
|
||||
if frappe.get_cached_value('DocType', dimension.document_type, 'is_tree'):
|
||||
filters[dimension.fieldname] = get_dimension_with_children(dimension.document_type,
|
||||
filters.get(dimension.fieldname))
|
||||
|
||||
conditions += """ and exists(select name from `tabSales Invoice Item`
|
||||
where parent=`tabSales Invoice`.name
|
||||
and ifnull(`tabSales Invoice Item`.{0}, '') in %({0})s)""".format(dimension.fieldname)
|
||||
|
||||
conditions += common_condition + "and ifnull(`tabSales Invoice Item`.{0}, '') in %({0})s)".format(dimension.fieldname)
|
||||
else:
|
||||
conditions += common_condition + "and ifnull(`tabSales Invoice Item`.{0}, '') in (%({0})s))".format(dimension.fieldname)
|
||||
|
||||
return conditions
|
||||
|
||||
|
||||
@@ -126,7 +126,9 @@ def get_rootwise_opening_balances(filters, report_type):
|
||||
if frappe.get_cached_value('DocType', dimension.document_type, 'is_tree'):
|
||||
filters[dimension.fieldname] = get_dimension_with_children(dimension.document_type,
|
||||
filters.get(dimension.fieldname))
|
||||
additional_conditions += "and {0} in %({0})s".format(dimension.fieldname)
|
||||
additional_conditions += "and {0} in %({0})s".format(dimension.fieldname)
|
||||
else:
|
||||
additional_conditions += "and {0} in (%({0})s)".format(dimension.fieldname)
|
||||
|
||||
query_filters.update({
|
||||
dimension.fieldname: filters.get(dimension.fieldname)
|
||||
|
||||
@@ -1,16 +1,19 @@
|
||||
{
|
||||
"cards": [
|
||||
{
|
||||
"links": "[\n {\n \"label\": \"Crop\",\n \"name\": \"Crop\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Crop Cycle\",\n \"name\": \"Crop Cycle\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Location\",\n \"name\": \"Location\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n }\n]",
|
||||
"title": "Crops & Lands"
|
||||
"hidden": 0,
|
||||
"label": "Crops & Lands",
|
||||
"links": "[\n {\n \"label\": \"Crop\",\n \"name\": \"Crop\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Crop Cycle\",\n \"name\": \"Crop Cycle\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Location\",\n \"name\": \"Location\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n }\n]"
|
||||
},
|
||||
{
|
||||
"links": "[\n {\n \"label\": \"Plant Analysis\",\n \"name\": \"Plant Analysis\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Soil Analysis\",\n \"name\": \"Soil Analysis\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Water Analysis\",\n \"name\": \"Water Analysis\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Soil Texture\",\n \"name\": \"Soil Texture\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Weather\",\n \"name\": \"Weather\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Agriculture Analysis Criteria\",\n \"name\": \"Agriculture Analysis Criteria\",\n \"type\": \"doctype\"\n }\n]",
|
||||
"title": "Analytics"
|
||||
"hidden": 0,
|
||||
"label": "Analytics",
|
||||
"links": "[\n {\n \"label\": \"Plant Analysis\",\n \"name\": \"Plant Analysis\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Soil Analysis\",\n \"name\": \"Soil Analysis\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Water Analysis\",\n \"name\": \"Water Analysis\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Soil Texture\",\n \"name\": \"Soil Texture\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Weather\",\n \"name\": \"Weather\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Agriculture Analysis Criteria\",\n \"name\": \"Agriculture Analysis Criteria\",\n \"type\": \"doctype\"\n }\n]"
|
||||
},
|
||||
{
|
||||
"links": "[\n {\n \"label\": \"Disease\",\n \"name\": \"Disease\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Fertilizer\",\n \"name\": \"Fertilizer\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n }\n]",
|
||||
"title": "Diseases & Fertilizers"
|
||||
"hidden": 0,
|
||||
"label": "Diseases & Fertilizers",
|
||||
"links": "[\n {\n \"label\": \"Disease\",\n \"name\": \"Disease\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Fertilizer\",\n \"name\": \"Fertilizer\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n }\n]"
|
||||
}
|
||||
],
|
||||
"category": "Domains",
|
||||
@@ -24,7 +27,7 @@
|
||||
"idx": 0,
|
||||
"is_standard": 1,
|
||||
"label": "Agriculture",
|
||||
"modified": "2020-03-12 16:30:37.565413",
|
||||
"modified": "2020-04-01 11:28:51.032822",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Agriculture",
|
||||
"name": "Agriculture",
|
||||
|
||||
@@ -1,17 +1,19 @@
|
||||
{
|
||||
"cards": [
|
||||
{
|
||||
"links": "[\n {\n \"label\": \"Asset\",\n \"name\": \"Asset\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Location\",\n \"name\": \"Location\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Asset Category\",\n \"name\": \"Asset Category\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Transfer an asset from one warehouse to another\",\n \"label\": \"Asset Movement\",\n \"name\": \"Asset Movement\",\n \"type\": \"doctype\"\n }\n]",
|
||||
"title": "Assets"
|
||||
"hidden": 0,
|
||||
"label": "Assets",
|
||||
"links": "[\n {\n \"label\": \"Asset\",\n \"name\": \"Asset\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Location\",\n \"name\": \"Location\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Asset Category\",\n \"name\": \"Asset Category\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Transfer an asset from one warehouse to another\",\n \"label\": \"Asset Movement\",\n \"name\": \"Asset Movement\",\n \"type\": \"doctype\"\n }\n]"
|
||||
},
|
||||
{
|
||||
"links": "[\n {\n \"label\": \"Asset Maintenance Team\",\n \"name\": \"Asset Maintenance Team\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"dependencies\": [\n \"Asset Maintenance Team\"\n ],\n \"label\": \"Asset Maintenance\",\n \"name\": \"Asset Maintenance\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"dependencies\": [\n \"Asset Maintenance\"\n ],\n \"label\": \"Asset Maintenance Log\",\n \"name\": \"Asset Maintenance Log\",\n \"type\": \"doctype\"\n },\n {\n \"dependencies\": [\n \"Asset\"\n ],\n \"label\": \"Asset Value Adjustment\",\n \"name\": \"Asset Value Adjustment\",\n \"type\": \"doctype\"\n },\n {\n \"dependencies\": [\n \"Asset\"\n ],\n \"label\": \"Asset Repair\",\n \"name\": \"Asset Repair\",\n \"type\": \"doctype\"\n }\n]",
|
||||
"title": "Maintenance"
|
||||
"hidden": 0,
|
||||
"label": "Maintenance",
|
||||
"links": "[\n {\n \"label\": \"Asset Maintenance Team\",\n \"name\": \"Asset Maintenance Team\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"dependencies\": [\n \"Asset Maintenance Team\"\n ],\n \"label\": \"Asset Maintenance\",\n \"name\": \"Asset Maintenance\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"dependencies\": [\n \"Asset Maintenance\"\n ],\n \"label\": \"Asset Maintenance Log\",\n \"name\": \"Asset Maintenance Log\",\n \"type\": \"doctype\"\n },\n {\n \"dependencies\": [\n \"Asset\"\n ],\n \"label\": \"Asset Value Adjustment\",\n \"name\": \"Asset Value Adjustment\",\n \"type\": \"doctype\"\n },\n {\n \"dependencies\": [\n \"Asset\"\n ],\n \"label\": \"Asset Repair\",\n \"name\": \"Asset Repair\",\n \"type\": \"doctype\"\n }\n]"
|
||||
},
|
||||
{
|
||||
"icon": "fa fa-table",
|
||||
"links": "[\n {\n \"dependencies\": [\n \"Asset\"\n ],\n \"doctype\": \"Asset\",\n \"is_query_report\": true,\n \"label\": \"Asset Depreciation Ledger\",\n \"name\": \"Asset Depreciation Ledger\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"Asset\"\n ],\n \"doctype\": \"Asset\",\n \"is_query_report\": true,\n \"label\": \"Asset Depreciations and Balances\",\n \"name\": \"Asset Depreciations and Balances\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"Asset Maintenance\"\n ],\n \"doctype\": \"Asset Maintenance\",\n \"label\": \"Asset Maintenance\",\n \"name\": \"Asset Maintenance\",\n \"type\": \"report\"\n }\n]",
|
||||
"title": "Reports"
|
||||
"hidden": 0,
|
||||
"label": "Reports",
|
||||
"links": "[\n {\n \"dependencies\": [\n \"Asset\"\n ],\n \"doctype\": \"Asset\",\n \"is_query_report\": true,\n \"label\": \"Asset Depreciation Ledger\",\n \"name\": \"Asset Depreciation Ledger\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"Asset\"\n ],\n \"doctype\": \"Asset\",\n \"is_query_report\": true,\n \"label\": \"Asset Depreciations and Balances\",\n \"name\": \"Asset Depreciations and Balances\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"Asset Maintenance\"\n ],\n \"doctype\": \"Asset Maintenance\",\n \"label\": \"Asset Maintenance\",\n \"name\": \"Asset Maintenance\",\n \"type\": \"report\"\n }\n]"
|
||||
}
|
||||
],
|
||||
"category": "Modules",
|
||||
@@ -26,7 +28,7 @@
|
||||
"idx": 0,
|
||||
"is_standard": 1,
|
||||
"label": "Assets",
|
||||
"modified": "2020-03-12 16:30:38.651019",
|
||||
"modified": "2020-04-01 11:28:51.072198",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Assets",
|
||||
"name": "Assets",
|
||||
@@ -35,17 +37,17 @@
|
||||
"pin_to_top": 0,
|
||||
"shortcuts": [
|
||||
{
|
||||
"is_query_report": 0,
|
||||
"label": "Asset",
|
||||
"link_to": "Asset",
|
||||
"type": "DocType"
|
||||
},
|
||||
{
|
||||
"is_query_report": 0,
|
||||
"label": "Asset Movement",
|
||||
"link_to": "Asset Movement",
|
||||
"type": "DocType"
|
||||
},
|
||||
{
|
||||
"is_query_report": 0,
|
||||
"label": "Fixed Asset Register",
|
||||
"link_to": "Fixed Asset Register",
|
||||
"type": "Report"
|
||||
}
|
||||
|
||||
@@ -1,44 +1,46 @@
|
||||
{
|
||||
"cards": [
|
||||
{
|
||||
"links": "[\n {\n \"description\": \"Supplier database.\",\n \"label\": \"Supplier\",\n \"name\": \"Supplier\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Supplier Group master.\",\n \"label\": \"Supplier Group\",\n \"name\": \"Supplier Group\",\n \"type\": \"doctype\"\n },\n {\n \"description\": \"All Contacts.\",\n \"label\": \"Contact\",\n \"name\": \"Contact\",\n \"type\": \"doctype\"\n },\n {\n \"description\": \"All Addresses.\",\n \"label\": \"Address\",\n \"name\": \"Address\",\n \"type\": \"doctype\"\n }\n]",
|
||||
"title": "Supplier"
|
||||
"hidden": 0,
|
||||
"label": "Supplier",
|
||||
"links": "[\n {\n \"description\": \"Supplier database.\",\n \"label\": \"Supplier\",\n \"name\": \"Supplier\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Supplier Group master.\",\n \"label\": \"Supplier Group\",\n \"name\": \"Supplier Group\",\n \"type\": \"doctype\"\n },\n {\n \"description\": \"All Contacts.\",\n \"label\": \"Contact\",\n \"name\": \"Contact\",\n \"type\": \"doctype\"\n },\n {\n \"description\": \"All Addresses.\",\n \"label\": \"Address\",\n \"name\": \"Address\",\n \"type\": \"doctype\"\n }\n]"
|
||||
},
|
||||
{
|
||||
"icon": "fa fa-star",
|
||||
"links": "[\n {\n \"dependencies\": [\n \"Item\",\n \"Supplier\"\n ],\n \"description\": \"Purchase Orders given to Suppliers.\",\n \"label\": \"Purchase Order\",\n \"name\": \"Purchase Order\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"dependencies\": [\n \"Item\",\n \"Supplier\"\n ],\n \"label\": \"Purchase Invoice\",\n \"name\": \"Purchase Invoice\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"dependencies\": [\n \"Item\"\n ],\n \"description\": \"Request for purchase.\",\n \"label\": \"Material Request\",\n \"name\": \"Material Request\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"dependencies\": [\n \"Item\",\n \"Supplier\"\n ],\n \"description\": \"Request for quotation.\",\n \"label\": \"Request for Quotation\",\n \"name\": \"Request for Quotation\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"dependencies\": [\n \"Item\",\n \"Supplier\"\n ],\n \"description\": \"Quotations received from Suppliers.\",\n \"label\": \"Supplier Quotation\",\n \"name\": \"Supplier Quotation\",\n \"type\": \"doctype\"\n }\n]",
|
||||
"title": "Purchasing"
|
||||
"hidden": 0,
|
||||
"label": "Purchasing",
|
||||
"links": "[\n {\n \"dependencies\": [\n \"Item\",\n \"Supplier\"\n ],\n \"description\": \"Purchase Orders given to Suppliers.\",\n \"label\": \"Purchase Order\",\n \"name\": \"Purchase Order\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"dependencies\": [\n \"Item\",\n \"Supplier\"\n ],\n \"label\": \"Purchase Invoice\",\n \"name\": \"Purchase Invoice\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"dependencies\": [\n \"Item\"\n ],\n \"description\": \"Request for purchase.\",\n \"label\": \"Material Request\",\n \"name\": \"Material Request\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"dependencies\": [\n \"Item\",\n \"Supplier\"\n ],\n \"description\": \"Request for quotation.\",\n \"label\": \"Request for Quotation\",\n \"name\": \"Request for Quotation\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"dependencies\": [\n \"Item\",\n \"Supplier\"\n ],\n \"description\": \"Quotations received from Suppliers.\",\n \"label\": \"Supplier Quotation\",\n \"name\": \"Supplier Quotation\",\n \"type\": \"doctype\"\n }\n]"
|
||||
},
|
||||
{
|
||||
"links": "[\n {\n \"description\": \"All Products or Services.\",\n \"label\": \"Item\",\n \"name\": \"Item\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Multiple Item prices.\",\n \"label\": \"Item Price\",\n \"name\": \"Item Price\",\n \"onboard\": 1,\n \"route\": \"#Report/Item Price\",\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Price List master.\",\n \"label\": \"Price List\",\n \"name\": \"Price List\",\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Bundle items at time of sale.\",\n \"label\": \"Product Bundle\",\n \"name\": \"Product Bundle\",\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Tree of Item Groups.\",\n \"icon\": \"fa fa-sitemap\",\n \"label\": \"Item Group\",\n \"link\": \"Tree/Item Group\",\n \"name\": \"Item Group\",\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Rules for applying different promotional schemes.\",\n \"label\": \"Promotional Scheme\",\n \"name\": \"Promotional Scheme\",\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Rules for applying pricing and discount.\",\n \"label\": \"Pricing Rule\",\n \"name\": \"Pricing Rule\",\n \"type\": \"doctype\"\n }\n]",
|
||||
"title": "Items and Pricing"
|
||||
"hidden": 0,
|
||||
"label": "Items and Pricing",
|
||||
"links": "[\n {\n \"description\": \"All Products or Services.\",\n \"label\": \"Item\",\n \"name\": \"Item\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Multiple Item prices.\",\n \"label\": \"Item Price\",\n \"name\": \"Item Price\",\n \"onboard\": 1,\n \"route\": \"#Report/Item Price\",\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Price List master.\",\n \"label\": \"Price List\",\n \"name\": \"Price List\",\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Bundle items at time of sale.\",\n \"label\": \"Product Bundle\",\n \"name\": \"Product Bundle\",\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Tree of Item Groups.\",\n \"icon\": \"fa fa-sitemap\",\n \"label\": \"Item Group\",\n \"link\": \"Tree/Item Group\",\n \"name\": \"Item Group\",\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Rules for applying different promotional schemes.\",\n \"label\": \"Promotional Scheme\",\n \"name\": \"Promotional Scheme\",\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Rules for applying pricing and discount.\",\n \"label\": \"Pricing Rule\",\n \"name\": \"Pricing Rule\",\n \"type\": \"doctype\"\n }\n]"
|
||||
},
|
||||
{
|
||||
"icon": "fa fa-cog",
|
||||
"links": "[\n {\n \"description\": \"Default settings for buying transactions.\",\n \"label\": \"Buying Settings\",\n \"name\": \"Buying Settings\",\n \"settings\": 1,\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Tax template for buying transactions.\",\n \"label\": \"Purchase Taxes and Charges Template\",\n \"name\": \"Purchase Taxes and Charges Template\",\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Template of terms or contract.\",\n \"label\": \"Terms and Conditions Template\",\n \"name\": \"Terms and Conditions\",\n \"type\": \"doctype\"\n }\n]",
|
||||
"title": "Settings"
|
||||
"hidden": 0,
|
||||
"label": "Settings",
|
||||
"links": "[\n {\n \"description\": \"Default settings for buying transactions.\",\n \"label\": \"Buying Settings\",\n \"name\": \"Buying Settings\",\n \"settings\": 1,\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Tax template for buying transactions.\",\n \"label\": \"Purchase Taxes and Charges Template\",\n \"name\": \"Purchase Taxes and Charges Template\",\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Template of terms or contract.\",\n \"label\": \"Terms and Conditions Template\",\n \"name\": \"Terms and Conditions\",\n \"type\": \"doctype\"\n }\n]"
|
||||
},
|
||||
{
|
||||
"links": "[\n {\n \"description\": \"All Supplier scorecards.\",\n \"label\": \"Supplier Scorecard\",\n \"name\": \"Supplier Scorecard\",\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Templates of supplier scorecard variables.\",\n \"label\": \"Supplier Scorecard Variable\",\n \"name\": \"Supplier Scorecard Variable\",\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Templates of supplier scorecard criteria.\",\n \"label\": \"Supplier Scorecard Criteria\",\n \"name\": \"Supplier Scorecard Criteria\",\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Templates of supplier standings.\",\n \"label\": \"Supplier Scorecard Standing\",\n \"name\": \"Supplier Scorecard Standing\",\n \"type\": \"doctype\"\n }\n]",
|
||||
"title": "Supplier Scorecard"
|
||||
"hidden": 0,
|
||||
"label": "Supplier Scorecard",
|
||||
"links": "[\n {\n \"description\": \"All Supplier scorecards.\",\n \"label\": \"Supplier Scorecard\",\n \"name\": \"Supplier Scorecard\",\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Templates of supplier scorecard variables.\",\n \"label\": \"Supplier Scorecard Variable\",\n \"name\": \"Supplier Scorecard Variable\",\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Templates of supplier scorecard criteria.\",\n \"label\": \"Supplier Scorecard Criteria\",\n \"name\": \"Supplier Scorecard Criteria\",\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Templates of supplier standings.\",\n \"label\": \"Supplier Scorecard Standing\",\n \"name\": \"Supplier Scorecard Standing\",\n \"type\": \"doctype\"\n }\n]"
|
||||
},
|
||||
{
|
||||
"icon": "fa fa-table",
|
||||
"links": "[\n {\n \"is_query_report\": true,\n \"label\": \"Purchase Analytics\",\n \"name\": \"Purchase Analytics\",\n \"onboard\": 1,\n \"reference_doctype\": \"Purchase Order\",\n \"type\": \"report\"\n },\n {\n \"is_query_report\": true,\n \"label\": \"Supplier-Wise Sales Analytics\",\n \"name\": \"Supplier-Wise Sales Analytics\",\n \"onboard\": 1,\n \"reference_doctype\": \"Stock Ledger Entry\",\n \"type\": \"report\"\n },\n {\n \"is_query_report\": true,\n \"label\": \"Purchase Order Trends\",\n \"name\": \"Purchase Order Trends\",\n \"onboard\": 1,\n \"reference_doctype\": \"Purchase Order\",\n \"type\": \"report\"\n },\n {\n \"is_query_report\": true,\n \"label\": \"Procurement Tracker\",\n \"name\": \"Procurement Tracker\",\n \"onboard\": 1,\n \"reference_doctype\": \"Purchase Order\",\n \"type\": \"report\"\n },\n {\n \"is_query_report\": true,\n \"label\": \"Requested Items To Be Ordered\",\n \"name\": \"Requested Items To Be Ordered\",\n \"onboard\": 1,\n \"reference_doctype\": \"Material Request\",\n \"type\": \"report\"\n }\n]",
|
||||
"title": "Key Reports"
|
||||
"hidden": 0,
|
||||
"label": "Key Reports",
|
||||
"links": "[\n {\n \"is_query_report\": true,\n \"label\": \"Purchase Analytics\",\n \"name\": \"Purchase Analytics\",\n \"onboard\": 1,\n \"reference_doctype\": \"Purchase Order\",\n \"type\": \"report\"\n },\n {\n \"is_query_report\": true,\n \"label\": \"Supplier-Wise Sales Analytics\",\n \"name\": \"Supplier-Wise Sales Analytics\",\n \"onboard\": 1,\n \"reference_doctype\": \"Stock Ledger Entry\",\n \"type\": \"report\"\n },\n {\n \"is_query_report\": true,\n \"label\": \"Purchase Order Trends\",\n \"name\": \"Purchase Order Trends\",\n \"onboard\": 1,\n \"reference_doctype\": \"Purchase Order\",\n \"type\": \"report\"\n },\n {\n \"is_query_report\": true,\n \"label\": \"Procurement Tracker\",\n \"name\": \"Procurement Tracker\",\n \"onboard\": 1,\n \"reference_doctype\": \"Purchase Order\",\n \"type\": \"report\"\n },\n {\n \"is_query_report\": true,\n \"label\": \"Requested Items To Be Ordered\",\n \"name\": \"Requested Items To Be Ordered\",\n \"onboard\": 1,\n \"reference_doctype\": \"Material Request\",\n \"type\": \"report\"\n }\n]"
|
||||
},
|
||||
{
|
||||
"icon": "fa fa-list",
|
||||
"links": "[\n {\n \"is_query_report\": true,\n \"label\": \"Items To Be Requested\",\n \"name\": \"Items To Be Requested\",\n \"onboard\": 1,\n \"reference_doctype\": \"Item\",\n \"type\": \"report\"\n },\n {\n \"is_query_report\": true,\n \"label\": \"Item-wise Purchase History\",\n \"name\": \"Item-wise Purchase History\",\n \"onboard\": 1,\n \"reference_doctype\": \"Item\",\n \"type\": \"report\"\n },\n {\n \"is_query_report\": true,\n \"label\": \"Material Requests for which Supplier Quotations are not created\",\n \"name\": \"Material Requests for which Supplier Quotations are not created\",\n \"reference_doctype\": \"Material Request\",\n \"type\": \"report\"\n },\n {\n \"is_query_report\": true,\n \"label\": \"Supplier Addresses And Contacts\",\n \"name\": \"Address And Contacts\",\n \"reference_doctype\": \"Address\",\n \"route_options\": {\n \"party_type\": \"Supplier\"\n },\n \"type\": \"report\"\n }\n]",
|
||||
"title": "Other Reports"
|
||||
"hidden": 0,
|
||||
"label": "Other Reports",
|
||||
"links": "[\n {\n \"is_query_report\": true,\n \"label\": \"Items To Be Requested\",\n \"name\": \"Items To Be Requested\",\n \"onboard\": 1,\n \"reference_doctype\": \"Item\",\n \"type\": \"report\"\n },\n {\n \"is_query_report\": true,\n \"label\": \"Item-wise Purchase History\",\n \"name\": \"Item-wise Purchase History\",\n \"onboard\": 1,\n \"reference_doctype\": \"Item\",\n \"type\": \"report\"\n },\n {\n \"is_query_report\": true,\n \"label\": \"Material Requests for which Supplier Quotations are not created\",\n \"name\": \"Material Requests for which Supplier Quotations are not created\",\n \"reference_doctype\": \"Material Request\",\n \"type\": \"report\"\n },\n {\n \"is_query_report\": true,\n \"label\": \"Supplier Addresses And Contacts\",\n \"name\": \"Address And Contacts\",\n \"reference_doctype\": \"Address\",\n \"route_options\": {\n \"party_type\": \"Supplier\"\n },\n \"type\": \"report\"\n }\n]"
|
||||
}
|
||||
],
|
||||
"category": "Modules",
|
||||
"charts": [
|
||||
{
|
||||
"chart_name": "Expenses",
|
||||
"label": "Expenses",
|
||||
"size": "Full"
|
||||
"label": "Expenses"
|
||||
}
|
||||
],
|
||||
"creation": "2020-01-28 11:50:26.195467",
|
||||
@@ -51,7 +53,7 @@
|
||||
"idx": 0,
|
||||
"is_standard": 1,
|
||||
"label": "Buying",
|
||||
"modified": "2020-03-12 16:30:40.779078",
|
||||
"modified": "2020-04-01 11:28:51.192097",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Buying",
|
||||
"name": "Buying",
|
||||
@@ -61,30 +63,30 @@
|
||||
"shortcuts": [
|
||||
{
|
||||
"format": "{} Unpaid",
|
||||
"is_query_report": 0,
|
||||
"label": "Purchase Invoice",
|
||||
"link_to": "Purchase Invoice",
|
||||
"stats_filter": "{\n \"company\": [\"like\", '%' + frappe.defaults.get_global_default(\"company\") + '%'],\n \"status\": \"Unpaid\"\n}",
|
||||
"type": "DocType"
|
||||
},
|
||||
{
|
||||
"format": "{} to receive",
|
||||
"is_query_report": 0,
|
||||
"label": "Purchase Order",
|
||||
"link_to": "Purchase Order",
|
||||
"stats_filter": "{\n \"company\": [\"like\", '%' + frappe.defaults.get_global_default(\"company\") + '%'],\n \"status\": \"To Receive\"\n}",
|
||||
"type": "DocType"
|
||||
},
|
||||
{
|
||||
"is_query_report": 0,
|
||||
"label": "Supplier Quotation",
|
||||
"link_to": "Supplier Quotation",
|
||||
"type": "DocType"
|
||||
},
|
||||
{
|
||||
"is_query_report": 0,
|
||||
"label": "Accounts Payable",
|
||||
"link_to": "Accounts Payable",
|
||||
"type": "Report"
|
||||
},
|
||||
{
|
||||
"is_query_report": 0,
|
||||
"label": "Purchase Register",
|
||||
"link_to": "Purchase Register",
|
||||
"type": "Report"
|
||||
}
|
||||
|
||||
@@ -27,6 +27,8 @@
|
||||
"supplier_type",
|
||||
"pan",
|
||||
"language",
|
||||
"allow_purchase_invoice_creation_without_purchase_order",
|
||||
"allow_purchase_invoice_creation_without_purchase_receipt",
|
||||
"disabled",
|
||||
"warn_rfqs",
|
||||
"warn_pos",
|
||||
@@ -364,13 +366,25 @@
|
||||
"fieldname": "is_frozen",
|
||||
"fieldtype": "Check",
|
||||
"label": "Is Frozen"
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"fieldname": "allow_purchase_invoice_creation_without_purchase_order",
|
||||
"fieldtype": "Check",
|
||||
"label": "Allow Purchase Invoice Creation Without Purchase Order"
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"fieldname": "allow_purchase_invoice_creation_without_purchase_receipt",
|
||||
"fieldtype": "Check",
|
||||
"label": "Allow Purchase Invoice Creation Without Purchase Receipt"
|
||||
}
|
||||
],
|
||||
"icon": "fa fa-user",
|
||||
"idx": 370,
|
||||
"image_field": "image",
|
||||
"links": [],
|
||||
"modified": "2019-12-19 18:17:16.614567",
|
||||
"modified": "2020-03-17 09:48:30.578242",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Buying",
|
||||
"name": "Supplier",
|
||||
|
||||
@@ -4,15 +4,17 @@
|
||||
// attach required files
|
||||
{% include 'erpnext/public/js/controllers/buying.js' %};
|
||||
|
||||
frappe.ui.form.on('Suppier Quotation', {
|
||||
setup: function(frm) {
|
||||
frm.custom_make_buttons = {
|
||||
'Purchase Order': 'Purchase Order'
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
erpnext.buying.SupplierQuotationController = erpnext.buying.BuyingController.extend({
|
||||
setup: function() {
|
||||
this.frm.custom_make_buttons = {
|
||||
'Purchase Order': 'Purchase Order',
|
||||
'Quotation': 'Quotation',
|
||||
'Subscription': 'Subscription'
|
||||
}
|
||||
|
||||
this._super();
|
||||
},
|
||||
|
||||
refresh: function() {
|
||||
var me = this;
|
||||
this._super();
|
||||
|
||||
@@ -2,131 +2,68 @@ from __future__ import unicode_literals
|
||||
from frappe import _
|
||||
|
||||
def get_data():
|
||||
|
||||
return [
|
||||
{
|
||||
"label": _("Consultation"),
|
||||
"icon": "icon-star",
|
||||
"items": [
|
||||
{
|
||||
"type": "doctype",
|
||||
"name": "Patient Appointment",
|
||||
"label": _("Patient Appointment"),
|
||||
},
|
||||
{
|
||||
"type": "doctype",
|
||||
"name": "Patient Encounter",
|
||||
"label": _("Patient Encounter"),
|
||||
},
|
||||
{
|
||||
"type": "doctype",
|
||||
"name": "Vital Signs",
|
||||
"label": _("Vital Signs"),
|
||||
"description": _("Record Patient Vitals"),
|
||||
},
|
||||
{
|
||||
"type": "page",
|
||||
"name": "patient_history",
|
||||
"label": _("Patient History"),
|
||||
},
|
||||
{
|
||||
"type": "page",
|
||||
"name": "appointment-analytic",
|
||||
"label": _("Appointment Analytics"),
|
||||
},
|
||||
{
|
||||
"type": "doctype",
|
||||
"name": "Clinical Procedure",
|
||||
"label": _("Clinical Procedure"),
|
||||
},
|
||||
{
|
||||
"type": "doctype",
|
||||
"name": "Inpatient Record",
|
||||
"label": _("Inpatient Record"),
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": _("Laboratory"),
|
||||
"icon": "icon-list",
|
||||
"items": [
|
||||
{
|
||||
"type": "doctype",
|
||||
"name": "Lab Test",
|
||||
"label": _("Lab Test"),
|
||||
},
|
||||
{
|
||||
"type": "doctype",
|
||||
"name": "Sample Collection",
|
||||
"label": _("Sample Collection"),
|
||||
},
|
||||
{
|
||||
"type": "report",
|
||||
"name": "Lab Test Report",
|
||||
"is_query_report": True,
|
||||
"label": _("Lab Test Report"),
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": _("Masters"),
|
||||
"icon": "icon-list",
|
||||
"items": [
|
||||
{
|
||||
"type": "doctype",
|
||||
"name": "Patient",
|
||||
"label": _("Patient"),
|
||||
"onboard": 1,
|
||||
"onboard": 1
|
||||
},
|
||||
{
|
||||
"type": "doctype",
|
||||
"name": "Healthcare Practitioner",
|
||||
"label": _("Healthcare Practitioner"),
|
||||
"onboard": 1,
|
||||
"onboard": 1
|
||||
},
|
||||
{
|
||||
"type": "doctype",
|
||||
"name": "Practitioner Schedule",
|
||||
"label": _("Practitioner Schedule"),
|
||||
},
|
||||
{
|
||||
"type": "doctype",
|
||||
"name": "Medical Code Standard",
|
||||
"label": _("Medical Code Standard"),
|
||||
},
|
||||
{
|
||||
"type": "doctype",
|
||||
"name": "Medical Code",
|
||||
"label": _("Medical Code"),
|
||||
"onboard": 1,
|
||||
},
|
||||
{
|
||||
"type": "doctype",
|
||||
"name": "Healthcare Service Unit",
|
||||
"label": _("Healthcare Service Unit")
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": _("Settings"),
|
||||
"icon": "icon-cog",
|
||||
"items": [
|
||||
{
|
||||
"type": "doctype",
|
||||
"name": "Healthcare Settings",
|
||||
"label": _("Healthcare Settings"),
|
||||
"onboard": 1,
|
||||
"onboard": 1
|
||||
},
|
||||
{
|
||||
"type": "doctype",
|
||||
"name": "Medical Department",
|
||||
"label": _("Medical Department"),
|
||||
},
|
||||
{
|
||||
"type": "doctype",
|
||||
"name": "Healthcare Service Unit Type",
|
||||
"label": _("Healthcare Service Unit Type")
|
||||
},
|
||||
{
|
||||
"type": "doctype",
|
||||
"name": "Healthcare Service Unit",
|
||||
"label": _("Healthcare Service Unit")
|
||||
},
|
||||
{
|
||||
"type": "doctype",
|
||||
"name": "Medical Code Standard",
|
||||
"label": _("Medical Code Standard")
|
||||
},
|
||||
{
|
||||
"type": "doctype",
|
||||
"name": "Medical Code",
|
||||
"label": _("Medical Code")
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": _("Consultation Setup"),
|
||||
"items": [
|
||||
{
|
||||
"type": "doctype",
|
||||
"name": "Appointment Type",
|
||||
"label": _("Appointment Type"),
|
||||
},
|
||||
{
|
||||
"type": "doctype",
|
||||
"name": "Clinical Procedure Template",
|
||||
"label": _("Clinical Procedure Template")
|
||||
},
|
||||
{
|
||||
"type": "doctype",
|
||||
"name": "Prescription Dosage",
|
||||
@@ -137,6 +74,36 @@ def get_data():
|
||||
"name": "Prescription Duration",
|
||||
"label": _("Prescription Duration")
|
||||
},
|
||||
{
|
||||
"type": "doctype",
|
||||
"name": "Antibiotic",
|
||||
"label": _("Antibiotic")
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": _("Consultation"),
|
||||
"items": [
|
||||
{
|
||||
"type": "doctype",
|
||||
"name": "Patient Appointment",
|
||||
"label": _("Patient Appointment")
|
||||
},
|
||||
{
|
||||
"type": "doctype",
|
||||
"name": "Clinical Procedure",
|
||||
"label": _("Clinical Procedure")
|
||||
},
|
||||
{
|
||||
"type": "doctype",
|
||||
"name": "Patient Encounter",
|
||||
"label": _("Patient Encounter")
|
||||
},
|
||||
{
|
||||
"type": "doctype",
|
||||
"name": "Vital Signs",
|
||||
"label": _("Vital Signs")
|
||||
},
|
||||
{
|
||||
"type": "doctype",
|
||||
"name": "Complaint",
|
||||
@@ -147,40 +114,104 @@ def get_data():
|
||||
"name": "Diagnosis",
|
||||
"label": _("Diagnosis")
|
||||
},
|
||||
{
|
||||
"type": "doctype",
|
||||
"name": "Fee Validity",
|
||||
"label": _("Fee Validity")
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": _("Settings"),
|
||||
"items": [
|
||||
{
|
||||
"type": "doctype",
|
||||
"name": "Healthcare Settings",
|
||||
"label": _("Healthcare Settings"),
|
||||
"onboard": 1
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": _("Laboratory Setup"),
|
||||
"items": [
|
||||
{
|
||||
"type": "doctype",
|
||||
"name": "Lab Test Template",
|
||||
"label": _("Lab Test Template")
|
||||
},
|
||||
{
|
||||
"type": "doctype",
|
||||
"name": "Lab Test Sample",
|
||||
"label": _("Lab Test Sample"),
|
||||
"label": _("Lab Test Sample")
|
||||
},
|
||||
{
|
||||
"type": "doctype",
|
||||
"name": "Lab Test UOM",
|
||||
"label": _("Lab Test UOM")
|
||||
},
|
||||
{
|
||||
"type": "doctype",
|
||||
"name": "Antibiotic",
|
||||
"label": _("Antibiotic")
|
||||
},
|
||||
{
|
||||
"type": "doctype",
|
||||
"name": "Sensitivity",
|
||||
"label": _("Sensitivity")
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": _("Laboratory"),
|
||||
"items": [
|
||||
{
|
||||
"type": "doctype",
|
||||
"name": "Lab Test",
|
||||
"label": _("Lab Test")
|
||||
},
|
||||
{
|
||||
"type": "doctype",
|
||||
"name": "Lab Test Template",
|
||||
"label": _("Lab Test Template")
|
||||
"name": "Sample Collection",
|
||||
"label": _("Sample Collection")
|
||||
},
|
||||
{
|
||||
"type": "doctype",
|
||||
"name": "Clinical Procedure Template",
|
||||
"label": _("Clinical Procedure Template"),
|
||||
"name": "Dosage Form",
|
||||
"label": _("Dosage Form")
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": _("Records and History"),
|
||||
"items": [
|
||||
{
|
||||
"type": "page",
|
||||
"name": "patient_history",
|
||||
"label": _("Patient History"),
|
||||
},
|
||||
{
|
||||
"type": "doctype",
|
||||
"name": "Healthcare Service Unit Type",
|
||||
"label": _("Healthcare Service Unit Type")
|
||||
"name": "Patient Medical Record",
|
||||
"label": _("Patient Medical Record")
|
||||
},
|
||||
{
|
||||
"type": "doctype",
|
||||
"name": "Inpatient Record",
|
||||
"label": _("Inpatient Record")
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": _("Reports"),
|
||||
"items": [
|
||||
{
|
||||
"type": "report",
|
||||
"is_query_report": True,
|
||||
"name": "Patient Appointment Analytics",
|
||||
"doctype": "Patient Appointment"
|
||||
},
|
||||
{
|
||||
"type": "report",
|
||||
"is_query_report": True,
|
||||
"name": "Lab Test Report",
|
||||
"doctype": "Lab Test",
|
||||
"label": _("Lab Test Report")
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ from erpnext.accounts.doctype.pricing_rule.utils import (apply_pricing_rule_on_t
|
||||
from erpnext.exceptions import InvalidCurrency
|
||||
from six import text_type
|
||||
from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import get_accounting_dimensions
|
||||
from erpnext.stock.get_item_details import get_item_warehouse
|
||||
|
||||
force_item_fields = ("item_group", "brand", "stock_uom", "is_fixed_asset", "item_tax_rate", "pricing_rules")
|
||||
|
||||
@@ -438,7 +439,7 @@ class AccountsController(TransactionBase):
|
||||
|
||||
if account_currency not in valid_currency:
|
||||
frappe.throw(_("Account {0} is invalid. Account Currency must be {1}")
|
||||
.format(account, _(" or ").join(valid_currency)))
|
||||
.format(account, (' ' + _("or") + ' ').join(valid_currency)))
|
||||
|
||||
def clear_unallocated_advances(self, childtype, parentfield):
|
||||
self.set(parentfield, self.get(parentfield, {"allocated_amount": ["not in", [0, None, ""]]}))
|
||||
@@ -833,7 +834,7 @@ class AccountsController(TransactionBase):
|
||||
|
||||
for d in self.get("payment_schedule"):
|
||||
if self.doctype == "Sales Order" and getdate(d.due_date) < getdate(self.transaction_date):
|
||||
frappe.throw(_("Row {0}: Due Date cannot be before posting date").format(d.idx))
|
||||
frappe.throw(_("Row {0}: Due Date in the Payment Terms table cannot be before Posting Date").format(d.idx))
|
||||
elif d.due_date in dates:
|
||||
li.append(_("{0} in row {1}").format(d.due_date, d.idx))
|
||||
dates.append(d.due_date)
|
||||
@@ -1126,16 +1127,16 @@ def set_sales_order_defaults(parent_doctype, parent_doctype_name, child_docname,
|
||||
"""
|
||||
Returns a Sales Order Item child item containing the default values
|
||||
"""
|
||||
p_doctype = frappe.get_doc(parent_doctype, parent_doctype_name)
|
||||
child_item = frappe.new_doc('Sales Order Item', p_doctype, child_docname)
|
||||
p_doc = frappe.get_doc(parent_doctype, parent_doctype_name)
|
||||
child_item = frappe.new_doc('Sales Order Item', p_doc, child_docname)
|
||||
item = frappe.get_doc("Item", item_code)
|
||||
child_item.item_code = item.item_code
|
||||
child_item.item_name = item.item_name
|
||||
child_item.description = item.description
|
||||
child_item.reqd_by_date = p_doctype.delivery_date
|
||||
child_item.reqd_by_date = p_doc.delivery_date
|
||||
child_item.uom = item.stock_uom
|
||||
child_item.conversion_factor = get_conversion_factor(item_code, item.stock_uom).get("conversion_factor") or 1.0
|
||||
child_item.warehouse = p_doctype.set_warehouse or p_doctype.items[0].warehouse
|
||||
child_item.warehouse = get_item_warehouse(item, p_doc, overwrite_warehouse=True)
|
||||
return child_item
|
||||
|
||||
|
||||
@@ -1143,13 +1144,13 @@ def set_purchase_order_defaults(parent_doctype, parent_doctype_name, child_docna
|
||||
"""
|
||||
Returns a Purchase Order Item child item containing the default values
|
||||
"""
|
||||
p_doctype = frappe.get_doc(parent_doctype, parent_doctype_name)
|
||||
child_item = frappe.new_doc('Purchase Order Item', p_doctype, child_docname)
|
||||
p_doc = frappe.get_doc(parent_doctype, parent_doctype_name)
|
||||
child_item = frappe.new_doc('Purchase Order Item', p_doc, child_docname)
|
||||
item = frappe.get_doc("Item", item_code)
|
||||
child_item.item_code = item.item_code
|
||||
child_item.item_name = item.item_name
|
||||
child_item.description = item.description
|
||||
child_item.schedule_date = p_doctype.schedule_date
|
||||
child_item.schedule_date = p_doc.schedule_date
|
||||
child_item.uom = item.stock_uom
|
||||
child_item.conversion_factor = get_conversion_factor(item_code, item.stock_uom).get("conversion_factor") or 1.0
|
||||
child_item.base_rate = 1 # Initiallize value will update in parent validation
|
||||
|
||||
@@ -45,6 +45,7 @@ class BuyingController(StockController):
|
||||
self.validate_warehouse()
|
||||
self.validate_from_warehouse()
|
||||
self.set_supplier_address()
|
||||
self.validate_asset_return()
|
||||
|
||||
if self.doctype=="Purchase Invoice":
|
||||
self.validate_purchase_receipt_if_update_stock()
|
||||
@@ -100,6 +101,19 @@ class BuyingController(StockController):
|
||||
for d in tax_for_valuation:
|
||||
d.category = 'Total'
|
||||
msgprint(_('Tax Category has been changed to "Total" because all the Items are non-stock items'))
|
||||
|
||||
def validate_asset_return(self):
|
||||
if self.doctype not in ['Purchase Receipt', 'Purchase Invoice'] or not self.is_return:
|
||||
return
|
||||
|
||||
purchase_doc_field = 'purchase_receipt' if self.doctype == 'Purchase Receipt' else 'purchase_invoice'
|
||||
not_cancelled_asset = [d.name for d in frappe.db.get_all("Asset", {
|
||||
purchase_doc_field: self.return_against,
|
||||
"docstatus": 1
|
||||
})]
|
||||
if self.is_return and len(not_cancelled_asset):
|
||||
frappe.throw(_("{} has submitted assets linked to it. You need to cancel the assets to create purchase return.".format(self.return_against)),
|
||||
title=_("Not Allowed"))
|
||||
|
||||
def get_asset_items(self):
|
||||
if self.doctype not in ['Purchase Order', 'Purchase Invoice', 'Purchase Receipt']:
|
||||
|
||||
@@ -179,6 +179,12 @@ def item_query(doctype, txt, searchfield, start, page_len, filters, as_dict=Fals
|
||||
# scan description only if items are less than 50000
|
||||
description_cond = 'or tabItem.description LIKE %(txt)s'
|
||||
|
||||
extra_cond = " and tabItem.has_variants=0"
|
||||
if (filters and isinstance(filters, dict)
|
||||
and filters.get("doctype") == "BOM"):
|
||||
extra_cond = ""
|
||||
del filters["doctype"]
|
||||
|
||||
return frappe.db.sql("""select tabItem.name,
|
||||
if(length(tabItem.item_name) > 40,
|
||||
concat(substr(tabItem.item_name, 1, 40), "..."), item_name) as item_name,
|
||||
@@ -188,11 +194,11 @@ def item_query(doctype, txt, searchfield, start, page_len, filters, as_dict=Fals
|
||||
{columns}
|
||||
from tabItem
|
||||
where tabItem.docstatus < 2
|
||||
and tabItem.has_variants=0
|
||||
and tabItem.disabled=0
|
||||
and (tabItem.end_of_life > %(today)s or ifnull(tabItem.end_of_life, '0000-00-00')='0000-00-00')
|
||||
and ({scond} or tabItem.item_code IN (select parent from `tabItem Barcode` where barcode LIKE %(txt)s)
|
||||
{description_cond})
|
||||
{extra_cond}
|
||||
{fcond} {mcond}
|
||||
order by
|
||||
if(locate(%(_txt)s, name), locate(%(_txt)s, name), 99999),
|
||||
@@ -203,6 +209,7 @@ def item_query(doctype, txt, searchfield, start, page_len, filters, as_dict=Fals
|
||||
key=searchfield,
|
||||
columns=columns,
|
||||
scond=searchfields,
|
||||
extra_cond=extra_cond,
|
||||
fcond=get_filters_cond(doctype, filters, conditions).replace('%', '%%'),
|
||||
mcond=get_match_cond(doctype).replace('%', '%%'),
|
||||
description_cond = description_cond),
|
||||
|
||||
@@ -69,16 +69,16 @@ status_map = {
|
||||
["Cancelled", "eval:self.docstatus==2"],
|
||||
["Closed", "eval:self.status=='Closed'"],
|
||||
],
|
||||
"Purchase Invoice": [
|
||||
["Draft", None],
|
||||
["Submitted", "eval:self.docstatus==1"],
|
||||
["Paid", "eval:self.outstanding_amount==0 and self.docstatus==1"],
|
||||
["Return", "eval:self.is_return==1 and self.docstatus==1"],
|
||||
["Debit Note Issued",
|
||||
"eval:self.outstanding_amount <= 0 and self.docstatus==1 and self.is_return==0 and get_value('Purchase Invoice', {'is_return': 1, 'return_against': self.name, 'docstatus': 1})"],
|
||||
["Unpaid", "eval:self.outstanding_amount > 0 and getdate(self.due_date) >= getdate(nowdate()) and self.docstatus==1"],
|
||||
["Overdue", "eval:self.outstanding_amount > 0 and getdate(self.due_date) < getdate(nowdate()) and self.docstatus==1"],
|
||||
["Cancelled", "eval:self.docstatus==2"],
|
||||
"Purchase Invoice": [
|
||||
["Draft", None],
|
||||
["Submitted", "eval:self.docstatus==1"],
|
||||
["Paid", "eval:self.outstanding_amount==0 and self.docstatus==1"],
|
||||
["Return", "eval:self.is_return==1 and self.docstatus==1"],
|
||||
["Debit Note Issued",
|
||||
"eval:self.outstanding_amount <= 0 and self.docstatus==1 and self.is_return==0 and get_value('Purchase Invoice', {'is_return': 1, 'return_against': self.name, 'docstatus': 1})"],
|
||||
["Unpaid", "eval:self.outstanding_amount > 0 and getdate(self.due_date) >= getdate(nowdate()) and self.docstatus==1"],
|
||||
["Overdue", "eval:self.outstanding_amount > 0 and getdate(self.due_date) < getdate(nowdate()) and self.docstatus==1"],
|
||||
["Cancelled", "eval:self.docstatus==2"],
|
||||
],
|
||||
"Material Request": [
|
||||
["Draft", None],
|
||||
|
||||
@@ -21,6 +21,7 @@ class StockController(AccountsController):
|
||||
super(StockController, self).validate()
|
||||
self.validate_inspection()
|
||||
self.validate_serialized_batch()
|
||||
self.validate_customer_provided_item()
|
||||
|
||||
def make_gl_entries(self, gl_entries=None, repost_future_gle=True, from_repost=False):
|
||||
if self.docstatus == 2:
|
||||
@@ -379,6 +380,15 @@ class StockController(AccountsController):
|
||||
for blanket_order in blanket_orders:
|
||||
frappe.get_doc("Blanket Order", blanket_order).update_ordered_qty()
|
||||
|
||||
def validate_customer_provided_item(self):
|
||||
for d in self.get('items'):
|
||||
# Customer Provided parts will have zero valuation rate
|
||||
if frappe.db.get_value('Item', d.item_code, 'is_customer_provided_item'):
|
||||
d.allow_zero_valuation_rate = 1
|
||||
if d.parenttype in ["Delivery Note", "Sales Invoice"] and d.rate:
|
||||
frappe.throw(_("Row #{0}: {1} cannot have {2} as it is a Customer Provided Item")
|
||||
.format(d.idx, frappe.bold(d.item_code), frappe.bold("Rate")))
|
||||
|
||||
def update_gl_entries_after(posting_date, posting_time, for_warehouses=None, for_items=None,
|
||||
warehouse_account=None, company=None):
|
||||
def _delete_gl_entries(voucher_type, voucher_no):
|
||||
|
||||
@@ -667,8 +667,7 @@ def get_itemised_tax_breakup_html(doc):
|
||||
itemised_tax=itemised_tax,
|
||||
itemised_taxable_amount=itemised_taxable_amount,
|
||||
tax_accounts=tax_accounts,
|
||||
conversion_rate=doc.conversion_rate,
|
||||
currency=doc.currency
|
||||
doc=doc
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
{
|
||||
"cards": [
|
||||
{
|
||||
"icon": "fa fa-star",
|
||||
"links": "[\n {\n \"description\": \"Database of potential customers.\",\n \"label\": \"Lead\",\n \"name\": \"Lead\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Potential opportunities for selling.\",\n \"label\": \"Opportunity\",\n \"name\": \"Opportunity\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Customer database.\",\n \"label\": \"Customer\",\n \"name\": \"Customer\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"description\": \"All Contacts.\",\n \"label\": \"Contact\",\n \"name\": \"Contact\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Record of all communications of type email, phone, chat, visit, etc.\",\n \"label\": \"Communication\",\n \"name\": \"Communication\",\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Track Leads by Lead Source.\",\n \"label\": \"Lead Source\",\n \"name\": \"Lead Source\",\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Helps you keep tracks of Contracts based on Supplier, Customer and Employee\",\n \"label\": \"Contract\",\n \"name\": \"Contract\",\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Helps you manage appointments with your leads\",\n \"label\": \"Appointment\",\n \"name\": \"Appointment\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Newsletter\",\n \"name\": \"Newsletter\",\n \"type\": \"doctype\"\n }\n]",
|
||||
"title": "Sales Pipeline"
|
||||
"hidden": 0,
|
||||
"label": "Sales Pipeline",
|
||||
"links": "[\n {\n \"description\": \"Database of potential customers.\",\n \"label\": \"Lead\",\n \"name\": \"Lead\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Potential opportunities for selling.\",\n \"label\": \"Opportunity\",\n \"name\": \"Opportunity\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Customer database.\",\n \"label\": \"Customer\",\n \"name\": \"Customer\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"description\": \"All Contacts.\",\n \"label\": \"Contact\",\n \"name\": \"Contact\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Record of all communications of type email, phone, chat, visit, etc.\",\n \"label\": \"Communication\",\n \"name\": \"Communication\",\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Track Leads by Lead Source.\",\n \"label\": \"Lead Source\",\n \"name\": \"Lead Source\",\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Helps you keep tracks of Contracts based on Supplier, Customer and Employee\",\n \"label\": \"Contract\",\n \"name\": \"Contract\",\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Helps you manage appointments with your leads\",\n \"label\": \"Appointment\",\n \"name\": \"Appointment\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Newsletter\",\n \"name\": \"Newsletter\",\n \"type\": \"doctype\"\n }\n]"
|
||||
},
|
||||
{
|
||||
"icon": "fa fa-list",
|
||||
"links": "[\n {\n \"dependencies\": [\n \"Lead\"\n ],\n \"doctype\": \"Lead\",\n \"is_query_report\": true,\n \"label\": \"Lead Details\",\n \"name\": \"Lead Details\",\n \"onboard\": 1,\n \"type\": \"report\"\n },\n {\n \"icon\": \"fa fa-bar-chart\",\n \"label\": \"Sales Funnel\",\n \"name\": \"sales-funnel\",\n \"onboard\": 1,\n \"type\": \"page\"\n },\n {\n \"dependencies\": [\n \"Lead\"\n ],\n \"doctype\": \"Lead\",\n \"is_query_report\": true,\n \"label\": \"Prospects Engaged But Not Converted\",\n \"name\": \"Prospects Engaged But Not Converted\",\n \"onboard\": 1,\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"Opportunity\"\n ],\n \"doctype\": \"Opportunity\",\n \"is_query_report\": true,\n \"label\": \"Minutes to First Response for Opportunity\",\n \"name\": \"Minutes to First Response for Opportunity\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"Sales Order\"\n ],\n \"doctype\": \"Sales Order\",\n \"is_query_report\": true,\n \"label\": \"Inactive Customers\",\n \"name\": \"Inactive Customers\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"Lead\"\n ],\n \"doctype\": \"Lead\",\n \"is_query_report\": true,\n \"label\": \"Campaign Efficiency\",\n \"name\": \"Campaign Efficiency\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"Lead\"\n ],\n \"doctype\": \"Lead\",\n \"is_query_report\": true,\n \"label\": \"Lead Owner Efficiency\",\n \"name\": \"Lead Owner Efficiency\",\n \"type\": \"report\"\n }\n]",
|
||||
"title": "Reports"
|
||||
"hidden": 0,
|
||||
"label": "Reports",
|
||||
"links": "[\n {\n \"dependencies\": [\n \"Lead\"\n ],\n \"doctype\": \"Lead\",\n \"is_query_report\": true,\n \"label\": \"Lead Details\",\n \"name\": \"Lead Details\",\n \"onboard\": 1,\n \"type\": \"report\"\n },\n {\n \"icon\": \"fa fa-bar-chart\",\n \"label\": \"Sales Funnel\",\n \"name\": \"sales-funnel\",\n \"onboard\": 1,\n \"type\": \"page\"\n },\n {\n \"dependencies\": [\n \"Lead\"\n ],\n \"doctype\": \"Lead\",\n \"is_query_report\": true,\n \"label\": \"Prospects Engaged But Not Converted\",\n \"name\": \"Prospects Engaged But Not Converted\",\n \"onboard\": 1,\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"Opportunity\"\n ],\n \"doctype\": \"Opportunity\",\n \"is_query_report\": true,\n \"label\": \"Minutes to First Response for Opportunity\",\n \"name\": \"Minutes to First Response for Opportunity\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"Sales Order\"\n ],\n \"doctype\": \"Sales Order\",\n \"is_query_report\": true,\n \"label\": \"Inactive Customers\",\n \"name\": \"Inactive Customers\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"Lead\"\n ],\n \"doctype\": \"Lead\",\n \"is_query_report\": true,\n \"label\": \"Campaign Efficiency\",\n \"name\": \"Campaign Efficiency\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"Lead\"\n ],\n \"doctype\": \"Lead\",\n \"is_query_report\": true,\n \"label\": \"Lead Owner Efficiency\",\n \"name\": \"Lead Owner Efficiency\",\n \"type\": \"report\"\n }\n]"
|
||||
},
|
||||
{
|
||||
"icon": "fa fa-cog",
|
||||
"links": "[\n {\n \"description\": \"Manage Customer Group Tree.\",\n \"icon\": \"fa fa-sitemap\",\n \"label\": \"Customer Group\",\n \"link\": \"Tree/Customer Group\",\n \"name\": \"Customer Group\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Manage Territory Tree.\",\n \"icon\": \"fa fa-sitemap\",\n \"label\": \"Territory\",\n \"link\": \"Tree/Territory\",\n \"name\": \"Territory\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Manage Sales Person Tree.\",\n \"icon\": \"fa fa-sitemap\",\n \"label\": \"Sales Person\",\n \"link\": \"Tree/Sales Person\",\n \"name\": \"Sales Person\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Sales campaigns.\",\n \"label\": \"Campaign\",\n \"name\": \"Campaign\",\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Sends Mails to lead or contact based on a Campaign schedule\",\n \"label\": \"Email Campaign\",\n \"name\": \"Email Campaign\",\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Send mass SMS to your contacts\",\n \"label\": \"SMS Center\",\n \"name\": \"SMS Center\",\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Logs for maintaining sms delivery status\",\n \"label\": \"SMS Log\",\n \"name\": \"SMS Log\",\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Setup SMS gateway settings\",\n \"label\": \"SMS Settings\",\n \"name\": \"SMS Settings\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Email Group\",\n \"name\": \"Email Group\",\n \"type\": \"doctype\"\n }\n]",
|
||||
"title": "Settings"
|
||||
"hidden": 0,
|
||||
"label": "Settings",
|
||||
"links": "[\n {\n \"description\": \"Manage Customer Group Tree.\",\n \"icon\": \"fa fa-sitemap\",\n \"label\": \"Customer Group\",\n \"link\": \"Tree/Customer Group\",\n \"name\": \"Customer Group\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Manage Territory Tree.\",\n \"icon\": \"fa fa-sitemap\",\n \"label\": \"Territory\",\n \"link\": \"Tree/Territory\",\n \"name\": \"Territory\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Manage Sales Person Tree.\",\n \"icon\": \"fa fa-sitemap\",\n \"label\": \"Sales Person\",\n \"link\": \"Tree/Sales Person\",\n \"name\": \"Sales Person\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Sales campaigns.\",\n \"label\": \"Campaign\",\n \"name\": \"Campaign\",\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Sends Mails to lead or contact based on a Campaign schedule\",\n \"label\": \"Email Campaign\",\n \"name\": \"Email Campaign\",\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Send mass SMS to your contacts\",\n \"label\": \"SMS Center\",\n \"name\": \"SMS Center\",\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Logs for maintaining sms delivery status\",\n \"label\": \"SMS Log\",\n \"name\": \"SMS Log\",\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Setup SMS gateway settings\",\n \"label\": \"SMS Settings\",\n \"name\": \"SMS Settings\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Email Group\",\n \"name\": \"Email Group\",\n \"type\": \"doctype\"\n }\n]"
|
||||
},
|
||||
{
|
||||
"icon": "fa fa-star",
|
||||
"links": "[\n {\n \"description\": \"Plan for maintenance visits.\",\n \"label\": \"Maintenance Schedule\",\n \"name\": \"Maintenance Schedule\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Visit report for maintenance call.\",\n \"label\": \"Maintenance Visit\",\n \"name\": \"Maintenance Visit\",\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Warranty Claim against Serial No.\",\n \"label\": \"Warranty Claim\",\n \"name\": \"Warranty Claim\",\n \"type\": \"doctype\"\n }\n]",
|
||||
"title": "Maintenance"
|
||||
"hidden": 0,
|
||||
"label": "Maintenance",
|
||||
"links": "[\n {\n \"description\": \"Plan for maintenance visits.\",\n \"label\": \"Maintenance Schedule\",\n \"name\": \"Maintenance Schedule\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Visit report for maintenance call.\",\n \"label\": \"Maintenance Visit\",\n \"name\": \"Maintenance Visit\",\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Warranty Claim against Serial No.\",\n \"label\": \"Warranty Claim\",\n \"name\": \"Warranty Claim\",\n \"type\": \"doctype\"\n }\n]"
|
||||
}
|
||||
],
|
||||
"category": "Modules",
|
||||
@@ -33,7 +33,7 @@
|
||||
"idx": 0,
|
||||
"is_standard": 1,
|
||||
"label": "CRM",
|
||||
"modified": "2020-03-12 16:30:41.142037",
|
||||
"modified": "2020-04-01 11:28:51.219999",
|
||||
"modified_by": "Administrator",
|
||||
"module": "CRM",
|
||||
"name": "CRM",
|
||||
@@ -43,25 +43,25 @@
|
||||
"shortcuts": [
|
||||
{
|
||||
"format": "Open",
|
||||
"is_query_report": 0,
|
||||
"label": "Lead",
|
||||
"link_to": "Lead",
|
||||
"stats_filter": "{\"status\":\"Open\"}",
|
||||
"type": "DocType"
|
||||
},
|
||||
{
|
||||
"format": "{} Assigned",
|
||||
"is_query_report": 0,
|
||||
"label": "Opportunity",
|
||||
"link_to": "Opportunity",
|
||||
"stats_filter": "{\"_assign\": [\"like\", '%' + frappe.session.user + '%']}",
|
||||
"type": "DocType"
|
||||
},
|
||||
{
|
||||
"is_query_report": 0,
|
||||
"label": "Customer",
|
||||
"link_to": "Customer",
|
||||
"type": "DocType"
|
||||
},
|
||||
{
|
||||
"is_query_report": 0,
|
||||
"label": "Sales Analytics",
|
||||
"link_to": "Sales Analytics",
|
||||
"type": "Report"
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
{
|
||||
"actions": [],
|
||||
"allow_events_in_timeline": 1,
|
||||
"allow_import": 1,
|
||||
"autoname": "naming_series:",
|
||||
@@ -33,6 +32,7 @@
|
||||
"notes",
|
||||
"address_info",
|
||||
"address_html",
|
||||
"address_type",
|
||||
"address_title",
|
||||
"address_line1",
|
||||
"address_line2",
|
||||
@@ -284,8 +284,7 @@
|
||||
"depends_on": "eval: doc.__islocal",
|
||||
"fieldname": "pincode",
|
||||
"fieldtype": "Data",
|
||||
"label": "Postal Code",
|
||||
"options": "Country"
|
||||
"label": "Postal Code"
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break2",
|
||||
@@ -303,7 +302,8 @@
|
||||
"fieldtype": "Data",
|
||||
"label": "Phone",
|
||||
"oldfieldname": "contact_no",
|
||||
"oldfieldtype": "Data"
|
||||
"oldfieldtype": "Data",
|
||||
"options": "Phone"
|
||||
},
|
||||
{
|
||||
"depends_on": "eval: doc.__islocal",
|
||||
@@ -311,7 +311,8 @@
|
||||
"fieldtype": "Data",
|
||||
"label": "Mobile No.",
|
||||
"oldfieldname": "mobile_no",
|
||||
"oldfieldtype": "Data"
|
||||
"oldfieldtype": "Data",
|
||||
"options": "Phone"
|
||||
},
|
||||
{
|
||||
"depends_on": "eval: doc.__islocal",
|
||||
@@ -432,13 +433,21 @@
|
||||
"fieldname": "contact_section",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Contact"
|
||||
},
|
||||
{
|
||||
"default": "Billing",
|
||||
"depends_on": "eval: doc.__islocal",
|
||||
"fieldname": "address_type",
|
||||
"fieldtype": "Select",
|
||||
"label": "Address Type",
|
||||
"options": "Billing\nShipping\nOffice\nPersonal\nPlant\nPostal\nShop\nSubsidiary\nWarehouse\nCurrent\nPermanent\nOther"
|
||||
}
|
||||
],
|
||||
"icon": "fa fa-user",
|
||||
"idx": 5,
|
||||
"image_field": "image",
|
||||
"links": [],
|
||||
"modified": "2019-12-24 16:00:44.239168",
|
||||
"modified": "2020-04-08 22:26:11.687110",
|
||||
"modified_by": "Administrator",
|
||||
"module": "CRM",
|
||||
"name": "Lead",
|
||||
@@ -511,4 +520,4 @@
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"title_field": "title"
|
||||
}
|
||||
}
|
||||
@@ -12,9 +12,6 @@ from frappe.email.inbox import link_communication_to_document
|
||||
from frappe.model.mapper import get_mapped_doc
|
||||
from frappe.utils import cint, comma_and, cstr, getdate, has_gravatar, nowdate, validate_email_address
|
||||
|
||||
sender_field = "email_id"
|
||||
|
||||
|
||||
class Lead(SellingController):
|
||||
def get_feed(self):
|
||||
return '{0}: {1}'.format(_(self.status), self.lead_name)
|
||||
@@ -129,16 +126,23 @@ class Lead(SellingController):
|
||||
self.title = self.lead_name
|
||||
|
||||
def create_address(self):
|
||||
address_fields = ["address_title", "address_line1", "address_line2",
|
||||
address_fields = ["address_type", "address_title", "address_line1", "address_line2",
|
||||
"city", "county", "state", "country", "pincode"]
|
||||
info_fields = ["email_id", "phone", "fax"]
|
||||
|
||||
# do not create an address if no fields are available,
|
||||
# skipping country since the system auto-sets it from system defaults
|
||||
if not any([self.get(field) for field in address_fields if field != "country"]):
|
||||
address = frappe.new_doc("Address")
|
||||
|
||||
mandatory_fields = [ df.fieldname for df in address.meta.fields if df.reqd ]
|
||||
|
||||
if not all([self.get(field) for field in mandatory_fields]):
|
||||
frappe.msgprint(_('Missing mandatory fields in address. \
|
||||
{0} to create address' ).format("<a href='desk#Form/Address/New Address 1' \
|
||||
> Click here </a>"),
|
||||
alert=True, indicator='yellow')
|
||||
return
|
||||
|
||||
address = frappe.new_doc("Address")
|
||||
address.update({addr_field: self.get(addr_field) for addr_field in address_fields})
|
||||
address.update({info_field: self.get(info_field) for info_field in info_fields})
|
||||
address.insert()
|
||||
@@ -205,7 +209,7 @@ class Lead(SellingController):
|
||||
self.contact_doc.save()
|
||||
|
||||
def flush_address_and_contact_fields(self):
|
||||
fields = ['address_line1', 'address_line2', 'address_title',
|
||||
fields = ['address_type', 'address_line1', 'address_line2', 'address_title',
|
||||
'city', 'county', 'country', 'fax', 'pincode', 'state']
|
||||
|
||||
for field in fields:
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
"doctype": "DocType",
|
||||
"document_type": "Document",
|
||||
"editable_grid": 1,
|
||||
"email_append_to": 1,
|
||||
"engine": "InnoDB",
|
||||
"field_order": [
|
||||
"from_section",
|
||||
@@ -328,6 +329,7 @@
|
||||
"fieldname": "contact_email",
|
||||
"fieldtype": "Data",
|
||||
"label": "Contact Email",
|
||||
"options": "Email",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
@@ -421,7 +423,7 @@
|
||||
"icon": "fa fa-info-sign",
|
||||
"idx": 195,
|
||||
"links": [],
|
||||
"modified": "2020-03-20 12:28:45.228994",
|
||||
"modified": "2020-04-07 09:05:39.391109",
|
||||
"modified_by": "Administrator",
|
||||
"module": "CRM",
|
||||
"name": "Opportunity",
|
||||
@@ -453,9 +455,11 @@
|
||||
}
|
||||
],
|
||||
"search_fields": "status,transaction_date,party_name,opportunity_type,territory,company",
|
||||
"sender_field": "contact_email",
|
||||
"show_name_in_global_search": 1,
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"subject_field": "title",
|
||||
"timeline_field": "party_name",
|
||||
"title_field": "title",
|
||||
"track_seen": 1,
|
||||
|
||||
@@ -11,9 +11,6 @@ from erpnext.utilities.transaction_base import TransactionBase
|
||||
from erpnext.accounts.party import get_party_account_currency
|
||||
from frappe.email.inbox import link_communication_to_document
|
||||
|
||||
subject_field = "title"
|
||||
sender_field = "contact_email"
|
||||
|
||||
class Opportunity(TransactionBase):
|
||||
def after_insert(self):
|
||||
if self.opportunity_from == "Lead":
|
||||
|
||||
@@ -1,56 +1,69 @@
|
||||
{
|
||||
"cards": [
|
||||
{
|
||||
"links": "[\n {\n \"label\": \"Student Attendance Tool\",\n \"name\": \"Student Attendance Tool\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Assessment Result Tool\",\n \"name\": \"Assessment Result Tool\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Student Group Creation Tool\",\n \"name\": \"Student Group Creation Tool\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Program Enrollment Tool\",\n \"name\": \"Program Enrollment Tool\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Course Scheduling Tool\",\n \"name\": \"Course Scheduling Tool\",\n \"type\": \"doctype\"\n }\n]",
|
||||
"title": "Tools"
|
||||
"hidden": 0,
|
||||
"label": "Tools",
|
||||
"links": "[\n {\n \"label\": \"Student Attendance Tool\",\n \"name\": \"Student Attendance Tool\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Assessment Result Tool\",\n \"name\": \"Assessment Result Tool\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Student Group Creation Tool\",\n \"name\": \"Student Group Creation Tool\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Program Enrollment Tool\",\n \"name\": \"Program Enrollment Tool\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Course Scheduling Tool\",\n \"name\": \"Course Scheduling Tool\",\n \"type\": \"doctype\"\n }\n]"
|
||||
},
|
||||
{
|
||||
"links": "[\n {\n \"dependencies\": [\n \"Program Enrollment\"\n ],\n \"doctype\": \"Program Enrollment\",\n \"is_query_report\": true,\n \"label\": \"Student and Guardian Contact Details\",\n \"name\": \"Student and Guardian Contact Details\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"Student Attendance\"\n ],\n \"doctype\": \"Student Attendance\",\n \"is_query_report\": true,\n \"label\": \"Student Monthly Attendance Sheet\",\n \"name\": \"Student Monthly Attendance Sheet\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"Fees\"\n ],\n \"doctype\": \"Fees\",\n \"is_query_report\": true,\n \"label\": \"Student Fee Collection\",\n \"name\": \"Student Fee Collection\",\n \"type\": \"report\"\n }\n]",
|
||||
"title": "Other Reports"
|
||||
"hidden": 0,
|
||||
"label": "Other Reports",
|
||||
"links": "[\n {\n \"dependencies\": [\n \"Program Enrollment\"\n ],\n \"doctype\": \"Program Enrollment\",\n \"is_query_report\": true,\n \"label\": \"Student and Guardian Contact Details\",\n \"name\": \"Student and Guardian Contact Details\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"Student Attendance\"\n ],\n \"doctype\": \"Student Attendance\",\n \"is_query_report\": true,\n \"label\": \"Student Monthly Attendance Sheet\",\n \"name\": \"Student Monthly Attendance Sheet\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"Fees\"\n ],\n \"doctype\": \"Fees\",\n \"is_query_report\": true,\n \"label\": \"Student Fee Collection\",\n \"name\": \"Student Fee Collection\",\n \"type\": \"report\"\n }\n]"
|
||||
},
|
||||
{
|
||||
"links": "[\n {\n \"label\": \"Student Category\",\n \"name\": \"Student Category\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Student Batch Name\",\n \"name\": \"Student Batch Name\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Grading Scale\",\n \"name\": \"Grading Scale\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Academic Term\",\n \"name\": \"Academic Term\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Academic Year\",\n \"name\": \"Academic Year\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Education Settings\",\n \"name\": \"Education Settings\",\n \"type\": \"doctype\"\n }\n]",
|
||||
"title": "Settings"
|
||||
"hidden": 0,
|
||||
"label": "Settings",
|
||||
"links": "[\n {\n \"label\": \"Student Category\",\n \"name\": \"Student Category\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Student Batch Name\",\n \"name\": \"Student Batch Name\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Grading Scale\",\n \"name\": \"Grading Scale\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Academic Term\",\n \"name\": \"Academic Term\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Academic Year\",\n \"name\": \"Academic Year\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Education Settings\",\n \"name\": \"Education Settings\",\n \"type\": \"doctype\"\n }\n]"
|
||||
},
|
||||
{
|
||||
"links": "[\n {\n \"label\": \"Article\",\n \"name\": \"Article\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Video\",\n \"name\": \"Video\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Quiz\",\n \"name\": \"Quiz\",\n \"type\": \"doctype\"\n }\n]",
|
||||
"title": "Content Masters"
|
||||
"hidden": 0,
|
||||
"label": "Content Masters",
|
||||
"links": "[\n {\n \"label\": \"Article\",\n \"name\": \"Article\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Video\",\n \"name\": \"Video\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Quiz\",\n \"name\": \"Quiz\",\n \"type\": \"doctype\"\n }\n]"
|
||||
},
|
||||
{
|
||||
"links": "[\n {\n \"label\": \"Student Attendance\",\n \"name\": \"Student Attendance\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Student Leave Application\",\n \"name\": \"Student Leave Application\",\n \"type\": \"doctype\"\n },\n {\n \"dependencies\": [\n \"Student Attendance\"\n ],\n \"doctype\": \"Student Attendance\",\n \"is_query_report\": true,\n \"label\": \"Absent Student Report\",\n \"name\": \"Absent Student Report\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"Student Attendance\"\n ],\n \"doctype\": \"Student Attendance\",\n \"is_query_report\": true,\n \"label\": \"Student Batch-Wise Attendance\",\n \"name\": \"Student Batch-Wise Attendance\",\n \"type\": \"report\"\n }\n]",
|
||||
"title": "Attendance"
|
||||
"hidden": 0,
|
||||
"label": "Attendance",
|
||||
"links": "[\n {\n \"label\": \"Student Attendance\",\n \"name\": \"Student Attendance\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Student Leave Application\",\n \"name\": \"Student Leave Application\",\n \"type\": \"doctype\"\n },\n {\n \"dependencies\": [\n \"Student Attendance\"\n ],\n \"doctype\": \"Student Attendance\",\n \"is_query_report\": true,\n \"label\": \"Absent Student Report\",\n \"name\": \"Absent Student Report\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"Student Attendance\"\n ],\n \"doctype\": \"Student Attendance\",\n \"is_query_report\": true,\n \"label\": \"Student Batch-Wise Attendance\",\n \"name\": \"Student Batch-Wise Attendance\",\n \"type\": \"report\"\n }\n]"
|
||||
},
|
||||
{
|
||||
"links": "[\n {\n \"label\": \"Student Applicant\",\n \"name\": \"Student Applicant\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Student Admission\",\n \"name\": \"Student Admission\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Program Enrollment\",\n \"name\": \"Program Enrollment\",\n \"type\": \"doctype\"\n }\n]",
|
||||
"title": "Admission"
|
||||
"hidden": 0,
|
||||
"label": "Admission",
|
||||
"links": "[\n {\n \"label\": \"Student Applicant\",\n \"name\": \"Student Applicant\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Student Admission\",\n \"name\": \"Student Admission\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Program Enrollment\",\n \"name\": \"Program Enrollment\",\n \"type\": \"doctype\"\n }\n]"
|
||||
},
|
||||
{
|
||||
"links": "[\n {\n \"label\": \"Assessment Plan\",\n \"name\": \"Assessment Plan\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Assessment Group\",\n \"link\": \"Tree/Assessment Group\",\n \"name\": \"Assessment Group\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Assessment Result\",\n \"name\": \"Assessment Result\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Assessment Criteria\",\n \"name\": \"Assessment Criteria\",\n \"type\": \"doctype\"\n }\n]",
|
||||
"title": "Assessment"
|
||||
"hidden": 0,
|
||||
"label": "Assessment",
|
||||
"links": "[\n {\n \"label\": \"Assessment Plan\",\n \"name\": \"Assessment Plan\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Assessment Group\",\n \"link\": \"Tree/Assessment Group\",\n \"name\": \"Assessment Group\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Assessment Result\",\n \"name\": \"Assessment Result\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Assessment Criteria\",\n \"name\": \"Assessment Criteria\",\n \"type\": \"doctype\"\n }\n]"
|
||||
},
|
||||
{
|
||||
"links": "[\n {\n \"label\": \"Student\",\n \"name\": \"Student\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Guardian\",\n \"name\": \"Guardian\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Student Log\",\n \"name\": \"Student Log\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Student Group\",\n \"name\": \"Student Group\",\n \"type\": \"doctype\"\n }\n]",
|
||||
"title": "Student"
|
||||
"hidden": 0,
|
||||
"label": "Student",
|
||||
"links": "[\n {\n \"label\": \"Student\",\n \"name\": \"Student\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Guardian\",\n \"name\": \"Guardian\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Student Log\",\n \"name\": \"Student Log\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Student Group\",\n \"name\": \"Student Group\",\n \"type\": \"doctype\"\n }\n]"
|
||||
},
|
||||
{
|
||||
"links": "[\n {\n \"label\": \"Program\",\n \"name\": \"Program\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Course\",\n \"name\": \"Course\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Topic\",\n \"name\": \"Topic\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Instructor\",\n \"name\": \"Instructor\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Room\",\n \"name\": \"Room\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n }\n]",
|
||||
"title": "Masters"
|
||||
"hidden": 0,
|
||||
"label": "Masters",
|
||||
"links": "[\n {\n \"label\": \"Program\",\n \"name\": \"Program\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Course\",\n \"name\": \"Course\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Topic\",\n \"name\": \"Topic\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Instructor\",\n \"name\": \"Instructor\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Room\",\n \"name\": \"Room\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n }\n]"
|
||||
},
|
||||
{
|
||||
"links": "[\n {\n \"label\": \"Course Enrollment\",\n \"name\": \"Course Enrollment\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Course Activity\",\n \"name\": \"Course Activity\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Quiz Activity\",\n \"name\": \"Quiz Activity\",\n \"type\": \"doctype\"\n }\n]",
|
||||
"title": "LMS Activity"
|
||||
"hidden": 0,
|
||||
"label": "LMS Activity",
|
||||
"links": "[\n {\n \"label\": \"Course Enrollment\",\n \"name\": \"Course Enrollment\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Course Activity\",\n \"name\": \"Course Activity\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Quiz Activity\",\n \"name\": \"Quiz Activity\",\n \"type\": \"doctype\"\n }\n]"
|
||||
},
|
||||
{
|
||||
"links": "[\n {\n \"label\": \"Course Schedule\",\n \"name\": \"Course Schedule\",\n \"route\": \"#List/Course Schedule/Calendar\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Course Scheduling Tool\",\n \"name\": \"Course Scheduling Tool\",\n \"type\": \"doctype\"\n }\n]",
|
||||
"title": "Schedule"
|
||||
"hidden": 0,
|
||||
"label": "Schedule",
|
||||
"links": "[\n {\n \"label\": \"Course Schedule\",\n \"name\": \"Course Schedule\",\n \"route\": \"#List/Course Schedule/Calendar\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Course Scheduling Tool\",\n \"name\": \"Course Scheduling Tool\",\n \"type\": \"doctype\"\n }\n]"
|
||||
},
|
||||
{
|
||||
"links": "[\n {\n \"label\": \"Fees\",\n \"name\": \"Fees\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Fee Schedule\",\n \"name\": \"Fee Schedule\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Fee Structure\",\n \"name\": \"Fee Structure\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Fee Category\",\n \"name\": \"Fee Category\",\n \"type\": \"doctype\"\n }\n]",
|
||||
"title": "Fees"
|
||||
"hidden": 0,
|
||||
"label": "Fees",
|
||||
"links": "[\n {\n \"label\": \"Fees\",\n \"name\": \"Fees\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Fee Schedule\",\n \"name\": \"Fee Schedule\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Fee Structure\",\n \"name\": \"Fee Structure\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Fee Category\",\n \"name\": \"Fee Category\",\n \"type\": \"doctype\"\n }\n]"
|
||||
},
|
||||
{
|
||||
"links": "[\n {\n \"dependencies\": [\n \"Assessment Result\"\n ],\n \"doctype\": \"Assessment Result\",\n \"is_query_report\": true,\n \"label\": \"Course wise Assessment Report\",\n \"name\": \"Course wise Assessment Report\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"Assessment Result\"\n ],\n \"doctype\": \"Assessment Result\",\n \"is_query_report\": true,\n \"label\": \"Final Assessment Grades\",\n \"name\": \"Final Assessment Grades\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"Assessment Plan\"\n ],\n \"doctype\": \"Assessment Plan\",\n \"is_query_report\": true,\n \"label\": \"Assessment Plan Status\",\n \"name\": \"Assessment Plan Status\",\n \"type\": \"report\"\n },\n {\n \"label\": \"Student Report Generation Tool\",\n \"name\": \"Student Report Generation Tool\",\n \"type\": \"doctype\"\n }\n]",
|
||||
"title": "Assessment Reports"
|
||||
"hidden": 0,
|
||||
"label": "Assessment Reports",
|
||||
"links": "[\n {\n \"dependencies\": [\n \"Assessment Result\"\n ],\n \"doctype\": \"Assessment Result\",\n \"is_query_report\": true,\n \"label\": \"Course wise Assessment Report\",\n \"name\": \"Course wise Assessment Report\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"Assessment Result\"\n ],\n \"doctype\": \"Assessment Result\",\n \"is_query_report\": true,\n \"label\": \"Final Assessment Grades\",\n \"name\": \"Final Assessment Grades\",\n \"type\": \"report\"\n },\n {\n \"dependencies\": [\n \"Assessment Plan\"\n ],\n \"doctype\": \"Assessment Plan\",\n \"is_query_report\": true,\n \"label\": \"Assessment Plan Status\",\n \"name\": \"Assessment Plan Status\",\n \"type\": \"report\"\n },\n {\n \"label\": \"Student Report Generation Tool\",\n \"name\": \"Student Report Generation Tool\",\n \"type\": \"doctype\"\n }\n]"
|
||||
}
|
||||
],
|
||||
"category": "Domains",
|
||||
@@ -64,7 +77,7 @@
|
||||
"idx": 0,
|
||||
"is_standard": 1,
|
||||
"label": "Education",
|
||||
"modified": "2020-03-12 16:30:37.217514",
|
||||
"modified": "2020-04-01 11:28:51.011309",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Education",
|
||||
"name": "Education",
|
||||
|
||||
@@ -14,7 +14,7 @@ def execute(filters=None):
|
||||
student_batch_name = filters.get("student_batch_name")
|
||||
|
||||
columns = get_columns()
|
||||
|
||||
|
||||
program_enrollments = frappe.get_list("Program Enrollment", fields=["student", "student_name"],
|
||||
filters={"academic_year": academic_year, "program": program, "student_batch_name": student_batch_name})
|
||||
|
||||
@@ -46,9 +46,9 @@ def execute(filters=None):
|
||||
|
||||
def get_columns():
|
||||
columns = [
|
||||
_(" Group Roll No") + "::60",
|
||||
_("Student ID") + ":Link/Student:90",
|
||||
_("Student Name") + "::150",
|
||||
_("Group Roll No") + "::60",
|
||||
_("Student ID") + ":Link/Student:90",
|
||||
_("Student Name") + "::150",
|
||||
_("Student Mobile No.") + "::110",
|
||||
_("Student Email ID") + "::125",
|
||||
_("Student Address") + "::175",
|
||||
@@ -84,10 +84,10 @@ def get_guardian_map(student_list):
|
||||
|
||||
guardian_list = list(set([g.guardian for g in guardian_details])) or ['']
|
||||
|
||||
guardian_mobile_no = dict(frappe.db.sql("""select name, mobile_number from `tabGuardian`
|
||||
guardian_mobile_no = dict(frappe.db.sql("""select name, mobile_number from `tabGuardian`
|
||||
where name in (%s)""" % ", ".join(['%s']*len(guardian_list)), tuple(guardian_list)))
|
||||
|
||||
guardian_email_id = dict(frappe.db.sql("""select name, email_address from `tabGuardian`
|
||||
guardian_email_id = dict(frappe.db.sql("""select name, email_address from `tabGuardian`
|
||||
where name in (%s)""" % ", ".join(['%s']*len(guardian_list)), tuple(guardian_list)))
|
||||
|
||||
for guardian in guardian_details:
|
||||
|
||||
60
erpnext/erpnext_integrations/custom/contact.json
Normal file
60
erpnext/erpnext_integrations/custom/contact.json
Normal file
@@ -0,0 +1,60 @@
|
||||
{
|
||||
"custom_fields": [
|
||||
{
|
||||
"_assign": null,
|
||||
"_comments": null,
|
||||
"_liked_by": null,
|
||||
"_user_tags": null,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"collapsible_depends_on": null,
|
||||
"columns": 0,
|
||||
"creation": "2019-12-02 11:00:03.432994",
|
||||
"default": null,
|
||||
"depends_on": null,
|
||||
"description": null,
|
||||
"docstatus": 0,
|
||||
"dt": "Contact",
|
||||
"fetch_from": null,
|
||||
"fetch_if_empty": 0,
|
||||
"fieldname": "is_billing_contact",
|
||||
"fieldtype": "Check",
|
||||
"hidden": 0,
|
||||
"idx": 27,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"insert_after": "is_primary_contact",
|
||||
"label": "Is Billing Contact",
|
||||
"length": 0,
|
||||
"modified": "2019-12-02 11:00:03.432994",
|
||||
"modified_by": "Administrator",
|
||||
"name": "Contact-is_billing_contact",
|
||||
"no_copy": 0,
|
||||
"options": null,
|
||||
"owner": "Administrator",
|
||||
"parent": null,
|
||||
"parentfield": null,
|
||||
"parenttype": null,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"print_width": null,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0,
|
||||
"width": null
|
||||
}
|
||||
],
|
||||
"custom_perms": [],
|
||||
"doctype": "Contact",
|
||||
"property_setters": [],
|
||||
"sync_on_migrate": 1
|
||||
}
|
||||
@@ -121,7 +121,7 @@ def call_mws_method(mws_method, *args, **kwargs):
|
||||
time.sleep(delay)
|
||||
continue
|
||||
|
||||
mws_settings.enable_synch = 0
|
||||
mws_settings.enable_sync = 0
|
||||
mws_settings.save()
|
||||
|
||||
frappe.throw(_("Sync has been temporarily disabled because maximum retries have been exceeded"))
|
||||
|
||||
@@ -39,16 +39,19 @@ __all__ = [
|
||||
# for a list of the end points and marketplace IDs
|
||||
|
||||
MARKETPLACES = {
|
||||
"CA" : "https://mws.amazonservices.ca", #A2EUQ1WTGCTBG2
|
||||
"US" : "https://mws.amazonservices.com", #ATVPDKIKX0DER",
|
||||
"DE" : "https://mws-eu.amazonservices.com", #A1PA6795UKMFR9
|
||||
"ES" : "https://mws-eu.amazonservices.com", #A1RKKUPIHCS9HS
|
||||
"FR" : "https://mws-eu.amazonservices.com", #A13V1IB3VIYZZH
|
||||
"IN" : "https://mws.amazonservices.in", #A21TJRUUN4KGV
|
||||
"IT" : "https://mws-eu.amazonservices.com", #APJ6JRA9NG5V4
|
||||
"UK" : "https://mws-eu.amazonservices.com", #A1F83G8C2ARO7P
|
||||
"JP" : "https://mws.amazonservices.jp", #A1VC38T7YXB528
|
||||
"CN" : "https://mws.amazonservices.com.cn", #AAHKV2X7AFYLW
|
||||
"CA": "https://mws.amazonservices.ca", #A2EUQ1WTGCTBG2
|
||||
"US": "https://mws.amazonservices.com", #ATVPDKIKX0DER",
|
||||
"DE": "https://mws-eu.amazonservices.com", #A1PA6795UKMFR9
|
||||
"ES": "https://mws-eu.amazonservices.com", #A1RKKUPIHCS9HS
|
||||
"FR": "https://mws-eu.amazonservices.com", #A13V1IB3VIYZZH
|
||||
"IN": "https://mws.amazonservices.in", #A21TJRUUN4KGV
|
||||
"IT": "https://mws-eu.amazonservices.com", #APJ6JRA9NG5V4
|
||||
"UK": "https://mws-eu.amazonservices.com", #A1F83G8C2ARO7P
|
||||
"JP": "https://mws.amazonservices.jp", #A1VC38T7YXB528
|
||||
"CN": "https://mws.amazonservices.com.cn", #AAHKV2X7AFYLW
|
||||
"AE": " https://mws.amazonservices.ae", #A2VIGQ35RCS4UG
|
||||
"MX": "https://mws.amazonservices.com.mx", #A1AM78C64UM0Y8
|
||||
"BR": "https://mws.amazonservices.com", #A2Q3Y263D00KWC
|
||||
}
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -7,14 +7,15 @@ import frappe
|
||||
from frappe.model.document import Document
|
||||
import dateutil
|
||||
from frappe.custom.doctype.custom_field.custom_field import create_custom_fields
|
||||
from erpnext.erpnext_integrations.doctype.amazon_mws_settings.amazon_methods import get_orders
|
||||
|
||||
class AmazonMWSSettings(Document):
|
||||
def validate(self):
|
||||
if self.enable_amazon == 1:
|
||||
self.enable_synch = 1
|
||||
self.enable_sync = 1
|
||||
setup_custom_fields()
|
||||
else:
|
||||
self.enable_synch = 0
|
||||
self.enable_sync = 0
|
||||
|
||||
def get_products_details(self):
|
||||
if self.enable_amazon == 1:
|
||||
@@ -27,7 +28,7 @@ class AmazonMWSSettings(Document):
|
||||
|
||||
def schedule_get_order_details():
|
||||
mws_settings = frappe.get_doc("Amazon MWS Settings")
|
||||
if mws_settings.enable_synch and mws_settings.enable_amazon:
|
||||
if mws_settings.enable_sync and mws_settings.enable_amazon:
|
||||
after_date = dateutil.parser.parse(mws_settings.after_date).strftime("%Y-%m-%d")
|
||||
get_orders(after_date = after_date)
|
||||
|
||||
|
||||
@@ -1,28 +1,49 @@
|
||||
{
|
||||
"cards": [
|
||||
{
|
||||
"icon": "icon-cog",
|
||||
"links": "[\n {\n \"label\": \"Healthcare Settings\",\n \"name\": \"Healthcare Settings\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Medical Department\",\n \"name\": \"Medical Department\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Appointment Type\",\n \"name\": \"Appointment Type\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Prescription Dosage\",\n \"name\": \"Prescription Dosage\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Prescription Duration\",\n \"name\": \"Prescription Duration\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Complaint\",\n \"name\": \"Complaint\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Diagnosis\",\n \"name\": \"Diagnosis\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Lab Test Sample\",\n \"name\": \"Lab Test Sample\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Lab Test UOM\",\n \"name\": \"Lab Test UOM\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Antibiotic\",\n \"name\": \"Antibiotic\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Sensitivity\",\n \"name\": \"Sensitivity\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Lab Test Template\",\n \"name\": \"Lab Test Template\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Clinical Procedure Template\",\n \"name\": \"Clinical Procedure Template\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Healthcare Service Unit Type\",\n \"name\": \"Healthcare Service Unit Type\",\n \"type\": \"doctype\"\n }\n]",
|
||||
"title": "Settings"
|
||||
},
|
||||
{
|
||||
"icon": "icon-list",
|
||||
"links": "[\n {\n \"label\": \"Lab Test\",\n \"name\": \"Lab Test\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Sample Collection\",\n \"name\": \"Sample Collection\",\n \"type\": \"doctype\"\n },\n {\n \"is_query_report\": true,\n \"label\": \"Lab Test Report\",\n \"name\": \"Lab Test Report\",\n \"type\": \"report\"\n }\n]",
|
||||
"title": "Laboratory"
|
||||
},
|
||||
{
|
||||
"icon": "icon-list",
|
||||
"links": "[\n {\n \"label\": \"Patient\",\n \"name\": \"Patient\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Healthcare Practitioner\",\n \"name\": \"Healthcare Practitioner\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Practitioner Schedule\",\n \"name\": \"Practitioner Schedule\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Medical Code Standard\",\n \"name\": \"Medical Code Standard\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Medical Code\",\n \"name\": \"Medical Code\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Healthcare Service Unit\",\n \"name\": \"Healthcare Service Unit\",\n \"type\": \"doctype\"\n }\n]",
|
||||
"icon": "",
|
||||
"links": "[\n\t{\n\t\t\"type\": \"doctype\",\n\t\t\"name\": \"Patient\",\n\t\t\"label\": \"Patient\",\n\t\t\"onboard\": 1\n\t},\n\t{\n\t\t\"type\": \"doctype\",\n\t\t\"name\": \"Healthcare Practitioner\",\n\t\t\"label\":\"Healthcare Practitioner\",\n\t\t\"onboard\": 1\n\t},\n\t{\n\t\t\"type\": \"doctype\",\n\t\t\"name\": \"Practitioner Schedule\",\n\t\t\"label\": \"Practitioner Schedule\",\n\t\t\"onboard\": 1\n\t},\n\t{\n\t\t\"type\": \"doctype\",\n\t\t\"name\": \"Medical Department\",\n\t\t\"label\": \"Medical Department\"\n\t},\n\t{\n\t\t\"type\": \"doctype\",\n\t\t\"name\": \"Healthcare Service Unit Type\",\n\t\t\"label\": \"Healthcare Service Unit Type\"\n\t},\n\t{\n\t\t\"type\": \"doctype\",\n\t\t\"name\": \"Healthcare Service Unit\",\n\t\t\"label\": \"Healthcare Service Unit\"\n\t},\n\t{\n\t\t\"type\": \"doctype\",\n\t\t\"name\": \"Medical Code Standard\",\n\t\t\"label\": \"Medical Code Standard\"\n\t},\n\t{\n\t\t\"type\": \"doctype\",\n\t\t\"name\": \"Medical Code\",\n\t\t\"label\": \"Medical Code\"\n\t}\n]",
|
||||
"title": "Masters"
|
||||
},
|
||||
{
|
||||
"icon": "",
|
||||
"links": "[\n\t{\n\t\t\"type\": \"doctype\",\n\t\t\"name\": \"Appointment Type\",\n\t\t\"label\": \"Appointment Type\"\n },\n\t{\n\t\t\"type\": \"doctype\",\n\t\t\"name\": \"Clinical Procedure Template\",\n\t\t\"label\": \"Clinical Procedure Template\"\n\t},\n\t{\n\t\t\"type\": \"doctype\",\n\t\t\"name\": \"Prescription Dosage\",\n\t\t\"label\": \"Prescription Dosage\"\n\t},\n\t{\n\t\t\"type\": \"doctype\",\n\t\t\"name\": \"Prescription Duration\",\n\t\t\"label\": \"Prescription Duration\"\n\t},\n\t{\n\t \"type\": \"doctype\",\n\t\t\"name\": \"Antibiotic\",\n\t\t\"label\": \"Antibiotic\"\n\t}\n]",
|
||||
"title": "Consultation Setup"
|
||||
},
|
||||
{
|
||||
"icon": "icon-star",
|
||||
"links": "[\n {\n \"label\": \"Patient Appointment\",\n \"name\": \"Patient Appointment\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Patient Encounter\",\n \"name\": \"Patient Encounter\",\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Record Patient Vitals\",\n \"label\": \"Vital Signs\",\n \"name\": \"Vital Signs\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Patient History\",\n \"name\": \"patient_history\",\n \"type\": \"page\"\n },\n {\n \"label\": \"Appointment Analytics\",\n \"name\": \"appointment-analytic\",\n \"type\": \"page\"\n },\n {\n \"label\": \"Clinical Procedure\",\n \"name\": \"Clinical Procedure\",\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Inpatient Record\",\n \"name\": \"Inpatient Record\",\n \"type\": \"doctype\"\n }\n]",
|
||||
"links": "[\n\t{\n\t\t\"type\": \"doctype\",\n\t\t\"name\": \"Patient Appointment\",\n\t\t\"label\": \"Patient Appointment\"\n\t},\n\t{\n\t\t\"type\": \"doctype\",\n\t\t\"name\": \"Clinical Procedure\",\n\t\t\"label\": \"Clinical Procedure\"\n\t},\n\t{\n\t\t\"type\": \"doctype\",\n\t\t\"name\": \"Patient Encounter\",\n\t\t\"label\": \"Patient Encounter\"\n\t},\n\t{\n\t\t\"type\": \"doctype\",\n\t\t\"name\": \"Vital Signs\",\n\t\t\"label\": \"Vital Signs\"\n\t},\n\t{\n\t\t\"type\": \"doctype\",\n\t\t\"name\": \"Complaint\",\n\t\t\"label\": \"Complaint\"\n\t},\n\t{\n\t\t\"type\": \"doctype\",\n\t\t\"name\": \"Diagnosis\",\n\t\t\"label\": \"Diagnosis\"\n\t},\n\t{\n\t\t\"type\": \"doctype\",\n\t\t\"name\": \"Fee Validity\",\n\t\t\"label\": \"Fee Validity\"\n\t}\n]",
|
||||
"title": "Consultation"
|
||||
},
|
||||
{
|
||||
"links": "[\n\t{\n\t\t\"type\": \"doctype\",\n\t\t\"name\": \"Healthcare Settings\",\n\t\t\"label\": \"Healthcare Settings\",\n\t\t\"onboard\": 1\n\t}\n]",
|
||||
"title": "Settings"
|
||||
},
|
||||
{
|
||||
"links": "[\n\t{\n\t\t\"type\": \"doctype\",\n\t\t\"name\": \"Lab Test Template\",\n\t\t\"label\": \"Lab Test Template\"\n\t},\n\t{\n\t\t\"type\": \"doctype\",\n\t\t\"name\": \"Lab Test Sample\",\n\t\t\"label\": \"Lab Test Sample\"\n\t},\n\t{\n\t\t\"type\": \"doctype\",\n\t\t\"name\": \"Lab Test UOM\",\n\t\t\"label\": \"Lab Test UOM\"\n\t},\n\t{\n\t\t\"type\": \"doctype\",\n\t\t\"name\": \"Sensitivity\",\n\t\t\"label\": \"Sensitivity\"\n\t}\n]",
|
||||
"title": "Laboratory Setup"
|
||||
},
|
||||
{
|
||||
"links": "[\n\t{\n\t\t\"type\": \"doctype\",\n\t\t\"name\": \"Lab Test\",\n\t\t\"label\": \"Lab Test\"\n\t},\n\t{\n\t\t\"type\": \"doctype\",\n\t\t\"name\": \"Sample Collection\",\n\t\t\"label\": \"Sample Collection\"\n\t},\n\t{\n\t\t\"type\": \"doctype\",\n\t\t\"name\": \"Dosage Form\",\n\t\t\"label\": \"Dosage Form\"\n\t}\n]",
|
||||
"title": "Laboratory"
|
||||
},
|
||||
{
|
||||
"links": "[\n\t{\n\t\t\"type\": \"page\",\n\t\t\"name\": \"patient_history\",\n\t\t\"label\": \"Patient History\"\n\t},\n\t{\n\t\t\"type\": \"doctype\",\n\t\t\"name\": \"Patient Medical Record\",\n\t\t\"label\": \"Patient Medical Record\"\n\t},\n\t{\n\t\t\"type\": \"doctype\",\n\t\t\"name\": \"Inpatient Record\",\n\t\t\"label\": \"Inpatient Record\"\n\t}\n]",
|
||||
"title": "Records and History"
|
||||
},
|
||||
{
|
||||
"links": "[\n\t{\n\t\t\"type\": \"report\",\n\t\t\"is_query_report\": true,\n\t\t\"name\": \"Patient Appointment Analytics\",\n\t\t\"doctype\": \"Patient Appointment\"\n\t},\n\t{\n\t\t\"type\": \"report\",\n\t\t\"is_query_report\": true,\n\t\t\"name\": \"Lab Test Report\",\n\t\t\"doctype\": \"Lab Test\",\n\t\t\"label\": \"Lab Test Report\"\n\t}\n]",
|
||||
"title": "Reports"
|
||||
}
|
||||
],
|
||||
"category": "Domains",
|
||||
"charts": [],
|
||||
"charts": [
|
||||
{
|
||||
"chart_name": "Patient Appointments",
|
||||
"label": "Patient Appointments"
|
||||
}
|
||||
],
|
||||
"charts_label": "",
|
||||
"creation": "2020-03-02 17:23:17.919682",
|
||||
"developer_mode_only": 0,
|
||||
"disable_user_customization": 0,
|
||||
@@ -32,7 +53,7 @@
|
||||
"idx": 0,
|
||||
"is_standard": 1,
|
||||
"label": "Healthcare",
|
||||
"modified": "2020-03-12 16:30:36.952979",
|
||||
"modified": "2020-03-26 16:10:44.629795",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Healthcare",
|
||||
"name": "Healthcare",
|
||||
@@ -40,5 +61,37 @@
|
||||
"pin_to_bottom": 0,
|
||||
"pin_to_top": 0,
|
||||
"restrict_to_domain": "Healthcare",
|
||||
"shortcuts": []
|
||||
"shortcuts": [
|
||||
{
|
||||
"format": "{} Open",
|
||||
"is_query_report": 0,
|
||||
"link_to": "Patient Appointment",
|
||||
"stats_filter": "{\n \"status\": \"Open\"\n}",
|
||||
"type": "DocType"
|
||||
},
|
||||
{
|
||||
"format": "{} Active",
|
||||
"is_query_report": 0,
|
||||
"link_to": "Patient",
|
||||
"stats_filter": "{\n \"status\": \"Active\"\n}",
|
||||
"type": "DocType"
|
||||
},
|
||||
{
|
||||
"format": "{} Vacant",
|
||||
"is_query_report": 0,
|
||||
"link_to": "Healthcare Service Unit",
|
||||
"stats_filter": "{\n \"occupancy_status\": \"Vacant\",\n \"is_group\": 0\n}",
|
||||
"type": "DocType"
|
||||
},
|
||||
{
|
||||
"is_query_report": 0,
|
||||
"link_to": "Healthcare Practitioner",
|
||||
"type": "DocType"
|
||||
},
|
||||
{
|
||||
"is_query_report": 0,
|
||||
"link_to": "patient_history",
|
||||
"type": "Page"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,213 +1,94 @@
|
||||
{
|
||||
"allow_copy": 0,
|
||||
"allow_guest_to_view": 0,
|
||||
"allow_import": 1,
|
||||
"allow_rename": 1,
|
||||
"autoname": "field:appointment_type",
|
||||
"beta": 1,
|
||||
"creation": "2016-07-22 11:52:34.953019",
|
||||
"custom": 0,
|
||||
"docstatus": 0,
|
||||
"doctype": "DocType",
|
||||
"document_type": "Setup",
|
||||
"editable_grid": 0,
|
||||
"actions": [],
|
||||
"allow_import": 1,
|
||||
"allow_rename": 1,
|
||||
"autoname": "field:appointment_type",
|
||||
"beta": 1,
|
||||
"creation": "2016-07-22 11:52:34.953019",
|
||||
"doctype": "DocType",
|
||||
"document_type": "Setup",
|
||||
"engine": "InnoDB",
|
||||
"field_order": [
|
||||
"appointment_type",
|
||||
"ip",
|
||||
"default_duration",
|
||||
"color"
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 1,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "appointment_type",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 1,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Type",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 1,
|
||||
"allow_in_quick_entry": 1,
|
||||
"fieldname": "appointment_type",
|
||||
"fieldtype": "Data",
|
||||
"ignore_xss_filter": 1,
|
||||
"in_list_view": 1,
|
||||
"label": "Type",
|
||||
"reqd": 1,
|
||||
"translatable": 1,
|
||||
"unique": 1
|
||||
},
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 1,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "ip",
|
||||
"fieldtype": "Check",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Is Inpatient",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 1,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"bold": 1,
|
||||
"default": "0",
|
||||
"fieldname": "ip",
|
||||
"fieldtype": "Check",
|
||||
"label": "Is Inpatient",
|
||||
"print_hide": 1,
|
||||
"report_hide": 1
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 1,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 1,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"description": "In Minutes",
|
||||
"fieldname": "default_duration",
|
||||
"fieldtype": "Int",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 1,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Default Duration",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"allow_in_quick_entry": 1,
|
||||
"bold": 1,
|
||||
"fieldname": "default_duration",
|
||||
"fieldtype": "Int",
|
||||
"in_filter": 1,
|
||||
"in_list_view": 1,
|
||||
"label": "Default Duration (In Minutes)"
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 1,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "color",
|
||||
"fieldtype": "Color",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Color",
|
||||
"length": 0,
|
||||
"no_copy": 1,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 1,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
"allow_in_quick_entry": 1,
|
||||
"fieldname": "color",
|
||||
"fieldtype": "Color",
|
||||
"in_list_view": 1,
|
||||
"label": "Color",
|
||||
"no_copy": 1,
|
||||
"report_hide": 1
|
||||
}
|
||||
],
|
||||
"has_web_view": 0,
|
||||
"hide_heading": 0,
|
||||
"hide_toolbar": 0,
|
||||
"idx": 0,
|
||||
"image_view": 0,
|
||||
"in_create": 0,
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2018-08-08 12:57:54.544216",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Healthcare",
|
||||
"name": "Appointment Type",
|
||||
"name_case": "",
|
||||
"owner": "Administrator",
|
||||
],
|
||||
"links": [],
|
||||
"modified": "2020-02-03 21:06:05.833050",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Healthcare",
|
||||
"name": "Appointment Type",
|
||||
"owner": "Administrator",
|
||||
"permissions": [
|
||||
{
|
||||
"amend": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Healthcare Administrator",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 0,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Healthcare Administrator",
|
||||
"share": 1,
|
||||
"write": 1
|
||||
},
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Physician",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 0,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Physician",
|
||||
"share": 1,
|
||||
"write": 1
|
||||
}
|
||||
],
|
||||
"quick_entry": 1,
|
||||
"read_only": 0,
|
||||
"read_only_onload": 0,
|
||||
"restrict_to_domain": "Healthcare",
|
||||
"search_fields": "appointment_type",
|
||||
"show_name_in_global_search": 0,
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"title_field": "",
|
||||
"track_changes": 0,
|
||||
"track_seen": 0,
|
||||
"track_views": 0
|
||||
],
|
||||
"quick_entry": 1,
|
||||
"restrict_to_domain": "Healthcare",
|
||||
"search_fields": "appointment_type",
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC"
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
from __future__ import unicode_literals
|
||||
from frappe import _
|
||||
|
||||
def get_data():
|
||||
return {
|
||||
'fieldname': 'appointment_type',
|
||||
'transactions': [
|
||||
{
|
||||
'label': _('Patient Appointments'),
|
||||
'items': ['Patient Appointment']
|
||||
},
|
||||
]
|
||||
}
|
||||
@@ -4,244 +4,285 @@
|
||||
frappe.ui.form.on('Clinical Procedure', {
|
||||
setup: function(frm) {
|
||||
frm.set_query('batch_no', 'items', function(doc, cdt, cdn) {
|
||||
var item = locals[cdt][cdn];
|
||||
if(!item.item_code) {
|
||||
frappe.throw(__("Please enter Item Code to get Batch Number"));
|
||||
let item = locals[cdt][cdn];
|
||||
if (!item.item_code) {
|
||||
frappe.throw(__('Please enter Item Code to get Batch Number'));
|
||||
} else {
|
||||
let filters = {'item_code': item.item_code};
|
||||
|
||||
if (frm.doc.status == 'In Progress') {
|
||||
var filters = {
|
||||
'item_code': item.item_code,
|
||||
'posting_date': frm.doc.start_date || frappe.datetime.nowdate()
|
||||
};
|
||||
if(frm.doc.warehouse) filters["warehouse"] = frm.doc.warehouse;
|
||||
} else {
|
||||
filters = {
|
||||
'item_code': item.item_code
|
||||
};
|
||||
filters['posting_date'] = frm.doc.start_date || frappe.datetime.nowdate();
|
||||
if (frm.doc.warehouse) filters['warehouse'] = frm.doc.warehouse;
|
||||
}
|
||||
|
||||
return {
|
||||
query : "erpnext.controllers.queries.get_batch_no",
|
||||
query : 'erpnext.controllers.queries.get_batch_no',
|
||||
filters: filters
|
||||
};
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
refresh: function(frm) {
|
||||
frm.set_query("patient", function () {
|
||||
frm.set_query('patient', function () {
|
||||
return {
|
||||
filters: {"disabled": 0}
|
||||
filters: {'status': ['!=', 'Disabled']}
|
||||
};
|
||||
});
|
||||
frm.set_query("appointment", function () {
|
||||
|
||||
frm.set_query('appointment', function () {
|
||||
return {
|
||||
filters: {
|
||||
"procedure_template": ["not in", null],
|
||||
"status": ['in', 'Open, Scheduled']
|
||||
'procedure_template': ['not in', null],
|
||||
'status': ['in', 'Open, Scheduled']
|
||||
}
|
||||
};
|
||||
});
|
||||
frm.set_query("service_unit", function(){
|
||||
|
||||
frm.set_query('service_unit', function() {
|
||||
return {
|
||||
filters: {
|
||||
"is_group": false,
|
||||
"allow_appointments": true
|
||||
'is_group': false,
|
||||
'allow_appointments': true
|
||||
}
|
||||
};
|
||||
});
|
||||
frm.set_query("practitioner", function() {
|
||||
|
||||
frm.set_query('practitioner', function() {
|
||||
return {
|
||||
filters: {
|
||||
'department': frm.doc.medical_department
|
||||
}
|
||||
};
|
||||
});
|
||||
if(frm.doc.consume_stock){
|
||||
|
||||
if (frm.doc.consume_stock) {
|
||||
frm.set_indicator_formatter('item_code',
|
||||
function(doc) { return (doc.qty<=doc.actual_qty) ? "green" : "orange" ; });
|
||||
function(doc) { return (doc.qty<=doc.actual_qty) ? 'green' : 'orange' ; });
|
||||
}
|
||||
|
||||
if (!frm.doc.__islocal && frm.doc.status == 'In Progress'){
|
||||
if (frm.doc.docstatus == 1) {
|
||||
if (frm.doc.status == 'In Progress') {
|
||||
let btn_label = '';
|
||||
let msg = '';
|
||||
if (frm.doc.consume_stock) {
|
||||
btn_label = __('Complete and Consume');
|
||||
msg = __('Complete {0} and Consume Stock?', [frm.doc.name]);
|
||||
} else {
|
||||
btn_label = 'Complete';
|
||||
msg = __('Complete {0}?', [frm.doc.name]);
|
||||
}
|
||||
|
||||
if(frm.doc.consume_stock){
|
||||
var btn_label = 'Complete and Consume';
|
||||
var msg = 'Complete '+frm.doc.name+' and Consume Stock?';
|
||||
}else{
|
||||
btn_label = 'Complete';
|
||||
msg = 'Complete '+frm.doc.name+'?';
|
||||
}
|
||||
frm.add_custom_button(__(btn_label), function () {
|
||||
frappe.confirm(
|
||||
msg,
|
||||
function() {
|
||||
frappe.call({
|
||||
method: 'complete_procedure',
|
||||
doc: frm.doc,
|
||||
callback: function(r) {
|
||||
if (r.message) {
|
||||
frappe.show_alert({
|
||||
message: __('Stock Entry {0} created',
|
||||
['<a class="bold" href="#Form/Stock Entry/'+ r.message + '">' + r.message + '</a>']),
|
||||
indicator: 'green'
|
||||
});
|
||||
frm.reload_doc();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
);
|
||||
}).addClass("btn-primary");
|
||||
|
||||
frm.add_custom_button(__(btn_label), function () {
|
||||
frappe.confirm(
|
||||
__(msg),
|
||||
function(){
|
||||
frappe.call({
|
||||
doc: frm.doc,
|
||||
method: "complete",
|
||||
callback: function(r) {
|
||||
if(!r.exc){
|
||||
} else if (frm.doc.status == 'Pending') {
|
||||
frm.add_custom_button(__('Start'), function() {
|
||||
frappe.call({
|
||||
doc: frm.doc,
|
||||
method: 'start_procedure',
|
||||
callback: function(r) {
|
||||
if (!r.exc) {
|
||||
if (r.message == 'insufficient stock') {
|
||||
let msg = __('Stock quantity to start the Procedure is not available in the Warehouse {0}. Do you want to record a Stock Entry?',
|
||||
[frm.doc.warehouse.bold()]);
|
||||
frappe.confirm(
|
||||
msg,
|
||||
function() {
|
||||
frappe.call({
|
||||
doc: frm.doc,
|
||||
method: 'make_material_receipt',
|
||||
callback: function(r) {
|
||||
if (!r.exc) {
|
||||
cur_frm.reload_doc();
|
||||
let doclist = frappe.model.sync(r.message);
|
||||
frappe.set_route('Form', doclist[0].doctype, doclist[0].name);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
);
|
||||
} else {
|
||||
cur_frm.reload_doc();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
);
|
||||
});
|
||||
}else if (frm.doc.status == 'Draft') {
|
||||
frm.add_custom_button(__("Start"), function () {
|
||||
frappe.call({
|
||||
doc: frm.doc,
|
||||
method: "start",
|
||||
callback: function(r) {
|
||||
if(!r.exc){
|
||||
if(frm.doc.status == 'Draft'){
|
||||
frappe.confirm(
|
||||
__("Stock quantity to start procedure is not available in the warehouse. Do you want to record a Stock Transfer"),
|
||||
function(){
|
||||
frappe.call({
|
||||
doc: frm.doc,
|
||||
method: "make_material_transfer",
|
||||
callback: function(r) {
|
||||
if(!r.exc){
|
||||
cur_frm.reload_doc();
|
||||
var doclist = frappe.model.sync(r.message);
|
||||
frappe.set_route("Form", doclist[0].doctype, doclist[0].name);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
);
|
||||
}else{
|
||||
cur_frm.reload_doc();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
if (frm.doc.__islocal){
|
||||
frm.set_df_property("consumables", "hidden", 1);
|
||||
}else{
|
||||
frm.set_df_property("consumables", "hidden", 0);
|
||||
});
|
||||
}).addClass("btn-primary");
|
||||
}
|
||||
}
|
||||
},
|
||||
onload: function(frm){
|
||||
if(frm.doc.status == 'Completed'){
|
||||
frm.set_df_property("items", "read_only", 1);
|
||||
}
|
||||
if(frm.is_new()) {
|
||||
frm.add_fetch("procedure_template", "medical_department", "medical_department");
|
||||
frm.set_value("start_time", null);
|
||||
|
||||
onload: function(frm) {
|
||||
if (frm.is_new()) {
|
||||
frm.add_fetch('procedure_template', 'medical_department', 'medical_department');
|
||||
frm.set_value('start_time', null);
|
||||
}
|
||||
},
|
||||
|
||||
patient: function(frm) {
|
||||
if(frm.doc.patient){
|
||||
if (frm.doc.patient) {
|
||||
frappe.call({
|
||||
"method": "erpnext.healthcare.doctype.patient.patient.get_patient_detail",
|
||||
'method': 'erpnext.healthcare.doctype.patient.patient.get_patient_detail',
|
||||
args: {
|
||||
patient: frm.doc.patient
|
||||
},
|
||||
callback: function (data) {
|
||||
let age = "";
|
||||
if(data.message.dob){
|
||||
let age = '';
|
||||
if (data.message.dob) {
|
||||
age = calculate_age(data.message.dob);
|
||||
}else if (data.message.age){
|
||||
} else if (data.message.age) {
|
||||
age = data.message.age;
|
||||
if(data.message.age_as_on){
|
||||
age = age+" as on "+data.message.age_as_on;
|
||||
if (data.message.age_as_on) {
|
||||
age = __('{0} as on {1}', [age, data.message.age_as_on]);
|
||||
}
|
||||
}
|
||||
frm.set_value("patient_age", age);
|
||||
frm.set_value("patient_sex", data.message.sex);
|
||||
frm.set_value('patient_age', age);
|
||||
frm.set_value('patient_sex', data.message.sex);
|
||||
}
|
||||
});
|
||||
}else{
|
||||
frm.set_value("patient_age", "");
|
||||
frm.set_value("patient_sex", "");
|
||||
} else {
|
||||
frm.set_value('patient_age', '');
|
||||
frm.set_value('patient_sex', '');
|
||||
}
|
||||
},
|
||||
|
||||
appointment: function(frm) {
|
||||
if(frm.doc.appointment){
|
||||
if (frm.doc.appointment) {
|
||||
frappe.call({
|
||||
"method": "frappe.client.get",
|
||||
'method': 'frappe.client.get',
|
||||
args: {
|
||||
doctype: "Patient Appointment",
|
||||
doctype: 'Patient Appointment',
|
||||
name: frm.doc.appointment
|
||||
},
|
||||
callback: function (data) {
|
||||
frm.set_value("patient", data.message.patient);
|
||||
frm.set_value("procedure_template", data.message.procedure_template);
|
||||
frm.set_value("medical_department", data.message.department);
|
||||
frm.set_value("start_date", data.message.appointment_date);
|
||||
frm.set_value("start_time", data.message.appointment_time);
|
||||
frm.set_value("notes", data.message.notes);
|
||||
frm.set_value("service_unit", data.message.service_unit);
|
||||
callback: function(data) {
|
||||
frm.set_value('patient', data.message.patient);
|
||||
frm.set_value('procedure_template', data.message.procedure_template);
|
||||
frm.set_value('medical_department', data.message.department);
|
||||
frm.set_value('start_date', data.message.appointment_date);
|
||||
frm.set_value('start_time', data.message.appointment_time);
|
||||
frm.set_value('notes', data.message.notes);
|
||||
frm.set_value('service_unit', data.message.service_unit);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
procedure_template: function(frm) {
|
||||
if(frm.doc.procedure_template){
|
||||
if (frm.doc.procedure_template) {
|
||||
frappe.call({
|
||||
"method": "frappe.client.get",
|
||||
'method': 'frappe.client.get',
|
||||
args: {
|
||||
doctype: "Clinical Procedure Template",
|
||||
doctype: 'Clinical Procedure Template',
|
||||
name: frm.doc.procedure_template
|
||||
},
|
||||
callback: function (data) {
|
||||
frm.set_value("medical_department", data.message.medical_department);
|
||||
frm.set_value("consume_stock", data.message.consume_stock);
|
||||
if(!frm.doc.warehouse){
|
||||
frappe.call({
|
||||
method: "frappe.client.get_value",
|
||||
args: {
|
||||
doctype: "Stock Settings",
|
||||
fieldname: "default_warehouse"
|
||||
},
|
||||
callback: function (data) {
|
||||
frm.set_value("warehouse", data.message.default_warehouse);
|
||||
}
|
||||
});
|
||||
}
|
||||
frm.set_value('medical_department', data.message.medical_department);
|
||||
frm.set_value('consume_stock', data.message.consume_stock);
|
||||
frm.events.set_warehouse(frm);
|
||||
frm.events.set_procedure_consumables(frm);
|
||||
}
|
||||
});
|
||||
}else{
|
||||
frm.set_value("consume_stock", 0);
|
||||
}
|
||||
},
|
||||
|
||||
service_unit: function(frm) {
|
||||
if(frm.doc.service_unit){
|
||||
if (frm.doc.service_unit) {
|
||||
frappe.call({
|
||||
method: "frappe.client.get_value",
|
||||
method: 'frappe.client.get_value',
|
||||
args:{
|
||||
fieldname: "warehouse",
|
||||
doctype: "Healthcare Service Unit",
|
||||
fieldname: 'warehouse',
|
||||
doctype: 'Healthcare Service Unit',
|
||||
filters:{name: frm.doc.service_unit},
|
||||
},
|
||||
callback: function(data) {
|
||||
if(data.message){
|
||||
frm.set_value("warehouse", data.message.warehouse);
|
||||
if (data.message) {
|
||||
frm.set_value('warehouse', data.message.warehouse);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
practitioner: function(frm) {
|
||||
if(frm.doc.practitioner){
|
||||
if (frm.doc.practitioner) {
|
||||
frappe.call({
|
||||
"method": "frappe.client.get",
|
||||
'method': 'frappe.client.get',
|
||||
args: {
|
||||
doctype: "Healthcare Practitioner",
|
||||
doctype: 'Healthcare Practitioner',
|
||||
name: frm.doc.practitioner
|
||||
},
|
||||
callback: function (data) {
|
||||
frappe.model.set_value(frm.doctype,frm.docname, "medical_department",data.message.department);
|
||||
frappe.model.set_value(frm.doctype,frm.docname, 'medical_department',data.message.department);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
set_warehouse: function(frm) {
|
||||
if (!frm.doc.warehouse) {
|
||||
frappe.call({
|
||||
method: 'frappe.client.get_value',
|
||||
args: {
|
||||
doctype: 'Stock Settings',
|
||||
fieldname: 'default_warehouse'
|
||||
},
|
||||
callback: function (data) {
|
||||
frm.set_value('warehouse', data.message.default_warehouse);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
set_procedure_consumables: function(frm) {
|
||||
frappe.call({
|
||||
method: 'erpnext.healthcare.doctype.clinical_procedure.clinical_procedure.get_procedure_consumables',
|
||||
args: {
|
||||
procedure_template: frm.doc.procedure_template
|
||||
},
|
||||
callback: function(data) {
|
||||
if (data.message) {
|
||||
frm.doc.items = [];
|
||||
$.each(data.message, function(i, v) {
|
||||
let item = frm.add_child('items');
|
||||
item.item_code = v.item_code;
|
||||
item.item_name = v.item_name;
|
||||
item.uom = v.uom;
|
||||
item.stock_uom = v.stock_uom;
|
||||
item.qty = flt(v.qty);
|
||||
item.transfer_qty = v.transfer_qty;
|
||||
item.conversion_factor = v.conversion_factor;
|
||||
item.invoice_separately_as_consumables = v.invoice_separately_as_consumables;
|
||||
item.batch_no = v.batch_no;
|
||||
});
|
||||
refresh_field('items');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
cur_frm.set_query("procedure_template", function(doc) {
|
||||
cur_frm.set_query('procedure_template', function(doc) {
|
||||
return {
|
||||
filters: {
|
||||
'medical_department': doc.medical_department
|
||||
@@ -249,57 +290,51 @@ cur_frm.set_query("procedure_template", function(doc) {
|
||||
};
|
||||
});
|
||||
|
||||
cur_frm.set_query("appointment", function() {
|
||||
return {
|
||||
filters: {
|
||||
status:['in',["Open"]]
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
frappe.ui.form.on('Clinical Procedure Item', {
|
||||
qty: function(frm, cdt, cdn){
|
||||
var d = locals[cdt][cdn];
|
||||
frappe.model.set_value(cdt, cdn, "transfer_qty", d.qty*d.conversion_factor);
|
||||
qty: function(frm, cdt, cdn) {
|
||||
let d = locals[cdt][cdn];
|
||||
frappe.model.set_value(cdt, cdn, 'transfer_qty', d.qty*d.conversion_factor);
|
||||
},
|
||||
uom: function(doc, cdt, cdn){
|
||||
var d = locals[cdt][cdn];
|
||||
if(d.uom && d.item_code){
|
||||
|
||||
uom: function(doc, cdt, cdn) {
|
||||
let d = locals[cdt][cdn];
|
||||
if (d.uom && d.item_code) {
|
||||
return frappe.call({
|
||||
method: "erpnext.stock.doctype.stock_entry.stock_entry.get_uom_details",
|
||||
method: 'erpnext.stock.doctype.stock_entry.stock_entry.get_uom_details',
|
||||
args: {
|
||||
item_code: d.item_code,
|
||||
uom: d.uom,
|
||||
qty: d.qty
|
||||
},
|
||||
callback: function(r) {
|
||||
if(r.message) {
|
||||
if (r.message) {
|
||||
frappe.model.set_value(cdt, cdn, r.message);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
item_code: function(frm, cdt, cdn) {
|
||||
var d = locals[cdt][cdn];
|
||||
let d = locals[cdt][cdn];
|
||||
let args = null;
|
||||
if(d.item_code) {
|
||||
if (d.item_code) {
|
||||
args = {
|
||||
'doctype' : "Clinical Procedure",
|
||||
'doctype' : 'Clinical Procedure',
|
||||
'item_code' : d.item_code,
|
||||
'company' : frm.doc.company,
|
||||
'warehouse': frm.doc.warehouse
|
||||
};
|
||||
return frappe.call({
|
||||
method: "erpnext.stock.get_item_details.get_item_details",
|
||||
method: 'erpnext.healthcare.doctype.clinical_procedure_template.clinical_procedure_template.get_item_details',
|
||||
args: {args: args},
|
||||
callback: function(r) {
|
||||
if(r.message) {
|
||||
frappe.model.set_value(cdt, cdn, "item_name", r.message.item_name);
|
||||
frappe.model.set_value(cdt, cdn, "stock_uom", r.message.stock_uom);
|
||||
frappe.model.set_value(cdt, cdn, "conversion_factor", r.message.conversion_factor);
|
||||
frappe.model.set_value(cdt, cdn, "actual_qty", r.message.actual_qty);
|
||||
refresh_field("items");
|
||||
if (r.message) {
|
||||
let d = locals[cdt][cdn];
|
||||
$.each(r.message, function(k, v) {
|
||||
d[k] = v;
|
||||
});
|
||||
refresh_field('items');
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -307,16 +342,16 @@ frappe.ui.form.on('Clinical Procedure Item', {
|
||||
}
|
||||
});
|
||||
|
||||
var calculate_age = function(birth) {
|
||||
var ageMS = Date.parse(Date()) - Date.parse(birth);
|
||||
var age = new Date();
|
||||
let calculate_age = function(birth) {
|
||||
let ageMS = Date.parse(Date()) - Date.parse(birth);
|
||||
let age = new Date();
|
||||
age.setTime(ageMS);
|
||||
var years = age.getFullYear() - 1970;
|
||||
return years + " Year(s) " + age.getMonth() + " Month(s) " + age.getDate() + " Day(s)";
|
||||
let years = age.getFullYear() - 1970;
|
||||
return years + ' Year(s) ' + age.getMonth() + ' Month(s) ' + age.getDate() + ' Day(s)';
|
||||
};
|
||||
|
||||
// List Stock items
|
||||
cur_frm.set_query("item_code", "items", function() {
|
||||
cur_frm.set_query('item_code', 'items', function() {
|
||||
return {
|
||||
filters: {
|
||||
is_stock_item:1
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -6,88 +6,101 @@ from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe import _
|
||||
from frappe.model.document import Document
|
||||
from frappe.utils import cint, flt, nowdate, nowtime, cstr
|
||||
from frappe.utils import flt, nowdate, nowtime, cstr
|
||||
from erpnext.healthcare.doctype.healthcare_settings.healthcare_settings import get_account
|
||||
from erpnext.healthcare.doctype.lab_test.lab_test import create_sample_doc
|
||||
from erpnext.stock.stock_ledger import get_previous_sle
|
||||
from erpnext.stock.get_item_details import get_item_details
|
||||
from frappe.model.mapper import get_mapped_doc
|
||||
|
||||
class ClinicalProcedure(Document):
|
||||
def validate(self):
|
||||
if self.consume_stock and not self.status == 'Draft':
|
||||
if not self.warehouse:
|
||||
frappe.throw(_("Set warehouse for Procedure {0} ").format(self.name))
|
||||
self.set_status()
|
||||
if self.consume_stock:
|
||||
self.set_actual_qty()
|
||||
|
||||
if self.items:
|
||||
self.invoice_separately_as_consumables = False
|
||||
for item in self.items:
|
||||
if item.invoice_separately_as_consumables == 1:
|
||||
if item.invoice_separately_as_consumables:
|
||||
self.invoice_separately_as_consumables = True
|
||||
|
||||
def before_insert(self):
|
||||
if self.consume_stock:
|
||||
set_stock_items(self, self.procedure_template, "Clinical Procedure Template")
|
||||
self.set_actual_qty();
|
||||
self.set_actual_qty()
|
||||
|
||||
def after_insert(self):
|
||||
if self.prescription:
|
||||
frappe.db.set_value("Procedure Prescription", self.prescription, "procedure_created", 1)
|
||||
frappe.db.set_value('Procedure Prescription', self.prescription, 'procedure_created', 1)
|
||||
if self.appointment:
|
||||
frappe.db.set_value("Patient Appointment", self.appointment, "status", "Closed")
|
||||
template = frappe.get_doc("Clinical Procedure Template", self.procedure_template)
|
||||
frappe.db.set_value('Patient Appointment', self.appointment, 'status', 'Closed')
|
||||
template = frappe.get_doc('Clinical Procedure Template', self.procedure_template)
|
||||
if template.sample:
|
||||
patient = frappe.get_doc("Patient", self.patient)
|
||||
patient = frappe.get_doc('Patient', self.patient)
|
||||
sample_collection = create_sample_doc(template, patient, None)
|
||||
frappe.db.set_value("Clinical Procedure", self.name, "sample", sample_collection.name)
|
||||
frappe.db.set_value('Clinical Procedure', self.name, 'sample', sample_collection.name)
|
||||
self.reload()
|
||||
|
||||
def complete(self):
|
||||
def set_status(self):
|
||||
if self.docstatus == 0:
|
||||
self.status = 'Draft'
|
||||
elif self.docstatus == 1:
|
||||
if self.status not in ['In Progress', 'Completed']:
|
||||
self.status = 'Pending'
|
||||
elif self.docstatus == 2:
|
||||
self.status = 'Cancelled'
|
||||
|
||||
def complete_procedure(self):
|
||||
if self.consume_stock and self.items:
|
||||
create_stock_entry(self)
|
||||
frappe.db.set_value("Clinical Procedure", self.name, "status", 'Completed')
|
||||
stock_entry = make_stock_entry(self)
|
||||
|
||||
if self.items:
|
||||
consumable_total_amount = 0
|
||||
consumption_details = False
|
||||
for item in self.items:
|
||||
if item.invoice_separately_as_consumables:
|
||||
price_list, price_list_currency = frappe.db.get_values("Price List", {"selling": 1}, ['name', 'currency'])[0]
|
||||
args = {
|
||||
'doctype': "Sales Invoice",
|
||||
'item_code': item.item_code,
|
||||
'company': self.company,
|
||||
'warehouse': self.warehouse,
|
||||
'customer': frappe.db.get_value("Patient", self.patient, "customer"),
|
||||
'selling_price_list': price_list,
|
||||
'price_list_currency': price_list_currency,
|
||||
'plc_conversion_rate': 1.0,
|
||||
'conversion_rate': 1.0
|
||||
}
|
||||
item_details = get_item_details(args)
|
||||
item_price = item_details.price_list_rate * item.transfer_qty
|
||||
item_consumption_details = item_details.item_name+"\t"+str(item.qty)+" "+item.uom+"\t"+str(item_price)
|
||||
consumable_total_amount += item_price
|
||||
if not consumption_details:
|
||||
consumption_details = "Clinical Procedure ("+self.name+"):\n\t"+item_consumption_details
|
||||
else:
|
||||
consumption_details += "\n\t"+item_consumption_details
|
||||
if consumable_total_amount > 0:
|
||||
frappe.db.set_value("Clinical Procedure", self.name, "consumable_total_amount", consumable_total_amount)
|
||||
frappe.db.set_value("Clinical Procedure", self.name, "consumption_details", consumption_details)
|
||||
customer = frappe.db.get_value('Patient', self.patient, 'customer')
|
||||
if customer:
|
||||
for item in self.items:
|
||||
if item.invoice_separately_as_consumables:
|
||||
price_list, price_list_currency = frappe.db.get_values('Price List', {'selling': 1}, ['name', 'currency'])[0]
|
||||
args = {
|
||||
'doctype': 'Sales Invoice',
|
||||
'item_code': item.item_code,
|
||||
'company': self.company,
|
||||
'warehouse': self.warehouse,
|
||||
'customer': customer,
|
||||
'selling_price_list': price_list,
|
||||
'price_list_currency': price_list_currency,
|
||||
'plc_conversion_rate': 1.0,
|
||||
'conversion_rate': 1.0
|
||||
}
|
||||
item_details = get_item_details(args)
|
||||
item_price = item_details.price_list_rate * item.qty
|
||||
item_consumption_details = item_details.item_name + ' ' + str(item.qty) + ' ' + item.uom + ' ' + str(item_price)
|
||||
consumable_total_amount += item_price
|
||||
if not consumption_details:
|
||||
consumption_details = _('Clinical Procedure ({0}):').format(self.name)
|
||||
consumption_details += '\n\t' + item_consumption_details
|
||||
|
||||
if consumable_total_amount > 0:
|
||||
frappe.db.set_value('Clinical Procedure', self.name, 'consumable_total_amount', consumable_total_amount)
|
||||
frappe.db.set_value('Clinical Procedure', self.name, 'consumption_details', consumption_details)
|
||||
else:
|
||||
frappe.throw(_('Please set Customer in Patient {0}').format(frappe.bold(self.patient)), title=_('Customer Not Found'))
|
||||
|
||||
def start(self):
|
||||
frappe.db.set_value('Clinical Procedure', self.name, 'status', 'Completed')
|
||||
if self.consume_stock and self.items:
|
||||
return stock_entry
|
||||
|
||||
def start_procedure(self):
|
||||
allow_start = self.set_actual_qty()
|
||||
if allow_start:
|
||||
self.status = 'In Progress'
|
||||
self.db_set('status', 'In Progress')
|
||||
insert_clinical_procedure_to_medical_record(self)
|
||||
else:
|
||||
self.status = 'Draft'
|
||||
self.save()
|
||||
return 'success'
|
||||
return 'insufficient stock'
|
||||
|
||||
def set_actual_qty(self):
|
||||
allow_negative_stock = cint(frappe.db.get_value("Stock Settings", None, "allow_negative_stock"))
|
||||
allow_negative_stock = frappe.db.get_single_value('Stock Settings', 'allow_negative_stock')
|
||||
|
||||
allow_start = True
|
||||
for d in self.get('items'):
|
||||
@@ -95,15 +108,16 @@ class ClinicalProcedure(Document):
|
||||
# validate qty
|
||||
if not allow_negative_stock and d.actual_qty < d.qty:
|
||||
allow_start = False
|
||||
break
|
||||
|
||||
return allow_start
|
||||
|
||||
def make_material_transfer(self):
|
||||
stock_entry = frappe.new_doc("Stock Entry")
|
||||
def make_material_receipt(self, submit=False):
|
||||
stock_entry = frappe.new_doc('Stock Entry')
|
||||
|
||||
stock_entry.purpose = "Material Transfer"
|
||||
stock_entry.stock_entry_type = 'Material Receipt'
|
||||
stock_entry.to_warehouse = self.warehouse
|
||||
expense_account = get_account(None, "expense_account", "Healthcare Settings", self.company)
|
||||
expense_account = get_account(None, 'expense_account', 'Healthcare Settings', self.company)
|
||||
for item in self.items:
|
||||
if item.qty > item.actual_qty:
|
||||
se_child = stock_entry.append('items')
|
||||
@@ -111,7 +125,7 @@ class ClinicalProcedure(Document):
|
||||
se_child.item_name = item.item_name
|
||||
se_child.uom = item.uom
|
||||
se_child.stock_uom = item.stock_uom
|
||||
se_child.qty = flt(item.qty-item.actual_qty)
|
||||
se_child.qty = flt(item.qty - item.actual_qty)
|
||||
se_child.t_warehouse = self.warehouse
|
||||
# in stock uom
|
||||
se_child.transfer_qty = flt(item.transfer_qty)
|
||||
@@ -119,104 +133,130 @@ class ClinicalProcedure(Document):
|
||||
cost_center = frappe.get_cached_value('Company', self.company, 'cost_center')
|
||||
se_child.cost_center = cost_center
|
||||
se_child.expense_account = expense_account
|
||||
if submit:
|
||||
stock_entry.submit()
|
||||
return stock_entry
|
||||
return stock_entry.as_dict()
|
||||
|
||||
@frappe.whitelist()
|
||||
|
||||
def get_stock_qty(item_code, warehouse):
|
||||
return get_previous_sle({
|
||||
"item_code": item_code,
|
||||
"warehouse": warehouse,
|
||||
"posting_date": nowdate(),
|
||||
"posting_time": nowtime()
|
||||
}).get("qty_after_transaction") or 0
|
||||
'item_code': item_code,
|
||||
'warehouse': warehouse,
|
||||
'posting_date': nowdate(),
|
||||
'posting_time': nowtime()
|
||||
}).get('qty_after_transaction') or 0
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_procedure_consumables(procedure_template):
|
||||
return get_items('Clinical Procedure Item', procedure_template, 'Clinical Procedure Template')
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def set_stock_items(doc, stock_detail_parent, parenttype):
|
||||
item_dict = get_item_dict("Clinical Procedure Item", stock_detail_parent, parenttype)
|
||||
items = get_items('Clinical Procedure Item', stock_detail_parent, parenttype)
|
||||
|
||||
for d in item_dict:
|
||||
for item in items:
|
||||
se_child = doc.append('items')
|
||||
se_child.item_code = d["item_code"]
|
||||
se_child.item_name = d["item_name"]
|
||||
se_child.uom = d["uom"]
|
||||
se_child.stock_uom = d["stock_uom"]
|
||||
se_child.qty = flt(d["qty"])
|
||||
se_child.item_code = item.item_code
|
||||
se_child.item_name = item.item_name
|
||||
se_child.uom = item.uom
|
||||
se_child.stock_uom = item.stock_uom
|
||||
se_child.qty = flt(item.qty)
|
||||
# in stock uom
|
||||
se_child.transfer_qty = flt(d["transfer_qty"])
|
||||
se_child.conversion_factor = flt(d["conversion_factor"])
|
||||
if d["batch_no"]:
|
||||
se_child.batch_no = d["batch_no"]
|
||||
if parenttype == "Clinical Procedure Template":
|
||||
se_child.invoice_separately_as_consumables = d["invoice_separately_as_consumables"]
|
||||
se_child.transfer_qty = flt(item.transfer_qty)
|
||||
se_child.conversion_factor = flt(item.conversion_factor)
|
||||
if item.batch_no:
|
||||
se_child.batch_no = item.batch_no
|
||||
if parenttype == 'Clinical Procedure Template':
|
||||
se_child.invoice_separately_as_consumables = item.invoice_separately_as_consumables
|
||||
|
||||
return doc
|
||||
|
||||
def get_item_dict(table, parent, parenttype):
|
||||
query = """select * from `tab{table}` where parent = '{parent}' and parenttype = '{parenttype}' """
|
||||
|
||||
return frappe.db.sql(query.format(table=table, parent=parent, parenttype=parenttype), as_dict=True)
|
||||
def get_items(table, parent, parenttype):
|
||||
items = frappe.db.get_all(table, filters={
|
||||
'parent': parent,
|
||||
'parenttype': parenttype
|
||||
}, fields=['*'])
|
||||
|
||||
def create_stock_entry(doc):
|
||||
stock_entry = frappe.new_doc("Stock Entry")
|
||||
stock_entry = set_stock_items(stock_entry, doc.name, "Clinical Procedure")
|
||||
stock_entry.purpose = "Material Issue"
|
||||
return items
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def make_stock_entry(doc):
|
||||
stock_entry = frappe.new_doc('Stock Entry')
|
||||
stock_entry = set_stock_items(stock_entry, doc.name, 'Clinical Procedure')
|
||||
stock_entry.stock_entry_type = 'Material Issue'
|
||||
stock_entry.from_warehouse = doc.warehouse
|
||||
stock_entry.company = doc.company
|
||||
expense_account = get_account(None, "expense_account", "Healthcare Settings", doc.company)
|
||||
expense_account = get_account(None, 'expense_account', 'Healthcare Settings', doc.company)
|
||||
|
||||
for item_line in stock_entry.items:
|
||||
cost_center = frappe.get_cached_value('Company', doc.company, 'cost_center')
|
||||
#item_line.s_warehouse = warehouse #deaful source warehouse set, stock entry to copy to lines
|
||||
item_line.cost_center = cost_center
|
||||
#if not expense_account:
|
||||
# expense_account = frappe.db.get_value("Item", item_line.item_code, "expense_account")
|
||||
item_line.expense_account = expense_account
|
||||
|
||||
stock_entry.insert(ignore_permissions = True)
|
||||
stock_entry.save(ignore_permissions=True)
|
||||
stock_entry.submit()
|
||||
return stock_entry.name
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def create_procedure(appointment):
|
||||
appointment = frappe.get_doc("Patient Appointment",appointment)
|
||||
procedure = frappe.new_doc("Clinical Procedure")
|
||||
procedure.appointment = appointment.name
|
||||
procedure.patient = appointment.patient
|
||||
procedure.patient_age = appointment.patient_age
|
||||
procedure.patient_sex = appointment.patient_sex
|
||||
procedure.procedure_template = appointment.procedure_template
|
||||
procedure.prescription = appointment.procedure_prescription
|
||||
procedure.practitioner = appointment.practitioner
|
||||
procedure.invoiced = appointment.invoiced
|
||||
procedure.medical_department = appointment.department
|
||||
procedure.start_date = appointment.appointment_date
|
||||
procedure.start_time = appointment.appointment_time
|
||||
procedure.notes = appointment.notes
|
||||
procedure.service_unit = appointment.service_unit
|
||||
procedure.company = appointment.company
|
||||
consume_stock = frappe.db.get_value("Clinical Procedure Template", appointment.procedure_template, "consume_stock")
|
||||
if consume_stock == 1:
|
||||
procedure.consume_stock = True
|
||||
warehouse = False
|
||||
if appointment.service_unit:
|
||||
warehouse = frappe.db.get_value("Healthcare Service Unit", appointment.service_unit, "warehouse")
|
||||
if not warehouse:
|
||||
warehouse = frappe.db.get_value("Stock Settings", None, "default_warehouse")
|
||||
if warehouse:
|
||||
procedure.warehouse = warehouse
|
||||
return procedure.as_dict()
|
||||
def make_procedure(source_name, target_doc=None):
|
||||
def set_missing_values(source, target):
|
||||
consume_stock = frappe.db.get_value('Clinical Procedure Template', source.procedure_template, 'consume_stock')
|
||||
if consume_stock:
|
||||
target.consume_stock = 1
|
||||
warehouse = None
|
||||
if source.service_unit:
|
||||
warehouse = frappe.db.get_value('Healthcare Service Unit', source.service_unit, 'warehouse')
|
||||
if not warehouse:
|
||||
warehouse = frappe.db.get_value('Stock Settings', None, 'default_warehouse')
|
||||
if warehouse:
|
||||
target.warehouse = warehouse
|
||||
|
||||
set_stock_items(target, source.procedure_template, 'Clinical Procedure Template')
|
||||
|
||||
doc = get_mapped_doc('Patient Appointment', source_name, {
|
||||
'Patient Appointment': {
|
||||
'doctype': 'Clinical Procedure',
|
||||
'field_map': [
|
||||
['appointment', 'name'],
|
||||
['patient', 'patient'],
|
||||
['patient_age', 'patient_age'],
|
||||
['patient_sex', 'patient_sex'],
|
||||
['procedure_template', 'procedure_template'],
|
||||
['prescription', 'procedure_prescription'],
|
||||
['practitioner', 'practitioner'],
|
||||
['medical_department', 'department'],
|
||||
['start_date', 'appointment_date'],
|
||||
['start_time', 'appointment_time'],
|
||||
['notes', 'notes'],
|
||||
['service_unit', 'service_unit'],
|
||||
['company', 'company'],
|
||||
['invoiced', 'invoiced']
|
||||
]
|
||||
}
|
||||
}, target_doc, set_missing_values)
|
||||
|
||||
return doc
|
||||
|
||||
|
||||
def insert_clinical_procedure_to_medical_record(doc):
|
||||
subject = cstr(doc.procedure_template)
|
||||
if doc.practitioner:
|
||||
subject += " "+doc.practitioner
|
||||
subject += ' ' + doc.practitioner
|
||||
if subject and doc.notes:
|
||||
subject += "<br/>"+doc.notes
|
||||
subject += '<br/>' + doc.notes
|
||||
|
||||
medical_record = frappe.new_doc("Patient Medical Record")
|
||||
medical_record = frappe.new_doc('Patient Medical Record')
|
||||
medical_record.patient = doc.patient
|
||||
medical_record.subject = subject
|
||||
medical_record.status = "Open"
|
||||
medical_record.status = 'Open'
|
||||
medical_record.communication_date = doc.start_date
|
||||
medical_record.reference_doctype = "Clinical Procedure"
|
||||
medical_record.reference_doctype = 'Clinical Procedure'
|
||||
medical_record.reference_name = doc.name
|
||||
medical_record.reference_owner = doc.owner
|
||||
medical_record.save(ignore_permissions=True)
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
frappe.listview_settings['Clinical Procedure'] = {
|
||||
get_indicator: function(doc) {
|
||||
var colors = {
|
||||
'Completed': 'green',
|
||||
'In Progress': 'orange',
|
||||
'Pending': 'orange',
|
||||
'Cancelled': 'grey'
|
||||
};
|
||||
return [__(doc.status), colors[doc.status], 'status,=,' + doc.status];
|
||||
}
|
||||
};
|
||||
@@ -4,6 +4,60 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import unittest
|
||||
import frappe
|
||||
from erpnext.healthcare.doctype.patient_appointment.test_patient_appointment import create_healthcare_docs, create_clinical_procedure_template
|
||||
|
||||
class TestClinicalProcedure(unittest.TestCase):
|
||||
pass
|
||||
def test_procedure_template_item(self):
|
||||
patient, medical_department, practitioner = create_healthcare_docs()
|
||||
procedure_template = create_clinical_procedure_template()
|
||||
self.assertTrue(frappe.db.exists('Item', procedure_template.item))
|
||||
|
||||
procedure_template.disabled = 1
|
||||
procedure_template.save()
|
||||
self.assertEquals(frappe.db.get_value('Item', procedure_template.item, 'disabled'), 1)
|
||||
|
||||
def test_consumables(self):
|
||||
patient, medical_department, practitioner = create_healthcare_docs()
|
||||
procedure_template = create_clinical_procedure_template()
|
||||
procedure_template.allow_stock_consumption = 1
|
||||
consumable = create_consumable()
|
||||
procedure_template.append('items', {
|
||||
'item_code': consumable.item_code,
|
||||
'qty': 1,
|
||||
'uom': consumable.stock_uom,
|
||||
'stock_uom': consumable.stock_uom
|
||||
})
|
||||
procedure_template.save()
|
||||
procedure = create_procedure(procedure_template, patient, practitioner)
|
||||
result = procedure.start_procedure()
|
||||
if result == 'insufficient stock':
|
||||
procedure.make_material_receipt(submit=True)
|
||||
result = procedure.start_procedure()
|
||||
self.assertEqual(procedure.status, 'In Progress')
|
||||
result = procedure.complete_procedure()
|
||||
# check consumption
|
||||
self.assertTrue(frappe.db.exists('Stock Entry', result))
|
||||
|
||||
|
||||
def create_consumable():
|
||||
if frappe.db.exists('Item', 'Syringe'):
|
||||
return frappe.get_doc('Item', 'Syringe')
|
||||
consumable = frappe.new_doc('Item')
|
||||
consumable.item_code = 'Syringe'
|
||||
consumable.item_group = '_Test Item Group'
|
||||
consumable.stock_uom = 'Nos'
|
||||
consumable.valuation_rate = 5.00
|
||||
consumable.save()
|
||||
return consumable
|
||||
|
||||
def create_procedure(procedure_template, patient, practitioner):
|
||||
procedure = frappe.new_doc('Clinical Procedure')
|
||||
procedure.procedure_template = procedure_template.name
|
||||
procedure.patient = patient
|
||||
procedure.practitioner = practitioner
|
||||
procedure.consume_stock = procedure_template.allow_stock_consumption
|
||||
procedure.items = procedure_template.items
|
||||
procedure.warehouse = frappe.db.get_single_value('Stock Settings', 'default_warehouse')
|
||||
procedure.submit()
|
||||
return procedure
|
||||
@@ -1,431 +1,123 @@
|
||||
{
|
||||
"allow_copy": 0,
|
||||
"allow_events_in_timeline": 0,
|
||||
"allow_guest_to_view": 0,
|
||||
"allow_import": 0,
|
||||
"allow_rename": 0,
|
||||
"beta": 1,
|
||||
"creation": "2017-10-05 16:15:10.876952",
|
||||
"custom": 0,
|
||||
"docstatus": 0,
|
||||
"doctype": "DocType",
|
||||
"document_type": "",
|
||||
"editable_grid": 1,
|
||||
"engine": "InnoDB",
|
||||
"actions": [],
|
||||
"beta": 1,
|
||||
"creation": "2017-10-05 16:15:10.876952",
|
||||
"doctype": "DocType",
|
||||
"editable_grid": 1,
|
||||
"engine": "InnoDB",
|
||||
"field_order": [
|
||||
"item_code",
|
||||
"item_name",
|
||||
"qty",
|
||||
"barcode",
|
||||
"uom",
|
||||
"invoice_separately_as_consumables",
|
||||
"column_break_5",
|
||||
"batch_no",
|
||||
"conversion_factor",
|
||||
"stock_uom",
|
||||
"transfer_qty",
|
||||
"actual_qty"
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 1,
|
||||
"collapsible": 0,
|
||||
"columns": 3,
|
||||
"fieldname": "item_code",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 1,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 1,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Item",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Item",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 1,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"bold": 1,
|
||||
"columns": 3,
|
||||
"fieldname": "item_code",
|
||||
"fieldtype": "Link",
|
||||
"ignore_user_permissions": 1,
|
||||
"in_global_search": 1,
|
||||
"in_list_view": 1,
|
||||
"label": "Item",
|
||||
"options": "Item",
|
||||
"reqd": 1,
|
||||
"search_index": 1
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "barcode",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Barcode",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"fieldname": "barcode",
|
||||
"fieldtype": "Data",
|
||||
"label": "Barcode"
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "item_name",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Item Name",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"fieldname": "item_name",
|
||||
"fieldtype": "Data",
|
||||
"in_list_view": 1,
|
||||
"label": "Item Name",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "qty",
|
||||
"fieldtype": "Float",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Quantity",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"fieldname": "qty",
|
||||
"fieldtype": "Float",
|
||||
"in_list_view": 1,
|
||||
"label": "Quantity",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "uom",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "UOM",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "UOM",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"fieldname": "uom",
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 1,
|
||||
"label": "UOM",
|
||||
"options": "UOM",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "invoice_separately_as_consumables",
|
||||
"fieldtype": "Check",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Invoice Separately as Consumables",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"default": "0",
|
||||
"fieldname": "invoice_separately_as_consumables",
|
||||
"fieldtype": "Check",
|
||||
"in_list_view": 1,
|
||||
"label": "Invoice Separately as Consumables"
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "column_break_5",
|
||||
"fieldtype": "Column Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"fieldname": "column_break_5",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "batch_no",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Batch",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Batch",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"fieldname": "batch_no",
|
||||
"fieldtype": "Link",
|
||||
"label": "Batch",
|
||||
"options": "Batch"
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "conversion_factor",
|
||||
"fieldtype": "Float",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Conversion Factor",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"fieldname": "conversion_factor",
|
||||
"fieldtype": "Float",
|
||||
"label": "Conversion Factor",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "stock_uom",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Stock UOM",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "UOM",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"fieldname": "stock_uom",
|
||||
"fieldtype": "Link",
|
||||
"label": "Stock UOM",
|
||||
"options": "UOM",
|
||||
"read_only": 1,
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "transfer_qty",
|
||||
"fieldtype": "Float",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Transfer Qty",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"fieldname": "transfer_qty",
|
||||
"fieldtype": "Float",
|
||||
"label": "Transfer Qty",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "actual_qty",
|
||||
"fieldtype": "Float",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Actual Qty (at source/target)",
|
||||
"length": 0,
|
||||
"no_copy": 1,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 1,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
"fieldname": "actual_qty",
|
||||
"fieldtype": "Float",
|
||||
"label": "Actual Qty (at source/target)",
|
||||
"no_copy": 1,
|
||||
"print_hide": 1,
|
||||
"read_only": 1,
|
||||
"search_index": 1
|
||||
}
|
||||
],
|
||||
"has_web_view": 0,
|
||||
"hide_heading": 0,
|
||||
"hide_toolbar": 0,
|
||||
"idx": 0,
|
||||
"image_view": 0,
|
||||
"in_create": 0,
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 1,
|
||||
"max_attachments": 0,
|
||||
"modified": "2018-11-04 03:33:16.833884",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Healthcare",
|
||||
"name": "Clinical Procedure Item",
|
||||
"name_case": "",
|
||||
"owner": "Administrator",
|
||||
"permissions": [],
|
||||
"quick_entry": 1,
|
||||
"read_only": 0,
|
||||
"read_only_onload": 0,
|
||||
"restrict_to_domain": "Healthcare",
|
||||
"show_name_in_global_search": 0,
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"track_changes": 1,
|
||||
"track_seen": 0,
|
||||
"track_views": 0
|
||||
],
|
||||
"istable": 1,
|
||||
"links": [],
|
||||
"modified": "2020-03-01 15:34:54.226722",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Healthcare",
|
||||
"name": "Clinical Procedure Item",
|
||||
"owner": "Administrator",
|
||||
"permissions": [],
|
||||
"quick_entry": 1,
|
||||
"restrict_to_domain": "Healthcare",
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"track_changes": 1
|
||||
}
|
||||
@@ -3,170 +3,141 @@
|
||||
|
||||
frappe.ui.form.on('Clinical Procedure Template', {
|
||||
template: function(frm) {
|
||||
if(!frm.doc.item_code)
|
||||
frm.set_value("item_code", frm.doc.template);
|
||||
if(!frm.doc.description)
|
||||
frm.set_value("description", frm.doc.template);
|
||||
if (!frm.doc.item_code)
|
||||
frm.set_value('item_code', frm.doc.template);
|
||||
if (!frm.doc.description)
|
||||
frm.set_value('description', frm.doc.template);
|
||||
mark_change_in_item(frm);
|
||||
},
|
||||
|
||||
rate: function(frm) {
|
||||
mark_change_in_item(frm);
|
||||
},
|
||||
|
||||
is_billable: function (frm) {
|
||||
mark_change_in_item(frm);
|
||||
},
|
||||
|
||||
item_group: function(frm) {
|
||||
mark_change_in_item(frm);
|
||||
},
|
||||
|
||||
description: function(frm) {
|
||||
mark_change_in_item(frm);
|
||||
},
|
||||
|
||||
medical_department: function(frm) {
|
||||
mark_change_in_item(frm);
|
||||
},
|
||||
|
||||
refresh: function(frm) {
|
||||
frm.fields_dict["items"].grid.set_column_disp("barcode", false);
|
||||
frm.fields_dict["items"].grid.set_column_disp("batch_no", false);
|
||||
cur_frm.set_df_property("item_code", "read_only", frm.doc.__islocal ? 0 : 1);
|
||||
if(!frm.doc.__islocal) {
|
||||
frm.fields_dict['items'].grid.set_column_disp('barcode', false);
|
||||
frm.fields_dict['items'].grid.set_column_disp('batch_no', false);
|
||||
|
||||
if (!frm.doc.__islocal) {
|
||||
cur_frm.add_custom_button(__('Change Item Code'), function() {
|
||||
change_template_code(frm.doc);
|
||||
} );
|
||||
if(frm.doc.disabled == 1){
|
||||
cur_frm.add_custom_button(__('Enable Template'), function() {
|
||||
enable_template(frm.doc);
|
||||
} );
|
||||
}
|
||||
else{
|
||||
cur_frm.add_custom_button(__('Disable Template'), function() {
|
||||
disable_template(frm.doc);
|
||||
} );
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var mark_change_in_item = function(frm) {
|
||||
if(!frm.doc.__islocal){
|
||||
let mark_change_in_item = function(frm) {
|
||||
if (!frm.doc.__islocal) {
|
||||
frm.doc.change_in_item = 1;
|
||||
}
|
||||
};
|
||||
|
||||
var disable_template = function(doc){
|
||||
frappe.call({
|
||||
method: "erpnext.healthcare.doctype.clinical_procedure_template.clinical_procedure_template.disable_enable_template",
|
||||
args: {status: 1, name: doc.name, item_code: doc.item_code, is_billable: doc.is_billable},
|
||||
callback: function(){
|
||||
cur_frm.reload_doc();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
var enable_template = function(doc){
|
||||
frappe.call({
|
||||
method: "erpnext.healthcare.doctype.clinical_procedure_template.clinical_procedure_template.disable_enable_template",
|
||||
args: {status: 0, name: doc.name, item_code: doc.item_code, is_billable: doc.is_billable},
|
||||
callback: function(){
|
||||
cur_frm.reload_doc();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
var change_template_code = function(doc){
|
||||
var d = new frappe.ui.Dialog({
|
||||
title:__("Change Template Code"),
|
||||
let change_template_code = function(doc) {
|
||||
let d = new frappe.ui.Dialog({
|
||||
title:__('Change Item Code'),
|
||||
fields:[
|
||||
{
|
||||
"fieldtype": "Data",
|
||||
"label": "Template Code",
|
||||
"fieldname": "Item Code",
|
||||
reqd:1
|
||||
},
|
||||
{
|
||||
"fieldtype": "Button",
|
||||
"label": __("Change Code"),
|
||||
click: function() {
|
||||
var values = d.get_values();
|
||||
if(!values)
|
||||
return;
|
||||
change_item_code_from_template(values["Item Code"], doc);
|
||||
d.hide();
|
||||
}
|
||||
'fieldtype': 'Data',
|
||||
'label': 'Item Code',
|
||||
'fieldname': 'item_code',
|
||||
reqd: 1
|
||||
}
|
||||
]
|
||||
],
|
||||
primary_action: function() {
|
||||
let values = d.get_values();
|
||||
|
||||
if (values) {
|
||||
frappe.call({
|
||||
'method': 'erpnext.healthcare.doctype.clinical_procedure_template.clinical_procedure_template.change_item_code_from_template',
|
||||
'args': {item_code: values.item_code, doc: doc},
|
||||
callback: function () {
|
||||
cur_frm.reload_doc();
|
||||
frappe.show_alert({
|
||||
message: 'Item Code renamed successfully',
|
||||
indicator: 'green'
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
d.hide();
|
||||
},
|
||||
primary_action_label: __('Change Item Code')
|
||||
});
|
||||
d.show();
|
||||
d.set_values({
|
||||
'Item Code': doc.item_code
|
||||
});
|
||||
};
|
||||
|
||||
var change_item_code_from_template = function(item_code, doc){
|
||||
frappe.call({
|
||||
"method": "erpnext.healthcare.doctype.clinical_procedure_template.clinical_procedure_template.change_item_code_from_template",
|
||||
"args": {item_code: item_code, doc: doc},
|
||||
callback: function () {
|
||||
cur_frm.reload_doc();
|
||||
frappe.show_alert({
|
||||
message: "Item Code renamed successfully",
|
||||
indicator: "green"
|
||||
});
|
||||
}
|
||||
d.set_values({
|
||||
'item_code': doc.item_code
|
||||
});
|
||||
};
|
||||
|
||||
frappe.ui.form.on('Clinical Procedure Item', {
|
||||
qty: function(frm, cdt, cdn){
|
||||
var d = locals[cdt][cdn];
|
||||
frappe.model.set_value(cdt, cdn, "transfer_qty", d.qty*d.conversion_factor);
|
||||
qty: function(frm, cdt, cdn) {
|
||||
let d = locals[cdt][cdn];
|
||||
frappe.model.set_value(cdt, cdn, 'transfer_qty', d.qty * d.conversion_factor);
|
||||
},
|
||||
|
||||
uom: function(doc, cdt, cdn){
|
||||
var d = locals[cdt][cdn];
|
||||
if(d.uom && d.item_code){
|
||||
let d = locals[cdt][cdn];
|
||||
if (d.uom && d.item_code) {
|
||||
return frappe.call({
|
||||
method: "erpnext.stock.doctype.stock_entry.stock_entry.get_uom_details",
|
||||
method: 'erpnext.stock.doctype.stock_entry.stock_entry.get_uom_details',
|
||||
args: {
|
||||
item_code: d.item_code,
|
||||
uom: d.uom,
|
||||
qty: d.qty
|
||||
},
|
||||
callback: function(r) {
|
||||
if(r.message) {
|
||||
if (r.message) {
|
||||
frappe.model.set_value(cdt, cdn, r.message);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
item_code: function(frm, cdt, cdn) {
|
||||
var d = locals[cdt][cdn];
|
||||
if(d.item_code) {
|
||||
let d = locals[cdt][cdn];
|
||||
if (d.item_code) {
|
||||
let args = {
|
||||
'item_code' : d.item_code,
|
||||
'transfer_qty' : d.transfer_qty,
|
||||
'company' : frm.doc.company,
|
||||
'quantity' : d.qty
|
||||
'quantity' : d.qty
|
||||
};
|
||||
return frappe.call({
|
||||
doc: frm.doc,
|
||||
method: "get_item_details",
|
||||
args: args,
|
||||
method: 'erpnext.healthcare.doctype.clinical_procedure_template.clinical_procedure_template.get_item_details',
|
||||
args: {args: args},
|
||||
callback: function(r) {
|
||||
if(r.message) {
|
||||
var d = locals[cdt][cdn];
|
||||
$.each(r.message, function(k, v){
|
||||
if (r.message) {
|
||||
let d = locals[cdt][cdn];
|
||||
$.each(r.message, function(k, v) {
|
||||
d[k] = v;
|
||||
});
|
||||
refresh_field("items");
|
||||
refresh_field('items');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// List Stock items
|
||||
cur_frm.set_query("item_code", "items", function() {
|
||||
cur_frm.set_query('item_code', 'items', function() {
|
||||
return {
|
||||
filters: {
|
||||
is_stock_item:1
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -7,126 +7,114 @@ import frappe, json
|
||||
from frappe import _
|
||||
from frappe.model.document import Document
|
||||
from frappe.model.rename_doc import rename_doc
|
||||
from frappe.utils import nowdate
|
||||
|
||||
class ClinicalProcedureTemplate(Document):
|
||||
def on_update(self):
|
||||
#Item and Price List update --> if (change_in_item)
|
||||
if(self.change_in_item and self.is_billable == 1 and self.item):
|
||||
updating_item(self)
|
||||
if(self.rate != 0.0):
|
||||
updating_rate(self)
|
||||
elif(self.is_billable == 0 and self.item):
|
||||
frappe.db.set_value("Item",self.item,"disabled",1)
|
||||
|
||||
frappe.db.set_value(self.doctype,self.name,"change_in_item",0)
|
||||
self.reload()
|
||||
def validate(self):
|
||||
self.enable_disable_item()
|
||||
|
||||
def after_insert(self):
|
||||
create_item_from_template(self)
|
||||
|
||||
#Call before delete the template
|
||||
def on_trash(self):
|
||||
if(self.item):
|
||||
try:
|
||||
frappe.delete_doc("Item",self.item)
|
||||
except Exception:
|
||||
frappe.throw(_("""Not permitted. Please disable the Procedure Template"""))
|
||||
def on_update(self):
|
||||
if self.change_in_item:
|
||||
self.update_item_and_item_price()
|
||||
|
||||
def get_item_details(self, args=None):
|
||||
item = frappe.db.sql("""select stock_uom, item_name
|
||||
from `tabItem`
|
||||
where name = %s
|
||||
and disabled=0
|
||||
and (end_of_life is null or end_of_life='0000-00-00' or end_of_life > %s)""",
|
||||
(args.get('item_code'), nowdate()), as_dict = 1)
|
||||
if not item:
|
||||
frappe.throw(_("Item {0} is not active or end of life has been reached").format(args.get('item_code')))
|
||||
def enable_disable_item(self):
|
||||
if self.is_billable:
|
||||
if self.disabled:
|
||||
frappe.db.set_value('Item', self.item, 'disabled', 1)
|
||||
else:
|
||||
frappe.db.set_value('Item', self.item, 'disabled', 0)
|
||||
|
||||
item = item[0]
|
||||
def update_item_and_item_price(self):
|
||||
if self.is_billable and self.item:
|
||||
item_doc = frappe.get_doc('Item', {'item_code': self.item})
|
||||
item_doc.item_name = self.template
|
||||
item_doc.item_group = self.item_group
|
||||
item_doc.description = self.description
|
||||
item_doc.disabled = 0
|
||||
item_doc.save(ignore_permissions=True)
|
||||
|
||||
ret = {
|
||||
'uom' : item.stock_uom,
|
||||
'stock_uom' : item.stock_uom,
|
||||
'item_name' : item.item_name,
|
||||
'quantity' : 0,
|
||||
'transfer_qty' : 0,
|
||||
'conversion_factor' : 1
|
||||
}
|
||||
return ret
|
||||
if self.rate:
|
||||
item_price = frappe.get_doc('Item Price', {'item_code': self.item})
|
||||
item_price.item_name = self.template
|
||||
item_price.price_list_rate = self.rate
|
||||
item_price.save()
|
||||
|
||||
def updating_item(self):
|
||||
frappe.db.sql("""update `tabItem` set item_name=%s, item_group=%s, disabled=0,
|
||||
description=%s, modified=NOW() where item_code=%s""",
|
||||
(self.template, self.item_group , self.description, self.item))
|
||||
def updating_rate(self):
|
||||
frappe.db.sql("""update `tabItem Price` set item_name=%s, price_list_rate=%s, modified=NOW() where
|
||||
item_code=%s""",(self.template, self.rate, self.item))
|
||||
elif not self.is_billable and self.item:
|
||||
frappe.db.set_value('Item', self.item, 'disabled', 1)
|
||||
|
||||
self.db_set('change_in_item', 0)
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_item_details(args=None):
|
||||
if not isinstance(args, dict):
|
||||
args = json.loads(args)
|
||||
|
||||
item = frappe.db.get_all('Item',
|
||||
filters={
|
||||
'disabled': 0,
|
||||
'name': args.get('item_code')
|
||||
},
|
||||
fields=['stock_uom', 'item_name']
|
||||
)
|
||||
|
||||
if not item:
|
||||
frappe.throw(_('Item {0} is not active').format(args.get('item_code')))
|
||||
|
||||
item = item[0]
|
||||
ret = {
|
||||
'uom': item.stock_uom,
|
||||
'stock_uom': item.stock_uom,
|
||||
'item_name': item.item_name,
|
||||
'qty': 1,
|
||||
'transfer_qty': 0,
|
||||
'conversion_factor': 1
|
||||
}
|
||||
return ret
|
||||
|
||||
def create_item_from_template(doc):
|
||||
disabled = 1
|
||||
|
||||
if(doc.is_billable == 1):
|
||||
disabled = doc.disabled
|
||||
if doc.is_billable and not doc.disabled:
|
||||
disabled = 0
|
||||
|
||||
#insert item
|
||||
item = frappe.get_doc({
|
||||
"doctype": "Item",
|
||||
"item_code": doc.template,
|
||||
"item_name":doc.template,
|
||||
"item_group": doc.item_group,
|
||||
"description":doc.description,
|
||||
"is_sales_item": 1,
|
||||
"is_service_item": 1,
|
||||
"is_purchase_item": 0,
|
||||
"is_stock_item": 0,
|
||||
"show_in_website": 0,
|
||||
"is_pro_applicable": 0,
|
||||
"disabled": disabled,
|
||||
"stock_uom": "Unit"
|
||||
}).insert(ignore_permissions=True)
|
||||
item = frappe.get_doc({
|
||||
'doctype': 'Item',
|
||||
'item_code': doc.template,
|
||||
'item_name':doc.template,
|
||||
'item_group': doc.item_group,
|
||||
'description':doc.description,
|
||||
'is_sales_item': 1,
|
||||
'is_service_item': 1,
|
||||
'is_purchase_item': 0,
|
||||
'is_stock_item': 0,
|
||||
'show_in_website': 0,
|
||||
'is_pro_applicable': 0,
|
||||
'disabled': disabled,
|
||||
'stock_uom': 'Unit'
|
||||
}).insert(ignore_permissions=True, ignore_mandatory=True)
|
||||
|
||||
#insert item price
|
||||
#get item price list to insert item price
|
||||
if(doc.rate != 0.0):
|
||||
price_list_name = frappe.db.get_value("Price List", {"selling": 1})
|
||||
if(doc.rate):
|
||||
make_item_price(item.name, price_list_name, doc.rate)
|
||||
else:
|
||||
make_item_price(item.name, price_list_name, 0.0)
|
||||
#Set item to the template
|
||||
frappe.db.set_value("Clinical Procedure Template", doc.name, "item", item.name)
|
||||
make_item_price(item.name, doc.rate)
|
||||
doc.db_set('item', item.name)
|
||||
|
||||
doc.reload() #refresh the doc after insert.
|
||||
|
||||
def make_item_price(item, price_list_name, item_price):
|
||||
def make_item_price(item, item_price):
|
||||
price_list_name = frappe.db.get_value('Price List', {'selling': 1})
|
||||
frappe.get_doc({
|
||||
"doctype": "Item Price",
|
||||
"price_list": price_list_name,
|
||||
"item_code": item,
|
||||
"price_list_rate": item_price
|
||||
}).insert(ignore_permissions=True)
|
||||
'doctype': 'Item Price',
|
||||
'price_list': price_list_name,
|
||||
'item_code': item,
|
||||
'price_list_rate': item_price
|
||||
}).insert(ignore_permissions=True, ignore_mandatory=True)
|
||||
|
||||
@frappe.whitelist()
|
||||
def change_item_code_from_template(item_code, doc):
|
||||
args = json.loads(doc)
|
||||
doc = frappe._dict(args)
|
||||
doc = frappe._dict(json.loads(doc))
|
||||
|
||||
if(frappe.db.exists({
|
||||
"doctype": "Item",
|
||||
"item_code": item_code})):
|
||||
frappe.throw(_("Code {0} already exist").format(item_code))
|
||||
if frappe.db.exists('Item', {'item_code': item_code}):
|
||||
frappe.throw(_('Item with Item Code {0} already exists').format(item_code))
|
||||
else:
|
||||
rename_doc("Item", doc.item_code, item_code, ignore_permissions=True)
|
||||
frappe.db.set_value("Clinical Procedure Template", doc.name, "item_code", item_code)
|
||||
rename_doc('Item', doc.item_code, item_code, ignore_permissions=True)
|
||||
frappe.db.set_value('Clinical Procedure Template', doc.name, 'item_code', item_code)
|
||||
return
|
||||
|
||||
@frappe.whitelist()
|
||||
def disable_enable_template(status, name, item_code):
|
||||
frappe.db.set_value("Clinical Procedure Template", name, "disabled", status)
|
||||
if (frappe.db.exists({ #set Item's disabled field to status
|
||||
"doctype": "Item",
|
||||
"item_code": item_code})):
|
||||
frappe.db.set_value("Item", item_code, "disabled", status)
|
||||
|
||||
return
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
from __future__ import unicode_literals
|
||||
from frappe import _
|
||||
|
||||
def get_data():
|
||||
return {
|
||||
'fieldname': 'procedure_template',
|
||||
'transactions': [
|
||||
{
|
||||
'label': _('Consultations'),
|
||||
'items': ['Clinical Procedure']
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,140 +1,56 @@
|
||||
{
|
||||
"allow_copy": 1,
|
||||
"allow_guest_to_view": 0,
|
||||
"allow_import": 0,
|
||||
"allow_rename": 0,
|
||||
"beta": 1,
|
||||
"creation": "2017-06-22 13:09:23.159579",
|
||||
"custom": 0,
|
||||
"docstatus": 0,
|
||||
"doctype": "DocType",
|
||||
"document_type": "",
|
||||
"editable_grid": 1,
|
||||
"engine": "InnoDB",
|
||||
"actions": [],
|
||||
"allow_copy": 1,
|
||||
"beta": 1,
|
||||
"creation": "2017-06-22 13:09:23.159579",
|
||||
"doctype": "DocType",
|
||||
"editable_grid": 1,
|
||||
"engine": "InnoDB",
|
||||
"field_order": [
|
||||
"medical_code",
|
||||
"code",
|
||||
"description"
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "medical_code",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 1,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Medical Code",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Medical Code",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"fieldname": "medical_code",
|
||||
"fieldtype": "Link",
|
||||
"ignore_user_permissions": 1,
|
||||
"in_list_view": 1,
|
||||
"label": "Medical Code",
|
||||
"options": "Medical Code",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fetch_from": "medical_code.code",
|
||||
"fieldname": "code",
|
||||
"fieldtype": "Read Only",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 1,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Code",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"fieldname": "code",
|
||||
"fieldtype": "Data",
|
||||
"ignore_xss_filter": 1,
|
||||
"in_list_view": 1,
|
||||
"label": "Code",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fetch_from": "medical_code.description",
|
||||
"fieldname": "description",
|
||||
"fieldtype": "Read Only",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 1,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Description",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
"fieldname": "description",
|
||||
"fieldtype": "Small Text",
|
||||
"ignore_xss_filter": 1,
|
||||
"in_list_view": 1,
|
||||
"label": "Description",
|
||||
"read_only": 1
|
||||
}
|
||||
],
|
||||
"has_web_view": 0,
|
||||
"hide_heading": 0,
|
||||
"hide_toolbar": 0,
|
||||
"idx": 0,
|
||||
"image_view": 0,
|
||||
"in_create": 0,
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 1,
|
||||
"max_attachments": 0,
|
||||
"modified": "2018-05-16 22:43:27.047479",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Healthcare",
|
||||
"name": "Codification Table",
|
||||
"name_case": "",
|
||||
"owner": "Administrator",
|
||||
"permissions": [],
|
||||
"quick_entry": 1,
|
||||
"read_only": 0,
|
||||
"read_only_onload": 0,
|
||||
"restrict_to_domain": "Healthcare",
|
||||
"show_name_in_global_search": 0,
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"track_changes": 1,
|
||||
"track_seen": 0
|
||||
],
|
||||
"istable": 1,
|
||||
"links": [],
|
||||
"modified": "2020-02-26 13:17:49.016293",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Healthcare",
|
||||
"name": "Codification Table",
|
||||
"owner": "Administrator",
|
||||
"permissions": [],
|
||||
"quick_entry": 1,
|
||||
"restrict_to_domain": "Healthcare",
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"track_changes": 1
|
||||
}
|
||||
@@ -1,381 +1,116 @@
|
||||
{
|
||||
"allow_copy": 1,
|
||||
"allow_guest_to_view": 0,
|
||||
"allow_import": 0,
|
||||
"allow_rename": 0,
|
||||
"beta": 1,
|
||||
"creation": "2016-09-16 16:41:45.533374",
|
||||
"custom": 0,
|
||||
"docstatus": 0,
|
||||
"doctype": "DocType",
|
||||
"document_type": "Document",
|
||||
"editable_grid": 1,
|
||||
"engine": "InnoDB",
|
||||
"actions": [],
|
||||
"allow_copy": 1,
|
||||
"beta": 1,
|
||||
"creation": "2016-09-16 16:41:45.533374",
|
||||
"doctype": "DocType",
|
||||
"document_type": "Document",
|
||||
"editable_grid": 1,
|
||||
"engine": "InnoDB",
|
||||
"field_order": [
|
||||
"drug_code",
|
||||
"drug_name",
|
||||
"dosage",
|
||||
"period",
|
||||
"dosage_form",
|
||||
"column_break_7",
|
||||
"comment",
|
||||
"usage_interval",
|
||||
"interval",
|
||||
"interval_uom",
|
||||
"update_schedule"
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "drug_code",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 1,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Drug Code",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Item",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"fieldname": "drug_code",
|
||||
"fieldtype": "Link",
|
||||
"ignore_user_permissions": 1,
|
||||
"in_list_view": 1,
|
||||
"label": "Drug",
|
||||
"options": "Item",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "drug_name",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Description/Strength",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"fetch_from": "drug_code.item_name",
|
||||
"fieldname": "drug_name",
|
||||
"fieldtype": "Data",
|
||||
"in_list_view": 1,
|
||||
"label": "Drug Name / Description"
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "dosage",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 1,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Dosage",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Prescription Dosage",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"fieldname": "dosage",
|
||||
"fieldtype": "Link",
|
||||
"ignore_user_permissions": 1,
|
||||
"in_list_view": 1,
|
||||
"label": "Dosage",
|
||||
"options": "Prescription Dosage"
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "period",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 1,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Period",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Prescription Duration",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"fieldname": "period",
|
||||
"fieldtype": "Link",
|
||||
"ignore_user_permissions": 1,
|
||||
"in_list_view": 1,
|
||||
"label": "Period",
|
||||
"options": "Prescription Duration"
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "dosage_form",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 1,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Dosage Form",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Dosage Form",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"fieldname": "dosage_form",
|
||||
"fieldtype": "Link",
|
||||
"ignore_user_permissions": 1,
|
||||
"label": "Dosage Form",
|
||||
"options": "Dosage Form"
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "column_break_7",
|
||||
"fieldtype": "Column Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"fieldname": "column_break_7",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "comment",
|
||||
"fieldtype": "Small Text",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 1,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Comment",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"fieldname": "comment",
|
||||
"fieldtype": "Small Text",
|
||||
"ignore_xss_filter": 1,
|
||||
"in_list_view": 1,
|
||||
"label": "Comment"
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"default": "0",
|
||||
"fieldname": "use_interval",
|
||||
"fieldtype": "Check",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Dosage by time interval",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"depends_on": "use_interval",
|
||||
"fieldname": "interval",
|
||||
"fieldtype": "Int",
|
||||
"in_list_view": 1,
|
||||
"label": "Interval"
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"depends_on": "use_interval",
|
||||
"fieldname": "interval",
|
||||
"fieldtype": "Int",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Interval",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"default": "1",
|
||||
"fieldname": "update_schedule",
|
||||
"fieldtype": "Check",
|
||||
"hidden": 1,
|
||||
"label": "Update Schedule",
|
||||
"print_hide": 1,
|
||||
"report_hide": 1
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"depends_on": "use_interval",
|
||||
"fieldname": "in_every",
|
||||
"fieldtype": "Select",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Interval UOM",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "\nHour\nDay",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"depends_on": "use_interval",
|
||||
"fieldname": "interval_uom",
|
||||
"fieldtype": "Select",
|
||||
"in_list_view": 1,
|
||||
"label": "Interval UOM",
|
||||
"options": "\nHour\nDay"
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"default": "1",
|
||||
"fieldname": "update_schedule",
|
||||
"fieldtype": "Check",
|
||||
"hidden": 1,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Update Schedule",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 1,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
"default": "0",
|
||||
"fieldname": "usage_interval",
|
||||
"fieldtype": "Check",
|
||||
"label": "Dosage by Time Interval"
|
||||
}
|
||||
],
|
||||
"has_web_view": 0,
|
||||
"hide_heading": 0,
|
||||
"hide_toolbar": 0,
|
||||
"idx": 0,
|
||||
"image_view": 0,
|
||||
"in_create": 0,
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 1,
|
||||
"max_attachments": 0,
|
||||
"modified": "2017-10-04 17:09:54.998517",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Healthcare",
|
||||
"name": "Drug Prescription",
|
||||
"name_case": "",
|
||||
"owner": "Administrator",
|
||||
"permissions": [],
|
||||
"quick_entry": 0,
|
||||
"read_only": 0,
|
||||
"read_only_onload": 0,
|
||||
"restrict_to_domain": "Healthcare",
|
||||
"show_name_in_global_search": 0,
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"track_changes": 0,
|
||||
"track_seen": 0
|
||||
],
|
||||
"istable": 1,
|
||||
"links": [],
|
||||
"modified": "2020-02-26 17:02:42.741338",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Healthcare",
|
||||
"name": "Drug Prescription",
|
||||
"owner": "Administrator",
|
||||
"permissions": [],
|
||||
"restrict_to_domain": "Healthcare",
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC"
|
||||
}
|
||||
@@ -12,21 +12,21 @@ class DrugPrescription(Document):
|
||||
dosage = None
|
||||
period = None
|
||||
|
||||
if(self.dosage):
|
||||
dosage = frappe.get_doc("Prescription Dosage",self.dosage)
|
||||
if self.dosage:
|
||||
dosage = frappe.get_doc('Prescription Dosage', self.dosage)
|
||||
for item in dosage.dosage_strength:
|
||||
quantity += item.strength
|
||||
if(self.period and self.interval):
|
||||
period = frappe.get_doc("Prescription Duration",self.period)
|
||||
if(self.interval < period.get_days()):
|
||||
quantity = quantity*(period.get_days()/self.interval)
|
||||
if self.period and self.interval:
|
||||
period = frappe.get_doc('Prescription Duration', self.period)
|
||||
if self.interval < period.get_days():
|
||||
quantity = quantity * (period.get_days()/self.interval)
|
||||
|
||||
elif(self.interval and self.in_every and self.period):
|
||||
period = frappe.get_doc("Prescription Duration",self.period)
|
||||
interval_in = self.in_every
|
||||
if(interval_in == 'Day' and (self.interval < period.get_days())):
|
||||
elif self.interval and self.interval_uom and self.period:
|
||||
period = frappe.get_doc('Prescription Duration', self.period)
|
||||
interval_in = self.interval_uom
|
||||
if interval_in == 'Day' and self.interval < period.get_days():
|
||||
quantity = period.get_days()/self.interval
|
||||
elif(interval_in == 'Hour' and (self.interval < period.get_hours())):
|
||||
elif interval_in == 'Hour' and self.interval < period.get_hours():
|
||||
quantity = period.get_hours()/self.interval
|
||||
if quantity > 0:
|
||||
return quantity
|
||||
|
||||
@@ -1,259 +1,134 @@
|
||||
{
|
||||
"allow_copy": 1,
|
||||
"allow_guest_to_view": 0,
|
||||
"allow_import": 1,
|
||||
"allow_rename": 0,
|
||||
"beta": 1,
|
||||
"creation": "2017-01-05 10:56:29.564806",
|
||||
"custom": 0,
|
||||
"docstatus": 0,
|
||||
"doctype": "DocType",
|
||||
"document_type": "Setup",
|
||||
"editable_grid": 1,
|
||||
"engine": "InnoDB",
|
||||
"actions": [],
|
||||
"allow_copy": 1,
|
||||
"allow_import": 1,
|
||||
"beta": 1,
|
||||
"creation": "2017-01-05 10:56:29.564806",
|
||||
"doctype": "DocType",
|
||||
"document_type": "Setup",
|
||||
"editable_grid": 1,
|
||||
"engine": "InnoDB",
|
||||
"field_order": [
|
||||
"practitioner",
|
||||
"patient",
|
||||
"column_break_3",
|
||||
"status",
|
||||
"section_break_5",
|
||||
"section_break_3",
|
||||
"max_visits",
|
||||
"visited",
|
||||
"ref_appointments",
|
||||
"column_break_6",
|
||||
"start_date",
|
||||
"valid_till"
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "practitioner",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Healthcare Practitioner",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Healthcare Practitioner",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 1,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"fieldname": "practitioner",
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 1,
|
||||
"label": "Healthcare Practitioner",
|
||||
"options": "Healthcare Practitioner",
|
||||
"read_only": 1,
|
||||
"reqd": 1,
|
||||
"search_index": 1
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "patient",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Patient",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Patient",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 1,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"fieldname": "patient",
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 1,
|
||||
"label": "Patient",
|
||||
"options": "Patient",
|
||||
"read_only": 1,
|
||||
"reqd": 1,
|
||||
"search_index": 1
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "max_visit",
|
||||
"fieldtype": "Int",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Max number of visit",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"fieldname": "visited",
|
||||
"fieldtype": "Int",
|
||||
"label": "Visited yet",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "visited",
|
||||
"fieldtype": "Int",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Visited yet",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"fieldname": "valid_till",
|
||||
"fieldtype": "Date",
|
||||
"label": "Valid till",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "valid_till",
|
||||
"fieldtype": "Date",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Valid till",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"fieldname": "section_break_3",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Validity",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "ref_invoice",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Reference Inv",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Sales Invoice",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
"fieldname": "column_break_6",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"fieldname": "max_visits",
|
||||
"fieldtype": "Int",
|
||||
"label": "Max number of visit",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_3",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"fieldname": "status",
|
||||
"fieldtype": "Select",
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 1,
|
||||
"label": "Status",
|
||||
"options": "Completed\nPending",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"fetch_from": "ref_appointment.appointment_date",
|
||||
"fieldname": "start_date",
|
||||
"fieldtype": "Date",
|
||||
"label": "Start Date",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "ref_appointments",
|
||||
"fieldtype": "Table MultiSelect",
|
||||
"label": "Reference Appointments",
|
||||
"options": "Fee Validity Reference",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"collapsible": 1,
|
||||
"fieldname": "section_break_5",
|
||||
"fieldtype": "Section Break"
|
||||
}
|
||||
],
|
||||
"has_web_view": 0,
|
||||
"hide_heading": 0,
|
||||
"hide_toolbar": 0,
|
||||
"idx": 0,
|
||||
"image_view": 0,
|
||||
"in_create": 0,
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2018-07-16 12:43:45.635230",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Healthcare",
|
||||
"name": "Fee Validity",
|
||||
"name_case": "",
|
||||
"owner": "Administrator",
|
||||
],
|
||||
"in_create": 1,
|
||||
"links": [],
|
||||
"modified": "2020-03-17 20:25:06.487418",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Healthcare",
|
||||
"name": "Fee Validity",
|
||||
"owner": "Administrator",
|
||||
"permissions": [
|
||||
{
|
||||
"amend": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Healthcare Administrator",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 0,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Healthcare Administrator",
|
||||
"share": 1,
|
||||
"write": 1
|
||||
}
|
||||
],
|
||||
"quick_entry": 1,
|
||||
"read_only": 0,
|
||||
"read_only_onload": 0,
|
||||
"restrict_to_domain": "Healthcare",
|
||||
"search_fields": "practitioner, patient",
|
||||
"show_name_in_global_search": 0,
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"title_field": "practitioner",
|
||||
"track_changes": 0,
|
||||
"track_seen": 0
|
||||
],
|
||||
"quick_entry": 1,
|
||||
"restrict_to_domain": "Healthcare",
|
||||
"search_fields": "practitioner, patient",
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"title_field": "practitioner"
|
||||
}
|
||||
@@ -9,28 +9,55 @@ from frappe.utils import getdate
|
||||
import datetime
|
||||
|
||||
class FeeValidity(Document):
|
||||
pass
|
||||
def validate(self):
|
||||
self.update_status()
|
||||
self.set_start_date()
|
||||
|
||||
def update_fee_validity(fee_validity, date, ref_invoice=None):
|
||||
max_visit = frappe.db.get_value("Healthcare Settings", None, "max_visit")
|
||||
valid_days = frappe.db.get_value("Healthcare Settings", None, "valid_days")
|
||||
if not valid_days:
|
||||
valid_days = 1
|
||||
if not max_visit:
|
||||
max_visit = 1
|
||||
date = getdate(date)
|
||||
valid_till = date + datetime.timedelta(days=int(valid_days))
|
||||
fee_validity.max_visit = max_visit
|
||||
def update_status(self):
|
||||
if self.visited >= self.max_visits:
|
||||
self.status = 'Completed'
|
||||
else:
|
||||
self.status = 'Pending'
|
||||
|
||||
def set_start_date(self):
|
||||
self.start_date = getdate()
|
||||
for appointment in self.ref_appointments:
|
||||
appointment_date = frappe.db.get_value('Patient Appointment', appointment.appointment, 'appointment_date')
|
||||
if getdate(appointment_date) < self.start_date:
|
||||
self.start_date = getdate(appointment_date)
|
||||
|
||||
|
||||
def create_fee_validity(appointment):
|
||||
if not check_is_new_patient(appointment):
|
||||
return
|
||||
|
||||
fee_validity = frappe.new_doc('Fee Validity')
|
||||
fee_validity.practitioner = appointment.practitioner
|
||||
fee_validity.patient = appointment.patient
|
||||
fee_validity.max_visits = frappe.db.get_single_value('Healthcare Settings', 'max_visits') or 1
|
||||
valid_days = frappe.db.get_single_value('Healthcare Settings', 'valid_days') or 1
|
||||
fee_validity.visited = 1
|
||||
fee_validity.valid_till = valid_till
|
||||
fee_validity.ref_invoice = ref_invoice
|
||||
fee_validity.valid_till = getdate(appointment.appointment_date) + datetime.timedelta(days=int(valid_days))
|
||||
fee_validity.append('ref_appointments', {
|
||||
'appointment': appointment.name
|
||||
})
|
||||
fee_validity.save(ignore_permissions=True)
|
||||
return fee_validity
|
||||
|
||||
def check_is_new_patient(appointment):
|
||||
validity_exists = frappe.db.exists('Fee Validity', {
|
||||
'practitioner': appointment.practitioner,
|
||||
'patient': appointment.patient
|
||||
})
|
||||
if validity_exists:
|
||||
return False
|
||||
|
||||
def create_fee_validity(practitioner, patient, date, ref_invoice=None):
|
||||
fee_validity = frappe.new_doc("Fee Validity")
|
||||
fee_validity.practitioner = practitioner
|
||||
fee_validity.patient = patient
|
||||
fee_validity = update_fee_validity(fee_validity, date, ref_invoice)
|
||||
return fee_validity
|
||||
appointment_exists = frappe.db.get_all('Patient Appointment', {
|
||||
'name': ('!=', appointment.name),
|
||||
'status': ('!=', 'Cancelled'),
|
||||
'patient': appointment.patient,
|
||||
'practitioner': appointment.practitioner
|
||||
})
|
||||
if len(appointment_exists) and appointment_exists[0]:
|
||||
return False
|
||||
return True
|
||||
@@ -5,100 +5,44 @@ from __future__ import unicode_literals
|
||||
|
||||
import frappe
|
||||
import unittest
|
||||
from frappe.utils.make_random import get_random
|
||||
from frappe.utils import nowdate, add_days, getdate
|
||||
from frappe.utils import nowdate, add_days
|
||||
from erpnext.healthcare.doctype.patient_appointment.test_patient_appointment import create_healthcare_docs, create_appointment, create_healthcare_service_items
|
||||
|
||||
test_dependencies = ["Company"]
|
||||
|
||||
class TestFeeValidity(unittest.TestCase):
|
||||
def test_fee_validity(self):
|
||||
def setUp(self):
|
||||
frappe.db.sql("""delete from `tabPatient Appointment`""")
|
||||
frappe.db.sql("""delete from `tabFee Validity`""")
|
||||
patient = get_random("Patient")
|
||||
practitioner = get_random("Healthcare Practitioner")
|
||||
department = get_random("Medical Department")
|
||||
frappe.db.sql("""delete from `tabPatient`""")
|
||||
|
||||
if not patient:
|
||||
patient = frappe.new_doc("Patient")
|
||||
patient.patient_name = "_Test Patient"
|
||||
patient.sex = "Male"
|
||||
patient.save(ignore_permissions=True)
|
||||
patient = patient.name
|
||||
def test_fee_validity(self):
|
||||
item = create_healthcare_service_items()
|
||||
healthcare_settings = frappe.get_single("Healthcare Settings")
|
||||
healthcare_settings.enable_free_follow_ups = 1
|
||||
healthcare_settings.max_visits = 2
|
||||
healthcare_settings.valid_days = 7
|
||||
healthcare_settings.automate_appointment_invoicing = 1
|
||||
healthcare_settings.op_consulting_charge_item = item
|
||||
healthcare_settings.save(ignore_permissions=True)
|
||||
patient, medical_department, practitioner = create_healthcare_docs()
|
||||
|
||||
if not department:
|
||||
medical_department = frappe.new_doc("Medical Department")
|
||||
medical_department.department = "_Test Medical Department"
|
||||
medical_department.save(ignore_permissions=True)
|
||||
department = medical_department.name
|
||||
|
||||
if not practitioner:
|
||||
practitioner = frappe.new_doc("Healthcare Practitioner")
|
||||
practitioner.first_name = "_Test Healthcare Practitioner"
|
||||
practitioner.department = department
|
||||
practitioner.save(ignore_permissions=True)
|
||||
practitioner = practitioner.name
|
||||
|
||||
|
||||
|
||||
frappe.db.set_value("Healthcare Settings", None, "max_visit", 2)
|
||||
frappe.db.set_value("Healthcare Settings", None, "valid_days", 7)
|
||||
|
||||
appointment = create_appointment(patient, practitioner, nowdate(), department)
|
||||
# appointment should not be invoiced. Check Fee Validity created for new patient
|
||||
appointment = create_appointment(patient, practitioner, nowdate())
|
||||
invoiced = frappe.db.get_value("Patient Appointment", appointment.name, "invoiced")
|
||||
self.assertEqual(invoiced, 0)
|
||||
|
||||
invoice_appointment(appointment)
|
||||
|
||||
appointment = create_appointment(patient, practitioner, add_days(nowdate(), 4), department)
|
||||
invoiced = frappe.db.get_value("Patient Appointment", appointment.name, "invoiced")
|
||||
self.assertTrue(invoiced)
|
||||
|
||||
appointment = create_appointment(patient, practitioner, add_days(nowdate(), 5), department)
|
||||
# appointment should not be invoiced as it is within fee validity
|
||||
appointment = create_appointment(patient, practitioner, add_days(nowdate(), 4))
|
||||
invoiced = frappe.db.get_value("Patient Appointment", appointment.name, "invoiced")
|
||||
self.assertEqual(invoiced, 0)
|
||||
|
||||
appointment = create_appointment(patient, practitioner, add_days(nowdate(), 10), department)
|
||||
# appointment should be invoiced as it is within fee validity but the max_visits are exceeded
|
||||
appointment = create_appointment(patient, practitioner, add_days(nowdate(), 5), invoice=1)
|
||||
invoiced = frappe.db.get_value("Patient Appointment", appointment.name, "invoiced")
|
||||
self.assertEqual(invoiced, 0)
|
||||
self.assertEqual(invoiced, 1)
|
||||
|
||||
def create_appointment(patient, practitioner, appointment_date, department):
|
||||
appointment = frappe.new_doc("Patient Appointment")
|
||||
appointment.patient = patient
|
||||
appointment.practitioner = practitioner
|
||||
appointment.department = department
|
||||
appointment.appointment_date = appointment_date
|
||||
appointment.company = "_Test Company"
|
||||
appointment.duration = 15
|
||||
appointment.save(ignore_permissions=True)
|
||||
return appointment
|
||||
|
||||
def invoice_appointment(appointment_doc):
|
||||
if not appointment_doc.name:
|
||||
return False
|
||||
sales_invoice = frappe.new_doc("Sales Invoice")
|
||||
sales_invoice.customer = frappe.get_value("Patient", appointment_doc.patient, "customer")
|
||||
sales_invoice.due_date = getdate()
|
||||
sales_invoice.is_pos = 0
|
||||
sales_invoice.company = appointment_doc.company
|
||||
sales_invoice.debit_to = "_Test Receivable - _TC"
|
||||
|
||||
create_invoice_items(appointment_doc, sales_invoice)
|
||||
|
||||
sales_invoice.save(ignore_permissions=True)
|
||||
sales_invoice.submit()
|
||||
|
||||
def create_invoice_items(appointment, invoice):
|
||||
item_line = invoice.append("items")
|
||||
item_line.item_name = "Consulting Charges"
|
||||
item_line.description = "Consulting Charges: " + appointment.practitioner
|
||||
item_line.uom = "Nos"
|
||||
item_line.conversion_factor = 1
|
||||
item_line.income_account = "_Test Account Cost for Goods Sold - _TC"
|
||||
item_line.cost_center = "_Test Cost Center - _TC"
|
||||
item_line.rate = 250
|
||||
item_line.amount = 250
|
||||
item_line.qty = 1
|
||||
item_line.reference_dt = "Patient Appointment"
|
||||
item_line.reference_dn = appointment.name
|
||||
|
||||
return invoice
|
||||
# appointment should be invoiced as it is not within fee validity and the max_visits are exceeded
|
||||
appointment = create_appointment(patient, practitioner, add_days(nowdate(), 10), invoice=1)
|
||||
invoiced = frappe.db.get_value("Patient Appointment", appointment.name, "invoiced")
|
||||
self.assertEqual(invoiced, 1)
|
||||
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"actions": [],
|
||||
"creation": "2020-03-13 16:08:42.859996",
|
||||
"doctype": "DocType",
|
||||
"editable_grid": 1,
|
||||
"engine": "InnoDB",
|
||||
"field_order": [
|
||||
"appointment"
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
"fieldname": "appointment",
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 1,
|
||||
"label": "Patient Appointment",
|
||||
"options": "Patient Appointment",
|
||||
"reqd": 1
|
||||
}
|
||||
],
|
||||
"istable": 1,
|
||||
"links": [],
|
||||
"modified": "2020-03-15 00:27:02.076470",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Healthcare",
|
||||
"name": "Fee Validity Reference",
|
||||
"owner": "Administrator",
|
||||
"permissions": [],
|
||||
"quick_entry": 1,
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"track_changes": 1
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
# import frappe
|
||||
from frappe.model.document import Document
|
||||
|
||||
class FeeValidityReference(Document):
|
||||
pass
|
||||
@@ -4,7 +4,7 @@
|
||||
frappe.ui.form.on('Healthcare Practitioner', {
|
||||
setup: function(frm) {
|
||||
frm.set_query('account', 'accounts', function(doc, cdt, cdn) {
|
||||
var d = locals[cdt][cdn];
|
||||
let d = locals[cdt][cdn];
|
||||
return {
|
||||
filters: {
|
||||
'root_type': 'Income',
|
||||
@@ -16,23 +16,28 @@ frappe.ui.form.on('Healthcare Practitioner', {
|
||||
},
|
||||
refresh: function(frm) {
|
||||
frappe.dynamic_link = {doc: frm.doc, fieldname: 'name', doctype: 'Healthcare Practitioner'};
|
||||
if(!frm.is_new()) {
|
||||
|
||||
if (!frm.is_new()) {
|
||||
frappe.contacts.render_address_and_contact(frm);
|
||||
} else {
|
||||
frappe.contacts.clear_address_and_contact(frm);
|
||||
}
|
||||
frm.set_query("service_unit", "practitioner_schedules", function(){
|
||||
|
||||
frm.set_query('service_unit', 'practitioner_schedules', function(){
|
||||
return {
|
||||
filters: {
|
||||
"is_group": false,
|
||||
"allow_appointments": true
|
||||
'is_group': false,
|
||||
'allow_appointments': true
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
set_query_service_item(frm, 'inpatient_visit_charge_item');
|
||||
set_query_service_item(frm, 'op_consulting_charge_item');
|
||||
}
|
||||
});
|
||||
|
||||
var set_query_service_item = function(frm, service_item_field) {
|
||||
let set_query_service_item = function(frm, service_item_field) {
|
||||
frm.set_query(service_item_field, function() {
|
||||
return {
|
||||
filters: {
|
||||
@@ -43,62 +48,62 @@ var set_query_service_item = function(frm, service_item_field) {
|
||||
});
|
||||
};
|
||||
|
||||
frappe.ui.form.on("Healthcare Practitioner", "user_id",function(frm) {
|
||||
if(frm.doc.user_id){
|
||||
frappe.ui.form.on('Healthcare Practitioner', 'user_id',function(frm) {
|
||||
if (frm.doc.user_id) {
|
||||
frappe.call({
|
||||
"method": "frappe.client.get",
|
||||
'method': 'frappe.client.get',
|
||||
args: {
|
||||
doctype: "User",
|
||||
doctype: 'User',
|
||||
name: frm.doc.user_id
|
||||
},
|
||||
callback: function (data) {
|
||||
|
||||
frappe.model.get_value('Employee', {'user_id': frm.doc.user_id}, 'name',
|
||||
function(data) {
|
||||
if(data){
|
||||
if(!frm.doc.employee || frm.doc.employee != data.name)
|
||||
frappe.model.set_value(frm.doctype,frm.docname, "employee", data.name);
|
||||
}else{
|
||||
frappe.model.set_value(frm.doctype,frm.docname, "employee", "");
|
||||
if (data) {
|
||||
if (!frm.doc.employee || frm.doc.employee != data.name)
|
||||
frappe.model.set_value(frm.doctype, frm.docname, 'employee', data.name);
|
||||
} else {
|
||||
frappe.model.set_value(frm.doctype, frm.docname, 'employee', '');
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
if(!frm.doc.first_name || frm.doc.first_name != data.message.first_name)
|
||||
frappe.model.set_value(frm.doctype,frm.docname, "first_name", data.message.first_name);
|
||||
if(!frm.doc.middle_name || frm.doc.middle_name != data.message.middle_name)
|
||||
frappe.model.set_value(frm.doctype,frm.docname, "middle_name", data.message.middle_name);
|
||||
if(!frm.doc.last_name || frm.doc.last_name != data.message.last_name)
|
||||
frappe.model.set_value(frm.doctype,frm.docname, "last_name", data.message.last_name);
|
||||
if(!frm.doc.mobile_phone || frm.doc.mobile_phone != data.message.mobile_no)
|
||||
frappe.model.set_value(frm.doctype,frm.docname, "mobile_phone", data.message.mobile_no);
|
||||
if (!frm.doc.first_name || frm.doc.first_name != data.message.first_name)
|
||||
frappe.model.set_value(frm.doctype,frm.docname, 'first_name', data.message.first_name);
|
||||
if (!frm.doc.middle_name || frm.doc.middle_name != data.message.middle_name)
|
||||
frappe.model.set_value(frm.doctype,frm.docname, 'middle_name', data.message.middle_name);
|
||||
if (!frm.doc.last_name || frm.doc.last_name != data.message.last_name)
|
||||
frappe.model.set_value(frm.doctype,frm.docname, 'last_name', data.message.last_name);
|
||||
if (!frm.doc.mobile_phone || frm.doc.mobile_phone != data.message.mobile_no)
|
||||
frappe.model.set_value(frm.doctype,frm.docname, 'mobile_phone', data.message.mobile_no);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
frappe.ui.form.on("Healthcare Practitioner", "employee", function(frm) {
|
||||
if(frm.doc.employee){
|
||||
frappe.ui.form.on('Healthcare Practitioner', 'employee', function(frm) {
|
||||
if (frm.doc.employee){
|
||||
frappe.call({
|
||||
"method": "frappe.client.get",
|
||||
'method': 'frappe.client.get',
|
||||
args: {
|
||||
doctype: "Employee",
|
||||
doctype: 'Employee',
|
||||
name: frm.doc.employee
|
||||
},
|
||||
callback: function (data) {
|
||||
if(!frm.doc.user_id || frm.doc.user_id != data.message.user_id)
|
||||
frm.set_value("user_id", data.message.user_id);
|
||||
if(!frm.doc.designation || frm.doc.designation != data.message.designation)
|
||||
frappe.model.set_value(frm.doctype,frm.docname, "designation", data.message.designation);
|
||||
if(!frm.doc.first_name || !frm.doc.user_id){
|
||||
frappe.model.set_value(frm.doctype,frm.docname, "first_name", data.message.employee_name);
|
||||
frappe.model.set_value(frm.doctype,frm.docname, "middle_name", "");
|
||||
frappe.model.set_value(frm.doctype,frm.docname, "last_name", "");
|
||||
if (!frm.doc.user_id || frm.doc.user_id != data.message.user_id)
|
||||
frm.set_value('user_id', data.message.user_id);
|
||||
if (!frm.doc.designation || frm.doc.designation != data.message.designation)
|
||||
frappe.model.set_value(frm.doctype,frm.docname, 'designation', data.message.designation);
|
||||
if (!frm.doc.first_name || !frm.doc.user_id){
|
||||
frappe.model.set_value(frm.doctype,frm.docname, 'first_name', data.message.first_name);
|
||||
frappe.model.set_value(frm.doctype,frm.docname, 'middle_name', '');
|
||||
frappe.model.set_value(frm.doctype,frm.docname, 'last_name', data.message.last_name);
|
||||
}
|
||||
if(!frm.doc.mobile_phone || !frm.doc.user_id)
|
||||
frappe.model.set_value(frm.doctype,frm.docname, "mobile_phone", data.message.cell_number);
|
||||
if(!frm.doc.address || frm.doc.address != data.message.current_address)
|
||||
frappe.model.set_value(frm.doctype,frm.docname, "address", data.message.current_address);
|
||||
if (!frm.doc.mobile_phone || !frm.doc.user_id)
|
||||
frappe.model.set_value(frm.doctype,frm.docname, 'mobile_phone', data.message.cell_number);
|
||||
if (!frm.doc.address || frm.doc.address != data.message.current_address)
|
||||
frappe.model.set_value(frm.doctype,frm.docname, 'address', data.message.current_address);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -5,10 +5,10 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe.model.document import Document
|
||||
from frappe import throw, _
|
||||
from frappe.utils import cstr
|
||||
from frappe import _
|
||||
from erpnext.accounts.party import validate_party_accounts
|
||||
from frappe.contacts.address_and_contact import load_address_and_contact, delete_contact_and_address
|
||||
from frappe.model.naming import append_number_if_name_exists
|
||||
from frappe.desk.reportview import build_match_conditions, get_filters_cond
|
||||
|
||||
class HealthcarePractitioner(Document):
|
||||
@@ -16,63 +16,66 @@ class HealthcarePractitioner(Document):
|
||||
load_address_and_contact(self)
|
||||
|
||||
def autoname(self):
|
||||
# practitioner first_name and last_name
|
||||
self.name = " ".join(filter(None,
|
||||
[cstr(self.get(f)).strip() for f in ["first_name","middle_name","last_name"]]))
|
||||
# concat first and last name
|
||||
self.name = self.practitioner_name
|
||||
|
||||
if frappe.db.exists('Healthcare Practitioner', self.name):
|
||||
self.name = append_number_if_name_exists('Contact', self.name)
|
||||
|
||||
def validate(self):
|
||||
self.set_full_name()
|
||||
validate_party_accounts(self)
|
||||
if self.inpatient_visit_charge_item:
|
||||
validate_service_item(self.inpatient_visit_charge_item, "Configure a service Item for Inpatient Visit Charge Item")
|
||||
validate_service_item(self.inpatient_visit_charge_item, 'Configure a service Item for Inpatient Consulting Charge Item')
|
||||
if self.op_consulting_charge_item:
|
||||
validate_service_item(self.op_consulting_charge_item, "Configure a service Item for Out Patient Consulting Charge Item")
|
||||
validate_service_item(self.op_consulting_charge_item, 'Configure a service Item for Out Patient Consulting Charge Item')
|
||||
|
||||
if self.user_id:
|
||||
self.validate_for_enabled_user_id()
|
||||
self.validate_duplicate_user_id()
|
||||
existing_user_id = frappe.db.get_value("Healthcare Practitioner", self.name, "user_id")
|
||||
if self.user_id != existing_user_id:
|
||||
frappe.permissions.remove_user_permission(
|
||||
"Healthcare Practitioner", self.name, existing_user_id)
|
||||
|
||||
self.validate_user_id()
|
||||
else:
|
||||
existing_user_id = frappe.db.get_value("Healthcare Practitioner", self.name, "user_id")
|
||||
existing_user_id = frappe.db.get_value('Healthcare Practitioner', self.name, 'user_id')
|
||||
if existing_user_id:
|
||||
frappe.permissions.remove_user_permission(
|
||||
"Healthcare Practitioner", self.name, existing_user_id)
|
||||
'Healthcare Practitioner', self.name, existing_user_id)
|
||||
|
||||
def on_update(self):
|
||||
if self.user_id:
|
||||
frappe.permissions.add_user_permission("Healthcare Practitioner", self.name, self.user_id)
|
||||
frappe.permissions.add_user_permission('Healthcare Practitioner', self.name, self.user_id)
|
||||
|
||||
def set_full_name(self):
|
||||
if self.last_name:
|
||||
self.practitioner_name = ' '.join(filter(None, [self.first_name, self.last_name]))
|
||||
else:
|
||||
self.practitioner_name = self.first_name
|
||||
|
||||
def validate_for_enabled_user_id(self):
|
||||
enabled = frappe.db.get_value("User", self.user_id, "enabled")
|
||||
if enabled is None:
|
||||
frappe.throw(_("User {0} does not exist").format(self.user_id))
|
||||
if enabled == 0:
|
||||
frappe.throw(_("User {0} is disabled").format(self.user_id))
|
||||
def validate_user_id(self):
|
||||
if not frappe.db.exists('User', self.user_id):
|
||||
frappe.throw(_('User {0} does not exist').format(self.user_id))
|
||||
elif not frappe.db.exists('User', self.user_id, 'enabled'):
|
||||
frappe.throw(_('User {0} is disabled').format(self.user_id))
|
||||
|
||||
def validate_duplicate_user_id(self):
|
||||
practitioner = frappe.db.sql_list("""select name from `tabHealthcare Practitioner` where
|
||||
user_id=%s and name!=%s""", (self.user_id, self.name))
|
||||
# check duplicate
|
||||
practitioner = frappe.db.exists('Healthcare Practitioner', {
|
||||
'user_id': self.user_id,
|
||||
'name': ('!=', self.name)
|
||||
})
|
||||
if practitioner:
|
||||
throw(_("User {0} is already assigned to Healthcare Practitioner {1}").format(
|
||||
self.user_id, practitioner[0]), frappe.DuplicateEntryError)
|
||||
frappe.throw(_('User {0} is already assigned to Healthcare Practitioner {1}').format(
|
||||
self.user_id, practitioner))
|
||||
|
||||
def on_trash(self):
|
||||
delete_contact_and_address('Healthcare Practitioner', self.name)
|
||||
|
||||
def validate_service_item(item, msg):
|
||||
if frappe.db.get_value("Item", item, "is_stock_item") == 1:
|
||||
if frappe.db.get_value('Item', item, 'is_stock_item'):
|
||||
frappe.throw(_(msg))
|
||||
|
||||
def get_practitioner_list(doctype, txt, searchfield, start, page_len, filters=None):
|
||||
fields = ["name", "first_name", "mobile_phone"]
|
||||
fields = ['name', 'practitioner_name', 'mobile_phone']
|
||||
|
||||
filters = {
|
||||
'name': ("like", "%%%s%%" % txt)
|
||||
'name': ('like', '%%%s%%' % txt)
|
||||
}
|
||||
|
||||
return frappe.get_all("Healthcare Practitioner", fields = fields,
|
||||
filters = filters, start=start, page_length=page_len, order_by="name, first_name", as_list=1)
|
||||
return frappe.get_all('Healthcare Practitioner', fields = fields,
|
||||
filters = filters, start=start, page_length=page_len, order_by='name, practitioner_name', as_list=1)
|
||||
|
||||
@@ -9,7 +9,11 @@ def get_data():
|
||||
'transactions': [
|
||||
{
|
||||
'label': _('Appointments and Patient Encounters'),
|
||||
'items': ['Patient Appointment', 'Patient Encounter']
|
||||
'items': ['Patient Appointment', 'Patient Encounter', 'Fee Validity']
|
||||
},
|
||||
{
|
||||
'label': _('Consultation'),
|
||||
'items': ['Clinical Procedure', 'Lab Test']
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
frappe.ui.form.on('Healthcare Service Unit', {
|
||||
onload: function(frm) {
|
||||
frm.list_route = "Tree/Healthcare Service Unit";
|
||||
frm.list_route = 'Tree/Healthcare Service Unit';
|
||||
|
||||
// get query select healthcare service unit
|
||||
frm.fields_dict['parent_healthcare_service_unit'].get_query = function(doc) {
|
||||
@@ -16,32 +16,32 @@ frappe.ui.form.on('Healthcare Service Unit', {
|
||||
};
|
||||
},
|
||||
refresh: function(frm) {
|
||||
frm.trigger("set_root_readonly");
|
||||
frm.set_df_property("service_unit_type", "reqd", 1);
|
||||
frm.add_custom_button(__("Healthcare Service Unit Tree"), function() {
|
||||
frappe.set_route("Tree", "Healthcare Service Unit");
|
||||
frm.trigger('set_root_readonly');
|
||||
frm.set_df_property('service_unit_type', 'reqd', 1);
|
||||
frm.add_custom_button(__('Healthcare Service Unit Tree'), function() {
|
||||
frappe.set_route('Tree', 'Healthcare Service Unit');
|
||||
});
|
||||
},
|
||||
set_root_readonly: function(frm) {
|
||||
// read-only for root healthcare service unit
|
||||
frm.set_intro("");
|
||||
if(!frm.doc.parent_healthcare_service_unit) {
|
||||
frm.set_intro('');
|
||||
if (!frm.doc.parent_healthcare_service_unit) {
|
||||
frm.set_read_only();
|
||||
frm.set_intro(__("This is a root healthcare service unit and cannot be edited."), true);
|
||||
frm.set_intro(__('This is a root healthcare service unit and cannot be edited.'), true);
|
||||
}
|
||||
},
|
||||
allow_appointments: function(frm) {
|
||||
if(!frm.doc.allow_appointments){
|
||||
frm.set_value("overlap_appointments", false);
|
||||
if (!frm.doc.allow_appointments) {
|
||||
frm.set_value('overlap_appointments', false);
|
||||
}
|
||||
},
|
||||
is_group: function(frm) {
|
||||
if(frm.doc.is_group == 1){
|
||||
frm.set_value("allow_appointments", false);
|
||||
frm.set_df_property("service_unit_type", "reqd", 0);
|
||||
if (frm.doc.is_group == 1) {
|
||||
frm.set_value('allow_appointments', false);
|
||||
frm.set_df_property('service_unit_type', 'reqd', 0);
|
||||
}
|
||||
else{
|
||||
frm.set_df_property("service_unit_type", "reqd", 1);
|
||||
else {
|
||||
frm.set_df_property('service_unit_type', 'reqd', 1);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
"doctype": "DocType",
|
||||
"document_type": "Setup",
|
||||
"editable_grid": 1,
|
||||
"engine": "InnoDB",
|
||||
"field_order": [
|
||||
"healthcare_service_unit_name",
|
||||
"parent_healthcare_service_unit",
|
||||
@@ -18,6 +19,7 @@
|
||||
"overlap_appointments",
|
||||
"inpatient_occupancy",
|
||||
"occupancy_status",
|
||||
"column_break_9",
|
||||
"warehouse",
|
||||
"company",
|
||||
"lft",
|
||||
@@ -99,9 +101,13 @@
|
||||
"fieldtype": "Select",
|
||||
"label": "Occupancy Status",
|
||||
"no_copy": 1,
|
||||
"options": "Vacant\nOccupied",
|
||||
"options": "\nVacant\nOccupied",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_9",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"bold": 1,
|
||||
"depends_on": "eval:doc.is_group != 1",
|
||||
@@ -153,13 +159,11 @@
|
||||
"report_hide": 1
|
||||
}
|
||||
],
|
||||
"is_tree": 1,
|
||||
"links": [],
|
||||
"modified": "2020-03-18 18:02:23.713439",
|
||||
"modified": "2020-03-26 16:13:08.675952",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Healthcare",
|
||||
"name": "Healthcare Service Unit",
|
||||
"nsm_parent_field": "parent_healthcare_service_unit",
|
||||
"owner": "Administrator",
|
||||
"permissions": [
|
||||
{
|
||||
|
||||
@@ -23,9 +23,9 @@ class HealthcareServiceUnit(NestedSet):
|
||||
self.validate_one_root()
|
||||
|
||||
def validate(self):
|
||||
if self.is_group == 1:
|
||||
if self.is_group:
|
||||
self.allow_appointments = 0
|
||||
self.overlap_appointments = 0
|
||||
self.inpatient_occupancy = 0
|
||||
elif self.allow_appointments != 1:
|
||||
elif not self.allow_appointments:
|
||||
self.overlap_appointments = 0
|
||||
|
||||
@@ -2,118 +2,85 @@
|
||||
// For license information, please see license.txt
|
||||
|
||||
frappe.ui.form.on('Healthcare Service Unit Type', {
|
||||
refresh: function(frm) {
|
||||
frm.set_df_property('item_code', 'read_only', frm.doc.__islocal ? 0 : 1);
|
||||
if (!frm.doc.__islocal && frm.doc.is_billable) {
|
||||
frm.add_custom_button(__('Change Item Code'), function() {
|
||||
change_item_code(cur_frm, frm.doc);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
service_unit_type: function(frm) {
|
||||
set_item_details(frm);
|
||||
if(!frm.doc.__islocal){
|
||||
|
||||
if (!frm.doc.__islocal) {
|
||||
frm.doc.change_in_item = 1;
|
||||
}
|
||||
},
|
||||
|
||||
is_billable: function(frm) {
|
||||
set_item_details(frm);
|
||||
},
|
||||
refresh: function(frm) {
|
||||
frm.set_df_property("item_code", "read_only", frm.doc.__islocal ? 0 : 1);
|
||||
if(!frm.doc.__islocal) {
|
||||
frm.add_custom_button(__('Change Item Code'), function() {
|
||||
change_item_code(cur_frm,frm.doc);
|
||||
} );
|
||||
if(frm.doc.disabled == 1){
|
||||
frm.add_custom_button(__('Enable'), function() {
|
||||
enable(cur_frm);
|
||||
} );
|
||||
}
|
||||
else{
|
||||
frm.add_custom_button(__('Disable'), function() {
|
||||
disable(cur_frm);
|
||||
} );
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
rate: function(frm) {
|
||||
if(!frm.doc.__islocal){
|
||||
if (!frm.doc.__islocal) {
|
||||
frm.doc.change_in_item = 1;
|
||||
}
|
||||
},
|
||||
item_group: function(frm) {
|
||||
if(!frm.doc.__islocal){
|
||||
if (!frm.doc.__islocal) {
|
||||
frm.doc.change_in_item = 1;
|
||||
}
|
||||
},
|
||||
description: function(frm) {
|
||||
if(!frm.doc.__islocal){
|
||||
if (!frm.doc.__islocal) {
|
||||
frm.doc.change_in_item = 1;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var disable = function(frm){
|
||||
var doc = frm.doc;
|
||||
frappe.call({
|
||||
method: "erpnext.healthcare.doctype.healthcare_service_unit_type.healthcare_service_unit_type.disable_enable",
|
||||
args: {status: 1, doc_name: doc.name, item: doc.item, is_billable: doc.is_billable},
|
||||
callback: function(){
|
||||
cur_frm.reload_doc();
|
||||
}
|
||||
});
|
||||
let set_item_details = function(frm) {
|
||||
if (frm.doc.service_unit_type && frm.doc.is_billable) {
|
||||
if (!frm.doc.item_code)
|
||||
frm.set_value('item_code', frm.doc.service_unit_type);
|
||||
if (!frm.doc.description)
|
||||
frm.set_value('description', frm.doc.service_unit_type);
|
||||
if (!frm.doc.item_group)
|
||||
frm.set_value('item_group', 'Services');
|
||||
}
|
||||
};
|
||||
|
||||
var enable = function(frm){
|
||||
var doc = frm.doc;
|
||||
frappe.call({
|
||||
method: "erpnext.healthcare.doctype.healthcare_service_unit_type.healthcare_service_unit_type.disable_enable",
|
||||
args: {status: 0, doc_name: doc.name, item: doc.item, is_billable: doc.is_billable},
|
||||
callback: function(){
|
||||
cur_frm.reload_doc();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
var change_item_code = function(frm, doc){
|
||||
var d = new frappe.ui.Dialog({
|
||||
title:__("Change Item Code"),
|
||||
fields:[
|
||||
let change_item_code = function(frm, doc) {
|
||||
let d = new frappe.ui.Dialog({
|
||||
title: __('Change Item Code'),
|
||||
fields: [
|
||||
{
|
||||
"fieldtype": "Data",
|
||||
"label": "Item Code",
|
||||
"fieldname": "Item Code",
|
||||
reqd:1
|
||||
},
|
||||
{
|
||||
"fieldtype": "Button",
|
||||
"label": __("Change Code"),
|
||||
click: function() {
|
||||
var values = d.get_values();
|
||||
if(!values)
|
||||
return;
|
||||
change_item_code_from_unit_type(values["Item Code"], doc);
|
||||
d.hide();
|
||||
}
|
||||
'fieldtype': 'Data',
|
||||
'label': 'Item Code',
|
||||
'fieldname': 'item_code',
|
||||
'default': doc.item_code,
|
||||
reqd: 1,
|
||||
}
|
||||
]
|
||||
],
|
||||
primary_action: function() {
|
||||
let values = d.get_values();
|
||||
if (values) {
|
||||
frappe.call({
|
||||
"method": "erpnext.healthcare.doctype.healthcare_service_unit_type.healthcare_service_unit_type.change_item_code",
|
||||
"args": {item: doc.item, item_code: values['item_code'], doc_name: doc.name},
|
||||
callback: function () {
|
||||
frm.reload_doc();
|
||||
}
|
||||
});
|
||||
}
|
||||
d.hide();
|
||||
},
|
||||
primary_action_label: __("Change Template Code")
|
||||
});
|
||||
|
||||
d.show();
|
||||
d.set_values({
|
||||
'Item Code': frm.doc.item_code
|
||||
});
|
||||
|
||||
var change_item_code_from_unit_type = function(item_code, doc){
|
||||
frappe.call({
|
||||
"method": "erpnext.healthcare.doctype.healthcare_service_unit_type.healthcare_service_unit_type.change_item_code",
|
||||
"args": {item: doc.item, item_code: item_code, doc_name: doc.name},
|
||||
callback: function () {
|
||||
frm.reload_doc();
|
||||
}
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
var set_item_details = function(frm) {
|
||||
if(frm.doc.service_unit_type && frm.doc.is_billable == 1){
|
||||
if(!frm.doc.item_code)
|
||||
frm.set_value("item_code", frm.doc.service_unit_type);
|
||||
if(!frm.doc.description)
|
||||
frm.set_value("description", frm.doc.service_unit_type);
|
||||
if(!frm.doc.item_group)
|
||||
frm.set_value("item_group", 'Services');
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,588 +1,164 @@
|
||||
{
|
||||
"allow_copy": 0,
|
||||
"allow_guest_to_view": 0,
|
||||
"allow_import": 1,
|
||||
"allow_rename": 1,
|
||||
"autoname": "field:service_unit_type",
|
||||
"beta": 0,
|
||||
"creation": "2018-07-11 16:47:51.414675",
|
||||
"custom": 0,
|
||||
"docstatus": 0,
|
||||
"doctype": "DocType",
|
||||
"document_type": "",
|
||||
"editable_grid": 1,
|
||||
"engine": "InnoDB",
|
||||
"actions": [],
|
||||
"allow_import": 1,
|
||||
"allow_rename": 1,
|
||||
"autoname": "field:service_unit_type",
|
||||
"creation": "2018-07-11 16:47:51.414675",
|
||||
"doctype": "DocType",
|
||||
"editable_grid": 1,
|
||||
"engine": "InnoDB",
|
||||
"field_order": [
|
||||
"disabled",
|
||||
"service_unit_type",
|
||||
"allow_appointments",
|
||||
"overlap_appointments",
|
||||
"inpatient_occupancy",
|
||||
"is_billable",
|
||||
"item_details",
|
||||
"item",
|
||||
"item_code",
|
||||
"item_group",
|
||||
"uom",
|
||||
"no_of_hours",
|
||||
"column_break_11",
|
||||
"rate",
|
||||
"description",
|
||||
"change_in_item"
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "service_unit_type",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Service Unit Type",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"fieldname": "service_unit_type",
|
||||
"fieldtype": "Data",
|
||||
"in_list_view": 1,
|
||||
"label": "Service Unit Type",
|
||||
"reqd": 1,
|
||||
"unique": 1
|
||||
},
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 1,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"default": "0",
|
||||
"depends_on": "eval:doc.inpatient_occupancy != 1",
|
||||
"fieldname": "allow_appointments",
|
||||
"fieldtype": "Check",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Allow Appointments",
|
||||
"length": 0,
|
||||
"no_copy": 1,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"bold": 1,
|
||||
"default": "0",
|
||||
"depends_on": "eval:doc.inpatient_occupancy != 1",
|
||||
"fieldname": "allow_appointments",
|
||||
"fieldtype": "Check",
|
||||
"label": "Allow Appointments",
|
||||
"no_copy": 1
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 1,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"default": "0",
|
||||
"depends_on": "eval:doc.allow_appointments == 1 && doc.inpatient_occupany != 1",
|
||||
"fieldname": "overlap_appointments",
|
||||
"fieldtype": "Check",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Allow Overlap",
|
||||
"length": 0,
|
||||
"no_copy": 1,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"bold": 1,
|
||||
"default": "0",
|
||||
"depends_on": "eval:doc.allow_appointments == 1 && doc.inpatient_occupany != 1",
|
||||
"fieldname": "overlap_appointments",
|
||||
"fieldtype": "Check",
|
||||
"label": "Allow Overlap",
|
||||
"no_copy": 1
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 1,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"default": "0",
|
||||
"depends_on": "eval:doc.allow_appointments != 1",
|
||||
"fieldname": "inpatient_occupancy",
|
||||
"fieldtype": "Check",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Inpatient Occupancy",
|
||||
"length": 0,
|
||||
"no_copy": 1,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"bold": 1,
|
||||
"default": "0",
|
||||
"depends_on": "eval:doc.allow_appointments != 1",
|
||||
"fieldname": "inpatient_occupancy",
|
||||
"fieldtype": "Check",
|
||||
"label": "Inpatient Occupancy",
|
||||
"no_copy": 1
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 1,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"depends_on": "eval:doc.inpatient_occupancy == 1 && doc.allow_appointments != 1",
|
||||
"fieldname": "is_billable",
|
||||
"fieldtype": "Check",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Is Billable",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"bold": 1,
|
||||
"default": "0",
|
||||
"depends_on": "eval:doc.inpatient_occupancy == 1 && doc.allow_appointments != 1",
|
||||
"fieldname": "is_billable",
|
||||
"fieldtype": "Check",
|
||||
"label": "Is Billable"
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"depends_on": "is_billable",
|
||||
"fieldname": "item_details",
|
||||
"fieldtype": "Section Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Item Details",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"depends_on": "is_billable",
|
||||
"fieldname": "item_details",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Item Details"
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "item",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Item",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Item",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"fieldname": "item",
|
||||
"fieldtype": "Link",
|
||||
"label": "Item",
|
||||
"options": "Item",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "item_code",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Item Code",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"fieldname": "item_code",
|
||||
"fieldtype": "Data",
|
||||
"label": "Item Code",
|
||||
"mandatory_depends_on": "eval: doc.is_billable == 1"
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "item_group",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Item Group",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Item Group",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"fieldname": "item_group",
|
||||
"fieldtype": "Link",
|
||||
"label": "Item Group",
|
||||
"mandatory_depends_on": "eval: doc.is_billable == 1",
|
||||
"options": "Item Group"
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "uom",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "UOM",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "UOM",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"fieldname": "uom",
|
||||
"fieldtype": "Link",
|
||||
"label": "UOM",
|
||||
"mandatory_depends_on": "eval: doc.is_billable == 1",
|
||||
"options": "UOM"
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "no_of_hours",
|
||||
"fieldtype": "Int",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "UOM Conversion in Hours",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"fieldname": "no_of_hours",
|
||||
"fieldtype": "Int",
|
||||
"label": "UOM Conversion in Hours",
|
||||
"mandatory_depends_on": "eval: doc.is_billable == 1"
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "column_break_11",
|
||||
"fieldtype": "Column Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"fieldname": "column_break_11",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "rate",
|
||||
"fieldtype": "Currency",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Rate / UOM",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"fieldname": "rate",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Rate / UOM"
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"default": "0",
|
||||
"fieldname": "disabled",
|
||||
"fieldtype": "Check",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Disabled",
|
||||
"length": 0,
|
||||
"no_copy": 1,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"default": "0",
|
||||
"fieldname": "disabled",
|
||||
"fieldtype": "Check",
|
||||
"label": "Disabled",
|
||||
"no_copy": 1
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "description",
|
||||
"fieldtype": "Small Text",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Description",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"fieldname": "description",
|
||||
"fieldtype": "Small Text",
|
||||
"label": "Description"
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "change_in_item",
|
||||
"fieldtype": "Check",
|
||||
"hidden": 1,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Change in Item",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
"default": "0",
|
||||
"fieldname": "change_in_item",
|
||||
"fieldtype": "Check",
|
||||
"hidden": 1,
|
||||
"label": "Change in Item"
|
||||
}
|
||||
],
|
||||
"has_web_view": 0,
|
||||
"hide_heading": 0,
|
||||
"hide_toolbar": 0,
|
||||
"idx": 0,
|
||||
"image_view": 0,
|
||||
"in_create": 0,
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2018-08-08 13:00:23.751635",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Healthcare",
|
||||
"name": "Healthcare Service Unit Type",
|
||||
"name_case": "",
|
||||
"owner": "Administrator",
|
||||
],
|
||||
"links": [],
|
||||
"modified": "2020-01-30 16:06:00.624496",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Healthcare",
|
||||
"name": "Healthcare Service Unit Type",
|
||||
"owner": "Administrator",
|
||||
"permissions": [
|
||||
{
|
||||
"amend": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Healthcare Administrator",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 0,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Healthcare Administrator",
|
||||
"share": 1,
|
||||
"write": 1
|
||||
}
|
||||
],
|
||||
"quick_entry": 0,
|
||||
"read_only": 0,
|
||||
"read_only_onload": 0,
|
||||
"restrict_to_domain": "Healthcare",
|
||||
"show_name_in_global_search": 0,
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"title_field": "service_unit_type",
|
||||
"track_changes": 0,
|
||||
"track_seen": 0,
|
||||
"track_views": 0
|
||||
],
|
||||
"restrict_to_domain": "Healthcare",
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"title_field": "service_unit_type"
|
||||
}
|
||||
@@ -10,109 +10,107 @@ from frappe.model.rename_doc import rename_doc
|
||||
|
||||
class HealthcareServiceUnitType(Document):
|
||||
def validate(self):
|
||||
if self.is_billable == 1:
|
||||
if not self.uom or not self.item_group or not self.description or not self.no_of_hours > 0:
|
||||
frappe.throw(_("Configure Item Fields like UOM, Item Group, Description and No of Hours."))
|
||||
if self.is_billable:
|
||||
if self.disabled:
|
||||
frappe.db.set_value('Item', self.item, 'disabled', 1)
|
||||
else:
|
||||
frappe.db.set_value('Item', self.item, 'disabled', 0)
|
||||
|
||||
def after_insert(self):
|
||||
if self.inpatient_occupancy and self.is_billable:
|
||||
create_item(self)
|
||||
|
||||
def on_trash(self):
|
||||
if(self.item):
|
||||
if self.item:
|
||||
try:
|
||||
frappe.delete_doc("Item",self.item)
|
||||
frappe.delete_doc('Item', self.item)
|
||||
except Exception:
|
||||
frappe.throw(_("""Not permitted. Please disable the Service Unit Type"""))
|
||||
frappe.throw(_('Not permitted. Please disable the Service Unit Type'))
|
||||
|
||||
def on_update(self):
|
||||
if(self.change_in_item and self.is_billable == 1 and self.item):
|
||||
updating_item(self)
|
||||
item_price = item_price_exist(self)
|
||||
if not item_price:
|
||||
if(self.rate != 0.0):
|
||||
price_list_name = frappe.db.get_value("Price List", {"selling": 1})
|
||||
if(self.rate):
|
||||
make_item_price(self.item_code, price_list_name, self.rate)
|
||||
else:
|
||||
make_item_price(self.item_code, price_list_name, 0.0)
|
||||
else:
|
||||
frappe.db.set_value("Item Price", item_price, "price_list_rate", self.rate)
|
||||
if self.change_in_item and self.is_billable and self.item:
|
||||
update_item(self)
|
||||
|
||||
frappe.db.set_value(self.doctype,self.name,"change_in_item",0)
|
||||
elif(self.is_billable == 0 and self.item):
|
||||
frappe.db.set_value("Item",self.item,"disabled",1)
|
||||
item_price = item_price_exists(self)
|
||||
|
||||
if not item_price:
|
||||
price_list_name = frappe.db.get_value('Price List', {'selling': 1})
|
||||
if self.rate:
|
||||
make_item_price(self.item_code, price_list_name, self.rate)
|
||||
else:
|
||||
make_item_price(self.item_code, price_list_name, 0.0)
|
||||
else:
|
||||
frappe.db.set_value('Item Price', item_price, 'price_list_rate', self.rate)
|
||||
|
||||
frappe.db.set_value(self.doctype, self.name, 'change_in_item',0)
|
||||
elif not self.is_billable and self.item:
|
||||
frappe.db.set_value('Item', self.item, 'disabled', 1)
|
||||
self.reload()
|
||||
|
||||
def item_price_exist(doc):
|
||||
item_price = frappe.db.exists({
|
||||
"doctype": "Item Price",
|
||||
"item_code": doc.item_code})
|
||||
if(item_price):
|
||||
return item_price[0][0]
|
||||
else:
|
||||
return False
|
||||
|
||||
def updating_item(doc):
|
||||
frappe.db.sql("""update `tabItem` set item_name=%s, item_group=%s, disabled=0, standard_rate=%s,
|
||||
description=%s, modified=NOW() where item_code=%s""",
|
||||
(doc.service_unit_type, doc.item_group , doc.rate, doc.description, doc.item))
|
||||
def item_price_exists(doc):
|
||||
item_price = frappe.db.exists({'doctype': 'Item Price', 'item_code': doc.item_code})
|
||||
if len(item_price):
|
||||
return item_price[0][0]
|
||||
return False
|
||||
|
||||
def create_item(doc):
|
||||
#insert item
|
||||
# insert item
|
||||
item = frappe.get_doc({
|
||||
"doctype": "Item",
|
||||
"item_code": doc.item_code,
|
||||
"item_name":doc.service_unit_type,
|
||||
"item_group": doc.item_group,
|
||||
"description":doc.description,
|
||||
"is_sales_item": 1,
|
||||
"is_service_item": 1,
|
||||
"is_purchase_item": 0,
|
||||
"is_stock_item": 0,
|
||||
"show_in_website": 0,
|
||||
"is_pro_applicable": 0,
|
||||
"disabled": 0,
|
||||
"stock_uom": doc.uom
|
||||
}).insert(ignore_permissions=True)
|
||||
'doctype': 'Item',
|
||||
'item_code': doc.item_code,
|
||||
'item_name': doc.service_unit_type,
|
||||
'item_group': doc.item_group,
|
||||
'description': doc.description or doc.item_code,
|
||||
'is_sales_item': 1,
|
||||
'is_service_item': 1,
|
||||
'is_purchase_item': 0,
|
||||
'is_stock_item': 0,
|
||||
'show_in_website': 0,
|
||||
'is_pro_applicable': 0,
|
||||
'disabled': 0,
|
||||
'stock_uom': doc.uom
|
||||
}).insert(ignore_permissions=True, ignore_mandatory=True)
|
||||
|
||||
#insert item price
|
||||
#get item price list to insert item price
|
||||
if(doc.rate != 0.0):
|
||||
price_list_name = frappe.db.get_value("Price List", {"selling": 1})
|
||||
if(doc.rate):
|
||||
make_item_price(item.name, price_list_name, doc.rate)
|
||||
item.standard_rate = doc.rate
|
||||
else:
|
||||
make_item_price(item.name, price_list_name, 0.0)
|
||||
item.standard_rate = 0.0
|
||||
item.save(ignore_permissions = True)
|
||||
#Set item to the Doc
|
||||
frappe.db.set_value("Healthcare Service Unit Type", doc.name, "item", item.name)
|
||||
# insert item price
|
||||
# get item price list to insert item price
|
||||
price_list_name = frappe.db.get_value('Price List', {'selling': 1})
|
||||
if doc.rate:
|
||||
make_item_price(item.name, price_list_name, doc.rate)
|
||||
item.standard_rate = doc.rate
|
||||
else:
|
||||
make_item_price(item.name, price_list_name, 0.0)
|
||||
item.standard_rate = 0.0
|
||||
|
||||
doc.reload() #refresh the doc after insert.
|
||||
item.save(ignore_permissions=True)
|
||||
|
||||
# Set item in the doc
|
||||
doc.db_set('item', item.name)
|
||||
|
||||
def make_item_price(item, price_list_name, item_price):
|
||||
frappe.get_doc({
|
||||
"doctype": "Item Price",
|
||||
"price_list": price_list_name,
|
||||
"item_code": item,
|
||||
"price_list_rate": item_price
|
||||
}).insert(ignore_permissions=True)
|
||||
'doctype': 'Item Price',
|
||||
'price_list': price_list_name,
|
||||
'item_code': item,
|
||||
'price_list_rate': item_price
|
||||
}).insert(ignore_permissions=True, ignore_mandatory=True)
|
||||
|
||||
def update_item(doc):
|
||||
item = frappe.get_doc("Item", doc.item)
|
||||
if item:
|
||||
item.update({
|
||||
"item_name": doc.service_unit_type,
|
||||
"item_group": doc.item_group,
|
||||
"disabled": 0,
|
||||
"standard_rate": doc.rate,
|
||||
"description": doc.description
|
||||
})
|
||||
item.db_update()
|
||||
|
||||
@frappe.whitelist()
|
||||
def change_item_code(item, item_code, doc_name):
|
||||
item_exist = frappe.db.exists({
|
||||
"doctype": "Item",
|
||||
"item_code": item_code})
|
||||
if(item_exist):
|
||||
frappe.throw(_("Code {0} already exist").format(item_code))
|
||||
if frappe.db.exists({'doctype': 'Item', 'item_code': item_code}):
|
||||
frappe.throw(_('Item with Item Code {0} already exists').format(item_code))
|
||||
else:
|
||||
rename_doc("Item", item, item_code, ignore_permissions=True)
|
||||
frappe.db.set_value("Healthcare Service Unit Type", doc_name, "item_code", item_code)
|
||||
|
||||
@frappe.whitelist()
|
||||
def disable_enable(status, doc_name, item=None, is_billable=None):
|
||||
frappe.db.set_value("Healthcare Service Unit Type", doc_name, "disabled", status)
|
||||
if(is_billable == 1):
|
||||
frappe.db.set_value("Item", item, "disabled", status)
|
||||
rename_doc('Item', item, item_code, ignore_permissions=True)
|
||||
frappe.db.set_value('Healthcare Service Unit Type', doc_name, 'item_code', item_code)
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
from __future__ import unicode_literals
|
||||
from frappe import _
|
||||
|
||||
def get_data():
|
||||
return {
|
||||
'fieldname': 'service_unit_type',
|
||||
'transactions': [
|
||||
{
|
||||
'label': _('Healthcare Service Units'),
|
||||
'items': ['Healthcare Service Unit']
|
||||
},
|
||||
]
|
||||
}
|
||||
@@ -3,6 +3,31 @@
|
||||
# See license.txt
|
||||
from __future__ import unicode_literals
|
||||
import unittest
|
||||
import frappe
|
||||
|
||||
class TestHealthcareServiceUnitType(unittest.TestCase):
|
||||
pass
|
||||
def test_item_creation(self):
|
||||
unit_type = get_unit_type()
|
||||
self.assertTrue(frappe.db.exists('Item', unit_type.item))
|
||||
|
||||
# check item disabled
|
||||
unit_type.disabled = 1
|
||||
unit_type.save()
|
||||
self.assertEqual(frappe.db.get_value('Item', unit_type.item, 'disabled'), 1)
|
||||
|
||||
|
||||
def get_unit_type():
|
||||
if frappe.db.exists('Healthcare Service Unit Type', 'Inpatient Rooms'):
|
||||
return frappe.get_doc('Healthcare Service Unit Type', 'Inpatient Rooms')
|
||||
|
||||
unit_type = frappe.new_doc('Healthcare Service Unit Type')
|
||||
unit_type.service_unit_type = 'Inpatient Rooms'
|
||||
unit_type.inpatient_occupancy = 1
|
||||
unit_type.is_billable = 1
|
||||
unit_type.item_code = 'Inpatient Rooms'
|
||||
unit_type.item_group = 'Services'
|
||||
unit_type.uom = 'Hour'
|
||||
unit_type.no_of_hours = 1
|
||||
unit_type.rate = 4000
|
||||
unit_type.save()
|
||||
return unit_type
|
||||
@@ -7,40 +7,40 @@
|
||||
"engine": "InnoDB",
|
||||
"field_order": [
|
||||
"sb_op_settings",
|
||||
"patient_master_name",
|
||||
"manage_customer",
|
||||
"patient_name_by",
|
||||
"link_customer_to_patient",
|
||||
"default_medical_code_standard",
|
||||
"column_break_9",
|
||||
"collect_registration_fee",
|
||||
"registration_fee",
|
||||
"manage_appointment_invoice_automatically",
|
||||
"max_visit",
|
||||
"automate_appointment_invoicing",
|
||||
"enable_free_follow_ups",
|
||||
"max_visits",
|
||||
"valid_days",
|
||||
"healthcare_service_items",
|
||||
"inpatient_visit_charge_item",
|
||||
"op_consulting_charge_item",
|
||||
"column_break_13",
|
||||
"clinical_procedure_consumable_item",
|
||||
"out_patient_sms_alerts",
|
||||
"reg_sms",
|
||||
"reg_msg",
|
||||
"app_con",
|
||||
"app_con_msg",
|
||||
"no_con",
|
||||
"column_break_16",
|
||||
"app_rem",
|
||||
"app_rem_msg",
|
||||
"rem_before",
|
||||
"sb_in_ac",
|
||||
"income_account",
|
||||
"sb_r_ac",
|
||||
"receivable_account",
|
||||
"out_patient_sms_alerts",
|
||||
"send_registration_msg",
|
||||
"registration_msg",
|
||||
"send_appointment_confirmation",
|
||||
"appointment_confirmation_msg",
|
||||
"avoid_confirmation",
|
||||
"column_break_16",
|
||||
"send_appointment_reminder",
|
||||
"appointment_reminder_msg",
|
||||
"remind_before",
|
||||
"sb_lab_settings",
|
||||
"create_test_on_si_submit",
|
||||
"require_sample_collection",
|
||||
"require_test_result_approval",
|
||||
"create_lab_test_on_si_submit",
|
||||
"create_sample_collection_for_lab_test",
|
||||
"column_break_34",
|
||||
"employee_name_and_designation_in_print",
|
||||
"lab_test_approval_required",
|
||||
"custom_signature_in_print",
|
||||
"laboratory_sms_alerts",
|
||||
"sms_printed",
|
||||
@@ -53,19 +53,6 @@
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Out Patient Settings"
|
||||
},
|
||||
{
|
||||
"fieldname": "patient_master_name",
|
||||
"fieldtype": "Select",
|
||||
"label": "Patient Name By",
|
||||
"options": "Patient Name\nNaming Series"
|
||||
},
|
||||
{
|
||||
"default": "1",
|
||||
"description": "If checked, a customer will be created, mapped to Patient.\nPatient Invoices will be created against this Customer. You can also select existing Customer while creating Patient.",
|
||||
"fieldname": "manage_customer",
|
||||
"fieldtype": "Check",
|
||||
"label": "Manage Customer"
|
||||
},
|
||||
{
|
||||
"fieldname": "default_medical_code_standard",
|
||||
"fieldtype": "Link",
|
||||
@@ -78,6 +65,7 @@
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"description": "Checking this will create new Patients with a Disabled status by default and will only be enabled after invoicing the Registration Fee.",
|
||||
"fieldname": "collect_registration_fee",
|
||||
"fieldtype": "Check",
|
||||
"label": "Collect Fee for Patient Registration"
|
||||
@@ -91,27 +79,19 @@
|
||||
"options": "Currency"
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"description": "Manage Appointment Invoice submit and cancel automatically for Patient Encounter",
|
||||
"fieldname": "manage_appointment_invoice_automatically",
|
||||
"fieldtype": "Check",
|
||||
"label": "Invoice Appointments Automatically"
|
||||
},
|
||||
{
|
||||
"fieldname": "max_visit",
|
||||
"fieldtype": "Int",
|
||||
"label": "Patient Encounters in valid days"
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:doc.enable_free_follow_ups == 1",
|
||||
"description": "Time period (Valid number of days) for free consultations",
|
||||
"fieldname": "valid_days",
|
||||
"fieldtype": "Int",
|
||||
"label": "Valid number of days"
|
||||
"label": "Valid Number of Days",
|
||||
"mandatory_depends_on": "eval:doc.enable_free_follow_ups == 1"
|
||||
},
|
||||
{
|
||||
"collapsible": 1,
|
||||
"description": "You can configure default Items for billing consultation charges, procedure consumption items and inpatient visits",
|
||||
"fieldname": "healthcare_service_items",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Healthcare Service Items"
|
||||
"label": "Default Healthcare Service Items"
|
||||
},
|
||||
{
|
||||
"fieldname": "inpatient_visit_charge_item",
|
||||
@@ -141,87 +121,25 @@
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Out Patient SMS Alerts"
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"fieldname": "reg_sms",
|
||||
"fieldtype": "Check",
|
||||
"label": "Patient Registration"
|
||||
},
|
||||
{
|
||||
"default": "Hello {{doc.patient}}, Thank you for registering with {{doc.company}}. Your ID is {{doc.id}} . Please note this ID for future reference. \nThank You, Get well soon!",
|
||||
"depends_on": "reg_sms",
|
||||
"fieldname": "reg_msg",
|
||||
"fieldtype": "Small Text",
|
||||
"ignore_xss_filter": 1,
|
||||
"label": "Registration Message"
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"fieldname": "app_con",
|
||||
"fieldtype": "Check",
|
||||
"label": "Appointment Confirmation"
|
||||
},
|
||||
{
|
||||
"default": "Hello {{doc.patient}}, You have scheduled an appointment with {{doc.practitioner}} by {{doc.start_dt}} at {{doc.company}}.\nThank you, Good day!",
|
||||
"depends_on": "app_con",
|
||||
"fieldname": "app_con_msg",
|
||||
"fieldtype": "Small Text",
|
||||
"ignore_xss_filter": 1,
|
||||
"label": "Confirmation Message"
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"depends_on": "app_con",
|
||||
"description": "Do not confirm if appointment is created for the same day",
|
||||
"fieldname": "no_con",
|
||||
"fieldtype": "Check",
|
||||
"label": "Avoid Confirmation"
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_16",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"fieldname": "app_rem",
|
||||
"fieldtype": "Check",
|
||||
"label": "Appointment Reminder"
|
||||
},
|
||||
{
|
||||
"default": "Hello {{doc.patient}}, You have an appointment with {{doc.practitioner}} by {{doc.appointment_time}} at {{doc.company}}.\nThank you, Good day!\n",
|
||||
"depends_on": "app_rem",
|
||||
"fieldname": "app_rem_msg",
|
||||
"fieldtype": "Small Text",
|
||||
"ignore_xss_filter": 1,
|
||||
"label": "Reminder Message"
|
||||
},
|
||||
{
|
||||
"depends_on": "app_rem",
|
||||
"fieldname": "rem_before",
|
||||
"fieldtype": "Time",
|
||||
"label": "Remind Before"
|
||||
},
|
||||
{
|
||||
"collapsible": 1,
|
||||
"description": "Default income accounts to be used if not set in Healthcare Practitioner to book Appointment charges.",
|
||||
"fieldname": "sb_in_ac",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Income Account"
|
||||
"label": "Default Accounts"
|
||||
},
|
||||
{
|
||||
"description": "Default income accounts to be used if not set in Healthcare Practitioner to book Appointment charges.",
|
||||
"fieldname": "income_account",
|
||||
"fieldtype": "Table",
|
||||
"label": "Income Account",
|
||||
"options": "Party Account"
|
||||
},
|
||||
{
|
||||
"collapsible": 1,
|
||||
"description": "Default receivable accounts to be used if not set in Patient to book Appointment charges.",
|
||||
"fieldname": "sb_r_ac",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Receivable Account"
|
||||
},
|
||||
{
|
||||
"description": "Default receivable accounts to be used to book Appointment charges.",
|
||||
"fieldname": "receivable_account",
|
||||
"fieldtype": "Table",
|
||||
"label": "Receivable Account",
|
||||
@@ -233,31 +151,13 @@
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Laboratory Settings"
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"fieldname": "create_test_on_si_submit",
|
||||
"fieldtype": "Check",
|
||||
"label": "Create Lab Test(s) on Sales Invoice Submit"
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"description": "Create documents for sample collection",
|
||||
"fieldname": "require_sample_collection",
|
||||
"fieldtype": "Check",
|
||||
"label": "Manage Sample Collection"
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"fieldname": "require_test_result_approval",
|
||||
"fieldtype": "Check",
|
||||
"label": "Require Lab Test Approval"
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_34",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"default": "1",
|
||||
"description": "Check this if you want the Name and Designation of the Employee associated with the User who submits the document to be printed in the Lab Test Report.",
|
||||
"fieldname": "employee_name_and_designation_in_print",
|
||||
"fieldtype": "Check",
|
||||
"label": "Employee name and designation in print"
|
||||
@@ -279,7 +179,7 @@
|
||||
"fieldname": "sms_printed",
|
||||
"fieldtype": "Small Text",
|
||||
"ignore_xss_filter": 1,
|
||||
"label": "Result Printed"
|
||||
"label": "Result Printed Message"
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_28",
|
||||
@@ -290,12 +190,123 @@
|
||||
"fieldname": "sms_emailed",
|
||||
"fieldtype": "Small Text",
|
||||
"ignore_xss_filter": 1,
|
||||
"label": "Result Emailed"
|
||||
"label": "Result Emailed Message"
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"description": "Checking this will restrict printing and emailing of Lab Test documents unless they have the status as Approved.",
|
||||
"fieldname": "lab_test_approval_required",
|
||||
"fieldtype": "Check",
|
||||
"label": "Do not print or email Lab Tests without Approval"
|
||||
},
|
||||
{
|
||||
"default": "1",
|
||||
"description": "If checked, a customer will be created, mapped to Patient.\nPatient Invoices will be created against this Customer. You can also select existing Customer while creating Patient.",
|
||||
"fieldname": "link_customer_to_patient",
|
||||
"fieldtype": "Check",
|
||||
"label": "Link Customer to Patient"
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"description": "Checking this will create Lab Test(s) specified in the Sales Invoice on submission.",
|
||||
"fieldname": "create_lab_test_on_si_submit",
|
||||
"fieldtype": "Check",
|
||||
"label": "Create Lab Test(s) on Sales Invoice Submission"
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"description": "Checking this will create a Sample Collection document every time you create a Lab Test",
|
||||
"fieldname": "create_sample_collection_for_lab_test",
|
||||
"fieldtype": "Check",
|
||||
"label": "Create Sample Collection document for Lab Test"
|
||||
},
|
||||
{
|
||||
"fieldname": "patient_name_by",
|
||||
"fieldtype": "Select",
|
||||
"label": "Patient Name By",
|
||||
"options": "Patient Name\nNaming Series"
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"description": "Manage Appointment Invoice submit and cancel automatically for Patient Encounter",
|
||||
"fieldname": "automate_appointment_invoicing",
|
||||
"fieldtype": "Check",
|
||||
"label": "Automate Appointment Invoicing"
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"fieldname": "send_registration_msg",
|
||||
"fieldtype": "Check",
|
||||
"label": "Patient Registration"
|
||||
},
|
||||
{
|
||||
"default": "Hello {{doc.patient}}, Thank you for registering with {{doc.company}}. Your ID is {{doc.id}} . Please note this ID for future reference. \nThank You, Get well soon!",
|
||||
"depends_on": "send_registration_msg",
|
||||
"fieldname": "registration_msg",
|
||||
"fieldtype": "Small Text",
|
||||
"ignore_xss_filter": 1,
|
||||
"label": "Registration Message"
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"fieldname": "send_appointment_confirmation",
|
||||
"fieldtype": "Check",
|
||||
"label": "Appointment Confirmation"
|
||||
},
|
||||
{
|
||||
"default": "Hello {{doc.patient}}, You have scheduled an appointment with {{doc.practitioner}} by {{doc.start_dt}} at {{doc.company}}.\nThank you, Good day!",
|
||||
"depends_on": "send_appointment_confirmation",
|
||||
"fieldname": "appointment_confirmation_msg",
|
||||
"fieldtype": "Small Text",
|
||||
"ignore_xss_filter": 1,
|
||||
"label": "Confirmation Message"
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"depends_on": "send_appointment_confirmation",
|
||||
"description": "Do not confirm if appointment is created for the same day",
|
||||
"fieldname": "avoid_confirmation",
|
||||
"fieldtype": "Check",
|
||||
"label": "Avoid Confirmation"
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"fieldname": "send_appointment_reminder",
|
||||
"fieldtype": "Check",
|
||||
"label": "Appointment Reminder"
|
||||
},
|
||||
{
|
||||
"default": "Hello {{doc.patient}}, You have an appointment with {{doc.practitioner}} by {{doc.appointment_time}} at {{doc.company}}.\nThank you, Good day!\n",
|
||||
"depends_on": "send_appointment_reminder",
|
||||
"fieldname": "appointment_reminder_msg",
|
||||
"fieldtype": "Small Text",
|
||||
"ignore_xss_filter": 1,
|
||||
"label": "Reminder Message"
|
||||
},
|
||||
{
|
||||
"depends_on": "send_appointment_reminder",
|
||||
"fieldname": "remind_before",
|
||||
"fieldtype": "Time",
|
||||
"label": "Remind Before"
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:doc.enable_free_follow_ups == 1",
|
||||
"description": "The number of free follow ups (Patient Encounters in valid days) allowed",
|
||||
"fieldname": "max_visits",
|
||||
"fieldtype": "Int",
|
||||
"label": "Number of Patient Encounters in Valid Days",
|
||||
"mandatory_depends_on": "eval:doc.enable_free_follow_ups == 1"
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"fieldname": "enable_free_follow_ups",
|
||||
"fieldtype": "Check",
|
||||
"label": "Enable Free Follow-ups"
|
||||
}
|
||||
],
|
||||
"issingle": 1,
|
||||
"links": [],
|
||||
"modified": "2020-01-23 13:31:43.699711",
|
||||
"modified": "2020-03-26 11:25:21.842092",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Healthcare",
|
||||
"name": "Healthcare Settings",
|
||||
|
||||
@@ -11,69 +11,80 @@ import json
|
||||
|
||||
class HealthcareSettings(Document):
|
||||
def validate(self):
|
||||
for key in ["collect_registration_fee","manage_customer","patient_master_name",
|
||||
"require_test_result_approval","require_sample_collection", "default_medical_code_standard"]:
|
||||
for key in ['collect_registration_fee', 'link_customer_to_patient', 'patient_name_by',
|
||||
'lab_test_approval_required', 'create_sample_collection_for_lab_test', 'default_medical_code_standard']:
|
||||
frappe.db.set_default(key, self.get(key, ""))
|
||||
if(self.collect_registration_fee):
|
||||
if self.registration_fee <= 0 :
|
||||
frappe.throw(_("Registration fee can not be Zero"))
|
||||
|
||||
if self.collect_registration_fee:
|
||||
if self.registration_fee <= 0:
|
||||
frappe.throw(_('Registration Fee cannot be negative or zero'))
|
||||
|
||||
if self.inpatient_visit_charge_item:
|
||||
validate_service_item(self.inpatient_visit_charge_item, "Configure a service Item for Inpatient Visit Charge Item")
|
||||
validate_service_item(self.inpatient_visit_charge_item)
|
||||
if self.op_consulting_charge_item:
|
||||
validate_service_item(self.op_consulting_charge_item, "Configure a service Item for Out Patient Consulting Charge Item")
|
||||
validate_service_item(self.op_consulting_charge_item)
|
||||
if self.clinical_procedure_consumable_item:
|
||||
validate_service_item(self.clinical_procedure_consumable_item, "Configure a service Item for Clinical Procedure Consumable Item")
|
||||
validate_service_item(self.clinical_procedure_consumable_item)
|
||||
|
||||
|
||||
def validate_service_item(item):
|
||||
if frappe.db.get_value('Item', item, 'is_stock_item'):
|
||||
frappe.throw(_('Configure a service Item for {0}').format(item))
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_sms_text(doc):
|
||||
sms_text = {}
|
||||
doc = frappe.get_doc("Lab Test",doc)
|
||||
#doc = json.loads(doc)
|
||||
context = {"doc": doc, "alert": doc, "comments": None}
|
||||
emailed = frappe.db.get_value("Healthcare Settings", None, "sms_emailed")
|
||||
sms_text['emailed'] = frappe.render_template(emailed, context)
|
||||
printed = frappe.db.get_value("Healthcare Settings", None, "sms_printed")
|
||||
sms_text['printed'] = frappe.render_template(printed, context)
|
||||
return sms_text
|
||||
sms_text = {}
|
||||
doc = frappe.get_doc('Lab Test', doc)
|
||||
context = {'doc': doc, 'alert': doc, 'comments': None}
|
||||
|
||||
emailed = frappe.db.get_value('Healthcare Settings', None, 'sms_emailed')
|
||||
sms_text['emailed'] = frappe.render_template(emailed, context)
|
||||
|
||||
printed = frappe.db.get_value('Healthcare Settings', None, 'sms_printed')
|
||||
sms_text['printed'] = frappe.render_template(printed, context)
|
||||
|
||||
return sms_text
|
||||
|
||||
def send_registration_sms(doc):
|
||||
if (frappe.db.get_value("Healthcare Settings", None, "reg_sms")=='1'):
|
||||
if doc.mobile:
|
||||
context = {"doc": doc, "alert": doc, "comments": None}
|
||||
if doc.get("_comments"):
|
||||
context["comments"] = json.loads(doc.get("_comments"))
|
||||
messages = frappe.db.get_value("Healthcare Settings", None, "reg_msg")
|
||||
messages = frappe.render_template(messages, context)
|
||||
number = [doc.mobile]
|
||||
send_sms(number,messages)
|
||||
else:
|
||||
frappe.msgprint(doc.name + " Has no mobile number to send registration SMS", alert=True)
|
||||
|
||||
if frappe.db.get_single_value('Healthcare Settings', 'send_registration_msg'):
|
||||
if doc.mobile:
|
||||
context = {'doc': doc, 'alert': doc, 'comments': None}
|
||||
if doc.get('_comments'):
|
||||
context['comments'] = json.loads(doc.get('_comments'))
|
||||
messages = frappe.db.get_single_value('Healthcare Settings', 'registration_msg')
|
||||
messages = frappe.render_template(messages, context)
|
||||
number = [doc.mobile]
|
||||
send_sms(number,messages)
|
||||
else:
|
||||
frappe.msgprint(doc.name + ' has no mobile number to send registration SMS', alert=True)
|
||||
|
||||
def get_receivable_account(company):
|
||||
receivable_account = get_account(None, "receivable_account", "Healthcare Settings", company)
|
||||
if receivable_account:
|
||||
return receivable_account
|
||||
return frappe.get_cached_value('Company', company, "default_receivable_account")
|
||||
receivable_account = get_account(None, 'receivable_account', 'Healthcare Settings', company)
|
||||
if receivable_account:
|
||||
return receivable_account
|
||||
|
||||
return frappe.get_cached_value('Company', company, 'default_receivable_account')
|
||||
|
||||
def get_income_account(practitioner, company):
|
||||
if(practitioner):
|
||||
income_account = get_account("Healthcare Practitioner", None, practitioner, company)
|
||||
if income_account:
|
||||
return income_account
|
||||
income_account = get_account(None, "income_account", "Healthcare Settings", company)
|
||||
if income_account:
|
||||
return income_account
|
||||
return frappe.get_cached_value('Company', company, "default_income_account")
|
||||
# check income account in Healthcare Practitioner
|
||||
if practitioner:
|
||||
income_account = get_account('Healthcare Practitioner', None, practitioner, company)
|
||||
if income_account:
|
||||
return income_account
|
||||
|
||||
# else check income account in Healthcare Settings
|
||||
income_account = get_account(None, 'income_account', 'Healthcare Settings', company)
|
||||
if income_account:
|
||||
return income_account
|
||||
|
||||
# else return default income account of company
|
||||
return frappe.get_cached_value('Company', company, 'default_income_account')
|
||||
|
||||
def get_account(parent_type, parent_field, parent, company):
|
||||
if(parent_type):
|
||||
return frappe.db.get_value("Party Account",
|
||||
{"parenttype": parent_type, "parent": parent, "company": company}, "account")
|
||||
if(parent_field):
|
||||
return frappe.db.get_value("Party Account",
|
||||
{"parentfield": parent_field, "parent": parent, "company": company}, "account")
|
||||
if parent_type:
|
||||
return frappe.db.get_value('Party Account',
|
||||
{'parenttype': parent_type, 'parent': parent, 'company': company}, 'account')
|
||||
|
||||
def validate_service_item(item, msg):
|
||||
if frappe.db.get_value("Item", item, "is_stock_item") == 1:
|
||||
frappe.throw(_(msg))
|
||||
if parent_field:
|
||||
return frappe.db.get_value('Party Account',
|
||||
{'parentfield': parent_field, 'parent': parent, 'company': company}, 'account')
|
||||
|
||||
@@ -8,11 +8,12 @@ import unittest
|
||||
from frappe.utils import now_datetime, today
|
||||
from frappe.utils.make_random import get_random
|
||||
from erpnext.healthcare.doctype.inpatient_record.inpatient_record import admit_patient, discharge_patient, schedule_discharge
|
||||
from erpnext.healthcare.doctype.patient_appointment.test_patient_appointment import create_patient
|
||||
|
||||
class TestInpatientRecord(unittest.TestCase):
|
||||
def test_admit_and_discharge(self):
|
||||
frappe.db.sql("""delete from `tabInpatient Record`""")
|
||||
patient = get_patient()
|
||||
patient = create_patient()
|
||||
# Schedule Admission
|
||||
ip_record = create_inpatient(patient)
|
||||
ip_record.save(ignore_permissions = True)
|
||||
@@ -41,7 +42,7 @@ class TestInpatientRecord(unittest.TestCase):
|
||||
|
||||
def test_validate_overlap_admission(self):
|
||||
frappe.db.sql("""delete from `tabInpatient Record`""")
|
||||
patient = get_patient()
|
||||
patient = create_patient()
|
||||
|
||||
ip_record = create_inpatient(patient)
|
||||
ip_record.save(ignore_permissions = True)
|
||||
@@ -75,17 +76,6 @@ def create_inpatient(patient):
|
||||
inpatient_record.scheduled_date = today()
|
||||
return inpatient_record
|
||||
|
||||
def get_patient():
|
||||
patient = get_random("Patient")
|
||||
if not patient:
|
||||
patient = frappe.new_doc("Patient")
|
||||
patient.patient_name = "Test Patient"
|
||||
patient.sex = "Male"
|
||||
patient.save(ignore_permissions=True)
|
||||
return patient.name
|
||||
return patient
|
||||
|
||||
|
||||
def get_healthcare_service_unit():
|
||||
service_unit = get_random("Healthcare Service Unit", filters={"inpatient_occupancy": 1})
|
||||
if not service_unit:
|
||||
|
||||
@@ -1,238 +1,78 @@
|
||||
{
|
||||
"allow_copy": 1,
|
||||
"allow_guest_to_view": 0,
|
||||
"allow_import": 0,
|
||||
"allow_rename": 0,
|
||||
"beta": 1,
|
||||
"creation": "2016-09-16 16:53:06.882970",
|
||||
"custom": 0,
|
||||
"docstatus": 0,
|
||||
"doctype": "DocType",
|
||||
"document_type": "Document",
|
||||
"editable_grid": 1,
|
||||
"actions": [],
|
||||
"allow_copy": 1,
|
||||
"beta": 1,
|
||||
"creation": "2016-09-16 16:53:06.882970",
|
||||
"doctype": "DocType",
|
||||
"document_type": "Document",
|
||||
"editable_grid": 1,
|
||||
"engine": "InnoDB",
|
||||
"field_order": [
|
||||
"lab_test_code",
|
||||
"lab_test_name",
|
||||
"invoiced",
|
||||
"column_break_4",
|
||||
"lab_test_comment",
|
||||
"lab_test_created"
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "lab_test_code",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 1,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Test Code",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Lab Test Template",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"fieldname": "lab_test_code",
|
||||
"fieldtype": "Link",
|
||||
"ignore_user_permissions": 1,
|
||||
"in_list_view": 1,
|
||||
"label": "Lab Test",
|
||||
"options": "Lab Test Template",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fetch_from": "lab_test_code.lab_test_name",
|
||||
"fieldname": "lab_test_name",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Test",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"fetch_from": "lab_test_code.lab_test_name",
|
||||
"fieldname": "lab_test_name",
|
||||
"fieldtype": "Data",
|
||||
"in_list_view": 1,
|
||||
"label": "Lab Test Name"
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"default": "0",
|
||||
"fieldname": "invoiced",
|
||||
"fieldtype": "Check",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Invoiced",
|
||||
"length": 0,
|
||||
"no_copy": 1,
|
||||
"options": "",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 1,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"default": "0",
|
||||
"fieldname": "invoiced",
|
||||
"fieldtype": "Check",
|
||||
"label": "Invoiced",
|
||||
"no_copy": 1,
|
||||
"read_only": 1,
|
||||
"search_index": 1
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "column_break_4",
|
||||
"fieldtype": "Column Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"fieldname": "column_break_4",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "lab_test_comment",
|
||||
"fieldtype": "Small Text",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 1,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Comments",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"fieldname": "lab_test_comment",
|
||||
"fieldtype": "Small Text",
|
||||
"ignore_xss_filter": 1,
|
||||
"in_list_view": 1,
|
||||
"label": "Comments"
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "lab_test_created",
|
||||
"fieldtype": "Check",
|
||||
"hidden": 1,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Test Created",
|
||||
"length": 0,
|
||||
"no_copy": 1,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 1,
|
||||
"reqd": 0,
|
||||
"search_index": 1,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
"default": "0",
|
||||
"fieldname": "lab_test_created",
|
||||
"fieldtype": "Check",
|
||||
"hidden": 1,
|
||||
"label": "Test Created",
|
||||
"no_copy": 1,
|
||||
"print_hide": 1,
|
||||
"report_hide": 1,
|
||||
"search_index": 1
|
||||
}
|
||||
],
|
||||
"has_web_view": 0,
|
||||
"hide_heading": 0,
|
||||
"hide_toolbar": 0,
|
||||
"idx": 0,
|
||||
"image_view": 0,
|
||||
"in_create": 0,
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 1,
|
||||
"max_attachments": 0,
|
||||
"modified": "2018-09-04 09:02:18.592637",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Healthcare",
|
||||
"name": "Lab Prescription",
|
||||
"name_case": "",
|
||||
"owner": "Administrator",
|
||||
"permissions": [],
|
||||
"quick_entry": 0,
|
||||
"read_only": 0,
|
||||
"read_only_onload": 0,
|
||||
"restrict_to_domain": "Healthcare",
|
||||
"show_name_in_global_search": 0,
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"track_changes": 0,
|
||||
"track_seen": 0,
|
||||
"track_views": 0
|
||||
],
|
||||
"istable": 1,
|
||||
"links": [],
|
||||
"modified": "2020-02-26 17:03:00.255560",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Healthcare",
|
||||
"name": "Lab Prescription",
|
||||
"owner": "Administrator",
|
||||
"permissions": [],
|
||||
"restrict_to_domain": "Healthcare",
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC"
|
||||
}
|
||||
@@ -29,7 +29,7 @@ frappe.ui.form.on('Lab Test', {
|
||||
get_lab_test_prescribed(frm);
|
||||
});
|
||||
}
|
||||
if(frm.doc.docstatus==1 && frm.doc.status!='Approved' && frm.doc.status!='Rejected' && frappe.defaults.get_default("require_test_result_approval") && frappe.user.has_role("LabTest Approver")){
|
||||
if(frm.doc.docstatus==1 && frm.doc.status!='Approved' && frm.doc.status!='Rejected' && frappe.defaults.get_default("lab_test_approval_required") && frappe.user.has_role("LabTest Approver")){
|
||||
frm.add_custom_button(__('Approve'), function() {
|
||||
status_update(1,frm);
|
||||
});
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user