summaryrefslogtreecommitdiff
path: root/addons/web_editor/static/src/js/backend.js
AgeCommit message (Collapse)Author
2017-08-16[MOV] web_editor, website: reorganize filesqsm-odoo
2017-08-10[FIX] web_editor: html_frame: saving in readonlyAaron Bohy
A form view record may be saved even if the record is displayed in readonly (e.g. when a button in the form view is clicked). When this happened, if there were an html field with html_frame widget in the form, it crashed (e.g. in Email Marketing > Mass Mailings > open one > click on Test Mailing).
2017-06-28[FIX] web_editor: make html widget translatableDarshan Kalola
The translate feature of widgets html and html_frame had been broken by the new views refactoring. This commit restores it for the html widget, and removes it completely for html_frame as it wasn't working correctly before the new views anyway (moreover, it had already been disabled for mass_mailing: de403dc1ab440b9b08ea7fce189cd157745dfe74). This commit also ensures that the changes are correctly saved for the html_frame widget. Note that this widget still needs to be converted to our new coding guidelines.
2017-06-26[MERGE] forward port branch saas-15 up to 4d79a1ff58fChristophe Simonis
2017-06-21[MERGE] forward port branch saas-11 up to 79dfcde359aChristophe Simonis
2017-06-21[MERGE] forward port branch 9.0 up to 26627391870Christophe Simonis
2017-06-21[FIX] mass_mailing: no multi language editNicolas Lempereur
Creating and editing mass mailing in multiple language is managed with the change 05daa15. But currently the language the mass mailing is sent in, is the language of the "Process Mass Mailing Queue" (root user if not changed) so all the recipients will receive the mail in the root user language has at the time the given batch of mails is sended. So this is different from what someone could expect by it being translatable. In any case the recipients list could be based on a lead, a partner a mass mailing contact or other and a language could not be determinable in stable (a mass mailing contact does not have a language for example). If the system worked, there is also a usability downside in the meaning that someone could duplicate a mail and not check all translation and not be aware that the mail he see is maybe not the mail that will be received (if translations have not all been completed). In stable to have the same behavior in any case and lessen the usability burden of users thinking erroneously the mass mailing may be sent in several languages depending on a not-existing heuristic, this changeset remove the translatability of mass mailing content. This has the following effect: no translation editing appear, the mass mailing is edited and sent in one and the same language, If someone want to send a mass mailing in several language, currently in Odoo it would then require to: duplicate the mass mailing, change the domains of recipients base on choosen heuristic, edit the duplicated mass mailing in the choosen language opw-746445 opw-746776 closes #17718
2017-06-15[FIX] web_editor: adapt web_editor to new viewsJoren Van Onder
set_value doesn't exist anymore. Instead use _setValue.
2017-06-15[FIX] web_editor,mass_mailing: adapt d7939282 to new viewsJoren Van Onder
Also adds body_html to the blacklisted fields. Because that tends to be quite long as well.
2017-05-29[FIX] web_editor: prevent crash with FieldTextHtmlSimpleGéry Debongnie
If the method commitChange from the widget FieldTextHtmlSimple was called in mode=readonly, a traceback was displayed. This is not very common, because most save operations are done in mode=edit, but it can happen in readonly mode: when the user clicks on an action button, then the form view is saved, if necessary. To reproduce this bug, just open a form view for res.users, and click on the Change Password button.
2017-05-24[FIX] web_editor: allow html widget for html fieldsAdrien Dieudonne
Before this commit, it was not possible to set the 'html' widget for a field in Studio. Even if this is the default widget for the form view, it not the case for the kanban view. You need to precise each widget you want to use (for performance reasons). opw-744254
2017-05-19[FIX] web_editor: field html: save changes done in code modeAaron Bohy
Summernote doesn't call the onChange callback when changes are done in the code mode, so the html field isn't aware of those changes. It means that if the user does some changes in code mode and then save directly (without coming back to normal mode), those changes are lost. This rev. ensures to save every changes by manually come back to the normal mode before saving, as this will correctly trigger the changes. Actually, it simply restores some code of the previous implementation (before new views) of this widget.
2017-05-16[MERGE] Forward-port saas-11 up to 0570033ae7c5b4e0efa4a1ee9fd90dcb9675f890Olivier Dony
2017-05-16[MERGE] Forward-port 9.0 up to 2c4512c263b0f46e4679c4bd0ee669f365a5aa92Olivier Dony
2017-05-12[FIX] web_editor: don't resize iframe in contentNicolas Lempereur
In 4e0e376b0 an iframe for the readonly preview was added when displaying html fields. In e5112ee00 this iframe was only used if style-inline was set in the widget options. This brought an incompatibility if the not iframed preview contained an iframe (eg. a youtube video which is then resize to a 30px height) which is solved by this commit. opw-725161 closes #16955
2017-05-05[FIX] web: better factorize debounced/input fields codeqsm-odoo
`DebouncedField` and `InputField` classes were not properly factorized, some of the DebouncedField code had to be part of the `InputField` class (which is a specialization of `DebouncedField`). Indeed the `FieldText` class, specialization of `DebouncedField` class, was missing properties which were part of `InputField` and was duplicating code which was already defined in `InputField`. For example, it was not possible to navigate out of text fields in editable list views with the right/left keys as this was part of the `InputField` class. Note: the FieldTextHtmlSimple class was implementing the `commitChanges` function differently than `DebouncedField` but this was in fact not necessary. This is why documentation update has also been done for this by this commit.
2017-05-04[REF] web, *: restore views designqsm-odoo
Since the new views merge, a lot of design elements were broken. This was particularly impacting the fields in the editable list view; indeed the editable list view is not using an inline form view anymore so the fields in the list were not properly styled as the LESS was still defined assuming the form view environment (for example the invalid fields were red for o2m fields in form view but not in editable list view even though they got the right CSS class). This commit refactor the LESS following these rules: - No more division of non-layout and layout rules. Dividing LESS rules in x_layout.less and x.less was a mistake. Many rules can be considered to be layout and not layout at the same time, developers always have to switch from one file part to the other, many CSS selectors (and rules!) are duplicated for nothing, ... - Field style is extracted from x_view.less and put in the new fields.less file. As before, the fields_extra.less will contain the rules specific to community so that the enterprise repo can override those by replacing the whole file. - Many classes have been renamed so that o_form_x_y becomes o_x_y as many classes can now be applied outside of form view. These classes should not be used in templates anyway. The commit also changes the DOM of fields so that it is more minimalist (no useless parent div, etc). Input elements are not automatically styled anymore, they have to get the o_input class explicitely. This allows to fix lots of small style bugs of previous versions (required monetary field had not the proper style, readonly m2m tags appeared as editable, ...). This also improves the LESS code. The editable list view should also completely stop flickering on chrome and firefox. The commit also removes the orange outline on list view dirty cells. The commit also removes deprecated static xml, LESS and other code. Notice there are still styles to restore/fix and LESS to improve.
2017-04-13[FIX] web(_editor): field widget htmlAaron Bohy
The field widget html wasn't implemented yet in the new views. A very basic implementation was done in addon web. It only handled the readonly mode so that the field were displayed in studio. This commit removes this basic implementation from web, and re- introduced the old one, converted, in addon web_editor.
2017-04-11[FIX] web_editor: various fixes and new testsAaron Bohy
- use 'nodeOptions' instead of 'options' in FieldTextHTML as 'options' doesn't exist, it has been renamed into nodeOptions in AbstractField. - mock iframe route in test to prevent the test framework from displaying an error (unimplemented route), and so the test from being red. - test that the url given in the node options is correctly used. - remove useless and broken code introduced by last rebase.
2017-04-11[REF] web, *: redesign all JS viewsGéry Debongnie
This commit introduce a full redesign of all JS views. We started basically from scratch. The goal was to unify all the various views under a common framework, to make them testable, to make then usable in different conditions (in studio, or in the frontend), and to make our lives easier. Some important points are: - we introduced new coding guidelines (camelCase, 80 chars width, ...) - we have a brand new testing framework (still QUnit based) - kanban view moved to the web addon - calendar view (formerly web_calender) moved to web as well - the tree view was removed - all new code should be documented We hope that this code is the start of a new era for the Odoo web client, we want to have a high quality codebase, well documented, well tested, well designed. Work done by the framework team: mostly aab, ged, chm, dmo, qsm
2017-03-06[MERGE] forward port branch saas-11 up to 503227838d1Christophe Simonis
2017-03-06[MERGE] forward port branch 9.0 up to 8092ee8c6a6Christophe Simonis
2017-03-02[FIX] web_editor: change of iframe URL on record loadedDenis Ledoux
When changing of record, through the pager or the breadcrumb, the URL of the iframe must change, as the model and id of the record is included in the URL This wasn't done before this revision, and it could lead to an INTERNAL SERVER ERROR in case of a deletion followed by the loading of another record: the URL of the iframe was still set to the former record, and this URL crashed as the record no longer existed. e.g. - Create a new mass mailing, subject 1, add a random block in the content then save - From this newly created mass mailing, Create a new mass mailing (directly with the create button) Subject 2, add a random black in the content and save - Delete the second mass mailing - Return in the mass mailing kanban view through the breadcrumb - Open the mass mailing 1 - You had an internel server error, due to the fact the URL of the iframe was still the one of the second mass mailing. opw-710239
2017-03-01[MERGE] forward port branch 9.0 up to 5f9f4f4d9dbChristophe Simonis
2017-02-23[FIX] web: html_frame field and lang vs onchangeNicolas Lempereur
In mass mailing there is several possibilities of states when rendering the widget with a possibly new value: 1. we are not in edition a. we are in same language than user language => the editor content can be updated b. we are in a different language => the content cannot be updated 2. we are in edition a. we are editing translation : the editor content cannot be updated b. we are not editing translation (editor language == en_US) i. we are requesting editor update (by having magic value `on_change_model_and_list`) => the editor can be updated ii. we are in same language than user language => the editor content can be updated iii. we are in a different language => the editor content cannot be updated In summary: - if language is the same than the user, we can update the value - if value is magic `on_change_model_and_list` and we are not translating, we can update the editor Before this commit, this worked as expected but for 2.a.ii. which if the user language was not en_US would for example prevent editor updating. closes #15583 closes #15414 opw-708032 inspired by a27e24c6d1 note: the fix is a fix for 9.0 and saas-11 only.
2017-01-16[FIX] web_editor: debug mode is not apply in editor iframeChristophe Matthieu
2017-01-10[MERGE] forward port branch saas-11 up to f1583504cebChristophe Simonis
2017-01-10[MERGE] forward port branch 9.0 up to 3f7b1f60834Christophe Simonis
2017-01-09[FIX] web_editor: harmless ; missing in 98ed53ceNicolas Lempereur
2017-01-09[FIX] web_editor: don't lose modified code view contentNicolas Lempereur
The intended scenario when using the code view is the following: 1) click on code view button to use code view 2) make changes 3) click on code view button to get back to wysiwyg view 4) save from the wysiwyg view If the 3rd step was not done: - for the inline editor, we lose the changes that have been done in code view, - for the iframe editor, we lose the entirety of the content. At one time the user was forced to go back to wysiwyg before being able to save, but this have been removed hence the present usability issue. With this fix, when the editor content is saved, if the user is in code view he is automatically set back to wysiwyg view. fixes #14648 closes #14475 opw-678677 opw-693052
2016-12-09[MERGE] forward port branch saas-11 up to 321b7dcChristophe Simonis
2016-12-07[FIX] web_editor: let whole backend know when leaving fullscreen editorqsm-odoo
An enterprise feature was in conflict with the fullscreen mode of the editor (see commit https://github.com/odoo/enterprise/commit/125414b73e4d839fc44c445bb83591e84f4c855d which fixes it). This commit forces this feature to be retriggered when the fullscreen mode is left (as the feature is now put asleep during the fullscreen mode). This should obviously be improved to handle fullscreen mode with a more robust way.
2016-11-22[MERGE] forward port branch saas-12 up to d1fddd2Christophe Simonis
2016-11-22[MERGE] forward port branch 9.0 up to 290601eChristophe Simonis
2016-11-21Revert "[IMP] web_editor: don't lose modified code view content"Nicolas Lempereur
This reverts commit 897290dd3ff218ddc12dcdc6c936a8725813cefe. It seems it breaks other use case, since this was fixing more a usability thing (need to click back on code view to save code view changes) it is better to revert than to add drawback. A better fix should be introduced, or the solution would be to not fix it and have a warning indicating what needs to be done. opw-693052
2016-11-17[MERGE] forward port branch saas-12 up to 1ef4061Christophe Simonis
2016-11-17[MERGE] forward port branch 9.0 up to 7ee09edChristophe Simonis
2016-11-16[IMP] web_editor: don't lose modified code view contentNicolas Lempereur
The scenario when using the code view is the following : - click on code view button to use code view - make changes - click on code view button to get back to wysiwyg view - save from the wysiwyg view If the 3rd step is not done: - for the inline editor, we lose the changes that have been done in code view, - for the iframe editor, we lose the entirety of the content. At one time the user was forced to go back to wysiwyg before being able to save, but this have been removed hence the present usability issue. With this fix, when the editor content is saved, if the user is in code view he is automatically set back to wysiwyg view. closes #14339 opw-693052
2016-11-08[MERGE] forward port branch saas-12 up to 6386037Christophe Simonis
2016-11-08[MERGE] forward port branch 9.0 up to b795755Christophe Simonis
2016-11-07[FIX] web_editor: widget html preview doesn't match wysiwig editor (widget ↵Christophe Matthieu
html iframe) The widget html is used for plain text and html content. Need to check if the content is a valid html code, if is not wrap with p tag every lines. opw-692158
2016-11-04[FIX] bus,im_odoo_support, web*: fix various memory leaksChristophe Matthieu
* Tip are never destroyed when change view mode * unbind methods * mail: memory leak with unbind methods * web: memory leak because 'ui-autocomplete' is never destroyed * web_editor: memory leak for wrong unbind on destroy * web: memory leak: must remove fileupload handler * bus: memory leak: correctly debind handlers on window in bus.Bus * remove handlers on switch buttons and views $buttons * remove handlers on breadcrumbs * web: memory leak: correctly debind handlers * im_odoo_support: memory leak: remove fileupload handler odoo_support Note: part of this commit was actually authored by aab
2016-09-30[IMP] mass_mailing, web_editor: propose installation of mass_mailing_themesqsm-odoo
When an user starts a new mail template, he is now proposed to upgrade to enterprise to install mass_mailing_themes.
2016-09-05[FIX] web_editor: debug mode is not applied in the iframe of html fieldChristophe Matthieu
2016-08-25[MERGE] forward port branch 9.0 up to c578fb7Christophe Simonis
2016-08-19[FIX] mass_mailing: avoid too long URIs by blacklisting fields in editor callDamien Bouvy
The call to the web_editor is made through an iframe with some get parameters. While not really a problem in itself, this has the disadvantage of generating long URIs. In some case, since all the fields in the views are included as a GET parameter, URIs can be generated that go up to several thousand characters. Most servers will return a 414 for such URIs, preventing the edition of the mail template in the view. To avoid this problem, this commit extends the 'html_frame' widget and blacklist 2 fields that can get too long once encoded. Ideally, it would probably be better to stop sending all the fields and simply add the *needed* fields one by one, but since it's difficult to know exactly what fields might be needed and this is stable, I'm gonna go with this 'workaround' but conservative fix. opw-685646
2016-06-23Revert "[FIX] web_editor: test jinja content to load editor in codeview"Christophe Matthieu
This reverts commit f38f8930f0436a40f675fa1d054a9d46f550d440. Revert for internal choice. Odoo want to use qweb in template and remove jinja support on next version. If users want to use jinja they can change the view to use text widget instead of html widget.
2016-06-22[FIX] web_editor: test jinja content to load editor in codeviewChristophe Matthieu
The preview change the content because the browser try to fix the dom. If a user use jinja and activate the preview, the jinja code is (re)moved by the browser and broke the template.
2016-03-24[MERGE] forward port of branch saas-9 up to 59d3f63Christophe Simonis
2016-03-14[FIX] web: various small issues in form view onchange/one2manyChristophe Matthieu
- Issue: Edit sale.order form view, add new line, change product who have taxes and click quickly on save (with slow network) => error message. Because some deferreds are lost. - reduce number of reads and onchange for x2m widgets - remove before_save method and use commit_value (the issue was that if the before_save and the change trigger an onchange, the onchange deferred is not checked before saving the content.