Since 12.0, we wanted the employee to select directly the sales order on which
the expense should be reinvoiced. The goal was to avoid employee to select the
analytic account (too technical and usually unknown for employee). Problem is
that we had to give read access to SO to simple employee, breaking the access
rules "See your own document".
As we want to allow all internal employees to determine if the expense should
be reinvoice and on which sales order it should be, we need to allow them to
select that sales order.
This commit allows user to search on SO (simply get their name_get), no information
more to avoid breaking "See your own document" for salesman. Falty ir.rule and
access rights are now removed.
We now clearly split the cost tracking and reinvoicing flow:
- the analytic account field (visible only with group 'analytic' as considered
as advance feature) allows user to track their expenses in some accounts.
- the sales order is displayed for users or approvers to reinvoice the expense.
As this operation implies the tracking, if the AA is not give, the SO will create
its own AA in which the expense will be tracked.
This SO field is only relevant when the product has a reinvoice policy, so we hide
it if there is no reinvoice policy defined.
Reinvoicing an expense has now a different flow from reinvoicing a "Vendor Bill",
which still do magic to determine the SO from the AA set on its lines.
Technical:
to allow user to select SO from a m2o dropdown, the `name_search` is done in `sudo`
for internal user. This is a borderline 'feature' of the system. A few thing show
that the system does completely supports this ("Search More" gives access error, ...).
We still keep this solution, as we don't want a sub group giving access to SO to all
employee (aka an option allowing people to break the sales rights).
Task-1843241
This commit makes the override of the `name_search` more
consistent the basic implementation of the ORM (using lazy
name_get and supports the `name_get_uid` parameters)
Task-1911581
This commit adds a missing `depends` on the `debit` and `credit` computed
field on analytic account model. Indeed, without that, the recompute is not
done when accessing thoses fields after adding lines in the same
transaction (like in tests).
Task-1911581
For historical reason (problably the inheritS between project and AA, removed in 12.0), portal
user can read Analytic Account. This makes no sense, as it is a purely internal resource
for companies. Removing the access rights don't change anything for portal user and make
those data secure.
Task-1911581
This version adds full support of string templates.
Before this version, rjsmin may produce wrong code with string
templates. For example:
```js
const url = `https://odoo.com`;
console.log(url);
```
was minified to:
```js
const url=`https:console.log(url);
```
Because `//` was wrongly handled as a comment inside the string
template.
closesodoo/odoo#35867
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
The user can already send a confirmation email when the
Stock Picking is done. It'd be great to communicate the
same information by SMS.
In addition, the current mailing tool requires a manual
action. The idea is to automate the process via a
Setting instead.
id=1972567
closesodoo/odoo#35662
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
When you are creating an invoice from the POS, the report route is
called to download the invoice, since changes made in rev: 118190f3b3
The values for ids where empty, so we give them now the correct id list.
closesodoo/odoo#35889
Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
_compute_is_mto was based on the sequence of the routes,
as most of those sequences were hardcoded, some had the same values,
resulting in wrong calculations. Furthermore, the method was setting the so lines
as mto if the sequence of the MTO route had the priority on the other ones, even if
the mto route wasn't set on the product.
This simply ensure to check the mto route is set on the product,
sequences should be set manually to prevent any sequence conflict.
TaskID: 2053703
closesodoo/odoo#35740
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
As it is is trying to write the journal type field everytime we try to
create a account.bank.statement record, even when the value we try to
write is the same already, it is assigned again in the journal.
With this new change we are not trying to overwrite the journal's type
field anymore. Only using it.
Closes#35578closesodoo/odoo#35714
Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
Each model of the relation can define `ondelete` for its `column2` foreign key.
This way the behavior is similar to m2o where the target of the `ondelete` is
the `comodel` foreign key.
Some models were already defining `ondelete` 'restrict' on m2m fields and after
review it appears the behavior introduced in this commit is the expected
behavior for them.
The 'restrict' from product.product has to be removed however because the rest
of the code needs adaptation now that it is properly restricted. These changes
will be done on a separate PR.
closesodoo/odoo#35654
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
- no default reason (otherwise the invoice ref is repeated twice)
- rewording of refund types and helper texts
- avoid 'Reversal of: INV/2019/001, False' as reference -_-
When you try to find a carrier in the wizard that let you add one on
your sale order, you don't see all of them because of a domain that only
show the ones that havethe same company id of the sale order, but it
should also show you the ones that don't have company_id set.
So we removed the domain in the view, and the invisible company_id as it
is not used anymore. Because the domain we need is already applied in
'available_carrier_ids'.
This behavior has been introduced in rev: c058562d73closesodoo/odoo#35856
Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
task-1973902
+ use of img locally
+ last PO review:
+ show latest in the list
+ remove underline
+ force same height if blog or not
+ ...
closesodoo/odoo#34609
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
In case of large cart and promotion program with a discount reward
of percentage type, we are rewriting the reward order lines
multiple times while we can do all in one update.
opw-2038791
closesodoo/enterprise#5086
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
X-port/Cherry-pick of odoo/enterprise@243e66663a
UTM fields are available in the invoice without sale_crm. That's why just apply
search_read on account.move instead of doing
--> search on sale order
--> map on invoice_ids which is computed
--> search_read on account.invoice.report
to get sale_invoiced_amount.
Currently, stat button 'Invoiced' is not redirecting to invoices tree
view because of wrong action and domain parameters. Thus we, set proper
action and pass valid parameter to get that invoices tree view.
Task 1919391
closesodoo/odoo#35296
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Purpose
=======
It happens a lot that we access to the employee timezone to compute
presence states, leaves, ...
Instead of sudoing all those accesses, it looks better to expose this
data in the public profile.
closesodoo/odoo#35811
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Create two models, `object` and `category`. The object have a Many2One
to the category. Override the `search` on the category so it returns a
subset of the records if a context key is present. Create an IR Rule on
object with the following pseudo-domain: `categ_id in category.search([])`.
Search on object with the context key present. Even if the context
should only be applied to category, it is applied to object too thus
there are some object missing.
When evaluating the domain of IR Rules, the current user is propagated
with the current environment context. API calls triggered by the domain
are called with the given context, possibly populating the cache with
different records than it would normally does without the context (i.e.
at `addons/point_of_sale/models/account_journal.py#L19-L23`). Following
requests do use that invalid cache thus return invalid results.
Forcing an empty context on the user used during the evaluation of the
context ensures the IR Rules are working as they should and is
future-proof (cf `load_company` v13 context key)
opw-2041667
closes#35123closes#35125closesodoo/odoo#35667
Signed-off-by: Julien Castiaux <Julien00859@users.noreply.github.com>
Co-authored-by: Hugo Adan <hugo@vauxoo.com>
When accessing a SO's tasks from Contacts (the partner_id's page), and
calling action_view_task, the active_id first corresponds to the contact's id.
Therefore, if a project.project exists with the contact's id, one can access
the SO's tasks, but otherwise, we get the error
Record does not exist or has been deleted.
(Records: [partner_id], User: ...)
Thus, if there is one corresponding project, we first update the context:
active_ids is set to project_id,
allowing access to the SO's corresponding project's tasks.
Note that the same thing is done lower:
eval_context.update({'active_id': task_projects.id})
which is too late to avoid trying to access the wrong record.
In the case where there are more than 1 corresponding projects (or if
there are no corresponding tasks), we don't have the issue.
OPW 2052559
closesodoo/odoo#35792
Signed-off-by: Nans Lefebvre (len) <len@odoo.com>
In some cases, the first request of a test is made before the
proper setting of the cookie. In that case, Odoo picks a new session,
leaving the request unauthenticated.
closesodoo/odoo#35780
Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
- Take a quizz survey, and fail it
- Go to Answers
- Print the Certification
Even if the quizz was failed, the certification can be printed.
There is no option to prevent printing a PDF, therefore we need to print
a different template.
opw-2049481
closesodoo/odoo#35769
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
- Create Event (Where All Day is Set to False)
- Edit Event > Check 'All Day', make it 'Recurrent'
An error occurs because a mandatory field is not set (`stop_date`).
It is possible to work around the issue by doing:
- Check 'All Day'
- Save
- Make it 'Recurrent'
However, the result should not depend on the order we perform the
action. To solve this we send data to server with `force_save`.
Fixes#27269Closes#33068closesodoo/odoo#35758
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>