Commit Graph
120413 Commits
Author SHA1 Message Date
Xavier Morel 0ecc5d50fb [IMP] base: cache property.get(res_id=False)
After installing a bunch more modules including account & some others,
company-dependent fields turn out to be horrendously inefficient (more
or less entirely unbatched): near 80% of runtime is taken by setting
those fields on the partners being created, split 28%/51% between
getting the default values (_default_company_dependent) and setting
them (_inverse_company_dependent).

clear_cache on *every* set_multi call is a bit extreme and cause test
problems (test_pickings_transfer_with_different_uom_and_back_orders
has a super fucky behaviour wrt caching so breaks when clearing the
cache on every set_multi) so only cache the "default"
case (res_id=False) and only clear when specifically setting that.

This makes fetching default values essentially disappear from the
profile.
2018-09-11 16:43:55 +02:00
Xavier Morel 7f29b31cf3 [IMP] models: use raw sql for modified()
Avoiding search makes modified go from 18% of total runtime to 9% over
10k calls (though only 5k search() call).
2018-09-11 16:43:55 +02:00
Xavier Morel edb34ee27a [IMP] base: avoid ref() in conversion of M2O/M2M
A proper ref() call implies an exists(), which isn't that expensive
but piles up over a few thousand calls.

The partner import test case trigger 7394 calls to exists, for a total
of ~6% runtime (and under 2% for the actual xid lookup).
2018-09-11 16:43:55 +02:00
Xavier Morel f11d143f00 [IMP] base: avoid re-serializing the tz list every time we create a partner
odoo.fields.Selection.convert_to_cache checks that values being set on
the field are valid (part of the selection's values).

For res.partner because of the tz field that means duplicating a list of
~600 timezones and sorting it every time we create a partner. Which for
my test case is 2500 times and burns 3.8% of total runtime for
absolutely no reason.

statically compute the reordered tzs list and just return it as-is from
_tz_get.
2018-09-11 16:43:55 +02:00
Xavier Morel d7210f5257 [IMP] api, models: _write performances on import
Followup from the previous commit: before this, _write takes 32% of
total runtime, of which 13.7% is ultimately assignable to add_todo.

Turns out for the test case we mostly keep adding records to recorsets
where they're already present, so the 13.7% of runtime in add_todo are
mostly spent creating orderedsets (11.17) then converting those back
into recordsets (1.75%) with some time spent creating lists and
appending records (already present) in them.

Checking if the records are already present before merging them in
decreases add_todo's runtime cost to 0.5%, and ultimately _write to
20%.

As many of the ignorable calls were merging a singleton or an empty
recorset into the parent recordset, optimising for these cases was
added to BaseModel's <= and >=.
2018-09-11 16:43:55 +02:00
Xavier Morel c3216db4c1 [IMP] fields: performance of creating with m2m fields
Note: all costs are according to cprofile on my machine, as a fraction
of total time to import, python-flamegraph has somewhat different cost
distributions, YMMV. Profiles use test-import of a 2500 partners file,
with name, country, street and 0~4 tags, all randomly
generated/assigned.

Costs were profiled as split 8.5%/32%/57% between data conversion,
creating records (Model.create/Model._create) and populating stored
computed fields for a total import time (unprofiled) of 1mn (±2s or
something).

For the creation step, 27% (of total runtime) were assigned to the m2m
(fields.Many2many.create), almost all of which (25%) was assigned to
accessing a record's id in a listcomp in a loop.

Optimisations:

* optimise the case where we're only adding / creating values:
  represent the relation as a dict of sets instead of a set of pairs;
  commands 5 and 6 will only operate on the current record's value,
  instead of traversing all pairs in the relation
* optimise accessing the value of an id field by hand-inlining the
  various bits, this is mostly obviated by the other previous
  optimisations (number of Id.__get__ calls reduced from 5.4 millions
  to 0.55) but given how common accessing a record's id is (and
  how it's usually considered to be free) it's still a good idea: cost
  of accessing the id field was reduced by 75% (0.55 million accesses
  went from 3.32% of total runtime to 0.83%)

Without profiling, time to import my test file went from ~1mn to ~45s.
2018-09-11 16:43:55 +02:00
Thibault Delavallée 08ce84f51d [REF] base: allow to override access rights computation on node in fields view get
Purpose of this commit is to have a hook to allow to set CRUD actions
on node in fields view get for other views than those defined in base or
web. For example grid view defined in enterprise does not have its
CRUD actions correctly set.

We choose to extract the access rights set on nodes in a separate method
to ease inheritance. The whole postprocess_and_fields does a big mixup
of updating the node, computing fields, computing the arch and could
probably be cleaned. This is however far from the simple purpose of this
commit and we choose to make a small diff without refactoring things
especially in a near-stable version.

This commit should not change anything from functional point of view.
2018-09-11 16:36:20 +02:00
Hiral Bhavsar 3bb99ff80e [FIX] web: BS4, use a fixed width for datetimepicker
When switching from calendar to hours, the 'auto' width changes and this
is not what was desired.
2018-09-11 15:17:23 +02:00
RomainLibert e332c304e0 [FIX] product: make the new group invisible
Since https://github.com/odoo/odoo/commit/acace4d8c3caca5f38eb6d6e603a1133329b4ccc a new empty
group was added to the product form view.

The problem is that this group is always visible while its content is
only visible when having group_product_pricelist hence showing a blank
space in the form view.
2018-09-11 15:05:14 +02:00
David Monjoie 955e2bad52 [FIX] web: fix wrong padding css rule
The css rule I introduced in 737ba55 was poorly written, my bad.
2018-09-11 15:02:55 +02:00
Martin Trigaux 3b30cd245d [I18N] export some saas-11.5 source terms 2018-09-11 14:53:40 +02:00
Kinjal Mehta 49c7105631 [FIX] mail: BS4, adjust counter position 2018-09-11 14:21:18 +02:00
Nikunj Ladava 9d98590f49 [FIX] note: fix border bottom color 2018-09-11 14:16:01 +02:00
Simon Lejeune 2d92febaf7 [FIX] barcodes: don't listen to barcode in input number
related to rev 74fcd3ac3b
2018-09-11 13:58:20 +02:00
XavierDo d5bc0e57cd [FIX] project: use user right on portal task
The search on project were done as sudo with a domain matching the
"project_task_rule_portal" rule. This commits remove the sudo call
and corresponding domains.

This replace lpe's fix b8fe404e, and user connected to portal to see
his tasks, avoiding an error during crawling tests:

Error use case:
User try to access a task list from /my/projects with a filter on a project.
The project filter does not exist in task list since the rules applied are for
portal user -> an error is raised

Now, project list on /my/projects and the filter available on /my/tasks should
be the same.
2018-09-11 12:22:40 +02:00
Cedric Snauwaert 069c6f39a3 [FIX] l10n_de: wrong order in manifest for xml view
Crashed on installation because there is a reference in data/report_layout.xml to a template that is defined in report/din5008_report.xml (external_layout_din5008).
The report/din5008_report.xml should be loaded first to avoid this error.
2018-09-11 11:34:58 +02:00
qsm-odoo c04d3d1460 [FIX] portal, web, web_editor: frontend font-size
Commit https://github.com/odoo/odoo/commit/903ff171acbef7f9fe6e533f43b99eba801b200f
lowered the font-size to 14px for the frontend by customizing the
bootstrap variable in the portal app. It changed the web_editor
rte_inline tour accordingly.

This however broke the test on runbot "base" database, as the font-size
in the editor without having installed the portal app was still set to
16px. Commit https://github.com/odoo/odoo/commit/e3bc059c3649a05c12cd3c8099092282c10141b7
only moved the failed test from "base" to "all" database.

This commit unifies the font-size for all frontends by setting it in the
web app. So, after this commit: reports, editor, login screen and
frontend will always have a font-size of 14px no matter the application
which is installed (except themes).
2018-09-11 10:58:17 +02:00
Christophe Monniez e3bc059c36 [FIX] web_editor: adapt tour to BS4 2018-09-11 10:00:42 +02:00
Dharmraj Jhala 881346780d [FIX] base: justify bootstrap grid columns properly using wkhtmltopdf
Since the BS4 is using 'justify-content' property to justify grid columns,
the columns are not justified properly in pdf because wkhtmltopdf does not
support this property.

So we set supported property '-webkit-box-pack' instead of 'justify-content'
through the post processing regex that will add limited support for grid
columns justification in pdf reports using BS classes only.

However, 'justify-content-between' / 'justify-content-around' classes are
still not supported due to the limited flex support by wkthmltopdf, and so
report designer might have to put some extra efforts for such rare cases.

Task: 1880709
Closes #26846
2018-09-10 17:54:43 +02:00
Dharmraj Jhala 2db1b48bfc [FIX] web: declare <!DOCTYPE> at the beginning of 'minimal_layout'
The <!DOCTYPE> declaration must be the very first thing in an HTML
document, otherwise you may experience that the preference is given
to the "user agent stylesheet".

This is the case while printing PDF reports using the 'minimal_layout' template.
For example, layout for 'Picking Operation' report will be different in HTML and
and PDF reports. Text inside <th> will be aligned left in the HTML report, while
center in the PDF one. The issue is there since a long time, but was not obvious
enough to catch till now. (For example, in previous BS versions, explicit rule
was present to align text to the left inside <th> tag, and so the layout did not
break by luck. BSv4 afterwards, this rule was removed, shedding light on this
issue).

This commit improves the behavior while printing PDF reports by placing
<!DOCTYPE> declraration at the very beginning so that preference will be
given to custom stylesheet over "user agent stylesheet".

Task: 1880709
Closes #26846
2018-09-10 17:54:43 +02:00
qsm-odoo 903ff171ac [REF] portal, website: BS4, lower <body/> font size
With BS4, the website's font size was set to 16px instead of 14px as
before. We finally decided to force the 14px back. This commit also
moves some bootstrap variables extensions to portal as it should have
been done and reformat the files to match the bootstrap _variables.scss
file.
2018-09-10 17:54:42 +02:00
William Henrotin b356b9468e [FIX] stock: better order of rules attribute
In the Route form view, there is a table summerizing all the rules that 
define the current route. The order of variables was not so clear.

Task id : 1879552
2018-09-10 17:27:44 +02:00
William Henrotin e316c95ab1 [FIX] stock: correct button string
The button to render the rules report was called 'Print' while it's not 
a pdf to print but an HTML report 

Task : 1879552
2018-09-10 17:27:44 +02:00
William Henrotin c7219c4876 [IMP] product: new report on product packaging
This commit adds two reports on the product packaging model. They act as 
labels representing the packaging. The first one is a pdf, the second 
one is a text one to be printed thanks to a zebra printer.
2018-09-10 17:23:02 +02:00
William Henrotin da00534e5b [IMP] product: uom on product packaging
If the 'Unit of Measure' setting is enable. We would like to see the
product uom on on the product packaging.
2018-09-10 17:22:56 +02:00
Christophe Simonis 86ff929ad6 [MERGE] forward port branch saas-11.4 up to 1199451606 2018-09-10 17:06:18 +02:00
Christophe Matthieu 4ad896bd3d [FIX] bus: Displays messages when loading the page with multiple tabs
If we use the cross tab, and the session has more than 50 seconds (or
does not exist), a remove is done in the init. The change trigger in
local storage causes the value of _lastNotificationID to become null.
This causes a loading error in the long poll.
2018-09-10 16:46:29 +02:00
David Monjoie 737ba55e1e [FIX] web: fix misaligned select inputs
Browsers add a 1px padding to inputs but they don't do it for the
select elements, which makes them unaligned.

Tested under Chrome 68, Firefox 61 and Safari 11 on MacOS 10.13.6.
2018-09-10 15:35:06 +02:00
Yannick Tivisse 1199451606 [MERGE] base: Revert https://github.com/odoo/odoo/pull/26831
Purpose
=======

The reified view removal makes sense from a functional point of view
as it allows to customize the res.users configuration view.

But this PR is also impossible to migrate efficiently as all the custom
groups that are not defined on the res.users model and that are not included
in the res.users view wont be displayed anymore.

It is still possible to add the group by hand in debug mode, but actually it is
not the clean workaround.

This could be done again in a better way, for example by defining a new field
like "UserGroup" and by allowing a easy customization with the Odoo Studio feature

Specification
=============

- Remove the generic methods to define the user's group computed fields
- Reintroduce the reified view
- Keep the main interesting feature of the original PR: Display the user's type
  (Internal User, Public, Portal) as a selection field.
2018-09-10 14:24:38 +02:00
Yannick Tivisse 73d0205802 [IMP] point_of_sale,auth_signup,...: Rename file according to guidelines 2018-09-10 14:23:43 +02:00
Yannick TivisseandWolfgang Pichler b7e6f28100 [FIX] base: user fields_get no add group if asked
The override of fields_get adds "virtual" fields corresponding to
groups.

If for example we make "res.users" have inherit "mail.thread", we get
these "virtual" field as if they had "track_visibility", since we do a
"fields_get" with fields having track_visibility expecting to only get
back "track_visibility" ones.

So the system would then fail trying to track visibility on fields like
"in_group_5" and for example a res.users could not be created anymore.

With this fix, we fix the fields_get so it respect the fields we ask of
it.

fixes #22332
opw-1878654
closes #22338
closes #26705

Co-authored-by: Wolfgang Pichler <wpichler@callino.at>
2018-09-10 14:23:43 +02:00
Yannick Tivisse c3717f3018 [IMP] base: Erase user's groups if converted to public/portal 2018-09-10 14:23:43 +02:00
Yannick Tivisseandjem-odoo bb3f20710a [IMP] base: Display Internal Users/Portal/Public as a selection
Co-authored-by: jem-odoo <jem@openerp.com>
2018-09-10 14:23:43 +02:00
Yannick Tivisse 43dd9ecd82 Revert "[IMP] base: Remove the reified view on 'groups_id' in res_users' form"
This reverts commit bd49f9fd17.
2018-09-10 14:23:43 +02:00
Yannick Tivisse 4587816198 Revert "[IMP] base: Remove unused module categories"
This reverts commit 382fbd3520.
2018-09-10 14:23:43 +02:00
Yannick Tivisse 7dfaca8639 [IMP] hr_contract: Remove users group fields 2018-09-10 14:23:43 +02:00
Yannick Tivisse 7978d4ba0f Revert "[IMP] *: Define groups on res.users models"
This reverts commit 99f497b390.
2018-09-10 14:23:42 +02:00
Yannick Tivisse dae8ca3f87 Revert "[IMP] base: Add compute/inverse methods to manage user groups"
This reverts commit ab179bb2d7.
2018-09-10 14:23:42 +02:00
Olivier Colson 1a37c127d6 [FIX] account: bill import wizard: link attachments to the created invoices instead of the file chooser wizard 2018-09-10 14:10:11 +02:00
William Henrotin 95a9572da3 [REF] barcodes, stock, point_of_sale: one nomenclature per company
This commit adds a many2one between barcode.nomenclature and res.company
and removes Many2one pointing toward a nomenclature record.

This aims to improve the usability and allows using nomenclature in
inventory adjustment where a `nomenclature_id` field was set.
2018-09-10 13:33:42 +02:00
Ankit Sathvara acace4d8c3 [FIX] product: fix missing group causing padding issues in sale page of product template notebook
This commit is linked to task ID 1875850 and PR #26664.
2018-09-10 13:28:21 +02:00
Thibault Delavallée cf9383570b [MERGE][REF] hr_holidays: refactor the configuration and request of leave and allocation
Purpose of this merge is to clean and simplify leave configuration and daily
use by

 * simplifying leave type configuration;
 * simplifying leave request and allocation encoding;
 * reorganizing menus to separate personal from manager menus;
 * adding missing kanban views;

For more details see sub commits. Each of them comes with its own
specifications and explanations.

This merge is linked to task ID 1876795 and closes PR #26571 .
2018-09-10 13:10:13 +02:00
Thibault Delavallée 2e1ab63ead [IMP] hr_holidays: add kanban views for leave and allocation
Purpose of this commit is to add kanban views for allocation and leave
request. It is already possible to reach those views notably using the
activities systray. Default view contains only the name which is quite
sad. We therefore add real kanban views for both models.

This commit is linked to task ID 1876795 and PR #26571.
2018-09-10 13:09:12 +02:00
Thibault Delavallée 63951ea2c1 [IMP] hr_holidays: improve allocation and request display name
Purpose of this commit is to correctly format the allocation or request
display name depending on the mode (employee, department, company or
category).

This commit is linked to task ID 1876795 and PR #26571.
2018-09-10 13:09:08 +02:00
Thibault Delavallée 04250cff1b [IMP] hr_holidays: allow allocation and request per company
Purpose of this commit is to add an option when allocation or requesting
leaves in mass. New option is to do it by company.

Company field used for mass allocation or request is called mode_company_id
to avoid confusion with possible company_id field used for multi company.

This commit is linked to task ID 1876795 and PR #26571.
2018-09-10 13:09:04 +02:00
Thibault Delavallée 744de4ee1c [REF] hr_holidays: improve leave form view and simplify duration encoding
Purpose of this commit is to simplify leave request encoding. We want less
options and more straightforward encoding of leave requests.

Specifications

 * taking half-day leaves is limited to one half day. It is not possible
   anymore to take leaves in half days that span on several days. WHen
   choosing half day the user choose whether he takes the morning or the
   afternoon of the given day;
 * choosing half-days leaves spanning on several days can be done taking
   several leaves if necessary. It is considered as a corner case that should
   not bloat the interface;
 * taking hours-based leaves is limited to a given day. It is not possible
   anymore to take leaves given some start and end hours that span on several
   days. When choosing hours the user choose the start and end hours using
   a selection for every half-hour for the given day;
 * choosing hours-based leaves spanning on several days can be done taking
   several leaves if necessary. It is considered as a corner case that should
   not bloat the interface;
 * taking leaves spanning on several days is necessarily done with full
   length days;

Various misc specifications about form view cleaning

 * hide "To submit" stage in the stage bar;
 * move description below duration information;
 * remove display name;

Duration computation, various fields and form view are updated accordingly
to this specification.

This commit is linked to task ID 1876795 and PR #26571.
2018-09-10 13:09:00 +02:00
Thibault Delavallée 14491e8f9b [REF] hr_holidays: clean fields used to store and display duration
Purpose of this commit is to simplify fields used in leave and allocation
used to store the duration of the requests. We want notably to get rid
of "number of days temp" that, contrary to its name, is not temporary
at all as it stores the real number of days. We also want to clarify
the hours or days encoding that is different on leave and allocation models.

Specifications

 * number_of_days on leave and allocation is the master field holding the
   leave or allocation duration in days;
 * two fields are used for interface that are suffixed by _display in order
   to indicate they are UX only: number_of_hours_display and number_of_days_
   display. They are interface fields used for the user and correct number
   of days is computed and stored in number_of_days;
 * more specifically for leave model

  * display fields are readonly as it is computed based on dates given by
    the user, directly (from / to) or indirectly (half-day leaves for example);
  * duration field is computed through an onchange. It could be directly
    set by hand by managers if some confusion in the number of days appear;

 * more specifically for allocation model

  * display fields trigger an inverse as they are the real duration given
    by HR officers or managers;
  * duration field is computed through the inverse of display fields;

Various reports, data and use of leave / allocation models are updated to
use the correct field.

This commit is linked to task ID 1876795 and PR #26571.
2018-09-10 13:08:57 +02:00
Thibault Delavallée bd5b2c9466 [REF] hr_holidays: simplify leave type configuration
Purpose of this commit is to simplify the configuration of leave type and
use the job of HR officers / manager by making options clearer and easier
to use.

Specifications for leave type :

 * display name as header;
 * remove accrual option from leave type. It is now configured directly
   on allocation requests;
 * add a "X days allocated" stmart button. If you set a general allocation
   of 20 days, the stat button will display 20 days. Even if you go update
   the allocation by employee after that. Purpose is to have the value of
   main allocation done in group, not individual cases of some employees;
 * add a "Group leaves" stmart button. It leads to a new leave requests
   in group mode where mode is visible;
 * have a unique allocation type field replacing the setting allowing to make
   leave or allocation as well as limit and negative fields;
 * limit leave duration encoding to two options, either day-based (allowing to
   take full days or half a day), either hours-based (allowing to take full
   days, half a day or some specific hours in a given day);

More technically

 * limit and negative fields are removed. It was confusing as limit set to
   True means you can actually exceed the limit). It can be computed based
   on allocation_type ('no' meaning you can bypass the limit);
 * request_unit is simplified. Day and half are merged into day;
 * accrual and balance limit are moved to allocation model;

