Commit Graph
49 Commits
Author SHA1 Message Date
Barad Mahendra 281b65a943 [FIX] web,*_*: fix the html content in notification
Currently markup-ification of the legacy notifications system
display the html content in notification layout for some of the
notification of document and planning from commit: https://github.com/odoo/enterprise/commit/ba44461fea337ed2e5adbdfa1e8eede00b036def

So here in this commit, we make the method `makeLegacyNotificationService`
always `_.escape(message)` and pass `messageIsHtml: true` to the owl
notifications system so notification with html content will be displayed
properly.

Task-2657391

closes odoo/odoo#78627

X-original-commit: 7ce6d8d70be79c9c626865598b898dce9a18b045
Related: odoo/enterprise#21782
Signed-off-by: LTU-Odoo <IT-Ideas@users.noreply.github.com>
2021-10-19 14:43:42 +00:00
François (FRC) 377f18013a [FIX] partner_autocomplete, *: fix partner autocomplete dropdown menu hidden
base: The two elements were not distinguishable by an xpath.

partner_autocomplete: Use new ids in xpath

The class `o_text_overflow` set on the fields was also
preventing the dropdown menu from appearing. This class is
now moved to the `input` tag instead of the while `div`.

closes odoo/odoo#78141

Task: 2638570
X-original-commit: fd7bfbccd45f874d5a826e695858bc75c8467700
Signed-off-by: Florian Daloze (fda) <fda@odoo.com>
2021-10-11 13:52:31 +00:00
Fabrice Henrion 0e30b8b828 [FIX] partner_autocomplete: correct typo
closes odoo/odoo#73524

Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2021-08-06 12:13:23 +00:00
Samuel Degueldre 08afc0af8f [REF] *: remove use of legacy notifications from tests
When writing the new webclient, the notification service was rewritten,
and all of its uses in production code were changed to use the new
services, however, some tests were still reliant on the old notification
service.

This commit removes references to the legacy notification service so
that we can be one step closer to removing it from the code base.

Part of #72675
2021-07-14 07:34:18 +00:00
Jorge Pinna Puissant 54e9527ec2 [IMP] web, *: read session information from a module
* google_recaptcha, mail, partner_autocomplete, point_of_sale, website

Now, to read session information, the module "@web/session" must be
imported. Not that, there is also the user service with all the user
information.

closes odoo/odoo#73201

Related: odoo/enterprise#19434
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-07-08 14:13:39 +00:00
Bruno Boi 8fcdcc0b1c [REF] web: extract company service from user service 2021-06-18 21:31:30 +02:00
+1 14bffd983e [REF] *: adapt code to new owl webclient
This commit adapts the community codebase to the rewriting of the
/web application in owl.

Co-authored-by: Aaron Bohy <aab@odoo.com>
Co-authored-by: Bruno Boi <boi@odoo.com>
Co-authored-by: Géry Debongnie <ged@odoo.com>
Co-authored-by: Samuel Degueldre <sad@odoo.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Co-authored-by: Simon Genin (ges) <ges@odoo.com>
Co-authored-by: Francois (fge) <fge@odoo.com>
Co-authored-by: Michael Mattiello (mcm) <mcm@odoo.com>
Co-authored-by: Julien Mougenot <jum@odoo.com>
Co-authored-by: Lucas Perais (lpe) <lpe@odoo.com>
Co-authored-by: Jorge Pinna Puissant <jpp@odoo.com>
2021-06-18 21:31:27 +02:00
Sébastien Theys c6716847aa [IMP] web, *: clean up notification API
task-2476867

closes odoo/odoo#67009

Related: odoo/enterprise#16760
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2021-05-27 13:47:23 +00:00
Munaf Khan c94e187cbe [IMP]partner_autocomplete: company name field length
Currently, in the res.company form view, name field
is extremely short.and in mobile view name field
is hidden by other element because of placeholder
is too long.

after this commit the length of name field is should
be as long as the res.partner one and change the
placeholder (e.g. My Company) instead of (e.g. My Awesome
Company) for idle mobile look.

closes odoo/odoo#70241

Taskid: 2520268
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-05-10 10:22:40 +00:00
Jorge Pinna PuissantandSamuel Degueldre f43a0814ae [IMP]*: configuration of ESLint for specific files
This commit will add the needed ESLint configurations on the JS files.
These configurations are added if the JS file uses a different
environment (serviceworker, node, etc) or if it uses a specific global
(google, ace, etc).

