add view and form for databases status

This commit is contained in:
dsalians601 2020-02-24 15:55:48 -05:00
parent 5a69b4d9f4
commit 278a11226a
4 changed files with 69 additions and 3 deletions

View File

@ -37,7 +37,6 @@ class Database(Workflow, ModelSQL, ModelView):
invoices_expiration = fields.Function(fields.Integer('Invoices Expiration'),
'get_invoices_expiration')
@classmethod
def __setup__(cls):
super(Database, cls).__setup__()
@ -72,6 +71,21 @@ class Database(Workflow, ModelSQL, ModelView):
record.allow_connections_database(False)
pass
@classmethod
def search_rec_name(cls, name, clause):
_, operator, value = clause
if operator.startswith('!') or operator.startswith('not '):
bool_op = 'AND'
else:
bool_op = 'OR'
domain = [
bool_op,
('name', operator, value),
('customer.name', operator, value),
('vps.name', operator, value),
]
return domain
@classmethod
@ModelView.button
@Workflow.transition('enable')
@ -79,8 +93,6 @@ class Database(Workflow, ModelSQL, ModelView):
for record in records:
record.allow_connections_database(True)
pass
def allow_connections_database(self, allow):
connection = None
try:

View File

@ -76,5 +76,33 @@ this repository contains the full copyright notices and license terms. -->
<field name="type">tree</field>
<field name="name">database_reel_view_tree</field>
</record>
<record model="ir.ui.view" id="vps_database_view_form">
<field name="model">vps.databases</field>
<field name="type">form</field>
<field name="name">vps_database_view_form</field>
</record>
<record model="ir.ui.view" id="vps_database_view_tree">
<field name="model">vps.databases</field>
<field name="type">tree</field>
<field name="name">vps_database_view_tree</field>
</record>
<record model="ir.action.act_window" id="act_vps_database_form">
<field name="name">Databases</field>
<field name="res_model">vps.databases</field>
</record>
<record model="ir.action.act_window.view" id="act_vps_database_form_view1">
<field name="sequence" eval="1"/>
<field name="view" ref="vps_database_view_tree"/>
<field name="act_window" ref="act_vps_database_form"/>
</record>
<record model="ir.action.act_window.view" id="act_vps_database_form_view2">
<field name="sequence" eval="2"/>
<field name="view" ref="vps_database_view_form"/>
<field name="act_window" ref="act_vps_database_form"/>
</record>
<menuitem parent="menu_vps" sequence="30"
action="act_vps_database_form" id="menu_vps_database_form"/>
</data>
</tryton>

View File

@ -0,0 +1,15 @@
<?xml version="1.0"?>
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. -->
<form>
<label name="name"/>
<field name="name"/>
<label name="state"/>
<field name="state"/>
<label name="customer"/>
<field name="customer"/>
<label name="price_plan"/>
<field name="price_plan"/>
<label name="invoices_expiration"/>
<field name="invoices_expiration"/>
</form>

View File

@ -0,0 +1,11 @@
<?xml version="1.0"?>
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. -->
<tree>
<field name="name"/>
<field name="state"/>
<field name="customer"/>
<field name="price_plan"/>
<field name="invoices_expiration"/>
<field name='vps'/>
</tree>