Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: only show advance payment entries where "book_advance_payments_in_separate_party_account" is true (backport #44545) #44616

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,8 @@ max_line_length = 110
[{*.json}]
insert_final_newline = false
indent_style = space
<<<<<<< HEAD
indent_size = 2
=======
indent_size = 1
>>>>>>> d847f75ade (chore: remove 'debug' param and linter fix)
15 changes: 15 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,20 @@ b147b85e6ac19a9220cd1e2958a6ebd99373283a
# bulk format python code with black
baec607ff5905b1c67531096a9cf50ec7ff00a5d

<<<<<<< HEAD
# ruff
960ef14b7a68cfec9e309ec12845f521cb6a721c
=======
# bulk refactor with sourcery
eb9ee3f79b94e594fc6dfa4f6514580e125eee8c

# js formatting
ec74a5e56617bbd76ac402451468fd4668af543d

# ruff formatting
a308792ee7fda18a681e9181f4fd00b36385bc23

# noisy typing refactoring of get_item_details
7b7211ac79c248a79ba8a999ff34e734d874c0ae
d827ed21adc7b36047e247cbb0dc6388d048a7f9
>>>>>>> d847f75ade (chore: remove 'debug' param and linter fix)
14 changes: 14 additions & 0 deletions .github/helper/documentation.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import sys
<<<<<<< HEAD
import requests
from urllib.parse import urlparse

=======
from urllib.parse import urlparse

import requests
>>>>>>> d847f75ade (chore: remove 'debug' param and linter fix)

WEBSITE_REPOS = [
"erpnext_com",
Expand Down Expand Up @@ -36,11 +42,15 @@ def is_documentation_link(word: str) -> bool:


def contains_documentation_link(body: str) -> bool:
<<<<<<< HEAD
return any(
is_documentation_link(word)
for line in body.splitlines()
for word in line.split()
)
=======
return any(is_documentation_link(word) for line in body.splitlines() for word in line.split())
>>>>>>> d847f75ade (chore: remove 'debug' param and linter fix)


def check_pull_request(number: str) -> "tuple[int, str]":
Expand All @@ -53,12 +63,16 @@ def check_pull_request(number: str) -> "tuple[int, str]":
head_sha = (payload.get("head") or {}).get("sha")
body = (payload.get("body") or "").lower()

<<<<<<< HEAD
if (
not title.startswith("feat")
or not head_sha
or "no-docs" in body
or "backport" in body
):
=======
if not title.startswith("feat") or not head_sha or "no-docs" in body or "backport" in body:
>>>>>>> d847f75ade (chore: remove 'debug' param and linter fix)
return 0, "Skipping documentation checks... 🏃"

if contains_documentation_link(body):
Expand Down
13 changes: 13 additions & 0 deletions .github/helper/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,22 @@ pip install frappe-bench

githubbranch=${GITHUB_BASE_REF:-${GITHUB_REF##*/}}
frappeuser=${FRAPPE_USER:-"frappe"}
<<<<<<< HEAD
frappebranch=${FRAPPE_BRANCH:-$githubbranch}

git clone "https://github.com/${frappeuser}/frappe" --branch "${frappebranch}" --depth 1
=======
frappecommitish=${FRAPPE_BRANCH:-$githubbranch}

mkdir frappe
pushd frappe
git init
git remote add origin "https://github.com/${frappeuser}/frappe"
git fetch origin "${frappecommitish}" --depth 1
git checkout FETCH_HEAD
popd

>>>>>>> d847f75ade (chore: remove 'debug' param and linter fix)
bench init --skip-assets --frappe-path ~/frappe --python "$(which python)" frappe-bench

mkdir ~/frappe-bench/sites/test_site
Expand Down
68 changes: 68 additions & 0 deletions .github/helper/translation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import re
import sys

errors_encounter = 0
pattern = re.compile(
r"_\(([\"']{,3})(?P<message>((?!\1).)*)\1(\s*,\s*context\s*=\s*([\"'])(?P<py_context>((?!\5).)*)\5)*(\s*,(\s*?.*?\n*?)*(,\s*([\"'])(?P<js_context>((?!\11).)*)\11)*)*\)"
)
words_pattern = re.compile(r"_{1,2}\([\"'`]{1,3}.*?[a-zA-Z]")
start_pattern = re.compile(r"_{1,2}\([f\"'`]{1,3}")
f_string_pattern = re.compile(r"_\(f[\"']")
starts_with_f_pattern = re.compile(r"_\(f")

# skip first argument
files = sys.argv[1:]
files_to_scan = [_file for _file in files if _file.endswith((".py", ".js"))]

for _file in files_to_scan:
with open(_file) as f:
print(f"Checking: {_file}")
file_lines = f.readlines()
for line_number, line in enumerate(file_lines, 1):
if "frappe-lint: disable-translate" in line:
continue

start_matches = start_pattern.search(line)
if start_matches:
starts_with_f = starts_with_f_pattern.search(line)

if starts_with_f:
has_f_string = f_string_pattern.search(line)
if has_f_string:
errors_encounter += 1
print(
f"\nF-strings are not supported for translations at line number {line_number}\n{line.strip()[:100]}"
)
continue
else:
continue

match = pattern.search(line)
error_found = False

if not match and line.endswith((",\n", "[\n")):
# concat remaining text to validate multiline pattern
line = "".join(file_lines[line_number - 1 :])
line = line[start_matches.start() + 1 :]
match = pattern.match(line)

if not match:
error_found = True
print(f"\nTranslation syntax error at line number {line_number}\n{line.strip()[:100]}")

if not error_found and not words_pattern.search(line):
error_found = True
print(
f"\nTranslation is useless because it has no words at line number {line_number}\n{line.strip()[:100]}"
)

if error_found:
errors_encounter += 1

if errors_encounter > 0:
print(
'\nVisit "https://frappeframework.com/docs/user/en/translations" to learn about valid translation strings.'
)
sys.exit(1)
else:
print("\nGood To Go!")
40 changes: 40 additions & 0 deletions .github/helper/update_pot_file.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/bash
set -e
cd ~ || exit

echo "Setting Up Bench..."

pip install frappe-bench
bench -v init frappe-bench --skip-assets --skip-redis-config-generation --python "$(which python)"
cd ./frappe-bench || exit

echo "Get ERPNext..."
bench get-app --skip-assets erpnext "${GITHUB_WORKSPACE}"

echo "Generating POT file..."
bench generate-pot-file --app erpnext

cd ./apps/erpnext || exit

echo "Configuring git user..."
git config user.email "[email protected]"
git config user.name "frappe-pr-bot"

echo "Setting the correct git remote..."
# Here, the git remote is a local file path by default. Let's change it to the upstream repo.
git remote set-url upstream https://github.com/frappe/erpnext.git

echo "Creating a new branch..."
isodate=$(date -u +"%Y-%m-%d")
branch_name="pot_${BASE_BRANCH}_${isodate}"
git checkout -b "${branch_name}"

echo "Commiting changes..."
git add erpnext/locale/main.pot
git commit -m "chore: update POT file"

gh auth setup-git
git push -u upstream "${branch_name}"

echo "Creating a PR..."
gh pr create --fill --base "${BASE_BRANCH}" --head "${branch_name}" --reviewer ${PR_REVIEWER} -R frappe/erpnext
11 changes: 11 additions & 0 deletions .github/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,17 @@ exemptProjects: true
# Set to true to ignore issues in a milestone (defaults to false)
exemptMilestones: true

<<<<<<< HEAD
=======
# Skip the stale action for draft PRs
exemptDraftPr: true

# Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable
exemptLabels:
- hotfix
- no-stale

>>>>>>> d847f75ade (chore: remove 'debug' param and linter fix)
pulls:
daysUntilStale: 15
daysUntilClose: 3
Expand Down
26 changes: 26 additions & 0 deletions .github/workflows/backport.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Backport
on:
pull_request_target:
types:
- closed
- labeled

jobs:
main:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Checkout Actions
uses: actions/checkout@v2
with:
repository: "frappe/backport"
path: ./actions
ref: develop
- name: Install Actions
run: npm install --production --prefix ./actions
- name: Run backport
uses: ./actions/backport
with:
token: ${{secrets.RELEASE_TOKEN}}
labelsToAdd: "backport"
title: "{{originalTitle}}"
39 changes: 39 additions & 0 deletions .github/workflows/generate-pot-file.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# This workflow is agnostic to branches. Only maintain on develop branch.
# To add/remove branches just modify the matrix.

name: Regenerate POT file (translatable strings)
on:
schedule:
# 9:30 UTC => 3 PM IST Sunday
- cron: "30 9 * * 0"
workflow_dispatch:

jobs:
regenerate-pot-file:
name: Regenerate POT file
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
branch: ["develop"]
permissions:
contents: write

steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ matrix.branch }}

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Run script to update POT file
run: |
bash ${GITHUB_WORKSPACE}/.github/helper/update_pot_file.sh
env:
GH_TOKEN: ${{ secrets.RELEASE_TOKEN }}
BASE_BRANCH: ${{ matrix.branch }}
PR_REVIEWER: barredterra # change to your GitHub username if you copied this file
32 changes: 32 additions & 0 deletions .github/workflows/initiate_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# This workflow is agnostic to branches. Only maintain on develop branch.
# To add/remove versions just modify the matrix.

name: Create weekly release pull requests
on:
schedule:
# 9:30 UTC => 3 PM IST Tuesday
- cron: "30 9 * * 2"
workflow_dispatch:

jobs:
stable-release:
name: Release
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
version: ["14", "15"]

steps:
- uses: octokit/[email protected]
with:
route: POST /repos/{owner}/{repo}/pulls
owner: frappe
repo: erpnext
title: |-
"chore: release v${{ matrix.version }}"
body: "Automated weekly release."
base: version-${{ matrix.version }}
head: version-${{ matrix.version }}-hotfix
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
15 changes: 15 additions & 0 deletions .github/workflows/linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,21 @@ jobs:
- name: Install and Run Pre-commit
uses: pre-commit/[email protected]

<<<<<<< HEAD
=======
semgrep:
name: semgrep
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: '3.10'
cache: pip

>>>>>>> d847f75ade (chore: remove 'debug' param and linter fix)
- name: Download Semgrep rules
run: git clone --depth 1 https://github.com/frappe/semgrep-rules.git frappe-semgrep-rules

Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/lock.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: 'Lock threads'

on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:

permissions:
issues: write
pull-requests: write


jobs:
lock:
runs-on: ubuntu-latest
steps:
- uses: dessant/lock-threads@v5
with:
github-token: ${{ github.token }}
issue-inactive-days: 14
pr-inactive-days: 14
Loading
Loading