diff options
| author | Christophe Simonis <chs@odoo.com> | 2019-03-21 13:58:37 +0100 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2019-03-21 13:58:37 +0100 |
| commit | 4eff0af02ef2c182793fce5f32d2d15f53a5fba7 (patch) | |
| tree | 8790e0051f631240562a9408ccd5e2a5cd64782b /addons/l10n_fr_fec | |
| parent | 45e3e432a3621cf03a38ce48562eb967f1ff76e0 (diff) | |
| parent | 6878c9f3424f27df9b07a665f9c0f5ef6e254996 (diff) | |
[MERGE] forward port branch saas-12.1 up to 6878c9f3424
Diffstat (limited to 'addons/l10n_fr_fec')
| -rw-r--r-- | addons/l10n_fr_fec/wizard/account_fr_fec.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/addons/l10n_fr_fec/wizard/account_fr_fec.py b/addons/l10n_fr_fec/wizard/account_fr_fec.py index d91f4858c88..0a6459a0953 100644 --- a/addons/l10n_fr_fec/wizard/account_fr_fec.py +++ b/addons/l10n_fr_fec/wizard/account_fr_fec.py @@ -8,7 +8,7 @@ import io from odoo import api, fields, models, _ from odoo.exceptions import Warning -from odoo.tools import pycompat +from odoo.tools import float_is_zero, pycompat class AccountFrFec(models.TransientModel): @@ -182,14 +182,16 @@ class AccountFrFec(models.TransientModel): sql_query += ''' GROUP BY aml.account_id, aat.type - HAVING sum(aml.balance) != 0 + HAVING round(sum(aml.balance), %s) != 0 AND aat.type not in ('receivable', 'payable') ''' formatted_date_from = fields.Date.to_string(self.date_from).replace('-', '') date_from = self.date_from formatted_date_year = date_from.year + currency_digits = 2 + self._cr.execute( - sql_query, (formatted_date_year, formatted_date_from, formatted_date_from, formatted_date_from, self.date_from, company.id)) + sql_query, (formatted_date_year, formatted_date_from, formatted_date_from, formatted_date_from, self.date_from, company.id, currency_digits)) for row in self._cr.fetchall(): listrow = list(row) @@ -202,6 +204,8 @@ class AccountFrFec(models.TransientModel): current_amount = float(listrow[11].replace(',', '.')) - float(listrow[12].replace(',', '.')) unaffected_earnings_amount = float(unaffected_earnings_results[11].replace(',', '.')) - float(unaffected_earnings_results[12].replace(',', '.')) listrow_amount = current_amount + unaffected_earnings_amount + if float_is_zero(listrow_amount, precision_digits=currency_digits): + continue if listrow_amount > 0: listrow[11] = str(listrow_amount).replace('.', ',') listrow[12] = '0,00' @@ -269,11 +273,11 @@ class AccountFrFec(models.TransientModel): sql_query += ''' GROUP BY aml.account_id, aat.type, rp.ref, rp.id - HAVING sum(aml.balance) != 0 + HAVING round(sum(aml.balance), %s) != 0 AND aat.type in ('receivable', 'payable') ''' self._cr.execute( - sql_query, (formatted_date_year, formatted_date_from, formatted_date_from, formatted_date_from, self.date_from, company.id)) + sql_query, (formatted_date_year, formatted_date_from, formatted_date_from, formatted_date_from, self.date_from, company.id, currency_digits)) for row in self._cr.fetchall(): listrow = list(row) |
