Skip to content

Commit

Permalink
[MIG] account_accountant_ux: Migration to 17.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ica-adhoc committed Dec 1, 2023
1 parent 83ca63d commit 861ffb8
Show file tree
Hide file tree
Showing 9 changed files with 79 additions and 64 deletions.
4 changes: 3 additions & 1 deletion account_accountant_ux/README.rst
Expand Up @@ -15,10 +15,12 @@ Accounting Reports UX
=====================

#. Mueve el menu "Caja y bancos" a nuevo menú de Accounting
#. This module add to set the company in the wizard to set the account lock date.
#. Agrega el parámetro "Compañía" en el wizard de Fechas Bloqueadas.
#. Add an option to force company currency on follow ups
#. Mejorar que para asientos migrados desde 13 que están vinculados a un pago y linea de extracto a la vez, el botón "pagos" te lleve efectivamente al pago (odoo te lleva a la linea de extracto pero ya existe un botón para esto)
#. Ajustar conciliacion bancaria para compatibilidad con la opción "reconcile_on_company_currency"
#. Agrega filtros de "Igual Monto", "Monto Aproximado" y "Monto Menor" en el asistente de conciliación.
#. Determina por defecto el filtro "Igual Monto" en el asistente de conciliación.

Installation
============
Expand Down
6 changes: 2 additions & 4 deletions account_accountant_ux/__manifest__.py
Expand Up @@ -19,7 +19,7 @@
##############################################################################
{
'name': 'Accounting Accountant UX',
'version': "16.0.2.1.0",
'version': "17.0.1.0.0",
'category': 'Accounting',
'sequence': 14,
'summary': '',
Expand All @@ -31,19 +31,17 @@
'depends': [
'account_reports',
'account_followup',
'account_payment_group',
],
'data': [
'views/res_partner_view.xml',
'views/account_followup_views.xml',
'views/account_move_line.xml',
'wizards/account_change_lock_date_views.xml',
'wizards/res_config_settings_views.xml',
'data/account_accountant_data.xml',
],
'demo': [
],
'installable': False,
'installable': True,
'auto_install': True,
'application': False,
}
5 changes: 0 additions & 5 deletions account_accountant_ux/data/account_accountant_data.xml

This file was deleted.

62 changes: 50 additions & 12 deletions account_accountant_ux/models/account_followup_report.py
Expand Up @@ -44,31 +44,42 @@ def _get_followup_report_lines(self, options):
invoice_date = {
'name': format_date(self.env, aml.move_id.invoice_date or aml.date, lang_code=lang_code),
'class': 'date',
'style': 'white-space:nowrap;text-align:center;'
'style': 'white-space:nowrap;text-align:left;',
'template': 'account_followup.cell_template_followup_report',
}
date_due = format_date(self.env, aml.date_maturity or aml.move_id.invoice_date or aml.date, lang_code=lang_code)
total += not aml.blocked and amount or 0
is_overdue = today > aml.date_maturity if aml.date_maturity else today > aml.date
is_payment = aml.payment_id
if is_overdue or is_payment:
total_issued += not aml.blocked and amount or 0
date_due = {'name': date_due, 'class': 'date', 'style': 'white-space:nowrap;text-align:center;'}
date_due = {
'name': date_due, 'class': 'date',
'style': 'white-space:nowrap;text-align:left;',
'template': 'account_followup.cell_template_followup_report',
}
if is_overdue:
date_due['style'] += 'color: red;'
if is_payment:
date_due = ''
move_line_name = {
'name': self._followup_report_format_aml_name(aml.name, aml.move_id.ref),
'style': 'text-align:right; white-space:normal;'
'style': 'text-align:left; white-space:normal;',
'template': 'account_followup.cell_template_followup_report',
}
amount = {
'name': formatLang(self.env, amount, currency_obj=currency),
'style': 'text-align:right; white-space:normal;',
'template': 'account_followup.cell_template_followup_report',
}
amount = formatLang(self.env, amount, currency_obj=currency)
line_num += 1
invoice_origin = aml.move_id.invoice_origin or ''
if len(invoice_origin) > 43:
invoice_origin = invoice_origin[:40] + '...'
invoice_origin = {
'name': invoice_origin,
'style': 'text-align:center; white-space:normal;',
'template': 'account_followup.cell_template_followup_report',
}
columns = [
invoice_date,
Expand All @@ -84,32 +95,53 @@ def _get_followup_report_lines(self, options):
'move_id': aml.move_id.id,
'type': is_payment and 'payment' or 'unreconciled_aml',
'unfoldable': False,
'columns': [isinstance(v, dict) and v or {'name': v} for v in columns],
'template': 'account_followup.cell_template_followup_report',
'columns': [isinstance(v, dict) and v or {'name': v, 'template': 'account_followup.cell_template_followup_report'} for v in columns],
})
total_due = formatLang(self.env, total, currency_obj=currency)
line_num += 1

