[tryton-debian-vcs] tryton-modules-account branch debian-stretch-4.2 updated. debian/4.2.3-1-2-g2c57229

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


The following commit has been merged in the debian-stretch-4.2 branch:
https://alioth.debian.org/plugins/scmgit/cgi-bin/gitweb.cgi/?p=tryton/tryton-modules-account.git;a=commitdiff;h=debian/4.2.3-1-2-g2c57229

commit 2c57229bb89818e9854858f29c8f63b06175fdbf
Author: Mathias Behrle <mathiasb at m9s.biz>
Date:   Sat Nov 11 17:35:46 2017 +0100

    Releasing debian version 4.2.4-1.
    
    Signed-off-by: Mathias Behrle <mathiasb at m9s.biz>

diff --git a/debian/changelog b/debian/changelog
index 90af86d..1f6059a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+tryton-modules-account (4.2.4-1) unstable; urgency=medium
+
+  * Merging upstream version 4.2.4.
+
+ -- Mathias Behrle <mathiasb at m9s.biz>  Sat, 11 Nov 2017 17:35:46 +0100
+
 tryton-modules-account (4.2.3-1) unstable; urgency=medium
 
   * Use the preferred https URL format in the copyright file.
commit 617464279656e1f5793a6c5a8236cfa5f2ff1028
Author: Mathias Behrle <mathiasb at m9s.biz>
Date:   Sat Nov 11 17:35:45 2017 +0100

    Merging upstream version 4.2.4.

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 c2ee804..e7faffd 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,6 @@
+Version 4.2.4 - 2017-11-08
+* Bug fixes (see mercurial logs for details)
+
 Version 4.2.3 - 2017-10-04
 * Bug fixes (see mercurial logs for details)
 
diff --git a/PKG-INFO b/PKG-INFO
index 80c0b22..f60482b 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: trytond_account
-Version: 4.2.3
+Version: 4.2.4
 Summary: Tryton module for accounting
 Home-page: http://www.tryton.org/
 Author: Tryton
diff --git a/fiscalyear.py b/fiscalyear.py
index 0576c5a..bc70007 100644
--- a/fiscalyear.py
+++ b/fiscalyear.py
@@ -140,7 +140,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:
@@ -149,12 +148,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 e6c8544..a6e7cf0 100644
--- a/move.py
+++ b/move.py
@@ -1181,9 +1181,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:])]
 
     @fields.depends('move','_parent_move.state')
     def on_change_with_move_state(self, name=None):
@@ -1216,7 +1217,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 918a473..fa3acad 100644
--- a/period.py
+++ b/period.py
@@ -101,7 +101,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..08e43cf
--- /dev/null
+++ b/tox.ini
@@ -0,0 +1,18 @@
+[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
+    sqlite: sqlitebck
+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 9aa1270..ac86539 100644
--- a/tryton.cfg
+++ b/tryton.cfg
@@ -1,5 +1,5 @@
 [tryton]
-version=4.2.3
+version=4.2.4
 depends:
     company
     currency
diff --git a/trytond_account.egg-info/PKG-INFO b/trytond_account.egg-info/PKG-INFO
index 8c1f9a1..2e33685 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.2.3
+Version: 4.2.4
 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 cc70cc0..4bcb5d6 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
@@ -212,10 +226,14 @@ locale/pt_BR.po
 locale/ru.po
 locale/sl.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