Commit Graph
151539 Commits
Author SHA1 Message Date
Xavier-Do 6c25b81eb0 [FIX] crm: make TestLeadAssignPerf deterministic
The performances tests in TestLeadAssignPerf have a margin for queries
because of some randomness in query counts.

Those margins avoid random failures but will hide small increments,
making the query count fail randomly in future build. This margin also
makes the update of query counts difficult.

This commit tries to identify the source of this randomness and proposes
some fixes.

Sources of randomness
=====================
Comparing different executions, the query can differ on two point:
1. During the flush, while updating the lead
1.1 the written user_id can vary (~1 additional query)
1.2 the written convert_date can changes (~4 additional queries)
1.3 the written date_last_stage_update can change (~1 additional query)
2. during _handle_salesmen_assignment
2.1 write/_message_auto_subscribe can change? (~1 additional query)

the point 1.2 and 1.3 can be easily reproduced, adding sleep,
especially a 0.1 sleep in convert_opportunity

Writing different values for date will lead to multiple execute
when flushing the records:
the orm cannot group records with different values

Proposed fixes
==============
A. Use `cr.now` instead of `fields.datetime.now`
Using the transaction time will avoid randomness linked to the change of
second during the transaction. This will fix 1.2 and 1.3

B. Sorting members
The members comes from a o2m and the order is not deterministic.
During the test with a subset of lead (10 instead of 100),
the two last members  ('Martin Sales Manager' and 'Orteil Sales Own')
can come in different orders, leading to different user_id set on lead.
Instead of 4 different users, the lead where sometimes dispatch on
5 different users with this setup. (5 queries in flush() instead of 4)
This is fixed by adding a complete order (adding id) on crm.team.members
This will solve 1.1

C. The leads are also ordered by id if they have the same probability,
since it shouldn't hurt and make the search more deterministic.

2.1 was fixed by B or C or is not fixed, not sure anymore.

task-2796579

Part-of: odoo/odoo#85525
2022-04-04 16:48:16 +02:00
Xavier-Do a1b2a69de9 [IMP] speedscope: add a constant_time option
The profiler can be useful to debug random behaviour, but the frame
duration becomes irrelevant in this case.
A new option allows to make all sample last exactly one second,
making the duration correspond to the number of frame,
especially useful for sql and query count debugging.

task-2796579

Part-of: odoo/odoo#85525
2022-04-04 16:48:15 +02:00
Laurent Smet 23f2b70a23 [FIX] account: Fix traceack when registering a 0 amount payment
=> Create an invoice in foreign currency
=> Register a payment of 0 using the currency of the company and select "Keep open"
A traceback is raised

closes odoo/odoo#87886

X-original-commit: 14894623029c24230dea92ccef950cff914e1704
Signed-off-by: Olivier Colson <oco@odoo.com>
Signed-off-by: Laurent Smet <las@odoo.com>
2022-04-04 15:39:50 +02:00
Laurent Smet f7d4ca469d [FIX] account: Fix division by zero on register payment wizard
- Create an invoice having a foreign currency
- Register a payment of 0.0 using a different currency with a write-off of any account
=> traceback

Task: 2809565
X-original-commit: c86faecc980523fcfa6a3258f4c17bf30b41522c
Part-of: odoo/odoo#87886
2022-04-04 15:39:50 +02:00
Achraf (abz) cfccd028b3 [FIX] board, project: Allow user to add project_graph to dashboard
If we add the graph view of project in the dashboard
And we access the dashboard a traceback appears

Cause: Unable to evaluate the context because the following information
is missing: "active_id" which is used in the domain

https://github.com/odoo/odoo/blob/4d864c05dfa8f9be25d41bbae318f75a61d0cde2/addons/board/static/src/legacy/js/board_view.js#L254

the solution is to add `globalContext` to the `contextToSave`

https://github.com/odoo/odoo/blob/7e77bb74bfa1bfef92c6d385dedc2d89e0040780/addons/board/static/src/add_to_board/add_to_board.js#L37-L43

`View` is `undefined` because the `project_graph` view is made with OWL
and board is still in legacy

https://github.com/odoo/odoo/blob/4d864c05dfa8f9be25d41bbae318f75a61d0cde2/addons/board/static/src/legacy/js/board_view.js#L274

Since https://github.com/odoo/odoo/pull/84864

The solution is to add a legacy version of the `project_graph`

Apply the same fix for `project_pivot`

opw-2791672

closes odoo/odoo#87883

X-original-commit: 8999277e668f666bc650d508384c4a07ea6c711e
Signed-off-by: Achraf <abz@odoo.com>
2022-04-04 14:45:26 +02:00
momegahedandFeyens Victor cccb235794 [FIX] sale: discount is calculated on wrong price
If applied, this commit will fix the following bug by changing the
price used in the discount calculation equation to be the real price.
the two prices differs when mapping a tax inculded price to a tax
excluded price

