示例#1
0
class OrderItemTO(SerializableTO):
    id = long_property('0')
    number = long_property('1')
    product = unicode_property('2')
    comment = unicode_property('3')
    count = long_property('4')
    price = long_property('5')
    app_id = unicode_property('6')
    service_visible_in = unicode_property('7')

    @classmethod
    def create(cls, model, subscription_order_date=None):
        item = OrderItemTO()
        item.id = model.key().id()
        item.number = model.number
        item.product = model.product.code
        item.comment = model.comment
        item.count = model.count
        item.price = model.price
        item.app_id = getattr(model, 'app_id', None)  # dynamic property
        if item.app_id:
            item.service_visible_in = subscription_order_date
        else:
            item.service_visible_in = None
        return item
示例#2
0
class EventTO(TO):
    id = long_property('id')
    type = long_property('type')
    title = unicode_property('title')
    description = unicode_property('description')
    location = unicode_property('location')
    start_timestamp = unicode_property('start_timestamp')
    end_timestamp = unicode_property('end_timestamp')
    past = bool_property('past')
示例#3
0
class GlobalStatsTO(TO):
    id = unicode_property('id')
    name = unicode_property('name')
    token_count = long_property('token_count')
    unlocked_count = long_property('unlocked_count')
    value = float_property('value')
    currencies = typed_property('currencies', CurrencyValueTO,
                                True)  # type: list[CurrencyValueTO]
    market_cap = float_property('market_cap')
示例#4
0
class CreateInvestmentAgreementTO(TO):
    app_user = unicode_property('app_user')
    amount = float_property('amount')
    currency = unicode_property('currency')
    document = unicode_property('document')
    token = unicode_property('token')
    status = long_property('status')
    sign_time = long_property('sign_time')
    paid_time = long_property('paid_time')
示例#5
0
class PaymentProviderTransactionTO(TO):
    id = unicode_property('1')
    type = unicode_property('2')
    name = unicode_property('3')
    amount = long_property('4')
    currency = unicode_property('5')
    memo = unicode_property('6')
    timestamp = long_property('7')
    from_asset_id = unicode_property('8')
    to_asset_id = unicode_property('9')
示例#6
0
class JobStatusTO(object):
    progress = long_property('1')
    phase = long_property('2')

    @classmethod
    def from_model(cls, model):
        to = cls()
        to.progress = int(model.estimate_progress())
        to.phase = model.phase
        return to
示例#7
0
class OdooConfiguration(TO):
    url = unicode_property('1')
    database = unicode_property('2')
    username = unicode_property('3')
    password = unicode_property('4')

    incoterm = long_property('5')
    payment_term = long_property('6')
    product_ids = typed_property(
        'product_ids', dict)  # key: the node's socket type, value: product id
示例#8
0
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')
示例#9
0
文件: nodes.py 项目: FastGeert/tf_app
class CreateNodeOrderTO(TO):
    app_user = unicode_property('app_user')
    billing_info = typed_property('billing_info',
                                  ContactInfoTO)  # type: ContactInfoTO
    shipping_info = typed_property('shipping_info',
                                   ContactInfoTO)  # type: ContactInfoTO
    status = long_property('status')
    order_time = long_property('order_time')
    sign_time = long_property('sign_time')
    send_time = long_property('send_time')
    odoo_sale_order_id = long_property('odoo_sale_order_id')
    document = unicode_property('document')
示例#10
0
class SalesStatsInvoiceTO(object):
    amount = long_property('1')
    date = long_property('2')
    operator = unicode_property('3')

    @staticmethod
    def create(obj):
        o = SalesStatsInvoiceTO()
        o.amount = obj.amount
        o.date = obj.date
        o.operator = obj.operator.nickname()
        return o
示例#11
0
class MenuItem(object):
    VISIBLE_IN_MENU = 1
    VISIBLE_IN_ORDER = 2

    name = unicode_property('1')
    price = long_property('2')
    description = unicode_property('3')
    visible_in = long_property('4')
    unit = long_property('5')
    step = long_property('6')
    image_id = long_property('7')
    qr_url = unicode_property('8')
    has_price = bool_property('9')
    id = unicode_property('10')
