Пример #1
0
    def get_ship_to(country="GB"):
        """Returns a shipto to a known country"""
        if country == "GB":
            ship_to_address = ShipmentConfirm.address_type(
                AddressLine1="205, Copper Gate House",
                AddressLine2="16 Brune Street",
                City="London",
                #StateProvinceCode="E1 7NJ",
                CountryCode="GB",
                PostalCode="E1 7NJ")
        elif country == "US":
            ship_to_address = ShipmentConfirm.address_type(
                AddressLine1="1 Infinite Loop",
                City="Cupertino",
                StateProvinceCode="CA",
                CountryCode="US",
                PostalCode="95014")
        else:
            raise Exception("This country is not supported")

        return ShipmentConfirm.ship_to_type(
            ship_to_address,
            CompanyName="Apple",
            AttentionName="Someone other than Steve",
            TaxIdentificationNumber="123456",
            PhoneNumber='4089961010',
        )
Пример #2
0
    def get_ship_to(country="GB"):
        """Returns a shipto to a known country"""
        if country == "GB":
            ship_to_address = ShipmentConfirm.address_type(
                AddressLine1="205, Copper Gate House",
                AddressLine2="16 Brune Street",
                City="London",
                #StateProvinceCode="E1 7NJ",
                CountryCode="GB",
                PostalCode="E1 7NJ"
                )
        elif country == "US":
            ship_to_address = ShipmentConfirm.address_type(
                AddressLine1="1 Infinite Loop",
                City="Cupertino",
                StateProvinceCode="CA",
                CountryCode="US",
                PostalCode="95014"
                )
        else:
            raise Exception("This country is not supported")

        return ShipmentConfirm.ship_to_type(
            ship_to_address,
            CompanyName="Apple",
            AttentionName="Someone other than Steve",
            TaxIdentificationNumber="123456",
            PhoneNumber='4089961010',
            )
Пример #3
0
    def get_ship_from(country="GB"):
        """Returns a shipfrom from a known country"""
        if country == "GB":
            ship_from_address = ShipmentConfirm.address_type(
                AddressLine1="2,Hope Rd",
                AddressLine2="Anson Road",
                City="Manchester",
                CountryCode="GB",
                PostalCode="M145EU")
        elif country == "US":
            ship_from_address = ShipmentConfirm.address_type(
                AddressLine1="245 NE 24th Street",
                AddressLine2="Suite 108",
                City="Miami",
                StateProvinceCode="FL",
                CountryCode="US",
                PostalCode="33137")
        else:
            raise Exception("This country is not supported")

        return ShipmentConfirm.ship_from_type(
            ship_from_address,
            CompanyName="Openlabs",
            AttentionName="Someone other than Sharoon",
            TaxIdentificationNumber="33065",
            PhoneNumber='0987654321',
        )
Пример #4
0
    def get_ship_from(country="GB"):
        """Returns a shipfrom from a known country"""
        if country == "GB":
            ship_from_address = ShipmentConfirm.address_type(
                AddressLine1="2,Hope Rd",
                AddressLine2="Anson Road",
                City="Manchester",
                CountryCode="GB",
                PostalCode="M145EU"
                )
        elif country == "US":
            ship_from_address = ShipmentConfirm.address_type(
                AddressLine1="245 NE 24th Street",
                AddressLine2="Suite 108",
                City="Miami",
                StateProvinceCode="FL",
                CountryCode="US",
                PostalCode="33137"
                )
        else:
            raise Exception("This country is not supported")

        return ShipmentConfirm.ship_from_type(
            ship_from_address,
            CompanyName="Openlabs",
            AttentionName="Someone other than Sharoon",
            TaxIdentificationNumber="33065",
            PhoneNumber='0987654321',
            )
