diff --git a/rma_sale/__manifest__.py b/rma_sale/__manifest__.py index 508aa6f8..0b4a763f 100644 --- a/rma_sale/__manifest__.py +++ b/rma_sale/__manifest__.py @@ -3,7 +3,7 @@ { 'name': 'Hibou RMAs for Sale Orders', - 'version': '11.0.1.0.0', + 'version': '11.0.1.1.0', 'category': 'Sale', 'author': "Hibou Corp.", 'license': 'AGPL-3', @@ -16,6 +16,7 @@ 'data': [ 'security/ir.model.access.csv', 'views/rma_views.xml', + 'views/sale_views.xml', 'wizard/rma_lines_views.xml', ], 'demo': [ diff --git a/rma_sale/models/__init__.py b/rma_sale/models/__init__.py index 0031f431..7efbd9ec 100644 --- a/rma_sale/models/__init__.py +++ b/rma_sale/models/__init__.py @@ -1 +1,2 @@ from . import rma +from . import sale diff --git a/rma_sale/models/sale.py b/rma_sale/models/sale.py new file mode 100644 index 00000000..eee41038 --- /dev/null +++ b/rma_sale/models/sale.py @@ -0,0 +1,14 @@ +from odoo import api, fields, models + + +class SaleOrder(models.Model): + _inherit = 'sale.order' + + rma_count = fields.Integer(string='RMA Count', compute='_compute_rma_count', compute_sudo=True) + rma_ids = fields.One2many('rma.rma', 'sale_order_id', string='RMAs') + + @api.multi + @api.depends('rma_ids') + def _compute_rma_count(self): + for so in self: + so.rma_count = len(so.rma_ids) diff --git a/rma_sale/views/sale_views.xml b/rma_sale/views/sale_views.xml new file mode 100644 index 00000000..4713945b --- /dev/null +++ b/rma_sale/views/sale_views.xml @@ -0,0 +1,19 @@ + + + + sale.order.form.inherit + sale.order + + + + + + + + \ No newline at end of file