Skip to content
Snippets Groups Projects
Commit 0ef54895 authored by Xavier Morel's avatar Xavier Morel
Browse files

[IMP] l10n_fr_fec: fix report

parent c8294e19
No related branches found
No related tags found
No related merge requests found
......@@ -7,7 +7,7 @@ import base64
import io
from odoo import api, fields, models, _
from odoo.exceptions import Warning
from odoo.exceptions import Warning, AccessDenied
from odoo.tools import float_is_zero, pycompat
from odoo.tools.misc import get_lang
......@@ -25,7 +25,7 @@ class AccountFrFec(models.TransientModel):
('nonofficial', 'Non-official FEC report (posted and unposted entries)'),
], string='Export Type', required=True, default='official')
def do_query_unaffected_earnings(self):
def _do_query_unaffected_earnings(self):
''' Compute the sum of ending balances for all accounts that are of a type that does not bring forward the balance in new fiscal years.
This is needed because we have to display only one line for the initial balance of all expense/revenue accounts in the FEC.
'''
......@@ -100,6 +100,8 @@ class AccountFrFec(models.TransientModel):
def generate_fec(self):
self.ensure_one()
if not (self.env.is_admin() or self.env.user.has_group('account.group_account_user')):
raise AccessDenied()
# We choose to implement the flat file instead of the XML
# file for 2 reasons :
# 1) the XSD file impose to have the label on the account.move
......@@ -138,7 +140,7 @@ class AccountFrFec(models.TransientModel):
unaffected_earnings_line = True # used to make sure that we add the unaffected earning initial balance only once
if unaffected_earnings_xml_ref:
#compute the benefit/loss of last year to add in the initial balance of the current year earnings account
unaffected_earnings_results = self.do_query_unaffected_earnings()
unaffected_earnings_results = self._do_query_unaffected_earnings()
unaffected_earnings_line = False
sql_query = '''
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment