summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/views/basic
AgeCommit message (Collapse)Author
2019-09-13[MERGE] forward port branch saas-12.4 up to fe59754c520Christophe Simonis
closes odoo/odoo#36721 Signed-off-by: Christophe Simonis <chs@odoo.com>
2019-09-09[FIX] web: use New as default value for breadcrumbRomainLibert
Before this commit if `display_name` was in the view, the breadcrumb when creating a new record, the breadcrumb would display either `Unnamed`, either the last value of `_title` in `action_mixin`. The default value when creating a record should be `New`, but the return was ignored because `display_name` was found in the view closes odoo/odoo#36565 Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2019-09-09[IMP] web: edit translations in new dialogVincent Schippefilt
Before this commit, translations were edited in a list view with a filter on the field that needed to be translated. After this commit, the translations for each fields are translated in a dedicated dialog. The changes done to the current language are taken into account immediately, both ways, from the dialog to the form and from the form to the dialog. Translating terms is also available in create mode, the user will be prompted to save before editing a translation Task ID: 2028152 closes odoo/odoo#36185 Signed-off-by: VincentSchippefilt <VincentSchippefilt@users.noreply.github.com>
2019-09-11[MERGE] forward port branch saas-12.3 up to 50e571acf7cChristophe Simonis
closes odoo/odoo#36491 Signed-off-by: Christophe Simonis <chs@odoo.com>
2019-08-23[FIX] web: grouped list with <groupby> node and onchangeAaron Bohy
Let's assume an editable grouped list view with a <groupby> node containing subfields, and an onchange. Edit a row to trigger the onchange. Before this rev., it crashed because the onchange specs was incorrect: it followed the relation of the many2one and thus included its subfields (whereas it should only follow the relation for x2many fields). For example, go to Accounting > Accounting > Sales and edit the label of a move line. Task 2044187 closes odoo/odoo#36001 Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2019-08-20[MERGE] forward port branch saas-12.3 up to 6f55fd65da8Christophe Simonis
2019-08-19[MERGE] forward port branch 12.0 up to 32039b2ab44Christophe Simonis
2019-08-12[FIX] partner_autocomplete, web: autocomplete error when suggested company ↵Jorge Pinna Puissant
has a country - Change the company's country to Finland; - Go to Contacts and click on Create; - Tick the Company box above the Name field; - Start typing into the Name field; - Click on a company with a VAT number under its name. Before this commit, a Traceback appears. This occurs because the response of the request with the suggested company has the fields 'company_name' and 'company_code' and these fields are not in res_partner. Now, the suggested company is parsed to correctly field the country field. opw-2049636 closes odoo/odoo#35631 Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
2019-08-08[MERGE] forward port branch saas-12.3 up to 752b2553c6fChristophe Simonis
2019-08-21[IMP] web: keep dirty fields dirtyGéry Debongnie
Before this commit, a simple optimization was done: if a field was modified in such a way that the new value is the same as the initial value, then it is not considered changed. However, with the new changes in the ORM, it may be an issue, because doing so loses the intent of the user. If an onchange changes a field, then the user changes it back, the server is not aware of that fact. With this commit, we simply keep the field in the list of changes to send to the server. opw #2057230 closes odoo/odoo#35890 Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2019-08-06[MERGE] forward port branch saas-12.2 up to 9e74730a26bChristophe Simonis
2019-08-06[MERGE] forward port branch 12.0 up to ff9ddfdacc9Christophe Simonis
2019-08-06[MERGE] forward port branch saas-11.3 up to 97d81f1220bChristophe Simonis
2019-08-02[MERGE] forward port branch 11.0 up to 593f631e5ebChristophe Simonis
2019-07-31[FIX] web: init makeRecord fields with correct valuesLucas Perais (lpe)
In the calendar view In the partner filter in the calendar side bar type something, and backspace rapidly to remove everything Before this commit, there was a error because the framework tried to write something in the corresponding field This was because the o2m field was not initialized with the correct values After this commit, there is no error OPW 2043975 closes odoo/odoo#35330 Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2019-08-21[MERGE] forward port branch saas-12.4 up to f26de445e55Christophe Simonis
2019-08-14[MERGE] forward port branch saas-12.4 up to 98a55917a60Christophe Simonis
2019-07-30[FIX] web: add view id in optional fields local storage keyDavid Monjoie
Since the renderer does not know the view id, we moved the local storage key computation up to the basic controller, which makes more sense since the renderer is supposed to be inert. The _processColumns function had to be moved in willStart however, since it now needs the controller to respond to the trigger_up and the controller is not present during the init of the renderer. closes odoo/odoo#34051 Signed-off-by: VincentSchippefilt <VincentSchippefilt@users.noreply.github.com>
2019-08-09[IMP] *: display some onchange warning with notiffja-odoo
* = base, web, sale, stock, sale_stock, stock_account Warnings for the onchange now takes a type to know if it needs to be displayed with a notification. Else it is displayed with a dialog notification (like before). Related to https://github.com/odoo/odoo/pull/32132 and https://github.com/odoo/odoo/pull/35209 Part of https://github.com/odoo/odoo/pull/35342 task-2047628 closes odoo/odoo#35342 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2019-08-07[FIX] web: add missing 'selection' key to create selection field using ↵Jigar Patel
makeRecord
2019-08-07[IMP] *: fix typos in commentsmreficent
closes odoo/odoo#35404 Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2019-07-22[MERGE] Forward port of saas-12.3 to saas-12.4 up to fe4caecb59dMartin Trigaux
closes odoo/odoo#35059 Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2019-07-18[FIX] web: execute action from new record and go backAaron Bohy
Let's assume a form view with a readonly many2one field with a default value. When creating a new record, the user can click on the many2one value, which should open the related record in a form view (stacked in the breadcrumbs). Before this rev., this didn't work: we actually came back to the previous view/action in the breadcrumbs, when trying to open the related record. closes odoo/odoo#33172 Signed-off-by: VincentSchippefilt <VincentSchippefilt@users.noreply.github.com>
2019-07-12[MERGE] Forward port of saas-12.3 to saas-12.4 up to 87fc1554d6a1823Martin Trigaux
closes odoo/odoo#34820 Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2019-07-11[FIX] web: batch read of m2m in o2m after onchangeAaron Bohy
Let's assume a one2many field (editable list) in a form view with a many2many (e.g. many2many_tags), and an onchange on the one2many such that, when a row is added to the relation, the server returns update commands for (a subset of) the records being already in the relation. For thoses updated records, the many2many field needs to be read (the onchange only returns the ids in the relation). Before this rev., the many2many field was read independently for each record in the one2many. This could cause a performance issue on large relations. For instance, this was the case on account.invoice records with a lot of lines. Issue 2027356 closes odoo/odoo#34785 Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2019-07-16[MERGE] Forward port of 12.0 to saas-12.2 up to 1bd434da34731b546Martin Trigaux
closes odoo/odoo#34901 Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2019-07-11[FIX] web: batch read of m2m in o2m after onchangeAaron Bohy
Let's assume a one2many field (editable list) in a form view with a many2many (e.g. many2many_tags), and an onchange on the one2many such that, when a row is added to the relation, the server returns update commands for (a subset of) the records being already in the relation. For thoses updated records, the many2many field needs to be read (the onchange only returns the ids in the relation). Before this rev., the many2many field was read independently for each record in the one2many. This could cause a performance issue on large relations. For instance, this was the case on account.invoice records with a lot of lines. This commit must be forwardported up to 12.2, not further. Issue 2027356 closes odoo/odoo#34771 Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2019-07-03[FIX] web: form: combine field and renderer classnamesAaron Bohy
The rendering of field widgets is asynchronous (as it returns a native Promise). However, the '_renderFieldWidget' method of basic renderers is sync, and returns a fake div that will be replaced by the widget'$el afterwards. The form renderer sometimes needs to add classNames on the rendered nodes (e.g. each child of an outer group as class 'o_group_col_x'). To handle this, once the field widget is ready, we copied all attributes of the fake node to the widget's node. Unfortunately, we were erasing the attr value (e.g. className) by the new one. As a consequence, the className defined in the widget were lost. This could be observed for the 'note' field in 'sale.order'. As this was only necessary for classNames, this rev. only retrieves the class attribute of the fake node, and adds it to the classNames of the widget's $el. closes odoo/odoo#34528 Signed-off-by: VincentSchippefilt <VincentSchippefilt@users.noreply.github.com>
2019-07-02[FIX] web: two o2m fields with onchangesCedric Snauwaert
Scenario: We have the following models: class A: submodel_1_ids = fields.One2Many(B) submodel_2_ids = fields.One2Many(B) class B: parent_model = fields.many2one(A) name = fields.Char() and the following onchange on class A: api.onchange(submodel_1_ids) def onchange_submodel1(self): // add newline to second o2m submodel_2_ids = submodel_1_ids api.onchange(submodel_2_ids) def onchange_submodel2(self): do_smth In a form view containing both o2m fields (editable="bottom" lists): 1) add a line on first o2m -> the onchange adds the same line on the other o2m 2) add a line on the second o2m Before this rev., the line (added in (2)) wasn't added at the bottom of the list, and the row in edition wasn't the newly created one. The issue occurred because we couldn't retrieve the datapoint corresponding to the other line (the one created by the onchange on the first o2m), and we thus created another which was put at the end of the list. Then, the BasicModel messed up the sort of the records because it couldn't match the virtual id of that new record with the ones in orderedResIds. We fixed the issue by preventing the model from creating a new datapoint after the onchange, by using 'ref' instead of 'res_id' to retrieve the one that already exist. closes odoo/odoo#34493 Signed-off-by: VincentSchippefilt <VincentSchippefilt@users.noreply.github.com> Co-authored-by: Aaron Bohy <aab@odoo.com> Co-authored-by: David Monjoie <dmo@odoo.com>
2019-06-28[FIX] web: BasicModel: don't update default one2many recordsAaron Bohy
Let's assume a one2many field in a form view with a default value with commands 4 (link to). Before this rev., when saving the record, the BasicModel generated a command 4 and a command 1 (update) for each record, with the values of the record (directly coming from DB). This can cause an issue when the related record can't be edited (e.g. a posted journal entry in accounting). closes odoo/odoo#33797 Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
2019-06-05[IMP] *: use new helper config.isDebug()Romain Derie
Before this commit, both config and session were aliases to odoo.debug. Now, config.isDebug() should be call, with possibility to pass a parameter to check if we are in a specific debug mode such as 'tests' or 'assets'. task-1934445 Coming with https://github.com/odoo/enterprise/pull/4281 Closes https://github.com/odoo/odoo/pull/33213
2019-07-29[IMP] base: Configure document layoutJulien Mougenot
The onboarding modal for setting up the few base fields of a company has now been moved to a wizard It is accessible from the general settings, but also in the onboarding section of sale and account modules. The following company settings are editable with that wizard: - Set report **layout**: The user can chose the overall look of the report. The current choices are : *Standard* (default), *Background*, *Boxed* and *Clean*. - Set company **logo**: Changes the company logo. - Set report **colors**: The user can set the primary and secondary colors of the report through a newly added widget allowing to pick a custom color. When changing the **logo**, colors are automatically set to its most dominant colors. > A "Reset colors" button also triggers the color calculation. - Set report **font**: Changes the overall font of the report. Only Google Fonts are used for enhanced compatibility. - Company **tagline**, also called "header" - **Footer** - **Paper format** - Report **preview**: A mockup of a final report Automatically updates when changing **layout**, **logo**, **colors** or **font** Co-authored by: Julien Mougenot <jum@odoo.com> closes odoo/odoo#33863 Signed-off-by: VincentSchippefilt <VincentSchippefilt@users.noreply.github.com> Co-authored-by: Lucas Perais <lpe@odoo.com>
2019-07-22[MERGE] Forward port of saas-12.4 to master up to aadc4a9f0be4Martin Trigaux
2019-07-19[IMP] base,web*: searchpanel in all multi record viewsLucas Perais (lpe)
Before this rev. the searchpanel could only be activated in kanban views (and it was specified in the kanban arch). From now on, the searchpanel can be activated in any multi record view. It's arch is moved to the search view arch (inside the <searchpanel> tag). Task 1985921 Co-authored-by: Aaron Bohy <aab@odoo.com>
2019-07-15[MERGE] Forward port of saas-12.4 to master up to 1f5a4649a67908Martin Trigaux
closes odoo/odoo#34850 Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2019-07-12[IMP] web: Make archive:unarchive buttons manage returned actionsYannick Tivisse
Purpose ======= When calling toggle_active, you may sometimes retrieve an action to execute. For example, when archiving an employee, it opens a wizard to provide information about the departure, and choose an offboarding plan. This commit modifies the way toggleActive, actionArchive and actionUnarchive works to manage this behavior.
2019-07-12[FIX] web: Call 'toggle_active' instead of 'write'Yannick Tivisse
Purpose ======= Currently when clicking on 'Archive' or 'Unarchive' on the list view, we write directly on the record {'active': False}, instead of calling toggle_active. Missing that way implementation of numerous business cases. Example - Archive a record --> archive its next activities - (Un)Archive a user --> (Un)Archive its partner - (Un)Archive a product variant --> (Un)Archive its template if there is only one variant - Archive an employee --> Open a wizard to choose an exit plan + describe the departure reason - Archive a route --> Archive its procurement rules - ... Specification ============= - Call toggle_active instead of write when calling toggleActive in the web client. - On the other hand, use actionArchive and actionUnarchive to apply the toggle action on the related records only.
2019-05-06[MERGE] forward port branch saas-12.2 up to 78b3b650b0dChristophe Simonis
2019-05-13[MERGE] forward port branch saas-12.3 up to 60e71302a38Christophe Simonis
2019-05-13[IMP] base: Contextualize the multi companyYannick Tivisse
Purpose ======= Allow the user to select the allowed companies for which he wants to see records on top of selecting his current company. It is confusing for users to see the records from the company he is connected to and the records of the children companies. Instead of using the hierarchy of companies to access records across companies, the user can now select (from his set of allowed companies) the companies for which he wants to access records. /!\ This means that the user will interact with records from company A when in company B. Example: a SO has been created and confirmed in A. When in B, I create the invoice from it. Specifications ============== 1/ Deprecate the parent/children hierarchy on the res.company model. The fields are kept on the res.company model to ensure the retro-compatibility, but won't be used accross the standard code anymore. The only functional usage for this mechanism was to allow to see records from several companies by creating a virtual parent company, which will be possible with the new mechanism. 2/ By default, a user will only see the records of the company he is connected to (or records without a company). (It is still editable by the user if needed). For that, put this information in the user context, to allow having different configurations on different browser tabs. Instead of having domains like ['|', ('company_id', '=', False), ('company_id', 'child_of', user.company_id.id)] you'll have something like ['|', ('company_id', '=', False), ('company_id', 'in', company_ids)] Note that the 'company_ids' is a value that is passed in the evaluation context on the record rule, as we already have user, or time. company_ids is a list of the ids of all the enabled companies in the user's context. 3/ Out of the generic improvements brought by this task, this will illustrate issues that could exist since several versions. For example, it should not be possible to create a scrap order for the company A with a package of the company B, or it should not be possible to create an invoice on the company A with payment terms from the company B. Before the version 12.0, it was easy to encounter this kind of issues as the admin was the SUPERUSER_ID. A positive side effect of the fact that the SUPERUSER_ID has become an inactive user was to make it more difficult to introduce mismatch on the records, but haven't solved the issue, as it was still possible to do it with parent companies configuration. Some of these issues have been fixed in this commit, but all the business flows should be re-tested to check if an ir.rule should be introduced (eg: a multi company rule for stock.quand.package), if the company of a record is correctly transfered to another record created from the first record (eg: From a SO, create an invoice and a payment, the company of the sales order should be transfered on the invoice and the payment, even if the company of the sales order is A and I'm logged into the company B with the company A enabled. 4/ Currently, if I click on a button on a notification email (example 'View Task'), I face a traceback if I'm not logged into the company of the record. Now, if you click on a button and if you have access to the record, the correct company will be automatically set. 5/ If I display a kanban view with several records from several companies (and an image), all the images should be displayed. 6/ Currently if you copy paste an url, this will crash if you're not in the correct company. This won't be fixed because it's quite impossible to do it in a clean way. This task brings a workaround. Copy/Paste -> Traceback -> Log into the correct company, re-copy/paste -> Ok. 7/ 2 property methods have been added on the environment to retrieve the company on which the user is logged in and the companies the user enabled, on a specific tab. That way, when creating a record, instead of doing default=lambda self: self.env.user.company_id do default=lambda self: self.env.company_id On the other hand, to retrieve the enabled companies, do companies = self.env.company_ids 8/ Modify the Company Switcher widget to allow to log into another company WITHOUT writing on the res.users (and thus bringing cache invalidation issues and so on). Also allow to enable several companies and see records from several companies, and independantly of the other browser's tabs. 9/ When focusing on a tab, save the current company configuration on the local storage. That way, when doing 'CTRL+T' or a middle click, the context is propagated to the new tab. 10/ Improve the error message in case of multi company access errors. Now, when the user is in debug mode, display the related names of the records and the name of the user who brings the issue. 11/ Remove the context erasing when writing on a res.users This is probably coming from the migration to new API of the base module. The context was not propagated at this moment, which was a common mistake at that time. When migrating the module, probably by using the 'black box' method, as the context was not propagated, it was erased on the new version. This is now an issue because the context (i.e. the enabled companies) was erased when writing on a res.users, leading to tracebacks. See: https://github.com/odoo/odoo/commit/7eab8e26d3d46c53f4be924d6a34e80a66e74960#diff-4c2e738ee8f64f11806c889ea097b5e7R624 12/ Fix the crash manager on redirect warnings. The issue is the following - Create an invoice on a company without a configured CoA. - Set a partner - On the onchange_partner_id, a redirect warning is raised to propose you to configure a CoA - Click on 'Go to the configuration panel' - A generic warning says something like 'Do you want to discard your changes?' - Click on yes, the page refreshes, but not on the redirect action. Now, set correctly the action on the hash, and reload instead. The breadcrumb is lost for example, but you reach the correct action at least. 13/ Introduce a res.group to enable/disable the multi company per tab feature. 14/ To help the users to know which tab is in which company, add the possibility to have a favicon per company. When creating a company, the classical 'O' icon is colored by default in a random color. 15/ Remove the company switcher on the frontend. This was mainly there to allow a user to swicth to the company linked to the website. This behavior is now transparent to the user. If the website A is activated, then the company set on the context is the company of the website. 16/ Deprecated the _company_default_get method on the res.company model. Remove the method _get_company on the res.users model. 17/ Add 'allowed_company_ids' and 'current_company_id' on the pyeval context. You can now use those variables on domains in the views to access directly to the activated company.ies on the current tab. TaskID: 1960971 closes odoo/odoo#32341 Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2019-05-02[FIX] web: load binary data in separate http reqJulien Castiaux
The `read` done by `_fetchRecord` in `basic_model.js` expicitly set a `bin_size: true` in the context. That context option tells the backend to send the size of the binary payload instead of the payload itself thus slim the response size. Frontend widgets are then responsible to fetch the actual payload in a separated http req. The `search_read` done by `_searchReadUngroupedList` didn't set the context option thus all the binary fields were sent b64 encoded along with the `search_read` response. opw-1963842 closes odoo/odoo#33014 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2019-04-08[FIX] web: correctly update modifiers in editable list with buttonsMartin Geubelle
Since rev. odoo/odoo@015958d it is possible to add buttons in list group headers. These buttons are defined in <groupby> nodes, pointing to m2o fields. Modifiers specified on these buttons thus use fields on the m2o comodel. There was a traceback in editable list view, when grouping by a m2o that defines a groupby button with modifiers as the modifiers are not registered with the same datapoint. When updating the modifiers, one must ensure that the modifier are related to the updated record. closes odoo/odoo#32456 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2019-05-02[IMP] web: various small improvements to form viewGéry Debongnie
This commit is a few small improvement/fixes to the web framework: - allow placeholder attribute on input tags in form view - only bind click event handler to buttons managed by the framework, not custom ones - _onExecuteAction method in action manager properly fails if event cannot be properly handled closes odoo/odoo#32458 Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2019-04-02[IMP] web: fetch records alongside read_groupAaron Bohy
This rev. adds params to the 'web_read_group' method, allowing to search_read records inside each groups in a single RPC, instead of doing a 'web_read_group' RPC followed by n 'search_read' RPCs, where n is the number of opened groups. Part of task 1915702
2019-04-02[IMP] web,board: enable pagination in grouped listsAaron Bohy
With this rev., when there are a lot of groups in a grouped list view, groups are displayed under several pages, whereas they were all displayed in the same page before. This is especially interesting with the new 'expand' attribute, to ensure that we don't read records for a large number of groups. By default, the groups limit is set to 80 (like records), and to 10 is the 'expand' attribute is set to true. This limit can be overriden with the 'groups_limit' attribute. Part of task 1915702
2019-04-02[IMP] web: list: add expand attrsAaron Bohy
When this attribute is set to true on the <tree> root node, in a grouped list view, first level groups are automatically opened. Part of task 1915702
2019-04-02[IMP] web: list: editable grouped list viewsRavi Gadhia
This rev. enables the editable feature in grouped list views. Part of task 1915702 Co-authored-by: Aaron Bohy <aab@odoo.com> Co-authored-by: Martin Geubelle <mge@odoo.com>
2019-03-13[MERGE] forward port branch 11.0 up to c23d1186e7bChristophe Simonis
2019-03-08[FIX] web: record datapoint context without group_by or orderedByLucas Perais (lpe)
Have a list view, apply a group_by and a filter with a sort parameter Click on one record to access the form view Have a x2m within it Before this commit, the x2m records were loaded with a context containing the keys orderedBy and group_by It seems harmless at first, but even conceptually those keys should not be here - they apply on a list of records, and not to individual ones - they may contain field names not existing in the x2m model Hence, when accessing another list view through an action button, the list will try to be orderedBy or group_by with the given context Which is plain wrong in the first place and may cause crashes After this commit, the context of a record datapoint (representing a single record) is stripped from the keys Read the opw for a concrete use case OPW 1943583 closes odoo/odoo#31706 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2019-04-24[FIX] web: grouped Kanban: traceback on click during reloadPriyanka Kakadiya
Have a grouped Kanban view with an x2many field. Interact with the searchview, and then click anywhere. The fetch of the x2many relational data is batched for the whole view a single RPC for all groups) since e10fd346. If the click occurs before all search_read are done (i.e. before the fetch of relational data is started), there is a crash. This is due to a call to get({raw: true}) to obtain the current model's state, which is currently being reloaded and in an intermediate state. Ideally, this shouldn't happen, but with the sync API of get, we can't change that easily. So at most, we can ensure that it doesn't crash. Moreover, sensitive functions requesting the state for the data can do that in the mutex to ensure that the state isn't currently being reloaded. Related to Issue: 1937149 closes odoo/odoo#32587 Signed-off-by: Géry Debongnie (ged) <ged@openerp.com> Co-authored-by: Mohammed Shekha <msh@openerp.com> Co-authored-by: Aaron Bohy <aab@odoo.com>