Skip to content

Commit

Permalink
Merge PR #20 into 15.0
Browse files Browse the repository at this point in the history
Signed-off-by chienandalu
  • Loading branch information
OCA-git-bot committed Nov 4, 2024
2 parents 965a7d0 + 2709b5c commit 77a0a77
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

def _inverse_stock_weighing_auto_package(self):
for wiz in self:
wiz.product_id.sudo().stock_weighing_auto_package = (
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 77a0a77

Please sign in to comment.