Commit graph

252 commits

Author SHA1 Message Date
Hussain Nagaria
8d2137c265 docs: consistent doc strings 2023-12-18 18:27:39 +05:30
Corentin Flr
4f809630c5
fix: Set sort_order to DESC if sort_field is modified (#23697)
Global search and replace operation, including single doctypes where it does not really matter.
2023-12-13 09:52:14 +05:30
Ankush Menat
8129fe7268
fix: Avoid duplicate contact names (#23731) 2023-12-11 17:15:37 +05:30
Ankush Menat
c6371cbdd0 fix: increase length for address lines
140 char default limit is often not enough as demonstrated here https://github.com/frappe/frappe/issues/23259
2023-11-20 17:29:00 +05:30
Sagar Vora
e8cbf61e6a
fix: revert unintentional quick entry default for Address (#22974) 2023-10-30 15:23:25 +05:30
Ankush Menat
8df5402b1f refactor: change kwarg name
frappe.call is oversmart about this particular name
2023-10-17 22:06:56 +05:30
Ankush Menat
3e19fb36a7
refactor: Split address render function (#22784)
This function can be used as utility where permssion checks might not be
required.
2023-10-17 14:07:31 +00:00
Ankush Menat
bac5f76247 fix: Apply address all perm only if owner 2023-10-11 11:48:51 +05:30
rohitwaghchaure
34fe6661c0
fix: e-commerece test cases (#22663) 2023-10-09 11:49:41 +05:30
Deepesh Garg
99bec229fb chore: remove unintentional json updated 2023-10-02 16:51:09 +05:30
Deepesh Garg
89fa201d9b chore: remove unintentional json updated 2023-10-02 16:49:36 +05:30
Deepesh Garg
ca726a82b4 fix: Give All role permission to read/create own address and contact 2023-10-02 16:12:41 +05:30
Sagar Vora
20178bd3eb fix: improved validation for address and contact 2023-09-29 12:04:38 +05:30
Raffael Meyer
59620c4b34
Merge branch 'develop' into use-existing-fullname 2023-08-10 11:29:02 +02:00
barredterra
88c8baa9ee refactor: for append to extend, merge list extend
Replace a for append loop with list extend.
Create the list with values instead of creating
an empty list and extending it with another list.
2023-08-09 13:25:39 +02:00
barredterra
8a5d667c85 fix(Contact): use existing full name 2023-08-09 13:11:54 +02:00
barredterra
b553ed98d8 refactor: inline immediately returned variable
Inline a variable to a return in the case when the
variable being declared is immediately returned
2023-08-08 18:09:49 +02:00
barredterra
a4385be70c fix: pass email as value 2023-07-24 16:02:22 +02:00
Ankush Menat
927cd647e4 chore: generate type annotations 2023-07-24 15:32:48 +05:30
Raffael Meyer
b6cd6535db
feat: better Email search (#20323)
* refactor: get_contact_list

* test: get_contact_list

* feat: search all emails, not just the primary one
2023-07-17 00:40:17 +05:30
Sagar Vora
b4f1a2328b
fix: ignore naming series validation when generating repeated address name (#21568) 2023-07-10 10:51:55 +05:30
Suraj Shetty
d2b7f47709
Merge pull request #19734 from barredterra/load-address-and-contact-display 2023-05-24 15:39:04 +05:30
Marica
3b5ff3dbb7
fix: get_default_address must accept 'Nonetype' name (#21022) 2023-05-17 11:11:57 +05:30
Raffael Meyer
440cde45f7
refactor: get_default_address (#20962) 2023-05-16 08:51:50 +05:30
Ritwik Puri
4b103888a7
chore: remove default None from address_dict param 2023-05-06 22:48:19 +05:30
Ritwik Puri
88bdefcc30
fix: type hints for get_address_display (#20923) 2023-05-06 21:36:07 +05:30
Raffael Meyer
0473f7b44f
feat: helper method for address display (#20900) 2023-05-04 23:36:58 +05:30
Raffael Meyer
fc10325074
fix: improve delete_contact_and_address (#20381) 2023-04-24 18:51:42 +05:30
Raffael Meyer
f5d79f0128
Merge branch 'develop' into load-address-and-contact-display 2023-04-21 13:17:46 +02:00
Ankush Menat
fa32b610d6
fix: rewrite query for postgres (#20557) 2023-04-03 14:47:45 +05:30
Ankush Menat
10dcbc5ecf fix: fix address query for postgres
refer https://github.com/frappe/frappe/pull/20537#ref-pullrequest-1645575433
2023-04-02 15:10:54 +05:30
Ankush Menat
fba3497ba0 test: address query 2023-03-31 19:04:11 +05:30
Ankush Menat
09e32c3085 perf: Faster address query with explicit joins
This querry is particularly problamatic when there are OR conditions due
to shared docs.

```sql
ANALYZE SELECT `tabAddress`.name,
       `tabAddress`.city,
       `tabAddress`.country
FROM `tabAddress`
join `tabDynamic Link` on (`tabDynamic Link`.parent = `tabAddress`.name AND `tabDynamic Link`.parenttype = 'Address')
WHERE
  `tabDynamic Link`.link_doctype = 'Customer'
  AND `tabDynamic Link`.link_name = 'CUSTOMER NAME'
  AND coalesce(`tabAddress`.disabled, 0) = 0
  AND (`tabAddress`.`country` like '%%'
       OR `tabAddress`.`state` like '%%'
       OR `tabAddress`.`name` like '%%'
       OR `tabAddress`.`name` like '%%')
  AND ((((coalesce(`tabAddress`.`branch`, '')=''
          OR `tabAddress`.`branch` in ('something')))))
  OR (`tabAddress`.name in ('SOME SHARED DOC'))
ORDER BY if(locate('', `tabAddress`.name), locate('', `tabAddress`.name), 99999),
         `tabAddress`.idx DESC,
         `tabAddress`.name
LIMIT 0, 20;
```

**Before:** Never terminates and reads entire table with millions of lines :LOL:

**After:** Reads ~100 rows max.

```
*************************** 1. row ***************************
           id: 1
  select_type: SIMPLE
        table: tabDynamic Link
         type: index_merge
possible_keys: parent,link_doctype_link_name_index,link_name
          key: link_name,link_doctype_link_name_index,parent
      key_len: 563,1126,563
          ref: NULL
         rows: 40
       r_rows: 79.00
     filtered: 100.00
   r_filtered: 100.00
        Extra: Using union(intersect(link_name,link_doctype_link_name_index),parent); Using where; Using temporary; Using filesort
*************************** 2. row ***************************
           id: 1
  select_type: SIMPLE
        table: tabAddress
         type: eq_ref
possible_keys: PRIMARY,selco_branch
          key: PRIMARY
      key_len: 562
          ref: _900a733bdc3bb9ed.tabDynamic Link.parent
         rows: 1
       r_rows: 1.00
     filtered: 100.00
   r_filtered: 100.00
        Extra: Using where
2 rows in set (0.001 sec)
```

<!--

Some key notes before you open a PR:

 1. Select which branch should this PR be merged in?
 2. PR name follows [convention](http://karma-runner.github.io/4.0/dev/git-commit-msg.html)
 3. All tests pass locally, UI and Unit tests
 4. All business logic and validations must be on the server-side
 5. Update necessary Documentation
 6. Put `closes #XXXX` in your comment to auto-close the issue that your PR fixes

Also, if you're new here

- Documentation Guidelines => https://github.com/frappe/erpnext/wiki/Updating-Documentation

- Contribution Guide => https://github.com/frappe/frappe/blob/develop/.github/CONTRIBUTING.md

- Pull Request Checklist => https://github.com/frappe/erpnext/wiki/Pull-Request-Checklist

-->

> Please provide enough information so that others can review your pull request:

<!-- You can skip this if you're fixing a typo or updating existing documentation -->

> Explain the **details** for making this change. What existing problem does the pull request solve?

<!-- Example: When "Adding a function to do X", explain why it is necessary to have a way to do X. -->

> Screenshots/GIFs

<!-- Add images/recordings to better visualize the change: expected/current behviour -->
2023-03-31 17:46:06 +05:30
Raffael Meyer
27a2b3204f
Merge branch 'develop' into load-address-and-contact-display 2023-02-22 18:54:18 +01:00
Ankush Menat
8446875257
refactor!: Remove "Set user permission" permtype (#20090)
This has never worked and setting user permission requires system
manager role always (because of permissions on list view)
2023-02-20 16:07:49 +05:30
Raffael Meyer
64c880aa70
Merge branch 'develop' into load-address-and-contact-display 2023-02-01 17:30:22 +01:00
Gavin D'souza
7ce0c4c8b3 Merge branch 'develop' into permlevel-apis 2023-01-31 17:47:59 +05:30
Gavin D'souza
31049b705e fix(db_query): With as_list, pass NULL to maintain order 2023-01-25 14:01:02 +05:30
barredterra
2a84b18d13 feat: load address and contact display
- Handle missing permissions
- Split into smaller functions
2023-01-23 18:59:16 +01:00
barredterra
076225720d refactor: address template 2023-01-18 12:53:32 +01:00
Ankush Menat
db35431b8c fix(postgres): psql with remote databases
If you dont use unix socket psql command doesn't work.
2022-12-20 15:14:38 +05:30
Ankush Menat
89a34159f9
fix: postgres query (#19357)
Double quotes are supposed to be used for table/columns only in
postgres. Mariadb is fine with either.


[skip ci]
2022-12-20 12:50:00 +05:30
Raffael Meyer
eae918d545
feat: contact full name (#18596)
* feat: contact full name

* patch: autocommit and don't update modified

* patch: print progress while updating contacts

* patch: don't overwrite existing full_name
2022-11-22 18:57:41 +05:30
Ankush Menat
8cca50bf26
refactor: remove naming case feature (#18672)
This has never worked since 2016... which can mean two things:
- No one really uses this.
- If I fix this now suddenly people will find different behaviour in
  naming because `name_case` is selected in some doctypes (but never
  tested)
2022-10-31 11:23:49 +05:30
Dany Robert
2f358dea03
fix: explicitly set doctype in queries (#18403) 2022-10-13 11:40:22 +05:30
Ankush Menat
3e2d2a703a test: Use FrappeTestCase everywhere 2022-08-17 16:39:42 +05:30
hrwx
b01929405d refactor: translatable doctypes 2022-08-05 21:38:10 +01:00
Ankush Menat
40f27f908a style: format JS files with prettier 2022-08-04 14:51:01 +05:30
Gavin D'souza
85e3ee9403 chore: Minified DocType JSON notation from old verbose notation 2022-08-03 12:22:03 +05:30
Ankush Menat
81b37cb7d2
refactor: clean up code to py310 supported features (#17367)
refactor: clean up code to py39+ supported syntax

- f-strings instead of format
- latest typing support instead of pre 3.9 TitleCase
- remove UTF-8 declarations.
- many more changes

Powered by https://github.com/asottile/pyupgrade/ + manual cleanups
2022-07-01 11:51:05 +05:30