[tryton-debian-vcs] tryton-modules-analytic-account branch debian updated. debian/3.2.1-1-4-g77ffab5

Mathias Behrle tryton-debian-vcs at alioth.debian.org
Thu Oct 23 12:14:27 UTC 2014


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

commit 77ffab553aa0b7b9e3bf6f1a49d96f78fc964980
Author: Mathias Behrle <mathiasb at m9s.biz>
Date:   Thu Oct 23 13:31:58 2014 +0200

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

diff --git a/debian/changelog b/debian/changelog
index 824a5fd..3492d77 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+tryton-modules-analytic-account (3.4.0-1) unstable; urgency=medium
+
+  * Adding actual upstream signing key.
+  * Updating to Standards-Version: 3.9.6, no changes needed.
+  * Merging upstream version 3.4.0.
+
+ -- Mathias Behrle <mathiasb at m9s.biz>  Tue, 21 Oct 2014 20:23:53 +0200
+
 tryton-modules-analytic-account (3.2.1-1) unstable; urgency=medium
 
   * Updating signing key while using now plain .asc files instead of .pgp
commit fed8b44e1a301efa1150ccfd6a1d91c2ea069b98
Author: Mathias Behrle <mathiasb at m9s.biz>
Date:   Tue Oct 21 11:29:08 2014 +0200

    Merging upstream version 3.4.0.

diff --git a/CHANGELOG b/CHANGELOG
index 32b259c..0e40e32 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,4 +1,4 @@
-Version 3.2.1 - 2014-07-02
+Version 3.4.0 - 2014-10-20
 * Bug fixes (see mercurial logs for details)
 
 Version 3.2.0 - 2014-04-21
diff --git a/PKG-INFO b/PKG-INFO
index 3b767d5..65ac0d1 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,12 +1,12 @@
 Metadata-Version: 1.1
 Name: trytond_analytic_account
-Version: 3.2.1
+Version: 3.4.0
 Summary: Tryton module for analytic accounting
 Home-page: http://www.tryton.org/
 Author: Tryton
 Author-email: issue_tracker at tryton.org
 License: GPL-3
-Download-URL: http://downloads.tryton.org/3.2/
+Download-URL: http://downloads.tryton.org/3.4/
 Description: trytond_analytic_account
         ========================
         
diff --git a/account.py b/account.py
index acb1061..359e326 100644
--- a/account.py
+++ b/account.py
@@ -195,8 +195,7 @@ class Account(ModelSQL, ModelView):
         return res
 
     @classmethod
-    def get_credit_debit(cls, accounts, name):
-        res = {}
+    def get_credit_debit(cls, accounts, names):
         pool = Pool()
         Line = pool.get('analytic_account.line')
         MoveLine = pool.get('account.move.line')
@@ -210,16 +209,21 @@ class Account(ModelSQL, ModelView):
         a_account = Account.__table__()
         company = Company.__table__()
 
-        if name not in ('credit', 'debit'):
-            raise Exception('Bad argument')
+        result = {}
+        ids = [a.id for a in accounts]
+        for name in names:
+            if name not in ('credit', 'debit'):
+                raise Exception('Bad argument')
+            result[name] = {}.fromkeys(ids, Decimal('0.0'))
 
         id2account = {}
-        ids = [a.id for a in accounts]
         for account in accounts:
-            res[account.id] = Decimal('0.0')
             id2account[account.id] = account
 
         line_query = Line.query_get(line)
+        columns = [table.id, company.currency]
+        for name in names:
+            columns.append(Sum(Coalesce(Column(line, name), 0)))
         cursor.execute(*table.join(line, 'LEFT',
                 condition=table.id == line.account
                 ).join(move_line, 'LEFT',
@@ -228,31 +232,33 @@ class Account(ModelSQL, ModelView):
                 condition=a_account.id == move_line.account
                 ).join(company, 'LEFT',
                 condition=company.id == a_account.company
-                ).select(table.id,
-                Sum(Coalesce(Column(line, name), 0)),
-                company.currency,
+                ).select(*columns,
                 where=(table.type != 'view')
                 & table.id.in_(ids)
                 & table.active & line_query,
                 group_by=(table.id, company.currency)))
 
         id2currency = {}
