diff --git a/.github/helper/install.sh b/.github/helper/install.sh index ee92ddd645..f6f0cad31a 100644 --- a/.github/helper/install.sh +++ b/.github/helper/install.sh @@ -1,10 +1,8 @@ #!/bin/bash -cd ~ || exit +set -e -# shellcheck disable=SC1091 -source ./.nvm/nvm.sh -nvm install 12 +cd ~ || exit pip install frappe-bench diff --git a/.github/helper/install_dependencies.sh b/.github/helper/install_dependencies.sh index 0ca509ef94..9be8519d85 100644 --- a/.github/helper/install_dependencies.sh +++ b/.github/helper/install_dependencies.sh @@ -1,9 +1,11 @@ #!/bin/bash -python "${GITHUB_WORKSPACE}/.github/helper/roulette.py" -if [[ $? != 2 ]];then - exit; -fi +set -e + +# python "${GITHUB_WORKSPACE}/.github/helper/roulette.py" +# if [[ $? != 2 ]];then +# exit; +# fi # install wkhtmltopdf wget -O /tmp/wkhtmltox.tar.xz https://github.com/frappe/wkhtmltopdf/raw/master/wkhtmltox-0.12.3_linux-generic-amd64.tar.xz diff --git a/.github/helper/roulette.py b/.github/helper/roulette.py index 4d83137199..ba775d6794 100644 --- a/.github/helper/roulette.py +++ b/.github/helper/roulette.py @@ -24,10 +24,12 @@ def is_docs(file): if __name__ == "__main__": build_type = os.environ.get("TYPE") - commit_range = os.environ.get("TRAVIS_COMMIT_RANGE") + before = os.environ.get("BEFORE") + after = os.environ.get("AFTER") + commit_range = before + '...' + after print("Build Type: {}".format(build_type)) print("Commit Range: {}".format(commit_range)) - + try: files_changed = get_output("git diff --name-only {}".format(commit_range), shell=False) except Exception: diff --git a/.github/helper/run_tests.sh b/.github/helper/run_tests.sh deleted file mode 100644 index d7d50650da..0000000000 --- a/.github/helper/run_tests.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash - -cd ~/frappe-bench/ || exit - -if [ "$TYPE" == "server" ]; then - - if [ "$DB" == "mariadb" ]; then - bench --verbose --site test_site run-tests --coverage - fi - - if [ "$DB" == "postgres" ]; then - bench --verbose --site test_site run-tests --coverage - fi - -fi - -if [ "$TYPE" == "ui" ]; then - bench --site test_site execute frappe.utils.install.complete_setup_wizard - bench --site test_site run-ui-tests frappe --headless -fi \ No newline at end of file diff --git a/.github/workflows/ci-tests.yml b/.github/workflows/ci-tests.yml index 83b34ece3a..1464446c82 100644 --- a/.github/workflows/ci-tests.yml +++ b/.github/workflows/ci-tests.yml @@ -15,12 +15,17 @@ jobs: - DB: "mariadb" TYPE: "server" JOB_NAME: "Python MariaDB" + RUN_COMMAND: bench --verbose --site test_site run-tests --coverage + - DB: "postgres" TYPE: "server" JOB_NAME: "Python PostgreSQL" + RUN_COMMAND: bench --verbose --site test_site run-tests --coverage + - DB: "mariadb" TYPE: "ui" JOB_NAME: "UI MariaDB" + RUN_COMMAND: bench --site test_site run-ui-tests frappe --headless name: ${{ matrix.JOB_NAME }} @@ -54,6 +59,11 @@ jobs: with: python-version: 3.7 + - uses: actions/setup-node@v2 + with: + node-version: '12' + check-latest: true + - name: Add to Hosts run: | echo "127.0.0.1 test_site" | sudo tee -a /etc/hosts @@ -103,6 +113,10 @@ jobs: - name: Install Dependencies run: bash ${GITHUB_WORKSPACE}/.github/helper/install_dependencies.sh + env: + BEFORE: ${{ env.GITHUB_EVENT_PATH.before }} + AFTER: ${{ env.GITHUB_EVENT_PATH.after }} + TYPE: ${{ matrix.TYPE }} - name: Install run: bash ${GITHUB_WORKSPACE}/.github/helper/install.sh @@ -110,8 +124,15 @@ jobs: DB: ${{ matrix.DB }} TYPE: ${{ matrix.TYPE }} + - name: Run Set-Up + if: matrix.TYPE == 'ui' + run: cd ~/frappe-bench/ && bench --site test_site execute frappe.utils.install.complete_setup_wizard + env: + DB: ${{ matrix.DB }} + TYPE: ${{ matrix.TYPE }} + - name: Run Tests - run: bash ${GITHUB_WORKSPACE}/.github/helper/run_tests.sh + run: cd ~/frappe-bench/ && ${{ matrix.RUN_COMMAND }} env: DB: ${{ matrix.DB }} TYPE: ${{ matrix.TYPE }} diff --git a/frappe/commands/utils.py b/frappe/commands/utils.py index b3f85d13ad..5ff66171fc 100644 --- a/frappe/commands/utils.py +++ b/frappe/commands/utils.py @@ -483,7 +483,6 @@ def console(context): @click.option('--doctype', help="For DocType") @click.option('--doctype-list-path', help="Path to .txt file for list of doctypes. Example erpnext/tests/server/agriculture.txt") @click.option('--test', multiple=True, help="Specific test") -@click.option('--driver', help="For Travis") @click.option('--ui-tests', is_flag=True, default=False, help="Run UI Tests") @click.option('--module', help="Run tests in a module") @click.option('--profile', is_flag=True, default=False) @@ -493,9 +492,9 @@ def console(context): @click.option('--junit-xml-output', help="Destination file path for junit xml report") @click.option('--failfast', is_flag=True, default=False) @pass_context -def run_tests(context, app=None, module=None, doctype=None, test=(), - driver=None, profile=False, coverage=False, junit_xml_output=False, ui_tests = False, - doctype_list_path=None, skip_test_records=False, skip_before_tests=False, failfast=False): +def run_tests(context, app=None, module=None, doctype=None, test=(), profile=False, + coverage=False, junit_xml_output=False, ui_tests = False, doctype_list_path=None, + skip_test_records=False, skip_before_tests=False, failfast=False): "Run tests" import frappe.test_runner @@ -535,8 +534,8 @@ def run_tests(context, app=None, module=None, doctype=None, test=(), cov.start() ret = frappe.test_runner.main(app, module, doctype, context.verbose, tests=tests, - force=context.force, profile=profile, junit_xml_output=junit_xml_output, - ui_tests=ui_tests, doctype_list_path=doctype_list_path, failfast=failfast) + force=context.force, profile=profile, junit_xml_output=junit_xml_output, + ui_tests=ui_tests, doctype_list_path=doctype_list_path, failfast=failfast) if coverage: cov.stop() diff --git a/frappe/model/base_document.py b/frappe/model/base_document.py index c1e5f01e03..de0c1e0e1c 100644 --- a/frappe/model/base_document.py +++ b/frappe/model/base_document.py @@ -856,6 +856,11 @@ class BaseDocument(object): from frappe.model.meta import get_default_df df = get_default_df(fieldname) + if not currency: + currency = self.get(df.get("options")) + if not frappe.db.exists('Currency', currency, cache=True): + currency = None + val = self.get(fieldname) if translated: diff --git a/frappe/public/js/frappe/desk.js b/frappe/public/js/frappe/desk.js index d59bd4cdb7..250d308b7e 100644 --- a/frappe/public/js/frappe/desk.js +++ b/frappe/public/js/frappe/desk.js @@ -173,6 +173,9 @@ frappe.Application = Class.extend({ frappe.router.route(); } frappe.after_ajax(() => frappe.flags.setting_original_route = false); + frappe.router.on('change', () => { + $(".tooltip").hide(); + }); }, setup_frappe_vue() { diff --git a/frappe/public/js/frappe/form/controls/select.js b/frappe/public/js/frappe/form/controls/select.js index 2ea32e032c..0fcfadb47d 100644 --- a/frappe/public/js/frappe/form/controls/select.js +++ b/frappe/public/js/frappe/form/controls/select.js @@ -96,7 +96,7 @@ frappe.ui.form.ControlSelect = frappe.ui.form.ControlData.extend({ } }, toggle_placeholder: function() { - const input_set = Boolean(this.$input.val()); + const input_set = Boolean(this.$input.find('option:selected').text()); this.$wrapper.find('.placeholder').toggle(!input_set); } }); diff --git a/frappe/public/js/frappe/ui/messages.js b/frappe/public/js/frappe/ui/messages.js index a4b1ad9f79..b3cbef1b8e 100644 --- a/frappe/public/js/frappe/ui/messages.js +++ b/frappe/public/js/frappe/ui/messages.js @@ -357,7 +357,7 @@ frappe.show_alert = function(message, seconds=7, actions={}) { 'yellow': "solid-warning", 'blue': "solid-success", 'green': "solid-success", - 'red': "solid-red" + 'red': "solid-error" }; if (typeof message==='string') { diff --git a/frappe/public/js/frappe/ui/page.js b/frappe/public/js/frappe/ui/page.js index 705d1ac8cd..96e31c7d62 100644 --- a/frappe/public/js/frappe/ui/page.js +++ b/frappe/public/js/frappe/ui/page.js @@ -537,7 +537,7 @@ frappe.ui.Page = Class.extend({ }, get_inner_group_button: function(label) { - return this.inner_toolbar.find(`.inner-group-button[data-label="${encodeURIComponent(label)}"`); + return this.inner_toolbar.find(`.inner-group-button[data-label="${encodeURIComponent(label)}"]`); }, set_inner_btn_group_as_primary: function(label) { diff --git a/frappe/public/js/frappe/web_form/web_form.js b/frappe/public/js/frappe/web_form/web_form.js index 0421147d49..c490c5c66c 100644 --- a/frappe/public/js/frappe/web_form/web_form.js +++ b/frappe/public/js/frappe/web_form/web_form.js @@ -88,15 +88,15 @@ export default class WebForm extends frappe.ui.FieldGroup { setup_delete_button() { this.add_button_to_header( - '', - "light", + frappe.utils.icon('delete'), + "danger", () => this.delete() ); } setup_print_button() { this.add_button_to_header( - '', + frappe.utils.icon('print'), "light", () => this.print() ); diff --git a/frappe/public/scss/common/form.scss b/frappe/public/scss/common/form.scss new file mode 100644 index 0000000000..2fa6ab619e --- /dev/null +++ b/frappe/public/scss/common/form.scss @@ -0,0 +1,29 @@ +.form-control { + border: none; + font-size: var(--text-md); + position: relative; +} + +.form-control.bold { + font-weight: 500; +} + +.like-disabled-input { + .for-description { + font-weight: normal; + font-size: var(--text-sm); + } + min-height: var(--input-height); + border-radius: $border-radius; + font-weight: 400; + padding: 8px 12px; + cursor: default; + color: var(--disabled-text-color); + background-color: var(--disabled-control-bg); +} + +.head-title { + font-size: var(--text-lg); + font-weight: 700; + color: var(--heading-color); +} \ No newline at end of file diff --git a/frappe/public/scss/desk/quill.scss b/frappe/public/scss/common/quill.scss similarity index 100% rename from frappe/public/scss/desk/quill.scss rename to frappe/public/scss/common/quill.scss diff --git a/frappe/public/scss/desk/form.scss b/frappe/public/scss/desk/form.scss index 9f22d9283a..0bb686f045 100644 --- a/frappe/public/scss/desk/form.scss +++ b/frappe/public/scss/desk/form.scss @@ -1,8 +1,4 @@ -.form-control { - border: none; - font-size: var(--text-md); - position: relative; -} +@import "../common/form.scss"; .form-section, .form-dashboard-section { margin: 0px; @@ -82,24 +78,6 @@ text-align: right; } -.form-control.bold { - font-weight: 500; -} - -.like-disabled-input { - .for-description { - font-weight: normal; - font-size: var(--text-sm); - } - min-height: var(--input-height); - border-radius: $border-radius; - font-weight: 400; - padding: 8px 12px; - cursor: default; - color: var(--disabled-text-color); - background-color: var(--disabled-control-bg); -} - .form-control:disabled, .form-control[readonly] { cursor: not-allowed; } diff --git a/frappe/public/scss/desk/index.scss b/frappe/public/scss/desk/index.scss index 5f5fef251b..f7449640fd 100644 --- a/frappe/public/scss/desk/index.scss +++ b/frappe/public/scss/desk/index.scss @@ -43,5 +43,5 @@ @import "user_profile"; @import "theme_switcher"; @import "link_preview"; -@import "quill"; +@import "../common/quill"; @import "plyr"; diff --git a/frappe/public/scss/print.scss b/frappe/public/scss/print.scss index 2539ff82d2..a610299159 100644 --- a/frappe/public/scss/print.scss +++ b/frappe/public/scss/print.scss @@ -1,5 +1,5 @@ // @import "~bootstrap/scss/bootstrap"; -@import './desk/quill'; +@import './common/quill'; @import "./desk/css_variables"; diff --git a/frappe/public/scss/website/index.scss b/frappe/public/scss/website/index.scss index c6b3771562..de81174d3b 100644 --- a/frappe/public/scss/website/index.scss +++ b/frappe/public/scss/website/index.scss @@ -1,6 +1,4 @@ -@import '~quill/dist/quill.core'; -@import '~quill/dist/quill.snow.css'; -@import '~quill/dist/quill.bubble.css'; +@import '../common/quill'; @import 'variables'; @import '~bootstrap/scss/bootstrap'; @import "../common/mixins"; @@ -15,6 +13,7 @@ @import 'multilevel_dropdown'; @import 'website_image'; @import 'website_avatar'; +@import 'web_form'; @import 'page_builder'; @import 'blog'; @import 'markdown'; diff --git a/frappe/public/scss/website/web_form.scss b/frappe/public/scss/website/web_form.scss new file mode 100644 index 0000000000..48f77000bf --- /dev/null +++ b/frappe/public/scss/website/web_form.scss @@ -0,0 +1,17 @@ +@import "../common/form"; + +.web-form-wrapper { + .form-control { + color: var(--text-color); + } + + .form-column { + &:first-child { + padding-left: 0; + } + + &:last-child { + padding-right: 0; + } + } +} \ No newline at end of file diff --git a/frappe/templates/includes/list/list.html b/frappe/templates/includes/list/list.html index cfe25f3682..fba5f20ed5 100644 --- a/frappe/templates/includes/list/list.html +++ b/frappe/templates/includes/list/list.html @@ -18,7 +18,7 @@ {{ item }} {% endfor %} - diff --git a/frappe/website/doctype/web_form/templates/web_form.html b/frappe/website/doctype/web_form/templates/web_form.html index 228898df66..96bd9209cc 100644 --- a/frappe/website/doctype/web_form/templates/web_form.html +++ b/frappe/website/doctype/web_form/templates/web_form.html @@ -62,7 +62,7 @@ data-web-form="{{ name }}" data-web-form-doctype="{{ doc_type }}" data-login-req {% endif %} {# attachments #} {% if allow_comments and not frappe.form_dict.new and not is_list -%} -
+

