Merge pull request #35902 from frappe/version-13-hotfix

chore: release v13
This commit is contained in:
Deepesh Garg
2023-06-28 21:33:23 +05:30
committed by GitHub
18 changed files with 111 additions and 75 deletions

View File

@@ -330,12 +330,10 @@ class JournalEntry(AccountsController):
d.db_update() d.db_update()
def unlink_asset_reference(self): def unlink_asset_reference(self):
if self.voucher_type != "Depreciation Entry":
return
for d in self.get("accounts"): for d in self.get("accounts"):
if ( if (
d.reference_type == "Asset" self.voucher_type == "Depreciation Entry"
and d.reference_type == "Asset"
and d.reference_name and d.reference_name
and d.account_type == "Depreciation" and d.account_type == "Depreciation"
and d.debit and d.debit
@@ -362,6 +360,15 @@ class JournalEntry(AccountsController):
else: else:
asset.db_set("value_after_depreciation", asset.value_after_depreciation + d.debit) asset.db_set("value_after_depreciation", asset.value_after_depreciation + d.debit)
asset.set_status() asset.set_status()
elif self.voucher_type == "Journal Entry" and d.reference_type == "Asset" and d.reference_name:
journal_entry_for_scrap = frappe.db.get_value(
"Asset", d.reference_name, "journal_entry_for_scrap"
)
if journal_entry_for_scrap == self.name:
frappe.throw(
_("Journal Entry for Asset scrapping cannot be cancelled. Please restore the Asset.")
)
def unlink_inter_company_jv(self): def unlink_inter_company_jv(self):
if ( if (

View File

@@ -558,7 +558,7 @@ def is_valid_certificate(
): ):
valid = False valid = False
available_amount = flt(certificate_limit) - flt(deducted_amount) - flt(current_amount) available_amount = flt(certificate_limit) - flt(deducted_amount)
if (getdate(valid_from) <= getdate(posting_date) <= getdate(valid_upto)) and available_amount > 0: if (getdate(valid_from) <= getdate(posting_date) <= getdate(valid_upto)) and available_amount > 0:
valid = True valid = True

View File

@@ -15,7 +15,6 @@ from erpnext.accounts.report.item_wise_sales_register.item_wise_sales_register i
get_group_by_conditions, get_group_by_conditions,
get_tax_accounts, get_tax_accounts,
) )
from erpnext.selling.report.item_wise_sales_history.item_wise_sales_history import get_item_details
def execute(filters=None): def execute(filters=None):
@@ -40,6 +39,16 @@ def _execute(filters=None, additional_table_columns=None, additional_query_colum
tax_doctype="Purchase Taxes and Charges", tax_doctype="Purchase Taxes and Charges",
) )
scrubbed_tax_fields = {}
for tax in tax_columns:
scrubbed_tax_fields.update(
{
tax + " Rate": frappe.scrub(tax + " Rate"),
tax + " Amount": frappe.scrub(tax + " Amount"),
}
)
po_pr_map = get_purchase_receipts_against_purchase_order(item_list) po_pr_map = get_purchase_receipts_against_purchase_order(item_list)
data = [] data = []
@@ -50,11 +59,7 @@ def _execute(filters=None, additional_table_columns=None, additional_query_colum
if filters.get("group_by"): if filters.get("group_by"):
grand_total = get_grand_total(filters, "Purchase Invoice") grand_total = get_grand_total(filters, "Purchase Invoice")
item_details = get_item_details()
for d in item_list: for d in item_list:
item_record = item_details.get(d.item_code)
purchase_receipt = None purchase_receipt = None
if d.purchase_receipt: if d.purchase_receipt:
purchase_receipt = d.purchase_receipt purchase_receipt = d.purchase_receipt
@@ -67,8 +72,8 @@ def _execute(filters=None, additional_table_columns=None, additional_query_colum
row = { row = {
"item_code": d.item_code, "item_code": d.item_code,
"item_name": item_record.item_name if item_record else d.item_name, "item_name": d.pi_item_name if d.pi_item_name else d.i_item_name,
"item_group": item_record.item_group if item_record else d.item_group, "item_group": d.pi_item_group if d.pi_item_group else d.i_item_group,
"description": d.description, "description": d.description,
"invoice": d.parent, "invoice": d.parent,
"posting_date": d.posting_date, "posting_date": d.posting_date,
@@ -87,7 +92,7 @@ def _execute(filters=None, additional_table_columns=None, additional_query_colum
"project": d.project, "project": d.project,
"company": d.company, "company": d.company,
"purchase_order": d.purchase_order, "purchase_order": d.purchase_order,
"purchase_receipt": d.purchase_receipt, "purchase_receipt": purchase_receipt,
"expense_account": expense_account, "expense_account": expense_account,
"stock_qty": d.stock_qty, "stock_qty": d.stock_qty,
"stock_uom": d.stock_uom, "stock_uom": d.stock_uom,
@@ -101,8 +106,8 @@ def _execute(filters=None, additional_table_columns=None, additional_query_colum
item_tax = itemised_tax.get(d.name, {}).get(tax, {}) item_tax = itemised_tax.get(d.name, {}).get(tax, {})
row.update( row.update(
{ {
frappe.scrub(tax + " Rate"): item_tax.get("tax_rate", 0), scrubbed_tax_fields[tax + " Rate"]: item_tax.get("tax_rate", 0),
frappe.scrub(tax + " Amount"): item_tax.get("tax_amount", 0), scrubbed_tax_fields[tax + " Amount"]: item_tax.get("tax_amount", 0),
} }
) )
total_tax += flt(item_tax.get("tax_amount")) total_tax += flt(item_tax.get("tax_amount"))
@@ -241,7 +246,7 @@ def get_columns(additional_table_columns, filters):
}, },
{ {
"label": _("Purchase Receipt"), "label": _("Purchase Receipt"),
"fieldname": "Purchase Receipt", "fieldname": "purchase_receipt",
"fieldtype": "Link", "fieldtype": "Link",
"options": "Purchase Receipt", "options": "Purchase Receipt",
"width": 100, "width": 100,
@@ -325,14 +330,16 @@ def get_items(filters, additional_query_columns):
`tabPurchase Invoice`.supplier, `tabPurchase Invoice`.remarks, `tabPurchase Invoice`.base_net_total, `tabPurchase Invoice`.supplier, `tabPurchase Invoice`.remarks, `tabPurchase Invoice`.base_net_total,
`tabPurchase Invoice`.unrealized_profit_loss_account, `tabPurchase Invoice`.unrealized_profit_loss_account,
`tabPurchase Invoice Item`.`item_code`, `tabPurchase Invoice Item`.description, `tabPurchase Invoice Item`.`item_code`, `tabPurchase Invoice Item`.description,
`tabPurchase Invoice Item`.`item_name`, `tabPurchase Invoice Item`.`item_group`, `tabPurchase Invoice Item`.`item_name` as pi_item_name, `tabPurchase Invoice Item`.`item_group` as pi_item_group,
`tabItem`.`item_name` as i_item_name, `tabItem`.`item_group` as i_item_group,
`tabPurchase Invoice Item`.`project`, `tabPurchase Invoice Item`.`purchase_order`, `tabPurchase Invoice Item`.`project`, `tabPurchase Invoice Item`.`purchase_order`,
`tabPurchase Invoice Item`.`purchase_receipt`, `tabPurchase Invoice Item`.`po_detail`, `tabPurchase Invoice Item`.`purchase_receipt`, `tabPurchase Invoice Item`.`po_detail`,
`tabPurchase Invoice Item`.`expense_account`, `tabPurchase Invoice Item`.`stock_qty`, `tabPurchase Invoice Item`.`expense_account`, `tabPurchase Invoice Item`.`stock_qty`,
`tabPurchase Invoice Item`.`stock_uom`, `tabPurchase Invoice Item`.`base_net_amount`, `tabPurchase Invoice Item`.`stock_uom`, `tabPurchase Invoice Item`.`base_net_amount`,
`tabPurchase Invoice`.`supplier_name`, `tabPurchase Invoice`.`mode_of_payment` {0} `tabPurchase Invoice`.`supplier_name`, `tabPurchase Invoice`.`mode_of_payment` {0}
from `tabPurchase Invoice`, `tabPurchase Invoice Item` from `tabPurchase Invoice`, `tabPurchase Invoice Item`, `tabItem`
where `tabPurchase Invoice`.name = `tabPurchase Invoice Item`.`parent` and where `tabPurchase Invoice`.name = `tabPurchase Invoice Item`.`parent` and
`tabItem`.name = `tabPurchase Invoice Item`.`item_code` and
`tabPurchase Invoice`.docstatus = 1 %s `tabPurchase Invoice`.docstatus = 1 %s
""".format( """.format(
additional_query_columns additional_query_columns

View File

@@ -11,7 +11,6 @@ from frappe.utils.xlsxutils import handle_html
from erpnext.accounts.report.sales_register.sales_register import get_mode_of_payments from erpnext.accounts.report.sales_register.sales_register import get_mode_of_payments
from erpnext.selling.report.item_wise_sales_history.item_wise_sales_history import ( from erpnext.selling.report.item_wise_sales_history.item_wise_sales_history import (
get_customer_details, get_customer_details,
get_item_details,
) )
@@ -35,6 +34,16 @@ def _execute(
if item_list: if item_list:
itemised_tax, tax_columns = get_tax_accounts(item_list, columns, company_currency) itemised_tax, tax_columns = get_tax_accounts(item_list, columns, company_currency)
scrubbed_tax_fields = {}
for tax in tax_columns:
scrubbed_tax_fields.update(
{
tax + " Rate": frappe.scrub(tax + " Rate"),
tax + " Amount": frappe.scrub(tax + " Amount"),
}
)
mode_of_payments = get_mode_of_payments(set(d.parent for d in item_list)) mode_of_payments = get_mode_of_payments(set(d.parent for d in item_list))
so_dn_map = get_delivery_notes_against_sales_order(item_list) so_dn_map = get_delivery_notes_against_sales_order(item_list)
@@ -47,11 +56,9 @@ def _execute(
grand_total = get_grand_total(filters, "Sales Invoice") grand_total = get_grand_total(filters, "Sales Invoice")
customer_details = get_customer_details() customer_details = get_customer_details()
item_details = get_item_details()
for d in item_list: for d in item_list:
customer_record = customer_details.get(d.customer) customer_record = customer_details.get(d.customer)
item_record = item_details.get(d.item_code)
delivery_note = None delivery_note = None
if d.delivery_note: if d.delivery_note:
@@ -64,8 +71,8 @@ def _execute(
row = { row = {
"item_code": d.item_code, "item_code": d.item_code,
"item_name": item_record.item_name if item_record else d.item_name, "item_name": d.si_item_name if d.si_item_name else d.i_item_name,
"item_group": item_record.item_group if item_record else d.item_group, "item_group": d.si_item_group if d.si_item_group else d.i_item_group,
"description": d.description, "description": d.description,
"invoice": d.parent, "invoice": d.parent,
"posting_date": d.posting_date, "posting_date": d.posting_date,
@@ -107,8 +114,8 @@ def _execute(
item_tax = itemised_tax.get(d.name, {}).get(tax, {}) item_tax = itemised_tax.get(d.name, {}).get(tax, {})
row.update( row.update(
{ {
frappe.scrub(tax + " Rate"): item_tax.get("tax_rate", 0), scrubbed_tax_fields[tax + " Rate"]: item_tax.get("tax_rate", 0),
frappe.scrub(tax + " Amount"): item_tax.get("tax_amount", 0), scrubbed_tax_fields[tax + " Amount"]: item_tax.get("tax_amount", 0),
} }
) )
if item_tax.get("is_other_charges"): if item_tax.get("is_other_charges"):
@@ -404,15 +411,18 @@ def get_items(filters, additional_query_columns, additional_conditions=None):
`tabSales Invoice Item`.project, `tabSales Invoice Item`.project,
`tabSales Invoice Item`.item_code, `tabSales Invoice Item`.description, `tabSales Invoice Item`.item_code, `tabSales Invoice Item`.description,
`tabSales Invoice Item`.`item_name`, `tabSales Invoice Item`.`item_group`, `tabSales Invoice Item`.`item_name`, `tabSales Invoice Item`.`item_group`,
`tabSales Invoice Item`.`item_name` as si_item_name, `tabSales Invoice Item`.`item_group` as si_item_group,
`tabItem`.`item_name` as i_item_name, `tabItem`.`item_group` as i_item_group,
`tabSales Invoice Item`.sales_order, `tabSales Invoice Item`.delivery_note, `tabSales Invoice Item`.sales_order, `tabSales Invoice Item`.delivery_note,
`tabSales Invoice Item`.income_account, `tabSales Invoice Item`.cost_center, `tabSales Invoice Item`.income_account, `tabSales Invoice Item`.cost_center,
`tabSales Invoice Item`.stock_qty, `tabSales Invoice Item`.stock_uom, `tabSales Invoice Item`.stock_qty, `tabSales Invoice Item`.stock_uom,
`tabSales Invoice Item`.base_net_rate, `tabSales Invoice Item`.base_net_amount, `tabSales Invoice Item`.base_net_rate, `tabSales Invoice Item`.base_net_amount,
`tabSales Invoice`.customer_name, `tabSales Invoice`.customer_group, `tabSales Invoice Item`.so_detail, `tabSales Invoice`.customer_name, `tabSales Invoice`.customer_group, `tabSales Invoice Item`.so_detail,
`tabSales Invoice`.update_stock, `tabSales Invoice Item`.uom, `tabSales Invoice Item`.qty {0} `tabSales Invoice`.update_stock, `tabSales Invoice Item`.uom, `tabSales Invoice Item`.qty {0}
from `tabSales Invoice`, `tabSales Invoice Item` from `tabSales Invoice`, `tabSales Invoice Item`, `tabItem`
where `tabSales Invoice`.name = `tabSales Invoice Item`.parent where `tabSales Invoice`.name = `tabSales Invoice Item`.parent and
and `tabSales Invoice`.docstatus = 1 {1} `tabItem`.name = `tabSales Invoice Item`.`item_code` and
`tabSales Invoice`.docstatus = 1 {1}
""".format( """.format(
additional_query_columns or "", conditions additional_query_columns or "", conditions
), ),

View File

@@ -136,11 +136,11 @@ def make_depreciation_entry(asset_name, date=None):
je.flags.ignore_permissions = True je.flags.ignore_permissions = True
je.flags.planned_depr_entry = True je.flags.planned_depr_entry = True
je.save() je.save()
if not je.meta.get_workflow():
je.submit()
d.db_set("journal_entry", je.name) d.db_set("journal_entry", je.name)
if not je.meta.get_workflow():
je.submit()
idx = cint(d.finance_book_id) idx = cint(d.finance_book_id)
finance_books = asset.get("finance_books")[idx - 1] finance_books = asset.get("finance_books")[idx - 1]
finance_books.value_after_depreciation -= d.depreciation_amount finance_books.value_after_depreciation -= d.depreciation_amount
@@ -344,6 +344,9 @@ def modify_depreciation_schedule_for_asset_repairs(asset):
def reverse_depreciation_entry_made_after_disposal(asset, date): def reverse_depreciation_entry_made_after_disposal(asset, date):
from erpnext.accounts.doctype.journal_entry.journal_entry import make_reverse_journal_entry from erpnext.accounts.doctype.journal_entry.journal_entry import make_reverse_journal_entry
if not asset.calculate_depreciation:
return
row = -1 row = -1
finance_book = asset.get("schedules")[0].get("finance_book") finance_book = asset.get("schedules")[0].get("finance_book")
for schedule in asset.get("schedules"): for schedule in asset.get("schedules"):

View File

@@ -70,20 +70,22 @@ frappe.ui.form.on('Asset Movement', {
else if (frm.doc.purpose === 'Issue') { else if (frm.doc.purpose === 'Issue') {
fieldnames_to_be_altered = { fieldnames_to_be_altered = {
target_location: { read_only: 1, reqd: 0 }, target_location: { read_only: 1, reqd: 0 },
source_location: { read_only: 1, reqd: 1 }, source_location: { read_only: 1, reqd: 0 },
from_employee: { read_only: 1, reqd: 0 }, from_employee: { read_only: 1, reqd: 0 },
to_employee: { read_only: 0, reqd: 1 } to_employee: { read_only: 0, reqd: 1 }
}; };
} }
if (fieldnames_to_be_altered) {
Object.keys(fieldnames_to_be_altered).forEach(fieldname => { Object.keys(fieldnames_to_be_altered).forEach(fieldname => {
let property_to_be_altered = fieldnames_to_be_altered[fieldname]; let property_to_be_altered = fieldnames_to_be_altered[fieldname];
Object.keys(property_to_be_altered).forEach(property => { Object.keys(property_to_be_altered).forEach(property => {
let value = property_to_be_altered[property]; let value = property_to_be_altered[property];
frm.set_df_property(fieldname, property, value, cdn, 'assets'); frm.fields_dict['assets'].grid.update_docfield_property(fieldname, property, value);
}); });
}); });
frm.refresh_field('assets'); frm.refresh_field('assets');
} }
}
}); });
frappe.ui.form.on('Asset Movement Item', { frappe.ui.form.on('Asset Movement Item', {

View File

@@ -37,6 +37,7 @@
"reqd": 1 "reqd": 1
}, },
{ {
"default": "Now",
"fieldname": "transaction_date", "fieldname": "transaction_date",
"fieldtype": "Datetime", "fieldtype": "Datetime",
"in_list_view": 1, "in_list_view": 1,
@@ -95,10 +96,11 @@
"index_web_pages_for_search": 1, "index_web_pages_for_search": 1,
"is_submittable": 1, "is_submittable": 1,
"links": [], "links": [],
"modified": "2021-01-22 12:30:55.295670", "modified": "2023-06-28 16:54:26.571083",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Assets", "module": "Assets",
"name": "Asset Movement", "name": "Asset Movement",
"naming_rule": "Expression",
"owner": "Administrator", "owner": "Administrator",
"permissions": [ "permissions": [
{ {
@@ -148,5 +150,6 @@
} }
], ],
"sort_field": "modified", "sort_field": "modified",
"sort_order": "DESC" "sort_order": "DESC",
"states": []
} }

View File

@@ -28,26 +28,20 @@ class AssetMovement(Document):
def validate_location(self): def validate_location(self):
for d in self.assets: for d in self.assets:
if self.purpose in ["Transfer", "Issue"]: if self.purpose in ["Transfer", "Issue"]:
if not d.source_location:
d.source_location = frappe.db.get_value("Asset", d.asset, "location")
if not d.source_location:
frappe.throw(_("Source Location is required for the Asset {0}").format(d.asset))
if d.source_location:
current_location = frappe.db.get_value("Asset", d.asset, "location") current_location = frappe.db.get_value("Asset", d.asset, "location")
if d.source_location:
if current_location != d.source_location: if current_location != d.source_location:
frappe.throw( frappe.throw(
_("Asset {0} does not belongs to the location {1}").format(d.asset, d.source_location) _("Asset {0} does not belongs to the location {1}").format(d.asset, d.source_location)
) )
else:
d.source_location = current_location
if self.purpose == "Issue": if self.purpose == "Issue":
if d.target_location: if d.target_location:
frappe.throw( frappe.throw(
_( _(
"Issuing cannot be done to a location. \ "Issuing cannot be done to a location. Please enter employee to issue the Asset {0} to"
Please enter employee who has issued Asset {0}"
).format(d.asset), ).format(d.asset),
title="Incorrect Movement Purpose", title="Incorrect Movement Purpose",
) )
@@ -110,12 +104,12 @@ class AssetMovement(Document):
) )
def on_submit(self): def on_submit(self):
self.set_latest_location_in_asset() self.set_latest_location_and_custodian_in_asset()
def on_cancel(self): def on_cancel(self):
self.set_latest_location_in_asset() self.set_latest_location_and_custodian_in_asset()
def set_latest_location_in_asset(self): def set_latest_location_and_custodian_in_asset(self):
current_location, current_employee = "", "" current_location, current_employee = "", ""
cond = "1=1" cond = "1=1"

View File

@@ -47,7 +47,7 @@ class TestAssetMovement(unittest.TestCase):
if not frappe.db.exists("Location", "Test Location 2"): if not frappe.db.exists("Location", "Test Location 2"):
frappe.get_doc({"doctype": "Location", "location_name": "Test Location 2"}).insert() frappe.get_doc({"doctype": "Location", "location_name": "Test Location 2"}).insert()
movement1 = create_asset_movement( create_asset_movement(
purpose="Transfer", purpose="Transfer",
company=asset.company, company=asset.company,
assets=[ assets=[
@@ -58,7 +58,7 @@ class TestAssetMovement(unittest.TestCase):
) )
self.assertEqual(frappe.db.get_value("Asset", asset.name, "location"), "Test Location 2") self.assertEqual(frappe.db.get_value("Asset", asset.name, "location"), "Test Location 2")
create_asset_movement( movement1 = create_asset_movement(
purpose="Transfer", purpose="Transfer",
company=asset.company, company=asset.company,
assets=[ assets=[
@@ -70,21 +70,32 @@ class TestAssetMovement(unittest.TestCase):
self.assertEqual(frappe.db.get_value("Asset", asset.name, "location"), "Test Location") self.assertEqual(frappe.db.get_value("Asset", asset.name, "location"), "Test Location")
movement1.cancel() movement1.cancel()
self.assertEqual(frappe.db.get_value("Asset", asset.name, "location"), "Test Location") self.assertEqual(frappe.db.get_value("Asset", asset.name, "location"), "Test Location 2")
employee = make_employee("testassetmovemp@example.com", company="_Test Company") employee = make_employee("testassetmovemp@example.com", company="_Test Company")
create_asset_movement( create_asset_movement(
purpose="Issue", purpose="Issue",
company=asset.company, company=asset.company,
assets=[{"asset": asset.name, "source_location": "Test Location", "to_employee": employee}], assets=[{"asset": asset.name, "source_location": "Test Location 2", "to_employee": employee}],
reference_doctype="Purchase Receipt", reference_doctype="Purchase Receipt",
reference_name=pr.name, reference_name=pr.name,
) )
# after issuing asset should belong to an employee not at a location # after issuing, asset should belong to an employee not at a location
self.assertEqual(frappe.db.get_value("Asset", asset.name, "location"), None) self.assertEqual(frappe.db.get_value("Asset", asset.name, "location"), None)
self.assertEqual(frappe.db.get_value("Asset", asset.name, "custodian"), employee) self.assertEqual(frappe.db.get_value("Asset", asset.name, "custodian"), employee)
create_asset_movement(
purpose="Receipt",
company=asset.company,
assets=[{"asset": asset.name, "from_employee": employee, "target_location": "Test Location"}],
reference_doctype="Purchase Receipt",
reference_name=pr.name,
)
# after receiving, asset should belong to a location not at an employee
self.assertEqual(frappe.db.get_value("Asset", asset.name, "location"), "Test Location")
def test_last_movement_cancellation(self): def test_last_movement_cancellation(self):
pr = make_purchase_receipt( pr = make_purchase_receipt(
item_code="Macbook Pro", qty=1, rate=100000.0, location="Test Location" item_code="Macbook Pro", qty=1, rate=100000.0, location="Test Location"

View File

@@ -115,7 +115,11 @@ def get_data(filters):
depreciation_amount_map = get_asset_depreciation_amount_map(filters, finance_book) depreciation_amount_map = get_asset_depreciation_amount_map(filters, finance_book)
for asset in assets_record: for asset in assets_record:
if assets_linked_to_fb and asset.asset_id not in assets_linked_to_fb: if (
assets_linked_to_fb
and asset.calculate_depreciation
and asset.asset_id not in assets_linked_to_fb
):
continue continue
asset_value = get_asset_value_after_depreciation( asset_value = get_asset_value_after_depreciation(

View File

@@ -242,7 +242,7 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend(
source_name: this.frm.doc.supplier, source_name: this.frm.doc.supplier,
target: this.frm, target: this.frm,
setters: { setters: {
company: me.frm.doc.company company: this.frm.doc.company
}, },
get_query_filters: { get_query_filters: {
docstatus: ["!=", 2], docstatus: ["!=", 2],

View File

@@ -333,7 +333,6 @@ def get_leave_allocation_for_period(
).run()[0][0] or 0.0 ).run()[0][0] or 0.0
@frappe.whitelist()
def get_carry_forwarded_leaves(employee, leave_type, date, carry_forward=None): def get_carry_forwarded_leaves(employee, leave_type, date, carry_forward=None):
"""Returns carry forwarded leaves for the given employee""" """Returns carry forwarded leaves for the given employee"""
unused_leaves = 0.0 unused_leaves = 0.0

View File

@@ -74,7 +74,6 @@ class LeavePolicyAssignment(Document):
).format(frappe.bold(get_link_to_form("Leave Type", leave_type.name))) ).format(frappe.bold(get_link_to_form("Leave Type", leave_type.name)))
frappe.msgprint(msg, indicator="orange", alert=True) frappe.msgprint(msg, indicator="orange", alert=True)
@frappe.whitelist()
def grant_leave_alloc_for_employee(self): def grant_leave_alloc_for_employee(self):
if self.leaves_allocated: if self.leaves_allocated:
frappe.throw(_("Leave already have been assigned for this Leave Policy Assignment")) frappe.throw(_("Leave already have been assigned for this Leave Policy Assignment"))

View File

@@ -145,7 +145,6 @@ class AdditionalSalary(Document):
return amount_per_day * no_of_days return amount_per_day * no_of_days
@frappe.whitelist()
def get_additional_salaries(employee, start_date, end_date, component_type): def get_additional_salaries(employee, start_date, end_date, component_type):
from frappe.query_builder import Criterion from frappe.query_builder import Criterion

View File

@@ -21,16 +21,14 @@ def get_columns(filters):
columns = [ columns = [
{ {
"label": _("Employee"), "label": _("Employee"),
"options": "Employee",
"fieldname": "employee", "fieldname": "employee",
"fieldtype": "Link", "fieldtype": "Link",
"options": "Employee",
"width": 200, "width": 200,
}, },
{ {
"label": _("Employee Name"), "label": _("Employee Name"),
"options": "Employee",
"fieldname": "employee_name", "fieldname": "employee_name",
"fieldtype": "Link",
"width": 160, "width": 160,
}, },
{"label": _("Amount"), "fieldname": "amount", "fieldtype": "Currency", "width": 140}, {"label": _("Amount"), "fieldname": "amount", "fieldtype": "Currency", "width": 140},

View File

@@ -18,16 +18,14 @@ def get_columns(filters):
columns = [ columns = [
{ {
"label": _("Employee"), "label": _("Employee"),
"options": "Employee",
"fieldname": "employee", "fieldname": "employee",
"fieldtype": "Link", "fieldtype": "Link",
"options": "Employee",
"width": 200, "width": 200,
}, },
{ {
"label": _("Employee Name"), "label": _("Employee Name"),
"options": "Employee",
"fieldname": "employee_name", "fieldname": "employee_name",
"fieldtype": "Link",
"width": 160, "width": 160,
}, },
{"label": _("PF Account"), "fieldname": "pf_account", "fieldtype": "Data", "width": 140}, {"label": _("PF Account"), "fieldname": "pf_account", "fieldtype": "Data", "width": 140},

View File

@@ -35,6 +35,7 @@ def add_print_formats():
def add_permissions(): def add_permissions():
frappe.reload_doc("regional", "doctype", "ksa_vat_setting", force=True)
"""Add Permissions for KSA VAT Setting.""" """Add Permissions for KSA VAT Setting."""
add_permission("KSA VAT Setting", "All", 0) add_permission("KSA VAT Setting", "All", 0)
for role in ("Accounts Manager", "Accounts User", "System Manager"): for role in ("Accounts Manager", "Accounts User", "System Manager"):

View File

@@ -13,10 +13,11 @@ frappe.ui.form.on("Warehouse", {
}; };
}); });
frm.set_query("parent_warehouse", function () { frm.set_query("parent_warehouse", function (doc) {
return { return {
filters: { filters: {
is_group: 1, is_group: 1,
company: doc.company,
}, },
}; };
}); });