* feat: utility to get file size
* feat: if backup file is greater than 1gb then consider latest backup site instead of taking new
* fix: remove unwanted import
* chore: fix condition inside offsite backup utils
Signed-off-by: Chinmay D. Pai <chinmaydpai@gmail.com>
* chore: change email field to notify_email
Signed-off-by: Chinmay D. Pai <chinmaydpai@gmail.com>
* chore: fix deepsource issues
Signed-off-by: Chinmay D. Pai <chinmaydpai@gmail.com>
* feat: add offsite_backup support for google drive
Signed-off-by: Chinmay D. Pai <chinmaydpai@gmail.com>
* chore: get recipients from within send_email
pass email_field to send_email instead of calling two functions
Signed-off-by: Chinmay D. Pai <chinmaydpai@gmail.com>
* chore: set flag within validate_file_size
Signed-off-by: Chinmay D. Pai <chinmaydpai@gmail.com>
* feat: get latest file backup when specified
Signed-off-by: Chinmay D. Pai <chinmaydpai@gmail.com>
* chore: fix deepsource issues
Signed-off-by: Chinmay D. Pai <chinmaydpai@gmail.com>
* chore: fix incorrectly spelled dropbox settings
Signed-off-by: Chinmay D. Pai <chinmaydpai@gmail.com>
* chore: implement file backup logic for aws s3
Signed-off-by: Chinmay D. Pai <chinmaydpai@gmail.com>
* chore: fix deepsource issues
Signed-off-by: Chinmay D. Pai <chinmaydpai@gmail.com>
* chore: fix deepsource issues
Signed-off-by: Chinmay D. Pai <chinmaydpai@gmail.com>
Co-authored-by: Chinmay D. Pai <chinmaydpai@gmail.com>
Co-authored-by: Suraj Shetty <13928957+surajshetty3416@users.noreply.github.com>
currently, there is no way to reset password for those logging in
through ldap. i understand that this shouldn't really be handled by
erpnext, but there are people that have requested resetting the ldap
password from with the instance itself, and hence, we'll let that happen
now.
Signed-off-by: Chinmay D. Pai <chinmaydpai@gmail.com>
* fix: missing bucket name check when user make changes on s3 backup setting
Problem: If the user changed the backup limit, then press save. The validate function will give an error message that the bucket name already exists. It would be inconvenient for the user to use a different bucket name to save any changes.
So I implemented a flag ''bucket_name_exist'' to indicate if the bucket name exists, if not, then go to the flow of trying to create a bucket.
* fix: extra line removed
* fix: Use head_bucket Boto3 API
1. Head_bucket will return 200 Ok if the bucket exists and you have permission to access it.
2. Error code 403 Forbidden, Error code 404 Not Found.
3. Use bucket_name_exist to check if need to create bucket.
Thanks @Mangesh-Khairnar suggestions.
Reference:
1. https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/s3.html#S3.Client.head_bucket
2. https://boto3.amazonaws.com/v1/documentation/api/latest/guide/migrations3.html#accessing-a-bucket
Further improvements:
1. Use 'GET' Requestion to check if the Access Key ID and Secret Access Key is valid (Because AWS tier has 20,000 GET requests while only 2,000 LIST requests)
2. Edge case on Error prompts when head_bucket returns an error code other than '403' or '404'.
* fix: add an extra line to align with original code style
* Update frappe/integrations/doctype/s3_backup_settings/s3_backup_settings.py
Co-Authored-By: Chinmay Pai <chinmaydpai@gmail.com>
* fix: remove the flag and redundant exception
When we got a 404 error, we can just create the bucket as 1. The bucket name does not exist in the current bucket. 2. we have permission to access the bucket.
* Update frappe/integrations/doctype/s3_backup_settings/s3_backup_settings.py
Co-Authored-By: Himanshu <himanshuwarekar@yahoo.com>
* Update frappe/integrations/doctype/s3_backup_settings/s3_backup_settings.py
Co-Authored-By: Chinmay Pai <chinmaydpai@gmail.com>
* fix: missing handling the error code '400' - 'Bad Request'
* fix: applied with DeepSource analysis
1. Lines too long
2. Doc Lines too long
3. Expected 2 blank lines between class and method
4. Unused variable removed
Co-authored-by: Chinmay Pai <chinmaydpai@gmail.com>
Co-authored-by: Himanshu <himanshuwarekar@yahoo.com>
* fix: better logging for slack
* chore: cleanup code and get from dict
Signed-off-by: Chinmay D. Pai <chinmaydpai@gmail.com>
Co-authored-by: Chinmay Pai <chinmaydpai@gmail.com>
* fix: sender is not set to current user
I am not sure if I did it right:
1. import frappe
2. check if the sender is None: using frappe.session.user to fetch email address for current user
* fix: update the correct field name for S3-backup-setting
The field variable name should be updated to 'notify_email' instead of 'notification_email'.
* style: remove a trailing whitespace
* fix: Assign notify_email instead of calling frappe.db.get_value twice
* chore: remove default sender and notify_email check
* default sender already gets set in queue.py, so there's no need for a
check inside __init__.py
* notify_email seems to be a mandatory field, so there's no need to
check if the field has a value (assuming that it always will).
Signed-off-by: Chinmay D. Pai <chinmaydpai@gmail.com>
Co-authored-by: Chinmay Pai <chinmaydpai@gmail.com>
* fix: REST API utf-8 decoding on creates/updates
Creating or updating a document via the REST API would generate an error of:
`TypeError: the JSON object must be str, not 'bytes'`
Because get_data() returns bytes which must be explicitly converted to a string before parsing as JSON.
Defect introduced by efe94886a and a71a92341e
* fix(patch): Handle failures in while making Prepared Report attachments private
* case insensitive search for postgres
* convert operator to lowercase while checking
* fix: Pass prepared_report_name as filter if exists
* fix: Add input to multiselect_list control
* fix(reportview): convert to unicode conditionally
fixes TypeError: decoding str is not supported
Traceback (most recent call last):
File "/home/frappe/frappe-bench/apps/frappe/frappe/app.py", line 57, in application
response = frappe.handler.handle()
File "/home/frappe/frappe-bench/apps/frappe/frappe/handler.py", line 22, in handle
data = execute_cmd(cmd)
File "/home/frappe/frappe-bench/apps/frappe/frappe/handler.py", line 61, in execute_cmd
return frappe.call(method, **frappe.form_dict)
File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 1038, in call
return fn(*args, **newargs)
File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 511, in wrapper_fn
retval = fn(*args, **get_newargs(fn, kwargs))
File "/home/frappe/frappe-bench/apps/frappe/frappe/desk/reportview.py", line 177, in export_query
frappe.response['result'] = text_type(f.read(), 'utf-8')
TypeError: decoding str is not supported
Signed-off-by: Chinmay D. Pai <chinmaydpai@gmail.com>
* chore: remove useless encode
Signed-off-by: Chinmay D. Pai <chinmaydpai@gmail.com>
* fix: Allow Rename in Website Route Meta
* fix: Add Visit Web Page button in form
* fix: next schedule date should be on or after current date
* test: next schedule date
* fix: Change modified by
* fix: do not allow bulk update for core, single doctypes and doctypes from inactive domains
* fix: switch to safe_decode
* test: Fix list_view test by removing clear-cache code (#8941)
* test: Fix listview test by waiting for clear-cache
* test: Move wait to list_view.js
* test: Try removing clear-cache
* fix(integration): Social Login Key (#8940)
add missing field
* fix: don't set filter for restrict_to_domain in Bulk Update Tool
* fix: query report chart options
* fix: Default and company address fixes
* fix: revert changes made to get_default_address function
* fix: Remove changes in notifications
* fix: list view group by filter ambiguous column name
* fix: changelog modal ui
* test: list view child table filter with created by filter
* fix: not able to download XML file
* fix(security): invalidate reset_password_key on password reset
currently there is no way to invalidate reset_password_key on updating
password through the user settings. so whenever the user sets a new
password we'll invalidate the reset_password_key, so that existing links
to reset user passwords cannot be used.
Signed-off-by: Chinmay D. Pai <chinmaydpai@gmail.com>
* fix: Pin faker version to avoid test failures
* perf: optimise globals search
* fix: add index on child table
* fix: do not pop item from list
* fix: dont add index for global search doctype
* fix: rename function to set
* tests: fix results being return
* fix: codacy fixes
* fix: Code cleanup
- Pass values so that db cursor can handle escaping
* fix: Convert list to tuple
* style: added semi-colon
* fix: add default role on sign up via SSO
* fix(autocomplete): parse options (#8999)
* fix(autocomplete): parse options
* fix: add ignore validation flag
* fix: minor change
* fix(email): try to encode email part to utf-8 (#8964)
fixes issues with class objects other than str
Traceback (most recent call last):
File "/home/frappe/frappe-bench/apps/frappe/frappe/email/doctype/email_account/email_account.py", line 281, in receive
communication = self.insert_communication(msg, args=args)
File "/home/frappe/frappe-bench/apps/frappe/frappe/email/doctype/email_account/email_account.py", line 338, in insert_communication
email = Email(raw)
File "/home/frappe/frappe-bench/apps/frappe/frappe/email/receive.py", line 372, in __init__
self.parse()
File "/home/frappe/frappe-bench/apps/frappe/frappe/email/receive.py", line 393, in parse
self.process_part(part)
File "/home/frappe/frappe-bench/apps/frappe/frappe/email/receive.py", line 445, in process_part
self.text_content += self.get_payload(part)
File "/home/frappe/frappe-bench/apps/frappe/frappe/email/receive.py", line 489, in get_payload
charset = self.get_charset(part)
File "/home/frappe/frappe-bench/apps/frappe/frappe/email/receive.py", line 484, in get_charset
charset = chardet.detect(frappe.safe_encode(part))['encoding']
File "/home/frappe/frappe-bench/env/lib/python3.6/site-packages/chardet/__init__.py", line 34, in detect
'{0}'.format(type(byte_str)))
TypeError: Expected object of type bytes or bytearray, got: <class 'email.message.Message'>
Signed-off-by: Chinmay D. Pai <chinmaydpai@gmail.com>
* fix: Ambiguous column error when going to next doc (#9005)
fix: Ambiguous column error when going to next doc
Co-authored-by: Prssanna Desai <prssud@gmail.com>
* fix(patch): auto commit on more than 10000 writes
fixes issue where patch fails with:
frappe.exceptions.ValidationError: Too many writes in one request. Please send smaller requests
Signed-off-by: Chinmay D. Pai <chinmaydpai@gmail.com>
* revert: changes in currency formatting (#9003)
* fix: reverted currency formatting
* ux: added description for currency's number format
* It doesn't have any effect on how the currency is formatted.
* fix: revert json changes in currency master
* fix(filters): set default id to empty string instead of 0 (#9014)
fixes issue where "undefined" value gets set to 0 in postgres, which causes ProgrammingError since the expected value is of type str and not int
* revert: changes in currency formatting (#9003)
* fix: reverted currency formatting
* ux: added description for currency's number format
* It doesn't have any effect on how the currency is formatted.
* fix: revert json changes in currency master
* feat: add doc for email linking
* fix: missing commits while reverting currency changes
* fix(file): Public-private issue (#9032)
* fix: Pass file's is_private for doc creation
* fix: File is_private and file_url mismatch
* fix: Check if file_url exists
* fix: Validation check
* fix(postgres): Convert is_private to int
* fix: File path for content_hash
* fix: Show default currency as a fallback for currency fieldtype (#8992)
* fix: Show default currency as a fallback for currency fieldtype
* test: Add a test for currency formatting
* fix: Add a patch to fix all user's home settings (#9040)
* fix: Add a patch to fix all user's home settings
* fix: Remove limit
* fix: Allow field of submitted doc to edit if field has allow_on_submit enabled
* test: Add test to check if field is editable
* fix: Typo
* test: Add assert statement for value
* test: Clear cache after creating doctype
* fix: Codacy
* fix checkbox behavior in rtl view when clicking on label to check (#8898)
* fix checkbox behavior in rtl view when clicking on label to check
* fix: Undo changes in desk.css
* fix: Empty row validation
* style: Fix code formatting
* fix: Terminate regex
* fix: don't validate email for standard filters
* fix: before setting user default value, if fieldtype is Link check if doc exists
* Revert "fix: user default value for Link fields"
* before setting user default value, if fieldtype is Link check if doc exists
* fix: Remove Attachment on remove
* fix: minor changes
* style: fix Codacy issue
There should be no space before ','. (comma-spacing)
* fix: rfc5322 compliance for python3 (#9056)
* start of tests
* rfc compliant emails for frappe.
* fix for deepsource
* fix length of strings.
* fix bug that I'm not sure where it came from?
* codacy and deepsource issues trying to keep them happy
* take a punt in the dark
* fix: use SMTPUTF8 instead of SMTP and other minor fixes
Signed-off-by: Chinmay D. Pai <chinmaydpai@gmail.com>
* fix: patch home_settings_for_all_users
* style: Fix Codacy
* fix: KeyError: 'hidden_modules'
* fix: TypeError in home_settings patch
Convert set to list
* refactor: override style for changelog modal
* Merge V12-pre-release to version-12-hotfix (#9094)
Merge V12-pre-release to version-12-hotfix
Co-authored-by: null <rohitw1991@gmail.com>
Co-authored-by: Prssanna Desai <prssud@gmail.com>
Co-authored-by: Chinmay Pai <chinmaydpai@gmail.com>
Co-authored-by: Vishal Dhayagude <vishaldhayagude09@gmail.com>
Co-authored-by: Himanshu <himanshuwarekar@yahoo.com>
Co-authored-by: null <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: null <sahilkhan28297@gmail.com>
* Revert queue.py
Co-authored-by: Ben Knowles <benknowles@users.noreply.github.com>
Co-authored-by: Aditya Hase <aditya@adityahase.com>
Co-authored-by: Shridhar Patil <shridharpatil2792@gmail.com>
Co-authored-by: Faris Ansari <netchampfaris@users.noreply.github.com>
Co-authored-by: Chinmay Pai <chinmaydpai@gmail.com>
Co-authored-by: Rucha Mahabal <ruchamahabal2@gmail.com>
Co-authored-by: Revant Nandgaonkar <revant.one@gmail.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Shivam Mishra <scmmishra@users.noreply.github.com>
Co-authored-by: Deepesh Garg <42651287+deepeshgarg007@users.noreply.github.com>
Co-authored-by: rohitwaghchaure <rohitw1991@gmail.com>
Co-authored-by: Himanshu <himanshuwarekar@yahoo.com>
Co-authored-by: Rohan <Alchez@users.noreply.github.com>
Co-authored-by: Mangesh-Khairnar <mkhairnar10@gmail.com>
Co-authored-by: Prssanna Desai <prssud@gmail.com>
Co-authored-by: Saqib <thefalconx33@gmail.com>
Co-authored-by: Nabin Hait <nabinhait@gmail.com>
Co-authored-by: Ammar Hararah <ammarkharara@gmail.com>
Co-authored-by: Vishal Dhayagude <vishdha@users.noreply.github.com>
Co-authored-by: sahil28297 <37302950+sahil28297@users.noreply.github.com>