Steps to reproduce:

1- install sales - accounting
2- create a product p with customer tax t
3- create a fiscal position for a country (belgium for example) that
maps t to a lower value tax.
3- create a pricelist pl with discount d
4- create a new SO, add a customer from belgium, add p, then select pl,
 click on update prices
5- the discount is not d, it is calculated based on
(p price - customer tax)

in comparison to:
4- create a new SO, add a customer from belgium,  select pl first, add p
5- the discount is d.

Bug:

the wrong price is being used for discount calculation

Fix:

calculate and use the correct price similar to the normal behavoir when
the pricelist is selected first

OPW-2745421

closes odoo/odoo#87882

X-original-commit: 43f938627ad91bab2ec233756041d5712ee29323
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
Co-authored-by: Feyens Victor (vfe-odoo) <vfe@odoo.com>
2022-04-04 14:45:22 +02:00
Mathieu Walravens ae95a1025e [FIX] base: shadowed attachment filename
When a filename is given to the function binary_content it was shadowed
by _binary_ir_attachment_redirect_content if it is an ir.attachment.

To reproduce:
  1. Start a brand new database in V14, install any app on which you can add an attachment (like Project or CRM)
  2. Add a file as an attachment
  3. Try to call the route "/web/content/<string:model>/<int:id>/<string:field>/<string:filename>"

closes odoo/odoo#87879

Solution: Use another variable to store the return value of _binary_ir_attachment_redirect_content and use it if the filename is not provided.
X-original-commit: 55e6097502da6169b85056b4769f4bf7fd230968
Signed-off-by: Wanderscheid Mathieu (mawa) <wama@odoo.com>
Signed-off-by: Julien Castiaux <juc@odoo.com>
2022-04-04 14:45:15 +02:00
tsm-odoo e5a9f77399 [IMP] mail, *: make activity menu tests rely on real behavior
*: calendar, note

In order to prepare the ground for test adaptation using the startServer method,
make the systray_activity_menu more realistic : instead of using a fake model, we
now rely on a  method in the mock server. This method mimics the behavior of the
`systray_get_activities` present on the res.users model.

task-2792108

closes odoo/odoo#87743

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2022-04-04 14:45:11 +02:00
tsm-odoo 9a2bb1a809 [MOV] mail, test_mail: move activity menu test to test_mail
In preparation for the adaptation of its adaptation to the new
way to seed tests data, the `systray_activity_menu_test` is moved to test_mail. Indeed,
with this adaptation, all fake models will be replaced by real ones, the `MailTestActivity`
model is the perfect candidate for this.

task-2792108

Part-of: odoo/odoo#87743
2022-04-04 14:45:11 +02:00
Kevin Baptiste 5ff6b41f67 [IMP] hr_contract: properly define first_contract_date
Removing the `related` makes it properly defined on the SQL view and
allows the field to be searched.

closes odoo/odoo#87885

Taskid: 2781421
Signed-off-by: Kevin Baptiste <kba@odoo.com>
2022-04-04 13:43:52 +02:00
aliya d949569e87 [IMP] account: clarify credit note creation message
Task: 2760136

Currently, when a credit note is created there is a message in the chatter "Invoice created", which is not coherent.
- Credit Note creation message should be "Credit Note created"

closes odoo/odoo#87868

X-original-commit: 93f65ff0b9e19037112c33ebda4cbfbd34f633e8
Signed-off-by: Olivier Colson <oco@odoo.com>
Signed-off-by: Tastemirova Aliya (alta) <alta@odoo.com>
2022-04-04 12:32:23 +02:00
Philippe Wauthy 4a91b626f9 [FIX] hr_holidays: fix default duration when creating a new time off from dashboard
In the dashboard of Time Off, when clicking on New Time Off, there is a difference of
one day between the start and end date and the duration of the time off shows one day.

By default, when clicking on the New Time Off button, the start and end date should be
the same with a duration of one day.

task-2760487

closes odoo/odoo#87864

X-original-commit: dbc16eac2448df63de6cbdaea81e057cd4d78e8a
Signed-off-by: Kevin Baptiste <kba@odoo.com>
2022-04-04 12:32:19 +02:00
Camille Spiritus db53118099 [IMP] account: display company's total amount in payments when grouping
When looking at the list of the payments and grouping by company, the total amount per company is no longer displayed since v15.

This is due to the fact that the new variable used to represent this data was no longer stored.

By storing this data, we can regain this ability.

task-2801688

closes odoo/odoo#87535

Related: odoo/upgrade#3401
Signed-off-by: Laurent Smet <las@odoo.com>
2022-04-04 12:32:09 +02:00
Fabio Barbero d53da71fe5 [IMP] mail: replace t-esc with t-out
Purpose
=======
Replace t-esc with t-out in email templates layout.

