diff --git a/delivery_gls_nl/models/delivery_gls_nl.py b/delivery_gls_nl/models/delivery_gls_nl.py index c0694d70..928018d6 100644 --- a/delivery_gls_nl/models/delivery_gls_nl.py +++ b/delivery_gls_nl/models/delivery_gls_nl.py @@ -2,7 +2,7 @@ from odoo import api, fields, models, _ from odoo.exceptions import UserError, ValidationError from .gls_nl_request import GLSNLRequest from requests import HTTPError -from base64 import decodebytes +from base64 import decodebytes, b64decode from csv import reader as csv_reader @@ -261,7 +261,10 @@ class ProviderGLSNL(models.Model): for i, unit in enumerate(label['units'], 1): trackings.append(unit['unitNo']) uniq_nos.append(unit['uniqueNo']) - attachments.append(('LabelGLSNL-%s-%s.%s' % (unit['unitNo'], i, sudoself.gls_nl_labeltype), unit['label'])) + label_data = unit['label'] + if label_data and sudoself.gls_nl_labeltype == 'pdf': + label_data = b64decode(label_data) + attachments.append(('LabelGLSNL-%s-%s.%s' % (unit['unitNo'], i, sudoself.gls_nl_labeltype), label_data)) tracking = ', '.join(set(trackings)) logmessage = _("Shipment created into GLS NL
" diff --git a/delivery_hibou/models/stock.py b/delivery_hibou/models/stock.py index d072195a..5e2d8b3a 100644 --- a/delivery_hibou/models/stock.py +++ b/delivery_hibou/models/stock.py @@ -34,6 +34,7 @@ class StockPicking(models.Model): _inherit = 'stock.picking' shipping_account_id = fields.Many2one('partner.shipping.account', string='Shipping Account') + commercial_partner_id = fields.Many2one('res.partner', related='partner_id.commercial_partner_id') require_insurance = fields.Selection([ ('auto', 'Automatic'), ('yes', 'Yes'),