mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-20 21:49:18 +00:00
Merge branch 'hotfix' into patch-2
This commit is contained in:
@@ -10,4 +10,10 @@ frappe.require("assets/erpnext/js/financial_statements.js", function() {
|
|||||||
"fieldtype": "Check",
|
"fieldtype": "Check",
|
||||||
"default": 1
|
"default": 1
|
||||||
});
|
});
|
||||||
|
|
||||||
|
frappe.query_reports["Balance Sheet"]["filters"].push({
|
||||||
|
"fieldname": "include_default_book_entries",
|
||||||
|
"label": __("Include Default Book Entries"),
|
||||||
|
"fieldtype": "Check"
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -15,4 +15,10 @@ frappe.require("assets/erpnext/js/financial_statements.js", function() {
|
|||||||
"label": __("Accumulated Values"),
|
"label": __("Accumulated Values"),
|
||||||
"fieldtype": "Check"
|
"fieldtype": "Check"
|
||||||
});
|
});
|
||||||
|
|
||||||
|
frappe.query_reports["Cash Flow"]["filters"].push({
|
||||||
|
"fieldname": "include_default_book_entries",
|
||||||
|
"label": __("Include Default Book Entries"),
|
||||||
|
"fieldtype": "Check"
|
||||||
|
});
|
||||||
});
|
});
|
||||||
@@ -14,8 +14,8 @@ def execute(filters=None):
|
|||||||
if cint(frappe.db.get_single_value('Accounts Settings', 'use_custom_cash_flow')):
|
if cint(frappe.db.get_single_value('Accounts Settings', 'use_custom_cash_flow')):
|
||||||
from erpnext.accounts.report.cash_flow.custom_cash_flow import execute as execute_custom
|
from erpnext.accounts.report.cash_flow.custom_cash_flow import execute as execute_custom
|
||||||
return execute_custom(filters=filters)
|
return execute_custom(filters=filters)
|
||||||
|
|
||||||
period_list = get_period_list(filters.from_fiscal_year, filters.to_fiscal_year,
|
period_list = get_period_list(filters.from_fiscal_year, filters.to_fiscal_year,
|
||||||
filters.periodicity, filters.accumulated_values, filters.company)
|
filters.periodicity, filters.accumulated_values, filters.company)
|
||||||
|
|
||||||
cash_flow_accounts = get_cash_flow_accounts()
|
cash_flow_accounts = get_cash_flow_accounts()
|
||||||
@@ -25,18 +25,18 @@ def execute(filters=None):
|
|||||||
accumulated_values=filters.accumulated_values, ignore_closing_entries=True, ignore_accumulated_values_for_fy= True)
|
accumulated_values=filters.accumulated_values, ignore_closing_entries=True, ignore_accumulated_values_for_fy= True)
|
||||||
expense = get_data(filters.company, "Expense", "Debit", period_list, filters=filters,
|
expense = get_data(filters.company, "Expense", "Debit", period_list, filters=filters,
|
||||||
accumulated_values=filters.accumulated_values, ignore_closing_entries=True, ignore_accumulated_values_for_fy= True)
|
accumulated_values=filters.accumulated_values, ignore_closing_entries=True, ignore_accumulated_values_for_fy= True)
|
||||||
|
|
||||||
net_profit_loss = get_net_profit_loss(income, expense, period_list, filters.company)
|
net_profit_loss = get_net_profit_loss(income, expense, period_list, filters.company)
|
||||||
|
|
||||||
data = []
|
data = []
|
||||||
company_currency = frappe.get_cached_value('Company', filters.company, "default_currency")
|
company_currency = frappe.get_cached_value('Company', filters.company, "default_currency")
|
||||||
|
|
||||||
for cash_flow_account in cash_flow_accounts:
|
for cash_flow_account in cash_flow_accounts:
|
||||||
section_data = []
|
section_data = []
|
||||||
data.append({
|
data.append({
|
||||||
"account_name": cash_flow_account['section_header'],
|
"account_name": cash_flow_account['section_header'],
|
||||||
"parent_account": None,
|
"parent_account": None,
|
||||||
"indent": 0.0,
|
"indent": 0.0,
|
||||||
"account": cash_flow_account['section_header']
|
"account": cash_flow_account['section_header']
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -44,18 +44,18 @@ def execute(filters=None):
|
|||||||
# add first net income in operations section
|
# add first net income in operations section
|
||||||
if net_profit_loss:
|
if net_profit_loss:
|
||||||
net_profit_loss.update({
|
net_profit_loss.update({
|
||||||
"indent": 1,
|
"indent": 1,
|
||||||
"parent_account": cash_flow_accounts[0]['section_header']
|
"parent_account": cash_flow_accounts[0]['section_header']
|
||||||
})
|
})
|
||||||
data.append(net_profit_loss)
|
data.append(net_profit_loss)
|
||||||
section_data.append(net_profit_loss)
|
section_data.append(net_profit_loss)
|
||||||
|
|
||||||
for account in cash_flow_account['account_types']:
|
for account in cash_flow_account['account_types']:
|
||||||
account_data = get_account_type_based_data(filters.company,
|
account_data = get_account_type_based_data(filters.company,
|
||||||
account['account_type'], period_list, filters.accumulated_values)
|
account['account_type'], period_list, filters.accumulated_values, filters)
|
||||||
account_data.update({
|
account_data.update({
|
||||||
"account_name": account['label'],
|
"account_name": account['label'],
|
||||||
"account": account['label'],
|
"account": account['label'],
|
||||||
"indent": 1,
|
"indent": 1,
|
||||||
"parent_account": cash_flow_account['section_header'],
|
"parent_account": cash_flow_account['section_header'],
|
||||||
"currency": company_currency
|
"currency": company_currency
|
||||||
@@ -63,7 +63,7 @@ def execute(filters=None):
|
|||||||
data.append(account_data)
|
data.append(account_data)
|
||||||
section_data.append(account_data)
|
section_data.append(account_data)
|
||||||
|
|
||||||
add_total_row_account(data, section_data, cash_flow_account['section_footer'],
|
add_total_row_account(data, section_data, cash_flow_account['section_footer'],
|
||||||
period_list, company_currency)
|
period_list, company_currency)
|
||||||
|
|
||||||
add_total_row_account(data, data, _("Net Change in Cash"), period_list, company_currency)
|
add_total_row_account(data, data, _("Net Change in Cash"), period_list, company_currency)
|
||||||
@@ -105,13 +105,15 @@ def get_cash_flow_accounts():
|
|||||||
# combine all cash flow accounts for iteration
|
# combine all cash flow accounts for iteration
|
||||||
return [operation_accounts, investing_accounts, financing_accounts]
|
return [operation_accounts, investing_accounts, financing_accounts]
|
||||||
|
|
||||||
def get_account_type_based_data(company, account_type, period_list, accumulated_values):
|
def get_account_type_based_data(company, account_type, period_list, accumulated_values, filters):
|
||||||
data = {}
|
data = {}
|
||||||
total = 0
|
total = 0
|
||||||
for period in period_list:
|
for period in period_list:
|
||||||
start_date = get_start_date(period, accumulated_values, company)
|
start_date = get_start_date(period, accumulated_values, company)
|
||||||
|
|
||||||
amount = get_account_type_based_gl_data(company, start_date, period['to_date'], account_type)
|
amount = get_account_type_based_gl_data(company, start_date,
|
||||||
|
period['to_date'], account_type, filters)
|
||||||
|
|
||||||
if amount and account_type == "Depreciation":
|
if amount and account_type == "Depreciation":
|
||||||
amount *= -1
|
amount *= -1
|
||||||
|
|
||||||
@@ -121,14 +123,24 @@ def get_account_type_based_data(company, account_type, period_list, accumulated_
|
|||||||
data["total"] = total
|
data["total"] = total
|
||||||
return data
|
return data
|
||||||
|
|
||||||
def get_account_type_based_gl_data(company, start_date, end_date, account_type):
|
def get_account_type_based_gl_data(company, start_date, end_date, account_type, filters):
|
||||||
|
cond = ""
|
||||||
|
|
||||||
|
if filters.finance_book:
|
||||||
|
cond = " and finance_book = '%s'" %(frappe.db.escape(filters.finance_book))
|
||||||
|
if filters.include_default_book_entries:
|
||||||
|
company_fb = frappe.db.get_value("Company", company, 'default_finance_book')
|
||||||
|
|
||||||
|
cond = """ and finance_book in ('%s', '%s')
|
||||||
|
""" %(frappe.db.escape(filters.finance_book), frappe.db.escape(company_fb))
|
||||||
|
|
||||||
gl_sum = frappe.db.sql_list("""
|
gl_sum = frappe.db.sql_list("""
|
||||||
select sum(credit) - sum(debit)
|
select sum(credit) - sum(debit)
|
||||||
from `tabGL Entry`
|
from `tabGL Entry`
|
||||||
where company=%s and posting_date >= %s and posting_date <= %s
|
where company=%s and posting_date >= %s and posting_date <= %s
|
||||||
and voucher_type != 'Period Closing Voucher'
|
and voucher_type != 'Period Closing Voucher'
|
||||||
and account in ( SELECT name FROM tabAccount WHERE account_type = %s)
|
and account in ( SELECT name FROM tabAccount WHERE account_type = %s) {cond}
|
||||||
""", (company, start_date, end_date, account_type))
|
""".format(cond=cond), (company, start_date, end_date, account_type))
|
||||||
|
|
||||||
return gl_sum[0] if gl_sum and gl_sum[0] else 0
|
return gl_sum[0] if gl_sum and gl_sum[0] else 0
|
||||||
|
|
||||||
@@ -154,7 +166,7 @@ def add_total_row_account(out, data, label, period_list, currency, consolidated
|
|||||||
key = period if consolidated else period['key']
|
key = period if consolidated else period['key']
|
||||||
total_row.setdefault(key, 0.0)
|
total_row.setdefault(key, 0.0)
|
||||||
total_row[key] += row.get(key, 0.0)
|
total_row[key] += row.get(key, 0.0)
|
||||||
|
|
||||||
total_row.setdefault("total", 0.0)
|
total_row.setdefault("total", 0.0)
|
||||||
total_row["total"] += row["total"]
|
total_row["total"] += row["total"]
|
||||||
|
|
||||||
|
|||||||
@@ -55,5 +55,10 @@ frappe.query_reports["Consolidated Financial Statement"] = {
|
|||||||
"fieldtype": "Check",
|
"fieldtype": "Check",
|
||||||
"default": 0
|
"default": 0
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "include_default_book_entries",
|
||||||
|
"label": __("Include Default Book Entries"),
|
||||||
|
"fieldtype": "Check"
|
||||||
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -355,7 +355,8 @@ def set_gl_entries_by_account(from_date, to_date, root_lft, root_rgt, filters, g
|
|||||||
"lft": root_lft,
|
"lft": root_lft,
|
||||||
"rgt": root_rgt,
|
"rgt": root_rgt,
|
||||||
"company": d.name,
|
"company": d.name,
|
||||||
"finance_book": filters.get("finance_book")
|
"finance_book": filters.get("finance_book"),
|
||||||
|
"company_fb": frappe.db.get_value("Company", d.name, 'default_finance_book')
|
||||||
},
|
},
|
||||||
as_dict=True)
|
as_dict=True)
|
||||||
|
|
||||||
@@ -386,7 +387,10 @@ def get_additional_conditions(from_date, ignore_closing_entries, filters):
|
|||||||
additional_conditions.append("gl.posting_date >= %(from_date)s")
|
additional_conditions.append("gl.posting_date >= %(from_date)s")
|
||||||
|
|
||||||
if filters.get("finance_book"):
|
if filters.get("finance_book"):
|
||||||
additional_conditions.append("ifnull(finance_book, '') in (%(finance_book)s, '')")
|
if filters.get("include_default_book_entries"):
|
||||||
|
additional_conditions.append("finance_book in (%(finance_book)s, %(company_fb)s)")
|
||||||
|
else:
|
||||||
|
additional_conditions.append("finance_book in (%(finance_book)s)")
|
||||||
|
|
||||||
return " and {}".format(" and ".join(additional_conditions)) if additional_conditions else ""
|
return " and {}".format(" and ".join(additional_conditions)) if additional_conditions else ""
|
||||||
|
|
||||||
|
|||||||
@@ -359,7 +359,8 @@ def set_gl_entries_by_account(
|
|||||||
"to_date": to_date,
|
"to_date": to_date,
|
||||||
"cost_center": filters.cost_center,
|
"cost_center": filters.cost_center,
|
||||||
"project": filters.project,
|
"project": filters.project,
|
||||||
"finance_book": filters.get("finance_book")
|
"finance_book": filters.get("finance_book"),
|
||||||
|
"company_fb": frappe.db.get_value("Company", company, 'default_finance_book')
|
||||||
},
|
},
|
||||||
as_dict=True)
|
as_dict=True)
|
||||||
|
|
||||||
@@ -393,7 +394,10 @@ def get_additional_conditions(from_date, ignore_closing_entries, filters):
|
|||||||
additional_conditions.append("cost_center in %(cost_center)s")
|
additional_conditions.append("cost_center in %(cost_center)s")
|
||||||
|
|
||||||
if filters.get("finance_book"):
|
if filters.get("finance_book"):
|
||||||
additional_conditions.append("ifnull(finance_book, '') in (%(finance_book)s, '')")
|
if filters.get("include_default_book_entries"):
|
||||||
|
additional_conditions.append("finance_book in (%(finance_book)s, %(company_fb)s)")
|
||||||
|
else:
|
||||||
|
additional_conditions.append("finance_book in (%(finance_book)s)")
|
||||||
|
|
||||||
return " and {}".format(" and ".join(additional_conditions)) if additional_conditions else ""
|
return " and {}".format(" and ".join(additional_conditions)) if additional_conditions else ""
|
||||||
|
|
||||||
|
|||||||
@@ -216,6 +216,11 @@ frappe.query_reports["General Ledger"] = {
|
|||||||
"fieldname": "show_opening_entries",
|
"fieldname": "show_opening_entries",
|
||||||
"label": __("Show Opening Entries"),
|
"label": __("Show Opening Entries"),
|
||||||
"fieldtype": "Check"
|
"fieldtype": "Check"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "include_default_book_entries",
|
||||||
|
"label": __("Include Default Book Entries"),
|
||||||
|
"fieldtype": "Check"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -133,6 +133,10 @@ def get_gl_entries(filters):
|
|||||||
sum(debit_in_account_currency) as debit_in_account_currency,
|
sum(debit_in_account_currency) as debit_in_account_currency,
|
||||||
sum(credit_in_account_currency) as credit_in_account_currency"""
|
sum(credit_in_account_currency) as credit_in_account_currency"""
|
||||||
|
|
||||||
|
if filters.get("include_default_book_entries"):
|
||||||
|
filters['company_fb'] = frappe.db.get_value("Company",
|
||||||
|
filters.get("company"), 'default_finance_book')
|
||||||
|
|
||||||
gl_entries = frappe.db.sql(
|
gl_entries = frappe.db.sql(
|
||||||
"""
|
"""
|
||||||
select
|
select
|
||||||
@@ -188,7 +192,10 @@ def get_conditions(filters):
|
|||||||
conditions.append("project in %(project)s")
|
conditions.append("project in %(project)s")
|
||||||
|
|
||||||
if filters.get("finance_book"):
|
if filters.get("finance_book"):
|
||||||
conditions.append("ifnull(finance_book, '') in (%(finance_book)s, '')")
|
if filters.get("include_default_book_entries"):
|
||||||
|
conditions.append("finance_book in (%(finance_book)s, %(company_fb)s)")
|
||||||
|
else:
|
||||||
|
conditions.append("finance_book in (%(finance_book)s)")
|
||||||
|
|
||||||
from frappe.desk.reportview import build_match_conditions
|
from frappe.desk.reportview import build_match_conditions
|
||||||
match_conditions = build_match_conditions("GL Entry")
|
match_conditions = build_match_conditions("GL Entry")
|
||||||
|
|||||||
@@ -41,6 +41,11 @@ frappe.require("assets/erpnext/js/financial_statements.js", function() {
|
|||||||
"fieldname": "accumulated_values",
|
"fieldname": "accumulated_values",
|
||||||
"label": __("Accumulated Values"),
|
"label": __("Accumulated Values"),
|
||||||
"fieldtype": "Check"
|
"fieldtype": "Check"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "include_default_book_entries",
|
||||||
|
"label": __("Include Default Book Entries"),
|
||||||
|
"fieldtype": "Check"
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ def get_rootwise_opening_balances(filters, report_type):
|
|||||||
if filters.finance_book:
|
if filters.finance_book:
|
||||||
fb_conditions = " and finance_book = %(finance_book)s"
|
fb_conditions = " and finance_book = %(finance_book)s"
|
||||||
if filters.include_default_book_entries:
|
if filters.include_default_book_entries:
|
||||||
fb_conditions = " and (finance_book in (%(finance_book)s, %(company_fb)s) or finance_book is null)"
|
fb_conditions = " and (finance_book in (%(finance_book)s, %(company_fb)s))"
|
||||||
|
|
||||||
additional_conditions += fb_conditions
|
additional_conditions += fb_conditions
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,8 @@ frappe.ui.form.on("Employee Attendance Tool", {
|
|||||||
refresh: function(frm) {
|
refresh: function(frm) {
|
||||||
frm.disable_save();
|
frm.disable_save();
|
||||||
},
|
},
|
||||||
|
|
||||||
onload: function(frm) {
|
onload: function(frm) {
|
||||||
frm.doc.department = frm.doc.branch = frm.doc.company = "All";
|
|
||||||
frm.set_value("date", frappe.datetime.get_today());
|
frm.set_value("date", frappe.datetime.get_today());
|
||||||
erpnext.employee_attendance_tool.load_employees(frm);
|
erpnext.employee_attendance_tool.load_employees(frm);
|
||||||
},
|
},
|
||||||
@@ -24,7 +23,7 @@ frappe.ui.form.on("Employee Attendance Tool", {
|
|||||||
company: function(frm) {
|
company: function(frm) {
|
||||||
erpnext.employee_attendance_tool.load_employees(frm);
|
erpnext.employee_attendance_tool.load_employees(frm);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -17,12 +17,11 @@ def get_employees(date, department = None, branch = None, company = None):
|
|||||||
attendance_not_marked = []
|
attendance_not_marked = []
|
||||||
attendance_marked = []
|
attendance_marked = []
|
||||||
filters = {"status": "Active", "date_of_joining": ["<=", date]}
|
filters = {"status": "Active", "date_of_joining": ["<=", date]}
|
||||||
if department != "All":
|
|
||||||
filters["department"] = department
|
for field, value in {'department': department,
|
||||||
if branch != "All":
|
'branch': branch, 'company': company}.items():
|
||||||
filters["branch"] = branch
|
if value:
|
||||||
if company != "All":
|
filters[field] = value
|
||||||
filters["company"] = company
|
|
||||||
|
|
||||||
employee_list = frappe.get_list("Employee", fields=["employee", "employee_name"], filters=filters, order_by="employee_name")
|
employee_list = frappe.get_list("Employee", fields=["employee", "employee_name"], filters=filters, order_by="employee_name")
|
||||||
marked_employee = {}
|
marked_employee = {}
|
||||||
|
|||||||
@@ -29,7 +29,20 @@ frappe.query_reports["HSN-wise-summary of outward supplies"] = {
|
|||||||
"placeholder":"Company GSTIN",
|
"placeholder":"Company GSTIN",
|
||||||
"options": [""],
|
"options": [""],
|
||||||
"width": "80"
|
"width": "80"
|
||||||
}
|
},
|
||||||
|
{
|
||||||
|
"fieldname":"from_date",
|
||||||
|
"label": __("From Date"),
|
||||||
|
"fieldtype": "Date",
|
||||||
|
"width": "80"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname":"to_date",
|
||||||
|
"label": __("To Date"),
|
||||||
|
"fieldtype": "Date",
|
||||||
|
"width": "80"
|
||||||
|
},
|
||||||
|
|
||||||
],
|
],
|
||||||
onload: (report) => {
|
onload: (report) => {
|
||||||
fetch_gstins(report);
|
fetch_gstins(report);
|
||||||
|
|||||||
@@ -88,7 +88,9 @@ def get_conditions(filters):
|
|||||||
|
|
||||||
for opts in (("company", " and company=%(company)s"),
|
for opts in (("company", " and company=%(company)s"),
|
||||||
("gst_hsn_code", " and gst_hsn_code=%(gst_hsn_code)s"),
|
("gst_hsn_code", " and gst_hsn_code=%(gst_hsn_code)s"),
|
||||||
("company_gstin", " and company_gstin=%(company_gstin)s")):
|
("company_gstin", " and company_gstin=%(company_gstin)s"),
|
||||||
|
("from_date", " and posting_date >= %(from_date)s"),
|
||||||
|
("to_date", "and posting_date <= %(to_date)s")):
|
||||||
if filters.get(opts[0]):
|
if filters.get(opts[0]):
|
||||||
conditions += opts[1]
|
conditions += opts[1]
|
||||||
|
|
||||||
|
|||||||
@@ -20,8 +20,7 @@ class DeliveryTrip(Document):
|
|||||||
# Google Maps returns distances in meters by default
|
# Google Maps returns distances in meters by default
|
||||||
self.default_distance_uom = frappe.db.get_single_value("Global Defaults", "default_distance_unit") or "Meter"
|
self.default_distance_uom = frappe.db.get_single_value("Global Defaults", "default_distance_unit") or "Meter"
|
||||||
self.uom_conversion_factor = frappe.db.get_value("UOM Conversion Factor",
|
self.uom_conversion_factor = frappe.db.get_value("UOM Conversion Factor",
|
||||||
{"from_uom": "Meter", "to_uom": self.default_distance_uom},
|
{"from_uom": "Meter", "to_uom": self.default_distance_uom}, "value")
|
||||||
"value")
|
|
||||||
|
|
||||||
def validate(self):
|
def validate(self):
|
||||||
self.validate_stop_addresses()
|
self.validate_stop_addresses()
|
||||||
@@ -139,7 +138,7 @@ class DeliveryTrip(Document):
|
|||||||
# Include last leg in the final distance calculation
|
# Include last leg in the final distance calculation
|
||||||
self.uom = self.default_distance_uom
|
self.uom = self.default_distance_uom
|
||||||
total_distance = sum([leg.get("distance", {}).get("value", 0.0)
|
total_distance = sum([leg.get("distance", {}).get("value", 0.0)
|
||||||
for leg in directions.get("legs")]) # in meters
|
for leg in directions.get("legs")]) # in meters
|
||||||
self.total_distance = total_distance * self.uom_conversion_factor
|
self.total_distance = total_distance * self.uom_conversion_factor
|
||||||
else:
|
else:
|
||||||
idx += len(route) - 1
|
idx += len(route) - 1
|
||||||
@@ -358,8 +357,12 @@ def notify_customers(delivery_trip):
|
|||||||
email_recipients = []
|
email_recipients = []
|
||||||
|
|
||||||
for stop in delivery_trip.delivery_stops:
|
for stop in delivery_trip.delivery_stops:
|
||||||
contact_info = frappe.db.get_value("Contact", stop.contact,
|
contact_info = frappe.db.get_value("Contact", stop.contact, ["first_name", "last_name", "email_id"], as_dict=1)
|
||||||
["first_name", "last_name", "email_id", "gender"], as_dict=1)
|
|
||||||
|
context.update({"items": []})
|
||||||
|
if stop.delivery_note:
|
||||||
|
items = frappe.get_all("Delivery Note Item", filters={"parent": stop.delivery_note, "docstatus": 1}, fields=["*"])
|
||||||
|
context.update({"items": items})
|
||||||
|
|
||||||
if contact_info and contact_info.email_id:
|
if contact_info and contact_info.email_id:
|
||||||
context.update(stop.as_dict())
|
context.update(stop.as_dict())
|
||||||
@@ -369,9 +372,9 @@ def notify_customers(delivery_trip):
|
|||||||
dispatch_template = frappe.get_doc("Email Template", dispatch_template_name)
|
dispatch_template = frappe.get_doc("Email Template", dispatch_template_name)
|
||||||
|
|
||||||
frappe.sendmail(recipients=contact_info.email_id,
|
frappe.sendmail(recipients=contact_info.email_id,
|
||||||
subject=dispatch_template.subject,
|
subject=dispatch_template.subject,
|
||||||
message=frappe.render_template(dispatch_template.response, context),
|
message=frappe.render_template(dispatch_template.response, context),
|
||||||
attachments=get_attachments(stop))
|
attachments=get_attachments(stop))
|
||||||
|
|
||||||
stop.db_set("email_sent_to", contact_info.email_id)
|
stop.db_set("email_sent_to", contact_info.email_id)
|
||||||
email_recipients.append(contact_info.email_id)
|
email_recipients.append(contact_info.email_id)
|
||||||
@@ -388,9 +391,7 @@ def get_attachments(delivery_stop):
|
|||||||
return []
|
return []
|
||||||
|
|
||||||
dispatch_attachment = frappe.db.get_single_value("Delivery Settings", "dispatch_attachment")
|
dispatch_attachment = frappe.db.get_single_value("Delivery Settings", "dispatch_attachment")
|
||||||
attachments = frappe.attach_print("Delivery Note",
|
attachments = frappe.attach_print("Delivery Note", delivery_stop.delivery_note,
|
||||||
delivery_stop.delivery_note,
|
file_name="Delivery Note", print_format=dispatch_attachment)
|
||||||
file_name="Delivery Note",
|
|
||||||
print_format=dispatch_attachment)
|
|
||||||
|
|
||||||
return [attachments]
|
return [attachments]
|
||||||
|
|||||||
Reference in New Issue
Block a user