Task-2798501

closes odoo/odoo#86725

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2022-04-04 12:32:06 +02:00
Fabio Barbero 8fee0908d6 [IMP] mail: show footer separator correctly
Purpose
=======
Avoid displaying "|" if there is nothing to separate in footer of email
template for sale order.

Task-2798501

Part-of: odoo/odoo#86725
2022-04-04 12:32:05 +02:00
Kevin Baptiste a7b9b6e309 [FIX] hr_recruitment: fix perf of new_application_count
On large databases, the method `_compute_new_application_count` could
take up to 80% of the total loading time of the Job positions as each
job was generating 2 queries.

closes odoo/odoo#87862

Taskid: 2812400
X-original-commit: 147f6a933f106fea540bd62522b941a855fffda2
Signed-off-by: Kevin Baptiste <kba@odoo.com>
2022-04-04 11:28:15 +02:00
Ipsita Borisagar b80d40c9e1 [FIX] mail: regarding scheduling activity in list view
Open a activity view(record modal), that will show records, clicking on the
'o_activity_btn' of a record will show dropdown and make sure that there are
many scheduled activity there .

Before this commit:

The dropdown was bigger than the record modal which had a scroll bar. It was not
scrollable properly and "+ Schedule Activity" button is not accessible.

After this commit:

The dropdown follows the scroll, and it will be possible to click the button.

Task- 2528111

closes odoo/odoo#87823

X-original-commit: 6436950bae7a8d0e3ec4a6eb83f42a3208a100d4
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2022-04-04 11:28:10 +02:00
Didier (did) a911f6d42d [FIX] mail: add missing checksum convert data
Follow up of send is_main with the attachments.

task-2783076

closes odoo/odoo#87795

X-original-commit: 2eafb395afb0262f2b789e377932ac191db1fdcc
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2022-04-04 11:28:02 +02:00
Victor Feyens 8e6cd12f9d [FIX] sale_management: correctly autocomplete uom on option lines
Fixes a mistake from 0c468f6c2f160dec672bd25c673401b154b2709b where the uom
autocompletion was lost and adds a test to make sure it won't happen again.

closes odoo/odoo#87667

X-original-commit: 10bc8dc114511740d549dfc5261bc244e0a98ad9
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2022-04-04 11:27:58 +02:00
Achraf (abz) 4f79f80e51 [FIX] web: Prevent datetime field from changing when pressing enter
When entering a date in a datetime field, it will be in the format
`08/01/2022 00:00:00`. If we place our cursor at the end of the
entry (after the hour) and each time we press enter, the timezone
offset is applied (so if offset is +1 it does +1 hour each time)

opw-2754116

closes odoo/odoo#87655

X-original-commit: 33e8540d64bb6e21debb7da9a121b706f551ab2e
Signed-off-by: Achraf <abz@odoo.com>
2022-04-04 10:25:26 +02:00
Joseph Caburnay 8f9602c3a1 [IMP] point_of_sale: allow multiple popups at a time
Previously, only one popup is allowed such that when one is not
yet close, but another one is requested, the new one will replace
the old. The function that tries to wait for the replaced popup
will never resolve resulting to some potential broken state.

This commit resolves the said issue which now allows multiple
popups at a time. We can use POS instance without demo as an
example.

Before this commit: The popup that asks whether to load the demo
products will be shown but it will be replaced by the cash opening
popup.

After this commit: The popup that asks whether to load the demo
products will be shown, then the cash opening popup will show.
When the user is done with the cash opening popup, the demo products
confirmation is shown next.

closes odoo/odoo#83661

Related: odoo/enterprise#23859
Signed-off-by: Masereel Pierre <pim@odoo.com>
2022-04-04 10:25:22 +02:00
Philippe Wauthy 6abce995d5 [FIX] hr_holidays_attendance: remove has_valid_allocation from search_count
In hr_holidays_attendance, the model that inherits from res.users adds a request_overtime field.
This field is used to allow the user to request overtime based on the total overtime.
The domain for the time off type includes has_valid_allocation. If the user doesn't have any allocation,
he won't be able to deduct extra hours

task-2701128

closes odoo/odoo#87845

X-original-commit: b6d186d7b46df1e0f4e0af3eb7c8e7b07909a040
Related: odoo/enterprise#25843
Signed-off-by: Kevin Baptiste <kba@odoo.com>
2022-04-04 09:24:59 +02:00
Julien Van Roy 7e48e1398c [FIX] partner_autocomplete: VAT not showing in edit mode
When using the widget res_partner_many2one (e.g. in the customer invoice
form view), the VAT number disappears when being in 'edit' mode.

This is caused by the '_getDisplayNameWithoutVAT' function, which was introduced
in PR https://github.com/odoo/odoo/pull/29189, because the VAT appeared in edit mode
but disappeared when saved at that time.
Since the VAT no longer disappears when saved, we no longer need this function
removing the VAT from the edit mode.