-        for account_id, sum, currency_id in cursor.fetchall():
-            # SQLite uses float for SUM
-            if not isinstance(sum, Decimal):
-                sum = Decimal(str(sum))
-            if currency_id != id2account[account_id].currency.id:
-                currency = None
-                if currency_id in id2currency:
-                    currency = id2currency[currency_id]
+        for row in cursor.fetchall():
+            account = id2account[row[0]]
+            currency_id = row[1]
+            for i, name in enumerate(names, 2):
+                # SQLite uses float for SUM
+                sum = row[i]
+                if not isinstance(sum, Decimal):
+                    sum = Decimal(str(sum))
+                if currency_id != account.currency.id:
+                    currency = None
+                    if currency_id in id2currency:
+                        currency = id2currency[currency_id]
+                    else:
+                        currency = Currency(currency_id)
+                        id2currency[currency.id] = currency
+                    result[name][account.id] += Currency.compute(currency, sum,
+                            account.currency, round=True)
                 else:
-                    currency = Currency(currency_id)
-                    id2currency[currency.id] = currency
-                res[account_id] += Currency.compute(currency, sum,
-                        id2account[account_id].currency, round=True)
-            else:
-                res[account_id] += id2account[account_id].currency.round(sum)
-        return res
+                    result[name][account.id] += account.currency.round(sum)
+        return result
 
     def get_rec_name(self, name):
         if self.code:
diff --git a/account.xml b/account.xml
index ac0bc07..0264b3b 100644
--- a/account.xml
+++ b/account.xml
@@ -104,15 +104,6 @@ this repository contains the full copyright notices and license terms. -->
             <field name="perm_delete" eval="True"/>
         </record>
 
-        <record model="ir.rule.group" id="rule_group_account">
-            <field name="model" search="[('model', '=', 'analytic_account.account')]"/>
-            <field name="global_p" eval="True"/>
-        </record>
-        <record model="ir.rule" id="rule_account1">
-            <field name="domain">[('company', 'in', [c.id for c in user.companies])]</field>
-            <field name="rule_group" ref="rule_group_account"/>
-        </record>
-
         <record model="ir.ui.view" id="open_chart_start_view_form">
             <field name="model">analytic_account.open_chart.start</field>
             <field name="type">form</field>
diff --git a/line.py b/line.py
index 9a0d984..c3458c3 100644
--- a/line.py
+++ b/line.py
@@ -23,8 +23,17 @@ class Line(ModelSQL, ModelView):
             'Currency'), 'on_change_with_currency')
     currency_digits = fields.Function(fields.Integer('Currency Digits'),
         'on_change_with_currency_digits')
