mirror of
https://gitlab.com/hibou-io/hibou-odoo/suite.git
synced 2025-01-20 12:37:31 +02:00
IMP rma_sale Add SO Smart Button link to related RMAs.
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
{
|
{
|
||||||
'name': 'Hibou RMAs for Sale Orders',
|
'name': 'Hibou RMAs for Sale Orders',
|
||||||
'version': '11.0.1.0.0',
|
'version': '11.0.1.1.0',
|
||||||
'category': 'Sale',
|
'category': 'Sale',
|
||||||
'author': "Hibou Corp.",
|
'author': "Hibou Corp.",
|
||||||
'license': 'AGPL-3',
|
'license': 'AGPL-3',
|
||||||
@@ -16,6 +16,7 @@
|
|||||||
'data': [
|
'data': [
|
||||||
'security/ir.model.access.csv',
|
'security/ir.model.access.csv',
|
||||||
'views/rma_views.xml',
|
'views/rma_views.xml',
|
||||||
|
'views/sale_views.xml',
|
||||||
'wizard/rma_lines_views.xml',
|
'wizard/rma_lines_views.xml',
|
||||||
],
|
],
|
||||||
'demo': [
|
'demo': [
|
||||||
|
|||||||
@@ -1 +1,2 @@
|
|||||||
from . import rma
|
from . import rma
|
||||||
|
from . import sale
|
||||||
|
|||||||
14
rma_sale/models/sale.py
Normal file
14
rma_sale/models/sale.py
Normal file
@@ -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)
|
||||||
19
rma_sale/views/sale_views.xml
Normal file
19
rma_sale/views/sale_views.xml
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<odoo>
|
||||||
|
<record id="view_order_form_inherit" model="ir.ui.view">
|
||||||
|
<field name="name">sale.order.form.inherit</field>
|
||||||
|
<field name="model">sale.order</field>
|
||||||
|
<field name="inherit_id" ref="sale.view_order_form"/>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<xpath expr="//div[@name='button_box']" position="inside">
|
||||||
|
<button name="%(rma.action_rma_rma)d" type="action" class="oe_stat_button" icon="fa-cubes"
|
||||||
|
attrs="{'invisible': [('rma_count', '=', 0)]}"
|
||||||
|
context="{'search_default_sale_order_id': active_id}">
|
||||||
|
<div class="o_field_widget o_stat_info">
|
||||||
|
<span class="o_stat_value"><field name="rma_count"/></span> RMA
|
||||||
|
</div>
|
||||||
|
</button>
|
||||||
|
</xpath>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
</odoo>
|
||||||
Reference in New Issue
Block a user