mirror of
https://github.com/OCA/manufacture.git
synced 2025-01-28 16:37:15 +02:00
38 lines
848 B
Python
38 lines
848 B
Python
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
|
|
|
from odoo import models
|
|
|
|
|
|
class StockRule(models.Model):
|
|
_inherit = "stock.rule"
|
|
|
|
def _prepare_mo_vals(
|
|
self,
|
|
product_id,
|
|
product_qty,
|
|
product_uom,
|
|
location_id,
|
|
name,
|
|
origin,
|
|
company_id,
|
|
values,
|
|
bom,
|
|
):
|
|
vals = super()._prepare_mo_vals(
|
|
product_id,
|
|
product_qty,
|
|
product_uom,
|
|
location_id,
|
|
name,
|
|
origin,
|
|
company_id,
|
|
values,
|
|
bom,
|
|
)
|
|
lot_id = values.get("restrict_lot_id")
|
|
if lot_id:
|
|
vals["lot_producing_id"] = lot_id
|
|
lot = self.env["stock.production.lot"].browse(lot_id)
|
|
vals["name"] = lot.name
|
|
return vals
|