Пример #5
0
    def _add_addresses(self, cr, uid, omni, package, context=None):
        """
        Adds the UPS style addresses to the ShipmentConfirm

        """
        address_obj = self.pool.get('res.partner')

        omni_obj = self.pool.get('omniship')
        ups_shipper = omni_obj.get_ups_shipper(cr, uid, omni, context)
        #Fetch Addresses
        if package.alternate_sender_address:
            from_addr = package.alternate_sender_address
            to_addr = package.picking.company_id.partner_id
        else:
            from_addr = package.picking.company_id.partner_id
            to_addr = package.picking.partner_id

        to_address = address_obj.address_to_ups_dict(cr, uid, to_addr, context)
        from_address = address_obj.address_to_ups_dict(cr, uid, from_addr,
                                                       context)
        shipper_address = address_obj.address_to_ups_dict(
            cr, uid, package.picking.company_id.partner_id, context)
        # Generating the XML Elements

        # Ship to address
        ship_to_address_elem = ShipmentConfirm.address_type(
            AddressLine1=to_address['line1'],
            AddressLine2=to_address['line2'],
            City=to_address['city'],
            PostalCode=to_address['postal_code'],
            StateProvinceCode=to_address['state_code'],
            CountryCode=to_address['country_code'],
        )

        # Ship from address
        ship_from_address_elem = ShipmentConfirm.address_type(
            AddressLine1=from_address['line1'],
            AddressLine2=from_address['line2'],
            City=from_address['city'],
            PostalCode=from_address['postal_code'],
            StateProvinceCode=from_address['state_code'],
            CountryCode=from_address['country_code'])

        # Shipper address
        shipper_address_elem = ShipmentConfirm.address_type(
            AddressLine1=shipper_address['line1'],
            AddressLine2=shipper_address['line2'],
            City=shipper_address['city'],
            PostalCode=shipper_address['postal_code'],
            StateProvinceCode=from_address['state_code'],
            CountryCode=shipper_address['country_code'])

        # Shipper
        shipper = ShipmentConfirm.shipper_type(
            shipper_address_elem,
            Name=shipper_address['company_name'],
            AttentionName=shipper_address['attention_name'],
            TaxIdentificationNumber=shipper_address['tin'],
            PhoneNumber=shipper_address['phone'],
            FaxNumber=shipper_address['fax'],
            EMailAddress=shipper_address['email'] or '',
            ShipperNumber=ups_shipper)

        if to_address['email'] == 'None':
            to_address['email'] = ''

        # Ship to
        ship_to = ShipmentConfirm.ship_to_type(
            ship_to_address_elem,
            CompanyName=to_address['company_name'],
            AttentionName=to_address['attention_name'],
            TaxIdentificationNumber=to_address['tin'],
            PhoneNumber=to_address['phone'],
            FaxNumber=to_address['fax'],
            EMailAddress=to_address['email'],
            LocationId='None')

        # Ship from
        ship_from = ShipmentConfirm.ship_from_type(
            ship_from_address_elem,
            CompanyName=from_address['company_name'],
            AttentionName=from_address['attention_name'],
            TaxIdentificationNumber=from_address['tin'],
            PhoneNumber=from_address['phone'],
            FaxNumber=from_address['fax'],
            EMailAddress=from_address['email'])
        return (shipper, ship_to, ship_from)