示例#12
0
class ChargeTO(object):
    id = long_property('0')
    reference = unicode_property('1')
    amount = long_property('2')  # in euro cents
    order_number = unicode_property('3')
    full_date_str = unicode_property('4')
    last_notification_date_str = unicode_property('5')
    structured_info = unicode_property('6')
    is_recurrent = bool_property('7')
    currency = unicode_property('8')
    total_amount_formatted = unicode_property('9')
    amount_paid_in_advance = long_property('10')
    amount_paid_in_advance_formatted = unicode_property('11')
    status = long_property('12')
    customer_id = long_property('13')
    manager = unicode_property('14')
    customer_po_number = unicode_property('15')
    invoice_number = unicode_property('16')
    paid = bool_property('17')

    @classmethod
    def from_model(cls, model):
        """
        Args:
            model (shop.models.Charge): charge db model
        """
        to = cls()
        to.id = model.key().id()
        to.reference = model.reference
        to.amount = model.total_amount
        to.order_number = model.order_number
        to.full_date_str = unicode(model.full_date_str)
        to.last_notification_date_str = unicode(
            model.last_notification_date_str)
        to.structured_info = model.structured_info
        to.is_recurrent = model.is_recurrent
        to.currency = model.currency
        to.total_amount_formatted = unicode(model.total_amount_formatted)
        to.amount_paid_in_advance = model.amount_paid_in_advance
        to.amount_paid_in_advance_formatted = unicode(
            model.amount_paid_in_advance_formatted)
        to.status = model.status
        to.customer_id = model.customer_id
        to.manager = model.manager and model.manager.email()
        to.customer_po_number = model.customer_po_number
        to.invoice_number = model.invoice_number
        to.paid = model.paid
        return to
示例#13
0
class InfluxDBConfig(TO):
    host = unicode_property('host')
    ssl = bool_property('ssl')
    port = long_property('port')
    database = unicode_property('database')
    username = unicode_property('username')
    password = unicode_property('password')
示例#14
0
class MenuCategory(object):
    name = unicode_property('1')
    items = typed_property('2', MenuItem, True)
    index = long_property('3')
    predescription = unicode_property('4')
    postdescription = unicode_property('5')
    id = unicode_property('6')
示例#15
0
class Address(object):
    street = unicode_property('1')
    house_number = long_property('2')
    bus = unicode_property('3')
    zipcode = unicode_property('4')
    city = unicode_property('5')
    country = unicode_property('6')
示例#16
0
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)
示例#17
0
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
示例#18
0
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
示例#19
0
class TffConfiguration(TO):
    """
    Args:
        rogerthat(RogerthatConfiguration)
        ledger(LedgerConfiguration)
        odoo(OdooConfiguration)
        orchestator(OrchestatorConfiguration)
        investor(InvestorConfiguration)
        apple(AppleConfiguration)
        backup_disabled(bool)
        intercom_admin_id(unicode)
        cloudstorage_encryption_key(unicode)
        onfido(OnfidoConfiguration)
    """
    rogerthat = typed_property('1', RogerthatConfiguration, False)
    ledger = typed_property('3', LedgerConfiguration, False)
    odoo = typed_property('4', OdooConfiguration, False)
    orchestator = typed_property('5', OrchestatorConfiguration, False)
    investor = typed_property('6', InvestorConfiguration, False)
    apple = typed_property('apple', AppleConfiguration)
    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)
示例#20
0
 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)
示例#21
0
        class MyLittleTO(object):
            name = unicode_property('name')
            age = long_property('age')

            def __str__(self):
                return u"%s is %s years old" % (self.name, self.age)

            def __eq__(self, other):
                return self.name == other.name and self.age == other.age
示例#22
0
class OrderTO(object):
    customer_id = long_property('1')
    order_number = unicode_property('2')
    full_date_str = unicode_property('3')
    full_date_canceled_str = unicode_property('4')
    amount = unicode_property('5')
    next_charge_date = long_property('6')

    @staticmethod
    def fromOrderModel(obj):
        i = OrderTO()
        i.customer_id = obj.customer_id
        i.order_number = obj.order_number
        i.full_date_str = unicode(obj.full_date_str)
        i.full_date_canceled_str = unicode(obj.full_date_canceled_str)
        i.amount = obj.total_amount_in_euro
        i.next_charge_date = obj.next_charge_date or 0
        return i
