Setting the value of a one2many field (`rec.line_ids = ...`) converts the new
recordset to a list of commands, and passes it to `write`.
Currently the list of commands is like: `[(5,), (0, 0, vals), (1, id, vals), (4, id), ...]`.
Notice that the command `(5,)` is inappropriate here: it deletes all the
existing lines of the record. Reintroducing the same lines with `(4, id)`
commands crashes, because the corresponding `id` is no longer in database.
The fix serializes the recordset as a list of commands like
`[(6, 0, ids), (0, 0, vals), (1, id, vals), ...]`.
Only the lines that are not kept will be deleted in this case.
When we are trying to set the quantity on a mobile device, we get
a traceback saying that we cannot call the 'find' function on the
elements returned by '_get_records'.
This '_get_records' function returns a 'Collection' when called on a tree
view and an 'Array' when called on a kanban view. When we are working
on a mobile device, most of the one2many are displayed as kanban.
The thing is when we work with the object returned by '_get_records' we
call a 'find' method on it, which is implemented by Odoo's Collection class.
So when we call 'find' on an 'Array' we actually call 'Array.prototype.find' which
is implemented on most desktop browser and on some mobile browser [1]. This is what
caused the traceback on Chrome in Android.
To fix this issue, we enforce '_get_records' to always return an 'Array' and we ensure
that, when working on this 'Array', we use '_.find'.
[1] https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/find
In the frontend customer quote validation,
the company used in the sentence
```
I agree that by signing this proposal,
I accept it on the behalf of
```
was the quotation company, which is the company
which is selling, not the company/customer which is buying,
and this does not make any sense.
Instead, it should use the company of the customer
accepting the sales order, or simply the customer
if he does not have a company set.
The only case which make it a little weird is when
it's the customer himself, without parent company,
who is accepting the quote
"on the behalf of himself", but:
- This isn't possible to correct this without
breaking the translations, because the
sentence "I accept it on the behalf on"
is within the same sentence than
"I agree that by signing this proposal"
- This makes sense if another person than the
customer himself is validating the order
(the customer sent the quote link with the token
to another person).
opw-690837
Current issue without this patch:
On a bare database, install `website_portal` and go to `/my/home` logged out.
You get to an empty page where you can see Public User's details.
Expected behavior with this patch:
User should be redirected to the login page.
Additional notes:
- Other submodules (`website_portal_sale` and `website_project_issue`) were
actually implementing this, so that is removed BTW and relies in base
module's now sensible behavior.
This commit closes#12775
With this commit, it's now possible to set an arbitrary limit on any
kanban view by adding a limit attribut to the root kanban tag in a
kanban definition.
Do not forward-port.
Backport of rev 8a87c382ba
- Activate the receipt in two steps on the warehouse
- Create a PO for a stockable product
- Receive the product in Input zone
- Receive the product in Stock
- Reverse the move to Stock > products are back in Input
- Reverse the move to Input
You can't reserve quantities for this last move (from Input to Vendor).
This is because a picking has been automatically created from the Input
to Stock.
Original move which is reversed: Input -> Stock
When we reverse it, we don't want to send it back to Stock, so we need
to check the destination location of the original move, not its
location.
opw-689206
In the widget, the value of reference field is a pair `[val1, val2]`.
When the field is blank, its value is `[false,false]`, thus checking `[false,false] === false`
never succeeds, and this breaks the check for required fields.
This is done by guarding the `on_hashchange` evant handler with the
`clear_uncommitted_changes` function.
Note that the url has already changed when we are in this handler, so we
make sure to restore the old url when the user chose to continue its
edition.
When creating a SO line and an invoice line for a downpayment,
the fiscal position set on the SO must be taken into account
to map the right taxes.
opw:688611
when extending these methods with the new api, the context is a frozendict
so we need to copy before mutating.
this patch was made by searching for key addition to context and calls to the
update() method on the 8.0 addons, and checking if a copy was made before in
the method.
Using the read method should generally pass a single id as a list
due to the new API inheritance of the read method. If an attempt
is made to use the new API, the result is inconsistent.
Following 4f0ca6d9Closes#13678
The validation_date was using the creation_date value in the follwing scenario:
1. create a new order with a few lines (creation_date=t1)
2. reload the page, `init_from_JSON` uses validation_date=t1
3. validate the order at t2, ignored due to already stored value
creation_date must be kept for tracablity reasons (e.g. pos_blackbox_be)
Fixes https://www.odoo.com/groups/59/20542134
The field in stock configuration group_stock_adv_location is toggling
the group "stock.group_adv_location". There was a typo which was using
on the form view of purchase.requisition the group
"stock.group_stock_adv_location" instead.
opw-690804
Most people install the im_livechat module and expect it
to be enabled automatically on their website.
When it doesn't work they try to use the integration JS
code and add it to their website layout, which does not
work as expected.
Setting it as auto-installed solves the issue.
* Failing test for one2many [(5,)] action, when domain is callable.
The problem is that `self` inside a callable domain becomes the comodel when at [(5,)].
* [FIX][fields] Make [(5,)] with computed domain work.
To reproduce this failure, declare a field like:
```
child_ids = fields.One2many(
comodel_name="other.model",
domain=lambda self: [("id", "in", self._ids_to_find())],
)
```
Now set some value to it.
Now unset them. Impossible because ``self`` becomes ``other.model`` in domain evaluation.
Web client use fields_get (which one call get_description) to know if
a group operator exists. But until now, group_operator are never returned.
Without it, the web client cannot display the sub-total except for sum
(the fallback in the web client).
This commit closes#13713
Todo: do the same on Class Monetary in next branch
According to the documentation it makes sens to map an excluded tax
with an included tax. For example in Belgium, B2C taxes are generaly
included and B2B taxes are excluded. Then we can manage this situation
by creating a pricelist with prices for B2B and B2C.
opw:688085
When an analytic account is specified on a write-off move, it should be
written on the move line linked to the write-off account, as it was the
case in v8.
opw-688635
When importing an action rule, an error occurs:
- The import is committed when the user clicks on "Validate"
- The import fails with a traceback when the user clicks on "Import"
This is because commit 7d648542 introduces a `cr.commit()` in the
`_update_registry`, while nothing should be committed upon import
validation.
opw-683874
The field bank_statement_id was removed at c04065a
The rule is no longer working and we have no link between a cashbox and a bank
statement anymore.
Fixes#13550
On old apple devices (IPad 2, IPhone 4, ...), the FAQ Roller could not
be opened on click. This is because the snippet does not use standard
bootstrap correctly and put the toggle on a <div/> element instead of
a <a/> element.
This fix forces an empty click handler on these <div/>, which allows
standard bootstrap to work.
These data should be in no update. Else at next update, it can change the configuration
of the production.
This commit closes#13404
Courtesy of @bealdav
Since Chrome 53.0.2785, the input select is hover the existing tag.
With this fix, the existing tag are displayed at the right side of
the input to create a new one.
This commit closes#13655
Courtesy of @8cells
When a user registers for an event on the front-end, the confirmation of
the associated SO will also confirm the registration. However, if a SO
is created manually and a ticket event is added to it, the confirmation
of the SO will not trigger the confirmation of the registration.
In the second case, the registration simply doesn't exist yet at
confirmation and is created by the method `default_get` of
`registration.editor`.
We make sure to confirm these registration when we make the final
reservation.
opw-688665
An issue occurs in the following situation:
- Define a currency exchange rate at day 1 and day 2
- Create an invoice at day 1, and calculate the taxes. Do not set an
invoice date!
- Validate the invoice at day 2
The exchange rate for taxes is the rate at day 1, while the exchange
rate for other amounts is the rate at day 2.
There is actually no way to know what was the rate applied for the
taxes at invoice validation. There are two solutions:
- recompute the taxes at validation
- force the user to set an invoice date and recompute manually the
taxes
The first solution might have unexpected effects, therefore the second
solution is applied.
Fixes#13473
opw-688517