+    company = fields.Function(fields.Many2One('company.company', 'Company'),
+        'on_change_with_company')
     account = fields.Many2One('analytic_account.account', 'Account',
-            required=True, select=True, domain=[('type', '!=', 'view')])
+            required=True, select=True, domain=[
+            ('type', '!=', 'view'),
+            ['OR',
+                ('company', '=', None),
+                ('company', '=', Eval('company', -1)),
+                ],
+            ],
+        depends=['company'])
     move_line = fields.Many2One('account.move.line', 'Account Move Line',
             ondelete='CASCADE', required=True)
     journal = fields.Many2One('account.journal', 'Journal', required=True,
@@ -89,6 +98,11 @@ class Line(ModelSQL, ModelView):
             return self.move_line.account.company.currency.digits
         return 2
 
+    @fields.depends('move_line')
+    def on_change_with_company(self, name=None):
+        if self.move_line:
+            return self.move_line.account.company.id
+
     @staticmethod
     def query_get(table):
         '''
diff --git a/locale/bg_BG.po b/locale/bg_BG.po
index 8686249..9f969a2 100644
--- a/locale/bg_BG.po
+++ b/locale/bg_BG.po
@@ -199,6 +199,11 @@ msgctxt "field:analytic_account.line,active:"
 msgid "Active"
 msgstr "Активен"
 
+#, fuzzy
+msgctxt "field:analytic_account.line,company:"
+msgid "Company"
+msgstr "Фирма"
+
 msgctxt "field:analytic_account.line,create_date:"
 msgid "Create Date"
 msgstr "Създадено на"
diff --git a/locale/ca_ES.po b/locale/ca_ES.po
index 130735f..1d52814 100644
--- a/locale/ca_ES.po
+++ b/locale/ca_ES.po
@@ -16,7 +16,7 @@ msgstr "Valors d'haver/deure erronis."
 
 msgctxt "error:analytic_account.line:"
 msgid "You can not create a move line using inactive account \"%s\"."
-msgstr "No podeu crear una línia de moviment utilitzant un compte \"%s\" inactiu."
+msgstr "No podeu crear un apunt utilitzant un compte \"%s\" inactiu."
 
 msgctxt "error:analytic_account.line:"
 msgid "You can not create a move line using view account \"%s\"."
@@ -197,6 +197,10 @@ msgctxt "field:analytic_account.line,active:"
 msgid "Active"
 msgstr "Actiu"
 
+msgctxt "field:analytic_account.line,company:"
+msgid "Company"
+msgstr "Empresa"
+
 msgctxt "field:analytic_account.line,create_date:"
 msgid "Create Date"
 msgstr "Data creació"
diff --git a/locale/cs_CZ.po b/locale/cs_CZ.po
index 214af49..aab0650 100644
--- a/locale/cs_CZ.po
+++ b/locale/cs_CZ.po
@@ -195,6 +195,10 @@ msgctxt "field:analytic_account.line,active:"
 msgid "Active"
 msgstr ""
 
+msgctxt "field:analytic_account.line,company:"
+msgid "Company"
+msgstr ""
+
 msgctxt "field:analytic_account.line,create_date:"
 msgid "Create Date"
 msgstr ""
diff --git a/locale/de_DE.po b/locale/de_DE.po
index 4d80f02..95701c4 100644
--- a/locale/de_DE.po
+++ b/locale/de_DE.po
@@ -285,6 +285,10 @@ msgctxt "field:analytic_account.line,active:"
 msgid "Active"
 msgstr "Aktiv"
 
+msgctxt "field:analytic_account.line,company:"
+msgid "Company"
+msgstr "Unternehmen"
+
 msgctxt "field:analytic_account.line,create_date:"
 msgid "Create Date"
 msgstr "Erstellungsdatum"
diff --git a/locale/es_AR.po b/locale/es_AR.po
index 45caffb..76a46d1 100644
--- a/locale/es_AR.po
+++ b/locale/es_AR.po
@@ -198,6 +198,10 @@ msgctxt "field:analytic_account.line,active:"
 msgid "Active"
 msgstr "Activa"
 
+msgctxt "field:analytic_account.line,company:"
+msgid "Company"
+msgstr "Empresa"
+
 msgctxt "field:analytic_account.line,create_date:"
 msgid "Create Date"
 msgstr "Fecha creación"
diff --git a/locale/es_CO.po b/locale/es_CO.po
index 0fe9dd4..d6fa4b0 100644
--- a/locale/es_CO.po
+++ b/locale/es_CO.po
@@ -198,6 +198,10 @@ msgctxt "field:analytic_account.line,active:"
 msgid "Active"
 msgstr "Activo"
 
+msgctxt "field:analytic_account.line,company:"
+msgid "Company"
+msgstr "Compañía"
+
 msgctxt "field:analytic_account.line,create_date:"
 msgid "Create Date"
 msgstr "Fecha de Creación"
@@ -329,7 +333,7 @@ msgstr "Cuentas Analíticas"
 
 msgctxt "model:ir.ui.menu,name:menu_analytic_account_configuration"
 msgid "Analytic Account"
-msgstr "Cuenta Analítica"
+msgstr "Centros de Costos"
 
 msgctxt "model:ir.ui.menu,name:menu_open_chart"
 msgid "Open Chart of Analytic Accounts"
diff --git a/locale/es_CO.po b/locale/es_EC.po
similarity index 94%
copy from locale/es_CO.po
copy to locale/es_EC.po
index 0fe9dd4..c3815a1 100644
--- a/locale/es_CO.po
+++ b/locale/es_EC.po
@@ -7,21 +7,22 @@ msgid ""
 "Can not have many accounts with the same root or a missing mandatory root "
 "account on \"%s\"."
 msgstr ""
-"No puede tener varias cuentas con la misma cuenta padre o que les falte la "
-"cuenta padre!"
+"No se puede tener muchas cuentas con la misma raíz o falta una cuenta raíz "
+"obligatoria en \"%s\"."
 
 msgctxt "error:analytic_account.line:"
 msgid "Wrong credit/debit values."
-msgstr "Valores de haber/debe incorrectos!"
+msgstr "Valores de crédito/débito erróneos."
 
 msgctxt "error:analytic_account.line:"
 msgid "You can not create a move line using inactive account \"%s\"."
-msgstr "No puede crear una línea de asiento usando la cuenta inactiva \"%s\"."
+msgstr "No puede crear una línea de asiento utilizando la cuenta inactiva \"%s\"."
 
 msgctxt "error:analytic_account.line:"
 msgid "You can not create a move line using view account \"%s\"."
 msgstr ""
-"No puede crear una línea de asiento usando una cuenta de tipo vista \"%s\"."
+"No puede crear una línea de asiento utilizando la cuenta de tipo vista "
+"\"%s\"."
 
 msgctxt "field:account.move.line,analytic_lines:"
 msgid "Analytic Lines"
@@ -45,7 +46,7 @@ msgstr "Código"
 
 msgctxt "field:analytic_account.account,company:"
 msgid "Company"
-msgstr "Compañía"
+msgstr "Empresa"
 
 msgctxt "field:analytic_account.account,create_date:"
 msgid "Create Date"
@@ -198,6 +199,10 @@ msgctxt "field:analytic_account.line,active:"
 msgid "Active"
 msgstr "Activo"
 
+msgctxt "field:analytic_account.line,company:"
+msgid "Company"
+msgstr "Empresa"
+
 msgctxt "field:analytic_account.line,create_date:"
 msgid "Create Date"
 msgstr "Fecha de Creación"
@@ -232,11 +237,11 @@ msgstr "ID"
 
 msgctxt "field:analytic_account.line,journal:"
 msgid "Journal"
-msgstr "Libro Contable"
+msgstr "Libro Diario"
 
 msgctxt "field:analytic_account.line,move_line:"
 msgid "Account Move Line"
-msgstr "Línea de Asiento"
+msgstr "Línea de Asiento Contable"
 
 msgctxt "field:analytic_account.line,name:"
 msgid "Name"
@@ -244,7 +249,7 @@ msgstr "Nombre"
 
 msgctxt "field:analytic_account.line,party:"
 msgid "Party"
-msgstr "Terceros"
+msgstr "Tercero"
 
 msgctxt "field:analytic_account.line,rec_name:"
 msgid "Name"
@@ -329,7 +334,7 @@ msgstr "Cuentas Analíticas"
 
 msgctxt "model:ir.ui.menu,name:menu_analytic_account_configuration"
 msgid "Analytic Account"
-msgstr "Cuenta Analítica"
+msgstr "Contabilidad Analítica"
 
 msgctxt "model:ir.ui.menu,name:menu_open_chart"
 msgid "Open Chart of Analytic Accounts"
@@ -349,7 +354,7 @@ msgstr "Débito - Crédito"
 
 msgctxt "selection:analytic_account.account,state:"
 msgid "Closed"
-msgstr "Cerrado"
+msgstr "Cerrada"
 
 msgctxt "selection:analytic_account.account,state:"
 msgid "Draft"
@@ -357,7 +362,7 @@ msgstr "Borrador"
 
 msgctxt "selection:analytic_account.account,state:"
 msgid "Opened"
-msgstr "Abierto"
+msgstr "Abierta"
 
 msgctxt "selection:analytic_account.account,type:"
 msgid "Normal"
@@ -397,7 +402,7 @@ msgstr "Notas"
 
 msgctxt "view:analytic_account.line:"
 msgid "Analytic Line"
-msgstr "Línea analítica"
+msgstr "Línea Analítica"
 
 msgctxt "view:analytic_account.line:"
 msgid "Analytic Lines"
diff --git a/locale/es_ES.po b/locale/es_ES.po
index 35e1e70..5971ada 100644
--- a/locale/es_ES.po
+++ b/locale/es_ES.po
@@ -16,7 +16,7 @@ msgstr "Valores de haber/debe erróneos."
 
 msgctxt "error:analytic_account.line:"
 msgid "You can not create a move line using inactive account \"%s\"."
-msgstr "No puede crear una línea de movimiento usando una cuenta inactiva \"%s\"."
+msgstr "No puede crear un apunte usando una cuenta inactiva \"%s\"."
 
 msgctxt "error:analytic_account.line:"
 msgid "You can not create a move line using view account \"%s\"."
@@ -197,6 +197,10 @@ msgctxt "field:analytic_account.line,active:"
 msgid "Active"
 msgstr "Activa"
 
+msgctxt "field:analytic_account.line,company:"
+msgid "Company"
+msgstr "Empresa"
+
 msgctxt "field:analytic_account.line,create_date:"
 msgid "Create Date"
 msgstr "Fecha creación"
diff --git a/locale/fr_FR.po b/locale/fr_FR.po
index d797e1b..06dbd1d 100644
--- a/locale/fr_FR.po
+++ b/locale/fr_FR.po
@@ -8,7 +8,7 @@ msgid ""
 "account on \"%s\"."
 msgstr ""
 "Plusieurs comptes ont la même racine ou il manque une racine obligatoire sur"
-" \"%s\"."
+" « %s »."
 
 msgctxt "error:analytic_account.line:"
 msgid "Wrong credit/debit values."
@@ -17,14 +17,14 @@ msgstr "Valeurs de débit/crédit incorrectes."
 msgctxt "error:analytic_account.line:"
 msgid "You can not create a move line using inactive account \"%s\"."
 msgstr ""
-"Vous ne pouvez pas crér une ligne de mouvement avec le compte inactif "
-"\"%s\"."
+"Vous ne pouvez pas crér une ligne de mouvement avec le compte inactif « %s "
+"»."
 
 msgctxt "error:analytic_account.line:"
 msgid "You can not create a move line using view account \"%s\"."
 msgstr ""
-"Vous ne pouvez pas crér une ligne de mouvement avec le compte de type vue "
-"\"%s\"."
+"Vous ne pouvez pas crér une ligne de mouvement avec le compte de type vue « "
+"%s »."
 
 msgctxt "field:account.move.line,analytic_lines:"
 msgid "Analytic Lines"
@@ -201,6 +201,10 @@ msgctxt "field:analytic_account.line,active:"
 msgid "Active"
 msgstr "Actif"
 
+msgctxt "field:analytic_account.line,company:"
+msgid "Company"
+msgstr "Société"
+
 msgctxt "field:analytic_account.line,create_date:"
 msgid "Create Date"
 msgstr "Date de création"
@@ -352,7 +356,7 @@ msgstr "Débit - Crédit"
 
 msgctxt "selection:analytic_account.account,state:"
 msgid "Closed"
-msgstr "Fermé"
+msgstr "Clôturé"
 
 msgctxt "selection:analytic_account.account,state:"
 msgid "Draft"
diff --git a/locale/nl_NL.po b/locale/nl_NL.po
index 973afc6..9c713e5 100644
--- a/locale/nl_NL.po
+++ b/locale/nl_NL.po
@@ -218,6 +218,11 @@ msgctxt "field:analytic_account.line,active:"
 msgid "Active"
 msgstr "Actief"
 
+#, fuzzy
+msgctxt "field:analytic_account.line,company:"
+msgid "Company"
+msgstr "Bedrijf"
+
 msgctxt "field:analytic_account.line,create_date:"
 msgid "Create Date"
 msgstr ""
diff --git a/locale/ru_RU.po b/locale/ru_RU.po
index 5943a0c..4a236ec 100644
--- a/locale/ru_RU.po
+++ b/locale/ru_RU.po
@@ -197,6 +197,11 @@ msgctxt "field:analytic_account.line,active:"
 msgid "Active"
 msgstr "Действующий"
 
+#, fuzzy
+msgctxt "field:analytic_account.line,company:"
+msgid "Company"
+msgstr "Учет.орг."
+
 msgctxt "field:analytic_account.line,create_date:"
 msgid "Create Date"
 msgstr "Дата создания"
diff --git a/locale/sl_SI.po b/locale/sl_SI.po
index 0118735..8578c80 100644
--- a/locale/sl_SI.po
+++ b/locale/sl_SI.po
@@ -48,11 +48,11 @@ msgstr "Družba"
 
 msgctxt "field:analytic_account.account,create_date:"
 msgid "Create Date"
-msgstr "Ustvarjeno"
+msgstr "Izdelano"
 
 msgctxt "field:analytic_account.account,create_uid:"
 msgid "Create User"
-msgstr "Ustvaril"
+msgstr "Izdelal"
 
 msgctxt "field:analytic_account.account,credit:"
 msgid "Credit"
@@ -127,13 +127,13 @@ msgctxt ""
 "field:analytic_account.account-"
 "analytic_account.account.selection,create_date:"
 msgid "Create Date"
-msgstr "Ustvarjeno"
+msgstr "Izdelano"
 
 msgctxt ""
 "field:analytic_account.account-"
 "analytic_account.account.selection,create_uid:"
 msgid "Create User"
-msgstr "Ustvaril"
+msgstr "Izdelal"
 
 msgctxt ""
 "field:analytic_account.account-analytic_account.account.selection,id:"
@@ -167,11 +167,11 @@ msgstr "Konti"
 
 msgctxt "field:analytic_account.account.selection,create_date:"
 msgid "Create Date"
-msgstr "Ustvarjeno"
+msgstr "Izdelano"
 
 msgctxt "field:analytic_account.account.selection,create_uid:"
 msgid "Create User"
-msgstr "Ustvaril"
+msgstr "Izdelal"
 
 msgctxt "field:analytic_account.account.selection,id:"
 msgid "ID"
@@ -197,13 +197,17 @@ msgctxt "field:analytic_account.line,active:"
 msgid "Active"
 msgstr "Aktivno"
 
+msgctxt "field:analytic_account.line,company:"
+msgid "Company"
+msgstr "Družba"
+
 msgctxt "field:analytic_account.line,create_date:"
 msgid "Create Date"
-msgstr "Ustvarjeno"
+msgstr "Izdelano"
 
 msgctxt "field:analytic_account.line,create_uid:"
 msgid "Create User"
-msgstr "Ustvaril"
+msgstr "Izdelal"
 
 msgctxt "field:analytic_account.line,credit:"
 msgid "Credit"
diff --git a/tests/test_analytic_account.py b/tests/test_analytic_account.py
index d5a69ac..e3b9bb4 100644
--- a/tests/test_analytic_account.py
+++ b/tests/test_analytic_account.py
@@ -1,8 +1,11 @@
 #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 unittest
+from decimal import Decimal
 import trytond.tests.test_tryton
 from trytond.tests.test_tryton import test_view, test_depends
+from trytond.tests.test_tryton import POOL, DB_NAME, USER, CONTEXT
+from trytond.transaction import Transaction
 
 
 class AnalyticAccountTestCase(unittest.TestCase):
@@ -10,6 +13,12 @@ class AnalyticAccountTestCase(unittest.TestCase):
 
     def setUp(self):
         trytond.tests.test_tryton.install_module('analytic_account')
+        self.fiscalyear = POOL.get('account.fiscalyear')
+        self.journal = POOL.get('account.journal')
+        self.move = POOL.get('account.move')
+        self.account = POOL.get('account.account')
+        self.analytic_account = POOL.get('analytic_account.account')
+        self.party = POOL.get('party.party')
 
     def test0005views(self):
         'Test views'
@@ -19,9 +28,121 @@ class AnalyticAccountTestCase(unittest.TestCase):
         'Test depends'
         test_depends()
 
+    def test0010account_debit_credit(self):
+        'Test account debit/credit'
+        with Transaction().start(DB_NAME, USER,
+                context=CONTEXT) as transaction:
+            party = self.party(name='Party')
+            party.save()
+            root, = self.analytic_account.create([{
+                        'type': 'root',
+                        'name': 'Root',
+                        }])
+            analytic_account, = self.analytic_account.create([{
+                        'type': 'normal',
+                        'name': 'Analytic Account',
+                        'parent': root.id,
+                        'root': root.id,
+                        }])
+            fiscalyear, = self.fiscalyear.search([])
+            period = fiscalyear.periods[0]
+            journal_revenue, = self.journal.search([
+                    ('code', '=', 'REV'),
+                    ])
+            journal_expense, = self.journal.search([
+                    ('code', '=', 'EXP'),
+                    ])
+            revenue, = self.account.search([
+                    ('kind', '=', 'revenue'),
+                    ])
+            receivable, = self.account.search([
+                    ('kind', '=', 'receivable'),
+                    ])
+            expense, = self.account.search([
+                    ('kind', '=', 'expense'),
+                    ])
+            payable, = self.account.search([
+                    ('kind', '=', 'payable'),
+                    ])
+
+            first_account_line = {
+                'account': revenue.id,
+                'credit': Decimal(100),
+                'analytic_lines': [
+                    ('create', [{
+                                'account': analytic_account.id,
+                                'name': 'Analytic Line',
+                                'credit': Decimal(100),
+                                'debit': Decimal(0),
+                                'journal': journal_revenue.id,
+                                'date': period.start_date,
+                                }])
+                    ]}
+            second_account_line = {
+                'account': expense.id,
+                'debit': Decimal(30),
+                'analytic_lines': [
+                    ('create', [{
+                                'account': analytic_account.id,
+                                'name': 'Analytic Line',
+                                'debit': Decimal(30),
+                                'credit': Decimal(0),
+                                'journal': journal_expense.id,
+                                'date': period.start_date,
+                                }])
+                    ]}
+            # Create some moves
+            vlist = [{
+                    'period': period.id,
+                    'journal': journal_revenue.id,
+                    'date': period.start_date,
+                    'lines': [
+                        ('create', [first_account_line, {
+                                    'account': receivable.id,
+                                    'debit': Decimal(100),
+                                    'party': party.id,
+                                    }]),
+                        ],
+                    }, {
+                    'period': period.id,
+                    'journal': journal_expense.id,
+                    'date': period.start_date,
+                    'lines': [
+                        ('create', [second_account_line, {
+                                    'account': payable.id,
+                                    'credit': Decimal(30),
+                                    'party': party.id,
+                                    }]),
+                        ],
+                    },
+                ]
+            self.move.create(vlist)
+
+            self.assertEqual((analytic_account.debit, analytic_account.credit),
+                (Decimal(30), Decimal(100)))
+            self.assertEqual(analytic_account.balance, Decimal(70))
+
+            with transaction.set_context(start_date=period.end_date):
+                analytic_account = self.analytic_account(analytic_account.id)
+                self.assertEqual((analytic_account.debit,
+                        analytic_account.credit),
+                    (Decimal(0), Decimal(0)))
+                self.assertEqual(analytic_account.balance, Decimal(0))
+
+            with transaction.set_context(end_date=period.end_date):
+                analytic_account = self.analytic_account(analytic_account.id)
+                self.assertEqual((analytic_account.debit,
+                        analytic_account.credit),
+                    (Decimal(30), Decimal(100)))
+                self.assertEqual(analytic_account.balance, Decimal(70))
+
 
 def suite():
     suite = trytond.tests.test_tryton.suite()
+    from trytond.modules.account.tests import test_account
+    for test in test_account.suite():
+        if test not in suite:
+            suite.addTest(test)
     suite.addTests(unittest.TestLoader().loadTestsFromTestCase(
         AnalyticAccountTestCase))
     return suite
diff --git a/tryton.cfg b/tryton.cfg
index 9bc8e4d..326c98e 100644
--- a/tryton.cfg
+++ b/tryton.cfg
@@ -1,5 +1,5 @@
 [tryton]
-version=3.2.1
+version=3.4.0
 depends:
     account
     company
diff --git a/trytond_analytic_account.egg-info/PKG-INFO b/trytond_analytic_account.egg-info/PKG-INFO
index 1588944..8395f22 100644
--- a/trytond_analytic_account.egg-info/PKG-INFO
+++ b/trytond_analytic_account.egg-info/PKG-INFO
@@ -1,12 +1,12 @@
 Metadata-Version: 1.1
 Name: trytond-analytic-account
-Version: 3.2.1
+Version: 3.4.0
 Summary: Tryton module for analytic accounting
 Home-page: http://www.tryton.org/
 Author: Tryton
 Author-email: issue_tracker at tryton.org
 License: GPL-3
-Download-URL: http://downloads.tryton.org/3.2/
+Download-URL: http://downloads.tryton.org/3.4/
 Description: trytond_analytic_account
         ========================
         
diff --git a/trytond_analytic_account.egg-info/SOURCES.txt b/trytond_analytic_account.egg-info/SOURCES.txt
index a754472..75de253 100644
--- a/trytond_analytic_account.egg-info/SOURCES.txt
+++ b/trytond_analytic_account.egg-info/SOURCES.txt
@@ -11,15 +11,40 @@ setup.py
 tryton.cfg
 ./__init__.py
 ./account.py
+./account.xml
+./analytic_account.xml
 ./line.py
+./line.xml
+./tryton.cfg
+./locale/bg_BG.po
+./locale/ca_ES.po
+./locale/cs_CZ.po
+./locale/de_DE.po
+./locale/es_AR.po
+./locale/es_CO.po
+./locale/es_EC.po
+./locale/es_ES.po
+./locale/fr_FR.po
+./locale/nl_NL.po
+./locale/ru_RU.po
+./locale/sl_SI.po
 ./tests/__init__.py
 ./tests/test_analytic_account.py
+./view/account_form.xml
+./view/account_list.xml
+./view/account_tree.xml
+./view/account_tree2.xml
+./view/line_form.xml
+./view/line_tree.xml
+./view/move_line_form.xml
+./view/open_chart_start_form.xml
 locale/bg_BG.po
 locale/ca_ES.po
 locale/cs_CZ.po
 locale/de_DE.po
 locale/es_AR.po
 locale/es_CO.po
+locale/es_EC.po
 locale/es_ES.po
 locale/fr_FR.po
 locale/nl_NL.po
diff --git a/trytond_analytic_account.egg-info/requires.txt b/trytond_analytic_account.egg-info/requires.txt
index b4e861f..908f66e 100644
--- a/trytond_analytic_account.egg-info/requires.txt
+++ b/trytond_analytic_account.egg-info/requires.txt
@@ -1,6 +1,6 @@
 python-sql
-trytond_account >= 3.2, < 3.3
-trytond_company >= 3.2, < 3.3
-trytond_currency >= 3.2, < 3.3
-trytond_party >= 3.2, < 3.3
-trytond >= 3.2, < 3.3
\ No newline at end of file
+trytond_account >= 3.4, < 3.5
+trytond_company >= 3.4, < 3.5
+trytond_currency >= 3.4, < 3.5
+trytond_party >= 3.4, < 3.5
+trytond >= 3.4, < 3.5
\ No newline at end of file
-- 
tryton-modules-analytic-account



More information about the tryton-debian-vcs mailing list