Co-authored-by: Samuel Degueldre <sad@odoo.com>
2021-05-04 13:32:49 +00:00
Simon Genin (ges) ecfe85db84 [REF] web: static/src/(img|fonts) => static/(img|fonts) 2021-04-29 07:34:40 +00:00
Adrien Dieudonne b13884fa7a [FIX] *: removal of any possibility of purchasing IAP credit in iOS
According to the app-store guidelines we are not allowed to sell from
the iOS app.

Our updates are currently blocked because of this.
In the rush, we have no choice but to hide certain elements related to
IAP services.

Source: https://developer.apple.com/app-store/review/guidelines/#business

Related PR:
https://github.com/odoo/mobile-ios/pull/102
https://github.com/odoo/mobile-ios/pull/103

Task-id: 2483253
X-original-commit: 657780cc7102c77cafe20998df0d7667cdc4c0df
2021-04-29 10:07:36 +00:00
Laurent Stukkens (LTU) 3e847fc8f4 [FIX] web,hr_timesheet,partner_autocomplete: make multi company timesheet uom work
This commit's primary objective is to ensure that the timesheet uom is working in accordance
with the company settings in a multi company environment.

Prior to this commit:

 - The timesheet preferences sent to the front end were always those of the default
   company of the user.
 - The timesheet related widgets initialisation process (adding the correct ones in
   the fieldRegistry) was performed before the front end treatment of cids and coockies
   which prevented applying the front end selected company settings.

After this commit:

 - A dictionnary is used in the session in order to structure the companies info.
 - The company timesheet preferences are sent to the front end through the company dict.
 - The uom info is sent to the front end through the session.
 - The timesheet uom is now managed from the frontend and is now in sync with the settings.
 - Timesheet widgets are initialised during the AbstractWebClient init and are in sync with
   the multicompany front end settings

task-2168337
Closes: #66551
2021-03-04 10:34:32 +01:00
97f2957821 [IMP] partner_autocomplete: automatically enrich user companies
In order to make a wow effect right after DB install we enrich the base
company based on the given email address or company website at install.
In order to achieve that goal we use the partner_autocomplete service from
IAP. It uses free credits that are offered to new clients on saas platform.

Only the fields that are not filled yet are enriched to avoid erasing user
entered data, except logo. Indeed as partner_autocomplete is probably installed
as a core app (mail -> iap -> partner_autocomplete auto install chain) it is
unlikely that people already updated their company logo.

We consider that having a call to IAP consuming a token is ok for a standard
use case, especially that

  * if no iap service is configured call to IAP won't add much timing;
  * on Odoo SaaS free credits are given and company is enriched;
  * on custom SaaS with custom iap service, at db creation probably no
    credits are given and call will simply give no results back;

We decided to call IAP asynchronously at client web load. Session combined to
a boolean field on company model allows to do this call only once per company.
Doing this allows to avoid adding yet another post init hook. It also eases
behavior tweak through inheritance.

This call is limited to admin for obvious security reasons as well as
performance reason (limiting calls to external providers). As call will be
done once per company generally admin is the first person to log into the
its newly created Odoo.

LINKS

Task ID-2322455
PR odoo/odoo#64600
PR odoo/upgrade#2086

Co-Authored-By: David Beguin <dbe@odoo.com>
Co-Authored-By: Thibault Delavallee <tde@odoo.com>
2021-02-01 13:53:59 +00:00
Krina Oza 036b7720d0 [IMP] various: Updated App icons for various modules
In this commit icons of the following modules are updated:

-fetmail
-hr_skills
-iap
-mail_bot
-microsoft_calendar
-partner_autocomplete
-payment_alipay
-payment_odoo_by_adyen
-payment_payulatam
-sale_timesheet
-sms
-snailmail
-test_exceptions

TaskID:2378861

closes odoo/odoo#62291

Related: odoo/enterprise#14958
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-11-25 11:09:53 +00:00
asa-odooandD J 0da98620ca [FIX] partner_autocomplete: avatar widget not clickable on mobile
Previously, in company form view, avatar was not clickable due to a
`block` div that was overlapping the avatar widget and preventing
clicking on it.

