Skip to content

Commit

Permalink
[FIX] tax_settlement
Browse files Browse the repository at this point in the history
closes #261

Signed-off-by: Juan José Scarafía <jjs@adhoc.com.ar>
  • Loading branch information
jjscarafia committed Aug 23, 2023
1 parent eafb2bf commit 8c08194
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 1 addition & 2 deletions account_tax_settlement/models/account_journal.py
Expand Up @@ -151,8 +151,7 @@ def create_tax_settlement_entry(self, move_lines):

def _get_tax_settlement_entry_lines_vals(self, domain=None):
# TODO agregar la parte dinamica
grouped_move_lines = self.env['account.move.line'].read_group(
domain, ['account_id', 'balance', 'amount_currency'], ['account_id'])
grouped_move_lines = self.env['account.move.line'].read_group(domain, ['account_id', 'balance', 'amount_currency:sum'], ['account_id'])

new_move_lines = []
balance = 0.0
Expand Down
7 changes: 6 additions & 1 deletion account_tax_settlement/models/account_report.py
Expand Up @@ -80,7 +80,12 @@ def _report_create_settlement_entry(self, journal, options, account):
balance = sum([x['debit'] - x['credit'] for x in lines_vals])
if not journal.company_id.currency_id.is_zero(balance):
if not self.settlement_allow_unbalanced or not account:
raise ValidationError('Debe configurar bla bla')
raise ValidationError(
'Parece que la liquidación quedaría desbalanceada. Si desea generar igualmente la liquidacion puede:\n'
'1. Ir a "Contabilidad / Configuración / Administración / Informes contables"\n'
'2. Buscar el informe correspondiente\n'
'3. En opciones, marcar "Settlement Allow Unbalanced"\n'
'4. Puede volver a crear el asiento de liqidación seleccionando la cuenta de contrapartida que le sea solicitada')
lines_vals.append({
'name': self.settlement_title,
'debit': balance < 0.0 and -balance,
Expand Down

0 comments on commit 8c08194

Please sign in to comment.