The default `compute_sudo=True` makes sense for recomputing stored
fields that are indirectly related to a business operation. This
ensures that the recomputation of the field does not break an operation
that is not aware of the fields to recompute.
However, computing non-stored fields in superuser mode is usually not
necessary. It even leads to unexpected values: counting a partner's
sales orders does not give the same result in superuser mode as in
normal mode. That is why non-stored fields are not computed in
superuser mode by default.
[FIX] account, delivery, event, hr_recruitment, point_of_sale, stock:
adapt the model definition to make all fields with the same compute
method have the same value for `compute_sudo`.
[FIX] sale: split the computation of `invoice_ids`, `invoice_count`
(non-stored) and `invoice_status` (stored), as no code is actually
shared.
closesodoo/odoo#39195
X-original-commit: 843fd38a97f02b49dc09d7f55919072d272fd80e
Signed-off-by: Olivier Dony (odo) <odo@openerp.com>
As this wizard only shows the first product overprocessed and does nothing else,
we remove it completely for cleaning purposes.
task-1938108
closesodoo/odoo#39161
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
All transit locations were set as active by default, confusing some users.
There are now set as active only when when a ressuply route is created
between some warehouses
TaskID: 1873106
Immediate transfers only fill the quantity done of stock moves/stock move lines
Those transfer are thus not taken into account for the forecast computation if they
are not validated. Indeed, the stock quant are not yet updated and the initial demand
is left blank.
This commit duplicate the quantity done of immediate transfer on their initial demand
this quantity is still hidden in the view but can now enter in the forecast quantity.
closesodoo/odoo#38169
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
- Go to Inventory > Configuration > Warehouse Management > Routes >
Make To Order
- Edit
- Swap two rules with the handles
- Save
An access error is raised.
This is due to the recomputation of `route_sequence` which is performed
on all companies.
Setting it as `compute_sudo` solves the problem.
opw-2072159
closesodoo/odoo#38104
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Usecase:
- Create a route without company
- Create a push rule for company B from intercompany to stock
- Apply the push rule on product and set in on a product.
- Connect with a user in company A
- Create a move from stock(company A) to intercompany.
- Confirm the move
-> The receipt for company B is not created.
Multiple issues:
- The rule is not found because it belong to the other company and is
filtered by the record rules. -> Aplly the seach as sudo if the move
is going to a location without company.
- Record rule error because a move from intercompany to company B is
created with a user from company A that has no access to company A.
-> Search and read company values and create the move as super user.
Based on work from Simon Lejeune <sle@odoo.com>
closesodoo/odoo#38124
X-original-commit: a80262e8b97256cac4bc5c406bc74a05f7189a00
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
Some companies may have several locations with usage == 'inventory' and they would like to choose each time which adjustment location to use.
closesodoo/odoo#37022
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
This reverts commit 3431d7b1cd.
Due to recent changes in the orm, editing a draft move crashes. We
revert this commit while we find a proper fix.
closesodoo/odoo#37752
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
Sets `date_done` and `state` fields as readonly in the model as they
must not be editable in the list view and they were already readonly
in form view.
Task #2078163
Makes the picking view list multi-editable, and some readonly conditions
was moved form the view to in the model (for the `backorder_id`, `name`,
`scheduled_date` fields).
Task #2078163
rev[0] writes the qty done on the move lines directly in put_in_pack,
meaning hitting discard in the delivery wizard left the move lines with
a changed qty_done. We fix that by editing the quantities in
_put_in_pack in the stock module and getting the right move lines in the
delivery modules: meaning, get the normal or suggested ones (a fix
missed by rev[1]) then with quantities or 0 quantities.
[0] e03c1a836f
[1] f6d88a2e8dclosesodoo/odoo#37563
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
On the product form view, the forcast stat button should open
the Graph view by default and not the grid one
closesodoo/odoo#37501
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
When the user do not set a company on a route and check warehouse selectable
then it's impossible to select a warehouse. It happens due to the
check_company domain ['|', ('company_id', '=', company_id)('company_id','=',False)]
closesodoo/odoo#37404
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
- Go to Inventory > Reporting > Inventory Valuation
- Run the report
- In the search view, filter on 'Location' or 'Warehouse'
The filter doesn't work.
Actually, the filter can't work. This is a hack introduced in order to
add context keys.
Originally, the function `search` was added to avoid the error log
'Non-stored field %s cannot be searched.'. This happens because the web
client adds the field in the domain on top of adding the context key. By
using `filter_domain`, no domain is added and no error is logged.
opw-2075456
closesodoo/odoo#37347
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
on a picking, move_ids_without_package is a subset of move_lines.
The inverse function on move_ids_without_package only work well when we
add a move.
This commit improves the inverse function to take deletion into account
closesodoo/odoo#36558
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
— Create a new product, it's tracking must be set to 'By Unique Serial
Number';
— Create a new purchase order, with 500 lines. Each line with 10 units
of quantity of the previously created product;
— Confirm the purchase.
Before this commit, the creation of the stock piking take a quite some
time, and becomes difficult to use this functionality.
Now, the creation of the stock piking time was significantly improved.
opw-2070738
closesodoo/odoo#37107
X-original-commit: a434b087c86888903e320532b5e75856fa32bd13
Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com>
Steps to reproduce the bug:
- Let's consider that warehouse A resupplies from warehouse B
- A has Outgoing Shipments in one step
- B has Outgoing Shipments in two steps
- Change Outgoing Shipments of B in one step
Bug: An integrity error was raised because route_id field is required
on model 'stock.rule'
PS Inspired from function create_resupply_routes
opw:2069163
closesodoo/odoo#36991
X-original-commit: 2a87b56efab1246fa85c1b507322e0909db3dd20
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
Be in multi-company, with shared products, let P be a product in company C.
Suppose there are stock moves or pickings in company C'.
Suppose a non-admin writes on P: it triggers an access error.
Stock moves are not shared across companies in all cases.
So fields that depend on product_id might trigger a recompute on stock.moves
that are in another company, and thus trigger a spurious ACL error while
simply writing product attributes.
Note that _cal_move_weight depends on product_qty, however it is not sufficient
to only put that field in compute_sudo; the product_qty has already been marked
as todo, and so it is recomputed in the initial environment.
opw 2066691
forward port of 7d4d8fa18aecb3b78c8d359434a165c1de71a9b4
closesodoo/odoo#36838
Signed-off-by: Nans Lefebvre (len) <len@odoo.com>
Followup of 3d6e917899 to avoid leaking
the company of first warehouse on all others when writing on multiple
records.
closesodoo/odoo#36656
X-original-commit: ca5def07346ac85bfb53304d6a73aaa85882d3d8
Signed-off-by: Christophe Simonis <chs@odoo.com>
When creating a new picking, in case the user creates stock.move before
define the picking type, the move has no `company_id`.
Also, if they changes the picking type for an another company picking
type, the `company_id`of the move already created doesn't corresponding
anymore to the `company_id`of the picking anymore.
So, when create a new picking, we now insure the write the `company_id`
of new stock.move to be sure these cases was handle.
closesodoo/odoo#37130
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
Before this commit, the field to generate serial numbers in the
detailed operation move view wasn't displayed.
closesodoo/odoo#37197
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
To avoid slowing down search like "{relational_field}" contains "{value}"
we always need to return the lazy name_get() for each [_]name_search method
closesodoo/odoo#36735
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
As there's technically no way to hide partially a selection field,
we raise a warning when the user set a `stock.picking.type` as
internal without having the setting `stock.group_stock_multilocations`
enabled.
closesodoo/odoo#37129
Taskid: BugsLogistics
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
This commit removes 'location' and 'warehouse' from the api.depends_context
of _compute_quantities() as:
1. They are not needed. They are never changed in a single transaction in the current code
2. The ORM doens't support the fact that they are sometimes passed as list instead of integer
closesodoo/odoo#36788
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
Before this commit, the reordering rules computed quantity fields wasn't
computed by active company but for all companies. So, set `compute_sudo`
on false for `nbr_reordering_rules`, `reordering_min_qty`,
`reordering_max_qty` of products and product templates to avoid to
search with sudo active and to search by company.
closesodoo/odoo#36856
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
Before this commit, the product/product template computed quantity
fields wasn't computed by active company but for all companies.
So, set `compute_sudo` on false for the different computed quantity
fields of products and product templates to avoid to search with sudo
active and to search by company.
rev[0] added the possibility to put in pack without setting any done
quantity on move lines but when the reserved move lines are hidden
(thanks to rev[1]) it got confused on which move lines to work on.
[0] e03c1a836f
[1] ffd5d5a097closesodoo/odoo#36832
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
When .with_context() is called with a dictionary as 1st positional
argument, it will replace context (and not modify the referenced keys)
It may create bugs when losing the content of the context (e.g. remove
partner's language)
This is a cherry-pick to saas-12.5 of odoo/odoo#36164 of the logistic
part as discussed
closesodoo/odoo#36690
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
The condition needs to be fined-tuned, so revert for now.
This reverts commit 40487aca5c.
closesodoo/odoo#36470
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
In case there is a lot of stock_moves and/or lot of
stock_quants, the function _get_qty_procurement
takes a lot of time because there is no index defined
on most accessed fields.
I.E. OPW-2027183
closesodoo/odoo#36113
Signed-off-by: Richard Mathot (rim) <rim@openerp.com>
Context was overwritten in the wizard warning for insufficient
quantity when trying to scrap a componenent from a MO. This had a
side-effect on the move creation of the scrap where the move was
not linked to the MO, thus ignored by the cost analysis report.
closesodoo/odoo#36563
Tasks: BugLogistics
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
There's no readonly possibility on the calendar view so the only way to
prevent updating a done or cancelled transfer is to raise on the write.
We should to raise in the inverse function so that it is possible to
bypass the constraint by writing directly on the move, as we want to
change some date in the demo data.
closesodoo/odoo#36550
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
We display the button on the move if detailed operations is enabled and
if pre-fill detailed operations is disabled. There was a mix of computed
field/conditions in the xml resulting in an always hidden button.
We now only use the computed field.
related to 3520220268closesodoo/odoo#36519
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>