[12.0][MIG] Migrate rma module to v12.0

This commit is contained in:
Adrià Gil Sorribes
2018-11-19 16:53:43 +01:00
committed by Florian da Costa
parent d6dde751ee
commit 6716a34b7b
15 changed files with 68 additions and 60 deletions

View File

@@ -3,7 +3,7 @@
{
'name': 'RMA (Return Merchandise Authorization)',
'version': '11.0.2.0.0',
'version': '12.0.2.0.0',
'license': 'LGPL-3',
'category': 'RMA',
'summary': 'Introduces the return merchandise authorization (RMA) process '

View File

@@ -141,9 +141,9 @@
<field name="rma_selectable" eval="True"/>
</record>
<record id="rule_rma_customer_in_pull" model="procurement.rule">
<record id="rule_rma_customer_in_pull" model="stock.rule">
<field name="name">Customer → RMA</field>
<field name="action">move</field>
<field name="action">pull</field>
<field name="warehouse_id" ref="stock.warehouse0"/>
<field name="location_src_id" ref="stock.stock_location_customers"/>
<field name="location_id" ref="rma.location_rma"/>
@@ -152,9 +152,9 @@
<field name="picking_type_id" ref="rma.picking_type_rma_cust_in"/>
</record>
<record id="rule_rma_customer_out_pull" model="procurement.rule">
<record id="rule_rma_customer_out_pull" model="stock.rule">
<field name="name">RMA → Customer</field>
<field name="action">move</field>
<field name="action">pull</field>
<field name="warehouse_id" ref="stock.warehouse0"/>
<field name="location_src_id" ref="rma.location_rma"/>
<field name="location_id" ref="stock.stock_location_customers"/>
@@ -163,9 +163,9 @@
<field name="picking_type_id" ref="rma.picking_type_rma_cust_out"/>
</record>
<record id="rule_rma_supplier_out_pull" model="procurement.rule">
<record id="rule_rma_supplier_out_pull" model="stock.rule">
<field name="name">RMA → Supplier</field>
<field name="action">move</field>
<field name="action">pull</field>
<field name="warehouse_id" ref="stock.warehouse0"/>
<field name="location_id" ref="stock.stock_location_suppliers"/>
<field name="location_src_id" ref="rma.location_rma"/>
@@ -174,9 +174,9 @@
<field name="picking_type_id" ref="rma.picking_type_rma_sup_out"/>
</record>
<record id="rule_rma_supplier_in_pull" model="procurement.rule">
<record id="rule_rma_supplier_in_pull" model="stock.rule">
<field name="name">Supplier → RMA</field>
<field name="action">move</field>
<field name="action">pull</field>
<field name="warehouse_id" ref="stock.warehouse0"/>
<field name="location_id" ref="rma.location_rma"/>
<field name="location_src_id" ref="stock.stock_location_suppliers"/>
@@ -185,9 +185,9 @@
<field name="picking_type_id" ref="rma.picking_type_rma_sup_in"/>
</record>
<record id="rule_rma_dropship_return" model="procurement.rule">
<record id="rule_rma_dropship_return" model="stock.rule">
<field name="name">Customer → Supplier</field>
<field name="action">move</field>
<field name="action">pull</field>
<field name="location_id" ref="stock.stock_location_suppliers"/>
<field name="location_src_id" ref="stock.stock_location_customers"/>
<field name="procure_method">make_to_stock</field>
@@ -196,9 +196,9 @@
ref="rma.picking_type_rma_dropship_return"/>
</record>
<record id="rule_rma_dropship" model="procurement.rule">
<record id="rule_rma_dropship" model="stock.rule">
<field name="name">Supplier → Customer</field>
<field name="action">move</field>
<field name="action">pull</field>
<field name="location_id" ref="stock.stock_location_customers"/>
<field name="location_src_id" ref="stock.stock_location_suppliers"/>
<field name="procure_method">make_to_stock</field>

View File

@@ -61,7 +61,7 @@
</record>
<!--Routes-->
<record id="route_rma_customer" model='stock.location.route'>
<record id="route_rma_customer" model="stock.location.route">
<field name="name">RMA Customer</field>
<field name="sequence">10</field>
<field name="sale_selectable" eval="False"/>
@@ -71,7 +71,7 @@
<field name="rma_selectable" eval="True"/>
</record>
<record id="route_rma_supplier" model='stock.location.route'>
<record id="route_rma_supplier" model="stock.location.route">
<field name="name">RMA Supplier</field>
<field name="sequence">10</field>
<field name="sale_selectable" eval="False"/>
@@ -81,7 +81,7 @@
<field name="rma_selectable" eval="True"/>
</record>
<record id="route_rma_dropship" model='stock.location.route'>
<record id="route_rma_dropship" model="stock.location.route">
<field name="name">RMA Dropship</field>
<field name="sequence">10</field>
<field name="sale_selectable" eval="False"/>
@@ -92,9 +92,9 @@
</record>
<!--Dropship rules-->
<record id="rule_rma_dropship_return" model="procurement.rule">
<record id="rule_rma_dropship_return" model="stock.rule">
<field name="name">Customer → Supplier</field>
<field name="action">move</field>
<field name="action">pull</field>
<field name="warehouse_id" ref="stock.warehouse0"/>
<field name="location_id" ref="stock.stock_location_suppliers"/>
<field name="location_src_id" ref="stock.stock_location_customers"/>
@@ -104,9 +104,9 @@
ref="rma.picking_type_rma_dropship_return"/>
</record>
<record id="rule_rma_dropship" model="procurement.rule">
<record id="rule_rma_dropship" model="stock.rule">
<field name="name">Supplier → Customer</field>
<field name="action">move</field>
<field name="action">pull</field>
<field name="warehouse_id" ref="stock.warehouse0"/>
<field name="location_id" ref="stock.stock_location_customers"/>
<field name="location_src_id" ref="stock.stock_location_suppliers"/>
@@ -117,8 +117,8 @@
</record>
<!-- Enable the RMA in warehouse0 -->
<record id='stock.warehouse0' model='stock.warehouse'>
<field name='rma_in_this_wh' eval='True'/>
<record id="stock.warehouse0" model="stock.warehouse">
<field name="rma_in_this_wh" eval="True"/>
</record>
</odoo>

View File

@@ -5,7 +5,7 @@ from odoo import fields, models
class ProcurementRule(models.Model):
_inherit = 'procurement.rule'
_inherit = 'stock.rule'
rma_line_id = fields.Many2one(
comodel_name='rma.order.line', string='RMA line',

View File

@@ -70,7 +70,7 @@ class RmaOrderLine(models.Model):
@api.multi
def _get_rma_move_qty(self, states, direction='in'):
for rec in self:
product_obj = self.env['product.uom']
product_obj = self.env['uom.uom']
qty = 0.0
if direction == 'in':
op = ops['=']
@@ -238,7 +238,7 @@ class RmaOrderLine(models.Model):
readonly=True, states={'draft': [('readonly', False)]},
)
uom_id = fields.Many2one(
comodel_name='product.uom', string='Unit of Measure',
comodel_name='uom.uom', string='Unit of Measure',
required=True,
readonly=True, states={'draft': [('readonly', False)]},
)

View File

@@ -33,16 +33,16 @@ class StockWarehouse(models.Model):
"for this warehouse.",
)
rma_customer_in_pull_id = fields.Many2one(
comodel_name='procurement.rule', string="RMA Customer In Rule",
comodel_name='stock.rule', string="RMA Customer In Rule",
)
rma_customer_out_pull_id = fields.Many2one(
comodel_name='procurement.rule', string="RMA Customer Out Rule",
comodel_name='stock.rule', string="RMA Customer Out Rule",
)
rma_supplier_in_pull_id = fields.Many2one(
comodel_name='procurement.rule', string="RMA Supplier In Rule",
comodel_name='stock.rule', string="RMA Supplier In Rule",
)
rma_supplier_out_pull_id = fields.Many2one(
comodel_name='procurement.rule', string="RMA Supplier Out Rule",
comodel_name='stock.rule', string="RMA Supplier Out Rule",
)
@api.multi
@@ -176,8 +176,10 @@ class StockWarehouse(models.Model):
customer_loc, supplier_loc = self._get_partner_locations()
# TODO: company_id?
rma_rules['rma_customer_in'] = {
'name': self._format_rulename(self, customer_loc, self.lot_rma_id),
'action': 'move',
'name': self._format_rulename(self,
customer_loc,
self.lot_rma_id.name),
'action': 'pull',
'warehouse_id': self.id,
'location_src_id': customer_loc.id,
'location_id': self.lot_rma_id.id,
@@ -187,8 +189,10 @@ class StockWarehouse(models.Model):
'active': True,
}
rma_rules['rma_customer_out'] = {
'name': self._format_rulename(self, self.lot_rma_id, customer_loc),
'action': 'move',
'name': self._format_rulename(self,
self.lot_rma_id,
customer_loc.name),
'action': 'pull',
'warehouse_id': self.id,
'location_src_id': self.lot_rma_id.id,
'location_id': customer_loc.id,
@@ -198,8 +202,10 @@ class StockWarehouse(models.Model):
'active': True,
}
rma_rules['rma_supplier_in'] = {
'name': self._format_rulename(self, supplier_loc, self.lot_rma_id),
'action': 'move',
'name': self._format_rulename(self,
supplier_loc,
self.lot_rma_id.name),
'action': 'pull',
'warehouse_id': self.id,
'location_src_id': supplier_loc.id,
'location_id': self.lot_rma_id.id,
@@ -209,8 +215,10 @@ class StockWarehouse(models.Model):
'active': True,
}
rma_rules['rma_supplier_out'] = {
'name': self._format_rulename(self, self.lot_rma_id, supplier_loc),
'action': 'move',
'name': self._format_rulename(self,
self.lot_rma_id,
supplier_loc.name),
'action': 'pull',
'warehouse_id': self.id,
'location_src_id': self.lot_rma_id.id,
'location_id': supplier_loc.id,
@@ -222,7 +230,7 @@ class StockWarehouse(models.Model):
return rma_rules
def _create_or_update_rma_pull(self):
rule_obj = self.env['procurement.rule']
rule_obj = self.env['stock.rule']
for wh in self:
rules_dict = wh.get_rma_rules_dict()
if wh.rma_customer_in_pull_id:

View File

@@ -72,7 +72,7 @@
<td><span t-field="doc.product_id"/></td>
<td class="text-right">
<span t-field="doc.product_qty"/>
<span t-field="doc.uom_id" groups="product.group_uom"/>
<span t-field="doc.uom_id" groups="uom.group_uom"/>
</td>
<td class="text-right">
<span t-field="doc.price_unit" t-options='{"widget": "monetary", "display_currency": doc.currency_id}'/>

View File

@@ -1,8 +1,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.tests import common
from openerp.exceptions import ValidationError
from odoo.tests import common
from odoo.exceptions import ValidationError
class TestRma(common.SavepointCase):
@@ -27,9 +27,9 @@ class TestRma(common.SavepointCase):
'rma.rma_operation_ds_replace')
cls.product_id = cls.env.ref('product.product_product_4')
cls.product_1 = cls.env.ref('product.product_product_25')
cls.product_2 = cls.env.ref('product.product_product_17')
cls.product_2 = cls.env.ref('product.product_product_22')
cls.product_3 = cls.env.ref('product.product_product_20')
cls.uom_unit = cls.env.ref('product.product_uom_unit')
cls.uom_unit = cls.env.ref('uom.product_uom_unit')
# assign an operation
cls.product_1.write(
{'rma_customer_operation_id': cls.rma_cust_replace_op_id.id,
@@ -48,7 +48,7 @@ class TestRma(common.SavepointCase):
'stock.stock_location_customers')
cls.supplier_location = cls.env.ref(
'stock.stock_location_suppliers')
cls.product_uom_id = cls.env.ref('product.product_uom_unit')
cls.product_uom_id = cls.env.ref('uom.product_uom_unit')
# Customer RMA:
products2move = [(cls.product_1, 3), (cls.product_2, 5),
(cls.product_3, 2)]

View File

@@ -15,7 +15,7 @@
<field name="origin"/>
<field name="operation_id"/>
<field name="supplier_address_id"/>
<field name="uom_id" groups="product.group_uom"/>
<field name="uom_id" groups="uom.group_uom"/>
<field name="product_qty"/>
<field name="price_unit"/>
<field name="state"/>
@@ -36,7 +36,7 @@
<field name="rma_id"/>
<field name="origin"/>
<field name="operation_id" domain="[('type','=','supplier')]"/>
<field name="uom_id" groups="product.group_uom"/>
<field name="uom_id" groups="uom.group_uom"/>
<field name="product_qty"/>
<field name="price_unit"/>
<field name="state"/>
@@ -115,7 +115,7 @@
<group name="product_qty" string="Quantity">
<field name="product_qty"/>
<field name="price_unit"/>
<field name="uom_id" groups="product.group_uom"/>
<field name="uom_id" groups="uom.group_uom"/>
</group>
</group>
<group name="main_info" string="Origin">
@@ -286,7 +286,7 @@
</group>
<group name="product_qty" string="Quantity">
<field name="product_qty"/>
<field name="uom_id" groups="product.group_uom"/>
<field name="uom_id" groups="uom.group_uom"/>
<field name="price_unit"/>
</group>
</group>
@@ -388,14 +388,14 @@
<field name="product_id"/>
<field name="lot_id"/>
<separator/>
<filter domain="[('assigned_to','=',uid)]" help="My RMAs"/>
<filter name="assigned_to" domain="[('assigned_to','=',uid)]" help="My RMAs"/>
<separator/>
<group name="stock_quantities" groups="stock.group_stock_user">
<filter domain="[('state','!=', 'done'),('qty_to_receive','>',0.0)]" help="To Receive"/>
<filter domain="[('state','!=', 'done'),('qty_to_deliver','>',0.0)]" help="To Deliver"/>
<filter name="to_receive" domain="[('state','!=', 'done'),('qty_to_receive','>',0.0)]" help="To Receive"/>
<filter name="to_deliver" domain="[('state','!=', 'done'),('qty_to_deliver','>',0.0)]" help="To Deliver"/>
</group>
<group name="rma_supplier_quantities">
<filter domain="[('state','!=', 'done'),('qty_to_supplier_rma','>',0.0)]" help="To Send to Supplier RMA"/>
<filter name="to_send_to_supplier" domain="[('state','!=', 'done'),('qty_to_supplier_rma','>',0.0)]" help="To Send to Supplier RMA"/>
</group>
<group expand="0" string="Group By">
<filter name="status" string="State" domain="[]"

View File

@@ -92,7 +92,7 @@
<field name="product_id"/>
<field name="lot_id" groups="stock.group_production_lot"/>
<field name="name"/>
<field name="uom_id" groups="product.group_uom"/>
<field name="uom_id" groups="uom.group_uom"/>
<field name="operation_id"/>
<field name="product_qty"/>
<field name="price_unit"/>
@@ -180,7 +180,7 @@
<field name="product_id"/>
<field name="lot_id" groups="stock.group_production_lot"/>
<field name="name"/>
<field name="uom_id" groups="product.group_uom"/>
<field name="uom_id" groups="uom.group_uom"/>
<field name="operation_id"/>
<field name="product_qty"/>
<field name="origin"/>

View File

@@ -17,7 +17,7 @@
<tree>
<field name="product_id"/>
<field name="product_uom_qty"/>
<field name="product_uom" string="Unit of Measure" groups="product.group_uom"/>
<field name="product_uom" string="Unit of Measure" groups="uom.group_uom"/>
<field name="product_packaging" domain="[('product_id','=',product_id)]" groups="product.group_stock_packaging"/>
<field name="picking_id"/>
<field name="location_id" groups="stock.group_locations"/>

View File

@@ -254,5 +254,5 @@ class RmaMakePickingItem(models.TransientModel):
qty_to_deliver = fields.Float(
string='Quantity To Deliver',
digits=dp.get_precision('Product Unit of Measure'))
uom_id = fields.Many2one('product.uom', string='Unit of Measure',
uom_id = fields.Many2one('uom.uom', string='Unit of Measure',
readonly=True)

View File

@@ -12,7 +12,7 @@
<field name="rma_id"/>
<field name="product_id"/>
<field name="product_qty"/>
<field name="uom_id" groups="product.group_uom"/>
<field name="uom_id" groups="uom.group_uom"/>
<field name="qty_to_receive" readonly="0"/>
</tree>
</field>
@@ -40,7 +40,7 @@
<field name="rma_id"/>
<field name="product_id"/>
<field name="product_qty"/>
<field name="uom_id" groups="product.group_uom"/>
<field name="uom_id" groups="uom.group_uom"/>
<field name="qty_to_deliver" readonly="0"/>
</tree>
</field>

View File

@@ -189,7 +189,7 @@ class RmaLineMakeRmaOrderItem(models.TransientModel):
product_id = fields.Many2one('product.product',
related='line_id.product_id', readony=True)
name = fields.Char(related='line_id.name', readonly=True)
uom_id = fields.Many2one('product.uom', string='UoM', readonly=True)
uom_id = fields.Many2one('uom.uom', string='UoM', readonly=True)
product_qty = fields.Float(string='Quantity',
digits=dp.get_precision('Product UoS'))
operation_id = fields.Many2one(

View File

@@ -32,7 +32,7 @@
<field name="operation_id"/>
<field name="product_qty"/>
<field name="uom_id"
groups="product.group_uom"/>
groups="uom.group_uom"/>
</tree>
</field>
</group>