cols = \
[{
'name': v,
'template': 'account_followup.cell_template_followup_report',
} for v in [''] * 3] + \
[{
'name': v,
'style': 'text-align:right; white-space:normal; font-weight: bold;',
'template': 'account_followup.cell_template_followup_report',
} for v in [total >= 0 and _('Total Due') or '', total_due]]

lines.append({
'id': line_num,
'name': '',
'class': 'total',
'style': 'border-top-style: double',
'unfoldable': False,
'level': 3,
'columns': [{'name': v} for v in [''] * 3 + [total >= 0 and _('Total Due') or '', total_due]],
'template': 'account_followup.cell_template_followup_report',
'columns': cols,
})
if total_issued > 0:
total_issued = formatLang(self.env, total_issued, currency_obj=currency)
line_num += 1

cols = \
[{
'name': v,
'template': 'account_followup.cell_template_followup_report',
} for v in [''] * 3] + \
[{
'name': v,
'style': 'text-align:right; white-space:normal; font-weight: bold;',
'template': 'account_followup.cell_template_followup_report',
} for v in [_('Total Overdue'), total_issued]]

lines.append({
'id': line_num,
'name': '',
'class': 'total',
'unfoldable': False,
'level': 3,
'columns': [{'name': v} for v in [''] * 3 + [_('Total Overdue'), total_issued]],
'template': 'account_followup.cell_template_followup_report',
'columns': cols,
})
# Add an empty line after the total to make a space between two currencies
line_num += 1
Expand All @@ -120,10 +152,16 @@ def _get_followup_report_lines(self, options):
'style': 'border-bottom-style: none',
'unfoldable': False,
'level': 0,
'columns': [{} for col in columns],
'template': 'account_followup.cell_template_followup_report',
'columns': [{'template': 'account_followup.cell_template_followup_report'} for col in columns],
})
# Remove the last empty line
if lines:
lines.pop()

# Catch negative numbers when present
for line in lines:
for col in line['columns']:
if self.env.company.currency_id.compare_amounts(col.get('no_format', 0.0), 0.0) == -1:
col['class'] = 'number color-red'

return lines
2 changes: 1 addition & 1 deletion account_accountant_ux/models/account_move_line.py
Expand Up @@ -6,7 +6,7 @@ class AccountMovetLine(models.Model):
_inherit = 'account.move.line'

filter_amount = fields.Float(compute="compute_filter_amout", search='_search_filter_amount')

def compute_filter_amout(self):
self.filter_amount = False

Expand Down
39 changes: 15 additions & 24 deletions account_accountant_ux/models/bank_rec_widget.py
Expand Up @@ -6,33 +6,24 @@
class BankRecWidget(models.Model):
_inherit = "bank.rec.widget"

@api.depends('st_line_id')
def _compute_amls_widget(self):
for wizard in self:
super()._compute_amls_widget()
amls_widget = wizard.amls_widget
amls_widget['context']['default_st_line_id'] = wizard.st_line_id.id
amls_widget['context']['search_default_same_amount'] = True
wizard.amls_widget = amls_widget
def _prepare_embedded_views_data(self):
data = super()._prepare_embedded_views_data()
data['amls']['context']['default_st_line_id'] = self.st_line_id.id
data['amls']['context']['search_default_same_amount'] = True
return data

