[tryton-debian-vcs] tryton-modules-analytic-invoice branch upstream updated. upstream/4.0.1-1-ga8860ef
Mathias Behrle
tryton-debian-vcs at alioth.debian.org
Tue Dec 6 15:54:50 UTC 2016
The following commit has been merged in the upstream branch:
https://alioth.debian.org/plugins/scmgit/cgi-bin/gitweb.cgi/?p=tryton/tryton-modules-analytic-invoice.git;a=commitdiff;h=upstream/4.0.1-1-ga8860ef
commit a8860eff5dab1b1e54fd04e00f2246c95ed8c39b
Author: Mathias Behrle <mathiasb at m9s.biz>
Date: Mon Dec 5 09:34:18 2016 +0100
Adding upstream version 4.2.0.
Signed-off-by: Mathias Behrle <mathiasb at m9s.biz>
diff --git a/CHANGELOG b/CHANGELOG
index b6ab8b6..b2dc8a3 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,5 +1,6 @@
-Version 4.0.1 - 2016-05-11
+Version 4.2.0 - 2016-11-28
* Bug fixes (see mercurial logs for details)
+* Add support for depreciable assets
Version 4.0.0 - 2016-05-02
* Bug fixes (see mercurial logs for details)
diff --git a/INSTALL b/INSTALL
index bc795f4..1c7c2c9 100644
--- a/INSTALL
+++ b/INSTALL
@@ -24,7 +24,7 @@ site-packages directory on your system.
For advanced options, please refer to the easy_install and/or the distutils
documentation:
- http://peak.telecommunity.com/DevCenter/EasyInstall
+ http://setuptools.readthedocs.io/en/latest/easy_install.html
http://docs.python.org/inst/inst.html
To use without installation, extract the archive into ``trytond/modules`` with
diff --git a/PKG-INFO b/PKG-INFO
index 7c315bf..fe0065d 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,12 +1,12 @@
Metadata-Version: 1.1
Name: trytond_analytic_invoice
-Version: 4.0.1
+Version: 4.2.0
Summary: Tryton module to add analytic accounting on invoice
Home-page: http://www.tryton.org/
Author: Tryton
Author-email: issue_tracker at tryton.org
License: GPL-3
-Download-URL: http://downloads.tryton.org/4.0/
+Download-URL: http://downloads.tryton.org/4.2/
Description: trytond_analytic_invoice
========================
@@ -62,6 +62,7 @@ Classifier: Natural Language :: French
Classifier: Natural Language :: German
Classifier: Natural Language :: Hungarian
Classifier: Natural Language :: Italian
+Classifier: Natural Language :: Polish
Classifier: Natural Language :: Portuguese (Brazilian)
Classifier: Natural Language :: Russian
Classifier: Natural Language :: Slovenian
diff --git a/__init__.py b/__init__.py
index 9487c80..644128c 100644
--- a/__init__.py
+++ b/__init__.py
@@ -3,10 +3,12 @@
from trytond.pool import Pool
from .invoice import *
+from . import asset
def register():
Pool.register(
InvoiceLine,
AnalyticAccountEntry,
+ asset.Asset,
module='analytic_invoice', type_='model')
diff --git a/asset.py b/asset.py
new file mode 100644
index 0000000..25a5d47
--- /dev/null
+++ b/asset.py
@@ -0,0 +1,52 @@
+# 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.pool import Pool, PoolMeta
+from trytond.model import fields
+
+from trytond.modules.analytic_account import AnalyticMixin
+
+__all__ = ['Asset']
+
+
+class Asset(AnalyticMixin):
+ __metaclass__ = PoolMeta
+ __name__ = 'account.asset'
+
+ @fields.depends('supplier_invoice_line', 'analytic_accounts')
+ def on_change_supplier_invoice_line(self):
+ pool = Pool()
+ Entry = pool.get('analytic.account.entry')
+
+ super(Asset, self).on_change_supplier_invoice_line()
+ if self.supplier_invoice_line:
+ entries = []
+ for entry in self.supplier_invoice_line.analytic_accounts:
+ new_entry = Entry()
+ for field in Entry._fields:
+ if field in {'origin', 'id'}:
+ continue
+ setattr(new_entry, field, getattr(entry, field))
+ entries.append(new_entry)
+ self.analytic_accounts = entries
+
+ def get_move(self, line):
+ move = super(Asset, self).get_move(line)
+ self.set_analytic_lines(move)
+ return move
+
+ def get_closing_move(self, account):
+ move = super(Asset, self).get_closing_move(account)
+ self.set_analytic_lines(move)
+ return move
+
+ def set_analytic_lines(self, move):
+ "Fill analytic lines on lines with expense account"
+ if self.analytic_accounts:
+ for line in move.lines:
+ if line.account != self.product.account_expense_used:
+ continue
+ analytic_lines = []
+ for entry in self.analytic_accounts:
+ analytic_lines.extend(
+ entry.get_analytic_lines(line, move.date))
+ line.analytic_lines = analytic_lines
diff --git a/asset.xml b/asset.xml
new file mode 100644
index 0000000..bdbceb6
--- /dev/null
+++ b/asset.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0"?>
+<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
+this repository contains the full copyright notices and license terms. -->
+<tryton>
+ <data depends="account_asset">
+ <record model="ir.ui.view" id="asset_view_form">
+ <field name="model">account.asset</field>
+ <field name="inherit" ref="account_asset.asset_view_form"/>
+ <field name="name">asset_form</field>
+ </record>
+ </data>
+</tryton>
diff --git a/invoice.py b/invoice.py
index 38bc9a2..f75d953 100644
--- a/invoice.py
+++ b/invoice.py
@@ -1,6 +1,8 @@
# 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.model import fields
from trytond.pool import PoolMeta, Pool
+from trytond.pyson import Eval, If
from trytond.modules.analytic_account import AnalyticMixin
@@ -8,49 +10,50 @@ __all__ = ['InvoiceLine', 'AnalyticAccountEntry']
class InvoiceLine(AnalyticMixin):
+ __metaclass__ = PoolMeta
__name__ = 'account.invoice.line'
+ @classmethod
+ def __setup__(cls):
+ super(InvoiceLine, cls).__setup__()
+ cls.analytic_accounts.domain = [
+ ('company', '=', If(~Eval('company'),
+ Eval('context', {}).get('company', -1),
+ Eval('company', -1))),
+ ]
+ cls.analytic_accounts.depends.append('company')
+
def _credit(self):
pool = Pool()
AnalyticAccountEntry = pool.get('analytic.account.entry')
- result = super(InvoiceLine, self)._credit()
+ line = super(InvoiceLine, self)._credit()
if self.analytic_accounts:
new_entries = AnalyticAccountEntry.copy(self.analytic_accounts,
default={
'origin': None,
})
- result['analytic_accounts'] = [('add',
- [e.id for e in new_entries])]
-
- return result
-
- def get_analytic_entry(self, entry, value):
- analytic_entry = {}
- analytic_entry['name'] = self.description
- analytic_entry['debit'] = value['debit']
- analytic_entry['credit'] = value['credit']
- analytic_entry['account'] = entry.account.id
- analytic_entry['journal'] = self.invoice.journal.id
- analytic_entry['date'] = (self.invoice.accounting_date or
- self.invoice.invoice_date)
- analytic_entry['reference'] = self.invoice.reference
- analytic_entry['party'] = self.invoice.party.id
- return analytic_entry
-
- def get_move_line(self):
- values = super(InvoiceLine, self).get_move_line()
- if self.analytic_accounts:
- for value in values:
- value['analytic_lines'] = []
- to_create = []
+ line.analytic_accounts = new_entries
+ return line
+
+ def get_move_lines(self):
+ lines = super(InvoiceLine, self).get_move_lines()
+ if self.invoice and self.invoice.type:
+ type_ = self.invoice.type
+ else:
+ type_ = self.invoice_type
+ asset_depreciable = (self.product and type_ == 'in'
+ and self.product.type == 'assets'
+ and getattr(self.product, 'depreciable', False))
+ if self.analytic_accounts and not asset_depreciable:
+ date = self.invoice.accounting_date or self.invoice.invoice_date
+ for line in lines:
+ analytic_lines = []
for entry in self.analytic_accounts:
- if not entry.account:
- continue
- to_create.append(self.get_analytic_entry(entry, value))
- if to_create:
- value['analytic_lines'] = [('create', to_create)]
- return values
+ analytic_lines.extend(
+ entry.get_analytic_lines(line, date))
+ line.analytic_lines = analytic_lines
+ return lines
class AnalyticAccountEntry:
@@ -59,5 +62,44 @@ class AnalyticAccountEntry:
@classmethod
def _get_origin(cls):
+ pool = Pool()
origins = super(AnalyticAccountEntry, cls)._get_origin()
- return origins + ['account.invoice.line']
+ origins.append('account.invoice.line')
+ try:
+ pool.get('account.asset')
+ origins.append('account.asset')
+ except KeyError:
+ pass
+ return origins
+
+ @fields.depends('origin')
+ def on_change_with_company(self, name=None):
+ pool = Pool()
+ InvoiceLine = pool.get('account.invoice.line')
+ try:
+ Asset = pool.get('account.asset')
+ except KeyError:
+ Asset = None
+ company = super(AnalyticAccountEntry, self).on_change_with_company(
+ name)
+ if (isinstance(self.origin, InvoiceLine)
+ or (Asset and isinstance(self.origin, Asset))):
+ company = self.origin.company.id
+ return company
+
+ @classmethod
+ def search_company(cls, name, clause):
+ pool = Pool()
+ domain = super(AnalyticAccountEntry, cls).search_company(name, clause),
+ domain = ['OR',
+ domain,
+ (('origin.company',) + tuple(clause[1:]) +
+ ('account.invoice.line',)),
+ ]
+ try:
+ pool.get('account.asset')
+ domain.append(
+ (('origin.company',) + tuple(clause[1:]) + ('account.asset',)))
+ except KeyError:
+ pass
+ return domain
diff --git a/locale/bg_BG.po b/locale/bg.po
similarity index 54%
rename from locale/bg_BG.po
rename to locale/bg.po
index 244957e..7698d35 100644
--- a/locale/bg_BG.po
+++ b/locale/bg.po
@@ -2,10 +2,24 @@
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
+msgctxt "error:account.asset:"
+msgid "Some mandatory root account are missing on \"%(name)s\""
+msgstr ""
+
msgctxt "error:account.invoice.line:"
msgid "Some mandatory root account are missing on \"%(name)s\""
msgstr ""
+#, fuzzy
+msgctxt "field:account.asset,analytic_accounts:"
+msgid "Analytic Accounts"
+msgstr "Аналитични сметки"
+
+#, fuzzy
+msgctxt "field:account.asset,analytic_accounts_size:"
+msgid "Analytic Accounts Size"
+msgstr "Аналитични сметки"
+
msgctxt "field:account.invoice.line,analytic_accounts:"
msgid "Analytic Accounts"
msgstr "Аналитични сметки"
diff --git a/locale/ca_ES.po b/locale/ca.po
similarity index 54%
rename from locale/ca_ES.po
rename to locale/ca.po
index 2b7232d..f0f4de5 100644
--- a/locale/ca_ES.po
+++ b/locale/ca.po
@@ -2,10 +2,22 @@
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
+msgctxt "error:account.asset:"
+msgid "Some mandatory root account are missing on \"%(name)s\""
+msgstr "Falten alguns comptes analítics obligatoris a \"%(name)s\"."
+
msgctxt "error:account.invoice.line:"
msgid "Some mandatory root account are missing on \"%(name)s\""
msgstr "Falten alguns comptes analítics obligatoris a \"%(name)s\"."
+msgctxt "field:account.asset,analytic_accounts:"
+msgid "Analytic Accounts"
+msgstr "Comptes analítics"
+
+msgctxt "field:account.asset,analytic_accounts_size:"
+msgid "Analytic Accounts Size"
+msgstr "Mida dels comptes analítics"
+
msgctxt "field:account.invoice.line,analytic_accounts:"
msgid "Analytic Accounts"
msgstr "Comptes analítics"
diff --git a/locale/cs_CZ.po b/locale/cs.po
similarity index 56%
rename from locale/cs_CZ.po
rename to locale/cs.po
index aeb0025..4c417f0 100644
--- a/locale/cs_CZ.po
+++ b/locale/cs.po
@@ -2,10 +2,22 @@
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
+msgctxt "error:account.asset:"
+msgid "Some mandatory root account are missing on \"%(name)s\""
+msgstr ""
+
msgctxt "error:account.invoice.line:"
msgid "Some mandatory root account are missing on \"%(name)s\""
msgstr ""
+msgctxt "field:account.asset,analytic_accounts:"
+msgid "Analytic Accounts"
+msgstr ""
+
+msgctxt "field:account.asset,analytic_accounts_size:"
+msgid "Analytic Accounts Size"
+msgstr ""
+
msgctxt "field:account.invoice.line,analytic_accounts:"
msgid "Analytic Accounts"
msgstr ""
diff --git a/locale/de_DE.po b/locale/de.po
similarity index 55%
rename from locale/de_DE.po
rename to locale/de.po
index 0b636e0..d54c616 100644
--- a/locale/de_DE.po
+++ b/locale/de.po
@@ -2,10 +2,22 @@
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
+msgctxt "error:account.asset:"
+msgid "Some mandatory root account are missing on \"%(name)s\""
+msgstr "Erforderliches Wurzelkonto für \"%(name)s\" fehlt"
+
msgctxt "error:account.invoice.line:"
msgid "Some mandatory root account are missing on \"%(name)s\""
msgstr "Erforderliches Wurzelkonto für \"%(name)s\" fehlt"
+msgctxt "field:account.asset,analytic_accounts:"
+msgid "Analytic Accounts"
+msgstr "Kostenstellen"
+
+msgctxt "field:account.asset,analytic_accounts_size:"
+msgid "Analytic Accounts Size"
+msgstr "Kostenstellengröße"
+
msgctxt "field:account.invoice.line,analytic_accounts:"
msgid "Analytic Accounts"
msgstr "Kostenstellen"
diff --git a/locale/es_ES.po b/locale/es.po
similarity index 54%
rename from locale/es_ES.po
rename to locale/es.po
index 7b6e63a..fbee00e 100644
--- a/locale/es_ES.po
+++ b/locale/es.po
@@ -2,10 +2,22 @@
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
+msgctxt "error:account.asset:"
+msgid "Some mandatory root account are missing on \"%(name)s\""
+msgstr "Faltan algunas cuentas analíticas obligatorias en \"%(name)s\"."
+
msgctxt "error:account.invoice.line:"
msgid "Some mandatory root account are missing on \"%(name)s\""
msgstr "Faltan algunas cuentas analíticas obligatorias en \"%(name)s\"."
+msgctxt "field:account.asset,analytic_accounts:"
+msgid "Analytic Accounts"
+msgstr "Cuentas analíticas"
+
+msgctxt "field:account.asset,analytic_accounts_size:"
+msgid "Analytic Accounts Size"
+msgstr "Tamaño de cuentas analíticas"
+
msgctxt "field:account.invoice.line,analytic_accounts:"
msgid "Analytic Accounts"
msgstr "Cuentas analíticas"
diff --git a/locale/hu_HU.po b/locale/es_419.po
similarity index 56%
copy from locale/hu_HU.po
copy to locale/es_419.po
index aeb0025..4c417f0 100644
--- a/locale/hu_HU.po
+++ b/locale/es_419.po
@@ -2,10 +2,22 @@
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
+msgctxt "error:account.asset:"
+msgid "Some mandatory root account are missing on \"%(name)s\""
+msgstr ""
+
msgctxt "error:account.invoice.line:"
msgid "Some mandatory root account are missing on \"%(name)s\""
msgstr ""
+msgctxt "field:account.asset,analytic_accounts:"
+msgid "Analytic Accounts"
+msgstr ""
+
+msgctxt "field:account.asset,analytic_accounts_size:"
+msgid "Analytic Accounts Size"
+msgstr ""
+
msgctxt "field:account.invoice.line,analytic_accounts:"
msgid "Analytic Accounts"
msgstr ""
diff --git a/locale/es_AR.po b/locale/es_AR.po
deleted file mode 100644
index 9485215..0000000
--- a/locale/es_AR.po
+++ /dev/null
@@ -1,15 +0,0 @@
-#
-msgid ""
-msgstr "Content-Type: text/plain; charset=utf-8\n"
-
-msgctxt "error:account.invoice.line:"
-msgid "Some mandatory root account are missing on \"%(name)s\""
-msgstr "Falta una cuenta root obligatoria en «%(name)s»"
-
-msgctxt "field:account.invoice.line,analytic_accounts:"
-msgid "Analytic Accounts"
-msgstr "Cuentas analíticas"
-
-msgctxt "field:account.invoice.line,analytic_accounts_size:"
-msgid "Analytic Accounts Size"
-msgstr "Tamaño de cuentas analíticas"
diff --git a/locale/es_CO.po b/locale/es_CO.po
deleted file mode 100644
index 005f715..0000000
--- a/locale/es_CO.po
+++ /dev/null
@@ -1,15 +0,0 @@
-#
-msgid ""
-msgstr "Content-Type: text/plain; charset=utf-8\n"
-
-msgctxt "error:account.invoice.line:"
-msgid "Some mandatory root account are missing on \"%(name)s\""
-msgstr "Alguna cuenta raíz obligatoria falta en \"%(name)s\""
-
-msgctxt "field:account.invoice.line,analytic_accounts:"
-msgid "Analytic Accounts"
-msgstr "Cuentas Analíticas"
-
-msgctxt "field:account.invoice.line,analytic_accounts_size:"
-msgid "Analytic Accounts Size"
-msgstr "Tamaño de Centro de Costos"
diff --git a/locale/es_EC.po b/locale/es_EC.po
deleted file mode 100644
index 217c1fc..0000000
--- a/locale/es_EC.po
+++ /dev/null
@@ -1,15 +0,0 @@
-#
-msgid ""
-msgstr "Content-Type: text/plain; charset=utf-8\n"
-
-msgctxt "error:account.invoice.line:"
-msgid "Some mandatory root account are missing on \"%(name)s\""
-msgstr "Faltan algunas cuentas raíz obligatorias en \"%(name)s\""
-
-msgctxt "field:account.invoice.line,analytic_accounts:"
-msgid "Analytic Accounts"
-msgstr "Cuentas analíticas"
-
-msgctxt "field:account.invoice.line,analytic_accounts_size:"
-msgid "Analytic Accounts Size"
-msgstr "Tamaño de cuentas analíticas"
diff --git a/locale/es_MX.po b/locale/es_MX.po
deleted file mode 100644
index 7b6e63a..0000000
--- a/locale/es_MX.po
+++ /dev/null
@@ -1,15 +0,0 @@
-#
-msgid ""
-msgstr "Content-Type: text/plain; charset=utf-8\n"
-
-msgctxt "error:account.invoice.line:"
-msgid "Some mandatory root account are missing on \"%(name)s\""
-msgstr "Faltan algunas cuentas analíticas obligatorias en \"%(name)s\"."
-
-msgctxt "field:account.invoice.line,analytic_accounts:"
-msgid "Analytic Accounts"
-msgstr "Cuentas analíticas"
-
-msgctxt "field:account.invoice.line,analytic_accounts_size:"
-msgid "Analytic Accounts Size"
-msgstr "Tamaño de cuentas analíticas"
diff --git a/locale/fr_FR.po b/locale/fr.po
similarity index 54%
rename from locale/fr_FR.po
rename to locale/fr.po
index 4877fcd..650c19e 100644
--- a/locale/fr_FR.po
+++ b/locale/fr.po
@@ -2,10 +2,22 @@
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
+msgctxt "error:account.asset:"
+msgid "Some mandatory root account are missing on \"%(name)s\""
+msgstr "Certains comptes racines obligatoires sont manquants sur « %(name)s »"
+
msgctxt "error:account.invoice.line:"
msgid "Some mandatory root account are missing on \"%(name)s\""
msgstr "Certains comptes racines obligatoires sont manquants sur « %(name)s »"
+msgctxt "field:account.asset,analytic_accounts:"
+msgid "Analytic Accounts"
+msgstr "Comptes analytiques"
+
+msgctxt "field:account.asset,analytic_accounts_size:"
+msgid "Analytic Accounts Size"
+msgstr "Taille des comptes analytiques"
+
msgctxt "field:account.invoice.line,analytic_accounts:"
msgid "Analytic Accounts"
msgstr "Comptes analytiques"
diff --git a/locale/hu_HU.po b/locale/hu_HU.po
index aeb0025..4c417f0 100644
--- a/locale/hu_HU.po
+++ b/locale/hu_HU.po
@@ -2,10 +2,22 @@
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
+msgctxt "error:account.asset:"
+msgid "Some mandatory root account are missing on \"%(name)s\""
+msgstr ""
+
msgctxt "error:account.invoice.line:"
msgid "Some mandatory root account are missing on \"%(name)s\""
msgstr ""
+msgctxt "field:account.asset,analytic_accounts:"
+msgid "Analytic Accounts"
+msgstr ""
+
+msgctxt "field:account.asset,analytic_accounts_size:"
+msgid "Analytic Accounts Size"
+msgstr ""
+
msgctxt "field:account.invoice.line,analytic_accounts:"
msgid "Analytic Accounts"
msgstr ""
diff --git a/locale/it_IT.po b/locale/it_IT.po
index aeb0025..6af3cab 100644
--- a/locale/it_IT.po
+++ b/locale/it_IT.po
@@ -2,14 +2,26 @@
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
+msgctxt "error:account.asset:"
+msgid "Some mandatory root account are missing on \"%(name)s\""
+msgstr "mancano alcuni conti radice obbligatori in \"%(name)s\""
+
msgctxt "error:account.invoice.line:"
msgid "Some mandatory root account are missing on \"%(name)s\""
-msgstr ""
+msgstr "mancano alcuni conti radice obbligatori in \"%(name)s\""
+
+msgctxt "field:account.asset,analytic_accounts:"
+msgid "Analytic Accounts"
+msgstr "conti analitici"
+
+msgctxt "field:account.asset,analytic_accounts_size:"
+msgid "Analytic Accounts Size"
+msgstr "dimensione conti analitici"
msgctxt "field:account.invoice.line,analytic_accounts:"
msgid "Analytic Accounts"
-msgstr ""
+msgstr "conti analitici"
msgctxt "field:account.invoice.line,analytic_accounts_size:"
msgid "Analytic Accounts Size"
-msgstr ""
+msgstr "dimensione conti analitici"
diff --git a/locale/ja_JP.po b/locale/ja_JP.po
index aeb0025..4c417f0 100644
--- a/locale/ja_JP.po
+++ b/locale/ja_JP.po
@@ -2,10 +2,22 @@
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
+msgctxt "error:account.asset:"
+msgid "Some mandatory root account are missing on \"%(name)s\""
+msgstr ""
+
msgctxt "error:account.invoice.line:"
msgid "Some mandatory root account are missing on \"%(name)s\""
msgstr ""
+msgctxt "field:account.asset,analytic_accounts:"
+msgid "Analytic Accounts"
+msgstr ""
+
+msgctxt "field:account.asset,analytic_accounts_size:"
+msgid "Analytic Accounts Size"
+msgstr ""
+
msgctxt "field:account.invoice.line,analytic_accounts:"
msgid "Analytic Accounts"
msgstr ""
diff --git a/locale/lo_LA.po b/locale/lo.po
similarity index 52%
rename from locale/lo_LA.po
rename to locale/lo.po
index 11cf736..7fa03fe 100644
--- a/locale/lo_LA.po
+++ b/locale/lo.po
@@ -2,10 +2,25 @@
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
+#, fuzzy
+msgctxt "error:account.asset:"
+msgid "Some mandatory root account are missing on \"%(name)s\""
+msgstr "ບາງບັນຊີຫຼັກບັງຄັບບໍ່ມີໃນ \"%(name)s\""
+
msgctxt "error:account.invoice.line:"
msgid "Some mandatory root account are missing on \"%(name)s\""
msgstr "ບາງບັນຊີຫຼັກບັງຄັບບໍ່ມີໃນ \"%(name)s\""
+#, fuzzy
+msgctxt "field:account.asset,analytic_accounts:"
+msgid "Analytic Accounts"
+msgstr "ບັນຊີວິເຄາະ"
+
+#, fuzzy
+msgctxt "field:account.asset,analytic_accounts_size:"
+msgid "Analytic Accounts Size"
+msgstr "ຂະໜາດບັນຊີວິເຄາະ"
+
msgctxt "field:account.invoice.line,analytic_accounts:"
msgid "Analytic Accounts"
msgstr "ບັນຊີວິເຄາະ"
diff --git a/locale/hu_HU.po b/locale/lt.po
similarity index 56%
copy from locale/hu_HU.po
copy to locale/lt.po
index aeb0025..4c417f0 100644
--- a/locale/hu_HU.po
+++ b/locale/lt.po
@@ -2,10 +2,22 @@
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
+msgctxt "error:account.asset:"
+msgid "Some mandatory root account are missing on \"%(name)s\""
+msgstr ""
+
msgctxt "error:account.invoice.line:"
msgid "Some mandatory root account are missing on \"%(name)s\""
msgstr ""
+msgctxt "field:account.asset,analytic_accounts:"
+msgid "Analytic Accounts"
+msgstr ""
+
+msgctxt "field:account.asset,analytic_accounts_size:"
+msgid "Analytic Accounts Size"
+msgstr ""
+
msgctxt "field:account.invoice.line,analytic_accounts:"
msgid "Analytic Accounts"
msgstr ""
diff --git a/locale/lt_LT.po b/locale/lt_LT.po
deleted file mode 100644
index aeb0025..0000000
--- a/locale/lt_LT.po
+++ /dev/null
@@ -1,15 +0,0 @@
-#
-msgid ""
-msgstr "Content-Type: text/plain; charset=utf-8\n"
-
-msgctxt "error:account.invoice.line:"
-msgid "Some mandatory root account are missing on \"%(name)s\""
-msgstr ""
-
-msgctxt "field:account.invoice.line,analytic_accounts:"
-msgid "Analytic Accounts"
-msgstr ""
-
-msgctxt "field:account.invoice.line,analytic_accounts_size:"
-msgid "Analytic Accounts Size"
-msgstr ""
diff --git a/locale/hu_HU.po b/locale/nl.po
similarity index 56%
copy from locale/hu_HU.po
copy to locale/nl.po
index aeb0025..4c417f0 100644
--- a/locale/hu_HU.po
+++ b/locale/nl.po
@@ -2,10 +2,22 @@
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
+msgctxt "error:account.asset:"
+msgid "Some mandatory root account are missing on \"%(name)s\""
+msgstr ""
+
msgctxt "error:account.invoice.line:"
msgid "Some mandatory root account are missing on \"%(name)s\""
msgstr ""
+msgctxt "field:account.asset,analytic_accounts:"
+msgid "Analytic Accounts"
+msgstr ""
+
+msgctxt "field:account.asset,analytic_accounts_size:"
+msgid "Analytic Accounts Size"
+msgstr ""
+
msgctxt "field:account.invoice.line,analytic_accounts:"
msgid "Analytic Accounts"
msgstr ""
diff --git a/locale/nl_NL.po b/locale/nl_NL.po
deleted file mode 100644
index aeb0025..0000000
--- a/locale/nl_NL.po
+++ /dev/null
@@ -1,15 +0,0 @@
-#
-msgid ""
-msgstr "Content-Type: text/plain; charset=utf-8\n"
-
-msgctxt "error:account.invoice.line:"
-msgid "Some mandatory root account are missing on \"%(name)s\""
-msgstr ""
-
-msgctxt "field:account.invoice.line,analytic_accounts:"
-msgid "Analytic Accounts"
-msgstr ""
-
-msgctxt "field:account.invoice.line,analytic_accounts_size:"
-msgid "Analytic Accounts Size"
-msgstr ""
diff --git a/locale/hu_HU.po b/locale/pl.po
similarity index 56%
copy from locale/hu_HU.po
copy to locale/pl.po
index aeb0025..4c417f0 100644
--- a/locale/hu_HU.po
+++ b/locale/pl.po
@@ -2,10 +2,22 @@
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
+msgctxt "error:account.asset:"
+msgid "Some mandatory root account are missing on \"%(name)s\""
+msgstr ""
+
msgctxt "error:account.invoice.line:"
msgid "Some mandatory root account are missing on \"%(name)s\""
msgstr ""
+msgctxt "field:account.asset,analytic_accounts:"
+msgid "Analytic Accounts"
+msgstr ""
+
+msgctxt "field:account.asset,analytic_accounts_size:"
+msgid "Analytic Accounts Size"
+msgstr ""
+
msgctxt "field:account.invoice.line,analytic_accounts:"
msgid "Analytic Accounts"
msgstr ""
diff --git a/locale/pt_BR.po b/locale/pt_BR.po
index 5ff5dd8..ceb1431 100644
--- a/locale/pt_BR.po
+++ b/locale/pt_BR.po
@@ -2,10 +2,25 @@
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
+#, fuzzy
+msgctxt "error:account.asset:"
+msgid "Some mandatory root account are missing on \"%(name)s\""
+msgstr "Alguma conta de raíz obrigatória está faltando em \"%(name)s\""
+
msgctxt "error:account.invoice.line:"
msgid "Some mandatory root account are missing on \"%(name)s\""
msgstr "Alguma conta de raíz obrigatória está faltando em \"%(name)s\""
+#, fuzzy
+msgctxt "field:account.asset,analytic_accounts:"
+msgid "Analytic Accounts"
+msgstr "Contas Analíticas"
+
+#, fuzzy
+msgctxt "field:account.asset,analytic_accounts_size:"
+msgid "Analytic Accounts Size"
+msgstr "Tamanho da Conta Analítica"
+
msgctxt "field:account.invoice.line,analytic_accounts:"
msgid "Analytic Accounts"
msgstr "Contas Analíticas"
diff --git a/locale/ru_RU.po b/locale/ru.po
similarity index 54%
rename from locale/ru_RU.po
rename to locale/ru.po
index bca6f85..1c4ee47 100644
--- a/locale/ru_RU.po
+++ b/locale/ru.po
@@ -2,10 +2,24 @@
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
+msgctxt "error:account.asset:"
+msgid "Some mandatory root account are missing on \"%(name)s\""
+msgstr ""
+
msgctxt "error:account.invoice.line:"
msgid "Some mandatory root account are missing on \"%(name)s\""
msgstr ""
+#, fuzzy
+msgctxt "field:account.asset,analytic_accounts:"
+msgid "Analytic Accounts"
+msgstr "Счета аналитики"
+
+#, fuzzy
+msgctxt "field:account.asset,analytic_accounts_size:"
+msgid "Analytic Accounts Size"
+msgstr "Счета аналитики"
+
msgctxt "field:account.invoice.line,analytic_accounts:"
msgid "Analytic Accounts"
msgstr "Счета аналитики"
diff --git a/locale/sl_SI.po b/locale/sl.po
similarity index 53%
rename from locale/sl_SI.po
rename to locale/sl.po
index 4e61b0f..bd1b85b 100644
--- a/locale/sl_SI.po
+++ b/locale/sl.po
@@ -2,10 +2,24 @@
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
+msgctxt "error:account.asset:"
+msgid "Some mandatory root account are missing on \"%(name)s\""
+msgstr "Pri \"%(name)s\" manjkajo nekateri obvezni korenski konti."
+
msgctxt "error:account.invoice.line:"
msgid "Some mandatory root account are missing on \"%(name)s\""
msgstr "Pri \"%(name)s\" manjkajo nekateri korenski konti."
+#, fuzzy
+msgctxt "field:account.asset,analytic_accounts:"
+msgid "Analytic Accounts"
+msgstr "Analitični konti"
+
+#, fuzzy
+msgctxt "field:account.asset,analytic_accounts_size:"
+msgid "Analytic Accounts Size"
+msgstr "Število analitičnih kontov"
+
msgctxt "field:account.invoice.line,analytic_accounts:"
msgid "Analytic Accounts"
msgstr "Analitični konti"
diff --git a/locale/zh_CN.po b/locale/zh_CN.po
index aeb0025..4c417f0 100644
--- a/locale/zh_CN.po
+++ b/locale/zh_CN.po
@@ -2,10 +2,22 @@
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
+msgctxt "error:account.asset:"
+msgid "Some mandatory root account are missing on \"%(name)s\""
+msgstr ""
+
msgctxt "error:account.invoice.line:"
msgid "Some mandatory root account are missing on \"%(name)s\""
msgstr ""
+msgctxt "field:account.asset,analytic_accounts:"
+msgid "Analytic Accounts"
+msgstr ""
+
+msgctxt "field:account.asset,analytic_accounts_size:"
+msgid "Analytic Accounts Size"
+msgstr ""
+
msgctxt "field:account.invoice.line,analytic_accounts:"
msgid "Analytic Accounts"
msgstr ""
diff --git a/setup.py b/setup.py
index acd968c..9a5b531 100644
--- a/setup.py
+++ b/setup.py
@@ -54,6 +54,8 @@ for dep in info.get('depends', []):
requires.append(get_require_version('trytond'))
tests_require = [get_require_version('proteus')]
+for dep in ['account_asset']:
+ tests_require.append(get_require_version('trytond_%s' % dep))
dependency_links = []
if minor_version % 2:
# Add development index for testing with proteus
@@ -95,6 +97,7 @@ setup(name=name,
'Natural Language :: German',
'Natural Language :: Hungarian',
'Natural Language :: Italian',
+ 'Natural Language :: Polish',
'Natural Language :: Portuguese (Brazilian)',
'Natural Language :: Russian',
'Natural Language :: Slovenian',
diff --git a/tests/scenario_analytic_invoice.rst b/tests/scenario_analytic_invoice.rst
index be79b6a..2dfb5eb 100644
--- a/tests/scenario_analytic_invoice.rst
+++ b/tests/scenario_analytic_invoice.rst
@@ -7,7 +7,8 @@ Imports::
>>> from dateutil.relativedelta import relativedelta
>>> from decimal import Decimal
>>> from operator import attrgetter
- >>> from proteus import config, Model, Wizard
+ >>> from proteus import Model, Wizard
+ >>> from trytond.tests.tools import activate_modules
>>> from trytond.modules.company.tests.tools import create_company, \
... get_company
>>> from trytond.modules.account.tests.tools import create_fiscalyear, \
@@ -16,18 +17,9 @@ Imports::
... set_fiscalyear_invoice_sequences, create_payment_term
>>> today = datetime.date.today()
-Create database::
+Install analytic_invoice::
- >>> config = config.set_trytond()
- >>> config.pool.test = True
-
-Install account_invoice::
-
- >>> Module = Model.get('ir.module')
- >>> analytic_invoice_module, = Module.find(
- ... [('name', '=', 'analytic_invoice')])
- >>> analytic_invoice_module.click('install')
- >>> Wizard('ir.module.install_upgrade').execute('upgrade')
+ >>> config = activate_modules('analytic_invoice')
Create company::
diff --git a/tests/scenario_analytic_invoice_asset.rst b/tests/scenario_analytic_invoice_asset.rst
new file mode 100644
index 0000000..4d1af54
--- /dev/null
+++ b/tests/scenario_analytic_invoice_asset.rst
@@ -0,0 +1,127 @@
+=====================================
+Analytic Invoice with Assets Scenario
+=====================================
+
+Imports::
+
+ >>> import datetime
+ >>> from dateutil.relativedelta import relativedelta
+ >>> from decimal import Decimal
+ >>> from operator import attrgetter
+ >>> from proteus import Model, Wizard
+ >>> from trytond.tests.tools import activate_modules
+ >>> from trytond.modules.company.tests.tools import create_company, \
+ ... get_company
+ >>> from trytond.modules.account.tests.tools import create_fiscalyear, \
+ ... create_chart, get_accounts
+ >>> from trytond.modules.account_invoice.tests.tools import \
+ ... set_fiscalyear_invoice_sequences, create_payment_term
+ >>> from trytond.modules.account_asset.tests.tools \
+ ... import add_asset_accounts
+ >>> today = datetime.date.today()
+
+Install analytic_invoice and account_asset::
+
+ >>> config = activate_modules(['analytic_invoice', 'account_asset'])
+
+Create company::
+
+ >>> _ = create_company()
+ >>> company = get_company()
+
+Create fiscal year::
+
+ >>> fiscalyear = set_fiscalyear_invoice_sequences(
+ ... create_fiscalyear(company))
+ >>> fiscalyear.click('create_period')
+
+Create chart of accounts::
+
+ >>> _ = create_chart(company)
+ >>> accounts = add_asset_accounts(get_accounts(company), company)
+ >>> revenue = accounts['revenue']
+ >>> asset_account = accounts['asset']
+ >>> expense = accounts['expense']
+ >>> depreciation_account = accounts['depreciation']
+
+Create analytic accounts::
+
+ >>> AnalyticAccount = Model.get('analytic_account.account')
+ >>> root = AnalyticAccount(type='root', name='Root')
+ >>> root.save()
+ >>> analytic_account = AnalyticAccount(root=root, parent=root,
+ ... name='Analytic')
+ >>> analytic_account.save()
+
+Create supplier::
+
+ >>> Party = Model.get('party.party')
+ >>> supplier = Party(name='Supplier')
+ >>> supplier.save()
+
+Create an asset::
+
+ >>> ProductUom = Model.get('product.uom')
+ >>> unit, = ProductUom.find([('name', '=', 'Unit')])
+ >>> ProductTemplate = Model.get('product.template')
+ >>> Product = Model.get('product.product')
+ >>> asset_product = Product()
+ >>> asset_template = ProductTemplate()
+ >>> asset_template.name = 'Asset'
+ >>> asset_template.type = 'assets'
+ >>> asset_template.default_uom = unit
+ >>> asset_template.list_price = Decimal('1000')
+ >>> asset_template.cost_price = Decimal('1000')
+ >>> asset_template.depreciable = True
+ >>> asset_template.account_expense = expense
+ >>> asset_template.account_revenue = revenue
+ >>> asset_template.account_asset = asset_account
+ >>> asset_template.account_depreciation = depreciation_account
+ >>> asset_template.depreciation_duration = Decimal(10)
+ >>> asset_template.save()
+ >>> asset_product.template = asset_template
+ >>> asset_product.save()
+
+Buy an asset::
+
+ >>> Invoice = Model.get('account.invoice')
+ >>> InvoiceLine = Model.get('account.invoice.line')
+ >>> supplier_invoice = Invoice(type='in')
+ >>> supplier_invoice.party = supplier
+ >>> invoice_line = supplier_invoice.lines.new()
+ >>> invoice_line.product = asset_product
+ >>> invoice_line.quantity = 1
+ >>> invoice_line.unit_price = Decimal('1000')
+ >>> entry, = invoice_line.analytic_accounts
+ >>> entry.account = analytic_account
+ >>> supplier_invoice.invoice_date = today + relativedelta(day=1, month=1)
+ >>> supplier_invoice.click('post')
+ >>> supplier_invoice.state
+ u'posted'
+ >>> invoice_line, = supplier_invoice.lines
+ >>> analytic_account.debit
+ Decimal('0.00')
+ >>> analytic_account.credit
+ Decimal('0.00')
+
+Depreciate the asset::
+
+ >>> Asset = Model.get('account.asset')
+ >>> asset = Asset()
+ >>> asset.product = asset_product
+ >>> asset.supplier_invoice_line = invoice_line
+ >>> asset.residual_value = Decimal(0)
+ >>> asset.click('create_lines')
+ >>> asset.click('run')
+
+Create Moves for 1 month::
+
+ >>> create_moves = Wizard('account.asset.create_moves')
+ >>> create_moves.form.date = (supplier_invoice.invoice_date
+ ... + relativedelta(months=1))
+ >>> create_moves.execute('create_moves')
+ >>> analytic_account.reload()
+ >>> analytic_account.debit
+ Decimal('100.00')
+ >>> analytic_account.credit
+ Decimal('0.00')
diff --git a/tests/test_analytic_invoice.py b/tests/test_analytic_invoice.py
index 3f8a4ce..0cc8f0e 100644
--- a/tests/test_analytic_invoice.py
+++ b/tests/test_analytic_invoice.py
@@ -4,7 +4,7 @@ import unittest
import doctest
import trytond.tests.test_tryton
from trytond.tests.test_tryton import ModuleTestCase
-from trytond.tests.test_tryton import doctest_setup, doctest_teardown
+from trytond.tests.test_tryton import doctest_teardown
from trytond.tests.test_tryton import doctest_checker
@@ -18,7 +18,11 @@ def suite():
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(
AnalyticInvoiceTestCase))
suite.addTests(doctest.DocFileSuite('scenario_analytic_invoice.rst',
- setUp=doctest_setup, tearDown=doctest_teardown, encoding='utf-8',
+ tearDown=doctest_teardown, encoding='utf-8',
+ checker=doctest_checker,
+ optionflags=doctest.REPORT_ONLY_FIRST_FAILURE))
+ suite.addTests(doctest.DocFileSuite('scenario_analytic_invoice_asset.rst',
+ tearDown=doctest_teardown, encoding='utf-8',
checker=doctest_checker,
optionflags=doctest.REPORT_ONLY_FIRST_FAILURE))
return suite
diff --git a/tryton.cfg b/tryton.cfg
index 6270648..9b5a8ef 100644
--- a/tryton.cfg
+++ b/tryton.cfg
@@ -1,7 +1,9 @@
[tryton]
-version=4.0.1
+version=4.2.0
depends:
account_invoice
analytic_account
+extras_depend:
+ account_asset
xml:
invoice.xml
diff --git a/trytond_analytic_invoice.egg-info/PKG-INFO b/trytond_analytic_invoice.egg-info/PKG-INFO
index a29665c..394bbd9 100644
--- a/trytond_analytic_invoice.egg-info/PKG-INFO
+++ b/trytond_analytic_invoice.egg-info/PKG-INFO
@@ -1,12 +1,12 @@
Metadata-Version: 1.1
Name: trytond-analytic-invoice
-Version: 4.0.1
+Version: 4.2.0
Summary: Tryton module to add analytic accounting on invoice
Home-page: http://www.tryton.org/
Author: Tryton
Author-email: issue_tracker at tryton.org
License: GPL-3
-Download-URL: http://downloads.tryton.org/4.0/
+Download-URL: http://downloads.tryton.org/4.2/
Description: trytond_analytic_invoice
========================
@@ -62,6 +62,7 @@ Classifier: Natural Language :: French
Classifier: Natural Language :: German
Classifier: Natural Language :: Hungarian
Classifier: Natural Language :: Italian
+Classifier: Natural Language :: Polish
Classifier: Natural Language :: Portuguese (Brazilian)
Classifier: Natural Language :: Russian
Classifier: Natural Language :: Slovenian
diff --git a/trytond_analytic_invoice.egg-info/SOURCES.txt b/trytond_analytic_invoice.egg-info/SOURCES.txt
index 8b4f4ab..2b10ef9 100644
--- a/trytond_analytic_invoice.egg-info/SOURCES.txt
+++ b/trytond_analytic_invoice.egg-info/SOURCES.txt
@@ -4,56 +4,56 @@ INSTALL
LICENSE
MANIFEST.in
README
+asset.xml
invoice.xml
setup.py
tryton.cfg
./__init__.py
+./asset.py
./invoice.py
./invoice.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/es_MX.po
-./locale/fr_FR.po
+./locale/bg.po
+./locale/ca.po
+./locale/cs.po
+./locale/de.po
+./locale/es.po
+./locale/es_419.po
+./locale/fr.po
./locale/hu_HU.po
./locale/it_IT.po
./locale/ja_JP.po
-./locale/lo_LA.po
-./locale/lt_LT.po
-./locale/nl_NL.po
+./locale/lo.po
+./locale/lt.po
+./locale/nl.po
+./locale/pl.po
./locale/pt_BR.po
-./locale/ru_RU.po
-./locale/sl_SI.po
+./locale/ru.po
+./locale/sl.po
./locale/zh_CN.po
./tests/__init__.py
./tests/scenario_analytic_invoice.rst
+./tests/scenario_analytic_invoice_asset.rst
./tests/test_analytic_invoice.py
+./view/asset_form.xml
./view/invoice_line_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/es_MX.po
-locale/fr_FR.po
+locale/bg.po
+locale/ca.po
+locale/cs.po
+locale/de.po
+locale/es.po
+locale/es_419.po
+locale/fr.po
locale/hu_HU.po
locale/it_IT.po
locale/ja_JP.po
-locale/lo_LA.po
-locale/lt_LT.po
-locale/nl_NL.po
+locale/lo.po
+locale/lt.po
+locale/nl.po
+locale/pl.po
locale/pt_BR.po
-locale/ru_RU.po
-locale/sl_SI.po
+locale/ru.po
+locale/sl.po
locale/zh_CN.po
trytond_analytic_invoice.egg-info/PKG-INFO
trytond_analytic_invoice.egg-info/SOURCES.txt
@@ -62,4 +62,5 @@ trytond_analytic_invoice.egg-info/entry_points.txt
trytond_analytic_invoice.egg-info/not-zip-safe
trytond_analytic_invoice.egg-info/requires.txt
trytond_analytic_invoice.egg-info/top_level.txt
+view/asset_form.xml
view/invoice_line_form.xml
\ No newline at end of file
diff --git a/trytond_analytic_invoice.egg-info/requires.txt b/trytond_analytic_invoice.egg-info/requires.txt
index 442de9c..40e9282 100644
--- a/trytond_analytic_invoice.egg-info/requires.txt
+++ b/trytond_analytic_invoice.egg-info/requires.txt
@@ -1,3 +1,3 @@
-trytond_account_invoice >= 4.0, < 4.1
-trytond_analytic_account >= 4.0, < 4.1
-trytond >= 4.0, < 4.1
+trytond_account_invoice >= 4.2, < 4.3
+trytond_analytic_account >= 4.2, < 4.3
+trytond >= 4.2, < 4.3
diff --git a/view/asset_form.xml b/view/asset_form.xml
new file mode 100644
index 0000000..c19a11b
--- /dev/null
+++ b/view/asset_form.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
+this repository contains the full copyright notices and license terms. -->
+<data>
+ <xpath expr="/form/notebook/page[@id='lines']" position="after">
+ <page name="analytic_accounts" col="1">
+ <field name="analytic_accounts"/>
+ </page>
+ </xpath>
+</data>
--
tryton-modules-analytic-invoice
More information about the tryton-debian-vcs
mailing list