mirror of
https://github.com/ForgeFlow/stock-rma.git
synced 2025-01-21 12:57:49 +02:00
[11.0] MIG: RMA module
This commit is contained in:
committed by
ahenriquez
parent
f9c7b28af8
commit
ae0a75499a
22
rma/models/procurement.py
Normal file → Executable file
22
rma/models/procurement.py
Normal file → Executable file
@@ -2,22 +2,28 @@
|
||||
# © 2017 Eficent Business and IT Consulting Services S.L.
|
||||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html)
|
||||
|
||||
from odoo import api, fields, models
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class ProcurementOrder(models.Model):
|
||||
_inherit = 'procurement.order'
|
||||
class ProcurementRule(models.Model):
|
||||
_inherit = 'procurement.rule'
|
||||
|
||||
rma_line_id = fields.Many2one(
|
||||
comodel_name='rma.order.line', string='RMA line',
|
||||
ondelete="set null",
|
||||
)
|
||||
|
||||
@api.model
|
||||
def _get_stock_move_values(self):
|
||||
res = super(ProcurementOrder, self)._get_stock_move_values()
|
||||
if self.rma_line_id:
|
||||
line = self.rma_line_id
|
||||
def _get_stock_move_values(self, product_id, product_qty, product_uom,
|
||||
location_id, name, origin, values, group_id):
|
||||
res = super(ProcurementRule, self)._get_stock_move_values(product_id,
|
||||
product_qty,
|
||||
product_uom,
|
||||
location_id,
|
||||
name, origin,
|
||||
values,
|
||||
group_id)
|
||||
if 'rma_line_id' in values:
|
||||
line = self.env['rma.order.line'].browse(values.get('rma_line_id'))
|
||||
res['rma_line_id'] = line.id
|
||||
if line.delivery_address_id:
|
||||
res['partner_id'] = line.delivery_address_id.id
|
||||
|
||||
Reference in New Issue
Block a user