mirror of
https://github.com/ForgeFlow/stock-rma.git
synced 2025-01-21 12:57:49 +02:00
[9.0] rma: remove rma.rule and add that setting to product.category
This commit is contained in:
committed by
AaronHForgeFlow
parent
58da75554a
commit
b0c14c7b0a
@@ -1,10 +1,11 @@
|
|||||||
.. 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
|
======================================
|
||||||
===
|
RMA (Return Merchandise Authorization)
|
||||||
|
======================================
|
||||||
|
|
||||||
A return merchandise authorization (RMA), is a part of the process of
|
A Return Merchandise Authorization (RMA), is a part of the process of
|
||||||
returning a product in order to receive a refund, replacement, or repair
|
returning a product in order to receive a refund, replacement, or repair
|
||||||
during the product's warranty period.
|
during the product's warranty period.
|
||||||
|
|
||||||
@@ -29,6 +30,7 @@ Configuration
|
|||||||
|
|
||||||
Security
|
Security
|
||||||
--------
|
--------
|
||||||
|
|
||||||
Go to Settings > Users and assign the appropiate permissions to users.
|
Go to Settings > Users and assign the appropiate permissions to users.
|
||||||
Different security groups grant distinct levels of access to the RMA features.
|
Different security groups grant distinct levels of access to the RMA features.
|
||||||
|
|
||||||
@@ -38,11 +40,25 @@ Different security groups grant distinct levels of access to the RMA features.
|
|||||||
* Users in group "RMA Manager" can access to, create, approve and process RMA's
|
* Users in group "RMA Manager" can access to, create, approve and process RMA's
|
||||||
associated to both customers and suppliers.
|
associated to both customers and suppliers.
|
||||||
|
|
||||||
|
RMA Approval Policy
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
There are two RMA approval policies in product catogories:
|
||||||
|
|
||||||
|
* One step: Always auto-approve RMAs that only contain products within
|
||||||
|
categories with this policy.
|
||||||
|
* Two steps: A RMA order containing a product within a category with this
|
||||||
|
policy will request the RMA manager approval.
|
||||||
|
|
||||||
|
In order to change the approval policy of a product category follow the next
|
||||||
|
steps:
|
||||||
|
|
||||||
|
#. Go to *Inventory > Configuration > Products > Product Categories*.
|
||||||
|
#. Select one and change the field *RMA Approval Policy* to your convenience.
|
||||||
|
|
||||||
|
Other Settings
|
||||||
|
--------------
|
||||||
|
|
||||||
#. Go to Settings > Users and assign the appropiate permissions to users.
|
|
||||||
Users assigned to the group 'RMA
|
|
||||||
#. Go to Inventory > Settings > Return Merchandising Authorization and select
|
#. Go to Inventory > Settings > Return Merchandising Authorization and select
|
||||||
the option "Display 3 fields on rma: partner, invoice address, delivery
|
the option "Display 3 fields on rma: partner, invoice address, delivery
|
||||||
address" if needed.
|
address" if needed.
|
||||||
@@ -51,16 +67,17 @@ Different security groups grant distinct levels of access to the RMA features.
|
|||||||
and suppliers RMA picking type. In case the warehouse is configured to
|
and suppliers RMA picking type. In case the warehouse is configured to
|
||||||
use routes, you need to create at least one route per rma type with at
|
use routes, you need to create at least one route per rma type with at
|
||||||
least two push rules (one for inbound another for outbound) it's very
|
least two push rules (one for inbound another for outbound) it's very
|
||||||
important to select the typeof operation supplier if we are moving in the
|
important to select the type of operation supplier if we are moving in the
|
||||||
company and customer if we are moving out of the company.
|
company and customer if we are moving out of the company.
|
||||||
|
|
||||||
Usage
|
Usage
|
||||||
=====
|
=====
|
||||||
|
|
||||||
RMA are accessible though Inventory menu. There's four menus, divided by type
|
RMA are accessible though Inventory menu. There's four menus, divided by type.
|
||||||
. Users can access to the list of RMA or RMA lines.
|
Users can access to the list of RMA or RMA lines.
|
||||||
|
|
||||||
Create an RMA:
|
Create an RMA:
|
||||||
|
|
||||||
#. Select a partner. Enter RMA lines associated to an existing picking, or
|
#. Select a partner. Enter RMA lines associated to an existing picking, or
|
||||||
manually.
|
manually.
|
||||||
#. Request approval and approve.
|
#. Request approval and approve.
|
||||||
@@ -87,10 +104,9 @@ 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>
|
||||||
|
|
||||||
Maintainer
|
Maintainer
|
||||||
----------
|
----------
|
||||||
|
|
||||||
This module is maintained by Eficent.
|
This module is maintained by Eficent.
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
# 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)
|
||||||
|
|
||||||
{
|
{
|
||||||
'name': 'rma',
|
'name': 'RMA (Return Merchandise Authorization)',
|
||||||
'version': '9.0.1.0.0',
|
'version': '9.0.1.0.0',
|
||||||
'license': 'LGPL-3',
|
'license': 'LGPL-3',
|
||||||
'category': 'RMA',
|
'category': 'RMA',
|
||||||
@@ -18,19 +18,16 @@
|
|||||||
],
|
],
|
||||||
'data': ['security/rma.xml',
|
'data': ['security/rma.xml',
|
||||||
'security/ir.model.access.csv',
|
'security/ir.model.access.csv',
|
||||||
|
|
||||||
'data/rma_sequence.xml',
|
'data/rma_sequence.xml',
|
||||||
'data/stock_data.xml',
|
'data/stock_data.xml',
|
||||||
'data/rma_operation.xml',
|
'data/rma_operation.xml',
|
||||||
'views/rma_order_view.xml',
|
'views/rma_order_view.xml',
|
||||||
'views/rma_operation_view.xml',
|
'views/rma_operation_view.xml',
|
||||||
'views/rma_rule_view.xml',
|
|
||||||
'views/rma_order_line_view.xml',
|
'views/rma_order_line_view.xml',
|
||||||
'views/stock_view.xml',
|
'views/stock_view.xml',
|
||||||
'views/stock_warehouse.xml',
|
'views/stock_warehouse.xml',
|
||||||
'views/product_view.xml',
|
'views/product_view.xml',
|
||||||
'views/procurement_view.xml',
|
'views/procurement_view.xml',
|
||||||
'views/res_company_view.xml',
|
|
||||||
'wizards/rma_make_picking_view.xml',
|
'wizards/rma_make_picking_view.xml',
|
||||||
'wizards/rma_add_stock_move_view.xml',
|
'wizards/rma_add_stock_move_view.xml',
|
||||||
'wizards/stock_config_settings.xml',
|
'wizards/stock_config_settings.xml',
|
||||||
|
|||||||
@@ -72,10 +72,4 @@
|
|||||||
<field name="out_route_id" ref="rma.route_rma_dropship"/>
|
<field name="out_route_id" ref="rma.route_rma_dropship"/>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record id="rma_rule_always" model="rma.rule">
|
|
||||||
<field name="name">Always</field>
|
|
||||||
<field name="code">alw</field>
|
|
||||||
<field name="approval_policy">always</field>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
</odoo>
|
</odoo>
|
||||||
|
|||||||
@@ -5,9 +5,8 @@
|
|||||||
from . import rma_order
|
from . import rma_order
|
||||||
from . import rma_order_line
|
from . import rma_order_line
|
||||||
from . import rma_operation
|
from . import rma_operation
|
||||||
from . import rma_rule
|
|
||||||
from . import stock
|
from . import stock
|
||||||
from . import stock_warehouse
|
from . import stock_warehouse
|
||||||
from . import product
|
from . import product
|
||||||
|
from . import product_category
|
||||||
from . import procurement
|
from . import procurement
|
||||||
from . import res_company
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ class ProcurementOrder(models.Model):
|
|||||||
if procurement.rma_line_id:
|
if procurement.rma_line_id:
|
||||||
line = procurement.rma_line_id
|
line = procurement.rma_line_id
|
||||||
res['rma_line_id'] = line.id
|
res['rma_line_id'] = line.id
|
||||||
if line.delivery_address_id and line.delivery_address_id.id:
|
if line.delivery_address_id:
|
||||||
res['partner_id'] = line.delivery_address_id.id
|
res['partner_id'] = line.delivery_address_id.id
|
||||||
elif line.invoice_line_id.invoice_id.partner_id:
|
elif line.invoice_line_id.invoice_id.partner_id:
|
||||||
res['partner_id'] = line.invoice_id.partner_id.id
|
res['partner_id'] = line.invoice_id.partner_id.id
|
||||||
|
|||||||
@@ -5,15 +5,10 @@
|
|||||||
from openerp import fields, models
|
from openerp import fields, models
|
||||||
|
|
||||||
|
|
||||||
class ProductCategory(models.Model):
|
|
||||||
_inherit = 'product.category'
|
|
||||||
|
|
||||||
rma_operation_id = fields.Many2one(
|
|
||||||
comodel_name="rma.operation", string="RMA Operation")
|
|
||||||
|
|
||||||
|
|
||||||
class ProductTemplate(models.Model):
|
class ProductTemplate(models.Model):
|
||||||
_inherit = 'product.template'
|
_inherit = 'product.template'
|
||||||
|
|
||||||
rma_operation_id = fields.Many2one(
|
rma_operation_id = fields.Many2one(
|
||||||
comodel_name="rma.operation", string="RMA Operation")
|
comodel_name="rma.operation", string="RMA Operation")
|
||||||
|
rma_approval_policy = fields.Selection(
|
||||||
|
related="categ_id.rma_approval_policy", readonly=True)
|
||||||
|
|||||||
20
rma/models/product_category.py
Normal file
20
rma/models/product_category.py
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
# -*- 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)
|
||||||
|
|
||||||
|
from openerp import fields, models
|
||||||
|
|
||||||
|
|
||||||
|
class ProductCategory(models.Model):
|
||||||
|
_inherit = "product.category"
|
||||||
|
|
||||||
|
rma_approval_policy = fields.Selection(
|
||||||
|
selection=[('one_step', 'One step'), ('two_step', 'Two steps')],
|
||||||
|
string="RMA Approval Policy", required=True, default='one_step',
|
||||||
|
help="Options: \n "
|
||||||
|
"* One step: Always auto-approve RMAs that only contain "
|
||||||
|
"products within categories with this policy.\n"
|
||||||
|
"* Two steps: A RMA containing a product within a category with "
|
||||||
|
"this policy will request the RMA manager approval.")
|
||||||
|
rma_operation_id = fields.Many2one(
|
||||||
|
comodel_name="rma.operation", string="RMA Operation")
|
||||||
@@ -1,11 +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 models, fields
|
|
||||||
|
|
||||||
|
|
||||||
class ResCompany(models.Model):
|
|
||||||
_inherit = 'res.company'
|
|
||||||
|
|
||||||
rma_rule_id = fields.Many2one('rma.rule', 'Default RMA Approval Policy')
|
|
||||||
@@ -14,12 +14,6 @@ class RmaOrder(models.Model):
|
|||||||
_name = "rma.order"
|
_name = "rma.order"
|
||||||
_inherit = ['mail.thread']
|
_inherit = ['mail.thread']
|
||||||
|
|
||||||
@api.model
|
|
||||||
def _compute_rule_id(self):
|
|
||||||
if self.company_id and self.company_id.id:
|
|
||||||
if self.company_id.rma_rule_id and self.company_id.rma_rule_id.id:
|
|
||||||
self.rule_id = self.company_id.rma_rule_id
|
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def _get_default_type(self):
|
def _get_default_type(self):
|
||||||
if 'supplier' in self.env.context:
|
if 'supplier' in self.env.context:
|
||||||
@@ -79,8 +73,6 @@ class RmaOrder(models.Model):
|
|||||||
requested_by = fields.Many2one('res.users', 'Requested by',
|
requested_by = fields.Many2one('res.users', 'Requested by',
|
||||||
track_visibility='onchange',
|
track_visibility='onchange',
|
||||||
default=lambda self: self.env.user)
|
default=lambda self: self.env.user)
|
||||||
rule_id = fields.Many2one('rma.rule', string='Approval Criteria',
|
|
||||||
compute=_compute_rule_id)
|
|
||||||
rma_line_ids = fields.One2many('rma.order.line', 'rma_id',
|
rma_line_ids = fields.One2many('rma.order.line', 'rma_id',
|
||||||
string='RMA lines')
|
string='RMA lines')
|
||||||
in_shipment_count = fields.Integer(compute=_compute_in_shipment_count,
|
in_shipment_count = fields.Integer(compute=_compute_in_shipment_count,
|
||||||
@@ -163,12 +155,12 @@ class RmaOrder(models.Model):
|
|||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def action_rma_to_approve(self):
|
def action_rma_to_approve(self):
|
||||||
|
self.write({'state': 'to_approve'})
|
||||||
for rec in self:
|
for rec in self:
|
||||||
rec.state = 'to_approve'
|
pols = rec.mapped('rma_line_ids.product_id.rma_approval_policy')
|
||||||
if rec.rule_id and rec.rule_id.id:
|
if not any(x != 'one_step' for x in pols):
|
||||||
if rec.rule_id.approval_policy == 'always':
|
rec.write({'assigned_to': self.env.uid})
|
||||||
rec.assigned_to = self.env.uid
|
rec.action_rma_approve()
|
||||||
rec.action_rma_approve()
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
@@ -180,8 +172,7 @@ class RmaOrder(models.Model):
|
|||||||
@api.multi
|
@api.multi
|
||||||
def action_rma_approve(self):
|
def action_rma_approve(self):
|
||||||
# pass the supplier address in case this is a customer RMA
|
# pass the supplier address in case this is a customer RMA
|
||||||
for rec in self:
|
self.write({'state': 'approved'})
|
||||||
rec.state = 'approved'
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
|
|||||||
@@ -1,16 +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 RmaRule(models.Model):
|
|
||||||
_name = 'rma.rule'
|
|
||||||
_description = 'RMA Approval Conditions'
|
|
||||||
|
|
||||||
name = fields.Char('Description', required=True)
|
|
||||||
code = fields.Char('Code', required=True)
|
|
||||||
approval_policy = fields.Selection([
|
|
||||||
('always', 'Always')], string="Approval Policy",
|
|
||||||
required=True, default='always')
|
|
||||||
@@ -8,6 +8,7 @@
|
|||||||
<field name="inherit_id" ref="product.product_category_form_view" />
|
<field name="inherit_id" ref="product.product_category_form_view" />
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<field name="type" position="after">
|
<field name="type" position="after">
|
||||||
|
<field name="rma_approval_policy"/>
|
||||||
<field name="rma_operation_id" groups="rma.group_rma_customer_user,rma.group_rma_supplier_user"/>
|
<field name="rma_operation_id" groups="rma.group_rma_customer_user,rma.group_rma_supplier_user"/>
|
||||||
</field>
|
</field>
|
||||||
</field>
|
</field>
|
||||||
@@ -20,6 +21,7 @@
|
|||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<group name="inventory" position="inside">
|
<group name="inventory" position="inside">
|
||||||
<group name="rma" groups="rma.group_rma_customer_user,rma.group_rma_supplier_user">
|
<group name="rma" groups="rma.group_rma_customer_user,rma.group_rma_supplier_user">
|
||||||
|
<field name="rma_approval_policy"/>
|
||||||
<field name="rma_operation_id"/>
|
<field name="rma_operation_id"/>
|
||||||
</group>
|
</group>
|
||||||
</group>
|
</group>
|
||||||
|
|||||||
@@ -1,17 +0,0 @@
|
|||||||
<?xml version="1.0"?>
|
|
||||||
<odoo>
|
|
||||||
<data>
|
|
||||||
<record id="view_company_form" model="ir.ui.view">
|
|
||||||
<field name="name">base_phone.company.form</field>
|
|
||||||
<field name="model">res.company</field>
|
|
||||||
<field name="inherit_id" ref="base.view_company_form" />
|
|
||||||
<field name="arch" type="xml">
|
|
||||||
<group name="account_grp" position="after">
|
|
||||||
<group name="rma" string="RMA">
|
|
||||||
<field name="rma_rule_id"/>
|
|
||||||
</group>
|
|
||||||
</group>
|
|
||||||
</field>
|
|
||||||
</record>
|
|
||||||
</data>
|
|
||||||
</odoo>
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<odoo>
|
|
||||||
<data>
|
|
||||||
<record id="rma_rule_tree" model="ir.ui.view">
|
|
||||||
<field name="name">rma.rule.tree</field>
|
|
||||||
<field name="model">rma.rule</field>
|
|
||||||
<field name="arch" type="xml">
|
|
||||||
<tree string="RMA rules">
|
|
||||||
<field name="code"/>
|
|
||||||
<field name="name"/>
|
|
||||||
</tree>
|
|
||||||
</field>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
<record id="rma_rule_form" model="ir.ui.view">
|
|
||||||
<field name="name">rma.rule.form</field>
|
|
||||||
<field name="model">rma.rule</field>
|
|
||||||
<field name="arch" type="xml">
|
|
||||||
<form string="RMA Rules">
|
|
||||||
<group colspan="4" col="2">
|
|
||||||
<group name="description"
|
|
||||||
string="Description">
|
|
||||||
<field name="code"/>
|
|
||||||
<field name="name"/>
|
|
||||||
</group>
|
|
||||||
<group name="policies"
|
|
||||||
string="Policies">
|
|
||||||
<field name="approval_policy"/>
|
|
||||||
</group>
|
|
||||||
</group>
|
|
||||||
</form>
|
|
||||||
</field>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
<record id="action_rma_rule" model="ir.actions.act_window">
|
|
||||||
<field name="name">Rules</field>
|
|
||||||
<field name="res_model">rma.rule</field>
|
|
||||||
<field name="view_type">form</field>
|
|
||||||
<field name="view_mode">tree,form</field>
|
|
||||||
<field name="view_id" ref="rma_rule_tree"/>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
<menuitem id="menu_rma_rule"
|
|
||||||
name="Rules"
|
|
||||||
groups="rma.group_rma_manager"
|
|
||||||
sequence="36"
|
|
||||||
parent="rma.menu_rma_config"
|
|
||||||
action="action_rma_rule"/>
|
|
||||||
|
|
||||||
</data>
|
|
||||||
</odoo>
|
|
||||||
Reference in New Issue
Block a user