Commit graph

2525 commits

Author SHA1 Message Date
Gavin D'souza
885c86bedb Merge branch 'develop' of github.com:frappe/frappe into set_value-refactor 2022-01-31 11:53:59 +05:30
Ankush Menat
eda052529b
fix: calling non-exisitng unescape method on HTML2Text (#15796)
test: xlsxutils
2022-01-30 12:17:02 +05:30
Gavin D'souza
5b6ceb5543 Merge branch 'develop' of github.com:frappe/frappe into set_value-refactor 2022-01-28 18:39:12 +05:30
Gavin D'souza
1811f464a9 Merge branch 'set_value-refactor' into set_value-refactor 2022-01-28 18:38:46 +05:30
Gavin D'souza
8037866dc1 fix: Handle parsing and formatting timedeltas
* Added utils parse_timedelta, format_timedelta
* Added to json_handler for de-serializing timedelta objects
2022-01-28 18:33:03 +05:30
Faris Ansari
bf19ebdeb6
fix(boilerplate): add .gitkeep in public folder (#15765)
add .gitkeep file so that public folder is committed to git this is
needed because if public doesn't exist, bench build doesn't
symlink the public folder to sites/assets
2022-01-27 19:17:41 +05:30
Ankush Menat
fd227d38f4
feat: post model-sync patches (#15351)
Ability to run a few patches after the doctype model schema is synced.

Read module-level docstring of patch_handler.py for more info.
2022-01-26 11:21:30 +05:30
Shariq Ansari
54b3a32968 fix: get timezone in user_info 2022-01-25 16:19:49 +05:30
saxenabhishek
efd5c197cb fix: sbool converting int stored as string 2022-01-25 03:07:34 +05:30
mergify[bot]
1d06077d35
Merge pull request #15639 from alyf-de/is_bool
refactor: use `is bool` instead of `== bool`
2022-01-24 11:30:02 +00:00
mergify[bot]
a053e8b33c
fix: allow custom queues (backport #15653) (#15667)
* fix: allow custom queues

(cherry picked from commit ab7077dd31c854f5a739f1a1a653e0fbffb2c53c)

* fix: remove site config and reformat the code

(cherry picked from commit b3e11c01ee08533e8ce151873e974730b16f26f7)

* fix: remove redundant code

(cherry picked from commit 51ae9a57fde9276877ef47a22d3a468a3fcfb479)

Co-authored-by: Lucas Vazquez <lucas5zvazquez@gmail.com>
2022-01-20 09:34:32 +00:00
barredterra
dac9349aef refactor: use is bool instead of == bool 2022-01-17 15:40:33 +01:00
Gavin D'souza
429f839ea3 style: Add typing, sorted imports# 2022-01-17 15:31:37 +05:30
barredterra
b1383df15a refactor: use is None instead of == None 2022-01-17 10:37:51 +01:00
Gavin D'souza
b403d67845 fix!: Don't use strtobool in sbool util
strtobool would convert 't', 'yes' to True too. Which shouldn't be a
problem generally but could be one possibly.
2022-01-17 14:55:36 +05:30
Gavin D'souza
227dc26707 Merge branch 'develop' of github.com:frappe/frappe into set_value-refactor 2022-01-17 14:04:13 +05:30
Rushabh Mehta
0486cde0a5
Merge pull request #15606 from rmehta/fix-user-info
fix: load user_info on-demand
2022-01-14 09:58:28 +05:30
Suraj Shetty
645f23a9a7 fix: Add toggle theme as standard dropdown option
- For new sites toggle theme was not available. It was added via patch for old sites.
2022-01-13 19:45:48 +05:30
Rushabh Mehta
545a3a3ac4 fix(minor): handle for illegal user 2022-01-13 18:49:18 +05:30
Rushabh Mehta
853287f49d fix: load user_info on-demand 2022-01-13 16:39:24 +05:30
Gavin D'souza
f5072af00d fix: sbool before cint in cast for Check types
Noticed an issue when get_single_value wasn't returning the correct
values; by converting true to 0.

Tested it out. Here's the examples:

In [2]: sbool("2")
Out[2]: '2'

In [3]: cint(sbool("2"))
Out[3]: 2

In [4]: cint(sbool("-1"))
Out[4]: -1

In [5]: cint(sbool("0"))
Out[5]: 0

In [6]: cint(sbool("1000"))
Out[6]: 1000

In [7]: cint(sbool("10_000"))
Out[7]: 10000

In [8]: cint(sbool("true"))
Out[8]: 1
2022-01-11 12:57:23 +05:30
Gavin D'souza
6aa9a0bef5 style: Sorted imports & whitespace consistency 2022-01-07 20:44:51 +05:30
Gavin D'souza
981564e544 Merge branch 'develop' into frappe-postgres-changes 2022-01-07 11:37:28 +05:30
Conor
55392b64e7 fix: Revert changes made to fix collation differences
Due to collation differences in MariaDB and Postgres, tests gave
inconsistent results. This was to be handled in tests alone instead of
the application. It was unnecessary. Collation changes should be made at DBMS config
level only. Accomodating for those in the application will unnecessarily
degrade performance for everyone.

Other changes:
* use pluck in user_type
* revert ordering in nestedset
* revert parsing in order_field
* use preferred APIs & styling

Co-authored-by: gavin <gavin18d@gmail.com>
2022-01-07 10:45:10 +05:30
Conor
40ba1ac9ba fix: Postgres Compatibility
* Handle inconsistencies in type handling in DatabaseQuery & Database
  APIs
* Update incompatible queries with frappe.qb notation
* Fixed use cases discovered by failing ERPNext CI tests

fix: db independent syntax for user_type

fix: handle postgres datetime values

feat: add ability to auto commit on db inserts

feat: add ability to escape underscore in postgres

fix: handle missing data in test runner bootstrapping

fix: db independent syntax for queries

fix: refactor to use qb

fix: update cache for language

fix: use pluck in email_queue

Co-authored-by: gavin <gavin18d@gmail.com>

fix: don't auto insert on tests for make_property_setter

fix: remove auto_commit in custom_field insertion

fix: remove auto_commit functionality

fix: review comments

fix: revert link validation

fix: style suggestion for readability

Co-authored-by: gavin <gavin18d@gmail.com>

fix: revert .lower() in link validation

fix: add rollback for setup_wizard

Revert "fix: add rollback for setup_wizard"

This reverts commit 83b3b0913db17718ccd5edae01858cff15603829.

Revert "feat: add ability to escape underscore in postgres"

This reverts commit 8ed9c2aa3306438e94bb813f60e65b416d0b947b.

fix: more concise representation of order fields

Co-authored-by: gavin <gavin18d@gmail.com>
2022-01-07 10:44:57 +05:30
Suraj Shetty
1d11ff0375
Merge branch 'develop' into fix-datetime-filter 2022-01-06 11:06:02 +05:30
Suraj Shetty
5d5ad78789 refactor: Rename week_starts_on to first_day_of_the_week
For consistency
2022-01-05 14:54:46 +05:30
Suraj Shetty
65a28002c2
Merge branch 'develop' into fix-datetime-filter 2022-01-04 15:19:56 +05:30
Ankush Menat
5ac79925ef fix: postgres install that doesn't abort transactions 2022-01-04 13:59:17 +05:30
Suraj Shetty
42e1c15c18 feat: Add setting to configure the day on which week starts 2022-01-04 13:00:31 +05:30
Suraj Shetty
9258941151 fix: Do not allow rebuilding of tree for doctypes without lft & rgt 2022-01-03 14:25:42 +05:30
Suraj Shetty
b5e2f78a88 fix: Start week from Sunday instead of Monday
- Like we do in client-side
2022-01-03 13:36:32 +05:30
mergify[bot]
1b28c3b4ed
Merge pull request #15407 from resilient-tech/server-scripts
feat: `frappe.enqueue` and `frappe.call` for Server Scripts
2021-12-24 14:14:51 +00:00
mergify[bot]
7e34c27690
fix: Incorrect timespan daterange calculation (backport #15369) (#15431)
Co-authored-by: Kartik Sharma <kartiksharma9319@gmail.com>
2021-12-24 00:20:57 +05:30
Sagar Vora
01f4ba2061 feat: frappe.enqueue and frappe.call for server scripts 2021-12-22 13:21:13 +05:30
Gavin D'souza
b56e6fe4db fix: Safe decode base64 data in case of incorrect padding
This could possibly happen in case of corrupted/partial files. But for
the most part, if there's a missing trailing = or three at the end too.

Traceback:
Traceback (most recent call last):
  File "/home/frappe/frappe-bench/apps/frappe/frappe/app.py", line 68, in application
    response = frappe.api.handle()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/api.py", line 55, in handle
    return frappe.handler.handle()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/handler.py", line 31, in handle
    data = execute_cmd(cmd)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/handler.py", line 67, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 1208, in call
    return fn(*args, **newargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/desk/form/save.py", line 21, in savedocs
    doc.save()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 285, in save
    return self._save(*args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 307, in _save
    self.insert()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 239, in insert
    self._validate()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 499, in _validate
    self._extract_images_from_text_editor()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/base_document.py", line 983, in _extract_images_from_text_editor
    extract_images_from_doc(self, df.fieldname)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/file/file.py", line 779, in extract_images_from_doc
    content = extract_images_from_html(doc, content)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/file/file.py", line 822, in extract_images_from_html
    content = re.sub(r']*src\s*=\s*["\'](?=data:)(.*?)["\']', _save_file, content)
  File "/home/frappe/frappe-bench/env/lib/python3.6/re.py", line 191, in sub
    return _compile(pattern, flags).sub(repl, string, count)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/file/file.py", line 814, in _save_file
    _file.save(ignore_permissions=True)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 285, in save
    return self._save(*args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 307, in _save
    self.insert()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 231, in insert
    self.run_method("before_insert")
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 860, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 1158, in composer
    return composed(self, method, *args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 1141, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 854, in
    fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/file/file.py", line 56, in before_insert
    self.save_file(content=self.content, decode=self.decode)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/file/file.py", line 436, in save_file
    self.content = base64.b64decode(self.content)
  File "/home/frappe/frappe-bench/env/lib/python3.6/base64.py", line 87, in b64decode
    return binascii.a2b_base64(s)
binascii.Error: Incorrect padding
2021-12-21 14:57:09 +05:30
mergify[bot]
8c52eb6389
Merge pull request #15339 from phot0n/uninstall-hooks
feat: `before_uninstall` and `after_uninstall` hooks
2021-12-20 12:29:28 +00:00
phot0n
1d879f741b feat: before_uninstall and after_uninstall hooks 2021-12-20 14:05:10 +05:30
mergify[bot]
50c653d620
Merge pull request #15220 from v0l/develop
feat: add number format for BTC
2021-12-16 17:14:28 +00:00
Faris Ansari
133ab39de2
Merge pull request #15334 from netchampfaris/server-script-error-ux
fix: Server Script UX
2021-12-16 20:32:18 +05:30
Faris Ansari
c6f9920795 fix: removing map filter
these can potentially lead to security issues, avoiding for now
2021-12-16 20:31:50 +05:30
Faris Ansari
0bc3ff794b fix: remove attr helpers and type
these can potentially lead to security issues, avoiding for now
2021-12-16 16:21:05 +05:30
Faris Ansari
7c8659388d fix(server-script): add common python builtins 2021-12-16 12:19:08 +05:30
mergify[bot]
59db87cb47
Merge pull request #15280 from phot0n/fix-jpeg-rgba-upload
fix: upload jpeg image with alpha channel
2021-12-16 06:28:53 +00:00
mergify[bot]
7153c6c0e9
Merge pull request #15237 from netchampfaris/document-states
feat: Document States
2021-12-14 12:29:58 +00:00
Faris Ansari
1d67a38059 fix: add doctype_state in sync and install 2021-12-14 16:32:58 +05:30
Suraj Shetty
e5372a147f
Merge branch 'develop' into develop 2021-12-14 10:29:23 +05:30
phot0n
afb3dbc59c fix: upload jpeg image with alpha channel 2021-12-13 13:33:53 +05:30
Rutwik Hiwalkar
1ec54c87c8
feat: patched frappe email to work with frappecloud mail app (#15248)
* feat: patched EmailQueue.send and frappe.utils.get_formatted_email

* chore: renamed hooks and handled an edge case

* fix: if the get_sender_details hook is defined but it returns invalid input
2021-12-12 21:09:31 +05:30
Ankush Menat
00d38d568c
fix: remove slash prefix 2021-12-12 15:20:50 +05:30