mirror of
https://gitlab.com/hibou-io/hibou-odoo/suite.git
synced 2025-01-20 12:37:31 +02:00
Modifications needed for Odoo 11.0 and Python3
This commit is contained in:
@@ -1,2 +1 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import models
|
||||
from . import models
|
||||
|
||||
@@ -1,28 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
#
|
||||
# Author: Jared Kipe
|
||||
# Copyright 2017 Hibou Corp.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
#
|
||||
|
||||
{
|
||||
'name': 'Stamps.com (USPS) Shipping',
|
||||
'summary': 'Send your shippings through Stamps.com and track them online.',
|
||||
'version': '10.0.1.0.0',
|
||||
'version': '11.0.1.0.0',
|
||||
'author': "Hibou Corp.",
|
||||
'category': 'Warehouse',
|
||||
'license': 'AGPL-3',
|
||||
@@ -34,11 +13,6 @@ Stamps.com (USPS) Shipping
|
||||
|
||||
Send your shippings through Stamps.com and track them online.
|
||||
|
||||
Contributors
|
||||
------------
|
||||
|
||||
* Jared Kipe <jared@hibou.io>
|
||||
|
||||
""",
|
||||
'depends': [
|
||||
'delivery',
|
||||
|
||||
@@ -1,2 +1 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from . import delivery_stamps
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
:license: BSD, see LICENSE for more details.
|
||||
"""
|
||||
|
||||
from ConfigParser import NoOptionError, NoSectionError, SafeConfigParser
|
||||
from urllib import pathname2url
|
||||
from urlparse import urljoin
|
||||
from configparser import NoOptionError, NoSectionError, SafeConfigParser
|
||||
from urllib.request import pathname2url
|
||||
from urllib.parse import urljoin
|
||||
import os
|
||||
|
||||
|
||||
|
||||
@@ -285,7 +285,7 @@ class XDecimal(XBuiltin):
|
||||
value for python.
|
||||
"""
|
||||
if topython:
|
||||
if isinstance(value, basestring) and len(value):
|
||||
if isinstance(value, str) and len(value):
|
||||
ret_val = Decimal(value)
|
||||
else:
|
||||
ret_val = None
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from datetime import date
|
||||
from logging import getLogger
|
||||
import urllib2
|
||||
from urllib.request import urlopen
|
||||
from suds import WebFault
|
||||
|
||||
from odoo import api, fields, models, _
|
||||
from odoo.exceptions import ValidationError
|
||||
|
||||
from api.config import StampsConfiguration
|
||||
from api.services import StampsService
|
||||
from .api.config import StampsConfiguration
|
||||
from .api.services import StampsService
|
||||
|
||||
_logger = getLogger(__name__)
|
||||
|
||||
@@ -105,16 +104,16 @@ class ProviderStamps(models.Model):
|
||||
return ret_val
|
||||
|
||||
def _get_order_for_picking(self, picking):
|
||||
if picking.group_id and picking.group_id.procurement_ids and picking.group_id.procurement_ids[0].sale_line_id:
|
||||
return picking.group_id.procurement_ids[0].sale_line_id.order_id
|
||||
if picking.sale_id:
|
||||
return picking.sale_id
|
||||
return None
|
||||
|
||||
def _get_company_for_order(self, order):
|
||||
company = order.company_id
|
||||
if order.team_id and order.team_id.subcompany_id:
|
||||
company = order.team_id.subcompany_id.company_id
|
||||
elif order.project_id and order.project_id.subcompany_id:
|
||||
company = order.project_id.subcompany_id.company_id
|
||||
elif order.analytic_account_id and order.analytic_account_id.subcompany_id:
|
||||
company = order.analytic_account_id.subcompany_id.company_id
|
||||
return company
|
||||
|
||||
def _get_company_for_picking(self, picking):
|
||||
@@ -273,7 +272,7 @@ class ProviderStamps(models.Model):
|
||||
carrier_price += float(label.Rate.Amount)
|
||||
url = label.URL
|
||||
|
||||
response = urllib2.urlopen(url)
|
||||
response = urlopen(url)
|
||||
attachment = response.read()
|
||||
picking.message_post(body=body, attachments=[('LabelStamps-%s.%s' % (label.TrackingNumber, self.stamps_image_type), attachment)])
|
||||
shipping_data = {'exact_price': carrier_price, 'tracking_number': ','.join(tracking_numbers)}
|
||||
|
||||
Reference in New Issue
Block a user