From a9dda232b20d9124e279172e4a527251ef7bcab5 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Mon, 2 Nov 2015 10:45:18 +0530 Subject: [PATCH 1/2] [minor] move item to top in stock module page --- erpnext/change_log/current/desktop.md | 2 ++ erpnext/config/desktop.py | 4 ++-- erpnext/config/stock.py | 10 +++++----- erpnext/hooks.py | 2 +- 4 files changed, 10 insertions(+), 8 deletions(-) create mode 100644 erpnext/change_log/current/desktop.md diff --git a/erpnext/change_log/current/desktop.md b/erpnext/change_log/current/desktop.md new file mode 100644 index 00000000000..9b4667b8198 --- /dev/null +++ b/erpnext/change_log/current/desktop.md @@ -0,0 +1,2 @@ +- **Desktop Reorganization:** To Do, Calendar, Messages, Notes, Activty have been moved into module **Tools** +- Integrations and Installer has been moved into **Setup** diff --git a/erpnext/config/desktop.py b/erpnext/config/desktop.py index 498d100a120..c3fe141ff89 100644 --- a/erpnext/config/desktop.py +++ b/erpnext/config/desktop.py @@ -64,9 +64,9 @@ def get_data(): "type": "module" }, "Learn": { - "color": "#FCB868", + "color": "#FF888B", "force_show": True, - "icon": "icon-facetime-video", + "icon": "octicon octicon-device-camera-video", "type": "module", "is_help": True } diff --git a/erpnext/config/stock.py b/erpnext/config/stock.py index dab009df3b2..a4a72020081 100644 --- a/erpnext/config/stock.py +++ b/erpnext/config/stock.py @@ -7,6 +7,11 @@ def get_data(): "label": _("Documents"), "icon": "icon-star", "items": [ + { + "type": "doctype", + "name": "Item", + "description": _("All Products or Services."), + }, { "type": "doctype", "name": "Material Request", @@ -32,11 +37,6 @@ def get_data(): "name": "Installation Note", "description": _("Installation record for a Serial No.") }, - { - "type": "doctype", - "name": "Item", - "description": _("All Products or Services."), - }, { "type": "doctype", "name": "Warehouse", diff --git a/erpnext/hooks.py b/erpnext/hooks.py index 471b69220f8..2c647e8803f 100644 --- a/erpnext/hooks.py +++ b/erpnext/hooks.py @@ -30,7 +30,7 @@ blogs. app_icon = "icon-th" app_color = "#e74c3c" app_version = "6.6.7" -github_link = "https://github.com/frappe/erpnext" +source_link = "https://github.com/frappe/erpnext" error_report_email = "support@erpnext.com" From bd4814fbb7e97c2f3181335c18877dd28c724be8 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Mon, 2 Nov 2015 17:47:10 +0530 Subject: [PATCH 2/2] [fix] email digest periods for weekly and monthly --- .../doctype/journal_entry/journal_entry.py | 17 ++++++---- .../doctype/email_digest/email_digest.py | 32 ++++++------------- .../email_digest/templates/default.html | 1 + 3 files changed, 21 insertions(+), 29 deletions(-) diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.py b/erpnext/accounts/doctype/journal_entry/journal_entry.py index 835679c2411..c5035adcb6b 100644 --- a/erpnext/accounts/doctype/journal_entry/journal_entry.py +++ b/erpnext/accounts/doctype/journal_entry/journal_entry.py @@ -176,6 +176,9 @@ class JournalEntry(AccountsController): against_voucher = frappe.db.get_value(d.reference_type, d.reference_name, [scrub(dt) for dt in field_dict.get(d.reference_type)]) + if not against_voucher: + frappe.throw(_("Row {0}: Invalid reference {1}").format(d.idx, d.reference_name)) + # check if party and account match if d.reference_type in ("Sales Invoice", "Purchase Invoice"): if (against_voucher[0] != d.party or against_voucher[1] != d.account): @@ -500,16 +503,16 @@ def get_default_bank_cash_account(company, voucher_type, mode_of_payment=None): if voucher_type=="Bank Entry": account = frappe.db.get_value("Company", company, "default_bank_account") if not account: - account = frappe.db.get_value("Account", + account = frappe.db.get_value("Account", {"company": company, "account_type": "Bank", "is_group": 0}) elif voucher_type=="Cash Entry": account = frappe.db.get_value("Company", company, "default_cash_account") if not account: - account = frappe.db.get_value("Account", + account = frappe.db.get_value("Account", {"company": company, "account_type": "Cash", "is_group": 0}) if account: - account_details = frappe.db.get_value("Account", account, + account_details = frappe.db.get_value("Account", account, ["account_currency", "account_type"], as_dict=1) return { "account": account, @@ -731,15 +734,15 @@ def get_account_balance_and_party_type(account, date, company, debit=None, credi def get_exchange_rate(account, account_currency=None, company=None, reference_type=None, reference_name=None, debit=None, credit=None, exchange_rate=None): from erpnext.setup.utils import get_exchange_rate - account_details = frappe.db.get_value("Account", account, + account_details = frappe.db.get_value("Account", account, ["account_type", "root_type", "account_currency", "company"], as_dict=1) - + if not company: company = account_details.company - + if not account_currency: account_currency = account_details.account_currency - + company_currency = get_company_currency(company) if account_currency != company_currency: diff --git a/erpnext/setup/doctype/email_digest/email_digest.py b/erpnext/setup/doctype/email_digest/email_digest.py index e2b0de0eb6d..2053fc003b4 100644 --- a/erpnext/setup/doctype/email_digest/email_digest.py +++ b/erpnext/setup/doctype/email_digest/email_digest.py @@ -111,7 +111,8 @@ class EmailDigest(Document): """Set standard digest style""" context.text_muted = '#8D99A6' context.text_color = '#36414C' - context.h1 = 'margin-bottom: 30px; margin-bottom: 0; margin-top: 40px; font-weight: 400;' + context.h1 = 'margin-bottom: 30px; margin-top: 40px; font-weight: 400; font-size: 30px;' + context.h2 = 'margin-bottom: 30px; margin-top: -20px; font-weight: 400; font-size: 20px;' context.label_css = '''display: inline-block; color: {text_muted}; padding: 3px 7px; margin-right: 7px;'''.format(text_muted = context.text_muted) context.section_head = 'margin-top: 60px; font-size: 16px;' @@ -152,7 +153,7 @@ class EmailDigest(Document): todo_list = frappe.db.sql("""select * from `tabToDo` where (owner=%s or assigned_by=%s) and status="Open" - order by field(priority, 'High', 'Medium', 'Low') asc, date asc""", + order by field(priority, 'High', 'Medium', 'Low') asc, date asc limit 20""", (user_id, user_id), as_dict=True) for t in todo_list: @@ -289,6 +290,7 @@ class EmailDigest(Document): elif self.frequency == "Weekly": # from date is the previous week's monday from_date = today - timedelta(days=today.weekday(), weeks=1) + # to date is sunday i.e. the previous day to_date = from_date + timedelta(days=6) else: @@ -300,32 +302,18 @@ class EmailDigest(Document): return from_date, to_date def set_dates(self): - today = now_datetime().date() + self.future_from_date, self.future_to_date = self.from_date, self.to_date # decide from date based on email digest frequency if self.frequency == "Daily": - # from date, to_date is today - self.future_from_date = self.future_to_date = today - self.past_from_date = self.past_to_date = today - relativedelta(days = 1) + self.past_from_date = self.past_to_date = self.future_from_date - relativedelta(days = 1) elif self.frequency == "Weekly": - # from date is the current week's monday - self.future_from_date = today - relativedelta(days=today.weekday()) - - # to date is the current week's sunday - self.future_to_date = self.future_from_date + relativedelta(days=6) - - self.past_from_date = self.future_from_date - relativedelta(days=7) - self.past_to_date = self.future_to_date - relativedelta(days=7) + self.past_from_date = self.future_from_date - relativedelta(weeks=1) + self.past_to_date = self.future_from_date - relativedelta(days=1) else: - # from date is the 1st day of the current month - self.future_from_date = today - relativedelta(days=today.day-1) - - # to date is the last day of the current month - self.future_to_date = self.future_from_date + relativedelta(days=-1, months=1) - - self.past_from_date = self.future_from_date - relativedelta(month=1) - self.past_to_date = self.future_to_date - relativedelta(month=1) + self.past_from_date = self.future_from_date - relativedelta(months=1) + self.past_to_date = self.future_from_date - relativedelta(days=1) def get_next_sending(self): from_date, to_date = self.get_from_to_date() diff --git a/erpnext/setup/doctype/email_digest/templates/default.html b/erpnext/setup/doctype/email_digest/templates/default.html index d0bd13a7d48..bd88baf9f17 100644 --- a/erpnext/setup/doctype/email_digest/templates/default.html +++ b/erpnext/setup/doctype/email_digest/templates/default.html @@ -11,6 +11,7 @@

{{ title }}

+

{{ company }}

{% if frequency == "Daily" %} {{ frappe.format_date(future_from_date) }}