mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-15 12:55:10 +00:00
fix: logical error in where condition of qb query
(cherry picked from commit 47f8a86003)
# Conflicts:
# erpnext/stock/doctype/landed_cost_taxes_and_charges/landed_cost_taxes_and_charges.json
This commit is contained in:
@@ -1404,7 +1404,7 @@ def add_operations_cost(stock_entry, work_order=None, expense_account=None):
|
|||||||
query = (
|
query = (
|
||||||
frappe.qb.from_(table)
|
frappe.qb.from_(table)
|
||||||
.select(Sum(table.amount).as_("amount"))
|
.select(Sum(table.amount).as_("amount"))
|
||||||
.where(table.parent.isin(subquery) & (table.description == "Corrective Operation Cost"))
|
.where(table.parent.isin(subquery) & (table.has_corrective_cost == 1))
|
||||||
)
|
)
|
||||||
return query.run(as_dict=True)[0].amount or 0
|
return query.run(as_dict=True)[0].amount or 0
|
||||||
|
|
||||||
@@ -1424,6 +1424,7 @@ def add_operations_cost(stock_entry, work_order=None, expense_account=None):
|
|||||||
{
|
{
|
||||||
"expense_account": expense_account,
|
"expense_account": expense_account,
|
||||||
"description": "Corrective Operation Cost",
|
"description": "Corrective Operation Cost",
|
||||||
|
"has_corrective_cost": 1,
|
||||||
"amount": remaining_cc / max_qty * flt(stock_entry.fg_completed_qty),
|
"amount": remaining_cc / max_qty * flt(stock_entry.fg_completed_qty),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -11,7 +11,8 @@
|
|||||||
"description",
|
"description",
|
||||||
"col_break3",
|
"col_break3",
|
||||||
"amount",
|
"amount",
|
||||||
"base_amount"
|
"base_amount",
|
||||||
|
"has_corrective_cost"
|
||||||
],
|
],
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
@@ -62,12 +63,23 @@
|
|||||||
"label": "Amount (Company Currency)",
|
"label": "Amount (Company Currency)",
|
||||||
"options": "Company:company:default_currency",
|
"options": "Company:company:default_currency",
|
||||||
"read_only": 1
|
"read_only": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"default": "0",
|
||||||
|
"fieldname": "has_corrective_cost",
|
||||||
|
"fieldtype": "Check",
|
||||||
|
"label": "Has Corrective Cost",
|
||||||
|
"read_only": 1
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"istable": 1,
|
"istable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
|
<<<<<<< HEAD
|
||||||
"modified": "2021-05-17 13:57:10.807980",
|
"modified": "2021-05-17 13:57:10.807980",
|
||||||
|
=======
|
||||||
|
"modified": "2025-01-20 12:22:03.455762",
|
||||||
|
>>>>>>> 47f8a86003 (fix: logical error in where condition of qb query)
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Stock",
|
"module": "Stock",
|
||||||
"name": "Landed Cost Taxes and Charges",
|
"name": "Landed Cost Taxes and Charges",
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ class LandedCostTaxesandCharges(Document):
|
|||||||
description: DF.SmallText
|
description: DF.SmallText
|
||||||
exchange_rate: DF.Float
|
exchange_rate: DF.Float
|
||||||
expense_account: DF.Link | None
|
expense_account: DF.Link | None
|
||||||
|
has_corrective_cost: DF.Check
|
||||||
parent: DF.Data
|
parent: DF.Data
|
||||||
parentfield: DF.Data
|
parentfield: DF.Data
|
||||||
parenttype: DF.Data
|
parenttype: DF.Data
|
||||||
|
|||||||
Reference in New Issue
Block a user