[tryton-debian-vcs] tryton-modules-account branch upstream-4.0 updated. upstream/4.0.9-1-g1c8eb5e

Mathias Behrle tryton-debian-vcs at alioth.debian.org
Sun Nov 12 16:28:47 UTC 2017


The following commit has been merged in the upstream-4.0 branch:
https://alioth.debian.org/plugins/scmgit/cgi-bin/gitweb.cgi/?p=tryton/tryton-modules-account.git;a=commitdiff;h=upstream/4.0.9-1-g1c8eb5e

commit 1c8eb5eeee4fa4f941d910dc0d1eaef5d1c23441
Author: Mathias Behrle <mathiasb at m9s.biz>
Date:   Sat Nov 11 17:34:02 2017 +0100

    Adding upstream version 4.0.10.
    
    Signed-off-by: Mathias Behrle <mathiasb at m9s.biz>

diff --git a/.drone.yml b/.drone.yml
new file mode 100644
index 0000000..c4fd423
--- /dev/null
+++ b/.drone.yml
@@ -0,0 +1,9 @@
+image: python:all
+env:
+  - POSTGRESQL_URI=postgresql://postgres@127.0.0.1:5432/
+  - MYSQL_URI=mysql://root@127.0.0.1:3306/
+script:
+  - pip install tox
+  - tox -e "{py27,py33,py34,py35}-{sqlite,postgresql}" --skip-missing-interpreters
+services:
+  - postgres
diff --git a/CHANGELOG b/CHANGELOG
index 5e23008..71b3db2 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,6 @@
+Version 4.0.10 - 2017-11-08
+* Bug fixes (see mercurial logs for details)
+
 Version 4.0.9 - 2017-10-04
 * Bug fixes (see mercurial logs for details)
 
diff --git a/PKG-INFO b/PKG-INFO
index f181f47..f294662 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: trytond_account
-Version: 4.0.9
+Version: 4.0.10
 Summary: Tryton module for accounting
 Home-page: http://www.tryton.org/
 Author: Tryton
diff --git a/fiscalyear.py b/fiscalyear.py
index 778bf40..efd5b4e 100644
--- a/fiscalyear.py
+++ b/fiscalyear.py
@@ -138,7 +138,6 @@ class FiscalYear(ModelSQL, ModelView):
     @classmethod
     def write(cls, *args):
         actions = iter(args)
-        args = []
         for fiscalyears, values in zip(actions, actions):
             if values.get('post_move_sequence'):
                 for fiscalyear in fiscalyears:
@@ -147,12 +146,6 @@ class FiscalYear(ModelSQL, ModelView):
                             values['post_move_sequence']):
                         cls.raise_user_error('change_post_move_sequence', (
                                 fiscalyear.rec_name,))
-            values = values.copy()
-            if 'periods' in values:
-                operator = ['delete', 'remove', 'create', 'write', 'add']
-                values['periods'].sort(lambda x, y:
-                    cmp(operator.index(x[0]), operator.index(y[0])))
-            args.extend((fiscalyears, values))
         super(FiscalYear, cls).write(*args)
 
     @classmethod
diff --git a/localize.xsl b/localize.xsl
new file mode 100644
index 0000000..73a1146
--- /dev/null
+++ b/localize.xsl
@@ -0,0 +1,34 @@
+<?xml version="1.0"?>
+<xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+    <xsl:param name="lang"/>
+    <xsl:template match="record[@id]">
+        <xsl:copy>
+            <xsl:attribute name="id">
+                <xsl:value-of select="attribute::id"/>_<xsl:value-of select="$lang"/>
+            </xsl:attribute>
+            <xsl:apply-templates select="@*|node()"/>
+        </xsl:copy>
+    </xsl:template>
+    <xsl:template match="@*">
+        <xsl:choose>
+            <xsl:when test="name()='id' or name()='lang'"></xsl:when>
+            <xsl:when test="name()='ref'">
+                <xsl:attribute name="ref">
+                    <xsl:value-of select="."/>_<xsl:value-of select="$lang"/>
+                </xsl:attribute>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:copy/>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    <xsl:template match="node()">
+        <xsl:choose>
+            <xsl:when test="@lang=$lang or not(@lang)">
+                <xsl:copy>
+                    <xsl:apply-templates select="@*|node()"/>
+                </xsl:copy>
+            </xsl:when>
+        </xsl:choose>
+    </xsl:template>
+</xsl:transform>
diff --git a/move.py b/move.py
index 814293f..3d6ab55 100644
--- a/move.py
+++ b/move.py
@@ -1173,9 +1173,10 @@ class Line(ModelSQL, ModelView):
 
     @classmethod
     def search_move_field(cls, name, clause):
