mirror of
https://github.com/ForgeFlow/stock-rma.git
synced 2025-01-21 12:57:49 +02:00
[MIG] rma_repair: Migration to 12.0
This commit is contained in:
committed by
JasminSForgeFlow
parent
d87a5d7e46
commit
25b3e2075c
@@ -10,7 +10,7 @@ This module allows you to create repairs from one or more RMA lines.
|
|||||||
Installation
|
Installation
|
||||||
============
|
============
|
||||||
|
|
||||||
This module depends on ``mrp_repair_refurbish`` which is available at
|
This module depends on ``repair_refurbish`` which is available at
|
||||||
`OCA/manufacture <https://github.com/OCA/manufacture>`_.
|
`OCA/manufacture <https://github.com/OCA/manufacture>`_.
|
||||||
|
|
||||||
Usage
|
Usage
|
||||||
@@ -40,6 +40,7 @@ Contributors
|
|||||||
* Jordi Ballester Alomar <jordi.ballester@eficent.com>
|
* Jordi Ballester Alomar <jordi.ballester@eficent.com>
|
||||||
* Aaron Henriquez <ahenriquez@eficent.com>
|
* Aaron Henriquez <ahenriquez@eficent.com>
|
||||||
* Lois Rilo <lois.rilo@eficent.com>
|
* Lois Rilo <lois.rilo@eficent.com>
|
||||||
|
* Akim Juillerat <akim.juillerat@camptocamp.com>
|
||||||
|
|
||||||
Maintainer
|
Maintainer
|
||||||
----------
|
----------
|
||||||
|
|||||||
@@ -3,19 +3,22 @@
|
|||||||
|
|
||||||
{
|
{
|
||||||
"name": "RMA Repair",
|
"name": "RMA Repair",
|
||||||
"version": "11.0.1.0.0",
|
"version": "12.0.1.0.0",
|
||||||
"license": "LGPL-3",
|
"license": "LGPL-3",
|
||||||
"category": "RMA",
|
"category": "RMA",
|
||||||
"summary": "Links RMA with Repairs.",
|
"summary": "Links RMA with Repairs.",
|
||||||
"author": "Eficent, Odoo Community Association (OCA)",
|
"author": "Eficent, Odoo Community Association (OCA)",
|
||||||
"website": "http://www.github.com/OCA/rma",
|
"website": "http://www.github.com/OCA/rma",
|
||||||
"depends": ["rma_account", "mrp_repair_refurbish"],
|
"depends": [
|
||||||
|
"rma_account",
|
||||||
|
"repair_refurbish"
|
||||||
|
],
|
||||||
"data": ["views/rma_order_view.xml",
|
"data": ["views/rma_order_view.xml",
|
||||||
"views/rma_operation_view.xml",
|
"views/rma_operation_view.xml",
|
||||||
"views/mrp_repair_view.xml",
|
"views/repair_view.xml",
|
||||||
"wizards/rma_order_line_make_repair_view.xml",
|
"wizards/rma_order_line_make_repair_view.xml",
|
||||||
"views/rma_order_line_view.xml",
|
"views/rma_order_line_view.xml",
|
||||||
"data/mrp_repair_sequence.xml",
|
"data/repair_sequence.xml",
|
||||||
],
|
],
|
||||||
"installable": True,
|
"installable": True,
|
||||||
"auto_install": True,
|
"auto_install": True,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<odoo noupdate="1">
|
<odoo noupdate="1">
|
||||||
|
|
||||||
<record id="mrp_repair.seq_mrp_repair" model="ir.sequence">
|
<record id="repair.seq_repair" model="ir.sequence">
|
||||||
<field name="prefix">RO</field>
|
<field name="prefix">RO</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html)
|
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html)
|
||||||
|
|
||||||
from . import mrp_repair
|
from . import repair
|
||||||
from . import rma_order_line
|
from . import rma_order_line
|
||||||
from . import rma_order
|
from . import rma_order
|
||||||
from . import rma_operation
|
from . import rma_operation
|
||||||
|
|||||||
@@ -4,12 +4,12 @@
|
|||||||
from odoo import fields, models
|
from odoo import fields, models
|
||||||
|
|
||||||
|
|
||||||
class MrpRepair(models.Model):
|
class RepairOrder(models.Model):
|
||||||
_inherit = "mrp.repair"
|
_inherit = "repair.order"
|
||||||
|
|
||||||
rma_line_id = fields.Many2one(
|
rma_line_id = fields.Many2one(
|
||||||
comodel_name='rma.order.line', string='RMA', ondelete='restrict',
|
comodel_name='rma.order.line', string='RMA', ondelete='restrict',
|
||||||
)
|
)
|
||||||
under_warranty = fields.Boolean(
|
under_warranty = fields.Boolean(
|
||||||
related='rma_line_id.under_warranty',
|
related='rma_line_id.under_warranty', readonly=False,
|
||||||
)
|
)
|
||||||
@@ -11,14 +11,14 @@ class RmaOrder(models.Model):
|
|||||||
def _compute_repair_count(self):
|
def _compute_repair_count(self):
|
||||||
for rma in self:
|
for rma in self:
|
||||||
repairs = rma.mapped('rma_line_ids.repair_ids')
|
repairs = rma.mapped('rma_line_ids.repair_ids')
|
||||||
rma.rma_count = len(repairs)
|
rma.repair_count = len(repairs)
|
||||||
|
|
||||||
repair_count = fields.Integer(
|
repair_count = fields.Integer(
|
||||||
compute=_compute_repair_count, string='# of Repairs')
|
compute='_compute_repair_count', string='# of Repairs')
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def action_view_repair_order(self):
|
def action_view_repair_order(self):
|
||||||
action = self.env.ref('mrp_repair.action_repair_order_tree')
|
action = self.env.ref('repair.action_repair_order_tree')
|
||||||
result = action.read()[0]
|
result = action.read()[0]
|
||||||
repair_ids = self.mapped('rma_line_ids.repair_ids').ids
|
repair_ids = self.mapped('rma_line_ids.repair_ids').ids
|
||||||
result['domain'] = [('id', 'in', repair_ids)]
|
result['domain'] = [('id', 'in', repair_ids)]
|
||||||
|
|||||||
@@ -29,41 +29,41 @@ class RmaOrderLine(models.Model):
|
|||||||
for line in self:
|
for line in self:
|
||||||
line.qty_repaired = line._get_rma_repaired_qty()
|
line.qty_repaired = line._get_rma_repaired_qty()
|
||||||
|
|
||||||
@api.multi
|
@api.depends('repair_ids')
|
||||||
def _compute_repair_count(self):
|
def _compute_repair_count(self):
|
||||||
for line in self:
|
for line in self:
|
||||||
line.repair_count = len(line.repair_ids)
|
line.repair_count = len(line.repair_ids)
|
||||||
|
|
||||||
repair_ids = fields.One2many(
|
repair_ids = fields.One2many(
|
||||||
comodel_name='mrp.repair', inverse_name='rma_line_id',
|
comodel_name='repair.order', inverse_name='rma_line_id',
|
||||||
string='Repair Orders', readonly=True,
|
string='Repair Orders', readonly=True,
|
||||||
states={'draft': [('readonly', False)]}, copy=False)
|
states={'draft': [('readonly', False)]}, copy=False)
|
||||||
qty_to_repair = fields.Float(
|
qty_to_repair = fields.Float(
|
||||||
string='Qty To Repair', copy=False,
|
string='Qty To Repair', copy=False,
|
||||||
digits=dp.get_precision('Product Unit of Measure'),
|
digits=dp.get_precision('Product Unit of Measure'),
|
||||||
readonly=True, compute=_compute_qty_to_repair,
|
readonly=True, compute='_compute_qty_to_repair',
|
||||||
store=True)
|
store=True)
|
||||||
qty_repaired = fields.Float(
|
qty_repaired = fields.Float(
|
||||||
string='Qty Repaired', copy=False,
|
string='Qty Repaired', copy=False,
|
||||||
digits=dp.get_precision('Product Unit of Measure'),
|
digits=dp.get_precision('Product Unit of Measure'),
|
||||||
readonly=True, compute=_compute_qty_repaired,
|
readonly=True, compute='_compute_qty_repaired',
|
||||||
store=True, help="Quantity repaired or being repaired.")
|
store=True, help="Quantity repaired or being repaired.")
|
||||||
repair_type = fields.Selection(selection=[
|
repair_type = fields.Selection(selection=[
|
||||||
('no', 'Not required'), ('ordered', 'Based on Ordered Quantities'),
|
('no', 'Not required'), ('ordered', 'Based on Ordered Quantities'),
|
||||||
('received', 'Based on Received Quantities')],
|
('received', 'Based on Received Quantities')],
|
||||||
string="Repair Policy", default='no', required=True)
|
string="Repair Policy", default='no', required=True)
|
||||||
repair_count = fields.Integer(
|
repair_count = fields.Integer(
|
||||||
compute=_compute_repair_count, string='# of Repairs')
|
compute='_compute_repair_count', string='# of Repairs')
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def action_view_repair_order(self):
|
def action_view_repair_order(self):
|
||||||
action = self.env.ref('mrp_repair.action_repair_order_tree')
|
action = self.env.ref('repair.action_repair_order_tree')
|
||||||
result = action.read()[0]
|
result = action.read()[0]
|
||||||
repair_ids = self.repair_ids.ids
|
repair_ids = self.repair_ids.ids
|
||||||
if len(repair_ids) != 1:
|
if len(repair_ids) != 1:
|
||||||
result['domain'] = [('id', 'in', repair_ids)]
|
result['domain'] = [('id', 'in', repair_ids)]
|
||||||
elif len(repair_ids) == 1:
|
elif len(repair_ids) == 1:
|
||||||
res = self.env.ref('mrp_repair.view_repair_order_form', False)
|
res = self.env.ref('repair.view_repair_order_form', False)
|
||||||
result['views'] = [(res and res.id or False, 'form')]
|
result['views'] = [(res and res.id or False, 'form')]
|
||||||
result['res_id'] = repair_ids[0]
|
result['res_id'] = repair_ids[0]
|
||||||
return result
|
return result
|
||||||
|
|||||||
@@ -2,9 +2,9 @@
|
|||||||
<odoo>
|
<odoo>
|
||||||
|
|
||||||
<record id="view_repair_order_form" model="ir.ui.view">
|
<record id="view_repair_order_form" model="ir.ui.view">
|
||||||
<field name="name">mrp.repair.form rma_repair</field>
|
<field name="name">repair.order.form rma_repair</field>
|
||||||
<field name="model">mrp.repair</field>
|
<field name="model">repair.order</field>
|
||||||
<field name="inherit_id" ref="mrp_repair.view_repair_order_form"/>
|
<field name="inherit_id" ref="repair.view_repair_order_form"/>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<field name="guarantee_limit" position="after">
|
<field name="guarantee_limit" position="after">
|
||||||
<field name="rma_line_id"/>
|
<field name="rma_line_id"/>
|
||||||
@@ -57,7 +57,7 @@ class RmaLineMakeRepair(models.TransientModel):
|
|||||||
@api.multi
|
@api.multi
|
||||||
def make_repair_order(self):
|
def make_repair_order(self):
|
||||||
res = []
|
res = []
|
||||||
repair_obj = self.env['mrp.repair']
|
repair_obj = self.env['repair.order']
|
||||||
for item in self.item_ids:
|
for item in self.item_ids:
|
||||||
rma_line = item.line_id
|
rma_line = item.line_id
|
||||||
data = item._prepare_repair_order(rma_line)
|
data = item._prepare_repair_order(rma_line)
|
||||||
@@ -68,7 +68,7 @@ class RmaLineMakeRepair(models.TransientModel):
|
|||||||
'name': _('Repairs'),
|
'name': _('Repairs'),
|
||||||
'view_type': 'form',
|
'view_type': 'form',
|
||||||
'view_mode': 'tree,form',
|
'view_mode': 'tree,form',
|
||||||
'res_model': 'mrp.repair',
|
'res_model': 'repair.order',
|
||||||
'view_id': False,
|
'view_id': False,
|
||||||
'context': False,
|
'context': False,
|
||||||
'type': 'ir.actions.act_window'
|
'type': 'ir.actions.act_window'
|
||||||
@@ -102,7 +102,7 @@ class RmaLineMakeRepairItem(models.TransientModel):
|
|||||||
)
|
)
|
||||||
rma_id = fields.Many2one(
|
rma_id = fields.Many2one(
|
||||||
comodel_name='rma.order', related='line_id.rma_id',
|
comodel_name='rma.order', related='line_id.rma_id',
|
||||||
string='RMA Order', readonly=True,
|
string='RMA Order',
|
||||||
)
|
)
|
||||||
product_id = fields.Many2one(
|
product_id = fields.Many2one(
|
||||||
comodel_name='product.product', string='Product', readonly=True,
|
comodel_name='product.product', string='Product', readonly=True,
|
||||||
@@ -111,7 +111,7 @@ class RmaLineMakeRepairItem(models.TransientModel):
|
|||||||
string='Quantity to repair', digits=dp.get_precision('Product UoS'),
|
string='Quantity to repair', digits=dp.get_precision('Product UoS'),
|
||||||
)
|
)
|
||||||
product_uom_id = fields.Many2one(
|
product_uom_id = fields.Many2one(
|
||||||
comodel_name='product.uom', string='UoM', readonly=True,
|
comodel_name='uom.uom', string='UoM', readonly=True,
|
||||||
)
|
)
|
||||||
out_route_id = fields.Many2one(
|
out_route_id = fields.Many2one(
|
||||||
comodel_name='stock.location.route', string='Outbound Route',
|
comodel_name='stock.location.route', string='Outbound Route',
|
||||||
|
|||||||
@@ -17,12 +17,12 @@
|
|||||||
<field name="line_id" options="{'no_open': true}"/>
|
<field name="line_id" options="{'no_open': true}"/>
|
||||||
<field name="product_id"/>
|
<field name="product_id"/>
|
||||||
<field name="product_qty"/>
|
<field name="product_qty"/>
|
||||||
<field name="product_uom_id" groups="product.group_uom"/>
|
<field name="product_uom_id" groups="uom.group_uom"/>
|
||||||
<field name="partner_id"/>
|
<field name="partner_id"/>
|
||||||
<field name="to_refurbish"/>
|
<field name="to_refurbish"/>
|
||||||
<field name="refurbish_product_id" attrs="{'required': [('to_refurbish', '=', True)]}"/>
|
<field name="refurbish_product_id" attrs="{'required': [('to_refurbish', '=', True)]}"/>
|
||||||
<field name="location_id"/>
|
<field name="location_id" groups="stock.group_stock_multi_locations"/>
|
||||||
<field name="location_dest_id"/>
|
<field name="location_dest_id" groups="stock.group_stock_multi_locations"/>
|
||||||
<field name="invoice_method"/>
|
<field name="invoice_method"/>
|
||||||
</tree>
|
</tree>
|
||||||
</field>
|
</field>
|
||||||
|
|||||||
Reference in New Issue
Block a user