Optimize registry.setup_models() such that some fields can be reused between registries. This happens when a model has the same base classes as another model.
This reduces the registry setup time.
On the runbot, this reduces the total execution time by ~20%.
When a model is set up, it can retrieve fields from a similar model (with the
same base classes). Only proper (not inherited), regular (non-related) fields
can be shared that way, since other fields may depend on other models.
Avoid this reference from a field to a model class; this will allow the sharing
of fields across model classes. Use `getattr` on class instances instead.
Split the methods `_setup_regular` and `_setup_related` in `base` and `full`
parts, such that the `base` part is done in `setup_base()`, and the `full` part
is done in `setup_full()`.
This optimizes the setup of models during the installation of modules: regular
fields are not set up again from scratch. Only related fields (which are less
common) are always set up from scratch.
The method uses the costly `inspect.getmembers` to retrieve the fields defined
on a model's classes. If the model is not modified by a module installation,
we simply reuse the fields retrieved in a former model setup.
The API of those method has been modified to take a recordset instead of a class
as parameter:
field.set_class_name(cls, name) -> field.setup_base(model, name)
field.setup(env) -> field.setup_full(model)
The recordset gives access to an environment, and will ease code reorganization
in the field's setup methods.
Converting the following class methods to model methods will make them more
flexible for changes, in particular by making the environment available:
- `_add_field`
- `_pop_field`
- `_add_magic_fields`
- `_init_manual_fields` (renamed to `_add_manual_fields`)
- `_inherits_check`
- `_init_inherited_fields` (renamed to `_add_inherited_fields`)
Make an explicit distinction between both semantics of `_attrs`:
- the parameters given to `__init__` in `args`
- the non-slot attributes (memory optimization) in `_attrs`
Making a distinction between the column from which the field was created, and
the one created from the field, allows to keep the second one from a registry
setup to the next one. This opens a door for optimizations: the column may not
need to be recomputed.
- Add nocontent tip in kanban view of project documents and remove create button.
- Hide a lot of noisy fields from attachment form view in technical group.
Former implementation used ir_values to retrieve the dashboard action id from
its menu id. Using ir_values to do that doesn't work anymore since the
cleaning up of rev. e7e452f.
We now retrieve the action id from its xmlid directly in the controller.
The start field is a computed field but it doesn't have any inverse function
(write() is overridden in calendar.event to, among other things, play the
role of the missing inverse function). It is thus automatically set as
readonly, and the events can't be dragged and dropped in the calendar view,
since rev. d6d3d098 in which we start checking if the start_date is readonly
or not before allowing the drag and drop.
This rev. simply adds a "do_nothing" inverse function so that the date field
is not readonly.
In web_calendar, the date_start attribute is mandatory so fallbacking on
date_end and date_delay is unnecessary.
- correctly compute the invoice and its lines, in order to trigger the
computation of the membership_state on the partner
- correctly compute, using a true multi returning correct values, the
various dates of membership
- use the sequence of function field to ensure that the dates and state
are computed in the correct order; otherwise some states are not
reachable
- various fixes in the computation
tests crash and that there is a mismatch between the tests and
the module. However as the tests were badly written the asserts
did not fire.
Now the tests crash as they should be doing since a long time.
[CLEAN] membership: dead code / tests cleaning
Removed dead code, unnecessary comments in membership.py. Also added the
use of server datetime format instead of custom one.
Also slightly cleaned the tests. No change, but use data created for the
tests instead of relying on existing demo data, probably modified by
the user and difficult to track.
Removed marketing_user and marketing_manager groups, replaced by more
specific groups. Those are lead_automation_user and manager groups.
Previous commits have removed the use of marketing groups in other
modules (event, mass mailing, utm, ...). Those groups can now be
safely used in lead automation modules.
Remove link to marketing groups on access rights and main menu. UTM being a
technical module it is now linked to the configuration group. Link tracking has
also been updated to use the configuration group.
Access rights and main menu display have been udpated.
Remove custom Purchase Requisition category, as well as purchase_requisition
user and manager groups. Those groups are not used except in one view as
purchase groups are already used for access rights. We now use purchase user
and manager groups instead of the purchase requisition groups.
Clean access, groups and categories in gamification. Remove custom
goal_category aka Gamification category. As gamification is mostly
integrated in HR, use HR categories. Remove custom group_goal_manager
group, replaced by HR manager. Gamification groups and configuration is
therefore linked to HR now.
Updated access rights accordingly.
Subscription: moved access rights from tools to sales groups. As this was the
last module to use the tools module category, it has been removed. This
category was used like a misc group. However now we try to better classify
modules.
- removed unused categories, aka report designer, CRM and knowledge management
- renamed Warehouse to Inventory
- defined all user groups in base_security, instead of having most of them in
base_security and 3 others defined in other files. Portal, public and
partner_manager groups are now present in base_security. This uniformize
the declaration of groups and module categories.
- define a new Extra / Other category, holding those 3 groups, to ease the
classification and display
- rename Usability ot Extra Rights[IMP] base: config: module category cleaning
- removed unused categories, aka report designer, CRM and knowledge management
- renamed Warehouse to Inventory
- defined all user groups in base_security, instead of having most of them in
base_security and 3 others defined in other files. Portal, public and
partner_manager groups are now present in base_security. This uniformize
the declaration of groups and module categories.
- define a new Extra / Other category, holding those 3 groups, to ease the
classification and display
- rename Usability ot Extra Rights
When running the test_menu tour with phantomjs, there was an error when
calling customize_chart because classList is not supported on phantomjs.
The workaround is to use addClass() of jQuery instead.
Also add missing call to _super() in start(), and remove ignored arguments
passed to customize_chart().
Before this rev., lighter columns seemed larger than the other ones as
their background-color is the same as the webclient background-color.
This rev. removes the gaps between columns (margin is replaced by padding).