Пример #6
0
    def _add_addresses(self, cursor, user, register_id, context=None):
        """
        Adds the UPS style addresses to the ShipmentConfirm

        :param cursor: Database Cursor
        :param user: ID of User
        :param register_id: ID of Shipment Register
        :param context: Context directly uses active id.
        """
        address_obj = self.pool.get('res.partner.address')
        company_obj = self.pool.get('res.company')

        ups_shipper = company_obj.get_ups_shipper(cursor, user, context)
        register_record = self.browse(cursor, user, register_id, context)
        #Fetch Addresses
        to_address = address_obj.address_to_ups_dict(
            cursor, user, register_record.to_address.id, context)
        from_address = address_obj.address_to_ups_dict(
            cursor, user, register_record.from_address.id, context)
        shipper_address = address_obj.address_to_ups_dict(
            cursor, user, register_record.shipper_address.id, context)

        # Generating the XML Elements

        # Ship to address
        ship_to_address_elem = ShipmentConfirm.address_type(
            AddressLine1=to_address['line1'],
            AddressLine2=to_address['line2'],
            City=to_address['city'],
            PostalCode=to_address['postal_code'],
            StateProvinceCode=to_address['state_code'],
            CountryCode=to_address['country_code'],
        )

        # Ship from address
        ship_from_address_elem = ShipmentConfirm.address_type(
            AddressLine1=from_address['line1'],
            AddressLine2=from_address['line2'],
            City=from_address['city'],
            PostalCode=from_address['postal_code'],
            StateProvinceCode=from_address['state_code'],
            CountryCode=from_address['country_code'])

        # Shipper address
        shipper_address_elem = ShipmentConfirm.address_type(
            AddressLine1=shipper_address['line1'],
            AddressLine2=shipper_address['line2'],
            City=shipper_address['city'],
            PostalCode=shipper_address['postal_code'],
            StateProvinceCode=from_address['state_code'],
            CountryCode=shipper_address['country_code'])

        # Shipper
        shipper = ShipmentConfirm.shipper_type(
            shipper_address_elem,
            Name=shipper_address['company_name'],
            AttentionName=shipper_address['attention_name'],
            TaxIdentificationNumber=shipper_address['tin'],
            PhoneNumber=shipper_address['phone'],
            FaxNumber=shipper_address['fax'],
            EMailAddress=shipper_address['email'],
            ShipperNumber=ups_shipper)

        # Ship to
        ship_to = ShipmentConfirm.ship_to_type(
            ship_to_address_elem,
            CompanyName=to_address['company_name'],
            AttentionName=to_address['attention_name'],
            TaxIdentificationNumber=to_address['tin'],
            PhoneNumber=to_address['phone'],
            FaxNumber=to_address['fax'],
            EMailAddress=to_address['email'],
            LocationId='None')

        # Ship from
        ship_from = ShipmentConfirm.ship_from_type(
            ship_from_address_elem,
            CompanyName=from_address['company_name'],
            AttentionName=from_address['attention_name'],
            TaxIdentificationNumber=from_address['tin'],
            PhoneNumber=from_address['phone'],
            FaxNumber=from_address['fax'],
            EMailAddress=from_address['email'])

        return (shipper, ship_to, ship_from)
    def _add_addresses(self, cursor, user, register_id, context=None):
        """
        Adds the UPS style addresses to the ShipmentConfirm
        
        :param cursor: Database Cursor
        :param user: ID of User
        :param register_id: ID of Shipment Register
        :param context: Context directly uses active id.
        """
        address_obj = self.pool.get('res.partner.address')
        company_obj = self.pool.get('res.company')
        
        ups_shipper = company_obj.get_ups_shipper(cursor, user, context)
        register_record = self.browse(cursor, user, register_id, context)
        #Fetch Addresses
        to_address = address_obj.address_to_ups_dict(
            cursor, user, register_record.to_address.id, context)
        from_address = address_obj.address_to_ups_dict(
            cursor, user, register_record.from_address.id, context)
        shipper_address = address_obj.address_to_ups_dict(
            cursor, user, register_record.shipper_address.id, context)

        # Generating the XML Elements
        
        # Ship to address
        ship_to_address_elem = ShipmentConfirm.address_type(
            AddressLine1=to_address['line1'],
            AddressLine2=to_address['line2'],
            City=to_address['city'],
            PostalCode=to_address['postal_code'],
            StateProvinceCode=to_address['state_code'],
            CountryCode=to_address['country_code'],)
            
        # Ship from address
        ship_from_address_elem = ShipmentConfirm.address_type(
            AddressLine1=from_address['line1'],
            AddressLine2=from_address['line2'],
            City=from_address['city'],
            PostalCode=from_address['postal_code'],
            StateProvinceCode=from_address['state_code'],
            CountryCode=from_address['country_code'])
            
        # Shipper address
        shipper_address_elem = ShipmentConfirm.address_type(
            AddressLine1=shipper_address['line1'],
            AddressLine2=shipper_address['line2'],
            City=shipper_address['city'],
            PostalCode=shipper_address['postal_code'],
            StateProvinceCode=from_address['state_code'],
            CountryCode=shipper_address['country_code'])
            
        # Shipper
        shipper = ShipmentConfirm.shipper_type(
            shipper_address_elem,
            Name=shipper_address['company_name'],
            AttentionName=shipper_address['attention_name'],
            TaxIdentificationNumber=shipper_address['tin'],
            PhoneNumber=shipper_address['phone'],
            FaxNumber=shipper_address['fax'],
            EMailAddress=shipper_address['email'],
            ShipperNumber=ups_shipper)
            
        # Ship to
        ship_to = ShipmentConfirm.ship_to_type(
            ship_to_address_elem,
            CompanyName=to_address['company_name'],
            AttentionName=to_address['attention_name'],
            TaxIdentificationNumber=to_address['tin'],
            PhoneNumber=to_address['phone'],
            FaxNumber=to_address['fax'],
            EMailAddress=to_address['email'],
            LocationId='None')
            
        # Ship from
        ship_from = ShipmentConfirm.ship_from_type(
            ship_from_address_elem,
            CompanyName=from_address['company_name'],
            AttentionName=from_address['attention_name'],
            TaxIdentificationNumber=from_address['tin'],
            PhoneNumber=from_address['phone'],
            FaxNumber=from_address['fax'],
            EMailAddress=from_address['email'])
            
        return (shipper, ship_to, ship_from)
