[MIG] rma_sale: Migration to 12.0

This commit is contained in:
Akim Juillerat
2019-03-12 17:59:40 +01:00
committed by JasminSForgeFlow
parent ebd7f9b810
commit e684a39b3a
10 changed files with 18 additions and 25 deletions

View File

@@ -3,7 +3,7 @@
{
'name': 'RMA Sale',
'version': '11.0.1.0.0',
'version': '12.0.1.0.0',
'license': 'LGPL-3',
'category': 'RMA',
'summary': 'Links RMA with Sales Orders',

View File

@@ -6,14 +6,15 @@ from odoo import api, fields, models
class RmaOrder(models.Model):
_inherit = "rma.order"
@api.multi
@api.depends('rma_line_ids', 'rma_line_ids.sale_line_id',
'rma_line_ids.sale_line_id.order_id')
def _compute_sales_count(self):
for rma in self:
sales = rma.mapped('rma_line_ids.sale_line_id.order_id')
rma.sale_count = len(sales)
sale_count = fields.Integer(
compute=_compute_sales_count, string='# of Sales')
compute='_compute_sales_count', string='# of Sales')
@api.model
def _get_line_domain(self, rma_id, line):

View File

@@ -27,7 +27,7 @@ class RmaOrderLine(models.Model):
for rec in self:
rec.qty_sold = rec._get_rma_sold_qty()
@api.multi
@api.depends('sale_line_ids', 'sale_line_ids.order_id')
def _compute_sales_count(self):
for line in self:
sales = line.mapped('sale_line_ids.order_id')
@@ -40,7 +40,6 @@ class RmaOrderLine(models.Model):
)
sale_id = fields.Many2one(
string="Source Sales Order", related='sale_line_id.order_id',
readonly=True,
)
sale_line_ids = fields.One2many(
comodel_name='sale.order.line', inverse_name='rma_line_id',
@@ -49,12 +48,12 @@ class RmaOrderLine(models.Model):
qty_to_sell = fields.Float(
string='Qty To Sell', copy=False,
digits=dp.get_precision('Product Unit of Measure'),
readonly=True, compute=_compute_qty_to_sell,
readonly=True, compute='_compute_qty_to_sell',
store=True)
qty_sold = fields.Float(
string='Qty Sold', copy=False,
digits=dp.get_precision('Product Unit of Measure'),
readonly=True, compute=_compute_qty_sold,
readonly=True, compute='_compute_qty_sold',
store=True)
sale_policy = fields.Selection(selection=[
('no', 'Not required'), ('ordered', 'Based on Ordered Quantities'),
@@ -62,7 +61,7 @@ class RmaOrderLine(models.Model):
string="Sale Policy", default='no', required=True,
readonly=True, states={'draft': [('readonly', False)]})
sales_count = fields.Integer(
compute=_compute_sales_count, string='# of Sales')
compute='_compute_sales_count', string='# of Sales')
@api.onchange('product_id', 'partner_id')
def _onchange_product_id(self):

View File

@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record id="rma_operation_tree" model="ir.ui.view">
<field name="name">rma.operation.tree</field>
@@ -24,5 +23,4 @@
</field>
</record>
</data>
</odoo>

View File

@@ -103,8 +103,8 @@
<field name="inherit_id" ref="rma.view_rma_rma_line_filter"/>
<field name="arch" type="xml">
<group name="stock_quantities" position="after">
<group name="sale_quantities" groups="base.group_sale_salesman">
<filter domain="[('state','!=', 'done'),('qty_to_sell','>',0.0)]" help="To Sell"/>
<group name="sale_quantities" groups="sales_team.group_sale_salesman">
<filter domain="[('state','!=', 'done'),('qty_to_sell','>',0.0)]" help="To Sell" name="to_sell"/>
</group>
</group>
</field>

View File

@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record id="view_rma_form" model="ir.ui.view">
<field name="name">rma.order.form</field>
<field name="model">rma.order</field>
@@ -10,12 +9,11 @@
<button type="object" name="action_view_sale_order"
class="oe_stat_button"
icon="fa-pencil-square-o"
groups="base.group_sale_salesman">
groups="sales_team.group_sale_salesman">
<field name="sale_count" widget="statinfo"
string="Origin SO"/>
</button>
</div>
</field>
</record>
</data>
</odoo>

View File

@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record id="view_order_form" model="ir.ui.view">
<field name="name">sale.order.form</field>
<field name="model">sale.order</field>
@@ -15,5 +14,4 @@
</xpath>
</field>
</record>
</data>
</odoo>

View File

@@ -32,7 +32,7 @@
<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="product_uom" string="Unit of Measure" groups="uom.group_uom"/>
<field name="price_subtotal" sum="Total" widget="monetary"/>
</tree>

View File

@@ -132,14 +132,14 @@ class RmaLineMakeSaleOrderItem(models.TransientModel):
line_id = fields.Many2one(
comodel_name='rma.order.line', string='RMA Line')
rma_id = fields.Many2one(
comodel_name='rma.order', related='line_id.rma_id')
comodel_name='rma.order', related='line_id.rma_id', readonly=False)
product_id = fields.Many2one(
comodel_name='product.product', string='Product')
name = fields.Char(string='Description')
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')
comodel_name='uom.uom', string='UoM')
out_warehouse_id = fields.Many2one(
comodel_name='stock.warehouse', string='Outbound Warehouse')
free_of_charge = fields.Boolean(string='Free of Charge')

View File

@@ -1,8 +1,8 @@
<?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>
<odoo>
<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>
@@ -33,7 +33,7 @@
<field name="name"/>
<field name="product_qty"/>
<field name="product_uom_id"
groups="product.group_uom"/>
groups="uom.group_uom"/>
<field name="free_of_charge"/>
</tree>
</field>
@@ -59,6 +59,5 @@
<field name="target">new</field>
</record>
</data>
</openerp>
</odoo>