mirror of
https://github.com/ForgeFlow/stock-rma.git
synced 2025-01-21 12:57:49 +02:00
[9.0][FIX] rma_repair
This commit is contained in:
@@ -1,37 +1,31 @@
|
|||||||
.. image:: https://img.shields.io/badge/licence-LGPL--3-blue.svg
|
.. image:: https://img.shields.io/badge/licence-LGPL--3-blue.svg
|
||||||
:alt: License LGPL-3
|
:alt: License LGPL-3
|
||||||
|
|
||||||
========
|
==========
|
||||||
RMA Sale
|
RMA Repair
|
||||||
========
|
==========
|
||||||
|
|
||||||
This module allows you to:
|
wip:
|
||||||
|
* fix wizard
|
||||||
|
* change repair sequence to not use 'RMA'.
|
||||||
|
|
||||||
#. Import sales order lines into RMA lines
|
This module allows you to create repairs from one or more RMA lines.
|
||||||
#. Create a sales order and/or sales order line from one or more RMA lines
|
|
||||||
|
Installation
|
||||||
|
============
|
||||||
|
|
||||||
|
This module depends on ``mrp_repair_refurbish`` which is available at
|
||||||
|
`OCA/manufacture <https://github.com/OCA/manufacture>`_.
|
||||||
|
|
||||||
Usage
|
Usage
|
||||||
=====
|
=====
|
||||||
|
|
||||||
**Import existing sales order lines into an RMA:**
|
To create repairs from RMA lines:
|
||||||
|
|
||||||
This feature is useful when you create an RMA associated to a product that
|
|
||||||
was shipped and you have as a reference the customer PO number.
|
|
||||||
|
|
||||||
#. Access to a customer RMA.
|
|
||||||
#. Fill the customer.
|
|
||||||
#. Press the button *Add from Sales Order*.
|
|
||||||
#. In the wizard add a sales order and click on *add item* to select the
|
|
||||||
lines you want to add to the RMA.
|
|
||||||
|
|
||||||
**Create a sales order and/or sales order line from RMA lines:**
|
|
||||||
|
|
||||||
#. Go to a approved RMA line.
|
#. Go to a approved RMA line.
|
||||||
#. Click on *Create a Sales Quotation*.
|
#. Click on *Create Repair Order*.
|
||||||
#. In the wizard, select an *Existing Quotation to update* or leave it empty
|
#. Fill the required information in the lines.
|
||||||
if you want to create a new one.
|
#. Hit *Create Repair Orders*.
|
||||||
#. Fill the quantity to sell in the lines.
|
|
||||||
#. Hit *Create a Sales Quotation*.
|
|
||||||
|
|
||||||
Bug Tracker
|
Bug Tracker
|
||||||
===========
|
===========
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- 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)
|
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html)
|
||||||
|
|
||||||
from . import models
|
from . import models
|
||||||
from . import wizards
|
from . import wizards
|
||||||
|
|||||||
@@ -13,9 +13,8 @@
|
|||||||
"depends": ["rma_account", "mrp_repair_refurbish"],
|
"depends": ["rma_account", "mrp_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/sale_order_view.xml",
|
"views/mrp_repair_view.xml",
|
||||||
"wizards/rma_order_line_make_sale_order_view.xml",
|
"wizards/rma_order_line_make_repair_view.xml",
|
||||||
"wizards/rma_add_sale.xml",
|
|
||||||
"views/rma_order_line_view.xml"],
|
"views/rma_order_line_view.xml"],
|
||||||
"installable": True,
|
"installable": True,
|
||||||
"auto_install": True,
|
"auto_install": True,
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# Copyright 2017 Eficent Business and IT Consulting Services S.L.
|
|
||||||
# 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 mrp_repair
|
||||||
|
|||||||
@@ -10,7 +10,8 @@ class RmaOrderLine(models.Model):
|
|||||||
_inherit = "rma.order.line"
|
_inherit = "rma.order.line"
|
||||||
|
|
||||||
@api.one
|
@api.one
|
||||||
@api.depends('repair_ids', 'repair_ids.state')
|
@api.depends('repair_ids', 'repair_type', 'repair_ids.state',
|
||||||
|
'qty_to_receive')
|
||||||
def _compute_qty_to_repair(self):
|
def _compute_qty_to_repair(self):
|
||||||
if self.repair_type == 'no':
|
if self.repair_type == 'no':
|
||||||
self.qty_to_repair = 0.0
|
self.qty_to_repair = 0.0
|
||||||
@@ -24,7 +25,8 @@ class RmaOrderLine(models.Model):
|
|||||||
self.qty_to_repair = 0.0
|
self.qty_to_repair = 0.0
|
||||||
|
|
||||||
@api.one
|
@api.one
|
||||||
@api.depends('repair_ids', 'repair_type', 'repair_ids.state')
|
@api.depends('repair_ids', 'repair_type', 'repair_ids.state',
|
||||||
|
'qty_to_receive')
|
||||||
def _compute_qty_repaired(self):
|
def _compute_qty_repaired(self):
|
||||||
self.qty_repaired = self._get_rma_repaired_qty()
|
self.qty_repaired = self._get_rma_repaired_qty()
|
||||||
|
|
||||||
@@ -38,15 +40,15 @@ class RmaOrderLine(models.Model):
|
|||||||
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 Sell', 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 Sold', 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)
|
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')],
|
||||||
@@ -69,7 +71,7 @@ class RmaOrderLine(models.Model):
|
|||||||
lambda p: p.state != 'cancel'):
|
lambda p: p.state != 'cancel'):
|
||||||
repair_qty = self.env['product.uom']._compute_qty_obj(
|
repair_qty = self.env['product.uom']._compute_qty_obj(
|
||||||
self.uom_id,
|
self.uom_id,
|
||||||
repair.product_uom_qty,
|
repair.product_qty,
|
||||||
repair.product_uom,
|
repair.product_uom,
|
||||||
)
|
)
|
||||||
qty += repair_qty
|
qty += repair_qty
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<data>
|
|
||||||
<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</field>
|
<field name="name">mrp.repair.form rma_repair</field>
|
||||||
<field name="model">mrp.repair</field>
|
<field name="model">mrp.repair</field>
|
||||||
<field name="inherit_id" ref="mrp_repair.view_repair_order_form"/>
|
<field name="inherit_id" ref="mrp_repair.view_repair_order_form"/>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
@@ -12,5 +12,4 @@
|
|||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
</data>
|
|
||||||
</odoo>
|
</odoo>
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<data>
|
|
||||||
|
|
||||||
<record id="rma_operation_tree" model="ir.ui.view">
|
<record id="rma_operation_tree" model="ir.ui.view">
|
||||||
<field name="name">rma.operation.tree</field>
|
<field name="name">rma.operation.tree - rma_repair</field>
|
||||||
<field name="model">rma.operation</field>
|
<field name="model">rma.operation</field>
|
||||||
<field name="inherit_id" ref="rma.rma_operation_tree"/>
|
<field name="inherit_id" ref="rma.rma_operation_tree"/>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
@@ -14,7 +13,7 @@
|
|||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record id="rma_operation_form" model="ir.ui.view">
|
<record id="rma_operation_form" model="ir.ui.view">
|
||||||
<field name="name">rma.operation.form</field>
|
<field name="name">rma.operation.form - rma_repair</field>
|
||||||
<field name="model">rma.operation</field>
|
<field name="model">rma.operation</field>
|
||||||
<field name="inherit_id" ref="rma.rma_operation_form"/>
|
<field name="inherit_id" ref="rma.rma_operation_form"/>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
@@ -24,5 +23,4 @@
|
|||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
</data>
|
|
||||||
</odoo>
|
</odoo>
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<data>
|
|
||||||
|
|
||||||
<record id="view_rma_line_form" model="ir.ui.view">
|
<record id="view_rma_line_form" model="ir.ui.view">
|
||||||
<field name="name">rma.order.line.form</field>
|
<field name="name">rma.order.line.form - rma_repair</field>
|
||||||
<field name="model">rma.order.line</field>
|
<field name="model">rma.order.line</field>
|
||||||
<field name="inherit_id" ref="rma.view_rma_line_form"/>
|
<field name="inherit_id" ref="rma.view_rma_line_form"/>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
@@ -34,12 +33,12 @@
|
|||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record id="view_rma_line_button_repair_form" model="ir.ui.view">
|
<record id="view_rma_line_button_repair_form" model="ir.ui.view">
|
||||||
<field name="name">rma.order.line.form</field>
|
<field name="name">rma.order.line.form - rma_repair</field>
|
||||||
<field name="model">rma.order.line</field>
|
<field name="model">rma.order.line</field>
|
||||||
<field name="inherit_id" ref="rma.view_rma_line_button_form"/>
|
<field name="inherit_id" ref="rma.view_rma_line_button_form"/>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<header position="inside">
|
<header position="inside">
|
||||||
<button name="%(action_rma_order_line_make_repair_order)d"
|
<button name="%(action_rma_order_line_make_repair)d"
|
||||||
states="approved"
|
states="approved"
|
||||||
string="Create Repair Order"
|
string="Create Repair Order"
|
||||||
class="oe_highlight"
|
class="oe_highlight"
|
||||||
@@ -48,5 +47,4 @@
|
|||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
</data>
|
|
||||||
</odoo>
|
</odoo>
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<data>
|
|
||||||
<record id="view_rma_form" model="ir.ui.view">
|
<record id="view_rma_form" model="ir.ui.view">
|
||||||
<field name="name">rma.order.form</field>
|
<field name="name">rma.order.form - rma_repair</field>
|
||||||
<field name="model">rma.order</field>
|
<field name="model">rma.order</field>
|
||||||
<field name="inherit_id" ref="rma.view_rma_form"/>
|
<field name="inherit_id" ref="rma.view_rma_form"/>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<div name="button_box" position="inside">
|
<div name="button_box" position="inside">
|
||||||
<button type="object" name="action_view_sale_order"
|
<button type="object" name="action_view_repair_order"
|
||||||
class="oe_stat_button"
|
class="oe_stat_button"
|
||||||
icon="fa-pencil-square-o"
|
icon="fa-pencil-square-o"
|
||||||
groups="stock.group_stock_user">
|
groups="stock.group_stock_user">
|
||||||
@@ -17,5 +17,5 @@
|
|||||||
</div>
|
</div>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
</data>
|
|
||||||
</odoo>
|
</odoo>
|
||||||
|
|||||||
@@ -1,8 +1,4 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- 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)
|
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html)
|
||||||
|
|
||||||
from . import rma_order_line_make_sale_order
|
from . import rma_order_line_make_repair
|
||||||
from . import rma_make_picking
|
|
||||||
from . import rma_refund
|
|
||||||
from . import rma_add_sale
|
|
||||||
|
|||||||
@@ -1,115 +0,0 @@
|
|||||||
# -*- 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
|
|
||||||
from openerp.exceptions import ValidationError
|
|
||||||
|
|
||||||
|
|
||||||
class RmaAddSale(models.TransientModel):
|
|
||||||
_name = 'rma_add_sale'
|
|
||||||
_description = 'Wizard to add rma lines from SO lines'
|
|
||||||
|
|
||||||
@api.model
|
|
||||||
def default_get(self, fields):
|
|
||||||
res = super(RmaAddSale, self).default_get(fields)
|
|
||||||
rma_obj = self.env['rma.order']
|
|
||||||
rma_id = self.env.context['active_ids'] or []
|
|
||||||
active_model = self.env.context['active_model']
|
|
||||||
if not rma_id:
|
|
||||||
return res
|
|
||||||
assert active_model == 'rma.order', 'Bad context propagation'
|
|
||||||
|
|
||||||
rma = rma_obj.browse(rma_id)
|
|
||||||
res['rma_id'] = rma.id
|
|
||||||
res['partner_id'] = rma.partner_id.id
|
|
||||||
res['sale_id'] = False
|
|
||||||
res['sale_line_ids'] = False
|
|
||||||
return res
|
|
||||||
|
|
||||||
rma_id = fields.Many2one(
|
|
||||||
comodel_name='rma.order', string='RMA Order', readonly=True)
|
|
||||||
partner_id = fields.Many2one(comodel_name='res.partner', string='Partner',
|
|
||||||
readonly=True)
|
|
||||||
sale_id = fields.Many2one(comodel_name='sale.order', string='Order')
|
|
||||||
sale_line_ids = fields.Many2many('sale.order.line',
|
|
||||||
'rma_add_sale_add_line_rel',
|
|
||||||
'sale_line_id', 'rma_add_sale_id',
|
|
||||||
readonly=False,
|
|
||||||
string='Sale Lines')
|
|
||||||
|
|
||||||
def _prepare_rma_line_from_sale_order_line(self, line):
|
|
||||||
operation = line.product_id.rma_customer_operation_id
|
|
||||||
if not operation:
|
|
||||||
operation = line.product_id.categ_id.rma_customer_operation_id
|
|
||||||
if not operation:
|
|
||||||
operation = self.env['rma.operation'].search(
|
|
||||||
[('type', '=', self.rma_id.type)], limit=1)
|
|
||||||
if not operation:
|
|
||||||
raise ValidationError("Please define an operation first")
|
|
||||||
if not operation.in_route_id or not operation.out_route_id:
|
|
||||||
route = self.env['stock.location.route'].search(
|
|
||||||
[('rma_selectable', '=', True)], limit=1)
|
|
||||||
if not route:
|
|
||||||
raise ValidationError("Please define an rma route")
|
|
||||||
if not operation.in_warehouse_id or not operation.out_warehouse_id:
|
|
||||||
warehouse = self.env['stock.warehouse'].search(
|
|
||||||
[('company_id', '=', self.rma_id.company_id.id),
|
|
||||||
('lot_rma_id', '!=', False)], limit=1)
|
|
||||||
if not warehouse:
|
|
||||||
raise ValidationError("Please define a warehouse with a "
|
|
||||||
"default rma location.")
|
|
||||||
data = {
|
|
||||||
'sale_line_id': line.id,
|
|
||||||
'product_id': line.product_id.id,
|
|
||||||
'origin': line.order_id.name,
|
|
||||||
'uom_id': line.product_uom.id,
|
|
||||||
'operation_id': operation.id,
|
|
||||||
'product_qty': line.product_uom_qty,
|
|
||||||
'delivery_address_id': self.sale_id.partner_id.id,
|
|
||||||
'invoice_address_id': self.sale_id.partner_id.id,
|
|
||||||
'price_unit': line.currency_id.compute(
|
|
||||||
line.price_unit, line.currency_id, round=False),
|
|
||||||
'rma_id': self.rma_id.id,
|
|
||||||
'in_route_id': operation.in_route_id.id or route.id,
|
|
||||||
'out_route_id': operation.out_route_id.id or route.id,
|
|
||||||
'receipt_policy': operation.receipt_policy,
|
|
||||||
'location_id': (operation.location_id.id or
|
|
||||||
operation.in_warehouse_id.lot_rma_id.id or
|
|
||||||
warehouse.lot_rma_id.id),
|
|
||||||
'refund_policy': operation.refund_policy,
|
|
||||||
'delivery_policy': operation.delivery_policy,
|
|
||||||
'in_warehouse_id': operation.in_warehouse_id.id or warehouse.id,
|
|
||||||
'out_warehouse_id': operation.out_warehouse_id.id or warehouse.id,
|
|
||||||
}
|
|
||||||
return data
|
|
||||||
|
|
||||||
@api.model
|
|
||||||
def _get_rma_data(self):
|
|
||||||
data = {
|
|
||||||
'date_rma': fields.Datetime.now(),
|
|
||||||
'delivery_address_id': self.sale_id.partner_id.id,
|
|
||||||
'invoice_address_id': self.sale_id.partner_id.id
|
|
||||||
}
|
|
||||||
return data
|
|
||||||
|
|
||||||
@api.model
|
|
||||||
def _get_existing_sale_lines(self):
|
|
||||||
existing_sale_lines = []
|
|
||||||
for rma_line in self.rma_id.rma_line_ids:
|
|
||||||
existing_sale_lines.append(rma_line.sale_line_id)
|
|
||||||
return existing_sale_lines
|
|
||||||
|
|
||||||
@api.multi
|
|
||||||
def add_lines(self):
|
|
||||||
rma_line_obj = self.env['rma.order.line']
|
|
||||||
existing_sale_lines = self._get_existing_sale_lines()
|
|
||||||
for line in self.sale_line_ids:
|
|
||||||
# Load a PO line only once
|
|
||||||
if line not in existing_sale_lines:
|
|
||||||
data = self._prepare_rma_line_from_sale_order_line(line)
|
|
||||||
rma_line_obj.create(data)
|
|
||||||
rma = self.rma_id
|
|
||||||
data_rma = self._get_rma_data()
|
|
||||||
rma.write(data_rma)
|
|
||||||
return {'type': 'ir.actions.act_window_close'}
|
|
||||||
@@ -1,80 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
|
|
||||||
<odoo>
|
|
||||||
<record id="view_rma_add_sale" model="ir.ui.view">
|
|
||||||
<field name="name">rma.add.sale</field>
|
|
||||||
<field name="model">rma_add_sale</field>
|
|
||||||
<field name="arch" type="xml">
|
|
||||||
<form string="Select Sale Order from customer">
|
|
||||||
<separator string="Select Sale Order from customer"/>
|
|
||||||
<group>
|
|
||||||
<field name="partner_id"
|
|
||||||
domain="[('customer','=',True)]"
|
|
||||||
string="Customer"/>
|
|
||||||
</group>
|
|
||||||
<separator string="Select Sale Order Lines to Add"/>
|
|
||||||
<group>
|
|
||||||
<field name="sale_id"
|
|
||||||
domain="[
|
|
||||||
('partner_id','=',partner_id), (('state','not in',['draft','cancel']))]"
|
|
||||||
context="{'partner_id': partner_id}"/>
|
|
||||||
</group>
|
|
||||||
<field name="sale_line_ids"
|
|
||||||
domain="[('order_id', '=', sale_id)]"
|
|
||||||
string="Sale Order Lines">
|
|
||||||
<tree>
|
|
||||||
<field name="product_id" invisible="1"/>
|
|
||||||
<field name="order_id"/>
|
|
||||||
<field name="order_partner_id"/>
|
|
||||||
<field name="name"/>
|
|
||||||
<field name="salesman_id"/>
|
|
||||||
<field name="product_uom_qty" string="Qty"/>
|
|
||||||
<field name="qty_delivered"/>
|
|
||||||
<field name="qty_invoiced"/>
|
|
||||||
<field name="qty_to_invoice"/>
|
|
||||||
<field name="product_uom" string="Unit of Measure" groups="product.group_uom"/>
|
|
||||||
<field name="price_subtotal" sum="Total" widget="monetary"/>
|
|
||||||
</tree>
|
|
||||||
|
|
||||||
</field>
|
|
||||||
<footer>
|
|
||||||
<button
|
|
||||||
string="Confirm"
|
|
||||||
name="add_lines" type="object"
|
|
||||||
class="oe_highlight"/>
|
|
||||||
or
|
|
||||||
<button name="action_cancel"
|
|
||||||
string="Cancel" class="oe_link" special="cancel"/>
|
|
||||||
</footer>
|
|
||||||
</form>
|
|
||||||
</field>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
<record id="action_rma_add_sale" model="ir.actions.act_window">
|
|
||||||
<field name="name">Add Sale Order</field>
|
|
||||||
<field name="type">ir.actions.act_window</field>
|
|
||||||
<field name="res_model">rma_add_sale</field>
|
|
||||||
<field name="src_model">rma.order</field>
|
|
||||||
<field name="view_type">form</field>
|
|
||||||
<field name="view_mode">form</field>
|
|
||||||
<field name="target">new</field>
|
|
||||||
<field name="view_id" ref="view_rma_add_sale"/>
|
|
||||||
<field name="groups_id" eval="[(4, ref('rma.group_rma_customer_user')), (4, ref('rma.group_rma_customer_user'))]"/>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
|
|
||||||
<record id="view_rma_add_sale_form" model="ir.ui.view">
|
|
||||||
<field name="name">rma.order.form - sale wizard</field>
|
|
||||||
<field name="model">rma.order</field>
|
|
||||||
<field name="inherit_id" ref="rma.view_rma_form"/>
|
|
||||||
<field name="arch" type="xml">
|
|
||||||
<button name="action_rma_done" position="after">
|
|
||||||
<button name="%(action_rma_add_sale)d"
|
|
||||||
string="Add From Sale Order"
|
|
||||||
type="action"
|
|
||||||
states="draft,to_approve"/>
|
|
||||||
</button>
|
|
||||||
</field>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
</odoo>
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
# -*- 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 RmaMakePicking(models.TransientModel):
|
|
||||||
_inherit = 'rma_make_picking.wizard'
|
|
||||||
|
|
||||||
@api.returns('rma.order.line')
|
|
||||||
def _prepare_item(self, line):
|
|
||||||
res = super(RmaMakePicking, self)._prepare_item(line)
|
|
||||||
res['sale_line_id'] = line.sale_line_id.id
|
|
||||||
return res
|
|
||||||
|
|
||||||
|
|
||||||
class RmaMakePickingItem(models.TransientModel):
|
|
||||||
_inherit = "rma_make_picking.wizard.item"
|
|
||||||
|
|
||||||
sale_line_id = fields.Many2one(
|
|
||||||
comodel_name='sale.order.line', string='Sale Line')
|
|
||||||
143
rma_repair/wizards/rma_order_line_make_repair.py
Normal file
143
rma_repair/wizards/rma_order_line_make_repair.py
Normal file
@@ -0,0 +1,143 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Copyright 2016 Eficent Business and IT Consulting Services S.L.
|
||||||
|
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl-3.0).
|
||||||
|
|
||||||
|
import openerp.addons.decimal_precision as dp
|
||||||
|
from openerp import _, api, fields, models
|
||||||
|
from openerp.exceptions import ValidationError
|
||||||
|
|
||||||
|
|
||||||
|
class RmaLineMakeRepair(models.TransientModel):
|
||||||
|
_name = "rma.order.line.make.repair"
|
||||||
|
_description = "Make Repair Order from RMA Line"
|
||||||
|
|
||||||
|
item_ids = fields.One2many(
|
||||||
|
comodel_name='rma.order.line.make.repair.item',
|
||||||
|
inverse_name='wiz_id', string='Items')
|
||||||
|
|
||||||
|
@api.model
|
||||||
|
def _prepare_item(self, line):
|
||||||
|
if line.product_id.refurbish_product_id:
|
||||||
|
to_refurbish = True
|
||||||
|
refurbish_product_id = line.product_id.refurbish_product_id.id
|
||||||
|
else:
|
||||||
|
to_refurbish = refurbish_product_id = False
|
||||||
|
return {
|
||||||
|
'line_id': line.id,
|
||||||
|
'rma_line_id': line.id,
|
||||||
|
'product_id': line.product_id.id,
|
||||||
|
'product_qty': line.qty_to_repair,
|
||||||
|
'rma_id': line.rma_id.id,
|
||||||
|
'out_route_id': line.out_route_id.id,
|
||||||
|
'product_uom_id': line.uom_id.id,
|
||||||
|
'partner_id': line.partner_id.id,
|
||||||
|
# 'location_dest_id': which default here?,
|
||||||
|
'to_refurbish': to_refurbish,
|
||||||
|
'refurbish_product_id': refurbish_product_id,
|
||||||
|
'location_id': line.location_id.id,
|
||||||
|
}
|
||||||
|
|
||||||
|
@api.model
|
||||||
|
def default_get(self, fields):
|
||||||
|
res = super(RmaLineMakeRepair, self).default_get(
|
||||||
|
fields)
|
||||||
|
rma_line_obj = self.env['rma.order.line']
|
||||||
|
rma_line_ids = self.env.context['active_ids'] or []
|
||||||
|
active_model = self.env.context['active_model']
|
||||||
|
|
||||||
|
if not rma_line_ids:
|
||||||
|
return res
|
||||||
|
assert active_model == 'rma.order.line', 'Bad context propagation'
|
||||||
|
items = []
|
||||||
|
lines = rma_line_obj.browse(rma_line_ids)
|
||||||
|
for line in lines:
|
||||||
|
items.append([0, 0, self._prepare_item(line)])
|
||||||
|
res['item_ids'] = items
|
||||||
|
return res
|
||||||
|
|
||||||
|
@api.multi
|
||||||
|
def make_repair_order(self):
|
||||||
|
res = []
|
||||||
|
repair_obj = self.env['mrp.repair']
|
||||||
|
for item in self.item_ids:
|
||||||
|
rma_line = item.line_id
|
||||||
|
data = item._prepare_repair_order(rma_line)
|
||||||
|
repair = repair_obj.create(data)
|
||||||
|
res.append(repair.id)
|
||||||
|
return {
|
||||||
|
'domain': [('id', 'in', res)],
|
||||||
|
'name': _('Repairs'),
|
||||||
|
'view_type': 'form',
|
||||||
|
'view_mode': 'tree,form',
|
||||||
|
'res_model': 'mrp.repair',
|
||||||
|
'view_id': False,
|
||||||
|
'context': False,
|
||||||
|
'type': 'ir.actions.act_window'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class RmaLineMakeRepairItem(models.TransientModel):
|
||||||
|
_name = "rma.order.line.make.repair.item"
|
||||||
|
_description = "RMA Line Make Repair Item"
|
||||||
|
|
||||||
|
@api.constrains('product_qty')
|
||||||
|
def _check_prodcut_qty(self):
|
||||||
|
for rec in self:
|
||||||
|
if rec.product_qty <= 0.0:
|
||||||
|
raise ValidationError(_('Quantity must be positive.'))
|
||||||
|
|
||||||
|
@api.onchange('to_refurbish')
|
||||||
|
def _onchange_to_refurbish(self):
|
||||||
|
if self.to_refurbish:
|
||||||
|
self.refurbish_product_id = self.product_id.refurbish_product_id
|
||||||
|
else:
|
||||||
|
self.refurbish_product_id = False
|
||||||
|
|
||||||
|
wiz_id = fields.Many2one(
|
||||||
|
comodel_name='rma.order.line.make.repair', string='Wizard',
|
||||||
|
required=True, readonly=True)
|
||||||
|
line_id = fields.Many2one(
|
||||||
|
comodel_name='rma.order.line', string='RMA Line', required=True)
|
||||||
|
rma_id = fields.Many2one(
|
||||||
|
comodel_name='rma.order', related='line_id.rma_id',
|
||||||
|
string='RMA Order', readonly=True)
|
||||||
|
product_id = fields.Many2one(
|
||||||
|
comodel_name='product.product', string='Product', readonly=True)
|
||||||
|
product_qty = fields.Float(
|
||||||
|
string='Quantity to repair', digits=dp.get_precision('Product UoS'))
|
||||||
|
product_uom_id = fields.Many2one(
|
||||||
|
comodel_name='product.uom', string='UoM', readonly=True)
|
||||||
|
out_route_id = fields.Many2one(
|
||||||
|
comodel_name='stock.location.route', string='Outbound Route',
|
||||||
|
domain=[('rma_selectable', '=', True)])
|
||||||
|
partner_id = fields.Many2one(
|
||||||
|
comodel_name='res.partner', string='Customer', required=False,
|
||||||
|
domain=[('customer', '=', True)])
|
||||||
|
location_id = fields.Many2one(
|
||||||
|
comodel_name="stock.location", string="Location", required=True)
|
||||||
|
location_dest_id = fields.Many2one(
|
||||||
|
comodel_name="stock.location", string="Destination location",
|
||||||
|
required=True)
|
||||||
|
to_refurbish = fields.Boolean(string="To Refurbish?")
|
||||||
|
refurbish_product_id = fields.Many2one(
|
||||||
|
comodel_name="product.product", string="Refurbished Product")
|
||||||
|
|
||||||
|
@api.model
|
||||||
|
def _prepare_repair_order(self, rma_line):
|
||||||
|
location_dest = (self.location_dest_id if not self.to_refurbish else
|
||||||
|
self.product_id.property_stock_refurbish)
|
||||||
|
refurbish_location_dest_id = (self.location_dest_id.id if
|
||||||
|
self.to_refurbish else False)
|
||||||
|
return {
|
||||||
|
'product_id': self.product_id.id,
|
||||||
|
'partner_id': self.partner_id.id,
|
||||||
|
'product_qty': self.product_qty,
|
||||||
|
'rma_line_id': self.line_id.id,
|
||||||
|
'product_uom': self.product_id.uom_po_id.id,
|
||||||
|
'company_id': rma_line.company_id.id,
|
||||||
|
'location_id': self.location_id.id,
|
||||||
|
'location_dest_id': location_dest.id,
|
||||||
|
'refurbish_location_dest_id': refurbish_location_dest_id,
|
||||||
|
'refurbish_product_id': self.refurbish_product_id.id,
|
||||||
|
'to_refurbish': self.to_refurbish,
|
||||||
|
}
|
||||||
60
rma_repair/wizards/rma_order_line_make_repair_view.xml
Normal file
60
rma_repair/wizards/rma_order_line_make_repair_view.xml
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Copyright 2017 Eficent Business and IT Consulting Services S.L.
|
||||||
|
License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl-3.0) -->
|
||||||
|
<odoo>
|
||||||
|
|
||||||
|
<record id="view_rma_order_line_make_repair" model="ir.ui.view">
|
||||||
|
<field name="name">RMA Line Make Repair</field>
|
||||||
|
<field name="model">rma.order.line.make.repair</field>
|
||||||
|
<field name="type">form</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<form string="Create Repair">
|
||||||
|
<separator string="New Repair Orders details:"/>
|
||||||
|
<newline/>
|
||||||
|
<group>
|
||||||
|
<field name="item_ids" nolabel="1" colspan="2">
|
||||||
|
<tree string="Details" editable="bottom" create="false">
|
||||||
|
<field name="line_id" options="{'no_open': true}"/>
|
||||||
|
<field name="product_id"/>
|
||||||
|
<field name="product_qty"/>
|
||||||
|
<field name="product_uom_id" groups="product.group_uom"/>
|
||||||
|
<field name="partner_id"/>
|
||||||
|
<field name="to_refurbish"/>
|
||||||
|
<field name="refurbish_product_id" attrs="{'required': [('to_refurbish', '=', True)]}"/>
|
||||||
|
<field name="location_id"/>
|
||||||
|
<field name="location_dest_id"/>
|
||||||
|
</tree>
|
||||||
|
</field>
|
||||||
|
</group>
|
||||||
|
<newline/>
|
||||||
|
<group colspan="2">
|
||||||
|
<button name="make_repair_order"
|
||||||
|
string="Create Repair Orders" type="object"
|
||||||
|
class="oe_highlight"/>
|
||||||
|
<button special="cancel" string="Cancel" class="oe_link"/>
|
||||||
|
</group>
|
||||||
|
</form>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="action_rma_order_line_make_repair"
|
||||||
|
model="ir.actions.act_window">
|
||||||
|
<field name="name">Create Repair</field>
|
||||||
|
<field name="type">ir.actions.act_window</field>
|
||||||
|
<field name="res_model">rma.order.line.make.repair</field>
|
||||||
|
<field name="view_type">form</field>
|
||||||
|
<field name="view_mode">form</field>
|
||||||
|
<field name="target">new</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="ir.values" id="rma_order_line_make_repair_multi">
|
||||||
|
<field name="model_id" ref="model_rma_order_line" />
|
||||||
|
<field name="name">Create Repairs</field>
|
||||||
|
<field name="key2">client_action_multi</field>
|
||||||
|
<field name="value"
|
||||||
|
eval="'ir.actions.act_window,' + str(ref('action_rma_order_line_make_repair'))" />
|
||||||
|
<field name="key">action</field>
|
||||||
|
<field name="model">rma.order.line</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
</odoo>
|
||||||
@@ -1,153 +0,0 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
# Copyright 2016 Eficent Business and IT Consulting Services S.L.
|
|
||||||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl-3.0).
|
|
||||||
|
|
||||||
import openerp.addons.decimal_precision as dp
|
|
||||||
from openerp import _, api, exceptions, fields, models
|
|
||||||
|
|
||||||
|
|
||||||
class RmaLineMakeSaleOrder(models.TransientModel):
|
|
||||||
_name = "rma.order.line.make.sale.order"
|
|
||||||
_description = "Make Sales Order from RMA Line"
|
|
||||||
|
|
||||||
partner_id = fields.Many2one(
|
|
||||||
comodel_name='res.partner', string='Customer', required=False,
|
|
||||||
domain=[('supplier', '=', True)])
|
|
||||||
item_ids = fields.One2many(
|
|
||||||
comodel_name='rma.order.line.make.sale.order.item',
|
|
||||||
inverse_name='wiz_id', string='Items')
|
|
||||||
sale_order_id = fields.Many2one(
|
|
||||||
comodel_name='sale.order', string='Sales Order', required=False,
|
|
||||||
domain=[('state', '=', 'draft')])
|
|
||||||
|
|
||||||
@api.model
|
|
||||||
def _prepare_item(self, line):
|
|
||||||
return {
|
|
||||||
'line_id': line.id,
|
|
||||||
'rma_line_id': line.id,
|
|
||||||
'product_id': line.product_id.id,
|
|
||||||
'name': line.product_id.name,
|
|
||||||
'product_qty': line.qty_to_sell,
|
|
||||||
'rma_id': line.rma_id.id,
|
|
||||||
'out_warehouse_id': line.out_warehouse_id.id,
|
|
||||||
'out_route_id': line.out_route_id.id,
|
|
||||||
'product_uom_id': line.uom_id.id,
|
|
||||||
}
|
|
||||||
|
|
||||||
@api.model
|
|
||||||
def default_get(self, fields):
|
|
||||||
res = super(RmaLineMakeSaleOrder, self).default_get(
|
|
||||||
fields)
|
|
||||||
rma_line_obj = self.env['rma.order.line']
|
|
||||||
rma_line_ids = self.env.context['active_ids'] or []
|
|
||||||
active_model = self.env.context['active_model']
|
|
||||||
|
|
||||||
if not rma_line_ids:
|
|
||||||
return res
|
|
||||||
assert active_model == 'rma.order.line', 'Bad context propagation'
|
|
||||||
|
|
||||||
items = []
|
|
||||||
lines = rma_line_obj.browse(rma_line_ids)
|
|
||||||
for line in lines:
|
|
||||||
items.append([0, 0, self._prepare_item(line)])
|
|
||||||
customers = lines.mapped('partner_id')
|
|
||||||
if len(customers) == 1:
|
|
||||||
res['partner_id'] = customers.id
|
|
||||||
else:
|
|
||||||
raise exceptions.Warning(
|
|
||||||
_('Only RMA lines from the same partner can be processed at '
|
|
||||||
'the same time'))
|
|
||||||
res['item_ids'] = items
|
|
||||||
return res
|
|
||||||
|
|
||||||
@api.model
|
|
||||||
def _prepare_sale_order(self, out_warehouse, company):
|
|
||||||
if not self.partner_id:
|
|
||||||
raise exceptions.Warning(
|
|
||||||
_('Enter a customer.'))
|
|
||||||
customer = self.partner_id
|
|
||||||
data = {
|
|
||||||
'origin': '',
|
|
||||||
'partner_id': customer.id,
|
|
||||||
'warehouse_id': out_warehouse.id,
|
|
||||||
'company_id': company.id,
|
|
||||||
}
|
|
||||||
return data
|
|
||||||
|
|
||||||
@api.model
|
|
||||||
def _prepare_sale_order_line(self, so, item):
|
|
||||||
product = item.product_id
|
|
||||||
vals = {
|
|
||||||
'name': product.name,
|
|
||||||
'order_id': so.id,
|
|
||||||
'product_id': product.id,
|
|
||||||
'product_uom': product.uom_po_id.id,
|
|
||||||
'route_id': item.out_route_id.id,
|
|
||||||
'product_uom_qty': item.product_qty,
|
|
||||||
'rma_line_id': item.line_id.id
|
|
||||||
}
|
|
||||||
if item.free_of_charge:
|
|
||||||
vals['price_unit'] = 0.0
|
|
||||||
return vals
|
|
||||||
|
|
||||||
@api.multi
|
|
||||||
def make_sale_order(self):
|
|
||||||
res = []
|
|
||||||
sale_obj = self.env['sale.order']
|
|
||||||
so_line_obj = self.env['sale.order.line']
|
|
||||||
sale = False
|
|
||||||
|
|
||||||
for item in self.item_ids:
|
|
||||||
line = item.line_id
|
|
||||||
if item.product_qty <= 0.0:
|
|
||||||
raise exceptions.Warning(
|
|
||||||
_('Enter a positive quantity.'))
|
|
||||||
|
|
||||||
if self.sale_order_id:
|
|
||||||
sale = self.sale_order_id
|
|
||||||
if not sale:
|
|
||||||
po_data = self._prepare_sale_order(line.out_warehouse_id,
|
|
||||||
line.company_id)
|
|
||||||
sale = sale_obj.create(po_data)
|
|
||||||
|
|
||||||
so_line_data = self._prepare_sale_order_line(sale, item)
|
|
||||||
so_line_obj.create(so_line_data)
|
|
||||||
res.append(sale.id)
|
|
||||||
|
|
||||||
return {
|
|
||||||
'domain': "[('id','in', ["+','.join(map(str, res))+"])]",
|
|
||||||
'name': _('Quotations'),
|
|
||||||
'view_type': 'form',
|
|
||||||
'view_mode': 'tree,form',
|
|
||||||
'res_model': 'sale.order',
|
|
||||||
'view_id': False,
|
|
||||||
'context': False,
|
|
||||||
'type': 'ir.actions.act_window'
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
class RmaLineMakeSaleOrderItem(models.TransientModel):
|
|
||||||
_name = "rma.order.line.make.sale.order.item"
|
|
||||||
_description = "RMA Line Make Sale Order Item"
|
|
||||||
|
|
||||||
wiz_id = fields.Many2one(
|
|
||||||
comodel_name='rma.order.line.make.sale.order', string='Wizard',
|
|
||||||
required=True, readonly=True)
|
|
||||||
line_id = fields.Many2one(
|
|
||||||
comodel_name='rma.order.line', string='RMA Line', required=True)
|
|
||||||
rma_id = fields.Many2one(
|
|
||||||
comodel_name='rma.order', related='line_id.rma_id',
|
|
||||||
string='RMA Order', readonly=True)
|
|
||||||
product_id = fields.Many2one(
|
|
||||||
comodel_name='product.product', string='Product', readonly=True)
|
|
||||||
name = fields.Char(string='Description', required=True, readonly=True)
|
|
||||||
product_qty = fields.Float(
|
|
||||||
string='Quantity to sell', digits=dp.get_precision('Product UoS'))
|
|
||||||
product_uom_id = fields.Many2one(
|
|
||||||
comodel_name='product.uom', string='UoM', readonly=True)
|
|
||||||
out_warehouse_id = fields.Many2one(
|
|
||||||
comodel_name='stock.warehouse', string='Outbound Warehouse')
|
|
||||||
free_of_charge = fields.Boolean(string='Free of Charge')
|
|
||||||
out_route_id = fields.Many2one(
|
|
||||||
comodel_name='stock.location.route', string='Outbound Route',
|
|
||||||
domain=[('rma_selectable', '=', True)])
|
|
||||||
@@ -1,75 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!-- Copyright 2016 Eficent Business and IT Consulting Services S.L.
|
|
||||||
License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl-3.0) -->
|
|
||||||
<openerp>
|
|
||||||
<data>
|
|
||||||
<record id="view_rma_order_line_make_sale_order" model="ir.ui.view">
|
|
||||||
<field name="name">RMA Line Make Sale Order</field>
|
|
||||||
<field name="model">rma.order.line.make.sale.order</field>
|
|
||||||
<field name="type">form</field>
|
|
||||||
<field name="arch" type="xml">
|
|
||||||
<form string="Create Quotation">
|
|
||||||
<separator string="Existing Quotation to update:"/>
|
|
||||||
<newline/>
|
|
||||||
<group>
|
|
||||||
<field name="sale_order_id"
|
|
||||||
domain="[('partner_id','=',partner_id)]"
|
|
||||||
context="{'partner_id': partner_id}"/>/>
|
|
||||||
</group>
|
|
||||||
<newline/>
|
|
||||||
<separator
|
|
||||||
string="New Sales Order details:"/>
|
|
||||||
<newline/>
|
|
||||||
<group>
|
|
||||||
<field name="partner_id"/>
|
|
||||||
</group>
|
|
||||||
<newline/>
|
|
||||||
<group>
|
|
||||||
<field name="item_ids" nolabel="1" colspan="2">
|
|
||||||
<tree string="Details" editable="bottom" create="false">
|
|
||||||
<field name="line_id"
|
|
||||||
options="{'no_open': true}"/>
|
|
||||||
<field name="product_id"/>
|
|
||||||
<field name="name"/>
|
|
||||||
<field name="product_qty"/>
|
|
||||||
<field name="product_uom_id"
|
|
||||||
groups="product.group_uom"/>
|
|
||||||
<field name="free_of_charge"/>
|
|
||||||
</tree>
|
|
||||||
</field>
|
|
||||||
</group>
|
|
||||||
<newline/>
|
|
||||||
<group colspan="2">
|
|
||||||
<button name="make_sale_order"
|
|
||||||
string="Create Sales Quotation" type="object"
|
|
||||||
class="oe_highlight"/>
|
|
||||||
<button special="cancel" string="Cancel" class="oe_link"/>
|
|
||||||
</group>
|
|
||||||
</form>
|
|
||||||
</field>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
<record id="action_rma_order_line_make_sale_order"
|
|
||||||
model="ir.actions.act_window">
|
|
||||||
<field name="name">Create Sales Quotation</field>
|
|
||||||
<field name="type">ir.actions.act_window</field>
|
|
||||||
<field name="res_model">rma.order.line.make.sale.order</field>
|
|
||||||
<field name="view_type">form</field>
|
|
||||||
<field name="view_mode">form</field>
|
|
||||||
<field name="view_id" ref="view_rma_order_line_make_sale_order"/>
|
|
||||||
<field name="target">new</field>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
<record model="ir.values" id="rma_order_line_make_sale_order">
|
|
||||||
<field name="model_id" ref="model_rma_order_line" />
|
|
||||||
<field name="name">Create RFQ</field>
|
|
||||||
<field name="key2">client_action_multi</field>
|
|
||||||
<field name="value"
|
|
||||||
eval="'ir.actions.act_window,' + str(ref('action_rma_order_line_make_sale_order'))" />
|
|
||||||
<field name="key">action</field>
|
|
||||||
<field name="model">rma.order.line</field>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
</data>
|
|
||||||
</openerp>
|
|
||||||
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
# -*- 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 RmaRefund(models.TransientModel):
|
|
||||||
_inherit = "rma.refund"
|
|
||||||
|
|
||||||
@api.returns('rma.order.line')
|
|
||||||
def _prepare_item(self, line):
|
|
||||||
res = super(RmaRefund, self)._prepare_item(line)
|
|
||||||
res['sale_line_id'] = line.sale_line_id.id
|
|
||||||
return res
|
|
||||||
|
|
||||||
|
|
||||||
class RmaRefundItem(models.TransientModel):
|
|
||||||
_inherit = "rma.refund.item"
|
|
||||||
|
|
||||||
sale_line_id = fields.Many2one(
|
|
||||||
comodel_name='sale.order.line', string='Sale Order Line')
|
|
||||||
Reference in New Issue
Block a user