Add configuration option to store label in filestore
issue10063 review343691002
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
* Add configuration option to store label in filestore
|
||||
* Manage supplier shipment returns
|
||||
|
||||
Version 5.8.0 - 2020-11-02
|
||||
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
|
||||
modules_url = 'https://docs.tryton.org/projects/modules-{module}/en/{series}/'
|
||||
trytond_url = 'https://docs.tryton.org/projects/server/en/{series}/'
|
||||
|
||||
|
||||
def get_info():
|
||||
import configparser
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
module_dir = os.path.dirname(os.path.dirname(__file__))
|
||||
|
||||
config = configparser.ConfigParser()
|
||||
config.read_file(open(os.path.join(module_dir, 'tryton.cfg')))
|
||||
info = dict(config.items('tryton'))
|
||||
|
||||
result = subprocess.run(
|
||||
[sys.executable, 'setup.py', '--name'],
|
||||
stdout=subprocess.PIPE, check=True, cwd=module_dir)
|
||||
info['name'] = result.stdout.decode('utf-8').strip()
|
||||
|
||||
result = subprocess.run(
|
||||
[sys.executable, 'setup.py', '--version'],
|
||||
stdout=subprocess.PIPE, check=True, cwd=module_dir)
|
||||
version = result.stdout.decode('utf-8').strip()
|
||||
if 'dev' in version:
|
||||
info['series'] = 'latest'
|
||||
else:
|
||||
info['series'] = '.'.join(version.split('.', 2)[:2])
|
||||
|
||||
for key in {'depends', 'extras_depend'}:
|
||||
info[key] = info.get(key, '').strip().splitlines()
|
||||
info['modules'] = set(info['depends'] + info['extras_depend'])
|
||||
info['modules'] -= {'ir', 'res'}
|
||||
|
||||
return info
|
||||
|
||||
|
||||
info = get_info()
|
||||
|
||||
master_doc = 'index'
|
||||
project = info['name']
|
||||
release = version = info['series']
|
||||
default_role = 'ref'
|
||||
highlight_language = 'none'
|
||||
extensions = [
|
||||
'sphinx.ext.intersphinx',
|
||||
]
|
||||
intersphinx_mapping = {
|
||||
'trytond': (trytond_url.format(series=version), None),
|
||||
}
|
||||
intersphinx_mapping.update({
|
||||
m: (modules_url.format(
|
||||
module=m.replace('_', '-'), series=version), None)
|
||||
for m in info['modules']
|
||||
})
|
||||
|
||||
del get_info, info, modules_url, trytond_url
|
||||
@@ -0,0 +1,29 @@
|
||||
*************
|
||||
Configuration
|
||||
*************
|
||||
|
||||
The *Stock Package Shipping Module* uses some settings from the
|
||||
``[stock_package_shipping]`` section of the :doc:`configuration file
|
||||
<trytond:topics/configuration>`.
|
||||
|
||||
.. _config-stock_package_shipping.filestore:
|
||||
|
||||
``filestore``
|
||||
=============
|
||||
|
||||
This configuration value indicates whether the shipping label should be stored
|
||||
in the :py:mod:`trytond:trytond.filestore` (``True``) or the database
|
||||
(``False``).
|
||||
|
||||
The default value is: ``False``
|
||||
|
||||
.. _config-stock_package_shipping.store_prefix:
|
||||
|
||||
``store_prefix``
|
||||
================
|
||||
|
||||
This is the prefix to use with the :py:mod:`trytond:trytond.filestore`.
|
||||
This value is only used when the `filestore
|
||||
<config-stock_package_shipping.filestore>` setting is in use.
|
||||
|
||||
The default value is: ``None``
|
||||
@@ -52,3 +52,8 @@ button triggers a wizard that is overridden in shipping service specific
|
||||
modules. The starting state of the wizard is a ``StateTransition``. Its linked
|
||||
method is overridden in shipping service modules in order to communicate with
|
||||
the service.
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
configuration
|
||||
|
||||
@@ -10,9 +10,12 @@ from setuptools import setup, find_packages
|
||||
|
||||
|
||||
def read(fname):
|
||||
return io.open(
|
||||
content = io.open(
|
||||
os.path.join(os.path.dirname(__file__), fname),
|
||||
'r', encoding='utf-8').read()
|
||||
content = re.sub(
|
||||
r'(?m)^\.\. toctree::\r?\n((^$|^\s.*$)\r?\n)*', '', content)
|
||||
return content
|
||||
|
||||
|
||||
def get_require_version(name):
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
|
||||
from trytond.config import config
|
||||
from trytond.i18n import gettext
|
||||
from trytond.model import Workflow, ModelView, fields
|
||||
from trytond.model.exceptions import AccessError
|
||||
@@ -11,6 +12,13 @@ from trytond.wizard import Wizard, StateTransition
|
||||
|
||||
from .exceptions import PackWarning
|
||||
|
||||
if config.getboolean('stock_package_shipping', 'filestore', default=False):
|
||||
file_id = 'shipping_label_id'
|
||||
store_prefix = config.get(
|
||||
'stock_package_shipping', 'store_prefix', default=None)
|
||||
else:
|
||||
file_id = store_prefix = None
|
||||
|
||||
|
||||
class PackageType(metaclass=PoolMeta):
|
||||
__name__ = 'stock.package.type'
|
||||
@@ -87,7 +95,10 @@ class Package(metaclass=PoolMeta):
|
||||
states={
|
||||
'readonly': Eval('_parent_shipment', {}).get('carrier', False),
|
||||
})
|
||||
shipping_label = fields.Binary('Shipping Label', readonly=True)
|
||||
shipping_label = fields.Binary(
|
||||
"Shipping Label", readonly=True,
|
||||
file_id=file_id, store_prefix=store_prefix)
|
||||
shipping_label_id = fields.Char("Shipping Label ID", readonly=True)
|
||||
|
||||
@classmethod
|
||||
def search_rec_name(cls, name, clause):
|
||||
|
||||
Reference in New Issue
Block a user