This function should return a deferred, as indicated in the
docstring. However, in some cases, it doesn't. It then crashed
as the FieldX2Many tries to call done() on undefined.
This happens for instance on the customer invoice form view:
create a new record, select a partner, add a line, select a
product, directly click on the invoice date field (this will
trigger an onchange which will totally override the value of the
one2many). The FielX2Many calls setRowMode to switch the edited
row back to readonly, but this row doesn't exist anymore as the
one2many value has been overriden by the onchange, so setRowMode
wrongly returns nothing, and it crashes.
Suppose that a default_get returns the value [[6, 0, [1]] for an
x2many field (i.e. put id 1 in the relation). A read is performed
to fetch record of the comodel whose id is 1. Suppose that there
is another x2many field of the comodel. This x2many has to be
fetched (if not empty), and processed by the BasicModel (i.e. a
dataPoint must be created for it) as well.
Before this rev., the second x2many wasn't fetched nor processed,
and it produced a traceback for example in Expenses app, when
clicking on 'Submit to manager' from an expense form view.
For now, these tests do not work with another CoA than the generic one.
Depending on your testing infrastructure, they may or may not pass.
We skip then invalid CoA's and plan to make them work in master.
On the 6 June, the rate from EUR to USD change
in demo data. This cause problem in test, when
comparing amount.
We choose to not used currency rate defined in
demo data and that are time-dependent.
The import_module() method does not need to be public,
so let's mark it private. It's not called by anyone
except import_zipfile().
After 76cd8d2558 it would
fail anyway because addons_path would not be prepared by
import_zipfile().
Before this fix, if the start field is readonly, the user could not create
an event. With this commit, it is also ensured that the context sends the
right default values to the view
In case of a MemoryError, there is no error message, the user gets a
"Database restore error: "
without any details.
Instead fallback to the repr.
This way, a wrong password is
"Database restore error: Access denied"
and a memoryerror
"Database restore error: MemoryError()"
Closes#17393
On a pricelist, if multiple rules were set with the same
set of rules condition, the choice of which rule/item
is used was random, according to the postgres database
state.
Adding the `id` in the order force to always use the same
rule/item (the first that was created).
opw-744865
with the new views, we removed the many2many_kanban widget on many2manys, since it is the default behaviour anyway, but we also removed it for a few one2manys. And this is a mistake, some one2manys have to behave like many2manys.
(PR #17190)
- Create an excluded tax of 20 %
- Create a customer invoice of 1000
- Create a payment of 900
- Make the matching between the invoice and the payment:
Write-off of 83.33, with the 20 % tax
Error: 'Cannot create unbalanced journal entry'
After commit 89cbef8540, the tax are by default not created
automatically anymore. We should make sure to pass the context key
`apply_taxes`.
opw-744266
When disabling the customer portal
in the general settings
(or uninstalling the `portal_sale` module directly),
the model `sale.order` no longer has a method
`get_signup_url`, and it therefore leads
to the fail of the email template rendering which is
still referencing this method.
Besides, the `access_url` is actually used only if
`is_online` is True,
(see the `% if is_online:` few lines later)
and in this case `get_signup_url`
was not used at all.
Therefore, we can assume `None` is a good alternative,
as the resul of `get_signup_url` was actually no longer
used.
opw-710481
If you have two invoices with a same product,
- one having 1 unit of a product,
- the other -1 unit of a product,
The sum of these quantities will be 0, and it will lead
to a division by zero in the former sql request.
The nullif should be applied on the sum, not on the line quantity.
opw-745073
This try except block was added in another era, where the piece of code
in the block was far less ambitious (and not for good reason since
adding a try except block because of a malformed mail template seems
overkill).
Even worse, this block actually prevented errors from bubbling, which
could have adverse effects.
Example: a long transaction confirmation (several seconds since it
implies S2S communication, invoice creating/validation, etc.) is
rollbacked because a mail message is recorded on the quote during
the processing time. The quote confirmation then crashes because of a
concurrent update error in postgres. This try except block does not
re-raise the error, which means that instead of retrying the operation
like the ORM would normally do, we have an incomplete traceback in the
system (since the error message crashes itself) and the transaction is
not validated (as far fetched as it may seem, this is in fact how this
bug was discovered).
This try-except block offers no gain in error logging (on the contrary,
since we have lost the initial error-causing statement) and prevent the
orm from correctly managing errors.
This commit removes it and let the orm handle the errors like a grown up
man; either crash for real (because it should crash to know if there's a
problem) or retry the transaction if it's a serialization issue.
opw-744629
The attribute filters based on all products matching current domain was limited
to the first page of result only.
If all the products of the current page had no variant, no filter was displayed.
Closes#17361
Previously, when an update operation was performed, the list of
ids in the x2many field was emptied beforehand.
It kinda worked in lots of cases where one would expect it to
fail because in thoses cases the widgets send link_to commands
along with the update one, thus re-adding the removed line.
Now the behavior is more consistent accross the board. We start
with the current list of ids and apply the requested changes.
When the user zooms with the browser, the bottom left pads are
misaligned for some zoom levels.
By slightly reducing the width of the action pad, this can be solved for
all acceptable zoom levels.
opw-745074
Use the field `time_cycle` for cost computation, which takes into
account the routing configuration (fixed time of computed based on
previous operations).
- Create a work center with a capacity of 1, an efficiency factor of
100% and a cost per hour of 40$
- Create a routing with two operations: one with a fixed duration of
30:00 minutes (OP1) and another with a duration computed on real time
but with a default of 30:00 minutes (OP2)
- Create a component with UOM "m" and a cost of 10$
- Create a finished product with an associated BoM
- The BoM has a first line with 0.8m of component in the OP1 and a
second line with 0.4m of component in the OP2
- Activate the Compute from BoM option on the finished product
- The proposed cost is 32$
Expected cost: 52$
(30 minutes @40$/hour + 30 minutes @40$/hour + 1,2m @10$/m)
We divide the WC cost by the number of operations, which does not make
sense.
opw-741032
An archived forum could still be posted in, something better should be
done in the next version (eg. website published present on a lot of
record type) but as of 10.0 just this improvement is done.
opw-745510
closes#17365
Otherwise some changes can create rpc errors that are silently caught
and never seen as long as, out of (un)luck, the end result is the same.
Tests which need to create a server error can just simulate it using
the mockRPC mechanism.
When the user writes something in a Many2One input, after a short
delay, a name_search RPC is done with the value written in the
input, and results are displayed in a dropdown. Then, if the user
clicks on the input, the dropdown closes. If he clicks again, it
should do again a name_search RPC with the value of the input.
Before this rev., it was doing it with the empty string.
Suppose that we have a many2one which is set (has a value) in
a form view. Before this rev., if the user unset the value (by
erasing the input content in edit mode), and then reset the same
value, the input remained empty, and the old value wasn't actually
reset.
Problem occured with checkboxes in editable lists: when pressing
up, down, right or left with the focus on a checkbox, in addition
to navigating in the requested direction in the list, the page
scrolled (if there was a scrollbar of course). This was because the
event wasn't 'preventDefaulted'.
Fixed some issues with parralax image updates:
- Background updated without clicking
- Default wallpaper not coming back
- Background disappearring sometimes
In carousel snippet, the target element for background snippet option is
being changed manually. So for the new target, we have to rebind the
associated events that were bound in `start` function of the snippet
option. For that, some code is extracted from the `start` function and
is used to rebind necessary events for new targets.
In particular, this was preventing the carousel slides' backgrounds to
be automatically removed when a background-color was selected.
The context is not in the kwargs when the integrity error is raised from
a rpc request. So the user lang was lost and the sql error message was not
translated.
The part treating the callable message in sql error is depracated.
opw:743259
Portal users do not have access on invoices or invoice lines. However when
viewing an online quotation in website_portal_sale some computation is
performed based on invoices and invoice lines. We therefore iterate on
invoice and invoice lines as superuser as we do not want to grant any
additional access on those models for portal users.