Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
b3a26a0
refactor: remove redundant target document fields and link weighbridg…
skibanga Jun 30, 2026
ea7566b
refactor: remove target document type validation logic from Weighbrid…
skibanga Jun 30, 2026
9e68cc0
feat: add fallback to default target doctypes when source-specific ta…
skibanga Jul 1, 2026
3250188
fix: add fallback to Sales Order and validation for empty targets in …
skibanga Jul 1, 2026
bccad03
feat: extend account-to-item sync to support Indirect Income in addit…
skibanga Jul 1, 2026
e4ae1fa
fix(av_tools): remove duplicate amended_from field from inter company…
MariamMabele Jul 1, 2026
3d11eeb
Merge pull request #74 from Aakvatech-Limited/backport-69-to-version-15
skibanga Jul 2, 2026
2b6e132
Merge pull request #79 from Aakvatech-Limited/version-15-hotfix
aakvatech Jul 10, 2026
2276c08
feat: allow non-stock items to be included in weigh bridge processing
skibanga Jul 13, 2026
8ccd138
chore(pyproject.toml): add Frappe version range
Emmafidelis Jun 6, 2026
a405164
Merge pull request #82 from Aakvatech-Limited/backport-56-to-version-15
aakvatech Jul 17, 2026
4bcf8f3
fix: grant Desk User read access to AV Tools Settings
MariamMabele Jul 18, 2026
7797d71
Merge pull request #84 from Aakvatech-Limited/backport-83-to-version-15
aakvatech Jul 18, 2026
f5d0d35
fix: use dict.get for barcode row fields to avoid KeyError.
Emmafidelis Jul 15, 2026
eaa39a9
Merge pull request #85 from Aakvatech-Limited/backport-81-to-version-15
aakvatech Jul 22, 2026
f8ccc9b
feat: route accounts receivable summary customers to general ledger
Emmafidelis Aug 6, 2026
a685b5f
Merge pull request #91 from Aakvatech-Limited/backport-89-to-version-15
aakvatech Aug 6, 2026
6baadec
feat(weigh_bridge): add configurable transport items setting for targ…
skibanga Aug 13, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions av_tools/av_tools/account.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ frappe.ui.form.on("Account", {
frm.set_query("item", function() {
return {
"filters": {
"item_group": "Indirect Expenses"
"item_group": ["in", ["Indirect Expenses", "Indirect Income"]]
}
};
});
Expand All @@ -16,7 +16,7 @@ frappe.ui.form.on("Account", {
create_expenses_item_btn: function (frm) {
frappe.db.get_single_value("AV Tools Settings", "enable_indirect_expense_item_creation").then(function (enabled) {
if (!enabled) return;
frm.add_custom_button(__("Create Expenses Item"), function() {
frm.add_custom_button(__("Create Expense/Income Item"), function() {
frappe.call({
method: 'av_tools.av_tools_hooks.account.add_indirect_expense_item',
args: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,11 +211,15 @@
"role": "System Manager",
"share": 1,
"write": 1
},
{
"read": 1,
"role": "Desk User"
}
],
"row_format": "Dynamic",
"sort_field": "modified",
"sort_order": "DESC",
"states": [],
"track_changes": 1
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ def update_barcodes(doc):
item.append(
"barcodes",
{
"barcode": barcode["barcode"],
"barcode_type": barcode["barcode_type"],
"uom": barcode["uom"],
"barcode": barcode.get("barcode"),
"barcode_type": barcode.get("barcode_type"),
"uom": barcode.get("uom"),
},
)
item.save(ignore_permissions=True)
Expand Down
68 changes: 41 additions & 27 deletions av_tools/av_tools_hooks/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,64 +15,78 @@ def create_indirect_expense_item(doc, method=None):
if frappe.local.flags.ignore_root_company_validation:
return

if (
not doc.parent_account
or doc.is_group
or not check_expenses_in_parent_accounts(doc.name)
or not doc.company
):
is_income = doc.root_type == "Income"
is_expense = doc.root_type == "Expense"

if not doc.company or doc.is_group or not (is_income or is_expense):
return
if (
not doc.parent_account
and not check_expenses_in_parent_accounts(doc.account_name)
and doc.item
):
doc.item = ""

if not check_expenses_in_parent_accounts(doc.name):
# Unlink the item if it was moved out of Indirect Expenses/Income
if doc.item:
doc.item = ""
return
indirect_expenses_group = frappe.db.exists("Item Group", "Indirect Expenses")
if not indirect_expenses_group:
indirect_expenses_group = frappe.get_doc(

item_group_name = "Indirect Income" if is_income else "Indirect Expenses"
if not frappe.db.exists("Item Group", item_group_name):
ig = frappe.get_doc(
dict(
doctype="Item Group",
item_group_name="Indirect Expenses",
item_group_name=item_group_name,
)
)
indirect_expenses_group.flags.ignore_permissions = True
ig.flags.ignore_permissions = True
frappe.flags.ignore_account_permission = True
indirect_expenses_group.save()
ig.save()

item = frappe.db.exists("Item", doc.account_name)
if item:
item = frappe.get_doc("Item", doc.account_name)
doc.item = item.name

if is_income:
item.is_sales_item = 1
elif is_expense:
item.is_purchase_item = 1

company_list = []
for i in item.item_defaults:
if doc.company not in company_list:
if i.company == doc.company:
company_list.append(doc.company)
if i.expense_account != doc.name:
if is_expense and i.expense_account != doc.name:
i.expense_account = doc.name
item.save()
elif is_income and i.default_income_account != doc.name:
i.default_income_account = doc.name
item.save()
if doc.company not in company_list:
row = item.append("item_defaults", {})
row.company = doc.company
row.expense_account = doc.name
if is_expense:
row.expense_account = doc.name
elif is_income:
row.default_income_account = doc.name
item.save()
company_list.append(doc.company)
doc.db_update()
return item.name

new_item = frappe.get_doc(
dict(
doctype="Item",
item_code=doc.account_name,
item_group="Indirect Expenses",
item_group=item_group_name,
is_stock_item=0,
is_sales_item=0,
is_sales_item=1 if is_income else 0,
is_purchase_item=1 if is_expense else 0,
stock_uom="Nos",
include_item_in_manufacturing=0,
item_defaults=[
{
"company": doc.company,
"expense_account": doc.name,
"expense_account": doc.name if is_expense else "",
"default_income_account": doc.name if is_income else "",
"default_warehouse": "",
}
],
Expand All @@ -94,13 +108,13 @@ def create_indirect_expense_item(doc, method=None):

def check_expenses_in_parent_accounts(account_name):
parent_account_1 = frappe.get_value("Account", account_name, "parent_account")
if "Indirect Expenses" in str(parent_account_1):
if "Indirect Expenses" in str(parent_account_1) or "Indirect Income" in str(parent_account_1):
return True
parent_account_2 = frappe.get_value("Account", parent_account_1, "parent_account")
if "Indirect Expenses" in str(parent_account_2):
if "Indirect Expenses" in str(parent_account_2) or "Indirect Income" in str(parent_account_2):
return True
parent_account_3 = frappe.get_value("Account", parent_account_2, "parent_account")
if "Indirect Expenses" in str(parent_account_3):
if "Indirect Expenses" in str(parent_account_3) or "Indirect Income" in str(parent_account_3):
return True
return False

Expand All @@ -109,7 +123,7 @@ def check_expenses_in_parent_accounts(account_name):
def add_indirect_expense_item(account_name):
if not _is_feature_enabled():
frappe.throw(
_("Indirect Expense Item auto-creation is disabled. Enable it in AV Tools Settings.")
_("Indirect Expense/Income Item auto-creation is disabled. Enable it in AV Tools Settings.")
)
account = frappe.get_doc("Account", account_name)
return create_indirect_expense_item(account)
Loading
Loading