Skip to content

Commit

Permalink
Merge branch 'v12-pre-release' into version-12
Browse files Browse the repository at this point in the history
  • Loading branch information
sahil28297 committed Feb 20, 2020
2 parents 5a64f56 + 103c1bd commit 9583bed
Show file tree
Hide file tree
Showing 81 changed files with 993 additions and 431 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/backport.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Backport
on:
pull_request:
types:
- closed
- labeled

jobs:
backport:
runs-on: ubuntu-18.04
name: Backport
steps:
- name: Backport
uses: tibdex/backport@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
43 changes: 25 additions & 18 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
language: python
dist: trusty
sudo: required

addons:
hosts:
Expand Down Expand Up @@ -39,6 +38,16 @@ matrix:
env: DB=mariadb TYPE=server
script: bench --site test_site run-tests --coverage

before_install:
# install wkhtmltopdf
- wget -O /tmp/wkhtmltox.tar.xz https://github.com/frappe/wkhtmltopdf/raw/master/wkhtmltox-0.12.3_linux-generic-amd64.tar.xz
- tar -xf /tmp/wkhtmltox.tar.xz -C /tmp
- sudo mv /tmp/wkhtmltox/bin/wkhtmltopdf /usr/local/bin/wkhtmltopdf
- sudo chmod o+x /usr/local/bin/wkhtmltopdf

# install cups
- sudo apt-get install libcups2-dev

install:
- cd ~
- source ./.nvm/nvm.sh
Expand All @@ -52,23 +61,20 @@ install:
- mkdir ~/frappe-bench/sites/test_site
- cp $TRAVIS_BUILD_DIR/.travis/$DB.json ~/frappe-bench/sites/test_site/site_config.json

- mysql -u root -e "SET GLOBAL character_set_server = 'utf8mb4'"
- mysql -u root -e "SET GLOBAL collation_server = 'utf8mb4_unicode_ci'"

- mysql -u root -e "CREATE DATABASE test_frappe"
- mysql -u root -e "CREATE USER 'test_frappe'@'localhost' IDENTIFIED BY 'test_frappe'"
- mysql -u root -e "GRANT ALL PRIVILEGES ON \`test_frappe\`.* TO 'test_frappe'@'localhost'"

- mysql -u root -e "UPDATE mysql.user SET Password=PASSWORD('travis') WHERE User='root'"
- mysql -u root -e "FLUSH PRIVILEGES"

- psql -c "CREATE DATABASE test_frappe" -U postgres
- psql -c "CREATE USER test_frappe WITH PASSWORD 'test_frappe'" -U postgres

- wget -O /tmp/wkhtmltox.tar.xz https://github.com/frappe/wkhtmltopdf/raw/master/wkhtmltox-0.12.3_linux-generic-amd64.tar.xz
- tar -xf /tmp/wkhtmltox.tar.xz -C /tmp
- sudo mv /tmp/wkhtmltox/bin/wkhtmltopdf /usr/local/bin/wkhtmltopdf
- sudo chmod o+x /usr/local/bin/wkhtmltopdf
- if [ $DB == "mariadb" ];then
mysql -u root -e "SET GLOBAL character_set_server = 'utf8mb4'";
mysql -u root -e "SET GLOBAL collation_server = 'utf8mb4_unicode_ci'";
mysql -u root -e "CREATE DATABASE test_frappe";
mysql -u root -e "CREATE USER 'test_frappe'@'localhost' IDENTIFIED BY 'test_frappe'";
mysql -u root -e "GRANT ALL PRIVILEGES ON \`test_frappe\`.* TO 'test_frappe'@'localhost'";
mysql -u root -e "UPDATE mysql.user SET Password=PASSWORD('travis') WHERE User='root'";
mysql -u root -e "FLUSH PRIVILEGES";
fi

- if [ $DB == "postgres" ];then
psql -c "CREATE DATABASE test_frappe" -U postgres;
psql -c "CREATE USER test_frappe WITH PASSWORD 'test_frappe'" -U postgres;
fi

- cd ./frappe-bench

Expand All @@ -85,5 +91,6 @@ install:
- bench build --app frappe

