Merge pull request #37108 from ruthra-kumar/better_asset_validation_on_returns
fix: asset validation misfire on debit notes
diff --git a/.github/helper/install.sh b/.github/helper/install.sh
index 48337ce..d1a97f8 100644
--- a/.github/helper/install.sh
+++ b/.github/helper/install.sh
@@ -68,6 +68,6 @@
wait $wkpid
-bench start &> bench_run_logs.txt &
+bench start &>> ~/frappe-bench/bench_start.log &
CI=Yes bench build --app frappe &
bench --site test_site reinstall --yes
diff --git a/.github/workflows/patch.yml b/.github/workflows/patch.yml
index aae2928..07b8de7 100644
--- a/.github/workflows/patch.yml
+++ b/.github/workflows/patch.yml
@@ -23,7 +23,7 @@
services:
mysql:
- image: mariadb:10.3
+ image: mariadb:10.6
env:
MARIADB_ROOT_PASSWORD: 'root'
ports:
@@ -45,9 +45,7 @@
- name: Setup Python
uses: "actions/setup-python@v4"
with:
- python-version: |
- 3.7
- 3.10
+ python-version: '3.10'
- name: Setup Node
uses: actions/setup-node@v2
@@ -102,40 +100,60 @@
- name: Run Patch Tests
run: |
cd ~/frappe-bench/
- wget https://erpnext.com/files/v10-erpnext.sql.gz
- bench --site test_site --force restore ~/frappe-bench/v10-erpnext.sql.gz
+ bench remove-app payments --force
+ jq 'del(.install_apps)' ~/frappe-bench/sites/test_site/site_config.json > tmp.json
+ mv tmp.json ~/frappe-bench/sites/test_site/site_config.json
+
+ wget https://erpnext.com/files/v13-erpnext.sql.gz
+ bench --site test_site --force restore ~/frappe-bench/v13-erpnext.sql.gz
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
- 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
+ function update_to_version() {
+ version=$1
- git -C "apps/frappe" checkout -q -f $branch_name
- git -C "apps/erpnext" checkout -q -f $branch_name
+ branch_name="version-$version-hotfix"
+ echo "Updating to v$version"
- rm -rf ~/frappe-bench/env
- bench setup env --python python3.7
- bench pip install -e ./apps/payments
- bench pip install -e ./apps/erpnext
+ # Fetch and checkout branches
+ 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 --site test_site migrate
- done
+ # Resetup env and install apps
+ pgrep honcho | xargs kill
+ rm -rf ~/frappe-bench/env
+ bench -v setup env
+ bench pip install -e ./apps/erpnext
+ bench start &>> ~/frappe-bench/bench_start.log &
+ bench --site test_site migrate
+ }
+
+ update_to_version 14
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"
+ pgrep honcho | xargs kill
rm -rf ~/frappe-bench/env
- bench -v setup env --python python3.10
- bench pip install -e ./apps/payments
+ bench -v setup env
bench pip install -e ./apps/erpnext
+ bench start &>> ~/frappe-bench/bench_start.log &
bench --site test_site migrate
- bench --site test_site install-app payments
+
+ - name: Show bench output
+ if: ${{ always() }}
+ run: |
+ cd ~/frappe-bench
+ cat bench_start.log || true
+ cd logs
+ for f in ./*.log*; do
+ echo "Printing log: $f";
+ cat $f
+ done
diff --git a/.github/workflows/server-tests-mariadb.yml b/.github/workflows/server-tests-mariadb.yml
index 2ce1125..559be06 100644
--- a/.github/workflows/server-tests-mariadb.yml
+++ b/.github/workflows/server-tests-mariadb.yml
@@ -123,6 +123,10 @@
CI_BUILD_ID: ${{ github.run_id }}
ORCHESTRATOR_URL: http://test-orchestrator.frappe.io
+ - name: Show bench output
+ if: ${{ always() }}
+ run: cat ~/frappe-bench/bench_start.log || true
+
- name: Upload coverage data
uses: actions/upload-artifact@v3
with:
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
index efe9741..c8c9ad1 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
@@ -161,6 +161,7 @@
}
this.frm.set_df_property("tax_withholding_category", "hidden", doc.apply_tds ? 0 : 1);
+ erpnext.accounts.unreconcile_payments.add_unreconcile_btn(me.frm);
}
unblock_invoice() {
diff --git a/erpnext/buying/report/requested_items_to_order_and_receive/requested_items_to_order_and_receive.py b/erpnext/buying/report/requested_items_to_order_and_receive/requested_items_to_order_and_receive.py
index 21241e0..0718735 100644
--- a/erpnext/buying/report/requested_items_to_order_and_receive/requested_items_to_order_and_receive.py
+++ b/erpnext/buying/report/requested_items_to_order_and_receive/requested_items_to_order_and_receive.py
@@ -7,7 +7,7 @@
import frappe
from frappe import _
from frappe.query_builder.functions import Coalesce, Sum
-from frappe.utils import date_diff, flt, getdate
+from frappe.utils import cint, date_diff, flt, getdate
def execute(filters=None):
@@ -47,8 +47,10 @@
mr.transaction_date.as_("date"),
mr_item.schedule_date.as_("required_date"),
mr_item.item_code.as_("item_code"),
- Sum(Coalesce(mr_item.stock_qty, 0)).as_("qty"),
- Coalesce(mr_item.stock_uom, "").as_("uom"),
+ Sum(Coalesce(mr_item.qty, 0)).as_("qty"),
+ Sum(Coalesce(mr_item.stock_qty, 0)).as_("stock_qty"),
+ Coalesce(mr_item.uom, "").as_("uom"),
+ Coalesce(mr_item.stock_uom, "").as_("stock_uom"),
Sum(Coalesce(mr_item.ordered_qty, 0)).as_("ordered_qty"),
Sum(Coalesce(mr_item.received_qty, 0)).as_("received_qty"),
(Sum(Coalesce(mr_item.stock_qty, 0)) - Sum(Coalesce(mr_item.received_qty, 0))).as_(
@@ -96,7 +98,7 @@
def update_qty_columns(row_to_update, data_row):
- fields = ["qty", "ordered_qty", "received_qty", "qty_to_receive", "qty_to_order"]
+ fields = ["qty", "stock_qty", "ordered_qty", "received_qty", "qty_to_receive", "qty_to_order"]
for field in fields:
row_to_update[field] += flt(data_row[field])
@@ -104,16 +106,20 @@
def prepare_data(data, filters):
"""Prepare consolidated Report data and Chart data"""
material_request_map, item_qty_map = {}, {}
+ precision = cint(frappe.db.get_default("float_precision")) or 2
for row in data:
# item wise map for charts
if not row["item_code"] in item_qty_map:
item_qty_map[row["item_code"]] = {
- "qty": row["qty"],
- "ordered_qty": row["ordered_qty"],
- "received_qty": row["received_qty"],
- "qty_to_receive": row["qty_to_receive"],
- "qty_to_order": row["qty_to_order"],
+ "qty": flt(row["stock_qty"], precision),
+ "stock_qty": flt(row["stock_qty"], precision),
+ "stock_uom": row["stock_uom"],
+ "uom": row["uom"],
+ "ordered_qty": flt(row["ordered_qty"], precision),
+ "received_qty": flt(row["received_qty"], precision),
+ "qty_to_receive": flt(row["qty_to_receive"], precision),
+ "qty_to_order": flt(row["qty_to_order"], precision),
}
else:
item_entry = item_qty_map[row["item_code"]]
@@ -200,21 +206,34 @@
{"label": _("Item Name"), "fieldname": "item_name", "fieldtype": "Data", "width": 100},
{"label": _("Description"), "fieldname": "description", "fieldtype": "Data", "width": 200},
{
- "label": _("Stock UOM"),
+ "label": _("UOM"),
"fieldname": "uom",
"fieldtype": "Data",
"width": 100,
},
+ {
+ "label": _("Stock UOM"),
+ "fieldname": "stock_uom",
+ "fieldtype": "Data",
+ "width": 100,
+ },
]
)
columns.extend(
[
{
- "label": _("Stock Qty"),
+ "label": _("Qty"),
"fieldname": "qty",
"fieldtype": "Float",
- "width": 120,
+ "width": 140,
+ "convertible": "qty",
+ },
+ {
+ "label": _("Qty in Stock UOM"),
+ "fieldname": "stock_qty",
+ "fieldtype": "Float",
+ "width": 140,
"convertible": "qty",
},
{
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index 7a07f56..d0ee2e4 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -339,9 +339,6 @@
erpnext.patches.v15_0.remove_exotel_integration
erpnext.patches.v14_0.single_to_multi_dunning
execute:frappe.db.set_single_value('Selling Settings', 'allow_negative_rates_for_items', 0)
-execute:frappe.delete_doc('DocType', 'Twitter Settings', ignore_missing=True)
-execute:frappe.delete_doc('DocType', 'LinkedIn Settings', ignore_missing=True)
-execute:frappe.delete_doc('DocType', 'Social Media Post', ignore_missing=True)
erpnext.patches.v15_0.correct_asset_value_if_je_with_workflow
erpnext.patches.v15_0.delete_woocommerce_settings_doctype
# below migration patch should always run last
diff --git a/erpnext/public/js/utils/unreconcile.js b/erpnext/public/js/utils/unreconcile.js
index acc77a6..bbdd51d 100644
--- a/erpnext/public/js/utils/unreconcile.js
+++ b/erpnext/public/js/utils/unreconcile.js
@@ -19,7 +19,7 @@
if (r.message) {
frm.add_custom_button(__("Un-Reconcile"), function() {
erpnext.accounts.unreconcile_payments.build_unreconcile_dialog(frm);
- });
+ }, __('Actions'));
}
}
});