trytonpsk-hotel/dash.py

37 lines
1.0 KiB
Python

# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
from trytond.pool import PoolMeta
from trytond.model import fields, ModelView, ModelSQL
class DashApp(metaclass=PoolMeta):
__name__ = 'dash.app'
@classmethod
def _get_origin(cls):
origins = super(DashApp, cls)._get_origin()
origins.extend(['dash.app.hotel_planner'])
return origins
@classmethod
def get_selection(cls):
options = super(DashApp, cls).get_selection()
options.extend([
('planner', 'Planner'),
])
return options
class AppHotelPlanner(ModelSQL, ModelView):
'App Hotel Planner'
__name__ = 'dash.app.hotel_planner'
company = fields.Many2One('company.company', 'Company', required=True)
@classmethod
def __setup__(cls):
super(AppHotelPlanner, cls).__setup__()
@staticmethod
def default_company():
return Transaction().context.get('company') or None