[FIX] l10n_fr_fec: exclude initial balance at 0
This is the proper fix for3180aec56aand is the continuation off7e4241a91. A sum without groupby will return NULL so we forced it back to 0,00. Then, it can happen that you have no move before the start date, so you don't have any opening "OUV" row. opw-682365
This commit is contained in:
@@ -41,8 +41,8 @@ class AccountFrFec(models.TransientModel):
|
||||
'-' AS PieceRef,
|
||||
%s AS PieceDate,
|
||||
'/' AS EcritureLib,
|
||||
replace(CASE WHEN sum(aml.balance) <= 0 THEN '0,00' ELSE to_char(SUM(aml.balance), '999999999999999D99') END, '.', ',') AS Debit,
|
||||
replace(CASE WHEN sum(aml.balance) >= 0 THEN '0,00' ELSE to_char(-SUM(aml.balance), '999999999999999D99') END, '.', ',') AS Credit,
|
||||
replace(CASE WHEN COALESCE(sum(aml.balance), 0) <= 0 THEN '0,00' ELSE to_char(SUM(aml.balance), '999999999999999D99') END, '.', ',') AS Debit,
|
||||
replace(CASE WHEN COALESCE(sum(aml.balance), 0) >= 0 THEN '0,00' ELSE to_char(-SUM(aml.balance), '999999999999999D99') END, '.', ',') AS Credit,
|
||||
'' AS EcritureLet,
|
||||
'' AS DateLet,
|
||||
%s AS ValidDate,
|
||||
@@ -191,13 +191,13 @@ class AccountFrFec(models.TransientModel):
|
||||
listrow[12] = str(listrow_amount)
|
||||
w.writerow([s.encode("utf-8") for s in listrow])
|
||||
#if the unaffected earnings account wasn't in the selection yet: add it manually
|
||||
if not unaffected_earnings_line and unaffected_earnings_results:
|
||||
if not unaffected_earnings_line and unaffected_earnings_results and unaffected_earnings_results[11] != '0,00' and unaffected_earnings_results[12] != '0,00':
|
||||
#search an unaffected earnings account
|
||||
unaffected_earnings_account = self.env['account.account'].search([('user_type_id', '=', self.env.ref('account.data_unaffected_earnings').id)], limit=1)
|
||||
if unaffected_earnings_account:
|
||||
unaffected_earnings_results[4] = unaffected_earnings_account.code
|
||||
unaffected_earnings_results[5] = unaffected_earnings_account.name
|
||||
w.writerow([(s if s else '').encode("utf-8") for s in unaffected_earnings_results])
|
||||
w.writerow([s.encode("utf-8") for s in unaffected_earnings_results])
|
||||
|
||||
# LINES
|
||||
sql_query = '''
|
||||
|
||||
Reference in New Issue
Block a user