With the new views, we mainly focused on making them work. But we also
need to be able to handle unusual cases, such as some RPC failing. An
example of such a problem was the following:
- a form view with a one2many with an onchange
- edit mode, change a field in the one2many, click elsewhere
- the onchange triggers, calls the server
- it may happen that the server fails with a ValidationError
- the onchange deferred fails, the line in the one2many is restored to
the value known by the list renderer, which is the previous value (but
the new value was applied to the model)
- we now have a 'corrupted' state: clicking on save will send the
invalid value, even though the UI displays the previous one.
We solve this problem in this commit by making sure that the onchange
deferred returned by the _performOnchange always succeed (or stays
pending). If the rpc fails, the deferred will succeed with an empty
dictionary. This means that the list renderer will be updated with the
value from the model.
Note that it may not be intuitive that a failure in the onchange is not
seen as an error from the perspective of the _performOnChange, but I
think that it still makes sense:
- the validation/network errors are not really a concern of the UI. The
UI just display the values entered by the user.
- if an onchange fails (for example, because of a coding error), we do
not really want to prevent the user from working.
Also, when the onchange is performed, the initial change was already
applied to the local data. Rollbacking them would be a more difficult
task.
Note that we also improve the mock server in this commit, to allow
mocking failures.
The session get_file method should return the value from the
ajax.get_file method, otherwise we lose information (this is necessary
to be able to react properly to the fact that the download was blocked)
Before this commit:
Multiple widgets for the same field on the same view (V11.0 settings) would not
retrieve the correct label but all of them.
Now:
We now retrieve the correct label instead of all of them
Before this commit, a portal user would land on /web after login in with oauth.
He would then just see the "Website" app.
He should then click on it to land on website instead of landing directly on it
after login in, which is not convenient, especially since theses users doesn't
know Odoo (in case of sale customers manually created for instance).
Now, if users has no 'base.group_user' right, it will be redirected to the
website directly instead of /web.
We had an interesting bug with the field many2many_checkbox: in some
cases, it could cause a crash, because it could not find an element in the
localdata.
To reproduce this, start with a non empty field many2many checkbox, then
uncheck them twice.
The reason is that the datapoint of type 'list' that represents the
current value is actually modified, and the replace_with operation
assumed that it could find the localID by looking into its data. I have
the feeling that a more complete fix is to make sure that the datapoint
is not modified (in its 'data' key), but is modified in its '_changes'
key. However, this would probably be a bigger change.
- Create a tax included of 21 %
- Create a product sold 7.00, set the 21 % tax
- Add the product in a SO
Amount w/o tax: 5.79
Amount tax: 1.22
Total: 7.01
We defer the base rounding to the end of the method so that the rounding
doesn't impact the tax computation of included taxes.
Complement of 6e46ba7b46
opw-777221
This use case was not correctly managed as the function evaluating if the
value has changed compares datetime and date.
This triggered an issue if the widget `date` was set on the field `date_order`
on a purchase order for example ; it was not possible to create a record as
the datapoint was set `dirty`.
This rev. ensures that a `field_changed` is not triggered if the day is the same
on a date widget.
This rev. also adds support of `datetime` fields on date widget, which appears
to be a valid use case.
Fixes https://github.com/odoo/odoo/issues/20311
Before this commit, the image was directly built without using the corresponding
template, which set some properties on the image (class, width, etc.).
- Create a product attribute, e.g. 'Recommanded Age'
- Create several values for this attribute
- Try to associate more than attribute value to the same variant =>
contraint which prevents to do it
We should allow this use case as long as the product attribute doesn't
create a variant.
opw-776344
- Activate multi-company, create companies A and B
- Set 2 companies on a user
When a message is sent (for example, thanks to the chatter), the
notification email always contains the logo of the same company,
whatever the company of the user or the company of the object.
This is a complement of commit 7a03f9ce93, applied to notifications.
Closes#20088
opw-772405
Before this commit, when on a mail.template form, click on the Preview smart button.
A wizard popped up with two buttons, as the default for form views.
First this made no sense since the wizard doesn't represent a model that can be modified
Second, the button discard was unable to close the wizard.
After this commit, only a discard button is present which does its job.
Before this commit, Sale order and invoice notification email templates broke when doing any action on them (duplicating, open preview etc...)
This is because the model is saved during those operation, and the css style gets converted to inline style.
The table tag present in those templates, was wrongly associated with the bootstrap rule for tables, collapsing their border, hence the break of the templates.
After this commit, we force the borders not to collapse, and the templates don't break
OPW 774323
This is a hotfix/hack for a conflict between website_sale and
website_quote, on the field website_description.
The conflict happens when both modules are installed.
Fixes#20118
Completes rev 333a236
- There was no feedback to the user when executing the Charge
transaction in server-to-server mode, while it could take several
seconds, with the normal UI/action buttons still available.
- Stripe integration was almost working along with `website_quote`
payment, but entirely broken with `website_payment`, and partially
broken with `website_sale`.
Fixing it required:
+ More leniency in processing optional transaction parameters, which
may or may not be present in the various payment flows.
+ It also required more precautions when locating the transaction for
which the Stripe Charge was to be created, which passed in different
manners in the session. The route now supports an explicit `tx_id`
to allow forcing the transaction without risk of mixing different
payment flows.
+ FIXME: There is still some amount of duplication and bad modularity
in the handling of the various payment flows in relation with
Stripe.
- We provided very little metadata to the Customer and Charge APIs of
Stripe. We now pass more names and references to make Stripe payments
easier to manage in the Stripe dashboard.
- In some cases, selecting Stripe as payment method caused a second
inclusion of `stripe.js`, raising a JS error because of the
duplication.
- Strip whitespace in emails: the Stripe API raises an error for
transactions done with invalid emails, including with
leading/trailing whitespace.
Customers will have a hard time figuring out the problem
by themselves, so we should at least strip whitespaces.
When double-clicking on a link/button, the link dialog is opened. The
problem was that the "btn" class is sometimes used on non-link elements.
While this should not be, the editor can easily be adapted to this.
When a user clicks on an input or a select field
in Safari on IOS, Safari has a behavior of zooming-in
on the field when the keyboard opens.
Even after the user dismisses the keyboard, the screen
still stays zoomed-in. The user has to then zoom out manually.
Now, the user is not allow to zoom-in at all.
This is already the case with the Android application.
We now have the same behavior between the two apps.
As can be seen in https://github.com/scottjehl/Device-Bugs/issues/8 a
combination of "-webkit-overflow-scrolling:touch", "position:relative"
and "overflow:auto" can have unexpected behavior on iOS.
The issue solved here is that writing in a form view inside a modal in
iOS (at least version 10.3) would make the whole form body invisible
until edition is ended.
This commit fixes this by adding a CSS rule which avoid the iOS bug.
opw-774396
closes#20314
We have problems when trying to validate our EU VAT report because some vat number are wrongly encoded in Odoo.
There are 2 problems:
1) We use vatnumber library to check the validity of the VAT number entered by the user on website.
That library removes the following characters '.' and '-' in order to perform the check and
thus can return True for a number like 123.123.123.13 or -123-3454-34
And those VAT number are then saved in our database but are rejected by the state
as VAT number should only contains alphanumeric character
-> Solution: prevent entering vat number with other characters than alphanumeric for users that are located in EUROPE!
2) Usually VAT is prefixed by country code, however some people in europe managed to bypass the system
by prefixing their VAT number with CC instead of their country code, CC is consider valid in odoo
(it means Country Code) but is not a valid European country code in general, which means that those
people that should have pay some tax have not. Which is a huge problem.
-> Solution: prevent the use of CC as country code by the user when entering a vatnumber only if the user country is in EUROPE!
source: https://en.wikipedia.org/wiki/VAT_identification_number
opw:772621
FIX: amount_currency can allow negative searches
IMP: can search on positive or negative amount only if use '-' or '+'
IMP: search for move lines based on the amount by clicking on the balance
amount. Search in 2 currencies if possible.
Display the 'money' icon in the balance amount line when the user is in
multi-currencies and there is a currency different from the one used in
current line.
issue: in the 'match' part of a reconciliation line, if the user uses the
search without any line as result and validate the selected proposition,
the line is removed but the account or partner reconciliation is maybe
not finished.
A bug happens when you enter a number with more than 2 decimal
if you unfocus/focus the field it will truncate it.
This commit change the decimal precision and use the same digits
than other fields used in stock.
opw-775791
When we generate commands for many2many, it could happen that the id was
in the list of changed fields (when we are in a new records, with a non
empty initial onchange). When this happens, the server is not happy.
To reproduce this, open the uninstall wizard of a module in the 'App'
application. This creates a new record with a non-empty many2many
field. Then click on 'Show technical modules', this will trigger an
onchange which should not send the id field.
Fine tuning of 1108c150d9
When setting a pricelist to show the public price discount, it ignored
the pricelist item's base field (if not 'Other Pricelist') and set it
by default on the lst_price instead.
This did not work when you based your discount on the standard_price
(= cost price) with public price discount.
Now it does.
opw:775275
- Create a vendor bill with a line linked to an asset category
- Validate the bill => an asset is created
- Refund the bill
The refund is also linked to an asset category. Therefore, upon
validation, a negative asset will be created.
The refund should not be linked to the asset category in a first place.
The user should cancel/modify the asset manually.
opw-775933
Commit aab6bdd54a was incorrectly forward-ported to
10.0 at abb726d4df . Indeed share users could land
to a wrong backend or frontend page depending on the target app due to an
indentation issue.