task-2749331

closes odoo/odoo#87843

X-original-commit: 78a5e53a99d9f0f04edf42f1ed8d713fda4de36e
Signed-off-by: Laurent Smet <las@odoo.com>
Signed-off-by: Julien Van Roy <juvr@odoo.com>
2022-04-04 09:24:53 +02:00
Fabio Barbero 82bbafe1cb [IMP] digest: update documentation links
Purpose
=======
Update documentation links for digest in settings menu for saas-15.2.

Task-2800588

closes odoo/odoo#87481

X-original-commit: 35182b23ec7a78bf34c05b82276b176cf60cdd91
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2022-04-04 09:24:46 +02:00
Philippe Wauthy d53051b6de [FIX] hr_holidays: fix holiday with multiple employees
https://github.com/odoo/odoo/pull/86101 introduced a check of the number of days
of the allocation when a time off is taken.

The _compute_from_holiday_status_id method search for allocations based on employee_id.
If a holiday has multiple employees, no allocation will be found and the validation error
message asking to split the request to fit in their number of days will appear

task-2812415

closes odoo/odoo#87818

X-original-commit: 2c4f4e4ec6b6b8a0f5233b589369e4aff70a3ca7
Signed-off-by: Kevin Baptiste <kba@odoo.com>
2022-04-04 08:24:40 +02:00
dbkosky 07a64d5e68 [FIX] l10n_it_edi: demo data bank and partner
Demo data to improve the flow of testing the edi. A bank account and a
partner with a street/city/zipcode/codice fiscale are required for the
edi, so having these as demo data is useful.
The demo company vat code and codice fiscale are also changed to those
of a valid company, so that they will be accepted by the sdi testing
environment. The address of the demo company is updated so that, if by
accident, an invoice is sent using the demo company, through the
official channel, the address will make it an obvious test.

closes odoo/odoo#87835

Task-id: 2809328
X-original-commit: f8da2dbedf948eaf86b92a0ac4ecd90acc811203
Signed-off-by: Josse Colpaert <jco@odoo.com>
Signed-off-by: Daniel Kosky (dako) <dako@odoo.com>
2022-04-02 22:53:47 +02:00
Jeremy Kersten d2b4214409 [FIX] auth_totp: don't redirect to url prefixed with lang
This commit removes the multilang feature on the /web/login/totp controller,
it doesn't really add value since it triggers a redirect and that the page is
all the same translated.

It is a good practice by default for SEO, but in this case it brings
some bug with the IOS apps that doesn't follow the redirect, while we don't
need to optimize this page for Search Engine.

The bug into the IOS apps, create a loop when we request the totp screen.
    Device request /web/login/totp
    Server ask a redirect to /fr_FR/web/login/totp
    Device redirect to /web/login/totp
    Server ask a redirect to /fr_FR/web/login/totp
    ...

closes odoo/odoo#87810

X-original-commit: 4dea1b9b7cf0855095f9cfa37ff6a9a6db7cf55e
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
Signed-off-by: Jérémy Kersten <jke@odoo.com>
2022-04-02 21:10:54 +02:00
wan d4fd9affc7 [FIX] account: clash in resequence
Have 3 moves named 0, 1 and 2
Delete move 1 to make a hole.
Resequence, starting the sequence at 2.

Expected: new names are 2 and 3

Result: an error because 1 is renamed to 2 but 2 still exists, leading
to a (temporary) duplicated name, which is not allowed.

We clear all the names to be resequenced before doing it in order to
avoid that.

closes odoo/odoo#87836

X-original-commit: bf5173f64582e2675f4121122ce26cb57624e08a
Signed-off-by: Quentin De Paoli <qdp@odoo.com>
Signed-off-by: William André (wan) <wan@odoo.com>
2022-04-02 00:54:49 +02:00
Odoo's Mergebot 7655867855 [MERGE] project,*: review project updates side panel
Purpose
=======

The goal is to review the information displayed in the project updates side panel and also completely review the project profitability calculation.
It will try to better cover the use-case of companies working by an offer by project. For instance, one of the companies we are working with maintains and repairs engines. Once they receive the engine from another company, they will evaluate the state of the machine and determine what it would take to repair it (parts to order, parts to produce, workforce etc.). Each engine has its unique requirements. The company has to determine whether it is profitable for them to repair the machine or not.

Before these changes, the side panel of the project updates does not allow that analysis for a two main reasons:

1. There are no details on the allocation of costs, revenues and budget. (What it makes a deal breaker exactly: is it because a part is very hard to find and thus very expensive to purchase? Is it because the worker spent 10 hours on the repair instead of the 2 estimated?)
The only option the user has is to open each stat button individually. This process is tedious and annoying.

