mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-26 16:34:46 +00:00
Merge pull request #35393 from frappe/version-13-hotfix
chore: release v13
This commit is contained in:
@@ -169,21 +169,18 @@ class PeriodClosingVoucher(AccountsController):
|
|||||||
return frappe.db.sql(
|
return frappe.db.sql(
|
||||||
"""
|
"""
|
||||||
select
|
select
|
||||||
t2.account_currency,
|
t1.account_currency,
|
||||||
{dimension_fields},
|
{dimension_fields},
|
||||||
sum(t1.debit_in_account_currency) - sum(t1.credit_in_account_currency) as bal_in_account_currency,
|
sum(t1.debit_in_account_currency) - sum(t1.credit_in_account_currency) as bal_in_account_currency,
|
||||||
sum(t1.debit) - sum(t1.credit) as bal_in_company_currency
|
sum(t1.debit) - sum(t1.credit) as bal_in_company_currency
|
||||||
from `tabGL Entry` t1, `tabAccount` t2
|
from `tabGL Entry` t1
|
||||||
where
|
where
|
||||||
t1.is_cancelled = 0
|
t1.is_cancelled = 0
|
||||||
and t1.account = t2.name
|
and t1.account in (select name from `tabAccount` where report_type = 'Profit and Loss' and docstatus < 2 and company = %s)
|
||||||
and t2.report_type = 'Profit and Loss'
|
|
||||||
and t2.docstatus < 2
|
|
||||||
and t2.company = %s
|
|
||||||
and t1.posting_date between %s and %s
|
and t1.posting_date between %s and %s
|
||||||
group by {dimension_fields}
|
group by {dimension_fields}
|
||||||
""".format(
|
""".format(
|
||||||
dimension_fields=", ".join(dimension_fields)
|
dimension_fields=", ".join(dimension_fields),
|
||||||
),
|
),
|
||||||
(self.company, self.get("year_start_date"), self.posting_date),
|
(self.company, self.get("year_start_date"), self.posting_date),
|
||||||
as_dict=1,
|
as_dict=1,
|
||||||
|
|||||||
@@ -432,7 +432,7 @@ class Asset(AccountsController):
|
|||||||
)
|
)
|
||||||
skip_row = True
|
skip_row = True
|
||||||
|
|
||||||
if depreciation_amount > 0:
|
if flt(depreciation_amount, self.precision("gross_purchase_amount")) > 0:
|
||||||
self.append(
|
self.append(
|
||||||
"schedules",
|
"schedules",
|
||||||
{
|
{
|
||||||
@@ -1281,9 +1281,11 @@ def get_straight_line_or_manual_depr_amount(asset, row):
|
|||||||
)
|
)
|
||||||
# if the Depreciation Schedule is being prepared for the first time
|
# if the Depreciation Schedule is being prepared for the first time
|
||||||
else:
|
else:
|
||||||
return (flt(asset.gross_purchase_amount) - flt(row.expected_value_after_useful_life)) / flt(
|
return (
|
||||||
row.total_number_of_depreciations
|
flt(asset.gross_purchase_amount)
|
||||||
)
|
- flt(asset.opening_accumulated_depreciation)
|
||||||
|
- flt(row.expected_value_after_useful_life)
|
||||||
|
) / flt(row.total_number_of_depreciations - asset.number_of_depreciations_booked)
|
||||||
|
|
||||||
|
|
||||||
def get_wdv_or_dd_depr_amount(
|
def get_wdv_or_dd_depr_amount(
|
||||||
|
|||||||
@@ -569,7 +569,7 @@ class TestDepreciationMethods(AssetSetup):
|
|||||||
)
|
)
|
||||||
|
|
||||||
self.assertEqual(asset.status, "Draft")
|
self.assertEqual(asset.status, "Draft")
|
||||||
expected_schedules = [["2032-12-31", 30000.0, 77095.89], ["2033-06-06", 12904.11, 90000.0]]
|
expected_schedules = [["2032-12-31", 42904.11, 90000.0]]
|
||||||
schedules = [
|
schedules = [
|
||||||
[cstr(d.schedule_date), flt(d.depreciation_amount, 2), d.accumulated_depreciation_amount]
|
[cstr(d.schedule_date), flt(d.depreciation_amount, 2), d.accumulated_depreciation_amount]
|
||||||
for d in asset.get("schedules")
|
for d in asset.get("schedules")
|
||||||
|
|||||||
@@ -192,9 +192,9 @@ def add_current_month_if_applicable(months_passed, date_of_joining, based_on_doj
|
|||||||
date = getdate(frappe.flags.current_date) or getdate()
|
date = getdate(frappe.flags.current_date) or getdate()
|
||||||
|
|
||||||
if based_on_doj:
|
if based_on_doj:
|
||||||
# if leave type allocation is based on DOJ, and the date of assignment creation is same as DOJ,
|
# if leave type allocation is based on DOJ, and the date of assignment creation is after DOJ,
|
||||||
# then the month should be considered
|
# then the month should be considered
|
||||||
if date.day == date_of_joining.day:
|
if date.day >= date_of_joining.day:
|
||||||
months_passed += 1
|
months_passed += 1
|
||||||
else:
|
else:
|
||||||
last_day_of_month = get_last_day(date)
|
last_day_of_month = get_last_day(date)
|
||||||
|
|||||||
@@ -48,7 +48,8 @@ frappe.ui.form.on("BOM", {
|
|||||||
return {
|
return {
|
||||||
query: "erpnext.manufacturing.doctype.bom.bom.item_query",
|
query: "erpnext.manufacturing.doctype.bom.bom.item_query",
|
||||||
filters: {
|
filters: {
|
||||||
"item_code": doc.item
|
"include_item_in_manufacturing": 1,
|
||||||
|
"is_fixed_asset": 0
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1346,8 +1346,9 @@ def item_query(doctype, txt, searchfield, start, page_len, filters):
|
|||||||
if not has_variants:
|
if not has_variants:
|
||||||
query_filters["has_variants"] = 0
|
query_filters["has_variants"] = 0
|
||||||
|
|
||||||
if filters and filters.get("is_stock_item"):
|
if filters:
|
||||||
query_filters["is_stock_item"] = 1
|
for fieldname, value in filters.items():
|
||||||
|
query_filters[fieldname] = value
|
||||||
|
|
||||||
return frappe.get_list(
|
return frappe.get_list(
|
||||||
"Item",
|
"Item",
|
||||||
|
|||||||
@@ -605,6 +605,45 @@ class TestBOM(FrappeTestCase):
|
|||||||
bom.update_cost()
|
bom.update_cost()
|
||||||
self.assertFalse(bom.flags.cost_updated)
|
self.assertFalse(bom.flags.cost_updated)
|
||||||
|
|
||||||
|
def test_do_not_include_manufacturing_and_fixed_items(self):
|
||||||
|
from erpnext.manufacturing.doctype.bom.bom import item_query
|
||||||
|
|
||||||
|
if not frappe.db.exists("Asset Category", "Computers-Test"):
|
||||||
|
doc = frappe.get_doc({"doctype": "Asset Category", "asset_category_name": "Computers-Test"})
|
||||||
|
doc.flags.ignore_mandatory = True
|
||||||
|
doc.insert()
|
||||||
|
|
||||||
|
for item_code, properties in {
|
||||||
|
"_Test RM Item 1 Do Not Include In Manufacture": {
|
||||||
|
"is_stock_item": 1,
|
||||||
|
"include_item_in_manufacturing": 0,
|
||||||
|
},
|
||||||
|
"_Test RM Item 2 Fixed Asset Item": {
|
||||||
|
"is_fixed_asset": 1,
|
||||||
|
"is_stock_item": 0,
|
||||||
|
"asset_category": "Computers-Test",
|
||||||
|
},
|
||||||
|
"_Test RM Item 3 Manufacture Item": {"is_stock_item": 1, "include_item_in_manufacturing": 1},
|
||||||
|
}.items():
|
||||||
|
make_item(item_code, properties)
|
||||||
|
|
||||||
|
data = item_query(
|
||||||
|
"Item",
|
||||||
|
txt="_Test RM Item",
|
||||||
|
searchfield="name",
|
||||||
|
start=0,
|
||||||
|
page_len=20000,
|
||||||
|
filters={"include_item_in_manufacturing": 1, "is_fixed_asset": 0},
|
||||||
|
)
|
||||||
|
|
||||||
|
items = []
|
||||||
|
for row in data:
|
||||||
|
items.append(row[0])
|
||||||
|
|
||||||
|
self.assertTrue("_Test RM Item 1 Do Not Include In Manufacture" not in items)
|
||||||
|
self.assertTrue("_Test RM Item 2 Fixed Asset Item" not in items)
|
||||||
|
self.assertTrue("_Test RM Item 3 Manufacture Item" in items)
|
||||||
|
|
||||||
|
|
||||||
def get_default_bom(item_code="_Test FG Item 2"):
|
def get_default_bom(item_code="_Test FG Item 2"):
|
||||||
return frappe.db.get_value("BOM", {"item": item_code, "is_active": 1, "is_default": 1})
|
return frappe.db.get_value("BOM", {"item": item_code, "is_active": 1, "is_default": 1})
|
||||||
|
|||||||
@@ -420,7 +420,7 @@
|
|||||||
],
|
],
|
||||||
"is_submittable": 1,
|
"is_submittable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2021-11-12 10:15:06.572401",
|
"modified": "2023-05-22 23:26:57.589331",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Manufacturing",
|
"module": "Manufacturing",
|
||||||
"name": "Job Card",
|
"name": "Job Card",
|
||||||
|
|||||||
@@ -657,7 +657,7 @@ class JobCard(Document):
|
|||||||
self.status = {0: "Open", 1: "Submitted", 2: "Cancelled"}[self.docstatus or 0]
|
self.status = {0: "Open", 1: "Submitted", 2: "Cancelled"}[self.docstatus or 0]
|
||||||
|
|
||||||
if self.docstatus < 2:
|
if self.docstatus < 2:
|
||||||
if self.for_quantity <= self.transferred_qty:
|
if flt(self.for_quantity) <= flt(self.transferred_qty):
|
||||||
self.status = "Material Transferred"
|
self.status = "Material Transferred"
|
||||||
|
|
||||||
if self.time_logs:
|
if self.time_logs:
|
||||||
|
|||||||
@@ -7,4 +7,6 @@ def execute():
|
|||||||
frappe.reload_doc("manufacturing", "doctype", "work_order")
|
frappe.reload_doc("manufacturing", "doctype", "work_order")
|
||||||
frappe.reload_doc("manufacturing", "doctype", "work_order_item")
|
frappe.reload_doc("manufacturing", "doctype", "work_order_item")
|
||||||
|
|
||||||
frappe.db.sql("""UPDATE `tabWork Order Item` SET amount = rate * required_qty""")
|
frappe.db.sql(
|
||||||
|
"""UPDATE `tabWork Order Item` SET amount = ifnull(rate, 0.0) * ifnull(required_qty, 0.0)"""
|
||||||
|
)
|
||||||
|
|||||||
@@ -183,13 +183,6 @@ def get_columns(earning_types, ded_types):
|
|||||||
"fieldtype": "Float",
|
"fieldtype": "Float",
|
||||||
"width": 120,
|
"width": 120,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"label": _("Currency"),
|
|
||||||
"fieldname": "currency",
|
|
||||||
"fieldtype": "Link",
|
|
||||||
"options": "Currency",
|
|
||||||
"hidden": 1,
|
|
||||||
},
|
|
||||||
]
|
]
|
||||||
|
|
||||||
for earning in earning_types:
|
for earning in earning_types:
|
||||||
@@ -247,6 +240,13 @@ def get_columns(earning_types, ded_types):
|
|||||||
"options": "currency",
|
"options": "currency",
|
||||||
"width": 120,
|
"width": 120,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"label": _("Currency"),
|
||||||
|
"fieldname": "currency",
|
||||||
|
"fieldtype": "Data",
|
||||||
|
"options": "Currency",
|
||||||
|
"hidden": 1,
|
||||||
|
},
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -656,11 +656,15 @@ def get_credit_limit(customer, company):
|
|||||||
|
|
||||||
if not credit_limit:
|
if not credit_limit:
|
||||||
customer_group = frappe.get_cached_value("Customer", customer, "customer_group")
|
customer_group = frappe.get_cached_value("Customer", customer, "customer_group")
|
||||||
credit_limit = frappe.db.get_value(
|
|
||||||
|
result = frappe.db.get_values(
|
||||||
"Customer Credit Limit",
|
"Customer Credit Limit",
|
||||||
{"parent": customer_group, "parenttype": "Customer Group", "company": company},
|
{"parent": customer_group, "parenttype": "Customer Group", "company": company},
|
||||||
"credit_limit",
|
fieldname=["credit_limit", "bypass_credit_limit_check"],
|
||||||
|
as_dict=True,
|
||||||
)
|
)
|
||||||
|
if result and not result[0].bypass_credit_limit_check:
|
||||||
|
credit_limit = result[0].credit_limit
|
||||||
|
|
||||||
if not credit_limit:
|
if not credit_limit:
|
||||||
credit_limit = frappe.get_cached_value("Company", company, "credit_limit")
|
credit_limit = frappe.get_cached_value("Company", company, "credit_limit")
|
||||||
|
|||||||
@@ -235,7 +235,7 @@ erpnext.selling.SalesOrderController = erpnext.selling.SellingController.extend(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// payment request
|
// payment request
|
||||||
if(flt(doc.per_billed)<100) {
|
if(flt(doc.per_billed, precision('per_billed', doc)) < 100 + frappe.boot.sysdefaults.over_billing_allowance) {
|
||||||
this.frm.add_custom_button(__('Payment Request'), () => this.make_payment_request(), __('Create'));
|
this.frm.add_custom_button(__('Payment Request'), () => this.make_payment_request(), __('Create'));
|
||||||
this.frm.add_custom_button(__('Payment'), () => this.make_payment_entry(), __('Create'));
|
this.frm.add_custom_button(__('Payment'), () => this.make_payment_entry(), __('Create'));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,10 @@ def boot_session(bootinfo):
|
|||||||
bootinfo.sysdefaults.allow_stale = cint(
|
bootinfo.sysdefaults.allow_stale = cint(
|
||||||
frappe.db.get_single_value("Accounts Settings", "allow_stale")
|
frappe.db.get_single_value("Accounts Settings", "allow_stale")
|
||||||
)
|
)
|
||||||
|
bootinfo.sysdefaults.over_billing_allowance = frappe.db.get_single_value(
|
||||||
|
"Accounts Settings", "over_billing_allowance"
|
||||||
|
)
|
||||||
|
|
||||||
bootinfo.sysdefaults.quotation_valid_till = cint(
|
bootinfo.sysdefaults.quotation_valid_till = cint(
|
||||||
frappe.db.get_single_value("Selling Settings", "default_valid_till")
|
frappe.db.get_single_value("Selling Settings", "default_valid_till")
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -292,7 +292,7 @@ def get_items_with_location_and_quantity(item_doc, item_location_map, docstatus)
|
|||||||
item_doc.qty if (docstatus == 1 and item_doc.stock_qty == 0) else item_doc.stock_qty
|
item_doc.qty if (docstatus == 1 and item_doc.stock_qty == 0) else item_doc.stock_qty
|
||||||
)
|
)
|
||||||
|
|
||||||
while remaining_stock_qty > 0 and available_locations:
|
while flt(remaining_stock_qty) > 0 and available_locations:
|
||||||
item_location = available_locations.pop(0)
|
item_location = available_locations.pop(0)
|
||||||
item_location = frappe._dict(item_location)
|
item_location = frappe._dict(item_location)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user