def collect_global_info_data(self, journal_id):
# def collect_global_info_data(self, journal_id):

# Por ahora no mostramos el valor en el kanban. Porque confunde al cliente
# Deberiaamos aplicar este Cambio a como esta en master 17 ¿usar patch?
# Ver commit
# https://github.com/odoo/enterprise/commit/e1f0f66a7237d8c8b056cdf2636ccc019818a17d#diff-ee342c09ffb6b8de7f51c4a0ed66fee056e8975e7416d0f85ae0d2b6b1883dfdR1467
# journal = self.env['account.journal'].browse(journal_id)
# balance = formatLang(self.env,
# journal.current_statement_balance,
# currency_obj=journal.currency_id or journal.company_id.currency_id)
# return {
# 'balance_amount': balance,
# }

# journal = self.env['account.journal'].browse(journal_id)
# balance = formatLang(self.env,
# journal.current_statement_balance,
# currency_obj=journal.currency_id or journal.company_id.currency_id)
# return {
# 'balance_amount': balance,
# }

return {'balance_amount': None}

def _lines_widget_recompute_exchange_diff(self):
def _lines_recompute_exchange_diff(self):
self.ensure_one()
self._ensure_loaded_lines()

Expand Down Expand Up @@ -62,4 +53,4 @@ def _lines_widget_recompute_exchange_diff(self):

self.line_ids = line_ids_commands
return
super()._lines_widget_recompute_exchange_diff()
super()._lines_recompute_exchange_diff()
2 changes: 1 addition & 1 deletion account_accountant_ux/views/account_move_line.xml
Expand Up @@ -2,7 +2,7 @@
<record id="view_account_move_line_search_bank_rec_widget" model="ir.ui.view">
<field name="name">account.move.line.search.bank_rec_widget</field>
<field name="model">account.move.line</field>
<field name="inherit_id" ref="account_accountant.view_account_move_line_search_bank_rec_widget"/>
<field name="inherit_id" ref="account_accountant.view_account_move_line_search_bank_rec_widget"/>
<field name="arch" type="xml">
<filter name="amount_received" position="before">
<filter name="same_amount" string="Igual Monto" domain="[('filter_amount', '=', 0.0)]"/>
Expand Down
2 changes: 1 addition & 1 deletion account_accountant_ux/views/res_partner_view.xml
Expand Up @@ -18,7 +18,7 @@
icon="fa-list"
name="%(account.action_account_moves_ledger_partner)d"
string="Partner Ledger"
context="{'search_default_partner_id': active_id}"
context="{'search_default_partner_id': id}"
>
</button>
</button>
Expand Down
21 changes: 6 additions & 15 deletions account_accountant_ux/wizards/res_config_settings_views.xml
Expand Up @@ -7,21 +7,12 @@
<field name="model">res.config.settings</field>
<field name="inherit_id" ref="account.res_config_settings_view_form"/>
<field name="arch" type="xml">
<div name="main_currency_setting_container" position="inside">
<div class="col-12 col-lg-6 o_setting_box">
<div class="o_setting_left_pane">
<field name="use_company_currency_on_followup"/>
</div>
<div class="o_setting_right_pane">
<label name="Use company currency on Followup" for="use_company_currency_on_followup"/>
<span class="fa fa-lg fa-building-o" title="Values set here are company-specific." groups="base.group_multi_company"/>
<div class="text-muted">
By default Odoo Follow up will open the debt per currency.
If you set this option all the debt will be grouped on one section and using the company currency.
</div>
</div>
</div>
</div>
<block name="main_currency_setting_container" position="inside">
<setting id="company_currency_on_follow_up" string="Use company currency on Followup" company_dependent="1" help="By default Odoo Follow up will open the debt per currency.
If you set this option all the debt will be grouped on one section and using the company currency.">
<field name="use_company_currency_on_followup"/>
</setting>
</block>
</field>
</record>

Expand Down

0 comments on commit 861ffb8

Please sign in to comment.