Specifications for allocation requests

 * set accrual specific on allocation itself and not coming from the leave
   type configuration anymore. Indeed we now consider accrual to be done
   case by case independently from the leave type;
 * remove negative and balance_limit. Indeed we now consider people have to
   check by hand what is done by accrual;

Leave and allocation are slightly impacted by other changes, such as domain
for default leave types. Changes have been made as small as possible. Future
commits will still improve leave and allocation models and views, going
further in the cleaning process. Some tests are udpated to match the new
configuration of leave type.

This commit is linked to task ID 1876795 and PR #26571.
2018-09-10 13:08:53 +02:00
Thibault Delavallée 2e3b392a6f [REF] hr_holidays: differentiate personal and manager leave / allocation views
Purpose of this commit is to clean allocation and request views and prepare
future modifications. We would like to separate personal views (making a
request for myself) from manager views (giving more options).

Specifications

 * views under "My" menu should be simplified

  * in a general way there should be no action buttons under my. Hide
    approve/refuse buttons in personal mode;
  * show only leave type, description and duration when asking for an
    allocation; hide details about group allocation and accrual; hide
    action buttons;
  * show only leave type, description and from/to choice as well as duration
    when asking for a leave; hide details about group allocation; hide action
    buttons;
  * in list view hide employee and buttons my menu;

 * views under "Manager" menu should be complete

  * display complete form view;
  * add buttons to approve / refuse directly from the list view in manager
    menus;

This commit is linked to task ID 1876795 and PR #26571.
2018-09-10 13:08:50 +02:00
Thibault Delavallée af7901ca29 [REM] hr_holidays: remove inverse on employee leaves fields
Currently code somehow allows people to create allocation requests on the fly
by writing on the computed remaining_leaves field. It work only under some
conditions that are not likely to happen. Moreover creating and validating
allocation requests should be done under the Leaves application while knowing
it and not hidden in an inverse field.

Let us remove that code and let people use the Leaves application to handle
allocation requests. That code comes from old versions of Leave application.

This commit is linked to task ID 1876795 and PR #26571.
2018-09-10 13:08:46 +02:00