2. There is a confusion between the gross and the net margin, and neither of them are a true reflection of the margin the company can expect.
The gross margin only takes into account AALs generated by invoices or vendor bills. This doesn't allow any kind of future estimation because it doesn't take into account sales or purchases that were already made, but not invoiced/billed yet.
The profitability report still provides insights of an unrealized margin, but it is hard to understand where the numbers come from and it doesn't take into account records others than SOs and expenses. It is thus not complete either.

Furthermore, the sold section representation is not perfectly clear, it could be the amount delivered or invoiced compared to the amount that was sold. Finally, the design of the `Total Sold` section is confusing and the information under that section is a bit redundant with the previous one.

## Implementation details

### Review the Sales section

The Sold and total sold sections have been replace Sales one. This new section will displayed all SOLs from SOs linked to the project. Each line will represent:
- the name of the SOL,
- the ordered quantity (`product_uom_qty` field),
- the delivered quantity (`qty_delivered` field),
- the invoiced quantity (`qty_invoiced` field).

The name will be clickable to see either the timesheets linked (if the product is a service) or the stock moves linked if the user has the sales: own documents access right level and he is assigned to the SO, or if he has the sales: all documents access right level.
This section will only visible if the project is billable (=`allow_billable=True`).

### Review the profitability section

In this section, the project profitability report has been removed to search the data in each model related to correctly compute the project profitability and also to get the records impacting the profitability.

This section replaces the `Profitability forecast` one and will be design like 3 tables:

1. a table representing all the revenues found for the project. Each row will correspond to a invoice type with the untaxed amount to invoice, the untaxed amount invoiced and the total amount expected for this section (invoice type). Here if the list of *sections*
   1.1. timesheets (fixed price)
   1.2. timesheets (billed on timesheets)
   1.3. timesheets (billed on milestones)
   1.4. materials
   1.5. expenses (reprensents the reinvoice expenses)
2. a table representing all the costs found for the project. Each row will correspon to a  invoice type with the untaxed amount to bill , the untaxed amount billed and the total expected for this section (= invoice type). Here is the list of *sections*:
   2.1. timesheets (fixed price)
   2.2. timesheets (billed on timesheets)
   2.3. timesheets (billed on milestones)
   2.4. timesheets (non billable)
   2.5. purchase orders
   2.6. manufacturing orders
   2.7. expenses
3. a table representing the margin of the project, 3 totals will be shown:
   3.1. the result of the total revenues amount to invoice **minus** the total costs amount to bill,
   3.2. the result of the total revenues amount invoiced **minus** the total costs amount billed.
   3.3. thee result of the total revenues amount **minus** the total costs amount.

In the 2 first tables, each row name will be clickable only if the user can see the records related in that row, for instance the section 1.1 will be clickable only if the current user has access to the Timesheets app as Timesheet Manager. Moreover, if no data is found for a row then this row will not be shown.

### Additional changes in the right side panel

- remove the following stat buttons: hours recorded, billable time, expenses, manufacturing orders, work orders, gross margin.

--
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr

closes odoo/odoo#87480

Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>
2022-04-01 23:58:52 +02:00
Alexandre Kühn 9a9cd8a199 [IMP] mail: remove outdated Messaging/isQUnitTest field
closes odoo/odoo#87816

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2022-04-01 19:53:40 +02:00
cbc9279eaa [MERGE] im_livechat: introduce chatbot scripts
PURPOSE

This commit introduces a chatbot operator that works based on a user-defined
script with various steps.

SPECS

A im_livechat.chatbot.script can be defined on a livechat rule.
When a end-user reaches a website page that matches the rule, the chat window
opens and the script of the bot starts iterating through its steps.

The chatbot code is currently directly integrated with the existing livechat
Javascript code.
It defines extra conditions and layout elements to be able to automate the
conversation and register user answers.

AVAILABLE STEPS

A script is defined with several steps that can currently be one of the
following types:

"text"

A simple text step where the bot posts a message without expecting an answer
e.g: "Hello! I'm a friendly robot!"

"question_selection"

The bot will ask a question and suggest answers, the end-user will have to
click on the answer he chooses
e.g: "How can I help you?
  -> Create a Ticket
  -> Create a Lead
  -> Speak with a human"

"question_email"

That step will ask the end user's email address (and validate it)
The result is saved on the linked im_livechat.im_livechatchatbot.mail.message

"question_phone"

Same logic as the 'question_email' for a phone number
We don't validate the input this time as it's a complicated process
(requires country, ...)

"forward_operator"

Special type of step that will add a human operator to the conversation when
reached, which stops the script and allow the visitor to discuss with a
real person.

The operator will be chosen among the available operators on the
livechat.channel.

If there is no operator available, the script continues normally which allows
to automate an "answering machine" that will redirect the user in case no
operator is available.