{{ _("Comments") }}

{% include 'templates/includes/comments/comments.html' %}
diff --git a/frappe/www/app.py b/frappe/www/app.py index 79b430019e..6088c413dc 100644 --- a/frappe/www/app.py +++ b/frappe/www/app.py @@ -12,10 +12,10 @@ from frappe import _ import frappe.sessions def get_context(context): - # if frappe.session.user == "Guest": - # frappe.throw(_("Log in to access this page."), frappe.PermissionError) - # elif frappe.db.get_value("User", frappe.session.user, "user_type") == "Website User": - # frappe.throw(_("You are not permitted to access this page."), frappe.PermissionError) + if frappe.session.user == "Guest": + frappe.throw(_("Log in to access this page."), frappe.PermissionError) + elif frappe.db.get_value("User", frappe.session.user, "user_type") == "Website User": + frappe.throw(_("You are not permitted to access this page."), frappe.PermissionError) hooks = frappe.get_hooks() try: diff --git a/frappe/www/login.html b/frappe/www/login.html index 2edec28375..338e572309 100644 --- a/frappe/www/login.html +++ b/frappe/www/login.html @@ -85,7 +85,10 @@
+ {% if provider.icon %} + {{ provider.icon }} + {% endif %} + {{ _("Login With {0}").format(provider.provider_name) }}
{% endfor %}

