Before this rev., it crashed when trying to create records of the
res.users model. This is due to commit ad1cceb.
The 'default_get' of 'res.users' always returns a value for field
'groups_id', whereas the docstring of 'default_get' states that it
only returns default values for fields given in arguments.
Rev. ad1cceb changed a bit the way the result of 'default_get' was
processed, by iterating over the values instead of over the fields
in the view. So, before ad1cceb, 'groups_id' was simply ignored,
and after, the BasicModel tried to process it and it crashed when it
attempted to retrieve its fieldsInfo, as this field isn't in the
view.
This rev. restores the previous behavior.
Fixes#23303Fixes#23305
Purpose of this commit is to simplify a bit message_post API. It has
a content_subtype parameter allowing to receive plaintext content.
It is then automatically converted into html.
This commit removes the parameter and consider the content is always
html. Code calling message_post should handle the conversion. In Odoo
the only use was in the chat_post controller that now perform the
plaintext to html conversion before calling message_post.
This commit is purely technical and does not hold any functional change.
Purpose is to clean code in order to prepare future changes in mail
application.
Posting on users is not supported anymore. It was implemented in a time
we thought having a twitter-like behavior in Odoo was a good idea.
Posting on users was redirected on its related partner in mail. It was
redirected on its related employee in hr. It does not make sense anymore
as employee are records with limited access and partners used for other
purpose than discussing notably in accounting.
Now that we have chat channels it makes no sense to have this kind of
behavior still implemented. Let us remove it. No functional change
should occur with this commit.
Propagation was not correctly done at 8a026e26c6 . This commit
ensures all parameters are passed to sub-calls when redirection is done
in message_post.
Before this commit, doAction returns a deferred that is
resolved when the action is performed (the exact moment
depends of the type of the action).
However, the deferred was not resolved with the action.
This is misleading, hence a traceback in the web_client
when clicking on 'Run JS Tests' in debug mode (enterprise):
after doAction, the web_client should hide the home_menu
depending on the type of the action.
With this commit, any doAction returns a deferred that is
resolved with the performed action.
When uploading an image as attachment, the document viewer doesn't
support the EXIF data. Therefore, a picture taken with a non-zero angle
will not appear with the right orientation (preview or full-size image).
Unfortunately, supporting EXIF data is not trivial in Python or
JavaScript without external libraries. Therefore, we add a rotate button
which allows the user to rotate the image by 90°. Moreover, we add the
`image-orientation: from-image` CSS property, which is only supported by
Firefox.
opw-1814407
Let's assume a one2many displayed over several pages with a default
order such that a record, say R, that would normally be on page 1
is actually on another page. Moreover, there is an onchange on that
one2many which converts all commands 4 (LINK_TO) into commands 1
(UPDATE), which is standard in the ORM.
When the first line of the one2many was edited, the record R was
fully loaded, whereas it shouldn't have been (as it is not on the
current page). So basically, a useless read was performed.
Moreover, if there was an x2many field in the one2many list, a
crash occurred because relational data of R that shouldn't have
been read wasn't postprocessed by the BasicModel.
The useless read occurred because the one2many subrecords weren't
correctly sorted before checking if some of them/some of their
fields should be read. This is not the case anymore.
OPW-1816800
A customer can pay an order with a non-cash journal (e.g. a credit
card through a stand-alone terminal).
When this order has to be refunded later it should be possible to do
so on that same journal.
Some code prevented this from happening, notably a check in
order_is_valid which explicitly prevented this for an unknown
reason. There is no explanation in the
commit (4647f896a4) introducing that.
This commit allows the following:
1. input what you want to refund with a negative qty
2. click 'Payment'
3. click the Credit Card (type Bank) journal
4. (amount is auto-populated)
5. click 'Validate'
opw-805302
Commit a42c27f99e0061b7c4f recently fixed some bugs on sale_coupon.
This commit add some tests to be sure theses bugs are fixed and won't appear
again.
This closes#1744
Commit a42c27f99e0061b7c4f recently fixed some bugs on sale_coupon.
This commit add some tests to be sure theses bugs are fixed and won't appear
again.
This closes#1744
Commit a42c27f99e0061b7c4f recently fixed some bugs on sale_coupon.
This commit add some tests to be sure theses bugs are fixed and won't appear
again.
This closes#1744
Some use cases were wrong, this commit attempt to fix those.
Here is the most important ones:
1. Discount was offered on free product 'value' aswell
Cart: 4 iPad Mini + one free offered + 10% discount
| qty | unit value | line total |
----------------------------------------------------
iPad Mini | 4 | 320 | 1280 |
- 10% discount| 1 | 128 | 128 |
= 1152
- free product| 1 | 320 | 320 |
= 832
Should be
| qty | unit value | line total |
----------------------------------------------------
iPad Mini | 4 | 320 | 1280 |
- free product| 1 | 320 | 320 |
= 960
- 10% discount| 1 | 96 | 96 |
= 864
The error result is $32 which is the 10% discount applied on the free iPad.
2. Decreasing product quantity below the minimum threshold to be elligible for
the promotion doesn't remove the product
- (With a promotion offering a free iPad when you buy 3 (fourth is free))
- Create a quotation with 3 iPads Mini, save and update promotions, you don't
have a free one, which is 'correct'
- Edit, change the quantity to 4 iPads, save, update promotions, you have a
free iPad (reduced from total), still correct
- Edit, change the quantity back to 3 ipad, update ptomotions, you still have
a free iPad even if you only bought 3 of them (the way it is designed, the
free iPad should only appears when you order your fourth).
The error result in a 'loss' of $320 since at the end we are offering a free
iPad and the user only pays 2 instead of 3.
3. Free product will be considered as regular product when updating quantity
of regular product afterward
This error is kind of exponential: the more you play with the flow explained
bellow, the more incorrect it becomes.
Buy 100 iPads, get 25 free iPads.
Then set quantity (on regular iPad) to 50, it will recalculate the amount of
free iPad thinking the 25 previous free iPads are regular iPad.
(50 + 25) = 75 regular iPads = 18 free iPads (25 previous free iPads were
wrongly used for the calculation but they are simply gone at this point).
Cart is now 50 regular iPads and 18 free one, total: $10240 (50×320 - 18×320).
It should be 12 free iPads, not 18, so $12160 (50×320 − 12×320)
The error result in a loss of $1920: ~ 20% of the total amount of the order.
This error will also appear the other way around if you add quantity instead of
removing some.
Playing with this error multiple times, you can arrive to a negative total
(more free than paid products), 0 total or very low total ($320 for 100 iPads).
4. Free product are wrongly calculated, user get too many of them
- Create a quotation with 10 iPads, you get 3 free iPads instead of 2
- Indeed, your first 4 iPads should give you a free one
- Your next 4 iPads should give you a second one (you got 8)
- The last 2 (to reach 10) are not enough to give you a third free iPad
The error result in a loss of $320 out of a total of 2560$ which is ~ 15%
5. Paid/regular products related to a promotion won't be taken into account
when checking if you have the minimum amount threshold to apply the promotion
Promotion: 3 Computer Case(25$) = 1 Free Little Server (40.000$), auto applied
-Have a cart with 3 'Computer Case' and 2 'Little Server'
-One little server of the 2 is free (because you have 3 computer cases)
-You so pay 3x25 + 1x40000 which is 40075$
-Create a promo code that will give you 10% discount if you bought over $2000
-You won't get the reduction even if you bought over $40.000 because the
little server you pay is considered as the product of the reward product
even if you dont have it free. It doesn't check how many regular product
should be substracted according to the number of free product you have
6. Wrong product is checked for the required quantity to apply the promotion
Promotion: 3 iPads Mini ($320) = 1 free Bose Mini Bluetooth Speaker ($247)
- Add 8 iPads Mini and a Bose Mini Bluetooth Speaker to your cart
- The system should give you a free Bose Mini Bluetooth Speaker since you
only have one regular Bose
- But the system is giving you 2 free Bose Mini Bluetooth Speaker
Cart is: 8 iPad ($2560), 1 Bose ($247), 2 free Bose (-$496)
The system think that it should give you 2 free Bose because you are eligible
to, since you have 8 iPad, but it doesn't check that you have enough regular
Bose.
The error result in a loss of $247 out of a total of $2311
7. Auto applying promotion are not applied if there is already a promotion code
Promotion:
- Free iPad Mini if you buy 3 (so the fourth become free), auto applied
- 10% discount with code '10pc'
- Add 4 iPads Mini, you got a free one
- Set quantity back to 1 iPad, free one is gone
- Add code 10pc, you got a 10% reduction line
- Set quantity to 4 iPads again, you dont have the free iPad since there is
already a promo code
This could make sense but it is not coherent since the 2 promotions would be
applied if they were both on auto apply mode.
Note:
- If both promotions are on auto apply, you will get both
- If 10% discount becomes auto applied and iPad promotion now has a code
(reverse situation) it will work
8. Discount is only applied on untaxed amount, not on tax
Discount will ONLY be calculated on the untaxed amount and then reduced from
the sale order/cart total.
The taxes would be unchanged and charged like the product was full price.
Let's illustrate with a $100 product, a 15% tax and a 20% discount:
1. Tax included:
$100 : Product with 15% included taxes
$86.96 : Untaxed product
$13.04 : Taxes
After aplying 20% discount, result should be:
$80 : Product with 15% included taxes
$69.57 : Untaxed product
$10.43 : Taxes
Instead we have:
$82.61 : Product with 15% included taxes
$69.57 : Untaxed product
$13.04 : Taxes
There is a difference of $2.61 which is the result of the taxes not being
discounted: 13.04-10.43 = 2.61
2. Tax excluded:
$115 : Product with 15% excluded taxes
$100 : Untaxed product
$15 : Taxes
After aplying 20% discount, result should be:
$92 : Product with 15% included taxes
$80 : Untaxed product
$12 : Taxes
Instead we have:
$95 : Product with 15% included taxes
$80 : Untaxed product
$15 : Taxes
There is a difference of $3 which is the result of the taxes not being
discounted: 15-12 = 3
9. Taxes of the free shipping reward would be considered as paid value when
checking if required threshold is met.
------------------------------------------
Not really a bug, more an improvement:
1. The way it was designed, the rule_minimum_amount would check if your order
amount was over the required threshold to be eligible for the reward.
'Problem' is that it your order has already a discount (eg: 10%), it would
check if the price without discount is above the required amount.
I don't think it is coherent, let's illustrate:
- First pomotion (auto applied): 1 iPad Mini for free if you buy over $2000
- Second promotion (auto applied): 50% on order
If an user is buying for $2000, he is actually paying $1000 thanks to the 50%
discount.
Should we give him the free iPad?
The current implementation is giving it, which is not convenient IMHO.
Now, we use the amount the user really pay to check if he is elligible.
2. Since new promotions have the same sequence by default, they will be sorted
and applied by their creation order. This will result in inconsistent behavior:
- Promotion 1 : 10% discount
- Promotion 2 : free shipping
- Both promotion are auto applied and need a minimum of $872.73 tax excluded
Let's illustrate with a $873 order:
If the promotions were created in the order above, you won't get both rewards
since the 10% discount will be applied first and will lower the SO total.
The order will then fall below the $872.73 required amount and won't be
eligible for the free shipping.
But if you created the free shipping promotion before the discount one, you
will be eligible for both since the free shipping will be applied first and
won't change the SO total.
To keep the same behavior independently of the promotion creation order, we now
sort by reward_type ('discount' > 'free_shipping' > 'product' to apply
discounts first.
This is better IMHO, since you want to give promotions with a minimum threshold
ONLY if the user really pays that amount. It wouldn't be the case if the total
is checked before the discount is applied.
Some use cases were wrong, this commit attempt to fix those.
Here is the most important ones:
1. Discount was offered on free product 'value' aswell
Cart: 4 iPad Mini + one free offered + 10% discount
| qty | unit value | line total |
----------------------------------------------------
iPad Mini | 4 | 320 | 1280 |
- 10% discount| 1 | 128 | 128 |
= 1152
- free product| 1 | 320 | 320 |
= 832
Should be
| qty | unit value | line total |
----------------------------------------------------
iPad Mini | 4 | 320 | 1280 |
- free product| 1 | 320 | 320 |
= 960
- 10% discount| 1 | 96 | 96 |
= 864
The error result is $32 which is the 10% discount applied on the free iPad.
2. Decreasing product quantity below the minimum threshold to be elligible for
the promotion doesn't remove the product
- (With a promotion offering a free iPad when you buy 3 (fourth is free))
- Create a quotation with 3 iPads Mini, save and update promotions, you don't
have a free one, which is 'correct'
- Edit, change the quantity to 4 iPads, save, update promotions, you have a
free iPad (reduced from total), still correct
- Edit, change the quantity back to 3 ipad, update ptomotions, you still have
a free iPad even if you only bought 3 of them (the way it is designed, the
free iPad should only appears when you order your fourth).
The error result in a 'loss' of $320 since at the end we are offering a free
iPad and the user only pays 2 instead of 3.
3. Free product will be considered as regular product when updating quantity
of regular product afterward
This error is kind of exponential: the more you play with the flow explained
bellow, the more incorrect it becomes.
Buy 100 iPads, get 25 free iPads.
Then set quantity (on regular iPad) to 50, it will recalculate the amount of
free iPad thinking the 25 previous free iPads are regular iPad.
(50 + 25) = 75 regular iPads = 18 free iPads (25 previous free iPads were
wrongly used for the calculation but they are simply gone at this point).
Cart is now 50 regular iPads and 18 free one, total: $10240 (50×320 - 18×320).
It should be 12 free iPads, not 18, so $12160 (50×320 − 12×320)
The error result in a loss of $1920: ~ 20% of the total amount of the order.
This error will also appear the other way around if you add quantity instead of
removing some.
Playing with this error multiple times, you can arrive to a negative total
(more free than paid products), 0 total or very low total ($320 for 100 iPads).
4. Free product are wrongly calculated, user get too many of them
- Create a quotation with 10 iPads, you get 3 free iPads instead of 2
- Indeed, your first 4 iPads should give you a free one
- Your next 4 iPads should give you a second one (you got 8)
- The last 2 (to reach 10) are not enough to give you a third free iPad
The error result in a loss of $320 out of a total of 2560$ which is ~ 15%
5. Paid/regular products related to a promotion won't be taken into account
when checking if you have the minimum amount threshold to apply the promotion
Promotion: 3 Computer Case(25$) = 1 Free Little Server (40.000$), auto applied
-Have a cart with 3 'Computer Case' and 2 'Little Server'
-One little server of the 2 is free (because you have 3 computer cases)
-You so pay 3x25 + 1x40000 which is 40075$
-Create a promo code that will give you 10% discount if you bought over $2000
-You won't get the reduction even if you bought over $40.000 because the
little server you pay is considered as the product of the reward product
even if you dont have it free. It doesn't check how many regular product
should be substracted according to the number of free product you have
6. Wrong product is checked for the required quantity to apply the promotion
Promotion: 3 iPads Mini ($320) = 1 free Bose Mini Bluetooth Speaker ($247)
- Add 8 iPads Mini and a Bose Mini Bluetooth Speaker to your cart
- The system should give you a free Bose Mini Bluetooth Speaker since you
only have one regular Bose
- But the system is giving you 2 free Bose Mini Bluetooth Speaker
Cart is: 8 iPad ($2560), 1 Bose ($247), 2 free Bose (-$496)
The system think that it should give you 2 free Bose because you are eligible
to, since you have 8 iPad, but it doesn't check that you have enough regular
Bose.
The error result in a loss of $247 out of a total of $2311
7. Auto applying promotion are not applied if there is already a promotion code
Promotion:
- Free iPad Mini if you buy 3 (so the fourth become free), auto applied
- 10% discount with code '10pc'
- Add 4 iPads Mini, you got a free one
- Set quantity back to 1 iPad, free one is gone
- Add code 10pc, you got a 10% reduction line
- Set quantity to 4 iPads again, you dont have the free iPad since there is
already a promo code
This could make sense but it is not coherent since the 2 promotions would be
applied if they were both on auto apply mode.
Note:
- If both promotions are on auto apply, you will get both
- If 10% discount becomes auto applied and iPad promotion now has a code
(reverse situation) it will work
8. Discount is only applied on untaxed amount, not on tax
Discount will ONLY be calculated on the untaxed amount and then reduced from
the sale order/cart total.
The taxes would be unchanged and charged like the product was full price.
Let's illustrate with a $100 product, a 15% tax and a 20% discount:
1. Tax included:
$100 : Product with 15% included taxes
$86.96 : Untaxed product
$13.04 : Taxes
After aplying 20% discount, result should be:
$80 : Product with 15% included taxes
$69.57 : Untaxed product
$10.43 : Taxes
Instead we have:
$82.61 : Product with 15% included taxes
$69.57 : Untaxed product
$13.04 : Taxes
There is a difference of $2.61 which is the result of the taxes not being
discounted: 13.04-10.43 = 2.61
2. Tax excluded:
$115 : Product with 15% excluded taxes
$100 : Untaxed product
$15 : Taxes
After aplying 20% discount, result should be:
$92 : Product with 15% included taxes
$80 : Untaxed product
$12 : Taxes
Instead we have:
$95 : Product with 15% included taxes
$80 : Untaxed product
$15 : Taxes
There is a difference of $3 which is the result of the taxes not being
discounted: 15-12 = 3
9. Taxes of the free shipping reward would be considered as paid value when
checking if required threshold is met.
------------------------------------------
Not really a bug, more an improvement:
1. The way it was designed, the rule_minimum_amount would check if your order
amount was over the required threshold to be eligible for the reward.
'Problem' is that it your order has already a discount (eg: 10%), it would
check if the price without discount is above the required amount.
I don't think it is coherent, let's illustrate:
- First pomotion (auto applied): 1 iPad Mini for free if you buy over $2000
- Second promotion (auto applied): 50% on order
If an user is buying for $2000, he is actually paying $1000 thanks to the 50%
discount.
Should we give him the free iPad?
The current implementation is giving it, which is not convenient IMHO.
Now, we use the amount the user really pay to check if he is elligible.
2. Since new promotions have the same sequence by default, they will be sorted
and applied by their creation order. This will result in inconsistent behavior:
- Promotion 1 : 10% discount
- Promotion 2 : free shipping
- Both promotion are auto applied and need a minimum of $872.73 tax excluded
Let's illustrate with a $873 order:
If the promotions were created in the order above, you won't get both rewards
since the 10% discount will be applied first and will lower the SO total.
The order will then fall below the $872.73 required amount and won't be
eligible for the free shipping.
But if you created the free shipping promotion before the discount one, you
will be eligible for both since the free shipping will be applied first and
won't change the SO total.
To keep the same behavior independently of the promotion creation order, we now
sort by reward_type ('discount' > 'free_shipping' > 'product' to apply
discounts first.
This is better IMHO, since you want to give promotions with a minimum threshold
ONLY if the user really pays that amount. It wouldn't be the case if the total
is checked before the discount is applied.
For the tests on coupon on enterprise, there is a need of a new class to wait
search results to be loaded, or it would click on the /shop product instead of
waiting, resulting in a conccurent update error.
This closes#22263
For objects inherting from rating.mixin, when their parent model change
(e.i.: task from a project to another), the "Parent document name" does
not change. The rating is still considered belonging to the old parent
object (rating stat of project is not correct).
Change the rating API. In rating mixin, instead of having 2 methods
returning parent id and parent model (rating_get_parent_id and
rating_get_parent_model_name), we should have one method returning the
'parent relation field' (inevitably m2o field). Then we can deduce its
parent_res_id/parent_res_model, and check this parent field is in values
of write to trigger the recompute of parent_res_name.
Also, add "ondelete=cascade" on parent_res_model_id
Impacted modules: project, rating, helpdesk, livechat
It shouldn't happen, but if we change the name of multiple rating_mixin
inheriting models, we can run into an error, because write doesn't
support multiple values.
* Install sale_management, contacts
* Uninstall sale (not sale_management)
* Try to access any partner via contacts
-> BOOM, traceback: relation account_invoice_report does not exist
For some reason, uninstalling `sale` drops the SQL view for
account.invoice.report which in turn means that anything that requires
the view will break, this was the case for accessing the res_partner
form view.
Fixes#23270 by forcing account.invoice.report.init() upon
uninstallation of the `sale` module.
Purpose
=======
The warrant cost formulae has been modified at 5d22170.
Instead of using the (remaining) warrant costs formulae, use the corresponding field instead.
Strangelly, this worked in 9.0 as the `this` element refers to the
`window` which also contains the `$` function. This may still be
wrong in some cases though, so it is fixed here (even if reported for
10.0).
opw-(1)817789
When only point_of sale module is installed, it is impossible to modify
existing taxes because the One2many tags widget doesn't allow to open the
taxes and edit them. So we add a menu item allowing to modify them.
It is needed if we want to set a tax included in the price.
Before this commit, when stroking "Enter" in the filter, a JS traceback popped, because no created lines where found
After this commit, we control that we have created lines
OPW 1814309
If the vacuum finds that there is nothing to do regarding the accounting
entries, do not call `_account_entry_move`, else an accounting entry
will be created for the entire cost of the compensated move.
opw-1817372
Remove wrong slash trailing
Now, in V11, matching of page are done on the exact name.
Previously, the error was transparent because we was using a
dedicated controller that allow trailing slash.
https://github.com/odoo/odoo/blob/11.0/odoo/http.py#L936https://webmasters.googleblog.com/2010/04/to-slash-or-not-to-slash.htmlhttp://example.com/foo/ (with trailing slash, conventionally a directory)
http://example.com/foo (without trailing slash, conventionally a file)
Google treats each URL above separately (and equally) regardless of
whether it’s a file or a directory, or it contains a trailing slash or
it doesn’t contain a trailing slash.
Different content on / and no-/ URLs okay for Google, often less ideal for users
Special case for homepage
Rest assured that for your root URL specifically,
http://example.com is equivalent to
http://example.com/ and can’t be redirected even if you’re Chuck Norris.
Before this commit, the sitemap will crash if you have some res.partner
without country that are publish and with an assigned_partner_id.
Now, we only search for customer with country that are set and avoid to have
a traceback:
File "/home/odoo/src/odoo/11.0/addons/website_customer/controllers/main.py", line 31, in sitemap_industry
loc = '/customers/country/%s' % slug(country['country_id'])
File "/home/odoo/src/odoo/11.0/addons/http_routing/models/ir_http.py", line 91, in slug
identifier, name = value
TypeError: 'bool' object is not iterable
The field `auth_signup_uninvited` is defined in the 3 aforementioned
modules, yet they are independant modules in respects to one another.
This means that whichever module is installed first will create an XMLID
for the field, if this module is uninstalled before the other two: boom!
crash when changing general settings because the res.config.settings
field set by the other two modules no longer exists.
To solve this, we simply ignore the field during ir_model_field.unlink()
Fixes#23171
Let's assume a one2many list view inside a form view, displaying
a single char field A. There is an onchange on the form view
returning a command 0 (CREATE) for the one2many. The command 0 only
specifies a value for field A. The one2many list isn't editable, so
when a sub-record is clicked, it is open in a form view (in a
dialog). In this form view, an x2many field B is displayed in a sub
list or kanban view.
Before this rev., it crashed when the user tried to open the
created one2many sub-record (returned by the onchange) in the form
view, because of the presence of the x2many field B, which wasn't
correctly processed by the BasicModel (its value was undefined,
whereas it must be a valid, empty, dataPoint).
Moreover, the limit of the x2many field B wasn't set, so a pager
was displayed as soon as it contained at least one record.
Fixes#22050
Due to the representation of floats, it may happen that the amounts in
the project overview appear with much more decimals than expected.
We use the usual `monetary` widget to render the amounts.
opw-1814843
Error messages are given by vendor and have specific meaning
Translating it does not specifally help to find out more about the problem
pos_mecury is intended for US market anyway
If you duplicate a channel the UUID should not
be copied, otherwise it might introduce security
issues and the method 'channel_minimize' will
fail with an "expected singleton error".
Closes#23102