Skip to content

Commit

Permalink
[FIX] stock_weighing_auto_package: Store stock_weighing_auto_package …
Browse files Browse the repository at this point in the history
…with sudo

TT51569
  • Loading branch information
sergio-teruel committed Nov 4, 2024
1 parent 965a7d0 commit 2709b5c
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions stock_weighing_auto_package/wizards/weighing_wizard.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,28 @@
# Copyright 2024 Tecnativa - Sergio Teruel
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
from odoo import fields, models
from odoo import api, fields, models


class WeighingWizard(models.TransientModel):
_inherit = "weighing.wizard"

stock_weighing_auto_package = fields.Boolean(
related="product_id.stock_weighing_auto_package",
readonly=False,
compute="_compute_stock_weighing_auto_package",
inverse="_inverse_stock_weighing_auto_package",
string="Auto package",
)

@api.depends("product_id")
def _compute_stock_weighing_auto_package(self):
for wiz in self:
wiz.stock_weighing_auto_package = wiz.product_id.stock_weighing_auto_package

Check warning on line 18 in stock_weighing_auto_package/wizards/weighing_wizard.py

View check run for this annotation

Codecov / codecov/patch

stock_weighing_auto_package/wizards/weighing_wizard.py#L18

Added line #L18 was not covered by tests

def _inverse_stock_weighing_auto_package(self):
for wiz in self:
wiz.product_id.sudo().stock_weighing_auto_package = (

Check warning on line 22 in stock_weighing_auto_package/wizards/weighing_wizard.py

View check run for this annotation

Codecov / codecov/patch

stock_weighing_auto_package/wizards/weighing_wizard.py#L22

Added line #L22 was not covered by tests
wiz.stock_weighing_auto_package
)

def _post_add_detailed_operation(self):
res = super(WeighingWizard, self)._post_add_detailed_operation()
if self.result_package_id:
Expand Down

0 comments on commit 2709b5c

Please sign in to comment.