Consider the following setting:
- on model A, field F is computed, stored, and depends on field G
- on model A, field one2many G to model B, with inverse field H
- on model B, field many2one H is inherited (_inherits) from model C
- on model C, field many2one H is stored
When adding records of model B, the field F must be recomputed. In order to
determine which records to recompute, one searches model A with a domain like
[(G, 'in', ids)]. In expression.py, this is resolved with an SQL query like
select H from B where id in {ids}
This query fails, since the field H is not stored in model B. This happens in
general if H is not stored (it may be any computed field). In that case, one
should instead browse records from B, and read field H through the ORM.
A test case has been added: it introduces a many2one field in a parent model,
and a one2many field using the inherited many2one on a child model. The test
checks whether one can search on the one2many field.
The `check` decorator expects the context to be in the `kwargs`
or to be the last arguments of the method.
The `call_kw` route, which is decorated by the `check` decorator,
like every route,
expands its kwargs arguments.
Therefore, once in the `check` decorator,
the context is located in the `kwargs` key
of the kwargs.
(More simply, instead of
`kwargs.get('context', {})`
it's
`kwargs.get('kwargs', {}).get('context', {})`
As the context is not retrieved correctly,
the lang is not set correctly either,
and the sql constraints were not translated.
In 7.0, it worked, because there was a double
check, as the call_kw was called trough an rpc
(`dispatch_rpc`) call,
which was decorated by the `check` as well.
As a fix for 8.0, we apply the same logic,
we perform a double check, with an indirection.
The check decorator should probably be
refactored, but this cannot be done
in a stable release such as 8.0.
Closes#3634
To compute start and end date of a working interval this function replaced
hour in datetime object without taking into account the time zone. The start and end date
taking respectively from calendar_working_day.hour_from and calendar_working_day.hour_to are
in the time zone of the user and the datetime object are compared in UTC to avoid schedule's gap.
This is why the start and end must be converted in UTC after being replaced by these hours.
The tz_info must be removed from dates because it's forbidden to compare naive and aware dates.
opw:648349
With 3e82c94d we use the timezone in the context to format date
sequences when formatting an ir.sequence.
This commit adds the other missing context when getting a sequence, so
these sequences are also dependant on the timezone.
closes#8351
opw-646487
The total used to check which delivery.grid.line to apply must be in
the currency of the company because the delivery.grid.line records with
variable == Price are expressed in the currency of the company.
opw:647799
When creating timesheet,
default from-date and to-date are adjusted for user timezone.
Fixes#3627
User timezone considered when assigning attendance records to timesheet
Fixes#3628Closes#3632
Written in the new API even though the rest is in the old API, because otherwise we'd have to add an onchange in the views which may be a problem for existing custom modules.
We want this behavior because previously, in some cases the default values were only added at create() time, ie. possibily when the users close the pop-up, so they may never have an opportunity to see and adjust the default.
This rev. is related to 1c533b193f
The reason why we force the event Google internal id is
explained in the above commit.
Forcing the internal id must be done only when creating the
event in Google, not when updating, for retro-compatibility:
if the event is already in the attendee calendar, with a different
internal id then the other attendee, we must leave it like this,
otherwise Google will be lost.
This rev. is related to a9e3d74713
This new revision is about the same use case than above, except
that both Google users login doesn't match the Odoo login email.
e.g.
User A: A@agrolait.com in Odoo, A@gmail.com in Google
User B: B@agrolait.com in Odoo, B@gmail.com in Google.
When A creates an event, with B in the attendees, and
syncs his calendar to Google, B is not automatically invited
Google side, as his attendee email is B@agrolait.com, which
doesn't match any existing Google User (doesn't match B@gmail.com)
While the revision mentioned above, a9e3d74713,
expected the attendee to be automatically invited Google side, and therefore
expected the event to already exists in B's calendar.
Therefore, when B syncs his calendar in Odoo, as the event
was there in his Odoo calendar, but not in his Google Calendar,
the code actually think it's no - longer - there, and take the assumption
the event has been deleted Google side. So, it deletes the event
in Odoo side as well, for both users A & B.
To overcome this new issue, when the Google & Odoo users emails
do not match, while keeping the compatibility when the Google & Odoo
emails do match (and therefore the invitation is automatically sent
Google side, as the email matches an existing Google account, and
the event is automatically created in B's calendar without needing the
sync in Odoo), we now force the Google internal id to be the same
for all attendees of an event, event by Google side.
opw-645745
Confirm lines of account cash statement on closing
The `account_bank_statement_extensions` adds
a state field to account.bank.statement.line
and sets the status to 'confirm'
when a bank statement is closed.
When a cash statement is closed,
the lines remained in draft.
Closes#3584
The risk was introduced by b7f1b9c.
IF _store_set_values() recall another _create() or _write(),
the recomputation mechanism enter in an infinite recursion
trying to reevaluate for each call exactly the same fields
for the same records than the previous one
This revision replaces the loop of _store_set_values()
by 2 nested loops:
- that not breaks the entire consumption
of recompute_old queue
(Tested thanks to revision a922d39),
- that allows to clear the queue
before each recomputations bundle fixing thereby the recursion
Closes#7558
`hr_timesheet_invoice.py` overrides `on_change_account_id`
of model `hr.analytic.timesheet`.
The super call wasn't done, probably because this on_change
method in the base model was trivial:
`return {'value':{}}`
Nevertheless, if another module overrides this on_change,
according to the module dependences,
this method could have been called first in the calling chain,
discarding the changes from the other overriden
`on_change_account_id` methods, preventing
any customization in this on_change according to the
current database state.
Closes#8248
When we export a recurring event, there was an error since there is
virtual ids (like '{real_id}-{date_of_the_event}').
Events steming from a recurring events are in fact shown virtually. In
the database there is really only one event and a suffix is appended to
the id to target a given instance of a recurring event.
If we want to separate a recurring event from the instances, we can edit
the instance and use the link "Update only this instance", once done
this instance is separated for the recurring event.
This commit if one or more recurring events instances are selected when
an export is done, will only export one source event of each of the
events occurences.
fixes#7932closes#8262
opw-647676
Regarding _schedule_days, similar thing was done in
saas-6, @ fd5e7f2.
When the argument `days` was negative, the
returned intervals were wrong.
Regarding `get_working_intervals_of_day`,
calling this method without
`default_interval` and calendar
set crashed.
Closes#8208
Escape the currency symbol to prevent javascript errors,
for instance when reconciling a bank statement
(with the special reconciliation widget)
Closes#8216
Escape text nodes changed via the web editor before sending the content
it to the server controller.
It is done since the content is unescaped one time when being displayed,
and it is not done for inline style and script tags (which may be
injected by dropping a snippet) since that would break them.
replacing the solution in cdb900044.
When clicking on the button "Refresh Challenge" in the "gamification.challenge"
view form, all the "gamification.goal" records linked to this challenge must
be updated.
opw:647983
In bank statement reconciliation, when selecting an other partner(with the pencil),
the possible invoices to reconcile must be suggested.
opw:647210, 647885
On a first edition of a view list editable, scrolling before the first
edition might cause an issue: the editing fields are higher than they
should.
This commit solves this.
This issue stems from jQuery .offset({value}) function which is broken
if the element we want to position:
- is in absolute postionning,
- is inside a scrolled element in non static positionning,
- has not both top and left css property setted,
- has no ancestor element between itself and the scrolled not in static
positionning.
This issue happens less (and probably not at all) in saas-6 since the
last condition is most often not met thanks to this change:
https://github.com/odoo/odoo/commit/1ccd87a#diff-27c072074221456684bfc5f150ca0bc9R876
This issue of jquery is solved since jquery 3.0.0-alpha1:
https://github.com/jquery/jquery/commit/2d71594
( the issue is shown in https://jsfiddle.net/wpjrnggf/ and we can see it
is solved with jQuery 3.0.0-alpha1 https://jsfiddle.net/L6ykpjgy/ )
closes#8251
opw-647622
In the case of a signup with token, the user login
already exists, and changing of login (email) is
therefore not allowed.
It's the same behavior than in the reset password
view (`auth_signup.reset_password`)
opw-648125