class CustomerServiceTO(SerializableTO): name = unicode_property('1') email = unicode_property('2') address = unicode_property('3') phone_number = unicode_property('4') language = unicode_property('5') currency = unicode_property('6') modules = unicode_list_property('7') broadcast_types = unicode_list_property('8') apps = unicode_list_property('9') organization_type = long_property('10') app_infos = typed_property('11', AppInfoTO, True) current_user_app_infos = typed_property('12', AppInfoTO, True) managed_organization_types = long_list_property('13')
class TffConfiguration(TO): """ Args: rogerthat(RogerthatConfiguration) ledger(LedgerConfiguration) odoo(OdooConfiguration) support_emails(list[string]) orchestator(OrchestatorConfiguration) investor(InvestorConfiguration) apple(AppleConfiguration) backup_disabled(bool) intercom_admin_id(unicode) cloudstorage_encryption_key(unicode) onfido(OnfidoConfiguration) influxdb(InfluxDBConfig) """ rogerthat = typed_property('1', RogerthatConfiguration, False) ledger = typed_property('3', LedgerConfiguration, False) odoo = typed_property('4', OdooConfiguration, False) orchestator = typed_property('5', OrchestatorConfiguration, False) support_emails = unicode_list_property('support_emails') backup_disabled = bool_property('backup_disabled') intercom_admin_id = long_property('intercom_admin_id') cloudstorage_encryption_key = unicode_property( 'cloudstorage_encryption_key') exchangerate_key = unicode_property('exchangerate_key') onfido = typed_property('onfido', OnfidoConfiguration) influxdb = typed_property('influxdb', InfluxDBConfig)
class RegioManagerBaseTO(object): email = unicode_property('1') name = unicode_property('2') app_ids = unicode_list_property('3') show_in_stats = bool_property('4') internal_support = bool_property('5') phone = unicode_property('6') team_id = long_property('7') admin = bool_property('8') @classmethod def from_model(cls, model): to = cls() to.email = model.email to.name = model.name to.app_ids = sorted([ app_id for app_id in model.app_ids if app_id not in model.read_only_app_ids ]) to.show_in_stats = model.show_in_stats to.internal_support = model.internal_support to.phone = model.phone to.team_id = model.team_id to.admin = model.admin return to
class Dummy(object): f1 = unicode_property('1') f2 = bool_property('2') f3 = float_property('3') f4 = long_property('4') f5 = unicode_list_property('5') f6 = typed_property('6', InnerDummy) f7 = typed_property('7', InnerDummy, True)
class RegioManagerTO(RegioManagerBaseTO): read_only_app_ids = unicode_list_property('51') @classmethod def from_model(cls, model): to = super(RegioManagerTO, cls).from_model(model) to.read_only_app_ids = model.read_only_app_ids return to
class ModulesReturnStatusTO(ReturnStatusTO): modules = unicode_list_property('51') @classmethod def create(cls, success=True, errormsg=None, modules=None): r = super(ModulesReturnStatusTO, cls).create(success=success, errormsg=errormsg) r.modules = modules or list() return r
class BaseTransactionTO(TO): timestamp = long_property('timestamp') unlock_timestamps = long_list_property('unlock_timestamps') unlock_amounts = long_list_property('unlock_amounts') token = unicode_property('token') token_type = unicode_property('token_type') amount = long_property('amount') memo = unicode_property('memo') app_users = unicode_list_property('app_users') from_user = unicode_property('from_user') to_user = unicode_property('to_user')
class SimpleAppTO(object): id = unicode_property('0') name = unicode_property('1') orderable_app_ids = unicode_list_property('2') @staticmethod def create(model): app = SimpleAppTO() app.id = model.app_id app.name = model.name app.orderable_app_ids = model.orderable_app_ids return app
class SolutionServiceMenuItem(object): icon_name = unicode_property('1') icon_color = unicode_property('2') label = unicode_property('3') tag = unicode_property('4') screen_branding = unicode_property('5') static_flow = unicode_property('6') requires_wifi = bool_property('7') # False run_in_background = bool_property('8') # True roles = long_list_property('9') # [] is_broadcast_settings = bool_property('10') # False broadcast_branding = unicode_property('11') # None broadcast_types = unicode_list_property('12') coords = long_list_property('13') action = long_property('14') link = typed_property('15', ServiceMenuItemLinkTO) def __init__(self, icon_name, icon_color, label, tag, screen_branding=None, requires_wifi=False, run_in_background=True, static_flow=None, roles=None, is_broadcast_settings=False, broadcast_branding=None, broadcast_types=None, coords=None, action=0, link=None): self.icon_name = icon_name self.icon_color = icon_color self.label = label self.tag = tag self.screen_branding = screen_branding self.requires_wifi = requires_wifi self.run_in_background = run_in_background self.static_flow = static_flow self.roles = list() if roles is None else roles self.is_broadcast_settings = is_broadcast_settings self.broadcast_branding = broadcast_branding self.broadcast_types = list( ) if broadcast_types is None else broadcast_types self.coords = list() if coords is None else coords self.action = action self.link = link
class RegioManagerTeamTO(object): id = long_property('1') name = unicode_property('2') legal_entity_id = long_property('3') app_ids = unicode_list_property('4') regio_managers = typed_property('5', RegioManagerTO, True) @classmethod def from_model(cls, regio_manager_team, regio_managers): to = cls() to.id = regio_manager_team.id to.name = regio_manager_team.name to.legal_entity_id = regio_manager_team._legal_entity_id to.app_ids = regio_manager_team.app_ids to.regio_managers = map(RegioManagerTO.from_model, regio_managers) return to
class TaskTO(object): id = long_property('0') execution_time = long_property('1') type = long_property('2') type_str = unicode_property('3') prospect_id = unicode_property('4') prospect_name = unicode_property('5') address = unicode_property('6') comments = unicode_list_property('7') closed_time = long_property('8') certainty = long_property('9') subscription = long_property('10') creation_time = long_property('11') assignee = unicode_property('12') @classmethod def from_model(cls, model, prospect): to = cls() to.id = model.id to.execution_time = model.execution_time to.type = model.type to.type_str = model.type_str to.prospect_id = unicode(prospect.id) to.prospect_name = prospect.name to.address = model.address to.comments = list() if model.comment: to.comments.append(model.comment) if prospect.comments: to.comments.extend([comment.text for comment in prospect.comments]) to.closed_time = model.closed_time if model.certainty is None: to.certainty = 0 else: to.certainty = model.certainty if model.subscription is None: to.subscription = 0 else: to.subscription = model.subscription to.creation_time = model.creation_time to.assignee = model.assignee return to
class RegioManagerTeamsTO(object): unassigned_regio_managers = typed_property('1', RegioManagerTO, True) regio_manager_teams = typed_property('2', RegioManagerTeamTO, True) apps = typed_property('3', AppInfoTO, True) unassigned_apps = unicode_list_property('4') @classmethod def from_model(cls, regio_manager_teams, regio_managers, apps): to = cls() unassigned_regio_managers = [] rms = {} for rm in regio_managers: unassigned_regio_managers.append(rm.email) rms[rm.email] = rm filtered_apps = [] unassigned_apps = [] for app in apps: if app.app_id != App.APP_ID_OSA_LOYALTY: filtered_apps.append(app) unassigned_apps.append(app.app_id) to.regio_manager_teams = [] for rmt in regio_manager_teams: rmt_members = [] for rm in rmt.regio_managers: unassigned_regio_managers.remove(rm) rmt_members.append(rms[rm]) to.regio_manager_teams.append( RegioManagerTeamTO.from_model(rmt, rmt_members)) for app_id in rmt.app_ids: if app_id in unassigned_apps: unassigned_apps.remove(app_id) to.unassigned_regio_managers = map( RegioManagerTO.from_model, [rms[rm] for rm in unassigned_regio_managers]) to.apps = map(AppInfoTO.fromModel, filtered_apps) to.unassigned_apps = sorted(unassigned_apps) return to
class ProductTO(object): default = bool_property('0') default_comment = unicode_property('1') default_count = long_property('2') description = unicode_property('3') extra_subscription_months = long_property('4') is_subscription = bool_property('5') is_subscription_discount = bool_property('6') module_set = unicode_property('7') organization_types = long_list_property('8') possible_counts = long_list_property('9') price = long_property('10') product_dependencies = unicode_list_property('12') visible = bool_property('13') code = unicode_property('14') picture_url = unicode_property('15') price_in_euro = unicode_property('16') @classmethod def create(cls, model, language): to = ProductTO() to.code = model.key().name() to.default = model.default to.default_comment = model.default_comment(language) to.default_count = model.default_count to.description = model.description(language) to.extra_subscription_months = model.extra_subscription_months to.is_subscription = model.is_subscription to.is_subscription_discount = model.is_subscription_discount to.module_set = model.module_set to.organization_types = model.organization_types to.possible_counts = model.possible_counts to.price = model.price to.product_dependencies = model.product_dependencies to.visible = model.visible to.picture_url = model.picture_url to.price_in_euro = model.price_in_euro return to
class ShopAppTO(object): name = unicode_property('1') bounds = typed_property('2', BoundsTO, False) searched_bounds = typed_property('3', BoundsTO, True) postal_codes = unicode_list_property('4') signup_enabled = bool_property('5') @classmethod def from_model(cls, model): to = cls() to.name = model.name most_sw, most_ne = model.south_west(), model.north_east() to.bounds = BoundsTO.create( most_sw.lat, most_sw.lon, most_ne.lat, most_ne.lon) if most_sw and most_ne else None to.searched_bounds = [ BoundsTO.create(sw.lat, sw.lon, ne.lat, ne.lon) for sw, ne in zip(model.searched_south_west_bounds, model.searched_north_east_bounds) ] to.postal_codes = model.postal_codes to.signup_enabled = model.signup_enabled return to
class ProspectTO(object): id = unicode_property('0') app_id = unicode_property('1') name = unicode_property('2') lat = float_property('3') lon = float_property('4') address = unicode_property('5') phone = unicode_property('6') website = unicode_property('7') types = unicode_list_property('8') status = long_property('9') reason = unicode_property('10') action_timestamp = long_property('11') assignee = unicode_property('12') email = unicode_property('13') comments = typed_property('14', ProspectComment, True) has_customer = bool_property('15') customer_id = long_property('16') certainty = long_property('17') subscription = long_property('18') categories = unicode_list_property('19') @classmethod def from_model(cls, model): if not model: return None to = cls() to.id = model.id to.app_id = model.app_id to.name = model.name if model.geo_point: to.lat = model.geo_point.lat to.lon = model.geo_point.lon else: to.lat = 0 to.lon = 0 to.address = model.address to.phone = model.phone to.website = model.website to.types = model.type to.status = model.status to.reason = model.reason to.action_timestamp = model.action_timestamp to.assignee = model.assignee to.email = model.email to.comments = list( ) if model.comments is None else model.comments.values() if model.customer_id is None: to.has_customer = False to.customer_id = -1 else: to.has_customer = True to.customer_id = model.customer_id if model.certainty is None: to.certainty = 0 else: to.certainty = model.certainty if model.subscription is None: to.subscription = 0 else: to.subscription = model.subscription to.categories = map(unicode, model.categories) return to
class InvestorConfiguration(TO): support_emails = unicode_list_property('1')
class ExtraInfo(object): first_name = unicode_property('1') christian_names = unicode_list_property('2') age = long_property('3') addresses = typed_property('4', Address, True)
class CustomerTO(CompanyTO): id = long_property('51') service_email = unicode_property('52') auto_login_url = unicode_property('54') stripe_valid = bool_property('55') migration_job = unicode_property('56') manager = unicode_property('57') app_ids = unicode_list_property('58') extra_apps_count = long_property('59') prospect_id = unicode_property('60') language = unicode_property('61') subscription_type = unicode_property('62') has_loyalty = bool_property('63') creation_time = long_property('64') team_id = long_property('65') can_edit = bool_property('66') is_admin = bool_property('67') service_disabled_at = long_property('68') service_disabled_reason = unicode_property('69') service_disabled_reason_int = long_property('70') subscription_cancel_pending_date = long_property('71') cancelling_on_date = long_property( '72') # Customer his subscription will be disabled on this date @staticmethod def fromCustomerModel(customer, can_edit, is_admin): c = CustomerTO() c.name = customer.name c.address1 = customer.address1 c.address2 = customer.address2 c.zip_code = customer.zip_code c.city = customer.city c.country = customer.country c.vat = customer.vat c.organization_type = customer.organization_type c.id = customer.id c.service_email = customer.service_email c.user_email = customer.user_email c.auto_login_url = customer.auto_login_url if customer.service_email else None c.stripe_valid = customer.stripe_valid c.migration_job = customer.migration_job c.manager = customer.manager.email().decode( 'utf-8') if customer.manager else None c.app_ids = customer.sorted_app_ids c.extra_apps_count = customer.extra_apps_count c.prospect_id = customer.prospect_id c.language = customer.language c.subscription_type = customer.SUBSCRIPTION_TYPES[ customer.subscription_type] c.has_loyalty = customer.has_loyalty c.creation_time = customer.creation_time c.team_id = customer.team_id c.can_edit = can_edit c.is_admin = is_admin c.service_disabled_at = customer.service_disabled_at if customer.subscription_cancel_pending_date != 0 and customer.subscription_order_number: c.cancelling_on_date = Order.get( Order.create_key( customer.id, customer.subscription_order_number)).next_charge_date else: c.cancelling_on_date = 0 c.service_disabled_reason = customer.disabled_reason or customer.disabled_reason_str c.service_disabled_reason_int = customer.disabled_reason_int c.subscription_cancel_pending_date = customer.subscription_cancel_pending_date c.website = customer.website c.facebook_page = customer.facebook_page return c