示例#1
0
    def init_values(self, elem, token, fetch_date):
        self['order_id'] = elem['ID']['_value_1']
        self['order_number'] = elem['OrderNumber']
        self['order_description'] = elem['Description']

        self['create_date'] = elem['CreateDate']
        self['create_date_pst'] = pytz.timezone(
            'America/Los_Angeles').localize(elem['CreateDate'])

        self['status'] = elem['Status']
        self['user_id'] = elem['User']['ID']['_value_1']
        self['user_group_syncmode'] = elem['UserGroups']['SyncMode']
        self['user_group_all_or_none'] = elem['UserGroups']['AllOrNone']
        self['seller_id'] = elem['Seller']['ID']['_value_1']
        self['company_id'] = elem['Company']['ID']['_value_1']
        self['supplier'] = elem['Supplier']
        self['billing_address_id'] = elem['BillingAddress']['ID']['_value_1']
        self['shipping_address_id'] = elem['ShippingAddress']['ID']['_value_1']
        self['payment_method'] = elem['PaymentMethod']
        self['payment_method_detail'] = elem['PaymentMethodDetail']
        self['credit_card'] = (settings.clean_json(elem['CreditCard'])
                               if elem['CreditCard'] is not None else None)
        self['attached_files'] = elem['AttachedFiles']
        self['token'] = token
        self['fetch_date'] = fetch_date
示例#2
0
 def init_values(self, elem):
     self['user_id'] = elem['User']['ID']['_value_1']
     self['fname'] = elem['User']['FirstName']
     self['lname'] = elem['User']['LastName']
     self['login_id'] = elem['User']['LoginID']
     self['generic_user_fields'] = ""
     self['email'] = elem['User']['Email']
     self['update_date'] = datetime.datetime.strftime(
         elem['CreateDate'], "%Y-%m-%d %H:%M:%S")
     self['user_group'] = (settings.clean_json(
         elem['UserGroups']['UserGroup']) if elem['UserGroups']['UserGroup']
                           is not None else None)
示例#3
0
 def append_to_group(self, order_id, swo):
     self.groups.append({
         'order_id':
         order_id,
         'sales_work_order_id':
         swo['ID']['_value_1'],
         'order_number':
         swo['OrderNumber'],
         'supplier_name':
         swo['SupplierName'],
         'credit_card': (settings.clean_json(swo['CreditCard'])
                         if swo['CreditCard'] is not None else None),
         'handling':
         swo['Handling']
     })
示例#4
0
 def append_to_group(self, od, elem):
     self.groups.append({
         'user_id':
         od['User']['ID']['_value_1'],
         'fname':
         od['User']['FirstName'],
         'lname':
         od['User']['LastName'],
         'login_id':
         od['User']['LoginID'],
         'email':
         od['User']['Email'],
         'generic_user_fields':
         (settings.clean_json(od['User']['GenericUserFields'])
          if od['User']['GenericUserFields'] is not None else None),
         'update_date':
         datetime.datetime.strftime(elem['CreateDate'],
                                    "%Y-%m-%d %H:%M:%S"),
     })
