Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[15.0][MIG] product_route_profile #1775

Open
wants to merge 18 commits into
base: 15.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion product_route_profile/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{
"name": "Product Route Profile",
"summary": "Add Route profile concept on product",
"version": "14.0.1.0.3",
"version": "15.0.1.0.0",
"category": "Warehouse",
"website": "https://github.com/OCA/stock-logistics-warehouse",
"author": "Akretion, Odoo Community Association (OCA)",
Expand Down
2 changes: 1 addition & 1 deletion product_route_profile/models/product_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class ProductTemplate(models.Model):
@api.depends("route_profile_id", "force_route_profile_id")
@api.depends_context("company")
def _compute_route_ids(self):
for rec in self:
for rec in self.sudo():
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bosd Why is this needed ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it was needed to pass the tests.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bosd I still need an answer on this as just putting this for tests is not wanted.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question. I don't remember, it has been a while :)
Maybe better to do functional test it without this. To see if it only is relevant for the tests. Or also required to achieve the functionality.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that different routes may apply depending on the current company, it might be the case that there are route profiles (with an empty company_id) that provide routes for different companies. In that case it makes sense to escalate privileges when copying routes so that routes are copied even if the user does not have access to the all the companies that the routes belong to.

if rec.force_route_profile_id:
rec.route_ids = [(6, 0, rec.force_route_profile_id.route_ids.ids)]
elif rec.route_profile_id:
Expand Down
2 changes: 1 addition & 1 deletion product_route_profile/models/route_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class RouteProfile(models.Model):
_name = "route.profile"
_description = "Route Profile"

name = fields.Char("Name")
name = fields.Char()
company_id = fields.Many2one(
comodel_name="res.company",
default=lambda self: self.env.company.id,
Expand Down
4 changes: 2 additions & 2 deletions product_route_profile/tests/test_product_route_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
# @author Kévin Roche <[email protected]>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo.tests.common import SavepointCase
from odoo.tests.common import TransactionCase


class TestProductRouteProfile(SavepointCase):
class TestProductRouteProfile(TransactionCase):
@classmethod
def setUpClass(cls):
super(TestProductRouteProfile, cls).setUpClass()
Expand Down