Пример #8
0
    def _add_addresses(self, cr, uid, omni, package, context=None):
        """
        Adds the UPS style addresses to the ShipmentConfirm

        """
        address_obj = self.pool.get('res.partner')

	omni_obj = self.pool.get('omniship')
        ups_shipper = omni_obj.get_ups_shipper(cr, uid, omni, context)
        #Fetch Addresses
        to_address = address_obj.address_to_ups_dict(
            cr, uid, package.picking.partner_id, context)
        from_address = address_obj.address_to_ups_dict(
            cr, uid, package.picking.company_id.partner_id, context)
        shipper_address = address_obj.address_to_ups_dict(
            cr, uid, package.picking.company_id.partner_id, context)
        # Generating the XML Elements

        # Ship to address
        ship_to_address_elem = ShipmentConfirm.address_type(
            AddressLine1=to_address['line1'],
            AddressLine2=to_address['line2'],
            City=to_address['city'],
            PostalCode=to_address['postal_code'],
            StateProvinceCode=to_address['state_code'],
            CountryCode=to_address['country_code'],)

        # Ship from address
        ship_from_address_elem = ShipmentConfirm.address_type(
            AddressLine1=from_address['line1'],
            AddressLine2=from_address['line2'],
            City=from_address['city'],
            PostalCode=from_address['postal_code'],
            StateProvinceCode=from_address['state_code'],
            CountryCode=from_address['country_code'])


        # Shipper address
        shipper_address_elem = ShipmentConfirm.address_type(
            AddressLine1=shipper_address['line1'],
            AddressLine2=shipper_address['line2'],
            City=shipper_address['city'],
            PostalCode=shipper_address['postal_code'],
            StateProvinceCode=from_address['state_code'],
            CountryCode=shipper_address['country_code'])

        # Shipper
        shipper = ShipmentConfirm.shipper_type(
            shipper_address_elem,
            Name=shipper_address['company_name'],
            AttentionName=shipper_address['attention_name'],
            TaxIdentificationNumber=shipper_address['tin'],
            PhoneNumber=shipper_address['phone'],
            FaxNumber=shipper_address['fax'],
            EMailAddress=shipper_address['email'] or '',
            ShipperNumber=ups_shipper)

	if to_address['email'] == 'None':
	    to_address['email'] = ''

        # Ship to
        ship_to = ShipmentConfirm.ship_to_type(
            ship_to_address_elem,
            CompanyName=to_address['company_name'],
            AttentionName=to_address['attention_name'],
            TaxIdentificationNumber=to_address['tin'],
            PhoneNumber=to_address['phone'],
            FaxNumber=to_address['fax'],
            EMailAddress=to_address['email'],
            LocationId='None')

        # Ship from
        ship_from = ShipmentConfirm.ship_from_type(
            ship_from_address_elem,
            CompanyName=from_address['company_name'],
            AttentionName=from_address['attention_name'],
            TaxIdentificationNumber=from_address['tin'],
            PhoneNumber=from_address['phone'],
	    FaxNumber=from_address['fax'],
            EMailAddress=from_address['email'])
        return (shipper, ship_to, ship_from)