Initial commit: Odoo 18.0-20251222 extra-addons
Some checks failed
pre-commit / pre-commit (push) Has been cancelled
tests / Detect unreleased dependencies (push) Has been cancelled
tests / test with OCB (push) Has been cancelled
tests / test with Odoo (push) Has been cancelled

This commit is contained in:
tocmo0nlord
2026-03-13 20:43:25 +00:00
parent 36e847a7df
commit adbe430761
9472 changed files with 1265727 additions and 0 deletions

View File

@@ -0,0 +1 @@
from . import sale_order_line

View File

@@ -0,0 +1,41 @@
from odoo import api, fields, models
class SaleOrderLine(models.Model):
_inherit = "sale.order.line"
def _selection_product_tracking(self):
return self.env["product.product"].fields_get(
allfields=["tracking"],
)["tracking"]["selection"]
product_tracking = fields.Selection(
selection=_selection_product_tracking,
compute="_compute_product_tracking",
)
lot_id = fields.Many2one(
"stock.lot",
"Lot",
copy=False,
compute="_compute_lot_id",
store=True,
readonly=False,
precompute=True,
)
def _prepare_procurement_values(self, group_id=False):
vals = super()._prepare_procurement_values(group_id=group_id)
if self.lot_id:
vals["restrict_lot_id"] = self.lot_id.id
return vals
@api.depends("product_id")
def _compute_product_tracking(self):
for sol in self:
sol.product_tracking = sol.product_id.tracking or sol.product_tracking
@api.depends("product_id")
def _compute_lot_id(self):
for sol in self:
if sol.product_id != sol.lot_id.product_id:
sol.lot_id = False