Odoo18-Base/addons/purchase_requisition_stock/wizard/purchase_requisition_create_alternative.py
2025-01-06 10:57:38 +07:00

25 lines
856 B
Python

# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, Command, models
class PurchaseRequisitionCreateAlternative(models.TransientModel):
_inherit = 'purchase.requisition.create.alternative'
def _get_alternative_values(self):
vals = super(PurchaseRequisitionCreateAlternative, self)._get_alternative_values()
vals.update({
'picking_type_id': self.origin_po_id.picking_type_id.id,
'group_id': self.origin_po_id.group_id.id,
})
return vals
@api.model
def _get_alternative_line_value(self, order_line):
res_line = super()._get_alternative_line_value(order_line)
if order_line.move_dest_ids:
res_line['move_dest_ids'] = [Command.set(order_line.move_dest_ids.ids)]
return res_line