Exclude deferral period and use configuration for opening
issue7410 review74321002
This commit is contained in:
1 parent
d1ef6a4246
commit
6adda2ab15
7 files changed
+88
-28
No files matched your search
@@ -1,3 +1,5 @@
|
||||
* Exclude deferral period on FEC
|
||||
* Use configuration for FEC opening move
|
||||
* Remove support for Python 2.7
|
||||
|
||||
Version 4.8.0 - 2018-04-23
|
||||
|
||||
@@ -7,4 +7,5 @@ include tryton.cfg
|
||||
include *.xml
|
||||
include view/*.xml
|
||||
include locale/*.po
|
||||
include doc/*
|
||||
include tests/*.rst
|
||||
+27
-17
@@ -7,11 +7,18 @@ from sql import Table
|
||||
from sql.aggregate import Sum
|
||||
from sql.conditionals import Coalesce
|
||||
|
||||
from trytond.config import config
|
||||
from trytond.pool import PoolMeta, Pool
|
||||
from trytond.pyson import Eval
|
||||
from trytond.transaction import Transaction
|
||||
from trytond.wizard import Wizard, StateView, StateTransition, Button
|
||||
from trytond.model import ModelView, ModelStorage, fields
|
||||
|
||||
OPENING_CODE = config.get('account_fr', 'fec_opening_code', default="OUV")
|
||||
OPENING_NAME = config.get(
|
||||
'account_fr', 'fec_opening_name', default="Balance Initiale")
|
||||
OPENING_NUMBER = config.get('account_fr', 'fec_opening_number', default="0")
|
||||
|
||||
|
||||
__all__ = ['TaxTemplate', 'TaxRuleTemplate',
|
||||
'AccountFrFEC', 'AccountFrFECStart', 'AccountFrFECResult']
|
||||
@@ -227,10 +234,9 @@ class AccountFrFEC(Wizard):
|
||||
else:
|
||||
debit, credit = 0, balance
|
||||
yield [
|
||||
self.start.deferral_journal.code
|
||||
or self.start.deferral_journal.name,
|
||||
self.start.deferral_journal.name,
|
||||
self.start.deferral_post_number,
|
||||
OPENING_CODE,
|
||||
OPENING_NAME,
|
||||
OPENING_NUMBER,
|
||||
format_date(self.start.fiscalyear.start_date),
|
||||
code,
|
||||
name,
|
||||
@@ -252,10 +258,14 @@ class AccountFrFEC(Wizard):
|
||||
pool = Pool()
|
||||
Line = pool.get('account.move.line')
|
||||
|
||||
return Line.search([
|
||||
('move.period.fiscalyear', '=', self.start.fiscalyear.id),
|
||||
('move.state', '=', 'posted'),
|
||||
],
|
||||
domain = [
|
||||
('move.period.fiscalyear', '=', self.start.fiscalyear.id),
|
||||
('move.state', '=', 'posted'),
|
||||
]
|
||||
if self.start.deferral_period:
|
||||
domain.append(('move.period', '!=', self.start.deferral_period.id))
|
||||
return Line.search(
|
||||
domain,
|
||||
order=[
|
||||
('move.post_number', 'ASC'),
|
||||
])
|
||||
@@ -326,20 +336,20 @@ class AccountFrFECStart(ModelView):
|
||||
type = fields.Selection([
|
||||
('is-bic', 'IS-BIC'),
|
||||
], 'Type', required=True)
|
||||
deferral_journal = fields.Many2One('account.journal',
|
||||
'Deferral Journal', required=True,
|
||||
help='Journal used for pseudo deferral move')
|
||||
deferral_post_number = fields.Char('Deferral Number', required=True,
|
||||
help='Post number used for pseudo deferral move')
|
||||
deferral_period = fields.Many2One(
|
||||
'account.period', "Deferral Period", required=True,
|
||||
domain=[
|
||||
('fiscalyear', '=', Eval('fiscalyear')),
|
||||
('type', '=', 'adjustment'),
|
||||
],
|
||||
depends=['fiscalyear'],
|
||||
help="The period to exclude which contains "
|
||||
"the moves to balance non-deferral account")
|
||||
|
||||
@classmethod
|
||||
def default_type(cls):
|
||||
return 'is-bic'
|
||||
|
||||
@classmethod
|
||||
def default_deferral_post_number(cls):
|
||||
return '0'
|
||||
|
||||
|
||||
class AccountFrFECResult(ModelView):
|
||||
'Generate FEC'
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
French Account Module
|
||||
#####################
|
||||
|
||||
The French account module defines the standard chart of account
|
||||
|
||||
A wizard allows to generate the FEC file for a fiscal year.
|
||||
|
||||
Configuration
|
||||
*************
|
||||
|
||||
The account_fr module uses the section `account_fr` to retrieve some parameters:
|
||||
|
||||
- `fec_opening_code`: defines the journal code for the opening balance in the
|
||||
FEC file. The default value is `OUV`.
|
||||
|
||||
- `fec_opening_name`: defines the journal name for the opening balance in the
|
||||
FEC file. The default value is `Balance Initiale`.
|
||||
|
||||
- `fec_opening_number`: defines the number of the opening balance in the FEC
|
||||
file. The default value is `0`.
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
JournalCode JournalLib EcritureNum EcritureDate CompteNum CompteLib CompAuxNum CompAuxLib PieceRef PieceDate EcritureLib Debit Credit EcritureLet DateLet ValidDate Montantdevise Idevise
|
||||
Deferral Deferral 0 20180101 797 Transferts de charges exceptionnelles - 20180101 - 0,00 -5,00 20180101
|
||||
Deferral Deferral 0 20180101 4967 Autres comptes débiteurs 2 Party - 20180101 - 5,00 0,00 20180101
|
||||
OUV Balance Initiale 0 20180101 797 Transferts de charges exceptionnelles - 20180101 - 0,00 -5,00 20180101
|
||||
OUV Balance Initiale 0 20180101 4967 Autres comptes débiteurs 2 Party - 20180101 - 5,00 0,00 20180101
|
||||
REV Revenue 1 20180101 797 Transferts de charges exceptionnelles - 20180101 - 0,00 10,00 20180101
|
||||
REV Revenue 1 20180101 4967 Autres comptes débiteurs 2 Party - 20180101 - 10,00 0,00 20180101
|
||||
|
+34
-5
@@ -99,15 +99,44 @@ Create some moves::
|
||||
>>> move.post_number = '1'
|
||||
>>> move.click('post')
|
||||
|
||||
Generate FEC::
|
||||
Balance non-deferral::
|
||||
|
||||
>>> deferral_journal = Journal(name="Deferral", type='situation')
|
||||
>>> deferral_journal.sequence = journal_cash.sequence
|
||||
>>> deferral_journal.save()
|
||||
>>> Sequence = Model.get('ir.sequence')
|
||||
>>> Period = Model.get('account.period')
|
||||
>>> Account = Model.get('account.account')
|
||||
|
||||
>>> journal_closing = Journal(name="Closing", code="CLO", type='situation')
|
||||
>>> journal_closing.sequence, = Sequence.find([
|
||||
... ('code', '=', 'account.journal'),
|
||||
... ])
|
||||
>>> journal_closing.save()
|
||||
|
||||
>>> period_closing = Period(name="Closing")
|
||||
>>> period_closing.fiscalyear = fiscalyear
|
||||
>>> period_closing.start_date = fiscalyear.end_date
|
||||
>>> period_closing.end_date = fiscalyear.end_date
|
||||
>>> period_closing.type = 'adjustment'
|
||||
>>> period_closing.save()
|
||||
|
||||
>>> balance_non_deferral = Wizard('account.fiscalyear.balance_non_deferral')
|
||||
>>> balance_non_deferral.form.fiscalyear = fiscalyear
|
||||
>>> balance_non_deferral.form.journal = journal_closing
|
||||
>>> balance_non_deferral.form.period = period_closing
|
||||
>>> balance_non_deferral.form.credit_account, = Account.find([
|
||||
... ('code', '=', '120'),
|
||||
... ])
|
||||
>>> balance_non_deferral.form.debit_account, = Account.find([
|
||||
... ('code', '=', '129'),
|
||||
... ])
|
||||
>>> balance_non_deferral.execute('balance')
|
||||
>>> move_line = balance_non_deferral.actions[0][0]
|
||||
>>> move_line.move.click('post')
|
||||
|
||||
Generate FEC::
|
||||
|
||||
>>> FEC = Wizard('account.fr.fec')
|
||||
>>> FEC.form.fiscalyear = fiscalyear
|
||||
>>> FEC.form.deferral_journal = deferral_journal
|
||||
>>> FEC.form.deferral_period = period_closing
|
||||
>>> FEC.execute('generate')
|
||||
>>> FEC.form.filename
|
||||
>>> file = os.path.join(os.path.dirname(__file__), 'FEC.csv')
|
||||
|
||||
@@ -6,8 +6,6 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="fiscalyear"/>
|
||||
<label name="type"/>
|
||||
<field name="type"/>
|
||||
<label name="deferral_journal"/>
|
||||
<field name="deferral_journal"/>
|
||||
<label name="deferral_post_number"/>
|
||||
<field name="deferral_post_number"/>
|
||||
<label name="deferral_period"/>
|
||||
<field name="deferral_period"/>
|
||||
</form>
|
||||
Reference in new issue
Block a user