mirror of
https://github.com/ForgeFlow/stock-rma.git
synced 2025-01-21 12:57:49 +02:00
[MIG] rma_filter_lot: Migration to 17.0
Moved the domain from the python declaration to xml view field to match base changes (6c67346b08).
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
# Copyright 2021 ForgeFlow S.L.
|
||||
# Copyright 2021-24 ForgeFlow S.L.
|
||||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html)
|
||||
|
||||
{
|
||||
"name": "RMA Filter Lot",
|
||||
"version": "15.0.1.0.0",
|
||||
"version": "17.0.1.0.0",
|
||||
"license": "LGPL-3",
|
||||
"category": "RMA",
|
||||
"summary": "Filter RMA lots",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Copyright 2021 ForgeFlow S.L.
|
||||
# Copyright 2021-24 ForgeFlow S.L.
|
||||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html)
|
||||
|
||||
from odoo import api, fields, models
|
||||
@@ -8,27 +8,22 @@ from odoo.tools import float_compare
|
||||
class RmaOrderLine(models.Model):
|
||||
_inherit = "rma.order.line"
|
||||
|
||||
lot_id = fields.Many2one(
|
||||
domain="[('id', 'in', valid_lot_ids)]",
|
||||
)
|
||||
valid_lot_ids = fields.One2many(
|
||||
comodel_name="stock.production.lot",
|
||||
comodel_name="stock.lot",
|
||||
compute="_compute_domain_lot_ids",
|
||||
)
|
||||
|
||||
@api.depends("product_id")
|
||||
def _compute_domain_lot_ids(self):
|
||||
for rec in self:
|
||||
lots = rec.env["stock.production.lot"].search(
|
||||
[("product_id", "=", rec.product_id.id)]
|
||||
)
|
||||
lots = rec.env["stock.lot"].search([("product_id", "=", rec.product_id.id)])
|
||||
if (
|
||||
lots
|
||||
and rec.type == "customer"
|
||||
and rec.product_id
|
||||
and rec.product_id.tracking != "none"
|
||||
):
|
||||
valid_ids = self.env["stock.production.lot"]
|
||||
valid_ids = self.env["stock.lot"]
|
||||
for quant in rec.product_id.stock_quant_ids:
|
||||
if (
|
||||
float_compare(quant.available_quantity, 0.0, precision_digits=2)
|
||||
|
||||
@@ -8,6 +8,11 @@
|
||||
<field name="partner_id" position="after">
|
||||
<field name="valid_lot_ids" invisible="1" />
|
||||
</field>
|
||||
<field name="lot_id" position="attributes">
|
||||
<attribute
|
||||
name="domain"
|
||||
>[('product_id', '=', product_id),('id','in',valid_lot_ids)]</attribute>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
|
||||
Reference in New Issue
Block a user