+        nested = clause[0].lstrip(name)
         if name.startswith('move_'):
             name = name[5:]
-        return [('move.' + name,) + tuple(clause[1:])]
+        return [('move.' + name + nested,) + tuple(clause[1:])]
 
     def _order_move_field(name):
         def order_field(tables):
@@ -1203,7 +1204,7 @@ class Line(ModelSQL, ModelView):
         if self.amount_second_currency is not None:
             return self.amount_second_currency * sign
         else:
-            return self.debit - self.credit * sign
+            return (self.debit - self.credit) * sign
 
     def get_amount_currency(self, name):
         if self.second_currency:
diff --git a/period.py b/period.py
index 5c6fc49..4c7c971 100644
--- a/period.py
+++ b/period.py
@@ -102,7 +102,7 @@ class Period(ModelSQL, ModelView):
 
     @classmethod
     def search_company(cls, name, clause):
-        return [('fiscalyear.%s' % name,) + tuple(clause[1:])]
+        return [('fiscalyear.' + clause[0],) + tuple(clause[1:])]
 
     @classmethod
     def validate(cls, periods):
diff --git a/scripts/fix_party b/scripts/fix_party
new file mode 100755
index 0000000..06c1857
--- /dev/null
+++ b/scripts/fix_party
@@ -0,0 +1,109 @@
+#!/usr/bin/env python
+# This file is part of Tryton.  The COPYRIGHT file at the top level of
+# this repository contains the full copyright notices and license terms.
+import sys
+from argparse import ArgumentParser
+
+from proteus import Model, config
+
+from trytond.pool import Pool
+from trytond.transaction import Transaction
+
+
+def allow_modify_party(database):
+    with Transaction().start(database, 'admin'):
+        pool = Pool()
+        Line = pool.get('account.move.line')
+        Line._check_modify_exclude.add('party')
+        try:
+            Line._reconciliation_modify_disallow.remove('party')
+        except KeyError:
+            pass
+
+
+def get_modules():
+    Module = Model.get('ir.module')
+    modules = Module.find([
+            ('state', '=', 'installed'),
+            ])
+    return [m.name for m in modules]
+
+
+def get_empty_party():
+    Line = Model.get('account.move.line')
+    return Line.find([
+            ('party', '=', None),
+            ('account.party_required', '=', True),
+            ])
+
+
+def get_party(line, modules):
+    for module, getter in MODULES_PARTY.items():
+        if module not in modules:
+            continue
+        party = getter(line)
+        if party:
+            return party
+
+
+def get_party_account_invoice(line):
+    Invoice = Model.get('account.invoice')
+
+    if isinstance(line.origin, Invoice):
+        return line.origin.party
+
+
+def get_party_account_statement(line):
+    Statement = Model.get('account.statement')
+
+    if isinstance(line.origin, Statement):
+        for statement_line in line.origin.lines:
+            if statement_line.move == line.move:
+                return statement_line.party
+
+MODULES_PARTY = {
+    'account_invoice': get_party_account_invoice,
+    'account_statement': get_party_account_statement,
+    }
+
+
+def get_set_party():
+    Line = Model.get('account.move.line')
+    return Line.find([
+            ('party', '!=', None),
+            ('account.party_required', '=', False),
+            ])
+
+
+def main(database, config_file=None):
+    config.set_trytond(database, config_file=config_file)
+
+    allow_modify_party(database)
+
+    modules = get_modules()
+
+    Line = Model.get('account.move.line')
+
+    lines = get_empty_party()
+    for line in lines:
+        line.party = get_party(line, modules)
+        if not line.party:
+            print >> sys.stderr, 'Can not fix line: %s' % line.rec_name
+    Line.save(lines)
+
+    lines = get_set_party()
+    for line in lines:
+        line.party = None
+    Line.save(lines)
+
+
+if __name__ == '__main__':
+    parser = ArgumentParser()
+    parser.add_argument('-d', '--database', dest='database')
+    parser.add_argument('-c', '--config', dest='config_file',
+        help='the trytond config file')
+
+    args = parser.parse_args()
+    if not args.database:
+        parser.error('Missing database')
+    main(args.database, args.config_file)
diff --git a/tox.ini b/tox.ini
new file mode 100644
index 0000000..3dda9ab
--- /dev/null
+++ b/tox.ini
@@ -0,0 +1,17 @@
+[tox]
+envlist = {py27,py33,py34,py35}-{sqlite,postgresql,mysql},pypy-{sqlite,postgresql}
+
+[testenv]
+commands = {envpython} setup.py test
+deps =
+    {py27,py33,py34,py35}-postgresql: psycopg2 >= 2.5
+    pypy-postgresql: psycopg2cffi >= 2.5
+    mysql: MySQL-python
+setenv =
+    sqlite: TRYTOND_DATABASE_URI={env:SQLITE_URI:sqlite://}
+    postgresql: TRYTOND_DATABASE_URI={env:POSTGRESQL_URI:postgresql://}
+    mysql: TRYTOND_DATABASE_URI={env:MYSQL_URI:mysql://}
+    sqlite: DB_NAME={env:SQLITE_NAME::memory:}
+    postgresql: DB_NAME={env:POSTGRESQL_NAME:test}
+    mysql: DB_NAME={env:MYSQL_NAME:test}
+install_command = pip install --pre --find-links https://trydevpi.tryton.org/ {opts} {packages}
diff --git a/tryton.cfg b/tryton.cfg
index a6c2eef..e6ea89f 100644
--- a/tryton.cfg
+++ b/tryton.cfg
@@ -1,5 +1,5 @@
 [tryton]
-version=4.0.9
+version=4.0.10
 depends:
     company
     currency
diff --git a/trytond_account.egg-info/PKG-INFO b/trytond_account.egg-info/PKG-INFO
index 49f3ca9..31cc87f 100644
--- a/trytond_account.egg-info/PKG-INFO
+++ b/trytond_account.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: trytond-account
-Version: 4.0.9
+Version: 4.0.10
 Summary: Tryton module for accounting
 Home-page: http://www.tryton.org/
 Author: Tryton
diff --git a/trytond_account.egg-info/SOURCES.txt b/trytond_account.egg-info/SOURCES.txt
index efb86fa..49b4c9c 100644
--- a/trytond_account.egg-info/SOURCES.txt
+++ b/trytond_account.egg-info/SOURCES.txt
@@ -1,16 +1,24 @@
+.drone.yml
+.hgtags
 CHANGELOG
 COPYRIGHT
 INSTALL
 LICENSE
 MANIFEST.in
 README
+__init__.py
+account.py
 account.xml
 aged_balance.odt
+configuration.py
 configuration.xml
+fiscalyear.py
 fiscalyear.xml
 general_journal.odt
 general_ledger.odt
+journal.py
 journal.xml
+localize.xsl
 minimal_chart.xml
 minimal_chart_bg.xml
 minimal_chart_ca.xml
@@ -22,12 +30,18 @@ minimal_chart_nl.xml
 minimal_chart_pt.xml
 minimal_chart_ru.xml
 minimal_chart_sl.xml
+move.py
 move.xml
+move_template.py
 move_template.xml
+party.py
 party.xml
+period.py
 period.xml
 setup.py
+tax.py
 tax.xml
+tox.ini
 trial_balance.odt
 tryton.cfg
 ./__init__.py
@@ -218,10 +232,14 @@ locale/pt_BR.po
 locale/ru_RU.po
 locale/sl_SI.po
 locale/zh_CN.po
+scripts/fix_party
+tests/__init__.py
 tests/scenario_account_reconciliation.rst
 tests/scenario_move_cancel.rst
 tests/scenario_move_template.rst
 tests/scenario_reports.rst
+tests/test_account.py
+tests/tools.py
 trytond_account.egg-info/PKG-INFO
 trytond_account.egg-info/SOURCES.txt
 trytond_account.egg-info/dependency_links.txt
-- 
tryton-modules-account



More information about the tryton-debian-vcs mailing list