示例#5
0
    def append_to_group(self, od, rec):
        # Remove pesky non-ascii characters
        ascii_replace = re.compile(r'[^\x00-\x7F]+')

        # if not isinstance(od['TemplateFields'], type(None)):
        #     find_template_value(od['TemplateFields']['TemplateField'], 'Drops')

        self.groups.append({
            'order_id':
            rec,
            'eddm_touches':
            (find_template_value_drops(od['TemplateFields']['TemplateField'])
             if od['TemplateFields'] is not None else None),
            'order_detail_id':
            od['ID']['_value_1'],
            'order_type':
            od['OrderType'],
            'user_id':
            od['User']['ID']['_value_1'],
            'req_user':
            od['ReqUser'],
            'product_id':
            od['ProductID']['_value_1'],
            'product_name':
            od['ProductName'],
            'product_description':
            (bs4.BeautifulSoup(od['ProductDescription'],
                               features="lxml").get_text()[:100]
             if od['ProductDescription'] is not None else None),
            'sku_id':
            od['SKU']['ID']['_value_1'],
            'sku_name':
            od['SKU']['Name'],
            'sku_description': (bs4.BeautifulSoup(od['SKUDescription'],
                                                  features="lxml").get_text()
                                if od['SKUDescription'] is not None else None),
            'template_fields':
            (settings.clean_json(od['TemplateFields']['TemplateField'])
             if od['TemplateFields'] is not None else None),
            'quantity':
            od['Quantity'],
            'quantity_shipped':
            od['QuantityShipped'],
            'price_customer':
            od['Price']['Cost']['Customer']['_value_1'],
            'price_seller':
            od['Price']['Cost']['Seller']['_value_1'],
            'price_shipping':
            od['Price']['Cost']['Shipping']['_value_1'],
            'price_unit':
            od['Price']['Cost']['Unit']['_value_1'],
            'price_customer_discount':
            od['Price']['Cost']['CustomerDiscount']['_value_1'],
            'price_seller_misc':
            od['Price']['Cost']['SellerMisc']['_value_1'],
            'price_seller_store_discount':
            od['Price']['Cost']['SellerStoreDiscount']['_value_1'],
            'price_seller_shipping':
            od['Price']['Cost']['SellerShipping']['_value_1'],
            'price_customer_store_discount':
            od['Price']['Cost']['CustomerStoreDiscount']['_value_1'],
            'price_postage':
            od['Price']['Cost']['Postage']['_value_1'],
            'price_customer_misc':
            od['Price']['Cost']['CustomerMisc']['_value_1'],
            'tax_customer_sales':
            od['Price']['Tax']['CustomerSales']['_value_1'],
            'tax_direct_acct_sales':
            od['Price']['Tax']['DirectAcctSales']['_value_1'],
            'tax_city':
            od['Price']['Tax']['City']['_value_1'],
            'tax_county':
            od['Price']['Tax']['County']['_value_1'],
            'tax_state':
            od['Price']['Tax']['State']['_value_1'],
            'tax_district':
            od['Price']['Tax']['District']['_value_1'],
            'tax_city_freight':
            od['Price']['Tax']['CityFreight']['_value_1'],
            'tax_county_freight':
            od['Price']['Tax']['CountyFreight']['_value_1'],
            'tax_state_freight':
            od['Price']['Tax']['StateFreight']['_value_1'],
            'tax_district_freight':
            od['Price']['Tax']['DistrictFreight']['_value_1'],
            'tax_total_freight':
            od['Price']['Tax']['TotalFreight']['_value_1'],
            'tax_taxable_sales':
            od['Price']['Tax']['TaxableSalesAmount']['_value_1'],
            'tax_exempt_sales':
            od['Price']['Tax']['ExemptSalesAmount']['_value_1'],
            'tax_non_taxable':
            od['Price']['Tax']['NonTaxableSalesAmount']['_value_1'],
            'tax_city_name':
            od['Price']['Tax']['CityName'],
            'tax_county_name':
            od['Price']['Tax']['CountyName'],
            'tax_state_name':
            od['Price']['Tax']['StateName'],
            'tax_zip':
            od['Price']['Tax']['Zip'],
            'department_id':
            od['Department']['ID']['_value_1'],
            'department_name':
            od['Department']['Name'],
            'department_number':
            od['Department']['Number'],
            'supplier_work_order_id':
            (od['SupplierWorkOrder']['ID']['_value_1']
             if od['SupplierWorkOrder'] is not None else None),
            'supplier_work_order_name':
            (od['SupplierWorkOrder']['Name']
             if od['SupplierWorkOrder'] is not None else None),
            'supplier_id':
            od['Supplier']['ID']['_value_1'],
            'shipping_date':
            od['Shipping']['Date'],
            'shipping_date_shipped':
            od['Shipping']['DateShipped'],
            'shipping_method':
            (ascii_replace.sub('', str(od['Shipping']['Method']))
             if od['Shipping']['Method'] is not None else None),
            'shipping_instructions':
            od['Shipping']['Instructions'],
            'shipping_address_id':
            od['Shipping']['Address']['ID']['_value_1'],
            'shipping_tracking':
            (od['Shipping']['TrackingNumber'][0:12]
             if od['Shipping']['TrackingNumber'] is not None else None),
            'shipping_tax':
            od['Shipping']['Tax'],
            'postage_cost': (od['Postage']['Cost']['_value_1']
                             if od['Postage'] is not None else None),
            'postage_method':
            (od['Postage']['Method'] if od['Postage'] is not None else None),
            'client_status_value':
            od['ClientStatus']['Value'],
            'client_status_date':
            od['ClientStatus']['Date'],
            'seller_status_value':
            od['SellerStatus']['Value'],
            'seller_status_date':
            od['SellerStatus']['Date'],
            'supplier_status_value':
            od['SupplierStatus']['Value'],
            'supplier_status_date':
            od['SupplierStatus']['Date'],
            'credit_card_settlement':
            (settings.clean_json(od['CreditCardSettlement'])
             if od['CreditCardSettlement'] is not None else None),
            'kit': (settings.clean_json(od['Kit']['KitDetail'])
                    if od['Kit'] is not None else None),
            'order_order_id':
            od['OrderID']['_value_1'],
            'order_order_number':
            od['OrderNumber'],
            'client_po':
            od['ClientPONumber'],
            'custom_work_order_fields':
            od['CustomOrderFields'],
            'sales_work_order_id':
            od['SalesWorkOrderID']['_value_1'],
            'product_type':
            od['ProductType'],
            'list_vendor':
            od['ListVendor'],
            'finishing_options':
            (settings.clean_json(od['FinishingOptions'])
             if od['FinishingOptions'] is not None else None),
            'coupons':
            od['Coupons'],
            'attached_files': (settings.clean_json(od['AttachedFiles'])
                               if od['AttachedFiles'] is not None else None),
            'uploaded_files': (settings.clean_json(od['UploadedFiles'])
                               if od['UploadedFiles'] is not None else None),
            'sku_inventory_settings':
            od['SKUInventorySettings'],
            'pagecount':
            od['PageCount'],
            'catalog_tree_node_id':
            od['CatalogTreeNodeExternalId'],
            'job_direct_options':
            od['JobDirectOptions'],
            'impersonator_fields': (settings.clean_json(od['Impersonator']) if
                                    od['Impersonator'] is not None else None),
            'requisition_status':
            od['RequisitionStatus'],
            'approver_user':
            od['ApproverUser'],
            'explanation':
            od['Explanation'],
            'job_direct_settings':
            od['JobDirectSettings']
        })