Files
stock-rma/rma_purchase/wizards/rma_make_picking.py
Jordi Ballester 56cf851fe8 [IMP] rma: Refactor all rma modules in order to consider using the correct price unit in moves
Otherwise the inventory accounting will be completely wrong.
2022-03-02 11:35:08 +01:00

37 lines
1.2 KiB
Python

# Copyright 2017-2022 ForgeFlow S.L.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html)
from odoo import api, fields, models
class RmaMakePicking(models.TransientModel):
_inherit = "rma_make_picking.wizard"
def _prepare_item(self, line):
res = super(RmaMakePicking, self)._prepare_item(line)
res["purchase_order_line_id"] = line.purchase_order_line_id.id
return res
@api.model
def _get_action(self, pickings, procurements):
po_list = []
for procurement in procurements:
if procurement.purchase_id and procurement.purchase_id.id:
po_list.append(procurement.purchase_id.id)
if len(po_list):
action = self.env.ref("purchase.purchase_rfq")
result = action.sudo().read()[0]
result["domain"] = [("id", "in", po_list)]
return result
else:
action = super(RmaMakePicking, self)._get_action(pickings, procurements)
return action
class RmaMakePickingItem(models.TransientModel):
_inherit = "rma_make_picking.wizard.item"
purchase_order_line_id = fields.Many2one(
"purchase.order.line", string="Purchase Line"
)