diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index aa7cc233..773a9ff6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -4,7 +4,7 @@ fail_fast: false repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v5.0.0 + rev: v4.3.0 hooks: - id: trailing-whitespace files: 'beam.*' @@ -20,42 +20,43 @@ repos: - id: debug-statements - repo: https://github.com/asottile/pyupgrade - rev: v3.19.1 + rev: v2.34.0 hooks: - id: pyupgrade - args: ['--py310-plus'] + args: ['--py38-plus'] - - repo: https://github.com/agritheory/black + - repo: https://github.com/frappe/black rev: 951ccf4d5bb0d692b457a5ebc4215d755618eb68 hooks: - id: black - - repo: https://github.com/PyCQA/autoflake - rev: v2.3.1 + - repo: local hooks: - - id: autoflake - args: [--remove-all-unused-imports, --in-place] + - id: prettier + name: prettier + entry: npx prettier . --write --ignore-path .prettierignore + language: node - repo: https://github.com/PyCQA/isort - rev: 6.0.0 + rev: 5.12.0 hooks: - id: isort - repo: https://github.com/PyCQA/flake8 - rev: 7.1.1 + rev: 5.0.4 hooks: - id: flake8 additional_dependencies: ['flake8-bugbear'] - repo: https://github.com/codespell-project/codespell - rev: v2.4.1 + rev: v2.3.0 hooks: - id: codespell additional_dependencies: - tomli - repo: https://github.com/agritheory/test_utils - rev: v0.17.0 + rev: v1.0.0 hooks: - id: update_pre_commit_config - id: validate_copyright @@ -65,13 +66,6 @@ repos: args: ['--app', 'beam'] - id: validate_customizations - - repo: local - hooks: - - id: prettier - name: prettier - entry: npx prettier . --write --ignore-path .prettierignore - language: node - ci: autoupdate_schedule: weekly skip: [] diff --git a/beam/docs/scale.md b/beam/docs/scale.md new file mode 100644 index 00000000..18c8ed6b --- /dev/null +++ b/beam/docs/scale.md @@ -0,0 +1,7 @@ + + +# Using the scale features + +The WebHID protocol is not supported in all browsers, [look here for compatibility](https://developer.mozilla.org/en-US/docs/Web/API/WebHID_API#browser_compatibility) + diff --git a/beam/public/js/beam.bundle.js b/beam/public/js/beam.bundle.js index 70eaa466..4a3b6e4d 100644 --- a/beam/public/js/beam.bundle.js +++ b/beam/public/js/beam.bundle.js @@ -4,3 +4,4 @@ import './scan/scan.js' import './print/print.js' // import './example_custom_callback.js' +import './scale/scale.js' diff --git a/beam/public/js/scale/scale.js b/beam/public/js/scale/scale.js new file mode 100644 index 00000000..b4203631 --- /dev/null +++ b/beam/public/js/scale/scale.js @@ -0,0 +1,57 @@ +// Copyright (c) 2025, AgriTheory and contributors +// For license information, please see license.txt + +frappe.ui.form.on('Purchase Receipt', { + async refresh(frm) { + await setup_scale(frm) + }, +}) + +async function setup_scale(frm) { + $('.form-sidebar').append(`
0.0 oz
+ +