示例#23
0
class CollectionTO(object):
    epoch = long_property('1')
    year = long_property('2')
    month = long_property('3')
    day = long_property('4')
    activity = typed_property('5', ActivityTO, False)

    @classmethod
    def fromObj(cls, obj, activity):
        to = cls()
        d = obj["d"].split("-")
        to.year = long(d[0])
        to.month = long(d[1])
        to.day = long(d[2])
        d = datetime.date(to.year, to.month, to.day)
        to.epoch = get_epoch_from_datetime(d)
        to.activity = activity
        return to
示例#24
0
class ProspectHistoryTO(object):
    created_time = long_property('0')
    executed_by = unicode_property('1')
    status = long_property('2')
    type = unicode_property('3')
    comment = unicode_property('4')
    reason = unicode_property('5')

    @classmethod
    def create(cls, model):
        to = cls()
        to.created_time = model.created_time
        to.executed_by = model.executed_by
        to.status = model.status
        to.type = model.type_str
        to.comment = model.comment
        to.reason = model.reason
        return to
示例#25
0
class SubscriptionLengthReturnStatusTO(ReturnStatusTO):
    subscription_length = long_property('3')

    @classmethod
    def create(cls, success=True, errormsg=None, subscription_length=0):
        to = super(SubscriptionLengthReturnStatusTO,
                   cls).create(success, errormsg)
        to.subscription_length = subscription_length
        return to
示例#26
0
class HouseTO(object):
    number = long_property('1')
    bus = unicode_property('2')

    @classmethod
    def fromObj(cls, obj):
        to = cls()
        to.number = obj["h"]
        to.bus = obj["t"]
        return to
示例#27
0
class StreetTO(object):
    number = long_property('1')
    name = unicode_property('2')

    @classmethod
    def fromObj(cls, obj):
        to = cls()
        to.number = obj["nr"]
        to.name = obj["s"]
        return to
示例#28
0
class InvoiceTO(object):
    customer_id = long_property('1')
    charge_id = long_property('2')
    order_number = unicode_property('3')
    invoice_number = unicode_property('4')
    full_date_str = unicode_property('5')
    paid = bool_property('6')

    @staticmethod
    def fromInvoiceModel(obj):
        i = InvoiceTO()
        i.customer_id = obj.customer_id
        i.charge_id = obj.charge_id
        i.order_number = obj.order_number
        i.invoice_number = obj.invoice_number
        i.full_date_str = unicode(obj.full_date_str)
        i.paid = obj.paid or obj.payment_type in (obj.PAYMENT_MANUAL,
                                                  obj.PAYMENT_STRIPE,
                                                  obj.PAYMENT_ON_SITE)
        return i
示例#29
0
class ShopProductTO(object):
    app_id = unicode_property('0')
    code = unicode_property('1')
    count = long_property('2')

    @classmethod
    def create(cls, app_id, code, count):
        to = cls()
        to.app_id = app_id
        to.code = code
        to.count = count
        return to
示例#30
0
class Shift(object):
    name = unicode_property('1', 'Name of the shift. Eg Lunch, Dinner')
    start = long_property(
        '2',
        'Start of the shift expressed in a number of seconds since midnight.')
    end = long_property(
        '3',
        'End of the shift expressed in a number of seconds since midnight.')
    leap_time = long_property(
        '4',
        'The time preceding the shift in which the customer cannot automatically make a reservation anymore expressed in minutes.'
    )
    capacity = long_property(
        '5', 'Max number of people attending the restaurant for this shift.')
    threshold = long_property(
        '6',
        'Percentage of the capacity that allows auto-booking of reservations.')
    max_group_size = long_property('7',
                                   'Max number of people in one reservation.')
    days = long_list_property(
        '8', 'Days on which this shift applies. 1=Monday, 7=Sunday')

    def __eq__(self, other):
        if not isinstance(other, Shift):
            return False
        return self.start == other.start and self.end == other.end and self.days == other.days