[tryton-debian-vcs] tryton-modules-account-payment-clearing branch upstream updated. upstream/3.4.1-1-g5a6f604
Mathias Behrle
tryton-debian-vcs at alioth.debian.org
Thu Apr 23 16:02:01 UTC 2015
The following commit has been merged in the upstream branch:
https://alioth.debian.org/plugins/scmgit/cgi-bin/gitweb.cgi/?p=tryton/tryton-modules-account-payment-clearing.git;a=commitdiff;h=upstream/3.4.1-1-g5a6f604
commit 5a6f604889b8a359d97e18553e2bc217cb38131e
Author: Mathias Behrle <mathiasb at m9s.biz>
Date: Thu Apr 23 16:59:51 2015 +0200
Adding upstream version 3.6.0.
Signed-off-by: Mathias Behrle <mathiasb at m9s.biz>
diff --git a/CHANGELOG b/CHANGELOG
index d2965de..cd9a9a7 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,5 +1,5 @@
-Version 3.4.1 - 2015-03-01
+Version 3.6.0 - 2015-04-20
* Bug fixes (see mercurial logs for details)
-
+* Add support for PyPy
Version 3.4.0 - 2014-10-20
* Initial release
\ No newline at end of file
diff --git a/PKG-INFO b/PKG-INFO
index eb02d15..e75c9d4 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,12 +1,12 @@
Metadata-Version: 1.1
Name: trytond_account_payment_clearing
-Version: 3.4.1
+Version: 3.6.0
Summary: Tryton module for payment clearing
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.4/
+Download-URL: http://downloads.tryton.org/3.6/
Description: trytond_account_payment_clearing
================================
@@ -64,5 +64,7 @@ Classifier: Natural Language :: Slovenian
Classifier: Natural Language :: Spanish
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 2.7
+Classifier: Programming Language :: Python :: Implementation :: CPython
+Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Topic :: Office/Business
Classifier: Topic :: Office/Business :: Financial :: Accounting
diff --git a/__init__.py b/__init__.py
index 2c2ca06..bc8b952 100644
--- a/__init__.py
+++ b/__init__.py
@@ -11,5 +11,6 @@ def register():
Journal,
Payment,
Move,
+ Statement,
StatementLine,
module='account_payment_clearing', type_='model')
diff --git a/locale/es_AR.po b/locale/es_AR.po
index 2aa5799..5752042 100644
--- a/locale/es_AR.po
+++ b/locale/es_AR.po
@@ -4,7 +4,7 @@ msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:account.payment,clearing_move:"
msgid "Clearing Move"
-msgstr "Movimiento de compensación"
+msgstr "Asiento de compensación"
msgctxt "field:account.payment.journal,clearing_account:"
msgid "Clearing Account"
diff --git a/locale/es_EC.po b/locale/es_EC.po
index 00f0241..0d76b7c 100644
--- a/locale/es_EC.po
+++ b/locale/es_EC.po
@@ -4,15 +4,15 @@ msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:account.payment,clearing_move:"
msgid "Clearing Move"
-msgstr "Asiento de Compensación"
+msgstr "Asiento de compensación"
msgctxt "field:account.payment.journal,clearing_account:"
msgid "Clearing Account"
-msgstr "Cuenta de Compensación"
+msgstr "Cuenta de compensación"
msgctxt "field:account.payment.journal,clearing_journal:"
msgid "Clearing Journal"
-msgstr "Libro Diario de Compensación"
+msgstr "Libro diario de compensación"
msgctxt "field:account.statement.line,payment:"
msgid "Payment"
diff --git a/locale/es_AR.po b/locale/es_ES.po
similarity index 78%
copy from locale/es_AR.po
copy to locale/es_ES.po
index 2aa5799..982c8a4 100644
--- a/locale/es_AR.po
+++ b/locale/es_ES.po
@@ -4,15 +4,15 @@ msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:account.payment,clearing_move:"
msgid "Clearing Move"
-msgstr "Movimiento de compensación"
+msgstr "Asiento de liquidación"
msgctxt "field:account.payment.journal,clearing_account:"
msgid "Clearing Account"
-msgstr "Cuenta de compensación"
+msgstr "Cuenta de liquidación"
msgctxt "field:account.payment.journal,clearing_journal:"
msgid "Clearing Journal"
-msgstr "Diario de compensación"
+msgstr "Diario de liquidación"
msgctxt "field:account.statement.line,payment:"
msgid "Payment"
diff --git a/payment.py b/payment.py
index 679b820..1f0c123 100644
--- a/payment.py
+++ b/payment.py
@@ -14,6 +14,7 @@ __metaclass__ = PoolMeta
class Journal:
__name__ = 'account.payment.journal'
clearing_account = fields.Many2One('account.account', 'Clearing Account',
+ domain=[('party_required', '=', False)],
states={
'required': Bool(Eval('clearing_journal')),
},
@@ -46,7 +47,7 @@ class Payment:
if move:
moves.append(move)
if moves:
- moves = Move.create([m._save_values for m in moves])
+ Move.save(moves)
cls.write(*sum((([m.origin], {'clearing_move': m.id})
for m in moves), ()))
diff --git a/setup.py b/setup.py
index 29a5060..d3c3f4f 100644
--- a/setup.py
+++ b/setup.py
@@ -93,6 +93,8 @@ setup(name=name,
'Natural Language :: Spanish',
'Operating System :: OS Independent',
'Programming Language :: Python :: 2.7',
+ 'Programming Language :: Python :: Implementation :: CPython',
+ 'Programming Language :: Python :: Implementation :: PyPy',
'Topic :: Office/Business',
'Topic :: Office/Business :: Financial :: Accounting',
],
diff --git a/statement.py b/statement.py
index d4a4338..00c3512 100644
--- a/statement.py
+++ b/statement.py
@@ -5,10 +5,40 @@ from trytond.model import fields
from trytond.pyson import Eval, If, Bool
from trytond.transaction import Transaction
-__all__ = ['StatementLine']
+__all__ = ['Statement', 'StatementLine']
__metaclass__ = PoolMeta
+class Statement:
+ __name__ = 'account.statement'
+
+ @classmethod
+ def create_move(cls, statements):
+ pool = Pool()
+ MoveLine = pool.get('account.move.line')
+
+ moves = super(Statement, cls).create_move(statements)
+
+ for move, statement, lines in moves:
+ assert len({l.payment for l in lines}) == 1
+ line = lines[0]
+ if line.payment and line.payment.clearing_move:
+ clearing_account = line.payment.journal.clearing_account
+ if clearing_account.reconcile:
+ to_reconcile = []
+ for line in move.lines + line.payment.clearing_move.lines:
+ if (line.account == clearing_account
+ and not line.reconciliation):
+ to_reconcile.append(line)
+ if not sum((l.debit - l.credit) for l in to_reconcile):
+ MoveLine.reconcile(to_reconcile)
+ return moves
+
+ def _group_key(self, line):
+ key = super(Statement, self)._group_key(line)
+ return key + (('payment', line.payment),)
+
+
class StatementLine:
__name__ = 'account.statement.line'
payment = fields.Many2One('account.payment', 'Payment',
@@ -25,62 +55,40 @@ class StatementLine:
default.setdefault('payment', None)
return super(StatementLine, cls).copy(lines, default=default)
- def create_move(self):
- pool = Pool()
- MoveLine = pool.get('account.move.line')
- move = super(StatementLine, self).create_move()
- if self.payment and self.payment.clearing_move:
- clearing_account = self.payment.journal.clearing_account
- if clearing_account.reconcile:
- to_reconcile = []
- for line in move.lines + self.payment.clearing_move.lines:
- if (line.account == clearing_account
- and not line.reconciliation):
- to_reconcile.append(line)
- if not sum((l.debit - l.credit) for l in to_reconcile):
- MoveLine.reconcile(to_reconcile)
- return move
-
@fields.depends('payment', 'party', 'account', '_parent_statement.journal')
def on_change_payment(self):
pool = Pool()
Currency = pool.get('currency.currency')
- changes = {}
if self.payment:
if not self.party:
- changes['party'] = self.payment.party.id
- changes['party.rec_name'] = self.payment.party.rec_name
+ self.party = self.payment.party
clearing_account = self.payment.journal.clearing_account
if (not self.account
and self.payment.clearing_move
and clearing_account):
- changes['account'] = clearing_account.id
- changes['account.rec_name'] = clearing_account.rec_name
+ self.account = clearing_account
if self.statement and self.statement.journal:
with Transaction().set_context(date=self.payment.date):
amount = Currency.compute(self.payment.currency,
self.payment.amount, self.statement.journal.currency)
- changes['amount'] = amount
+ self.amount = amount
if self.payment.kind == 'payable':
- changes['amount'] *= -1
- return changes
+ self.amount *= -1
@fields.depends('party', 'payment')
def on_change_party(self):
- changes = super(StatementLine, self).on_change_party()
+ super(StatementLine, self).on_change_party()
if self.payment:
if self.payment.party != self.party:
- changes['payment'] = None
- return changes
+ self.payment = None
@fields.depends('account', 'payment')
def on_change_account(self):
- changes = super(StatementLine, self).on_change_account()
+ super(StatementLine, self).on_change_account()
if self.payment:
clearing_account = self.payment.journal.clearing_account
if self.account != clearing_account:
- changes['payment'] = None
- return changes
+ self.payment = None
@classmethod
def post_move(cls, lines):
diff --git a/tests/scenario_account_payment_clearing.rst b/tests/scenario_account_payment_clearing.rst
index 5e5c39b..c493b05 100644
--- a/tests/scenario_account_payment_clearing.rst
+++ b/tests/scenario_account_payment_clearing.rst
@@ -6,8 +6,13 @@ Imports::
>>> import datetime
>>> from dateutil.relativedelta import relativedelta
>>> from decimal import Decimal
- >>> from operator import attrgetter
>>> from proteus import config, Model, Wizard
+ >>> 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
>>> today = datetime.date.today()
Create database::
@@ -28,91 +33,28 @@ Install account_payment_clearing::
Create company::
- >>> Currency = Model.get('currency.currency')
- >>> CurrencyRate = Model.get('currency.currency.rate')
- >>> currencies = Currency.find([('code', '=', 'USD')])
- >>> if not currencies:
- ... currency = Currency(name='US Dollar', symbol=u'$', code='USD',
- ... rounding=Decimal('0.01'), mon_grouping='[]',
- ... mon_decimal_point='.')
- ... currency.save()
- ... CurrencyRate(date=today + relativedelta(month=1, day=1),
- ... rate=Decimal('1.0'), currency=currency).save()
- ... else:
- ... currency, = currencies
- >>> Company = Model.get('company.company')
- >>> Party = Model.get('party.party')
- >>> company_config = Wizard('company.company.config')
- >>> company_config.execute('company')
- >>> company = company_config.form
- >>> party = Party(name='Dunder Mifflin')
- >>> party.save()
- >>> company.party = party
- >>> company.currency = currency
- >>> company_config.execute('add')
- >>> company, = Company.find([])
-
-Reload the context::
-
- >>> User = Model.get('res.user')
- >>> config._context = User.get_preferences(True, config.context)
+ >>> _ = create_company()
+ >>> company = get_company()
Create fiscal year::
- >>> FiscalYear = Model.get('account.fiscalyear')
- >>> Sequence = Model.get('ir.sequence')
- >>> SequenceStrict = Model.get('ir.sequence.strict')
- >>> fiscalyear = FiscalYear(name=str(today.year))
- >>> fiscalyear.start_date = today + relativedelta(month=1, day=1)
- >>> fiscalyear.end_date = today + relativedelta(month=12, day=31)
- >>> fiscalyear.company = company
- >>> post_move_seq = Sequence(name=str(today.year), code='account.move',
- ... company=company)
- >>> post_move_seq.save()
- >>> fiscalyear.post_move_sequence = post_move_seq
- >>> invoice_sequence = SequenceStrict(name='%s' % today.year,
- ... code='account.invoice',
- ... company=company)
- >>> invoice_sequence.save()
- >>> fiscalyear.out_invoice_sequence = invoice_sequence
- >>> fiscalyear.in_invoice_sequence = invoice_sequence
- >>> fiscalyear.out_credit_note_sequence = invoice_sequence
- >>> fiscalyear.in_credit_note_sequence = invoice_sequence
- >>> fiscalyear.save()
- >>> FiscalYear.create_period([fiscalyear.id], config.context)
+ >>> fiscalyear = set_fiscalyear_invoice_sequences(
+ ... create_fiscalyear(company))
+ >>> fiscalyear.click('create_period')
Create chart of accounts::
- >>> AccountTemplate = Model.get('account.account.template')
+ >>> _ = create_chart(company)
+ >>> accounts = get_accounts(company)
+ >>> receivable = accounts['receivable']
+ >>> payable = accounts['payable']
+ >>> cash = accounts['cash']
+
>>> Account = Model.get('account.account')
- >>> account_template, = AccountTemplate.find([('parent', '=', None)])
- >>> create_chart = Wizard('account.create_chart')
- >>> create_chart.execute('account')
- >>> create_chart.form.account_template = account_template
- >>> create_chart.form.company = company
- >>> create_chart.execute('create_account')
- >>> receivable, = Account.find([
- ... ('kind', '=', 'receivable'),
- ... ('company', '=', company.id),
- ... ])
- >>> payable, = Account.find([
- ... ('kind', '=', 'payable'),
- ... ('company', '=', company.id),
- ... ])
- >>> expense, = Account.find([
- ... ('kind', '=', 'expense'),
- ... ('company', '=', company.id),
- ... ])
- >>> cash, = Account.find([
- ... ('name', '=', 'Main Cash'),
- ... ('company', '=', company.id),
- ... ])
>>> bank_clearing = Account(name='Bank Clearing', type=payable.type,
... reconcile=True, deferral=True, parent=payable.parent, kind='other')
>>> bank_clearing.save()
- >>> create_chart.form.account_receivable = receivable
- >>> create_chart.form.account_payable = payable
- >>> create_chart.execute('create_properties')
+
>>> Journal = Model.get('account.journal')
>>> expense, = Journal.find([('code', '=', 'EXP')])
@@ -265,6 +207,7 @@ Create statement::
>>> StatementJournal = Model.get('account.statement.journal')
>>> Statement = Model.get('account.statement')
+ >>> Sequence = Model.get('ir.sequence')
>>> sequence = Sequence(name='Satement',
... code='account.journal',
diff --git a/tests/test_account_payment_clearing.py b/tests/test_account_payment_clearing.py
index 0333081..c0ffdfd 100644
--- a/tests/test_account_payment_clearing.py
+++ b/tests/test_account_payment_clearing.py
@@ -3,23 +3,13 @@
import unittest
import doctest
import trytond.tests.test_tryton
-from trytond.tests.test_tryton import test_view, test_depends
+from trytond.tests.test_tryton import ModuleTestCase
from trytond.tests.test_tryton import doctest_setup, doctest_teardown
-class AccountPaymentTestCase(unittest.TestCase):
+class AccountPaymentTestCase(ModuleTestCase):
'Test Account Payment module'
-
- def setUp(self):
- trytond.tests.test_tryton.install_module('account_payment_clearing')
-
- def test0005views(self):
- 'Test views'
- test_view('account_payment_clearing')
-
- def test0006depends(self):
- 'Test depends'
- test_depends()
+ module = 'account_payment_clearing'
def suite():
diff --git a/tryton.cfg b/tryton.cfg
index 5d70ad2..43eac26 100644
--- a/tryton.cfg
+++ b/tryton.cfg
@@ -1,5 +1,5 @@
[tryton]
-version=3.4.1
+version=3.6.0
depends:
account_payment
ir
diff --git a/trytond_account_payment_clearing.egg-info/PKG-INFO b/trytond_account_payment_clearing.egg-info/PKG-INFO
index aa37d71..42f54ce 100644
--- a/trytond_account_payment_clearing.egg-info/PKG-INFO
+++ b/trytond_account_payment_clearing.egg-info/PKG-INFO
@@ -1,12 +1,12 @@
Metadata-Version: 1.1
Name: trytond-account-payment-clearing
-Version: 3.4.1
+Version: 3.6.0
Summary: Tryton module for payment clearing
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.4/
+Download-URL: http://downloads.tryton.org/3.6/
Description: trytond_account_payment_clearing
================================
@@ -64,5 +64,7 @@ Classifier: Natural Language :: Slovenian
Classifier: Natural Language :: Spanish
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 2.7
+Classifier: Programming Language :: Python :: Implementation :: CPython
+Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Topic :: Office/Business
Classifier: Topic :: Office/Business :: Financial :: Accounting
diff --git a/trytond_account_payment_clearing.egg-info/SOURCES.txt b/trytond_account_payment_clearing.egg-info/SOURCES.txt
index a7c4585..304e82c 100644
--- a/trytond_account_payment_clearing.egg-info/SOURCES.txt
+++ b/trytond_account_payment_clearing.egg-info/SOURCES.txt
@@ -20,6 +20,7 @@ tryton.cfg
./locale/es_AR.po
./locale/es_CO.po
./locale/es_EC.po
+./locale/es_ES.po
./locale/fr_FR.po
./locale/sl_SI.po
./tests/__init__.py
@@ -34,6 +35,7 @@ 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/sl_SI.po
tests/scenario_account_payment_clearing.rst
diff --git a/trytond_account_payment_clearing.egg-info/requires.txt b/trytond_account_payment_clearing.egg-info/requires.txt
index a90ce06..306f312 100644
--- a/trytond_account_payment_clearing.egg-info/requires.txt
+++ b/trytond_account_payment_clearing.egg-info/requires.txt
@@ -1,2 +1,2 @@
-trytond_account_payment >= 3.4, < 3.5
-trytond >= 3.4, < 3.5
\ No newline at end of file
+trytond_account_payment >= 3.6, < 3.7
+trytond >= 3.6, < 3.7
\ No newline at end of file
--
tryton-modules-account-payment-clearing
More information about the tryton-debian-vcs
mailing list