e.g: "I'm sorry, no operator is available right now, please contact us by email
at 'info@company.com', we will try to respond as soon as possible!".
(Or even something more complex with multiple questions / paths).

"free_input_single"

Will ask the visitor for a single line of text.
This text is not saved anywhere else than in the conversation, but it's still
useful when combined with steps that create leads / tickets since those print
the whole conversation into the description.

"free_input_multi"

Same as "free_input_single" but lets the user input multiple lines of text.
The frontend implementation is made by waiting a few seconds (currently 10) for
either the next submitted message or the next character typed into the input.

This lets visitors explain their issue / question with multiple messages.
Which is very useful since new messages are sent every time you press "Enter".

"create_lead"

Special step_type that allows creating a crm.lead when reaching it.
Usually used in addition to 'question_email' and 'question_phone' to create
interesting leads.

LINKS

Task-2030386

closes odoo/odoo#84000

Related: odoo/enterprise#24894
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Co-authored-by: Patrick Hoste <pko@odoo.com>
Co-authored-by: Aurélien Warnon <awa@odoo.com>
2022-04-01 18:49:58 +02:00
Aurélien Warnon 81cf389a15 [IMP] im_livechat: change default chat button background color
This commit adapts the "button_background_color" field default value from a
grey to a purple (the same color as the default header background).

The grey color makes the button look disabled, which is counter intuitive for
visitors as they will think the livechat is not active even though it is.

Task-2030386

Part-of: odoo/odoo#84000
2022-04-01 18:49:57 +02:00
Aurélien WarnonandPatrick Hoste b0991dc110 [IMP] crm_livechat: allow creating leads within the chatbot
PURPOSE

This commits adds a special step_type on the chatbot.script.steps that allows
creating a crm.lead when reaching it.

SPECS

In addition, we let the end user configure in which crm.team that lead will
land upon being created, making it possible to sort your leads based on
previous questions.
e.g: "In which country do you live"
And based on the answer, you assign to a different sales.team.

This commit comes with the necessary business code to make this feature work
as well as some extra testing methods that ensure it is correctly implemented.

Task-2030386

Part-of: odoo/odoo#84000
Co-authored-by: Patrick Hoste <pko@odoo.com>
Co-authored-by: Aurélien Warnon <awa@odoo.com>
2022-04-01 18:49:56 +02:00
Aurélien WarnonandPatrick Hoste ea680d8595 [IMP] im_livechat: introduce chatbot scripts
PURPOSE

This commit introduces a chatbot operator that works based on a user-defined
script with various steps.

SPECS

A im_livechat.chatbot.script can be defined on a livechat rule.
When a end-user reaches a website page that matches the rule, the chat window
opens and the script of the bot starts iterating through its steps.

The chatbot code is currently directly integrated with the existing livechat
Javascript code.
It defines extra conditions and layout elements to be able to automate the
conversation and register user answers.

AVAILABLE STEPS

A script is defined with several steps that can currently be one of the
following types:

"text"

A simple text step where the bot posts a message without expecting an answer
e.g: "Hello! I'm a friendly robot!"

"question_selection"

The bot will ask a question and suggest answers, the end-user will have to
click on the answer he chooses
e.g: "How can I help you?
  -> Create a Ticket
  -> Create a Lead
  -> Speak with a human"

"question_email"

That step will ask the end user's email address (and validate it)
The result is saved on the linked im_livechat.im_livechatchatbot.mail.message

"question_phone"

Same logic as the 'question_email' for a phone number
We don't validate the input this time as it's a complicated process
(requires country, ...)

"forward_operator"

Special type of step that will add a human operator to the conversation when
reached, which stops the script and allow the visitor to discuss with a
real person.

The operator will be chosen among the available operators on the
livechat.channel.

If there is no operator available, the script continues normally which allows
to automate an "answering machine" that will redirect the user in case no
operator is available.

e.g: "I'm sorry, no operator is available right now, please contact us by email
at 'info@company.com', we will try to respond as soon as possible!".
(Or even something more complex with multiple questions / paths).

"free_input_single"

Will ask the visitor for a single line of text.
This text is not saved anywhere else than in the conversation, but it's still
useful when combined with steps that create leads / tickets since those print
the whole conversation into the description.

"free_input_multi"

Same as "free_input_single" but lets the user input multiple lines of text.
The frontend implementation is made by waiting a few seconds (currently 10) for
either the next submitted message or the next character typed into the input.

This lets visitors explain their issue / question with multiple messages.
Which is very useful since new messages are sent every time you press "Enter".

LINKS

Task-2030386

Part-of: odoo/odoo#84000
Co-authored-by: Patrick Hoste <pko@odoo.com>
Co-authored-by: Aurélien Warnon <awa@odoo.com>
2022-04-01 18:49:56 +02:00
Aurélien Warnon de324e682b [IMP] mail: allow opening the chat window when inviting members to a channel
Currently, when inviting members to a mail.channel using the "add_members"
method, it is not possible to signal to web client to automatically open that
conversation in a chat window.

