Files
stock-rma/rma/models/procurement.py
lreficent 539be323ef [9.0][FIX] rma:
* fix assignment of moves.
* default qty in rma lines.
* remove account dependency.
* test and flake8 fixes.
2020-01-14 16:35:26 +01:00

30 lines
954 B
Python

# -*- coding: utf-8 -*-
# © 2017 Eficent Business and IT Consulting Services S.L.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html)
from openerp import api, fields, models
class ProcurementOrder(models.Model):
_inherit = 'procurement.order'
rma_line_id = fields.Many2one('rma.order.line', 'RMA', ondelete="set null")
@api.model
def _run_move_create(self, procurement):
res = super(ProcurementOrder, self)._run_move_create(procurement)
if procurement.rma_line_id:
line = procurement.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
return res
class ProcurementGroup(models.Model):
_inherit = 'procurement.group'
rma_id = fields.Many2one('rma.order', 'RMA', ondelete="set null")