mirror of
https://github.com/ForgeFlow/stock-rma.git
synced 2025-01-21 12:57:49 +02:00
[FIX] rma: do not force reservation on supplier RMA deliveries
* remove code call to unexisting `force_asign`. * only one model per model file and rename as appropriate.
This commit is contained in:
committed by
Florian da Costa
parent
6fda8128dd
commit
c2d491ede6
41
rma/models/stock_rule.py
Normal file
41
rma/models/stock_rule.py
Normal file
@@ -0,0 +1,41 @@
|
||||
# Copyright (C) 2017-22 ForgeFlow S.L.
|
||||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html)
|
||||
|
||||
from odoo import models
|
||||
|
||||
|
||||
class StockRule(models.Model):
|
||||
_inherit = "stock.rule"
|
||||
|
||||
def _get_stock_move_values(
|
||||
self,
|
||||
product_id,
|
||||
product_qty,
|
||||
product_uom,
|
||||
location_id,
|
||||
name,
|
||||
origin,
|
||||
company_id,
|
||||
values,
|
||||
):
|
||||
res = super()._get_stock_move_values(
|
||||
product_id,
|
||||
product_qty,
|
||||
product_uom,
|
||||
location_id,
|
||||
name,
|
||||
origin,
|
||||
company_id,
|
||||
values,
|
||||
)
|
||||
if "rma_line_id" in values:
|
||||
line = values.get("rma_line_id")
|
||||
res["rma_line_id"] = line.id
|
||||
if line.delivery_address_id:
|
||||
res["partner_id"] = line.delivery_address_id.id
|
||||
else:
|
||||
res["partner_id"] = line.rma_id.partner_id.id
|
||||
dest_loc = self.env["stock.location"].browse([res["location_dest_id"]])[0]
|
||||
if dest_loc.usage == "internal":
|
||||
res["price_unit"] = line.price_unit
|
||||
return res
|
||||
Reference in New Issue
Block a user