mirror of
https://github.com/frappe/erpnext.git
synced 2026-09-01 23:53:21 +00:00
Merge branch 'develop' into setup_wizard
This commit is contained in:
@@ -29,7 +29,8 @@ frappe.ui.form.on("Company", {
|
||||
|
||||
company_name: function(frm) {
|
||||
if(frm.doc.__islocal) {
|
||||
let parts = frm.doc.company_name.split();
|
||||
// add missing " " arg in split method
|
||||
let parts = frm.doc.company_name.split(" ");
|
||||
let abbr = $.map(parts, function (p) {
|
||||
return p? p.substr(0, 1) : null;
|
||||
}).join("");
|
||||
|
||||
@@ -725,7 +725,7 @@
|
||||
"icon": "fa fa-building",
|
||||
"idx": 1,
|
||||
"image_field": "company_logo",
|
||||
"modified": "2019-07-04 22:20:45.104307",
|
||||
"modified": "2019-11-22 13:04:47.470768",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Setup",
|
||||
"name": "Company",
|
||||
@@ -767,6 +767,18 @@
|
||||
{
|
||||
"read": 1,
|
||||
"role": "Projects User"
|
||||
},
|
||||
{
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Accounts Manager",
|
||||
"share": 1,
|
||||
"write": 1
|
||||
}
|
||||
],
|
||||
"show_name_in_global_search": 1,
|
||||
|
||||
@@ -14,10 +14,14 @@ class CurrencyExchange(Document):
|
||||
purpose = ""
|
||||
if not self.date:
|
||||
self.date = nowdate()
|
||||
|
||||
# If both selling and buying enabled
|
||||
purpose = "Selling-Buying"
|
||||
if cint(self.for_buying)==0 and cint(self.for_selling)==1:
|
||||
purpose = "Selling"
|
||||
if cint(self.for_buying)==1 and cint(self.for_selling)==0:
|
||||
purpose = "Buying"
|
||||
|
||||
self.name = '{0}-{1}-{2}{3}'.format(formatdate(get_datetime_str(self.date), "yyyy-MM-dd"),
|
||||
self.from_currency, self.to_currency, ("-" + purpose) if purpose else "")
|
||||
|
||||
|
||||
@@ -11,7 +11,9 @@ test_records = frappe.get_test_records('Currency Exchange')
|
||||
|
||||
def save_new_records(test_records):
|
||||
for record in test_records:
|
||||
purpose = str("")
|
||||
# If both selling and buying enabled
|
||||
purpose = "Selling-Buying"
|
||||
|
||||
if cint(record.get("for_buying"))==0 and cint(record.get("for_selling"))==1:
|
||||
purpose = "Selling"
|
||||
if cint(record.get("for_buying"))==1 and cint(record.get("for_selling"))==0:
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe import _
|
||||
from frappe.utils import fmt_money, formatdate, format_time, now_datetime, \
|
||||
get_url_to_form, get_url_to_list, flt, get_link_to_report
|
||||
from frappe.utils import (fmt_money, formatdate, format_time, now_datetime,
|
||||
get_url_to_form, get_url_to_list, flt, get_link_to_report, add_to_date, today)
|
||||
from datetime import timedelta
|
||||
from dateutil.relativedelta import relativedelta
|
||||
from frappe.core.doctype.user.user import STANDARD_USERS
|
||||
@@ -151,8 +151,9 @@ class EmailDigest(Document):
|
||||
def get_calendar_events(self):
|
||||
"""Get calendar events for given user"""
|
||||
from frappe.desk.doctype.event.event import get_events
|
||||
events = get_events(self.future_from_date.strftime("%Y-%m-%d"),
|
||||
self.future_to_date.strftime("%Y-%m-%d")) or []
|
||||
from_date, to_date = get_future_date_for_calendaer_event(self.frequency)
|
||||
|
||||
events = get_events(from_date, to_date)
|
||||
|
||||
event_count = 0
|
||||
for i, e in enumerate(events):
|
||||
@@ -825,4 +826,14 @@ def get_count_for_period(account, fieldname, from_date, to_date):
|
||||
last_year_closing_count = get_count_on(account, fieldname, fy_start_date - timedelta(days=1))
|
||||
count = count_on_to_date + (last_year_closing_count - count_before_from_date)
|
||||
|
||||
return count
|
||||
return count
|
||||
|
||||
def get_future_date_for_calendaer_event(frequency):
|
||||
from_date = to_date = today()
|
||||
|
||||
if frequency == "Weekly":
|
||||
to_date = add_to_date(from_date, weeks=1)
|
||||
elif frequency == "Monthly":
|
||||
to_date = add_to_date(from_date, months=1)
|
||||
|
||||
return from_date, to_date
|
||||
@@ -39,6 +39,7 @@ class ItemGroup(NestedSet, WebsiteGenerator):
|
||||
invalidate_cache_for(self)
|
||||
self.validate_name_with_item()
|
||||
self.validate_one_root()
|
||||
self.delete_child_item_groups_key()
|
||||
|
||||
def make_route(self):
|
||||
'''Make website route'''
|
||||
@@ -58,6 +59,7 @@ class ItemGroup(NestedSet, WebsiteGenerator):
|
||||
def on_trash(self):
|
||||
NestedSet.on_trash(self)
|
||||
WebsiteGenerator.on_trash(self)
|
||||
self.delete_child_item_groups_key()
|
||||
|
||||
def validate_name_with_item(self):
|
||||
if frappe.db.exists("Item", self.name):
|
||||
@@ -83,6 +85,9 @@ class ItemGroup(NestedSet, WebsiteGenerator):
|
||||
|
||||
return context
|
||||
|
||||
def delete_child_item_groups_key(self):
|
||||
frappe.cache().hdel("child_item_groups", self.name)
|
||||
|
||||
@frappe.whitelist(allow_guest=True)
|
||||
def get_product_list_for_group(product_group=None, start=0, limit=10, search=None):
|
||||
if product_group:
|
||||
@@ -136,6 +141,7 @@ def get_child_groups_for_list_in_html(item_group, start, limit, search):
|
||||
fields = ['name', 'route', 'description', 'image'],
|
||||
filters = dict(
|
||||
show_in_website = 1,
|
||||
parent_item_group = item_group.name,
|
||||
lft = ('>', item_group.lft),
|
||||
rgt = ('<', item_group.rgt),
|
||||
),
|
||||
@@ -167,6 +173,19 @@ def get_child_groups(item_group_name):
|
||||
from `tabItem Group` where lft>=%(lft)s and rgt<=%(rgt)s
|
||||
and show_in_website = 1""", {"lft": item_group.lft, "rgt": item_group.rgt})
|
||||
|
||||
def get_child_item_groups(item_group_name):
|
||||
child_item_groups = frappe.cache().hget("child_item_groups", item_group_name)
|
||||
|
||||
if not child_item_groups:
|
||||
item_group = frappe.get_cached_doc("Item Group", item_group_name)
|
||||
|
||||
child_item_groups = [d.name for d in frappe.get_all('Item Group',
|
||||
filters= {'lft': ('>=', item_group.lft),'rgt': ('>=', item_group.rgt)})]
|
||||
|
||||
frappe.cache().hset("child_item_groups", item_group_name, child_item_groups)
|
||||
|
||||
return child_item_groups or {}
|
||||
|
||||
def get_item_for_list_in_html(context):
|
||||
# add missing absolute link in files
|
||||
# user may forget it during upload
|
||||
|
||||
Reference in New Issue
Block a user