{{ _("or") }}

diff --git a/frappe/www/login.py b/frappe/www/login.py index 54d3ccfb1e..76b232f8ee 100644 --- a/frappe/www/login.py +++ b/frappe/www/login.py @@ -25,7 +25,7 @@ def get_context(context): redirect_to = get_home_page() else: redirect_to = "/app" - + if redirect_to != 'login': frappe.local.flags.redirect_location = redirect_to raise frappe.Redirect @@ -44,11 +44,13 @@ def get_context(context): client_secret = get_decrypted_password("Social Login Key", provider, "client_secret") provider_name = frappe.get_value("Social Login Key", provider, "provider_name") - if provider_name != "Custom": - icon_url = frappe.get_value("Social Login Key", provider, "icon") - icon = "{1}".format(icon_url, provider_name) - else: - icon = get_icon_html(frappe.get_value("Social Login Key", provider, "icon"), small=True) + icon = None + icon_url = frappe.get_value("Social Login Key", provider, "icon") + if icon_url: + if provider_name != "Custom": + icon = "{1}".format(icon_url, provider_name) + else: + icon = get_icon_html(icon_url, small=True) if (get_oauth_keys(provider) and client_secret and client_id and base_url): context.provider_logins.append({ diff --git a/package.json b/package.json index 43cedc158a..40bed18cb7 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "driver.js": "^0.9.8", "express": "^4.17.1", "fast-deep-equal": "^2.0.1", - "frappe-charts": "^2.0.0-rc5", + "frappe-charts": "^2.0.0-rc10", "frappe-datatable": "^1.15.3", "frappe-gantt": "^0.5.0", "fuse.js": "^3.4.6", diff --git a/yarn.lock b/yarn.lock index daca81cfda..921c174e6c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2467,10 +2467,10 @@ fragment-cache@^0.2.1: dependencies: map-cache "^0.2.2" -frappe-charts@^2.0.0-rc5: - version "2.0.0-rc5" - resolved "https://registry.yarnpkg.com/frappe-charts/-/frappe-charts-2.0.0-rc5.tgz#16f5c744c3cdb134a41bb4581ea3c816e6b8601f" - integrity sha512-4wEsSeGVlEBxr3qA2FF/CTrn+XRjf73txdID+vEBhr22Osc+wcJNhY5sJWFtq4wrihz3WHFnNOTGu+uUNdb0lw== +frappe-charts@^2.0.0-rc10: + version "2.0.0-rc10" + resolved "https://registry.yarnpkg.com/frappe-charts/-/frappe-charts-2.0.0-rc10.tgz#6e4cfbb99eb48374f78c0c048e1b04f278a3848a" + integrity sha512-qj1yFdBF7e0aW6xES/SK7cb4plimcm63ENG/0HOMKprijNj0V938/v9uhe1lSATvuqu65pPkHNbt93zfCLx9gQ== frappe-datatable@^1.15.3: version "1.15.3"