summaryrefslogtreecommitdiff
path: root/addons/web/controllers
AgeCommit message (Collapse)Author
2021-03-09[FIX] web: fix float value representation in exportAndrea Grazioso (agr-odoo)
- Create a product with: Cost: 60.80 Quantity On Hand: 999.0 - Go to Inventory / Reporting / Inventory Valuation - Click on export all (little button next to "Inventory at date") The field "Total value" have too many decimals: 60739.2000000004 This occur because of the multiplication: it yield the correct value (60739.2), but every rounding attempt done, even in the ORM, will mess up the representation https://github.com/odoo/odoo/blob/042298f8c949fba470eda6ad90f94c95ca291030/odoo/fields.py#L1333 opw-2438384 closes odoo/odoo#67543 X-original-commit: 67cf82962688360cfe25c6b2118a7dbd17a6ee95 Signed-off-by: agr-odoo <agr-odoo@users.noreply.github.com>
2020-12-24[FIX] web: prevent crash on image resize/cropPierre Paridans
When attempting to resize or crop an attachment through the '/web/image' route, if the attachment isn't actually an image (even if the record's mimetype says so) or doesn't match one of the format supported by PIL (Python Imaging Library) - like Apple's HEIF - the request crashes with a "500 Internal Error". Although it makes sense to return a response with an HTTP error code, a more sensible approach would be to return a "404 Not Found" response instead. The point by handling the Exception thrown by PIL and returning a 404 status code is to more closely match the semantic of this HTTP status code. Getting a resized version of a non-image doesn't really make sense as this resource doesn't exist at all ; hence the "404 Not Found" response. On the other hand returning a "500 Internal Error" would denote that a legitimate request failed on the server side, which is not the case here. Note: this difference of semantic, even if only visible in a regular browser, has its importance in the mobile apps because we use it to given a meaningful feedback to the user in case if failed HTTP requests. Note: the mimetype detection could be improved to ease the handling of this kind of errors but would require too much changes to be done in stable branch. Steps to reproduce in Discuss: - rename an HEIF file with a ".jpeg" extension - upload it in a chat window => the thumbnail in the chat window throws an HTTP error 500 opw-2417172 closes odoo/odoo#63767 X-original-commit: 873bc2aa5a8fcfc0664fc5ca70f789911873d583 Related: odoo/enterprise#15456 Signed-off-by: Pierre Paridans <pparidans@users.noreply.github.com> Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
2020-12-09[FIX] web: replace ttf fonts used to sign with better onesChristophe Monniez
Some ttf fonts used to sign are shipped does not come with a clear licensing. Also some of them does not have accented characters. With this commit, they are replaced with better ones and their accompanying Open Font License. Also, before this commit, any file in the font directory was read to be rendered by the sign widget. With this commit, only `ttf`, `otf` and 'woff[2]' files are read, this allows to store the license file alongside with the font.
2020-12-08[FIX] web: export should ignore requests for xid on viewsXavier Morel
5c4544fb2943e63fc1e0f5ae1e7e250a5a2b2cf1 reordered some of the operations at the export toplevel, and in doing so moved the filtering of the xid out of the `fields` list *after* that fields list has been used to know what fields to export. Meaning the fields list isn't filtered anymore, and requesting the xid on a view would blow up due to a latter assertion checking against that. Fix the filter, although a better solution might be to strip out the field upstream (in the fields list provided to the export wizard) such that users wouldn't even attempt to perform this export. An other possibility (possibly combined with the previous) could be to only strip out the export of the xid based on the absence of an ``id`` field on the model, though that's somewhat risky: technically views have no reason to be stable so a "record" could disappear or move around without the ORM being aware, leading to dangling xids. Fixes #46674 closes odoo/odoo#62993 X-original-commit: adc25bcf67438675bc9b0d55975ce733d58b4fb5 Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2020-12-08[FIX] web: make clean_action() allow extra propertiesArnaud Baes
Some actions use 'non-standard' key in the action dict, to pass extra parameters. In that situation the filtering of keys in `clean_action()` strips valuable params, in an attempt to avoid leaking internal action data. One example of this is the dynamic action definition returned by `open_yodlee_action()` in the account_yodlee module, which uses several non-standard properties. This commit alters the filtering logic in order to allow extra keys by default, as long as they're not actual fields of the action model (and therefore should not cause unintended "internal data" leaks). A warning is also added to recommend passing those extra parameters in the `context` and `params` action properties, which are explicitly designed for this, by convention. For cases where extra properties are returned and where the warning is annoying, those properties can be explicitly _allowed_ by making them virtual action fields, through a `_get_readable_fields()` override.
2020-11-13[IMP] core: broken symbols on uploadXavier Morel
2020-11-24[FIX] web: grouped exportNicolas Martinelli
- Create a product with: Cost: 60.80 Quantity On Hand: 999.0 - Go to Inventory / Reporting / Inventory Report - Export as XLS The header values have too many decimals: 60739.2000000007 The root cause is `convert_to_cache` returns this value: https://github.com/odoo/odoo/blob/042298f8c949fba470eda6ad90f94c95ca291030/odoo/fields.py#L1333 In this case, `currency.round()` keeps the extra digits. Since the field is not stored, the useless digits are kept. A simple solution is to use `float_repr` on the non-stored float fields to make sure that doesn't happen. Another solution could be to not convert the floats to strings, but that doesn't seem intended. opw-2378895 closes odoo/odoo#62260 X-original-commit: 2ebcbb16f113dee1416097b7a52f8068a40a34cf Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-09-28[REM] *: ability to put raw modules in evaluation contextsDebauche Stéphane
Co-authored-by: Xavier Morel <xmo@odoo.com>
2020-08-27[FIX] web: /web/binary/uploadXavier Morel
Doesn't seem used since it's been broken forever on python 3: base64.b64encode returns binary data, on which json.dumps chokes. Still, removing the endpoint on old stables seems a bit brutal so just fix it. closes odoo/odoo#56647 X-original-commit: 7fc9bc28986d69184df5a4fdeefbe09e4b39b8f0 Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2020-08-17[IMP] base,web: _for_xml_id as a safe access pointMartin Trigaux
/web/action/load is the public controller that Should be used by the webclient to fetch actions _for_xml_id is the default access method on actions that implements fields filtering to avoid leaking server action code or other information not needed by the webclient Implementing whitelist of fields that can be access per model
2020-08-14[ADD] auth_totpXavier Morel
New module for supporting two-factor authentication via time-base one-time-password (TOTP). Users (including portal users) can choose to enable two-factor auth in their user account settings, by scanning a QR code and adding it to an authenticator app, such as Google Auth, 1Password, etc. When two-factor is enabled, password-based non-interactive RPC is only possible by using API keys. Co-authored-by: Olivier Dony <odo@odoo.com>
2020-08-14[ADD] core, web: support for partial sessions & MFAXavier Morel
2020-08-14[IMP] core: replace dedicated uid cache by ormcacheXavier Morel
Before this, invalidations to the UID cache is not synchronised between workers because it's an ad-hoc solution (so a user changing their password or an admin disabling a user would only lock out an attacker currently using the API of one of possibly several workers). Shift the entire thing to ormcache which already has proper support for synchronising cache invalidation between workers. Also simplify the cache invalidation mess in Users.write because the caches have been unified into a single registry-level LRU, so the half-dozen cache clears on specific ormcached methods & models is pretty much the same as repeatedly calling clear_caches on the current model. **However** registry.cache is trivially accessible from server actions and safe_eval as long as they provide access to a model (through `model.pool.cache`). Which is common, and an issue given we're very much putting sensible data in there. Fix this by renaming `Registry.cache` to `Registry.__cache`, this requires few editions and mangled names are not accessible from safe_eval contexts. The alternative would have been to add more bespoke handling of the uid cache to hook it into the cache invalidation propagation machinery. After discussion with (@)odony, fixing LRU access and using that seems cleaner and less error-prone. Note on lazy_property ===================== Make Registry.cache / Registry.__cache into a regular attribute: the overhead of the LRU is not that high (compared to that of the registry itself), it's rare that we *don't* need it, and it's assumed to be a persisted attribute (it's not just a cache) so making it a normal attribute seems fine; and lazy_property doesn't work for mangled names: the name of the property is mangled using the name of the definition class, but the name of the symbol (fget) is not mangled so lazy_property would set the __cache attribute but then Python would lookup _Registry__cache, creating a new cache every access. And we can't (always) mangle things correctly on `__get__(obj, owner)`: `owner` is just `type(obj)`, meaning in the case of inheritance the type we get is the type through which the property is accessed rather than the one it's defined on. So it would work in the cases where no inheritance is involved (such as Registry.__cache) but not in general (lest we want to play around walking the MRO ourselves to find the definition source, which doesn't seem worth it). lazy_property *could* be made to work properly on Python 3.6+: the descriptor protocol gains `__set_name__(name, owner)`, which is called with the properly mangled name — and with the definition class to boot (though there might still be issues when overriding lazy properties as the override will be mangled & named differently... or maybe that's a feature?). However we're still supporting 3.5 at this point, AFAIK, so that's not an option. Plus it feels unnecessary / not very useful. However add an assertion to `lazy_property` so it signals when we try to use it on a mangled method (as otherwise it kinda sorta work in the sense that the property / object is accessible but is in effect a slower way to write a regular property).
2020-06-18[IMP] *: replace to new _() syntaxMartin Trigaux
Using a few regex like \((_\(.*%s.*)(\) % )([\w\[\]][\w .\[\]\(\)'"]*)\) ($1, $3)) Old syntax is still compatible but starts the migration to the new syntax that catches error.
2020-06-04[FIX] web: correct grammar of error messageRay Carnes
closes odoo/odoo#52384 Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2020-05-18[FIX] web: fix array values exportAnh Thao Pham (pta)
- Install Sales and Accounting - Go to Sales > Orders > Quotations - Create a new quotation - Add a product and in Order Line form, select a tax - Save the Order Line - Save the quotation - Go back to quotation list - Select (checkbox) the created quotation - Select "Export" in Action menu - In export wizard, choose "Excel" format and add field "Tax amount by group" - Validate with "EXPORT TO FILE" An error is triggered. The issue comes from the fact that the value of "amount_by_group" is an array of tuples and "xlwt" cannot write that type of value. opw-2255054 closes odoo/odoo#51480 X-original-commit: dde2ca9943362b20853ab11b15fe1504c0b8d848 Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-05-14[IMP] web: force a master password on insecure dbsMartin Trigaux
When creating a new database, a random master password for it is generated and strongly suggested to be used. The motivation for this change is to have, by default, a secure master password set for any Odoo deployment. Often, users do not realise that, when making an Odoo installation accessible on internet, anyone else can also access it. Use autocomplete="new-password" for updating the master password and play nice with password managers When generating a new password, use autocomplete="new-password" as well to prevent autofill of password potentially saved in password manager. Make the eye click to toogle on click instead of need to maintain. closes odoo/odoo#45117 Task-id: 2091260 Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2020-05-14[IMP] *: convert to private methodsMartin Trigaux
render, render_template, load, activity_schedule_with_view, get_website_pages should all be private: It should not be possible to render an aribtrary template only with its name or id Still need to render some qweb views from js so the method render_template is kept public. This explains why the website editor still need read access on ir.ui.view as we want to allow any snippet to be rendered.
2020-04-08[REF] base: Remove deprecated exceptions and osvJulien Castiaux
TL;DR: remember `osv` and `except_orm` ? You can forget about them. * Deprecated `except_orm` dropped. * `UserError` elevated as super type of all user-related errors. * Unused `DeferredException` dropped. * Unused `QWebException` dropped (real one is in `qweb.py`). * `MailDeliveryException` made a python exception. * `name` legacy exception attribute made an alias of the python standard `args[0]` attribute and deprecated. * `value` legacy exception attribute dropped. * `exception_type` RPC error response key dropped. * Deprecated `osv` module dropped. * `--osv-memory-age-limit` cli option made an alias of `--transient-age-limit` and deprecated. The `odoo.exceptions.Warning` have long been a deprecated alias to `UserError`. It is going to be removed in a future version but first we explicitly deprecate it with a warning. The `odoo.exceptions.DeferredException` was a very old internal exception, it has been removed without deprecation notice as it is never raised. The `odoo.exceptions.except_orm` has been a deprecated exception type with deprecation warning for 5 years, it has been removed in favor of UserError which becomes the super class of all user-related errors. The `odoo.base.models.ir_mail_server.MailDeliveryException` was inheriting `except_orm`. As it is not related to a user error but is more of a problem an admin much take care of, the exception has been made a Python error. The `exception_type` JSON key in RPC error responses was holding an hardcoded value derived from the exception type. Its usage has been dropped in favor of the `name` JSON key that holds the precise exception name. Again as it was hardly used in the source code (beside the crash manager) it has been dropped without deprecation warning. Since we are here trying to clean odoo custom exceptions, we are also deprecating the `name` exception attribute in favor of the more standard `args[0]` attribute. The `name` (along with `value`) were two attributes used to raise `except_orm` exceptions before the introduction of `UserError`, `AccessError` and related exceptions. The `name` attribute, at the time, was holding the exception type/title. Nowadays it contains the error message. The `value` attribute, at the time, was holding the error message. Nowadays it is no more used. The `osv` module contains very old deprecated aliases. There is no simple way to log a deprecation warning for osv, osv_memory and osv_abstract but as they have not been in use for ages, they have been removed too. To be consistent, the `--osv-memory-age-limit` cli option has been made a deprecated alias to the `--transient-age-limit`. closes odoo/odoo#45723 Task: 2187728 Related: odoo/enterprise#9162 Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2020-03-30[IMP] base, account, l10n_ch, website_sale, payment, web: make payment ↵oco-odoo
QR-code generation more generic This new modelling makes it easier to add new QR-code formats, and allows using all of them in website_sale and account.payment's form view as well (so, Swiss QR codes are now available there, while they were restricted to only invoices in the past). All barcodes are now generated as reports, from a dedicated route. This was only partly the case before : Swiss QR added a cross on top of the QR-code directly in the template, it wasn't part of the image returned by the route; now it is. [ADD] base_qr_code_sepa: new module decoupling SEPA QR-codes generation from the base module Each new QR-code generation option should thus be done in a dedicated module (or added to a localization) in the future. [IMP] base_qr_code_sepa: update the generated QR codes to version 2 of the specification Version 1 is still supported, so no need to backport this. [IMP] l10n_ch: make Swiss QR-codes compatible with the new version of the specification (the old one is deprecated) This will be backported to 11.0 and 12.0, as these QR-codes will soon replace ISR. [IMP] account: make it possible to mark manual payments as sent with a button on the form view This way, when making them directly with a QR-code (or doing a more classical wire transfer), people can keep track of what they already have asked the bank to do, and what they still have to treat. closes odoo/odoo#44839 Related: odoo/enterprise#8262 Related: odoo/upgrade#992 Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
2020-03-23[FIX] web: export of id from grouped elements does not failjerome hanke (jhk)
Steps to reproduce: - install sales - go to sales > go to any list view (SO for example) and group by anything (customer for example) - click on action > export > add ID to the exported columns - click export Previous behavior: you get a traceback: "Invalid field specification '.id'." Current behavior: ids are exported as intended opw-2194233 closes odoo/odoo#48222 X-original-commit: c8217080d960ec3f8436111ce60a17754fe64f2d Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com> Signed-off-by: mightyjol <jhk-odoo@users.noreply.github.com>
2020-02-12[FIX] web: 404 response even if placeholderNicolas Martinelli
- Open any product kanban view with missing images A 404 status code is returned for missing images, while they are replaced by a placeholder. This can cause issues when configuring a specific 404 page in a reverse proxy: the proxy will serve the custom page instead of the placeholder. opw-2192663 opw-2192340 closes odoo/odoo#45157 X-original-commit: 2719c8a0e40f318787b4d7a46626de46a8fd33f0 Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-02-04[FIX] *: deprecated access to url_ utilities through werkzeug rootXavier Morel
In 0.15 accessing werkzeug.urls functions directly through werkzeug is deprecated, the shortcut will be removed in the eventual werkzeug 1.0. Fix existing uses of these shortcuts. Also cleanup some imports when they're not far from a werkzeug* import being altered.
2020-01-30[FIX] web: template inheritance from dotted nameLucas Perais (lpe)
A good practice is to always prefix the name of a template by the name of the module it is defined in. So in the case where a template ```xml <t t-name="module.template" /> ``` was inherited by another Before this commit, one should have written ```xml <t t-name="other" t-inherit="module.module.template" /> ``` After this commit, it becomes more natural, and one should only write ```xml <t t-name="other" t-inherit="module.template"/> ```
2020-01-29[FIX] web: invalidate cursor after duplicateAndrea Grazioso (agr-odoo)
Login in into a database Access the database manager Duplicate a database Internal server error will occur and display user. This should not happen (even if the database is duplicated just fine), and occur because after the duplication the connection is dropped but the cursor will still hold the old reference and then, in the response generation it will crash. Invalidating cursor right after the duplication, like what is done after a 'drop' operation fix the issue opw-2170974 closes odoo/odoo#44159 X-original-commit: 59553c8595cdaf50a4c6f3ffe4093116d0f48bf1 Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-01-28[IMP] web: change pivot download file from xls to xlsxMohammed Shekha
before this commit: file was downloaded in xls format, which supports maximum 256 columns and 65536 rows. after this commit: pivot returns xlsx file when table printed and downloaded, we have support of xlsxwriter, xlsx file supports 16384 columns and 1048576 rows task-2127388
2020-01-21[IMP] web: remove unused controllerJeremy Kersten
This controller is no more used, probably used in the past with calendar invitation. closes odoo/odoo#43657 Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2020-01-21[IMP] base: add default image for users + placeholder if unassignedXavier Bol (xbo)
1/ When the new database is created without demo data, the admin has a 'silhouette' as a default picture. When a new user is created without picture given by the current user, the new user will have a 'silhouette' as a default profile picture. 2/ web: image for fa-user-slash. This image will be used when a record is unassigned. 3/ web, *: Change placeholder by default when record is unassigned. We want to have a fa-user-slash icon when a record is unassigned instead of 'placeholder.png'. A method is created in the BaseModel to have a generic method to change easily the placeholder for other models. 4/ Adapt kanban test to keep the same behaviour. Attention the behaviour is a bit different. Because, now the default image is given by the server to change easily the default image when a record doesn't have an image. Thus, we don't say if it's the default placeholder, but we can say it's not the same image of the record (in this test, the record, it's the partner). 5/ misc: display 'Unassigned' in the hover on kanban cards if record is unassigned closes odoo/odoo#41356 Taskid: 2060206 Related: odoo/enterprise#7758 Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com> Co-authored-by: jdoutreloux <jud@odoo.com> Co-authored-by: Yannick Tivisse <yti@odoo.com>
2020-01-17[IMP] web: split _content_image with get response sub methodDavid Beguin
This commit splits the _content_image method to allow to call the get response part individually. This is needed because _content_image call binary_content using current user access. But in some cases, we need to render a binary content even if the user does not have access to the target model (typically for public users). The binary_content is gotten in sudo mode where needed and the result can be given to the _content_image_get_response. This will avoid code duplication where the sudo use case is met. Usage : This commit prepare the redesign of survey. This _content_image_get_response method will be called to grant access of background image even for public users. Other modules will use this new method like elearning (website_slides) to display karma ranking, etc. Task ID: '2150291' PR #43237
2020-01-06[ADD] web: Custom File InputJulien Mougenot
New component: the custom file input. Its purpose is to define a input of type file with a custom trigger (button, link, etc.). Its construction is the following: - attributes: behaviour of the actual input (route to call, multifile, allowed extensions etc.) - inner template: the trigger that will fire the upload prompt when clicked Once a file has been uploaded, the component will emit a 'uploaded' custom event containing the files. closes odoo/odoo#38423 Related: odoo/enterprise#6031 Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2019-12-17[FIX] web: use rec_name to display imported recordDao Tuan Phong
When expending a many2x record, a field named 'name' was used to represent the exported record. If there was no field 'name' on the record, expanding the many2x field raised a KeyError in the export screen with "import-compatible export" enabled. Use the _rec_name instead as fallback closes odoo/odoo#42004 X-original-commit: 914d4f8ce9dbfd8380caa429a0aeac0513cf5ff9 Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2019-12-04[IMP] web: static inheritance: primary root node is the master nodeLucas Perais (lpe)
Before this commit, when doing a primary inheritance the root node of the resulting template was the one of the inherited template after this commit, the root node of the resulting template is the one defined on the inheriting template closes odoo/odoo#39452 Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2019-12-04[IMP]: web, tools: static inheritance do not disclose t-inherit* directivesLucas Perais (lpe)
Before this commit, when a template was inheriting from another the template mentionned its t-inherit This has been deemed overkill as the information is irrelevant to the caller i.e. the caller just wants the template and doesn't care how they've been computed After this commit, only t-name and attributes not related with inheritance are disclosed [FIX]: base: static inheritance propagates other attributes When doing a inherit in primary mode, the original attributes on the root node of the inheriting template were not propagated After this commit they are
2019-12-04[IMP] web: template inheritance respects XPATH specsLucas Perais (lpe)
At the conception of this feature it has been intentionally thought that the behavior for static templates should resemble what is done for ir.ui.view While keeping the general previous behavior (and this is important) A little bit of context for ir.ui.view They are defined as XML's, but end up as python objects Their meta-data (id, name, inheritance specs...) are thus present in their XML definition, but end up as part of python objects members Hence, the final, business, usable arch is free of those meta-data and is left only with business-relevant dom nodes The static inheritance feature was backed with those ideas but inherently encountered the issue that, for them, the meta-data also end up in the business dom, since they are at no point considered as plain objects. Decision has been made, back then, to exclude the root node that holds the metadata, to be at all targeted by any XPATH This decision is now challenged as the specs of XPATH should be respected This commit consequently introduces the root node as any other It can be replaced, and will be targeted by `expr="."` or `expr="//NODE_TAG"` The few attributes that are necessary to define them are kept across inheritance cycles though.
2019-10-22[FIX] website: clean sitemapJeremy Kersten
followup of 8a0fc6476c70a4126043de3b3efbd1096e41f968 task-2065018 closes odoo/odoo#39211 X-original-commit: bfa239b59c4d02c2b03ab8a84b52bc8f77704e41 Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2019-10-16[FIX] web: Avoid variable name confusionLucas Lefèvre
The attribute `self._fields` is not well named. This is not a list of instances of the Field class. It is a list of field names to export. e.g. 'journal_id', 'account_id/name' X-original-commit: 6225ce60082d5d2b5fec0e678fe2a1f3f9b93668
2019-10-16[FIX] web: Correctly aggregate values in exported parent groupsLucas Lefèvre
When exporting a grouped list view with some nested groups, the aggregate value of parent groups are not correct. It always sums aggregated values of children whether the group operator is 'sum' or not (could be 'max', 'avg', ...). This behavior is wrong and can even lead to a crash if the aggregated field is a date field (e.g. with group_operator='max'). (Try two sum two dates...) The quick fix 85cf47f was merged just before OXP to avoid any crash. This fix limited the support of aggregates to only int and float fields. This commit remove this limitation. This commit correclty implements the aggregation for parent group for all field types and all group_operator. This commit also improves the export feature tests. X-original-commit: 5e7e4fa98698967e3c4fd0903f4aa8e91981a6cd
2019-10-16[FIX] web: Manage False in groupby titlejbm-odoo
Before this commit, when we export a list with a groupby on boolean, the groupby title 'False' is replaced by 'Undefined' in xls document. After this commit, with an export and groupby on a boolean, we will have correct title: True and False. X-original-commit: 7e2c7bc35f2a5b3bc22e0e6c9d3b38279cda9367
2019-10-10[REM] web: remove unused controller /apps/<app>Romain Derie
This controller never really worked in the last 3 versions. It was fixed in 11.3 with e9350993ca0 but broken with refactoring in 12.0 at a higher level with 19eacf7d23c9. It was even worse in 13.0 as it was leading to a traceback: `view_type` field got removed with 3cd7ed07a29c8 but this controller was still reading that field. closes odoo/odoo#38355 X-original-commit: a5c4e262449fef03d05d5250e4523832db5fbf00 Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2019-10-09[MERGE] forward port branch 13.0 up to f4105eb9c70Christophe Simonis
2019-10-07[FIX] web: Support integer group nameSwapnesh Shah
Fixes https://github.com/odoo/odoo/issues/37998 Follow up on https://github.com/odoo/odoo/commit/5c4544fb2943e63fc1e0f5ae1e7e250a5a2b2cf1 As Integer fields are Supported for "Group By", they should be used as Group name closes odoo/odoo#38007 Signed-off-by: lul-odoo <LucasLefevre@users.noreply.github.com>
2019-09-30[FIX] web, mail: move admin login warning to mailXavier Morel
Fixes #33254: * was in mail despite using mail.channel (which breaks if mail is not installed, and web doesn't depend on mail) * changes to sudo() broke previous behaviour (of having odoobot message the admin, we ended up with the admin messaging themselves) so fix that * also get the channel and message with the user's context, otherwise since we're during the login procedure the context could be as little as just the lang from the browser and apparently channel_get automatically creates a translation which would break if the browser's lang is not installed in Odoo closes odoo/odoo#37580 Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2019-09-27[FIX] Web controllers: quick fix for just keep number in aggregated_valuesFlorian Gilbert
2019-09-25[IMP] http, *: review cache TTL valuesqsm-odoo
* base, web Google now recommends a TTL of one year for static contents. We used to use 1 week in almost every case. This commit increases that value to one year for safe resources, like assets bundles which contain a specific hash in the URL which changes if the bundle is recomputed anyway. Note: this commit refactors the code so that both the one week and one year durations are defined in http.py and used by others apps. Loading the library "locale" file used to be done with 10-hours-cache, this has been increased to 1-week-cache by using the http.py STATIC_CACHE var. closes odoo/odoo#37402 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2019-09-20[MERGE] web: Re-implement the XLS grouped exportOdoo's Mergebot
Purpose ======= The commit 2849b5c introduces a new export mechanism of grouped list views to xls files. The issue with this development is mainly that the displayed records are exported, instead of all the records that match the search parameters. To export all the records we cannot rely on the data from the web client. This implies to revert 2849b5c, and implement it in a better way. Functional Spec =============== Add the support of grouped exports. Allow the user to export all records in one click from the listview, without having to go through the export modal, taking into account the domain, groupbys, and visible fields. Technical Spec ============== When exporting (whether it is from the modal or from the shortcut), any groupby(s) set on the listview should be taken into account (all unfolded) - UNLESS the export is import-compatible - each subgroup header has an indentation compared to its parent - the 'group headers' in the exported file should contain the same info (label, field aggregates) as it has in the listview. New secondary button on the tree view with label 'EXPORT' (to be confirmed...) - the export shortcut disregard the selected records, it exports all records according to the domain. - the button is visible even if there is no selected records. - essentially the export shortcut does the same thing as the following: - select all records - hit 'action' then 'export' - hit 'export' Define a boolean attribute on <tree> to specify whether or not the export shortcut should be displayed Task 2072910 closes odoo/odoo#37087 Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2019-09-20[IMP] web: Export grouped list view in xls fileLucas Lefèvre
PURPOSE ======= Add the support of grouped exports. Allow the user to export all records in one click from the listview, without having to go through the export modal, taking into account the domain, groupbys, and visible fields. SPECIFICATION ============= When exporting (whether it is from the modal or from the shortcut), any groupby(s) set on the listview should be taken into account (all unfolded) - UNLESS the export is import-compatible - each subgroup header has an indentation compared to its parent - the 'group headers' in the exported file should contain the same info (label, field aggregates) as it has in the listview. New secondary button on the tree view with label 'EXPORT' (to be confirmed...) - the export shortcut disregard the selected records, it exports all records according to the domain. - the button is visible even if there is no selected records. - essentially the export shortcut does the same thing as the following: - select all records - hit 'action' then 'export' - hit 'export' Define a boolean attribute on <tree> to specify whether or not the export shortcut should be displayed Task 2072910
2019-09-19Revert "[IMP] web: Export list view as XLS file"Lucas Lefèvre
This reverts commit ac00548b28c0c384b5b1423f65405e4918101872.
2019-09-19[IMP] *: remove image_64 and clean viewsSébastien Theys
There are too many image sizes. Since they are stored resized this takes time to generate when saving a new image, it's more rows on the attachment table, more files on the disk, ... 64px is close enough to 128px that it can be removed without a big impact on download size. It will even reduce download and number of requests when both images are displayed because now only one has to be downloaded and then benefit from cache. The difference between the two is typically around 1.5kB which is negligible these days, especially when the request overhead is around 0.5kB already, not even taking into account other factors such as latency. If a 64px image must absolutely be returned, it is still possible to pass the size parameters to the image route. But the current guideline is to handle resizing in the views when necessary. Views ===== - remove width and height attributes when existing CSS rules are overriding them (eg. `.oe_kanban_avatar` in the right context) - add CSS rules instead of width and height attributes when possible - use `object-fit: cover;` where width and height are forced to avoid distortion of non-square images - for products, use `object-fit: contain;` instead, keep ratio but without crop - add new CSS rules where the expected size was max 64px*64px before due to the image size itself - remove `img-fluid` where using size classes to avoid conflicting rules task-2060865 closes odoo/odoo#36147 Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2019-09-17[FIX] web: avoid having context twiceRomainLibert
In case the context was manually passed to report_download, #36839 would pass the context keyword argument twice to report_routes. That is not allowed in python so we update the current context with the custom context from the report and pop the custom context from the arguments closes odoo/odoo#36989 Signed-off-by: Romain Libert (rli) <rli@odoo.com>
2019-09-16[IMP] web: Export list view as XLS fileLucas Lefèvre
Purpose ======= Have a quick export feature. The current export wizard is quite complex. We want to be able to quickly export a tree view, with the group by correctly represented, depending on the fields visible in the list view. Specification ============= Add an "EXPORT (XLS)" button in the list view (a little download icon) - export only columns visible in list view - export all the records - while respecting the group by This should be a generic feature but should be applied to all the account.move.lines list views. account.view_move_line_tree_grouped_sales_purchases account.view_move_line_tree_grouped_bank_cash account.view_move_line_tree_grouped_misc Task 2031835 closes odoo/odoo#36943 Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>