mirror of
https://github.com/OCA/manufacture.git
synced 2025-01-28 16:37:15 +02:00
34 lines
1.1 KiB
Python
34 lines
1.1 KiB
Python
# Copyright 2020 ForgeFlow S.L.
|
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
|
from odoo import api, models
|
|
|
|
|
|
class StockMove(models.Model):
|
|
|
|
_inherit = "stock.move"
|
|
|
|
@api.model_create_multi
|
|
def create(self, vals_list):
|
|
if "to_refurbish" in self.env.context and self.env.context["to_refurbish"]:
|
|
if "force_refurbish_location_dest_id" in self.env.context:
|
|
for vals in vals_list:
|
|
vals["location_dest_id"] = self.env.context[
|
|
"force_refurbish_location_dest_id"
|
|
]
|
|
return super().create(vals_list)
|
|
|
|
|
|
class StockMoveLine(models.Model):
|
|
|
|
_inherit = "stock.move.line"
|
|
|
|
@api.model_create_multi
|
|
def create(self, vals_list):
|
|
if "to_refurbish" in self.env.context and self.env.context["to_refurbish"]:
|
|
if "force_refurbish_location_dest_id" in self.env.context:
|
|
for vals in vals_list:
|
|
vals["location_dest_id"] = self.env.context[
|
|
"force_refurbish_location_dest_id"
|
|
]
|
|
return super().create(vals_list)
|