diff --git a/rma_sale/__manifest__.py b/rma_sale/__manifest__.py index 19cee716..4d107f8d 100644 --- a/rma_sale/__manifest__.py +++ b/rma_sale/__manifest__.py @@ -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', diff --git a/rma_sale/models/rma_order.py b/rma_sale/models/rma_order.py index db4d6a7a..f5236329 100644 --- a/rma_sale/models/rma_order.py +++ b/rma_sale/models/rma_order.py @@ -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): diff --git a/rma_sale/models/rma_order_line.py b/rma_sale/models/rma_order_line.py index 34039f0e..d4745bd8 100644 --- a/rma_sale/models/rma_order_line.py +++ b/rma_sale/models/rma_order_line.py @@ -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): diff --git a/rma_sale/views/rma_operation_view.xml b/rma_sale/views/rma_operation_view.xml index 7b5664b5..4ab4a56d 100644 --- a/rma_sale/views/rma_operation_view.xml +++ b/rma_sale/views/rma_operation_view.xml @@ -1,6 +1,5 @@ - rma.operation.tree @@ -24,5 +23,4 @@ - diff --git a/rma_sale/views/rma_order_line_view.xml b/rma_sale/views/rma_order_line_view.xml index 8412cf7c..c6d0f5e5 100644 --- a/rma_sale/views/rma_order_line_view.xml +++ b/rma_sale/views/rma_order_line_view.xml @@ -103,8 +103,8 @@ - - + + diff --git a/rma_sale/views/rma_order_view.xml b/rma_sale/views/rma_order_view.xml index 48ff6f61..f3fd9c47 100644 --- a/rma_sale/views/rma_order_view.xml +++ b/rma_sale/views/rma_order_view.xml @@ -1,6 +1,5 @@ - rma.order.form rma.order @@ -10,12 +9,11 @@ - diff --git a/rma_sale/views/sale_order_view.xml b/rma_sale/views/sale_order_view.xml index cbde25ce..f45b0852 100644 --- a/rma_sale/views/sale_order_view.xml +++ b/rma_sale/views/sale_order_view.xml @@ -1,6 +1,5 @@ - sale.order.form sale.order @@ -15,5 +14,4 @@ - diff --git a/rma_sale/wizards/rma_add_sale.xml b/rma_sale/wizards/rma_add_sale.xml index dd91f0dc..1f0bd4d8 100644 --- a/rma_sale/wizards/rma_add_sale.xml +++ b/rma_sale/wizards/rma_add_sale.xml @@ -32,7 +32,7 @@ - + diff --git a/rma_sale/wizards/rma_order_line_make_sale_order.py b/rma_sale/wizards/rma_order_line_make_sale_order.py index b16760c2..b5577c81 100644 --- a/rma_sale/wizards/rma_order_line_make_sale_order.py +++ b/rma_sale/wizards/rma_order_line_make_sale_order.py @@ -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') diff --git a/rma_sale/wizards/rma_order_line_make_sale_order_view.xml b/rma_sale/wizards/rma_order_line_make_sale_order_view.xml index 308e6e7c..78052ca1 100644 --- a/rma_sale/wizards/rma_order_line_make_sale_order_view.xml +++ b/rma_sale/wizards/rma_order_line_make_sale_order_view.xml @@ -1,8 +1,8 @@ - - + + RMA Line Make Sale Order rma.order.line.make.sale.order @@ -33,7 +33,7 @@ + groups="uom.group_uom"/> @@ -59,6 +59,5 @@ new - - +