This commit fixes the issue by preventing the overlap and thus making
the image widget on company form clickable.

Note that another fix would be to remove `partner_gid` from the company
form view (it's already the case in 14.0).
In this case "oe_title" is directly followed by .o_form_view .oe_avatar
and a padding-right: 100px is applied:
.o_form_view .oe_avatar + .oe_title {
    padding-right: 100px;
}
However, considering stable version, changing fields position
should be avoided.

Task Id: 2231950

closes odoo/odoo#62634

Pr: #53798
X-original-commit: 6e6847767b1c2ef741773a1a8a63cccbcf31e798
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
Co-authored-by: D J <dja@odoo.com>
2020-11-30 16:23:13 +00:00
Krina Oza 42965b16cb [IMP] various: Update the app icons
Purpose of the task is to update the icon of the various modules.

So in this commitn updated App icons of the following modules:

-fetchmail
-iap
-mail_bot
-partner_autocomplete
-sale_timesheet
-sms
-snailmail

Related PR: https://github.com/odoo/enterprise/pull/14408

closes odoo/odoo#60817

Taskid: 2369682
Related: odoo/enterprise#14408
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-10-27 13:19:20 +00:00
Nicolas Lempereur 56f04a273f [FIX] partner_autocomplete: show other errors
When IAP reply when an error for partner_autocomplete, show the error
instead of thinking `error` and `error_message` are res.partner data
which leads to subsequent errors.

opw-2337763
opw-2341473
closes #58024

closes odoo/odoo#58241

X-original-commit: 0c71cc51adf92582c89ae7c78141278bae341f22
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2020-09-22 14:16:37 +00:00
Nathan de Pryck 9bee0b4752 [FIX/IMP] partner_autocomplete: vat for free
In this commit, we ensure that the vat is
added to the company data if an error occured
when contacting iap-services.

task~2092378

closes odoo/odoo#57335

X-original-commit: 848733b758063307bbbbf69eee10cd2426e9c017
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
2020-09-09 09:22:20 +00:00
Rémi Rahir 08ed6afa2a [IMP] partner_autocomplete: do not fill email field on partner
- the email returned by Partner Autocomplete is often useless as it is
quite generic/random e.g. info@company.com. As it is set automatically,
the user might not realize he is going to send an email to that
generic address.

- not returning the email address faclitates some onboarding flows. It
allows us to prompt the user to set his own email address to have a
preview of the emails we are sending.

Note that this information is not lost but rather displayed in the
chatter of the partner record.

However, we do not propagate this modification to other services like
Lead Enrichment or Lead Generation since this kind of email is still
relevant to:
- approach a new prospect
- enrich information and create leads based on the email domain

TaskID 2321864

closes odoo/odoo#56038

Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
2020-08-18 13:53:46 +00:00
Dhruv Patel a75bd4d353 [FIX] partner_autocomplete: auto suggestion box cut on small device
Partner autocomplete suggestion popup cropped from the top in small devices.
once you type anything in M2O box, autocomplete popup will display with all
maximum possibilities consist of the database records and records got from
global search partner API.

Currently, we have limit of database record search is 7 and autocomplete
display maximum 16 items databse records + API generated records.
So with this commit, we have reduced the API record display limit for small
devices, based on height it will display number of items in autocomplete box,
this will reduce chance of cropped issue.

Task:2206844

closes odoo/odoo#51151

X-original-commit: ded375786557ae6c7680409faa32cbe3a4e30e99
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-05-13 09:59:36 +00:00
Rémi Rahir 9f2b2ed130 [FIX] partner_autocomplete: image.mixin on partner form
The m2o widget did not provide the correct default context key.

closes odoo/odoo#46888

X-original-commit: d59ebe634f3d9f89d493ca38418513bea24f3ba9
Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
2020-03-04 13:25:14 +00:00
Goffin Simon 7dd24ec90b [FIX] iap, partner_autocomplete: Autocomplete without IAP account token
Steps to reproduce the bug:
- Go to Settings > Technical > IAP account >
- Remove the access token
- Go to Contact
- Try to create a company called 'Proximus' and click on the autocomplete

Bug:

A traceback was raised because the IAP account token was not set.

opw:2087607

closes odoo/odoo#39099

X-original-commit: bc6357f0b95d354afa602eecce24a3c265819101
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2019-10-21 09:08:27 +00:00
Pierre Rousseau 47f64af982 [FIX] partner_autocomplete: do not crash on empty logo
Before this commit, if the user clicked on a company which have no company logo, the system did not let him create a contact.

opw-2086824

closes odoo/odoo#39054

X-original-commit: e3fe7a9af00b7afa5b03d5dcaac1d8f135cb1ea5
Signed-off-by: Pierre Rousseau (pro) <pro@odoo.com>
2019-10-18 15:14:56 +00:00
Juhil Somaiya ececa1f7bf [FIX] *: hide technical field widgets in non-debug mode (Studio)
*:
- account
- barcodes
- calenndar
- hr_timesheet
- mail
- mass_mailing
- partner_autocomplete
- web
- website_slides

This commit removes description of fields that should not be shown in
non-debug mode Studio. Only field widgets whose own description is
set are displayed in non-debug mode Studio in "Widget" of sidebar.
In other words, even if any ancestor has a description but not the
current widget, it won't be displayed in the sidebar in non-debug
mode.

Task-Id 2056992

closes odoo/odoo#35902

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2019-09-23 15:00:44 +00:00
Julien Mougenot 91ea5a2ca4 [REF] web,*: native event dispatching in test utils
*: mail,partner_autocomplete: adapted tests

Added a new function to trigger the adequate type of event on
an element (native JS event to DOM Nodes and jQuery event to jQuery objects),
and refactored the generic event-triggering functions to call this new function.
2019-08-26 07:36:28 +00:00
Sébastien Theys 1e9772889b [IMP] *: use image.mixin when appropriate
The following models are already using big images, or they might need big images
in the future:

- partner
- hr employee
- shop category
- lunch product
- gamification badge and karma rank

PR: #34925
2019-08-02 16:47:58 +00:00
fja-odoo 283f8fed6e [IMP] web, *: display rpc warnings with toasts
* = test_website, partner_autocomplete

- All the rpc warnings are now displayed using the notification system
  of https://github.com/odoo/odoo/commit/b94395b50175925fc7d1bd3655e5facb78a8ba2b

- test_website is up to date

Part of https://github.com/odoo/odoo/pull/32132
task-1894820
2019-06-28 08:53:53 +00:00
Sébastien Theys 9dec7ba7e9 [IMP] web, *: add utils to get dataURL (base64) from file/blob
* = partner_autocomplete, point_of_sale, web_editor,
website_forum, website_slides

This can be used for example to preview an image from a file input field.

It can also be used to send the base64 content of the input by RPC instead of
having to rely on form submit as POST with multipart/form-data.

Technically wrap FileReader.readAsDataURL in a Promise.

This will also be used in task-1930726

PR: #33508

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2019-05-21 11:37:20 +00:00
Yannick Tivisse a5b6f31cf2 [IMP] base: Contextualize the multi company
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-13 08:57:49 +00:00
qsm-odoo b94395b501 [IMP] web, *: share and improve notification system
* barcodes, calendar, partner_autocomplete, web_settings_dashboard

Make the notification system better, using bootstrap toast component,
and make it available in the frontend.

The toast component allowed to remove some JS code and made the
component customizable by themes but it had to be reviewed/fixed to make
it functional (maybe bootstrap will review its work in next versions).

This work should still be improved because there are still too many
ways (deprecated and not deprecated) to instantiate toasts in the
backend. The goal here was however to make the toasts more modern and
make them available in the frontend.

This work is needed for some tasks. @kig-odoo and @fja-odoo made a
pre-work to instantiate toasts in the frontend for their respective
tasks. This commit unifies the system.

Part of https://github.com/odoo/odoo/pull/32793
task-1970731

closes odoo/odoo#32793

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2019-04-24 13:21:41 +00:00
Juhil SomaiyaandMohammed Shekha 5dc971b1ae [IMP] web, *: add a description to generic widgets
A `description` key has been added on AbstractField and all generic
field widgets ; it is used to display a more user friendly name (both in
the webclient and in Studio).

Non-generic field widgets have an empty string as description.

Related task 1918327

closes odoo/odoo#30131

Signed-off-by: Martin Geubelle (mge) <mge@openerp.com>


Co-authored-by: Mohammed Shekha <msh@openerp.com>
2019-04-24 09:57:56 +00:00
Aaron Bohy 0bc24a78a2 [FIX] web,*: adapt autocomplete dropdowns after jquery update
*partner_autocomplete,test_main_flows

In jQuery 3, the active element in autocomplete dropdowns is no
longer identified with class 'ui-state-focus' on the <li/>, but
with class 'ui-state-active' is on its child <a/>. Moreover, the
background color of the active element is now set on the <a/>
instead of the <li/>.

This rev. adapts scss rules accordingly, and selectors in the
main_flow_tour.

Issue reported on the jquery update pad.

closes odoo/odoo#31693

Signed-off-by: VincentSchippefilt <VincentSchippefilt@users.noreply.github.com>
2019-03-08 07:25:39 +00:00
5547aa2487 [REF] partner_autocomplete: adapt code after jQuery update
Part of task 1896658

Co-authored-by: Aaron Bohy <aab@odoo.com>
Co-authored-by: Christophe Matthieu <chm@odoo.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Co-authored-by: David Monjoie <dmo@odoo.com>
Co-authored-by: Martin Geubelle <mge@odoo.com>
Co-authored-by: svs-odoo <svs@odoo.com>
Co-authored-by: Vincent Schippefilt <vsc@odoo.com>
2019-03-06 20:07:17 +01:00
Christophe Simonis 3cbc9dd6c0 [MERGE] forward port branch 12.0 up to 6a0675d36d 2019-01-14 10:34:50 +01:00
Pierre Rousseau 700191514e [FIX] partner_autocomplete: ignored field is sent to view
The field ignored is set in javascript on company object to filter the
ones we want to show. As it is not an odoo field, it triggers a
traceback when the trigger_up 'field_changed' is called.

OPW-1921568

closes odoo/odoo#30153
2019-01-11 15:04:34 +00:00
Christophe Simonis 8aa8548d8a [MERGE] forward port branch 12.0 up to 3e4138deaa
closes odoo/odoo#30045
2019-01-09 15:56:53 +00:00
Pierre Masereel 52dd18b8ad [FIX] partner_autocomplete: ignored field is sent to view
The field ignored is set in javascript on company object to filter the
ones we want to show. As it is not an odoo field, it triggers a
traceback when the trigger_up 'field_changed' is called.

OPW-1921568

closes odoo/odoo#29864
2019-01-03 07:19:35 +00:00
Antoine Prieels (ANP) 186e70ad6c [FIX] partner_autocomplete: Remove companies from suggestions
We wanted to make it possible to manually mark records from the partner_autocomplete service as 'ignored' so that they wouldn't appear in suggestions.
Previously, this was done by removing, in the service, records that were marked as 'ignored' from returned suggestions.
The problem is that, since the record was not present in odooSuggestions, the data from this company was retrieved from clearbitSuggestions and the company was still present in the dropdown.
We fix this problem by also returning ignored companies from the service, marked as 'ignored', so that they can be filtered out after getting additional suggestions from clearbit.

closes odoo/odoo#29785
2018-12-28 08:49:17 +00:00
len-odoo 8f3ac2530f [FIX] base, partner_autocomplete: remove vat from the partner selection field
Commit a6e1eb9f0a
introduced the show_vat context key, that displays the Tax ID of a customer
after its name when present, similarly to show_address.

However it appears on the field when being edited, then disappears at save,
which is confusing.
Other unclean things tended to happen: you would have "name - taxid" on customer
field, but "name" on invoice address and delivery address.
Furthermore a client could edit the name manually to erase the Tax ID, and thus
recreate a new record for the same customer.

We introduce a method to clean the name from the Tax ID, and use it so that it
is directly the client's name that is selected at edit.

Note that we also replace the standard dash in the 'name - taxid'
by a figuredash (‒, U+2012) so as to avoid potential egregious splits
because of legitimate customer names.

Similar to commit: 3cbfc40303
(same thing for show_address)

opw 1911954

closes odoo/odoo#29189
2018-12-03 09:23:33 +00:00
Antoine Prieels (ANP) 8b930c648d [IMP] partner_autocomplete: Notify when user out of credits
closes odoo/odoo#29309
2018-11-28 10:32:20 +00:00
Christophe Simonis e1f9499d26 [MERGE] forward port branch 12.0 up to 053bb45706 2018-12-05 18:46:15 +01:00
Géry Debongnie abf32b8b21 [REF] *: update js test suite to use helpers
This rev. introduces robust helpers to use in the JS tests suite to
interact with DOM and components, and starts using them (almost)
everywhere.

All the helpers are exposed though testUtils.js.

There are 2 kinds of helpers:

1. Assertions
-------------
 * assert.containsNone, containsN, containsOnce check that the DOM
   (or a specific part of the DOM) contains a `selector`. It
   generates a correct error message automatically.
    ex: assert.strictEqual(form.$('.o_form_editable'), 1, "msg");
        -> assert.containsOnce(form, '.o_form_editable');
 * assert.isVisible, isNotVisible check that the DOM has an element
   visible or not. They also check that the element is actually in
   the DOM (before most tests didn't verify this).
 * assert.hasClass, doesNotHaveClass, hasAttrVAlue, check specific
   properties of a DOM element, and also validate that it is
   applied on a single existing DOM element (before most tests
   didn't verify this).
    ex: assert.notOk(form.$('button').hasClass('btn-primary'));
       -> assert.doesNotHaveClass(form.$('button'), 'btn-primary');

2. Utilities
------------
The goal of the utilities is to centralize the definition of many
standard components and interactions, ensuring that when we
refactor the JS framework, we do not need to change all the tests.

Existing mock utilities (addMockEnvironment, intercept, path,
patchDate, unpatch and fieldsViewGet) are moved to
'testUtils.mock.*'.
Existing DOM utilities are moved to 'testUtils.dom.*'.
New dom utilities are created for opendDatePicker, click,
clickFirst and clickLast. Helper `click` verifies that there is
exactly 1 element visible in the DOM you click on, `clickFirst`
and `clickLast` verify that there are more than one element on the
DOM.
 ex: form.$('button').click();
     -> testUtils.dom.click(form.$('button'));

New Form utilities: (testUtils.form.*)
 clickEdit, clickSave, clickCreate, clickDiscard, all clicks on
 the control panel buttons of the form.
 `reload` reloads the form data.

New modal, graph, kanban and pivot utils (testUtils.pivot.*,
testUtils.kanban.*, etc.).

New fields utils: (testUtils.fields.*)
 * editInput, editSelect: allow to change the value of a field,
   using a selector to identify it. They validate that the input
   exists and trigger the change event automatically.
 * editAndTrigger: allow to modify a field and trigger specific
   events after the value change
 * many2one (testUtils.fields.many2one.*)
   clickOpenDropdown, clickHighlightedItem, clickItem,
   searchAndClickItem: use a field name instead of a selector and
   do all the complex mechanism to open, filter and highlight
   many2one fields.

Joint work with aab, dam, ged, mge, svs and vsc.
2018-11-19 11:24:28 +00:00
Pierre Paridans 60d3fc736c [FIX] partner_autocomplete: autocomplete not defined in mobile
Bugfix to prevent traceback in mobile apps due to override
of Many2one widget with native implementation.
Happens in every form view containing a partner field.

Implemented as defensive programming.
The goal of the included test is to prevent a silent error for the
webclient. It doesn't test the actual behavior in mobile (where there is
no DOM for Many2one).

Task #1896641

closes odoo/odoo#27967
2018-10-23 16:58:58 +00:00
TWA 73f0cc21ce [FIX] partner_autocomplete: Enrich data even if get logo returns error 2018-09-29 11:30:21 +02:00
TWA e609a6ad4c [IMP] partner_autocomplete: improved additional informations template 2018-09-27 10:45:30 +02:00
Rémi Rahir 7838bde2a8 [IMP] partner_autocomplete: diverse improvements
- CRON changed to 60min
- Fixed display/rendering issues with autocomplete widgets.
- Moved 'Insufficient credit' banner
- Editable endpoint for partner_autocomplete service
2018-09-25 22:28:43 +02:00
TWA 302bd149dc [IMP] iap: Check Credit Widget moved to IAP module 2018-09-25 22:28:43 +02:00
Antony Lesuisse a6e1eb9f0a [ADD] partner_autocomplete: Added autocomplete on partners fields
For Name field or M2O, gives a list of companies
Data comes from Odoo IAP Service
2018-09-21 14:02:22 +02:00