mirror of
https://github.com/ForgeFlow/stock-rma.git
synced 2025-01-21 12:57:49 +02:00
27 lines
974 B
Python
27 lines
974 B
Python
# Copyright 22 ForgeFlow S.L.
|
|
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html)
|
|
|
|
from odoo import models
|
|
|
|
|
|
class RmaRefund(models.TransientModel):
|
|
_inherit = "rma.refund"
|
|
|
|
def _get_refund_price_unit(self, rma):
|
|
price_unit = super(RmaRefund, self)._get_refund_price_unit(rma)
|
|
if rma.type == "supplier":
|
|
if rma.account_move_line_id:
|
|
price_unit = rma.account_move_line_id.price_unit
|
|
elif rma.purchase_order_line_id:
|
|
price_unit = rma.purchase_order_line_id.price_unit
|
|
return price_unit
|
|
|
|
def _get_refund_currency(self, rma):
|
|
currency = super(RmaRefund, self)._get_refund_currency(rma)
|
|
if rma.type == "supplier":
|
|
if rma.account_move_line_id:
|
|
currency = rma.account_move_line_id.currency_id
|
|
elif rma.purchase_order_line_id:
|
|
currency = rma.purchase_order_line_id.currency_id
|
|
return currency
|