Merge branch 'develop' into education_sepration

This commit is contained in:
Ankush Menat 2022-05-02 11:47:37 +05:30 committed by GitHub
commit bae8ab2fa9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 453 additions and 135 deletions

View File

@ -114,10 +114,13 @@ class OpeningInvoiceCreationTool(Document):
)
or {}
)
default_currency = frappe.db.get_value(row.party_type, row.party, "default_currency")
if company_details:
invoice.update(
{
"currency": company_details.get("default_currency"),
"currency": default_currency or company_details.get("default_currency"),
"letter_head": company_details.get("default_letter_head"),
}
)

View File

@ -23,6 +23,10 @@
"order_confirmation_no",
"order_confirmation_date",
"amended_from",
"accounting_dimensions_section",
"cost_center",
"dimension_col_break",
"project",
"drop_ship",
"customer",
"customer_name",
@ -1137,16 +1141,39 @@
"fieldtype": "Link",
"label": "Tax Withholding Category",
"options": "Tax Withholding Category"
},
{
"collapsible": 1,
"fieldname": "accounting_dimensions_section",
"fieldtype": "Section Break",
"label": "Accounting Dimensions "
},
{
"fieldname": "cost_center",
"fieldtype": "Link",
"label": "Cost Center",
"options": "Cost Center"
},
{
"fieldname": "dimension_col_break",
"fieldtype": "Column Break"
},
{
"fieldname": "project",
"fieldtype": "Link",
"label": "Project",
"options": "Project"
}
],
"icon": "fa fa-file-text",
"idx": 105,
"is_submittable": 1,
"links": [],
"modified": "2021-09-28 13:10:47.955401",
"modified": "2022-04-26 12:16:38.694276",
"modified_by": "Administrator",
"module": "Buying",
"name": "Purchase Order",
"naming_rule": "By \"Naming Series\" field",
"owner": "Administrator",
"permissions": [
{
@ -1193,6 +1220,7 @@
"show_name_in_global_search": 1,
"sort_field": "modified",
"sort_order": "DESC",
"states": [],
"timeline_field": "supplier",
"title_field": "supplier_name",
"track_changes": 1

View File

@ -528,6 +528,9 @@ accounting_dimension_doctypes = [
"Subscription Plan",
"POS Invoice",
"POS Invoice Item",
"Purchase Order",
"Purchase Receipt",
"Sales Order",
]
regional_overrides = {

View File

@ -5,7 +5,7 @@
import frappe
from frappe import _
from frappe.model.document import Document
from frappe.utils import cint, get_datetime
from frappe.utils import cint, get_datetime, get_link_to_form
from erpnext.hr.doctype.attendance.attendance import (
get_duplicate_attendance_record,
@ -130,14 +130,11 @@ def mark_attendance_and_link_log(
"""
log_names = [x.name for x in logs]
employee = logs[0].employee
if attendance_status == "Skip":
frappe.db.sql(
"""update `tabEmployee Checkin`
set skip_auto_attendance = %s
where name in %s""",
("1", log_names),
)
skip_attendance_in_checkins(log_names)
return None
elif attendance_status in ("Present", "Absent", "Half Day"):
employee_doc = frappe.get_doc("Employee", employee)
duplicate = get_duplicate_attendance_record(employee, attendance_date, shift)
@ -159,6 +156,12 @@ def mark_attendance_and_link_log(
}
attendance = frappe.get_doc(doc_dict).insert()
attendance.submit()
if attendance_status == "Absent":
attendance.add_comment(
text=_("Employee was marked Absent for not meeting the working hours threshold.")
)
frappe.db.sql(
"""update `tabEmployee Checkin`
set attendance = %s
@ -167,13 +170,10 @@ def mark_attendance_and_link_log(
)
return attendance
else:
frappe.db.sql(
"""update `tabEmployee Checkin`
set skip_auto_attendance = %s
where name in %s""",
("1", log_names),
)
skip_attendance_in_checkins(log_names)
add_comment_in_checkins(log_names, duplicate, overlapping)
return None
else:
frappe.throw(_("{} is an invalid Attendance Status.").format(attendance_status))
@ -241,3 +241,34 @@ def time_diff_in_hours(start, end):
def find_index_in_dict(dict_list, key, value):
return next((index for (index, d) in enumerate(dict_list) if d[key] == value), None)
def add_comment_in_checkins(log_names, duplicate, overlapping):
if duplicate:
text = _("Auto Attendance skipped due to duplicate attendance record: {}").format(
get_link_to_form("Attendance", duplicate[0].name)
)
else:
text = _("Auto Attendance skipped due to overlapping attendance record: {}").format(
get_link_to_form("Attendance", overlapping.name)
)
for name in log_names:
frappe.get_doc(
{
"doctype": "Comment",
"comment_type": "Comment",
"reference_doctype": "Employee Checkin",
"reference_name": name,
"content": text,
}
).insert(ignore_permissions=True)
def skip_attendance_in_checkins(log_names):
EmployeeCheckin = frappe.qb.DocType("Employee Checkin")
(
frappe.qb.update(EmployeeCheckin)
.set("skip_auto_attendance", 1)
.where(EmployeeCheckin.name.isin(log_names))
).run()

View File

@ -134,7 +134,17 @@ class ShiftType(Document):
shift_details = get_employee_shift(employee, timestamp, True)
if shift_details and shift_details.shift_type.name == self.name:
mark_attendance(employee, date, "Absent", self.name)
attendance = mark_attendance(employee, date, "Absent", self.name)
if attendance:
frappe.get_doc(
{
"doctype": "Comment",
"comment_type": "Comment",
"reference_doctype": "Attendance",
"reference_name": attendance,
"content": frappe._("Employee was marked Absent due to missing Employee Checkins."),
}
).insert(ignore_permissions=True)
def get_start_and_end_dates(self, employee):
"""Returns start and end dates for checking attendance and marking absent

View File

@ -368,3 +368,4 @@ erpnext.patches.v13_0.create_gst_custom_fields_in_quotation
erpnext.patches.v13_0.copy_custom_field_filters_to_website_item
erpnext.patches.v14_0.discount_accounting_separation
erpnext.patches.v14_0.delete_employee_transfer_property_doctype
erpnext.patches.v13_0.create_accounting_dimensions_in_orders

View File

@ -0,0 +1,39 @@
import frappe
from frappe.custom.doctype.custom_field.custom_field import create_custom_field
def execute():
accounting_dimensions = frappe.db.get_all(
"Accounting Dimension", fields=["fieldname", "label", "document_type", "disabled"]
)
if not accounting_dimensions:
return
count = 1
for d in accounting_dimensions:
if count % 2 == 0:
insert_after_field = "dimension_col_break"
else:
insert_after_field = "accounting_dimensions_section"
for doctype in ["Purchase Order", "Purchase Receipt", "Sales Order"]:
field = frappe.db.get_value("Custom Field", {"dt": doctype, "fieldname": d.fieldname})
if field:
continue
df = {
"fieldname": d.fieldname,
"label": d.label,
"fieldtype": "Link",
"options": d.document_type,
"insert_after": insert_after_field,
}
create_custom_field(doctype, df, ignore_validate=False)
frappe.clear_cache(doctype=doctype)
count += 1

View File

@ -2,8 +2,10 @@ import frappe
def execute():
doc = frappe.get_doc("Accounts Settings")
discount_account = doc.enable_discount_accounting
data = frappe.db.sql(
'select value from tabSingles where doctype="Accounts Settings" and field="enable_discount_accounting"'
)
discount_account = data and int(data[0][0]) or 0
if discount_account:
for doctype in ["Buying Settings", "Selling Settings"]:
frappe.db.set_value(doctype, doctype, "enable_discount_accounting", 1, update_modified=False)

View File

@ -86,6 +86,7 @@ class Project(Document):
type=task_details.type,
issue=task_details.issue,
is_group=task_details.is_group,
color=task_details.color,
)
).insert()

View File

@ -244,7 +244,7 @@ def make_custom_fields():
"Supplier Quotation Item": invoice_item_fields,
}
create_custom_fields(custom_fields)
create_custom_fields(custom_fields, ignore_validate=True)
def add_print_formats():

View File

@ -25,6 +25,10 @@
"po_no",
"po_date",
"tax_id",
"accounting_dimensions_section",
"cost_center",
"dimension_col_break",
"project",
"contact_info",
"customer_address",
"address_display",
@ -113,7 +117,6 @@
"is_internal_customer",
"represents_company",
"inter_company_order_reference",
"project",
"party_account_currency",
"column_break_77",
"source",
@ -1522,13 +1525,29 @@
"label": "% Picked",
"no_copy": 1,
"read_only": 1
},
{
"collapsible": 1,
"fieldname": "accounting_dimensions_section",
"fieldtype": "Section Break",
"label": "Accounting Dimensions"
},
{
"fieldname": "cost_center",
"fieldtype": "Link",
"label": "Cost Center",
"options": "Cost Center"
},
{
"fieldname": "dimension_col_break",
"fieldtype": "Column Break"
}
],
"icon": "fa fa-file-text",
"idx": 105,
"is_submittable": 1,
"links": [],
"modified": "2022-04-21 08:16:48.316074",
"modified": "2022-04-26 14:38:18.350207",
"modified_by": "Administrator",
"module": "Selling",
"name": "Sales Order",

View File

@ -5,7 +5,7 @@
"label": "Sales Order Trends"
}
],
"content": "[{\"type\":\"onboarding\",\"data\":{\"onboarding_name\":\"Selling\",\"col\":12}},{\"type\":\"chart\",\"data\":{\"chart_name\":\"Sales Order Trends\",\"col\":12}},{\"type\":\"spacer\",\"data\":{\"col\":12}},{\"type\":\"header\",\"data\":{\"text\":\"<span class=\\\"h4\\\"><b>Quick Access</b></span>\",\"col\":12}},{\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Item\",\"col\":3}},{\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Sales Order\",\"col\":3}},{\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Sales Analytics\",\"col\":3}},{\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Sales Order Analysis\",\"col\":3}},{\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Dashboard\",\"col\":3}},{\"type\":\"spacer\",\"data\":{\"col\":12}},{\"type\":\"header\",\"data\":{\"text\":\"<span class=\\\"h4\\\"><b>Reports & Masters</b></span>\",\"col\":12}},{\"type\":\"card\",\"data\":{\"card_name\":\"Selling\",\"col\":4}},{\"type\":\"card\",\"data\":{\"card_name\":\"Items and Pricing\",\"col\":4}},{\"type\":\"card\",\"data\":{\"card_name\":\"Settings\",\"col\":4}},{\"type\":\"card\",\"data\":{\"card_name\":\"Key Reports\",\"col\":4}},{\"type\":\"card\",\"data\":{\"card_name\":\"Other Reports\",\"col\":4}}]",
"content": "[{\"type\":\"onboarding\",\"data\":{\"onboarding_name\":\"Selling\",\"col\":12}},{\"type\":\"chart\",\"data\":{\"chart_name\":\"Sales Order Trends\",\"col\":12}},{\"type\":\"spacer\",\"data\":{\"col\":12}},{\"type\":\"header\",\"data\":{\"text\":\"<span class=\\\"h4\\\"><b>Quick Access</b></span>\",\"col\":12}},{\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Item\",\"col\":3}},{\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Sales Order\",\"col\":3}},{\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Sales Analytics\",\"col\":3}},{\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Sales Order Analysis\",\"col\":3}},{\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Dashboard\",\"col\":3}},{\"type\":\"spacer\",\"data\":{\"col\":12}},{\"type\":\"header\",\"data\":{\"text\":\"<span class=\\\"h4\\\"><b>Reports &amp; Masters</b></span>\",\"col\":12}},{\"type\":\"card\",\"data\":{\"card_name\":\"Selling\",\"col\":4}},{\"type\":\"card\",\"data\":{\"card_name\":\"Items and Pricing\",\"col\":4}},{\"type\":\"card\",\"data\":{\"card_name\":\"Settings\",\"col\":4}},{\"type\":\"card\",\"data\":{\"card_name\":\"Key Reports\",\"col\":4}},{\"type\":\"card\",\"data\":{\"card_name\":\"Other Reports\",\"col\":4}}]",
"creation": "2020-01-28 11:49:12.092882",
"docstatus": 0,
"doctype": "Workspace",
@ -314,118 +314,11 @@
"onboard": 0,
"type": "Link"
},
{
"hidden": 0,
"is_query_report": 0,
"label": "Key Reports",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
{
"dependencies": "",
"hidden": 0,
"is_query_report": 1,
"label": "Sales Analytics",
"link_count": 0,
"link_to": "Sales Analytics",
"link_type": "Report",
"onboard": 1,
"type": "Link"
},
{
"dependencies": "Sales Order",
"hidden": 0,
"is_query_report": 1,
"label": "Sales Order Analysis",
"link_count": 0,
"link_to": "Sales Order Analysis",
"link_type": "Report",
"onboard": 1,
"type": "Link"
},
{
"dependencies": "",
"hidden": 0,
"is_query_report": 0,
"label": "Sales Funnel",
"link_count": 0,
"link_to": "sales-funnel",
"link_type": "Page",
"onboard": 1,
"type": "Link"
},
{
"dependencies": "Sales Order",
"hidden": 0,
"is_query_report": 1,
"label": "Sales Order Trends",
"link_count": 0,
"link_to": "Sales Order Trends",
"link_type": "Report",
"onboard": 0,
"type": "Link"
},
{
"dependencies": "Quotation",
"hidden": 0,
"is_query_report": 1,
"label": "Quotation Trends",
"link_count": 0,
"link_to": "Quotation Trends",
"link_type": "Report",
"onboard": 0,
"type": "Link"
},
{
"dependencies": "Customer",
"hidden": 0,
"is_query_report": 1,
"label": "Customer Acquisition and Loyalty",
"link_count": 0,
"link_to": "Customer Acquisition and Loyalty",
"link_type": "Report",
"onboard": 0,
"type": "Link"
},
{
"dependencies": "Sales Order",
"hidden": 0,
"is_query_report": 1,
"label": "Inactive Customers",
"link_count": 0,
"link_to": "Inactive Customers",
"link_type": "Report",
"onboard": 0,
"type": "Link"
},
{
"dependencies": "Sales Order",
"hidden": 0,
"is_query_report": 1,
"label": "Sales Person-wise Transaction Summary",
"link_count": 0,
"link_to": "Sales Person-wise Transaction Summary",
"link_type": "Report",
"onboard": 0,
"type": "Link"
},
{
"dependencies": "Item",
"hidden": 0,
"is_query_report": 1,
"label": "Item-wise Sales History",
"link_count": 0,
"link_to": "Item-wise Sales History",
"link_type": "Report",
"onboard": 0,
"type": "Link"
},
{
"hidden": 0,
"is_query_report": 0,
"label": "Other Reports",
"link_count": 0,
"link_count": 12,
"onboard": 0,
"type": "Card Break"
},
@ -560,9 +453,258 @@
"link_type": "Report",
"onboard": 0,
"type": "Link"
},
{
"hidden": 0,
"is_query_report": 0,
"label": "Key Reports",
"link_count": 22,
"onboard": 0,
"type": "Card Break"
},
{
"dependencies": "",
"hidden": 0,
"is_query_report": 1,
"label": "Sales Analytics",
"link_count": 0,
"link_to": "Sales Analytics",
"link_type": "Report",
"onboard": 1,
"type": "Link"
},
{
"dependencies": "Sales Order",
"hidden": 0,
"is_query_report": 1,
"label": "Sales Order Analysis",
"link_count": 0,
"link_to": "Sales Order Analysis",
"link_type": "Report",
"onboard": 1,
"type": "Link"
},
{
"dependencies": "",
"hidden": 0,
"is_query_report": 0,
"label": "Sales Funnel",
"link_count": 0,
"link_to": "sales-funnel",
"link_type": "Page",
"onboard": 1,
"type": "Link"
},
{
"dependencies": "Sales Order",
"hidden": 0,
"is_query_report": 1,
"label": "Sales Order Trends",
"link_count": 0,
"link_to": "Sales Order Trends",
"link_type": "Report",
"onboard": 0,
"type": "Link"
},
{
"dependencies": "Quotation",
"hidden": 0,
"is_query_report": 1,
"label": "Quotation Trends",
"link_count": 0,
"link_to": "Quotation Trends",
"link_type": "Report",
"onboard": 0,
"type": "Link"
},
{
"dependencies": "Customer",
"hidden": 0,
"is_query_report": 1,
"label": "Customer Acquisition and Loyalty",
"link_count": 0,
"link_to": "Customer Acquisition and Loyalty",
"link_type": "Report",
"onboard": 0,
"type": "Link"
},
{
"dependencies": "Sales Order",
"hidden": 0,
"is_query_report": 1,
"label": "Inactive Customers",
"link_count": 0,
"link_to": "Inactive Customers",
"link_type": "Report",
"onboard": 0,
"type": "Link"
},
{
"dependencies": "Sales Order",
"hidden": 0,
"is_query_report": 1,
"label": "Sales Person-wise Transaction Summary",
"link_count": 0,
"link_to": "Sales Person-wise Transaction Summary",
"link_type": "Report",
"onboard": 0,
"type": "Link"
},
{
"dependencies": "Item",
"hidden": 0,
"is_query_report": 1,
"label": "Item-wise Sales History",
"link_count": 0,
"link_to": "Item-wise Sales History",
"link_type": "Report",
"onboard": 0,
"type": "Link"
},
{
"dependencies": "Lead",
"hidden": 0,
"is_query_report": 1,
"label": "Lead Details",
"link_count": 0,
"link_to": "Lead Details",
"link_type": "Report",
"onboard": 0,
"type": "Link"
},
{
"dependencies": "Address",
"hidden": 0,
"is_query_report": 1,
"label": "Customer Addresses And Contacts",
"link_count": 0,
"link_to": "Address And Contacts",
"link_type": "Report",
"onboard": 0,
"type": "Link"
},
{
"dependencies": "Item",
"hidden": 0,
"is_query_report": 1,
"label": "Available Stock for Packing Items",
"link_count": 0,
"link_to": "Available Stock for Packing Items",
"link_type": "Report",
"onboard": 0,
"type": "Link"
},
{
"dependencies": "Sales Order",
"hidden": 0,
"is_query_report": 1,
"label": "Pending SO Items For Purchase Request",
"link_count": 0,
"link_to": "Pending SO Items For Purchase Request",
"link_type": "Report",
"onboard": 0,
"type": "Link"
},
{
"dependencies": "Delivery Note",
"hidden": 0,
"is_query_report": 1,
"label": "Delivery Note Trends",
"link_count": 0,
"link_to": "Delivery Note Trends",
"link_type": "Report",
"onboard": 0,
"type": "Link"
},
{
"dependencies": "Sales Invoice",
"hidden": 0,
"is_query_report": 1,
"label": "Sales Invoice Trends",
"link_count": 0,
"link_to": "Sales Invoice Trends",
"link_type": "Report",
"onboard": 0,
"type": "Link"
},
{
"dependencies": "Customer",
"hidden": 0,
"is_query_report": 1,
"label": "Customer Credit Balance",
"link_count": 0,
"link_to": "Customer Credit Balance",
"link_type": "Report",
"onboard": 0,
"type": "Link"
},
{
"dependencies": "Customer",
"hidden": 0,
"is_query_report": 1,
"label": "Customers Without Any Sales Transactions",
"link_count": 0,
"link_to": "Customers Without Any Sales Transactions",
"link_type": "Report",
"onboard": 0,
"type": "Link"
},
{
"dependencies": "Customer",
"hidden": 0,
"is_query_report": 1,
"label": "Sales Partners Commission",
"link_count": 0,
"link_to": "Sales Partners Commission",
"link_type": "Report",
"onboard": 0,
"type": "Link"
},
{
"dependencies": "Sales Order",
"hidden": 0,
"is_query_report": 1,
"label": "Territory Target Variance Based On Item Group",
"link_count": 0,
"link_to": "Territory Target Variance Based On Item Group",
"link_type": "Report",
"onboard": 0,
"type": "Link"
},
{
"dependencies": "Sales Order",
"hidden": 0,
"is_query_report": 1,
"label": "Sales Person Target Variance Based On Item Group",
"link_count": 0,
"link_to": "Sales Person Target Variance Based On Item Group",
"link_type": "Report",
"onboard": 0,
"type": "Link"
},
{
"dependencies": "Sales Order",
"hidden": 0,
"is_query_report": 1,
"label": "Sales Partner Target Variance Based On Item Group",
"link_count": 0,
"link_to": "Sales Partner Target Variance based on Item Group",
"link_type": "Report",
"onboard": 0,
"type": "Link"
},
{
"hidden": 0,
"is_query_report": 1,
"label": "Payment Terms Status for Sales Order",
"link_count": 0,
"link_to": "Payment Terms Status for Sales Order",
"link_type": "Report",
"onboard": 0,
"type": "Link"
}
],
"modified": "2022-01-13 17:43:02.778627",
"modified": "2022-04-26 13:29:55.087240",
"modified_by": "Administrator",
"module": "Selling",
"name": "Selling",

View File

@ -23,6 +23,10 @@
"is_return",
"issue_credit_note",
"return_against",
"accounting_dimensions_section",
"cost_center",
"dimension_col_break",
"project",
"customer_po_details",
"po_no",
"column_break_17",
@ -115,7 +119,6 @@
"driver_name",
"lr_date",
"more_info",
"project",
"campaign",
"source",
"column_break5",
@ -1309,13 +1312,29 @@
"fieldtype": "Currency",
"label": "Amount Eligible for Commission",
"read_only": 1
},
{
"collapsible": 1,
"fieldname": "accounting_dimensions_section",
"fieldtype": "Section Break",
"label": "Accounting Dimensions"
},
{
"fieldname": "cost_center",
"fieldtype": "Link",
"label": "Cost Center",
"options": "Cost Center"
},
{
"fieldname": "dimension_col_break",
"fieldtype": "Column Break"
}
],
"icon": "fa fa-truck",
"idx": 146,
"is_submittable": 1,
"links": [],
"modified": "2022-03-10 14:29:13.428984",
"modified": "2022-04-26 14:48:08.781837",
"modified_by": "Administrator",
"module": "Stock",
"name": "Delivery Note",
@ -1380,6 +1399,7 @@
"show_name_in_global_search": 1,
"sort_field": "modified",
"sort_order": "DESC",
"states": [],
"timeline_field": "customer",
"title_field": "title",
"track_changes": 1,

View File

@ -24,6 +24,10 @@
"apply_putaway_rule",
"is_return",
"return_against",
"accounting_dimensions_section",
"cost_center",
"dimension_col_break",
"project",
"section_addresses",
"supplier_address",
"contact_person",
@ -107,7 +111,6 @@
"bill_no",
"bill_date",
"more_info",
"project",
"status",
"amended_from",
"range",
@ -1143,13 +1146,29 @@
"label": "Represents Company",
"options": "Company",
"read_only": 1
},
{
"collapsible": 1,
"fieldname": "accounting_dimensions_section",
"fieldtype": "Section Break",
"label": "Accounting Dimensions"
},
{
"fieldname": "cost_center",
"fieldtype": "Link",
"label": "Cost Center",
"options": "Cost Center"
},
{
"fieldname": "dimension_col_break",
"fieldtype": "Column Break"
}
],
"icon": "fa fa-truck",
"idx": 261,
"is_submittable": 1,
"links": [],
"modified": "2022-04-10 22:50:37.761362",
"modified": "2022-04-26 13:41:32.625197",
"modified_by": "Administrator",
"module": "Stock",
"name": "Purchase Receipt",