[MOV] helpdesk_rma: from hibou-suite-enterprise:11.0

This commit is contained in:
Jared Kipe
2020-10-29 11:20:02 -07:00
parent 750e13cf46
commit c125335b29
7 changed files with 84 additions and 0 deletions

1
helpdesk_rma/__init__.py Normal file
View File

@@ -0,0 +1 @@
from . import models

21
helpdesk_rma/__manifest__.py Executable file
View File

@@ -0,0 +1,21 @@
{
'name': 'Helpdesk RMA',
'summary': 'Adds RMA functionality to the Helpdesk App',
'version': '11.0.1.0.0',
'author': "Hibou Corp.",
'category': 'Helpdesk',
'license': 'AGPL-3',
'images': [],
'website': "https://hibou.io",
'description': "Adds functionality to the Helpdesk App",
'depends': [
'helpdesk',
'rma',
],
'demo': [],
'data': [
'views/helpdesk_views.xml',
],
'auto_install': False,
'installable': True,
}

View File

@@ -0,0 +1 @@
from . import helpdesk

View File

@@ -0,0 +1,26 @@
from odoo import api, models, fields
from logging import getLogger
_logger = getLogger(__name__)
class Ticket(models.Model):
_inherit = 'helpdesk.ticket'
rma_count = fields.Integer(compute='_compute_rma_count')
def _compute_rma_count(self):
for ticket in self:
if ticket.partner_id:
ticket.rma_count = self.env['rma.rma'].search_count([('partner_id', 'child_of', ticket.partner_id.id)])
else:
ticket.rma_count = 0
def action_partner_rma(self):
self.ensure_one()
action = self.env.ref('rma.action_rma_rma').read()[0]
action['context'] = {
'search_default_partner_id': self.partner_id.id,
}
return action

View File

@@ -0,0 +1 @@
from . import test_helpdesk

View File

@@ -0,0 +1,14 @@
from odoo.tests import common
class TestHelpdesk(common.TransactionCase):
# We need to test Stage, Ticket, Server, and Filter Classes
# We created a couple fields per model and a couple methods
# for our functionality implementation
def setUp(self):
pass
def test_helpdesk_filter(self):
pass

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- Helpdesk Ticket -->
<record id="helpdesk_ticket_view_form_inherit" model="ir.ui.view">
<field name="name">helpdesk.ticket.form.inherit</field>
<field name="model">helpdesk.ticket</field>
<field name="inherit_id" ref="helpdesk.helpdesk_ticket_view_form" />
<field name="arch" type="xml">
<xpath expr="//button[@name='toggle_active']" position="before">
<button class="oe_stat_button" type="object" name="action_partner_rma"
context="{'search_default_partner_id': partner_id}"
icon="fa-cubes">
<field string="RMAs" name="rma_count" widget="statinfo"/>
</button>
</xpath>
</field>
</record>
</odoo>