changeset 8a5e54db6bda in modules/account_invoice_stock:default
details: 
https://hg.tryton.org/modules/account_invoice_stock?cmd=changeset;node=8a5e54db6bda
description:
        Improve documentation

        issue9716
        review316221002
diffstat:

 doc/conf.py   |  61 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 doc/index.rst |   7 +++--
 setup.py      |   8 +++++-
 3 files changed, 71 insertions(+), 5 deletions(-)

diffs (107 lines):

diff -r 61dfd17b8423 -r 8a5e54db6bda doc/conf.py
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/conf.py       Wed Feb 17 13:37:08 2021 +0000
@@ -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
diff -r 61dfd17b8423 -r 8a5e54db6bda doc/index.rst
--- a/doc/index.rst     Mon Feb 15 19:13:09 2021 +0100
+++ b/doc/index.rst     Wed Feb 17 13:37:08 2021 +0000
@@ -1,7 +1,8 @@
+############################
 Account Invoice Stock Module
 ############################
 
-The account invoice stock module adds link between invoice lines and stock
+The *Account Invoice Stock Module* links together invoice lines and stock
 moves.
-The unit price of the stock move is updated with the average price of the
-posted invoice lines that are linked to it.
+This allows a stock move's unit price to be updated from the average price
+of the linked invoice lines.
diff -r 61dfd17b8423 -r 8a5e54db6bda setup.py
--- a/setup.py  Mon Feb 15 19:13:09 2021 +0100
+++ b/setup.py  Wed Feb 17 13:37:08 2021 +0000
@@ -10,9 +10,12 @@
 
 
 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):
@@ -80,7 +83,8 @@
     download_url=download_url,
     project_urls={
         "Bug Tracker": 'https://bugs.tryton.org/',
-        "Documentation": 'https://docs.tryton.org/',
+        "Documentation":
+        'https://docs.tryton.org/projects/modules-account-invoice-stock/',
         "Forum": 'https://www.tryton.org/forum',
         "Source Code": 'https://hg.tryton.org/modules/account_invoice_stock',
         },

Reply via email to