Add related field home_delivery on stock.move.line from picking_id, and expose it in the batch move line list view as an optional boolean toggle.
44 lines
1.1 KiB
Python
44 lines
1.1 KiB
Python
# Copyright 2026 Criptomart
|
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
|
|
|
from odoo import api
|
|
from odoo import fields
|
|
from odoo import models
|
|
|
|
|
|
class StockMoveLine(models.Model):
|
|
_inherit = "stock.move.line"
|
|
|
|
product_categ_id = fields.Many2one(
|
|
comodel_name="product.category",
|
|
string="Product Category (Batch)",
|
|
related="product_id.categ_id",
|
|
store=True,
|
|
readonly=True,
|
|
)
|
|
|
|
is_collected = fields.Boolean(
|
|
string="Collected",
|
|
default=False,
|
|
copy=False,
|
|
)
|
|
|
|
home_delivery = fields.Boolean(
|
|
related="picking_id.home_delivery",
|
|
readonly=True,
|
|
)
|
|
|
|
consumer_group_id = fields.Many2one(
|
|
comodel_name="res.partner",
|
|
compute="_compute_consumer_group_id",
|
|
readonly=True,
|
|
)
|
|
|
|
@api.depends("picking_id")
|
|
def _compute_consumer_group_id(self):
|
|
for line in self:
|
|
picking = line.picking_id
|
|
if picking:
|
|
line.consumer_group_id = picking.batch_consumer_group_id
|
|
else:
|
|
line.consumer_group_id = False
|