trytond-carrier_send_shipme.../manifest.py

26 lines
922 B
Python
Raw Normal View History

2014-05-27 14:29:09 +02:00
# This file is part of carrier_send_shipments_seurvalencia module for Tryton.
# The COPYRIGHT file at the top level of this repository contains
# the full copyright notices and license terms.
from seurvalencia import Picking
from trytond.pool import PoolMeta
2015-04-21 10:20:37 +02:00
from trytond.transaction import Transaction
from base64 import decodestring
2014-05-27 14:29:09 +02:00
2014-05-28 17:28:12 +02:00
__all__ = ['CarrierManifest']
2014-05-27 14:29:09 +02:00
2018-09-15 18:08:52 +02:00
class CarrierManifest(metaclass=PoolMeta):
2014-05-28 17:28:12 +02:00
__name__ = 'carrier.manifest'
2014-05-27 14:29:09 +02:00
def get_manifest_seurvalencia(self, api, from_date, to_date):
dbname = Transaction().database.name
2015-04-21 10:20:37 +02:00
2014-05-27 14:29:09 +02:00
with Picking(api.username, api.password, api.debug) as picking_api:
2015-04-21 10:20:37 +02:00
manifest_file = picking_api.info()
if manifest_file:
manifiest = decodestring(manifest_file)
file_name = '%s-manifest-seurvalencia.pdf' % dbname
return (manifiest, file_name)
else:
return