From 78ee7c79f6c1d3f3df3131cb30aa6ce60f67b545 Mon Sep 17 00:00:00 2001 From: prssanna Date: Tue, 31 Dec 2019 16:01:59 +0530 Subject: [PATCH 1/3] fix: fix depends on ui test --- cypress/integration/depends_on.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cypress/integration/depends_on.js b/cypress/integration/depends_on.js index 73faad845a..8cb4e42d3e 100644 --- a/cypress/integration/depends_on.js +++ b/cypress/integration/depends_on.js @@ -1,4 +1,8 @@ context('Depends On', () => { + beforeEach(() => { + cy.login(); + cy.visit('/desk'); + }); before(() => { cy.login(); cy.visit('/desk'); @@ -49,6 +53,7 @@ context('Depends On', () => { cy.get('.control-input [data-fieldname="dependant_field"]').should('not.be.disabled'); }); it('should display the field depending on other fields value', () => { + cy.new_form('Test Depends On'); cy.get('.control-input [data-fieldname="display_dependant_field"]').should('not.be.visible'); cy.get('.control-input [data-fieldname="test_field"]').clear(); cy.fill_field('test_field', 'Value'); From 459e550a3f0364ae86ee351ac888b4d9a74cf96c Mon Sep 17 00:00:00 2001 From: "Chinmay D. Pai" Date: Tue, 31 Dec 2019 18:19:15 +0530 Subject: [PATCH 2/3] fix(requirements): remove psycopg2 from requirements apparently, since version 2.8, psycopg2 does not install the binary version by default (read source), and hence fails on setup with the error: Error: pg_config executable not found since nobody can really be arsed to compile this binary on their own, we'll stick to using psycopg2-binary instead. source: https://www.postgresql.org/message-id/CA%2Bmi_8bd6kJHLTGkuyHSnqcgDrJ1uHgQWvXCKQFD3tPQBUa2Bw%40mail.gmail.com Signed-off-by: Chinmay D. Pai --- requirements.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index b2c5c12f46..77f49156e9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -35,7 +35,6 @@ pdfkit==0.6.1 Pillow==6.2.1 premailer==3.6.1 psycopg2-binary==2.8.4 -psycopg2==2.8.4 pyasn1==0.4.7 Pygments==2.2.0 PyJWT==1.7.1 @@ -64,4 +63,4 @@ urllib3==1.25.7 watchdog==0.8.0 Werkzeug==0.16.0 xlrd==1.2.0 -zxcvbn-python==4.4.24 \ No newline at end of file +zxcvbn-python==4.4.24 From 0778c337ae06f265b402b7297a4f4f463504962e Mon Sep 17 00:00:00 2001 From: Rucha Mahabal Date: Tue, 31 Dec 2019 18:51:09 +0530 Subject: [PATCH 3/3] fix(Auto Repeat): derive next date from start date and offset (#9177) --- .../doctype/auto_repeat/auto_repeat.py | 37 +++++++++++-------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/frappe/automation/doctype/auto_repeat/auto_repeat.py b/frappe/automation/doctype/auto_repeat/auto_repeat.py index e618c7d63e..2d9428d1fe 100644 --- a/frappe/automation/doctype/auto_repeat/auto_repeat.py +++ b/frappe/automation/doctype/auto_repeat/auto_repeat.py @@ -9,7 +9,7 @@ from frappe.desk.form import assign_to from frappe.utils.jinja import validate_template from dateutil.relativedelta import relativedelta from frappe.utils.user import get_system_managers -from frappe.utils import cstr, getdate, split_emails, add_days, today, get_last_day, get_first_day +from frappe.utils import cstr, getdate, split_emails, add_days, today, get_last_day, get_first_day, month_diff from frappe.model.document import Document from frappe.core.doctype.communication.email import make from frappe.utils.background_jobs import get_jobs @@ -48,7 +48,7 @@ class AutoRepeat(Document): if self.disabled: self.next_schedule_date = None else: - self.next_schedule_date = get_next_schedule_date(self.start_date, self.frequency, self.repeat_on_day, self.repeat_on_last_day, self.end_date) + self.next_schedule_date = get_next_schedule_date(self.start_date, self.frequency, self.start_date, self.repeat_on_day, self.repeat_on_last_day, self.end_date) def unlink_if_applicable(self): if self.status == 'Completed' or self.disabled: @@ -107,27 +107,27 @@ class AutoRepeat(Document): end_date = getdate(self.end_date) if not self.end_date: - start_date = get_next_schedule_date(start_date, self.frequency, self.repeat_on_day, self.repeat_on_last_day) + next_date = get_next_schedule_date(start_date, self.frequency, self.start_date, self.repeat_on_day, self.repeat_on_last_day) row = { "reference_document": self.reference_document, "frequency": self.frequency, - "next_scheduled_date": start_date + "next_scheduled_date": next_date } schedule_details.append(row) - start_date = get_next_schedule_date(start_date, self.frequency, self.repeat_on_day, self.repeat_on_last_day) if self.end_date: - start_date = get_next_schedule_date( - start_date, self.frequency, self.repeat_on_day, self.repeat_on_last_day, for_full_schedule=True) - while (getdate(start_date) < getdate(end_date)): + next_date = get_next_schedule_date( + start_date, self.frequency, self.start_date, self.repeat_on_day, self.repeat_on_last_day, for_full_schedule=True) + + while (getdate(next_date) < getdate(end_date)): row = { "reference_document" : self.reference_document, "frequency" : self.frequency, - "next_scheduled_date" : start_date + "next_scheduled_date" : next_date } schedule_details.append(row) - start_date = get_next_schedule_date( - start_date, self.frequency, self.repeat_on_day, self.repeat_on_last_day, end_date, for_full_schedule=True) + next_date = get_next_schedule_date( + next_date, self.frequency, self.start_date, self.repeat_on_day, self.repeat_on_last_day, end_date, for_full_schedule=True) return schedule_details @@ -268,8 +268,12 @@ class AutoRepeat(Document): ) -def get_next_schedule_date(start_date, frequency, repeat_on_day, repeat_on_last_day=False, end_date=None, for_full_schedule=False): - month_count = month_map.get(frequency) +def get_next_schedule_date(schedule_date, frequency, start_date, repeat_on_day=None, repeat_on_last_day=False, end_date=None, for_full_schedule=False): + if month_map.get(frequency): + month_count = month_map.get(frequency) + month_diff(schedule_date, start_date) - 1 + else: + month_count = 0 + day_count = 0 if month_count and repeat_on_last_day: next_date = get_next_date(start_date, month_count, 31) @@ -288,7 +292,9 @@ def get_next_schedule_date(start_date, frequency, repeat_on_day, repeat_on_last_ # next schedule date should be after or on current date if not for_full_schedule: while getdate(next_date) < getdate(today()): - next_date = get_next_date(next_date, month_count, day_count) + if month_count: + month_count += month_map.get(frequency) + next_date = get_next_date(start_date, month_count, day_count) return next_date @@ -316,8 +322,7 @@ def create_repeated_entries(data): if schedule_date == current_date and not doc.disabled: doc.create_documents() - schedule_date = get_next_schedule_date(schedule_date, doc.frequency, doc.repeat_on_day, doc.repeat_on_last_day, doc.end_date) - + schedule_date = get_next_schedule_date(schedule_date, doc.frequency, doc.start_date, doc.repeat_on_day, doc.repeat_on_last_day, doc.end_date) if schedule_date and not doc.disabled: frappe.db.set_value('Auto Repeat', doc.name, 'next_schedule_date', schedule_date)