From 2a619fd7890d542f9c6fa28594c0dae97cfb683a Mon Sep 17 00:00:00 2001 From: gn306029 Date: Wed, 29 Jun 2022 17:15:21 +0800 Subject: [PATCH 1/9] fix: Modify opts parameter misspell (#31476) Modify opts parameter misspell closes #31474 --- erpnext/buying/doctype/purchase_order/purchase_order.js | 2 +- erpnext/public/js/utils.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.js b/erpnext/buying/doctype/purchase_order/purchase_order.js index da45610eaf..33dbe3f468 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.js +++ b/erpnext/buying/doctype/purchase_order/purchase_order.js @@ -425,7 +425,7 @@ erpnext.buying.PurchaseOrderController = class PurchaseOrderController extends e company: me.frm.doc.company }, allow_child_item_selection: true, - child_fielname: "items", + child_fieldname: "items", child_columns: ["item_code", "qty"] }) }, __("Get Items From")); diff --git a/erpnext/public/js/utils.js b/erpnext/public/js/utils.js index 01710f1e41..096175a68d 100755 --- a/erpnext/public/js/utils.js +++ b/erpnext/public/js/utils.js @@ -713,7 +713,7 @@ erpnext.utils.map_current_doc = function(opts) { get_query: opts.get_query, add_filters_group: 1, allow_child_item_selection: opts.allow_child_item_selection, - child_fieldname: opts.child_fielname, + child_fieldname: opts.child_fieldname, child_columns: opts.child_columns, size: opts.size, action: function(selections, args) { From 8a13ddc2f2be2e4ad465e85d41e76f78167cd71f Mon Sep 17 00:00:00 2001 From: Devin Slauenwhite Date: Wed, 29 Jun 2022 12:28:24 -0400 Subject: [PATCH 2/9] fix: gain/loss can be income or expense --- erpnext/setup/doctype/company/company.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/setup/doctype/company/company.js b/erpnext/setup/doctype/company/company.js index 0de5b2d5a3..3dec303a92 100644 --- a/erpnext/setup/doctype/company/company.js +++ b/erpnext/setup/doctype/company/company.js @@ -219,8 +219,8 @@ erpnext.company.setup_queries = function(frm) { ["default_discount_account", {}], ["discount_allowed_account", {"root_type": "Expense"}], ["discount_received_account", {"root_type": "Income"}], - ["exchange_gain_loss_account", {"root_type": "Expense"}], - ["unrealized_exchange_gain_loss_account", {"root_type": "Expense"}], + ["exchange_gain_loss_account", {"root_type": ["in", ["Expense", "Income"]]}], + ["unrealized_exchange_gain_loss_account", {"root_type": ["in", ["Expense", "Income"]]}], ["accumulated_depreciation_account", {"root_type": "Asset", "account_type": "Accumulated Depreciation"}], ["depreciation_expense_account", {"root_type": "Expense", "account_type": "Depreciation"}], From 56c6a709cdc8f50b6a1b49b4b58685de1fd64eee Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Thu, 30 Jun 2022 11:35:45 +0530 Subject: [PATCH 3/9] ci: bump container count for unittests (#31490) [skip ci] --- .github/workflows/server-tests-mariadb.yml | 2 +- .github/workflows/server-tests-postgres.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/server-tests-mariadb.yml b/.github/workflows/server-tests-mariadb.yml index cdb68499ff..91a0114004 100644 --- a/.github/workflows/server-tests-mariadb.yml +++ b/.github/workflows/server-tests-mariadb.yml @@ -39,7 +39,7 @@ jobs: fail-fast: false matrix: - container: [1, 2, 3] + container: [1, 2, 3, 4] name: Python Unit Tests diff --git a/.github/workflows/server-tests-postgres.yml b/.github/workflows/server-tests-postgres.yml index 77d3c1ae61..d3268e25b3 100644 --- a/.github/workflows/server-tests-postgres.yml +++ b/.github/workflows/server-tests-postgres.yml @@ -21,7 +21,7 @@ jobs: strategy: fail-fast: false matrix: - container: [1, 2, 3] + container: [1] name: Python Unit Tests From 20f85195f45f5b311e9ba02d82d08f0036928809 Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Wed, 29 Jun 2022 12:23:17 +0530 Subject: [PATCH 4/9] build!: declarative builds --- .github/workflows/patch.yml | 2 +- .github/workflows/server-tests-mariadb.yml | 2 +- .github/workflows/server-tests-postgres.yml | 2 +- CODEOWNERS | 2 +- pyproject.toml | 29 +++++++++++++++++++++ requirements.txt | 11 -------- setup.py | 25 +++--------------- 7 files changed, 37 insertions(+), 36 deletions(-) delete mode 100644 requirements.txt diff --git a/.github/workflows/patch.yml b/.github/workflows/patch.yml index 2cf44444cc..4d8c51d942 100644 --- a/.github/workflows/patch.yml +++ b/.github/workflows/patch.yml @@ -52,7 +52,7 @@ jobs: uses: actions/cache@v2 with: path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} + key: ${{ runner.os }}-pip-${{ hashFiles('**/*requirements.txt', '**/pyproject.toml') }} restore-keys: | ${{ runner.os }}-pip- ${{ runner.os }}- diff --git a/.github/workflows/server-tests-mariadb.yml b/.github/workflows/server-tests-mariadb.yml index 91a0114004..9dcc6560f9 100644 --- a/.github/workflows/server-tests-mariadb.yml +++ b/.github/workflows/server-tests-mariadb.yml @@ -74,7 +74,7 @@ jobs: uses: actions/cache@v2 with: path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} + key: ${{ runner.os }}-pip-${{ hashFiles('**/*requirements.txt', '**/pyproject.toml') }} restore-keys: | ${{ runner.os }}-pip- ${{ runner.os }}- diff --git a/.github/workflows/server-tests-postgres.yml b/.github/workflows/server-tests-postgres.yml index d3268e25b3..f62c22b0df 100644 --- a/.github/workflows/server-tests-postgres.yml +++ b/.github/workflows/server-tests-postgres.yml @@ -61,7 +61,7 @@ jobs: uses: actions/cache@v2 with: path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} + key: ${{ runner.os }}-pip-${{ hashFiles('**/*requirements.txt', '**/pyproject.toml') }} restore-keys: | ${{ runner.os }}-pip- ${{ runner.os }}- diff --git a/CODEOWNERS b/CODEOWNERS index bfc2601088..f0cb37919a 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -32,4 +32,4 @@ erpnext/patches/ @deepeshgarg007 @nextchamp-saqib @marination @an erpnext/public/ @nextchamp-saqib @marination .github/ @ankush -requirements.txt @gavindsouza +pyproject.toml @gavindsouza @ankush diff --git a/pyproject.toml b/pyproject.toml index 8043dd9906..b39c4f072f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,32 @@ +[project] +name = "erpnext" +authors = [ + { name = "Frappe Technologies Pvt Ltd", email = "developers@frappe.io"} +] +description = "Open Source ERP" +requires-python = ">=3.8" +readme = "README.md" +dynamic = ["version"] +dependencies = [ + # Core dependencies + "pycountry~=20.7.3", + "python-stdnum~=1.16", + "Unidecode~=1.2.0", + "redisearch~=2.1.0", + + # integration dependencies + "gocardless-pro~=1.22.0", + "googlemaps", + "plaid-python~=7.2.1", + "python-youtube~=0.8.0", + "taxjar~=1.9.2", + "tweepy~=3.10.0", +] + +[build-system] +requires = ["flit_core >=3.4,<4"] +build-backend = "flit_core.buildapi" + [tool.black] line-length = 99 diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 83e53758be..0000000000 --- a/requirements.txt +++ /dev/null @@ -1,11 +0,0 @@ -# frappe # https://github.com/frappe/frappe is installed during bench-init -gocardless-pro~=1.22.0 -googlemaps -plaid-python~=7.2.1 -pycountry~=20.7.3 -python-stdnum~=1.16 -python-youtube~=0.8.0 -taxjar~=1.9.2 -tweepy~=3.10.0 -Unidecode~=1.2.0 -redisearch~=2.1.0 diff --git a/setup.py b/setup.py index 1faff0412f..0ea4d07348 100644 --- a/setup.py +++ b/setup.py @@ -1,23 +1,6 @@ -from setuptools import setup, find_packages -import re, ast +# TODO: Remove this file when v15.0.0 is released +from setuptools import setup -# get version from __version__ variable in erpnext/__init__.py -_version_re = re.compile(r"__version__\s+=\s+(.*)") +name = "frappe" -with open("requirements.txt") as f: - install_requires = f.read().strip().split("\n") - -with open("erpnext/__init__.py", "rb") as f: - version = str(ast.literal_eval(_version_re.search(f.read().decode("utf-8")).group(1))) - -setup( - name="erpnext", - version=version, - description="Open Source ERP", - author="Frappe Technologies", - author_email="info@erpnext.com", - packages=find_packages(), - zip_safe=False, - include_package_data=True, - install_requires=install_requires, -) +setup() From 0e3872aceba70aa00941b535ec1a688b64c6fd3e Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Wed, 29 Jun 2022 12:15:05 +0530 Subject: [PATCH 5/9] chore(meta): update CODEOWNERS Co-authored-by: Nabin Hait --- CODEOWNERS | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/CODEOWNERS b/CODEOWNERS index f0cb37919a..ecbae86d96 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -3,32 +3,29 @@ # These owners will be the default owners for everything in # the repo. Unless a later match takes precedence, -erpnext/accounts/ @nextchamp-saqib @deepeshgarg007 -erpnext/assets/ @nextchamp-saqib @deepeshgarg007 -erpnext/erpnext_integrations/ @nextchamp-saqib +erpnext/accounts/ @nextchamp-saqib @deepeshgarg007 @ruthra-kumar +erpnext/assets/ @nextchamp-saqib @deepeshgarg007 @ruthra-kumar erpnext/loan_management/ @nextchamp-saqib @deepeshgarg007 -erpnext/regional @nextchamp-saqib @deepeshgarg007 -erpnext/selling @nextchamp-saqib @deepeshgarg007 +erpnext/regional @nextchamp-saqib @deepeshgarg007 @ruthra-kumar +erpnext/selling @nextchamp-saqib @deepeshgarg007 @ruthra-kumar erpnext/support/ @nextchamp-saqib @deepeshgarg007 pos* @nextchamp-saqib -erpnext/buying/ @marination @rohitwaghchaure @ankush +erpnext/buying/ @marination @rohitwaghchaure @s-aga-r erpnext/e_commerce/ @marination -erpnext/maintenance/ @marination @rohitwaghchaure -erpnext/manufacturing/ @marination @rohitwaghchaure @ankush +erpnext/maintenance/ @marination @rohitwaghchaure @s-aga-r +erpnext/manufacturing/ @marination @rohitwaghchaure @s-aga-r erpnext/portal/ @marination -erpnext/quality_management/ @marination @rohitwaghchaure +erpnext/quality_management/ @marination @rohitwaghchaure @s-aga-r erpnext/shopping_cart/ @marination -erpnext/stock/ @marination @rohitwaghchaure @ankush +erpnext/stock/ @marination @rohitwaghchaure @s-aga-r -erpnext/crm/ @ruchamahabal @pateljannat -erpnext/education/ @ruchamahabal @pateljannat -erpnext/hr/ @ruchamahabal @pateljannat -erpnext/payroll @ruchamahabal @pateljannat -erpnext/projects/ @ruchamahabal @pateljannat +erpnext/crm/ @NagariaHussain +erpnext/education/ @rutwikhdev +erpnext/projects/ @ruchamahabal -erpnext/controllers/ @deepeshgarg007 @nextchamp-saqib @rohitwaghchaure @marination @ankush -erpnext/patches/ @deepeshgarg007 @nextchamp-saqib @marination @ankush +erpnext/controllers/ @deepeshgarg007 @nextchamp-saqib @rohitwaghchaure @marination +erpnext/patches/ @deepeshgarg007 @nextchamp-saqib @marination erpnext/public/ @nextchamp-saqib @marination .github/ @ankush From cd0450b102367e1a5bb19561661049cced3f7727 Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Wed, 29 Jun 2022 19:24:52 +0530 Subject: [PATCH 6/9] refactor: move dev-dependencies to pyproject --- dev-requirements.txt | 1 - pyproject.toml | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) delete mode 100644 dev-requirements.txt diff --git a/dev-requirements.txt b/dev-requirements.txt deleted file mode 100644 index 15545c0efa..0000000000 --- a/dev-requirements.txt +++ /dev/null @@ -1 +0,0 @@ -hypothesis~=6.31.0 diff --git a/pyproject.toml b/pyproject.toml index b39c4f072f..d446c9b39e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -27,6 +27,9 @@ dependencies = [ requires = ["flit_core >=3.4,<4"] build-backend = "flit_core.buildapi" +[tool.bench.dev-dependencies] +hypothesis = "~=6.31.0" + [tool.black] line-length = 99 From 57d08b7cdf13f7c2c48098d3eb91004913d04f3e Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Thu, 30 Jun 2022 15:49:43 +0530 Subject: [PATCH 7/9] build!: bump min python required to 3.10 --- .github/workflows/docs-checker.yml | 2 +- .github/workflows/patch.yml | 2 +- .github/workflows/server-tests-mariadb.yml | 2 +- .github/workflows/server-tests-postgres.yml | 2 +- pyproject.toml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/docs-checker.yml b/.github/workflows/docs-checker.yml index b644568d5e..722c1252ed 100644 --- a/.github/workflows/docs-checker.yml +++ b/.github/workflows/docs-checker.yml @@ -12,7 +12,7 @@ jobs: - name: 'Setup Environment' uses: actions/setup-python@v2 with: - python-version: 3.8 + python-version: '3.10' - name: 'Clone repo' uses: actions/checkout@v2 diff --git a/.github/workflows/patch.yml b/.github/workflows/patch.yml index 4d8c51d942..4e00870cab 100644 --- a/.github/workflows/patch.yml +++ b/.github/workflows/patch.yml @@ -37,7 +37,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v2 with: - python-version: 3.8 + python-version: '3.10' - name: Setup Node uses: actions/setup-node@v2 diff --git a/.github/workflows/server-tests-mariadb.yml b/.github/workflows/server-tests-mariadb.yml index 9dcc6560f9..f65cb460f1 100644 --- a/.github/workflows/server-tests-mariadb.yml +++ b/.github/workflows/server-tests-mariadb.yml @@ -59,7 +59,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v2 with: - python-version: 3.8 + python-version: '3.10' - name: Setup Node uses: actions/setup-node@v2 diff --git a/.github/workflows/server-tests-postgres.yml b/.github/workflows/server-tests-postgres.yml index f62c22b0df..53a94dbfac 100644 --- a/.github/workflows/server-tests-postgres.yml +++ b/.github/workflows/server-tests-postgres.yml @@ -46,7 +46,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v2 with: - python-version: 3.8 + python-version: '3.10' - name: Setup Node uses: actions/setup-node@v2 diff --git a/pyproject.toml b/pyproject.toml index d446c9b39e..5acfd39272 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ authors = [ { name = "Frappe Technologies Pvt Ltd", email = "developers@frappe.io"} ] description = "Open Source ERP" -requires-python = ">=3.8" +requires-python = ">=3.10" readme = "README.md" dynamic = ["version"] dependencies = [ From b9f394a794cecde36d95740f812afe985c4adc9d Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Thu, 30 Jun 2022 16:20:59 +0530 Subject: [PATCH 8/9] ci: patch test w/ diff python versions Co-Authored-By: Gavin D'souza --- .github/workflows/patch.yml | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/.github/workflows/patch.yml b/.github/workflows/patch.yml index 4e00870cab..a71db7289a 100644 --- a/.github/workflows/patch.yml +++ b/.github/workflows/patch.yml @@ -35,9 +35,9 @@ jobs: uses: actions/checkout@v2 - name: Setup Python - uses: actions/setup-python@v2 + uses: "gabrielfalcao/pyenv-action@v9" with: - python-version: '3.10' + versions: 3.10:latest, 3.7:latest - name: Setup Node uses: actions/setup-node@v2 @@ -82,7 +82,10 @@ jobs: ${{ runner.os }}-yarn- - name: Install - run: bash ${GITHUB_WORKSPACE}/.github/helper/install.sh + run: | + pip install frappe-bench + pyenv global $(pyenv versions | grep '3.10') + bash ${GITHUB_WORKSPACE}/.github/helper/install.sh env: DB: mariadb TYPE: server @@ -96,18 +99,23 @@ jobs: git -C "apps/frappe" remote set-url upstream https://github.com/frappe/frappe.git git -C "apps/erpnext" remote set-url upstream https://github.com/frappe/erpnext.git + pyenv global $(pyenv versions | grep '3.7') for version in $(seq 12 13) do echo "Updating to v$version" branch_name="version-$version-hotfix" + git -C "apps/frappe" fetch --depth 1 upstream $branch_name:$branch_name git -C "apps/erpnext" fetch --depth 1 upstream $branch_name:$branch_name git -C "apps/frappe" checkout -q -f $branch_name git -C "apps/erpnext" checkout -q -f $branch_name - bench setup requirements --python + rm -rf ~/frappe-bench/env + bench setup env + bench pip install -e ./apps/erpnext + bench --site test_site migrate done @@ -115,5 +123,10 @@ jobs: echo "Updating to latest version" git -C "apps/frappe" checkout -q -f "${GITHUB_BASE_REF:-${GITHUB_REF##*/}}" git -C "apps/erpnext" checkout -q -f "$GITHUB_SHA" - bench setup requirements --python + + pyenv global $(pyenv versions | grep '3.10') + rm -rf ~/frappe-bench/env + bench -v setup env + bench pip install -e ./apps/erpnext + bench --site test_site migrate From 7b093e580386e260dadda3ebb335ea1384c7a679 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Fri, 1 Jul 2022 10:35:59 +0530 Subject: [PATCH 9/9] fix(Salary Slip): Components not updated when amount evaluates to 0 due to payment days (backport #31425) (#31432) Co-authored-by: Rucha Mahabal --- erpnext/payroll/doctype/salary_slip/salary_slip.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/erpnext/payroll/doctype/salary_slip/salary_slip.py b/erpnext/payroll/doctype/salary_slip/salary_slip.py index e1ccc117e7..7b7d0571b6 100644 --- a/erpnext/payroll/doctype/salary_slip/salary_slip.py +++ b/erpnext/payroll/doctype/salary_slip/salary_slip.py @@ -624,7 +624,7 @@ class SalarySlip(TransactionBase): data = self.get_data_for_eval() for struct_row in self._salary_structure_doc.get(component_type): amount = self.eval_condition_and_formula(struct_row, data) - if amount and struct_row.statistical_component == 0: + if amount is not None and struct_row.statistical_component == 0: self.update_component_row(struct_row, amount, component_type) def get_data_for_eval(self): @@ -854,6 +854,10 @@ class SalarySlip(TransactionBase): component_row, joining_date, relieving_date )[0] + # remove 0 valued components that have been updated later + if component_row.amount == 0: + self.remove(component_row) + def set_precision_for_component_amounts(self): for component_type in ("earnings", "deductions"): for component_row in self.get(component_type):