* fix: autoincr status per doctype
closes https://github.com/frappe/frappe/issues/21386
* chore: Check autoincremented on the database currently being used.
* refactor: Styling and space fix
---------
Co-authored-by: Athul Cyriac Ajay <athul8720@gmail.com>
* feat: Custom naming series parser via hooks
* chore: use assignment operatot
Co-authored-by: Ankush Menat <ankushmenat@gmail.com>
* test: Unit test for custom parser
* test: Unit test for custom parser
---------
Co-authored-by: Ankush Menat <ankushmenat@gmail.com>
* feat: configurable amendment naming
* patch: set default amend naming
* chore: linters and document filter
* test: amended document naming
* refactor: use set_single_value
* chore: typo, fix copy
* fix(UX): move action button below table
* refactor: Series Counter -> Default Naming
The behaviour in this PR doesn't necessarily mean to apply naming series
it can be:
- Naming Series
- hash
- Naming Rule
- Some code
So the name was misleading.
---------
Co-authored-by: Ankush Menat <ankush@frappe.io>
When migrating base doctypes we need to insert docfield which triggers
document naming rule code and document naming rule doesn't yet exists
cause that's what we are trying to migrate.
Fix: skip naming rule on bootstrapped doctypes.
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)
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
Converted all possible usages of re.* that weren't compiling the regex
separately and re-using it. Separated out the compiled patterns as
global variables. Repetitive patterns could be made DRY-er.
Would be nicer to have all regexes in a single module so that we could
re-use better, keep track of outdated, and keep checks for possible
reDos' etc
refactor: fetching transaction list
refactor: get default naming series
refactor: simplify naming series option scrubbing
fix: remove dead code related to insert series
This code is dead in many ways
- Creates map but it's never evaluated, so it doesn't actually run :D
- Just randomly splits naming series parts to create prefix... makes no
sense.
fix: deduplicate prefix list
* fix: misc fixes
local.x gets resetted on every request so switched to a simple dict
simplified is_val_used in set_next_val function for sequences
* chore: use multisql for sequence methods
* fix: fields not updating on form
* minor(base_input): removed unnecessary branching in update_input
* chore: remove prints and rename autoincremented_status_map
* chore: added proper type hint + comment + formatting
* fix: added searching in cast_name rather than handling it manually
* fix: share condition query + test_build_match_conditions
* fix: add cast_name to more places
* test: test for sequence
* fix: sequence functions
* fix: inherit frappetestcase
* minor: attach sequence methods to db context local
* chore: update sequence function names in Database
use frappe.db for sequences in naming.py
* fix: convert filename to str (for autoincremented doctypes)
* chore: better regex for modifying values for postgres
* minor: allow changing name column type (if no data is present in the doctype)
* refactor: validate_autoname
converted it to a simple function
enabled changing autoincrement autoname from customize form
* fix: use sql_ddl for change_column_type in postgres
* fix: use not null constraint in postgres when changing name type
* fix(test): updated test_autoincremented_doctype_transition with transitioning when no data is present
* fix(test): updated test_cast_name
probably messed up during rebase
* fix(test): used rollback upon error in transaction for postgres
* chore: use frappe.db.x methods for sequences
* minor: use temporary sequences in test
* minor: use generate_hash for sequence naming in sequence tests
* chore: replace sequence imports with frappe.db.x
* chore: move out casting name fields to a separate method
* refactor: cast_name
more explicit cases for casts and added docstring
* fix: added space in test_cast_name
* chore: fix linter
* chore: better naming for can_change_name_column_type
* chore: add comment for autoincremented_site_status_map
* chore: update/add docstrings