after_script:
- pip install coverage==4.5.4
- pip install python-coveralls
- coveralls -b apps/frappe -d ../../sites/.coverage
5 changes: 2 additions & 3 deletions cypress/integration/awesome_bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,8 @@ context('Awesome Bar', () => {

cy.get('h1').should('contain', 'To Do');

cy.get('.toggle-filter')
.should('have.length', 1)
.should('contain', 'ID like %test%');
cy.get('[data-original-title="Name"] > .input-with-feedback')
.should('have.value', '%test%');
});

it('navigates to new form', () => {
Expand Down
6 changes: 4 additions & 2 deletions cypress/integration/report_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@ context('Report View', () => {
cy.server();
cy.route('POST', 'api/method/frappe.client.set_value').as('value-update');
cy.visit(`/desk#List/${doctype_name}/Report`);
let cell = cy.get('.dt-row-0 > .dt-cell--col-3');
// check status column added from docstatus
cy.get('.dt-row-0 > .dt-cell--col-3').should('contain', 'Submitted');
let cell = cy.get('.dt-row-0 > .dt-cell--col-4');
// select the cell
cell.dblclick();
cell.find('input[data-fieldname="enabled"]').check({force: true});
cy.get('.dt-row-0 > .dt-cell--col-4').click();
cy.get('.dt-row-0 > .dt-cell--col-5').click();
cy.wait('@value-update');
cy.get('@doc').then(doc => {
cy.call('frappe.client.get_value', {
Expand Down
15 changes: 12 additions & 3 deletions frappe/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
reload(sys)
sys.setdefaultencoding("utf-8")

__version__ = '12.2.1'
__version__ = '12.3.0'
__title__ = "Frappe Framework"

local = Local()
Expand Down Expand Up @@ -339,6 +339,9 @@ def _raise_exception():
if alert:
out.alert = 1

if raise_exception:
out.raise_exception = 1

if primary_action:
out.primary_action = primary_action

Expand All @@ -352,6 +355,13 @@ def _raise_exception():
def clear_messages():
local.message_log = []

def get_message_log():
log = []
for msg_out in local.message_log:
log.append(json.loads(msg_out))

return log

def clear_last_message():
if len(local.message_log) > 0:
local.message_log = local.message_log[:-1]
Expand Down Expand Up @@ -430,7 +440,7 @@ def sendmail(recipients=[], sender="", subject="No Subject", message="No Message
:param recipients: List of recipients.
:param sender: Email sender. Default is current user.
:param sender: Email sender. Default is current user or default outgoing account.
:param subject: Email Subject.
:param message: (or `content`) Email Content.
:param as_markdown: Convert content markdown to HTML.
Expand All @@ -452,7 +462,6 @@ def sendmail(recipients=[], sender="", subject="No Subject", message="No Message
:param args: Arguments for rendering the template
:param header: Append header in email
"""

text_content = None
if template:
message, text_content = get_email_from_template(template, args)
Expand Down
4 changes: 4 additions & 0 deletions frappe/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ def handle():
frappe.local.response.update({
"data": doc.save().as_dict()
})

if doc.parenttype and doc.parent:
frappe.get_doc(doc.parenttype, doc.parent).save()

frappe.db.commit()

if frappe.local.request.method=="DELETE":
Expand Down
4 changes: 2 additions & 2 deletions frappe/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
from werkzeug.wrappers import Request
from werkzeug.local import LocalManager
from werkzeug.exceptions import HTTPException, NotFound
from werkzeug.contrib.profiler import ProfilerMiddleware
from werkzeug.wsgi import SharedDataMiddleware
from werkzeug.middleware.profiler import ProfilerMiddleware
from werkzeug.middleware.shared_data import SharedDataMiddleware

import frappe
import frappe.handler
Expand Down
28 changes: 20 additions & 8 deletions frappe/automation/doctype/auto_repeat/auto_repeat.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,16 +212,30 @@ def send_notification(self, new_doc):
elif "{" in self.subject:
subject = frappe.render_template(self.subject, {'doc': new_doc})

if not self.message:
print_format = self.print_format or 'Standard'
error_string = None

try:
attachments = [frappe.attach_print(new_doc.doctype, new_doc.name,
file_name=new_doc.name, print_format=print_format)]

except frappe.PermissionError:
error_string = _("A recurring {0} {1} has been created for you via Auto Repeat {2}.").format(new_doc.doctype, new_doc.name, self.name)
error_string += "<br><br>"

error_string += _("{0}: Failed to attach new recurring document. To enable attaching document in the auto repeat notification email, enable {1} in Print Settings").format(
frappe.bold(_('Note')),
frappe.bold(_('Allow Print for Draft'))
)
attachments = '[]'

if error_string:
message = error_string
elif not self.message:
message = _("Please find attached {0}: {1}").format(new_doc.doctype, new_doc.name)
elif "{" in self.message:
message = frappe.render_template(self.message, {'doc': new_doc})

print_format = self.print_format or 'Standard'

attachments = [frappe.attach_print(new_doc.doctype, new_doc.name,
file_name=new_doc.name, print_format=print_format)]

recipients = self.recipients.split('\n')

make(doctype=new_doc.doctype, name=new_doc.name, recipients=recipients,
Expand Down Expand Up @@ -276,11 +290,9 @@ def get_next_schedule_date(schedule_date, frequency, start_date, repeat_on_day=N

day_count = 0
if month_count and repeat_on_last_day:
next_date = get_next_date(start_date, month_count, 31)
day_count = 31
next_date = get_next_date(start_date, month_count, day_count)
elif month_count and repeat_on_day:
next_date = get_next_date(start_date, month_count, repeat_on_day)
day_count = repeat_on_day
next_date = get_next_date(start_date, month_count, day_count)
elif month_count:
Expand Down
11 changes: 3 additions & 8 deletions frappe/automation/doctype/auto_repeat/test_auto_repeat.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,9 @@ def test_next_schedule_date(self):
dict(doctype='ToDo', description='test next schedule date todo', assigned_by='Administrator')).insert()
doc = make_auto_repeat(frequency='Monthly', reference_document=todo.name, start_date=add_months(today(), -2))

#check next_schedule_date is set as per current date
#it should not be a previous month's date
self.assertEqual(doc.next_schedule_date, current_date)
data = get_auto_repeat_entries(current_date)
create_repeated_entries(data)
docnames = frappe.get_all(doc.reference_doctype, {'auto_repeat': doc.name})
#the original doc + the repeated doc
self.assertEqual(len(docnames), 2)
# next_schedule_date is set as on or after current date
# it should not be a previous month's date
self.assertTrue((doc.next_schedule_date >= current_date))


def make_auto_repeat(**args):
Expand Down
17 changes: 17 additions & 0 deletions frappe/change_log/v12/v12_3_0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Version 12.3.0 Release Notes

- Fixed user's permission issue while loading query report data ([#9231](https://github.com/frappe/frappe/pull/9231))
- Fixed issue with group by reports not being saved ([#9255](https://github.com/frappe/frappe/pull/9255))
- In Report View, status field will now be derived from docstatus or workflow status field if not in docfields ([#9279](https:9279//github.com/frappe/frappe/pull/))
- Reset document email link on changing the document([#9271](https://github.com/frappe/frappe/pull/9271))
- Fixed issues with Dashboard Chart filter ([#9298](https://github.com/frappe/frappe/pull/9298))
- Support Before/After Save document events for server scripts ([#9332](https://github.com/frappe/frappe/pull/9332))
- Fixed Auto Email Report which were not working for the prepared report ([#9344](https://github.com/frappe/frappe/pull/9344))
- Updated breadcrumb itemtype to schema.org ([#9348](https://github.com/frappe/frappe/pull/9348))
- Added in_quick_entry option for custom field ([#9395](https://github.com/frappe/frappe/pull/9395))
- Release notes/update popup will be only shown to System Managers ([#9410](https://github.com/frappe/frappe/pull/9410))
- Added ability to dynamically skip total row in Script Reports ([#9414](https://github.com/frappe/frappe/pull/9414))
- Retain standard filter input fields on reload ([#9446](https://github.com/frappe/frappe/pull/9446))
- Hide Cancel button if workflow state and action for Cancel is defined ([#9423](https://github.com/frappe/frappe/pull/9423))
- Automatically set workflow state when some action is performed on a document from the backend if workflow exists ([#9498](https://github.com/frappe/frappe/pull/9498))
- Bulk Workflow Action will be rolled back on error ([#9443](https://github.com/frappe/frappe/pull/9443))
19 changes: 16 additions & 3 deletions frappe/contacts/doctype/address/address.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,15 @@ frappe.ui.form.on("Address", {
}
});
frm.refresh_field("links");

if (frm.doc.links) {
for (let i in frm.doc.links) {
let link = frm.doc.links[i];
frm.add_custom_button(__("{0}: {1}", [__(link.link_doctype), __(link.link_name)]), function() {
frappe.set_route("Form", link.link_doctype, link.link_name);
}, __("Links"));
}
}
},
validate: function(frm) {
// clear linked customer / supplier / sales partner on saving...
Expand All @@ -38,9 +47,13 @@ frappe.ui.form.on("Address", {
() => frappe.timeout(1),
() => {
const last_doc = frappe.contacts.get_last_doc(frm);
if(frappe.dynamic_link && frappe.dynamic_link.doc
&& frappe.dynamic_link.doc.name == last_doc.docname){
frappe.set_route('Form', last_doc.doctype, last_doc.docname);
if (frappe.dynamic_link && frappe.dynamic_link.doc && frappe.dynamic_link.doc.name == last_doc.docname) {
for (let i in frm.doc.links) {
let link = frm.doc.links[i];
if (last_doc.doctype == link.link_doctype && last_doc.docname == link.link_name) {
frappe.set_route('Form', last_doc.doctype, last_doc.docname);
}
}
}
}
]);
Expand Down
5 changes: 3 additions & 2 deletions frappe/contacts/doctype/address/address.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ def link_address(self):
def validate_reference(self):
if self.is_your_company_address:
if not [row for row in self.links if row.link_doctype == "Company"]:
frappe.throw(_("Company is mandatory, as it is your company address"))
frappe.throw(_("Address needs to be linked to a Company. Please add a row for Company in the Links table below."),
title =_("Company not Linked"))

def get_display(self):
return get_address_display(self.as_dict())
Expand Down Expand Up @@ -256,4 +257,4 @@ def address_query(doctype, txt, searchfield, start, page_len, filters):

def get_condensed_address(doc):
fields = ["address_title", "address_line1", "address_line2", "city", "county", "state", "country"]
return ", ".join([doc.get(d) for d in fields if doc.get(d)])
return ", ".join([doc.get(d) for d in fields if doc.get(d)])
19 changes: 15 additions & 4 deletions frappe/contacts/doctype/contact/contact.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ frappe.ui.form.on("Contact", {
});
frm.refresh_field("links");

if (frm.doc.links.length > 0) {
if (frm.doc.links) {
frappe.call({
method: "frappe.contacts.doctype.contact.contact.address_query",
args: {links: frm.doc.links},
Expand All @@ -58,6 +58,13 @@ frappe.ui.form.on("Contact", {
}
}
});

for (let i in frm.doc.links) {
let link = frm.doc.links[i];
frm.add_custom_button(__("{0}: {1}", [__(link.link_doctype), __(link.link_name)]), function() {
frappe.set_route("Form", link.link_doctype, link.link_name);
}, __("Links"));
}
}
},
validate: function(frm) {
Expand All @@ -73,9 +80,13 @@ frappe.ui.form.on("Contact", {
() => frappe.timeout(1),
() => {
const last_doc = frappe.contacts.get_last_doc(frm);
if(frappe.dynamic_link && frappe.dynamic_link.doc
&& frappe.dynamic_link.doc.name == last_doc.docname){
frappe.set_route('Form', last_doc.doctype, last_doc.docname);
if (frappe.dynamic_link && frappe.dynamic_link.doc && frappe.dynamic_link.doc.name == last_doc.docname) {
for (let i in frm.doc.links) {
let link = frm.doc.links[i];
if (last_doc.doctype == link.link_doctype && last_doc.docname == link.link_name) {
frappe.set_route('Form', last_doc.doctype, last_doc.docname);
}
}
}
}
]);
Expand Down
Loading

0 comments on commit 9583bed

Please sign in to comment.