This commit adds a parameter to that method to allow that behavior, and also
slightly adapts the notification handling to open the chat window accordingly
on the web client side.

This is necessary for the upcoming chatbot, where we want to invite operators
to the channel and make them see the new conversation immediately.

Task-2030386

Part-of: odoo/odoo#84000
2022-04-01 18:49:56 +02:00
Aurélien Warnon 89eb064977 [IMP] mail: allow not posting join notifications when adding members
Currently, when adding members to a mail.channel using the add_members method,
we always post notification message on the channel mentioning that someone has
joined the channel / was invited to join by another user.

This commit simply adds a method parameter allowing to disable that behavior.

This change is necessary for the upcoming chatbot, where we want to add members
but handle the join notifications differently.

Task-2030386

Part-of: odoo/odoo#84000
2022-04-01 18:49:56 +02:00
John Laterre (jol) 5d0111d079 [IMP] base: prevent blocking access to commerical fields
Currently, when creating a partner, there could be a situation
in which a commerical field has some access restriction
due to `groups` being set on a the field declaration.

The `sudo()` makes sure it does not happen.

closes odoo/odoo#83205

Related: odoo/enterprise#25828
Signed-off-by: William André (wan) <wan@odoo.com>
2022-04-01 18:49:46 +02:00
John Laterre (jol) ff0275be6b [IMP] account: credit limit by partners
The basic idea of this functionality is for users
to be able to put limits on Partners that would
trigger non-blocking warnings when trying to confirm new:

- Sales Orders
- Invoices

when that partner has too many open invoices.

task-2722165

Part-of: odoo/odoo#83205
2022-04-01 18:49:46 +02:00
Wolfgang Taferner f826718365 [FIX] stock_account: stock inventory garbage adjustments
In case you applied inventory in batch the system would create a lot of useless
stock moves and stock move lines.

closes odoo/odoo#87771

X-original-commit: 07f18f62db490608b316cc9482f228252ed8fc63
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: Wolfgang Taferner <w.taferner@wtioit.at>
2022-04-01 17:57:02 +02:00
roen-odoo 9788447a7a [FIX] web: Avoid showing bootstrap error
Current behavior:
In some particular cases bootstrap was throwing an error "Uncaught Error: Please use show on visible elements"
wich appeared on the users screens.

Steps to reproduce:
- Could only reproduce on copy of clients Db
- Go in CRM and go in any lead
- Create a new activity
- Swap to an activity with less fields
- Then quickly put your mouse on the top of a field that just disappeared
- The "Please use show on visible elements" error appears.

Here's a video where I reproduce it on clients Db : https://watch.screencastify.com/v/gksBwwF0McirZzSFwaAP

opw-2720853

closes odoo/odoo#87770

X-original-commit: 3404c9500fad4004d6d8beef6041ac51439078cd
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Engels Robin (roen) <roen@odoo.com>
2022-04-01 17:56:58 +02:00
Alexandre Kühn 68ef0cd276 [IMP] mail: remove ComposerSuggestionComponent/is getters
Task-2793280

closes odoo/odoo#87735

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2022-04-01 17:56:54 +02:00
thcl-odoo ce0648adce [FIX] mail: take all messages into account on unlink
Current behavior :
When you delete a record (for example project.task), all the messages related
to this record aren't deleted.
This, in case a user has his notifications managed in Odoo, may prevent him
from accessing the History tab in the Discuss app because these messages are
linked to a record that doesn't exist anymore and it will raise a Missing Record
error

Steps :
*with demo data*
- Install Project
- Make Marc Demo notifications managed in Odoo
- Delete a task project to which Marc Demo is assigned
(*with Marc Demo*)
- Go to Discuss and try to access History tab

OPW-2764855

closes odoo/odoo#87732

X-original-commit: ee8feeb73c920827090b1a5ecf78e8b1d21bbae4
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Signed-off-by: Claude Thibault (thcl) <thcl@odoo.com>
2022-04-01 17:56:50 +02:00
Julien Castiaux 814a34c3c9 [FIX] http_routing,website: missing request attribute during install
Steps to reproduce:

1) start from a clean database (http_routing should not be installed).
2) go to the app menu and install project (don't install via `-i`!!).
3) traceback: `request` has not attribute `is_frontend` while rendering
   a template.

The `is_frontend` attribute on request is set by the http_routing
module. At the moment the "install now" button is clicked, http_routing
was not installed so the `is_frontend` attribute was not set.

FF to the end of the installation: the registry is reloaded to include
the modules that have been installed, http_routing among them.

We are in a tricky situation: (1) there is a request, (2) http_routing
is installed and (3) the `is_frontend` attribute is missing from the
request.

This situation is illegal, when http_routing is installed, the
`is_frontend` attribut should always be set. In this work we reset the
missing attributes using sensitive default values via post-init hooks.

closes odoo/odoo#87684

Signed-off-by: Julien Castiaux <juc@odoo.com>
2022-04-01 17:56:45 +02:00
Nicolas (vin) e2b3ec6d5c [IMP] account_*: some Back2Basics improvements
Improve a few things in accounts modules:
    - Users wants to be able to change the account in the general ledger
    list view
    - Do not group by date by default when auditing a tax line.
    - Make the currency fields only show in debug mode for accounts and assets
    - Disallow to delete taxes linked to a tax repartition line, and
    clarify the error message when trying to delete one linked to a
    fiscal position's account mapping

Task id # 2810379
[IMP] account_*: some Back2Basics improvements

Improve a few things in accounts modules:
    - Users wants to be able to change the account in the general ledger
    list view
    - Do not group by date by default when auditing a tax line.
    - Disallow to delete taxes linked to a tax repartition line, and
    clarify the error message when trying to delete one linked to a
    fiscal position's account mapping

Task id # 2810379

closes odoo/odoo#87659

Related: odoo/enterprise#25770
Signed-off-by: Laurent Smet <las@odoo.com>
2022-04-01 17:56:38 +02:00
Florian Charlier f0e1e60528 [IMP] {*_,,}event{,,_sms}: update sms reminder template
* = website

Change the wording of the sms reminder template to make it sound friendlier and
more complete. The sms will include the event address if it is defined.
Otherwise, it will link to the event page if website is installed.

A one line-formatted version of the venue is added to the model to be used in
the template and other places.

This required to update `event_registration.get_date_range_str` to not include
the time when describing an event happening more than a month from the current
date, which makes sense as there is no reason to specify the time only in that
case, and we add the time somewhere else when it's useful anyway.

For consistency, Wembley Stadium is updated to London timezone in the demo
data.

Task-2777183

closes odoo/odoo#85664

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2022-04-01 17:56:24 +02:00
Pierre-Yves Dufays eca543ef40 [REM] mail, sms, snailmail: discard notifications without confirmation
Skip the confirmation step when wanting to get rid of a notification
for emails, sms or letters that were not sent.

Technical:
- All 3 wizards to confirm the discarding of the notification have been removed
(the ones for mail, sms and letter) have been removed
- The method to discard notification has been centralized in MailThread
(notify_cancel_by_type in addons/mail/models/mail_thread.py)
- This centralization has been done as well on the client code as the same
server code is called whether it is a mail, a sms or a letter
(in addons/mail/static/src/models/notification_group/notification_group.js)
- Existing front and back test have been adapted
- A test of notify_cancel_by_type for mail has been added
(addons/test_mail/tests/test_mail_management.py)
- add missing author_id in mail_notification demo data

Task-2752190

closes odoo/odoo#84452

Related: odoo/upgrade#3246
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2022-04-01 17:56:20 +02:00
Florian Charlier e82e12e3a4 [IMP] calendar: improve UI/UX
A reorganization of the calendar alarm form view was necessary for easier
extension with new fields
(such as the one from appointment, see links).

The partner is now the author of notifications about their invitation
(instead of public user).

Task-2709580
See odoo/enterprise#23191

closes odoo/odoo#82387

Related: odoo/upgrade#3383
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2022-04-01 17:56:00 +02:00
Andrea Grazioso (agr-odoo) 1554ffd74d [FIX] point_of_sale: no fiscal position in refund
- Create a fiscal position [FPOS]
- Assign [FPOS] to a customer [DEMO]
- Add [FPOS] to the available fiscal positions of POS
- Open pos session, add a product, select [DEMO], [FPOS] will be
automatically selected. Confirm order and pay
- Click on refund button and select the previous order

[FPOS] will not be automatically selected for the refund order

opw-2799179

closes odoo/odoo#87503

X-original-commit: 4f8e257f2fc8e3d505342f9e1d6cb243a25e83e2
Signed-off-by: Masereel Pierre <pim@odoo.com>
Signed-off-by: Grazioso Andrea (agr) <agr@odoo.com>
2022-04-01 16:48:08 +02:00
Xavier BOL (xbo) e26bdb3282 [IMP] project,*: sort the row displayed in profitability section
Before this commit, the order of rows shown in costs and revenues is not
fixed and depends on the order of the modules.

This commit adds a sequence on each row and then sort the rows to fix
the order of those rows.

task-2710808
2022-04-01 15:33:00 +02:00
Xavier BOL (xbo) 88d94c852a [IMP] sale_timesheet: add billable_{milestones,manual} in timesheet_invoice_type 2022-04-01 15:33:00 +02:00