diff --git a/account_financial_report/README.rst b/account_financial_report/README.rst index 5cb6fc5cd941..b4fea7bdded0 100644 --- a/account_financial_report/README.rst +++ b/account_financial_report/README.rst @@ -7,7 +7,7 @@ Account Financial Reports !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:63c22ffc36a866253069bb79e215fde2ac28e02e6aff126107095dfdf6e50206 + !! source digest: sha256:c2a836a62811dc8ebd92aba44122bb5e2ec69ccb6d39c53568bcaf35ce3da550 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png @@ -45,11 +45,45 @@ currency used in account move lines is properly shown. In case that in an account has not been configured a second currency foreign currency balances are not available. +Invoicing / Settings / Invoicing / OCA Aged Report Configuration you will be able to set +dynamic intervals that will appear on the Aged Partner Balance. +For further information, check CONFIGURE.rst + **Table of contents** .. contents:: :local: +Configuration +============= + +To configure dynamic intervals for Aged Partner Balance you need to: + +Go on 'Settings' -> 'Invoicing' -> 'OCA Aged Report Configuration'. + +Click on option 'Configurations' and create new record. + +Create new interval. +The name established on line will be the column to display in Aged Partner Balance. +Superior limit established on line is the interval + +Example of configuration superior limit: + +-> 15 +-> 30 +-> 60 + +It means the first interval is from 0 to 15, the second from 16 to 30, and the third is 61+. + +Go on 'Invoicing' -> 'Reports' -> 'OCA accounting reports' -> 'Aged Partner Balance' + +When wizard is open, you need to select your interval configuration and print report. + +If you want to get default interval configuration any time you wish to print Aged Partner Report, +you can set default interval configuration per company in: + +'Settings' -> 'Invoicing' -> 'OCA Aged Report Configuration'. + Known issues / Roadmap ====================== @@ -134,6 +168,7 @@ Contributors * João Marques * Alexandre D. Díaz * Víctor Martínez + * Carolina Fernandez * `Sygel `__: diff --git a/account_financial_report/__manifest__.py b/account_financial_report/__manifest__.py index 35d1c0ad4a7d..02cf5d7e03db 100644 --- a/account_financial_report/__manifest__.py +++ b/account_financial_report/__manifest__.py @@ -25,6 +25,7 @@ "wizard/open_items_wizard_view.xml", "wizard/trial_balance_wizard_view.xml", "wizard/vat_report_wizard_view.xml", + "view/account_age_report_configuration_views.xml", "menuitems.xml", "reports.xml", "report/templates/layouts.xml", @@ -35,13 +36,13 @@ "report/templates/trial_balance.xml", "report/templates/vat_report.xml", "view/account_view.xml", - "view/account_age_report_configuration_views.xml", "view/report_general_ledger.xml", "view/report_journal_ledger.xml", "view/report_trial_balance.xml", "view/report_open_items.xml", "view/report_aged_partner_balance.xml", "view/report_vat_report.xml", + "view/res_config_settings_views.xml", ], "assets": { "web.assets_backend": [ diff --git a/account_financial_report/i18n/account_financial_report.pot b/account_financial_report/i18n/account_financial_report.pot index 2cb00eac5486..d47049d94933 100644 --- a/account_financial_report/i18n/account_financial_report.pot +++ b/account_financial_report/i18n/account_financial_report.pot @@ -6,6 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 15.0\n" "Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2023-11-22 16:10+0000\n" +"PO-Revision-Date: 2023-11-22 16:10+0000\n" "Last-Translator: \n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -49,6 +51,11 @@ msgstr "" msgid "Taxes summary" msgstr "" +#. module: account_financial_report +#: model_terms:ir.ui.view,arch_db:account_financial_report.res_config_settings_view_form +msgid "Intervals configuration" +msgstr "" + #. module: account_financial_report #: model_terms:ir.ui.view,arch_db:account_financial_report.aged_partner_balance_wizard #: model_terms:ir.ui.view,arch_db:account_financial_report.general_ledger_wizard @@ -88,6 +95,11 @@ msgstr "" msgid "Account" msgstr "" +#. module: account_financial_report +#: model:ir.model.fields,field_description:account_financial_report.field_account_age_report_configuration_line__account_age_report_config_id +msgid "Account Age Report Config" +msgstr "" + #. module: account_financial_report #: model:ir.model.fields,field_description:account_financial_report.field_aged_partner_balance_report_wizard__account_code_from #: model:ir.model.fields,field_description:account_financial_report.field_general_ledger_report_wizard__account_code_from @@ -146,11 +158,16 @@ msgstr "" msgid "Additional Filtering" msgstr "" +#. module: account_financial_report +#: model:ir.actions.act_window,name:account_financial_report.action_aged_partner_report_configuration +msgid "Age Partner Report Configuration" +msgstr "" + #. module: account_financial_report #: model_terms:ir.ui.view,arch_db:account_financial_report.report_aged_partner_balance_move_lines msgid "" "Age ≤ 120\n" -" d." +" d." msgstr "" #. module: account_financial_report @@ -164,7 +181,7 @@ msgstr "" #: model_terms:ir.ui.view,arch_db:account_financial_report.report_aged_partner_balance_move_lines msgid "" "Age ≤ 30\n" -" d." +" d." msgstr "" #. module: account_financial_report @@ -178,7 +195,7 @@ msgstr "" #: model_terms:ir.ui.view,arch_db:account_financial_report.report_aged_partner_balance_move_lines msgid "" "Age ≤ 60\n" -" d." +" d." msgstr "" #. module: account_financial_report @@ -192,7 +209,7 @@ msgstr "" #: model_terms:ir.ui.view,arch_db:account_financial_report.report_aged_partner_balance_move_lines msgid "" "Age ≤ 90\n" -" d." +" d." msgstr "" #. module: account_financial_report @@ -390,8 +407,21 @@ msgstr "" msgid "Code" msgstr "" +#. module: account_financial_report +#: code:addons/account_financial_report/models/account_age_report_configuration.py:0 +#: model:ir.model.constraint,message:account_financial_report.constraint_account_age_report_configuration_line_unique_name_config_combination +#, python-format +msgid "Name must be unique per report configuration" +msgstr "" + +#. module: account_financial_report +#: model:ir.model,name:account_financial_report.model_res_company +msgid "Companies" +msgstr "" + #. module: account_financial_report #: code:addons/account_financial_report/report/journal_ledger_xlsx.py:0 +#: model:ir.model.fields,field_description:account_financial_report.field_account_age_report_configuration__company_id #: model:ir.model.fields,field_description:account_financial_report.field_account_financial_report_abstract_wizard__company_id #: model:ir.model.fields,field_description:account_financial_report.field_aged_partner_balance_report_wizard__company_id #: model:ir.model.fields,field_description:account_financial_report.field_general_ledger_report_wizard__company_id @@ -409,6 +439,18 @@ msgid "Compute accounts" msgstr "" #. module: account_financial_report +#: model:ir.model,name:account_financial_report.model_res_config_settings +msgid "Config Settings" +msgstr "" + +#. module: account_financial_report +#: model_terms:ir.ui.view,arch_db:account_financial_report.res_config_settings_view_form +msgid "Configurations" +msgstr "" + +#. module: account_financial_report +#: model:ir.model.fields,field_description:account_financial_report.field_account_age_report_configuration__create_uid +#: model:ir.model.fields,field_description:account_financial_report.field_account_age_report_configuration_line__create_uid #: model:ir.model.fields,field_description:account_financial_report.field_aged_partner_balance_report_wizard__create_uid #: model:ir.model.fields,field_description:account_financial_report.field_general_ledger_report_wizard__create_uid #: model:ir.model.fields,field_description:account_financial_report.field_journal_ledger_report_wizard__create_uid @@ -419,6 +461,8 @@ msgid "Created by" msgstr "" #. module: account_financial_report +#: model:ir.model.fields,field_description:account_financial_report.field_account_age_report_configuration__create_date +#: model:ir.model.fields,field_description:account_financial_report.field_account_age_report_configuration_line__create_date #: model:ir.model.fields,field_description:account_financial_report.field_aged_partner_balance_report_wizard__create_date #: model:ir.model.fields,field_description:account_financial_report.field_general_ledger_report_wizard__create_date #: model:ir.model.fields,field_description:account_financial_report.field_journal_ledger_report_wizard__create_date @@ -595,6 +639,8 @@ msgid "Detail Taxes" msgstr "" #. module: account_financial_report +#: model:ir.model.fields,field_description:account_financial_report.field_account_age_report_configuration__display_name +#: model:ir.model.fields,field_description:account_financial_report.field_account_age_report_configuration_line__display_name #: model:ir.model.fields,field_description:account_financial_report.field_aged_partner_balance_report_wizard__display_name #: model:ir.model.fields,field_description:account_financial_report.field_general_ledger_report_wizard__display_name #: model:ir.model.fields,field_description:account_financial_report.field_journal_ledger_report_wizard__display_name @@ -873,6 +919,14 @@ msgstr "" msgid "Grouped By" msgstr "" +#. module: account_financial_report +#: model:ir.model.fields,help:account_financial_report.field_res_company__age_partner_config_id +#: model:ir.model.fields,help:account_financial_report.field_res_config_settings__default_age_partner_config_id +#: model_terms:ir.ui.view,arch_db:account_financial_report.res_config_settings_view_form +msgid "" +"Here you can set the intervals that will appear on the Aged Partner Balance." +msgstr "" + #. module: account_financial_report #: code:addons/account_financial_report/report/general_ledger_xlsx.py:0 #: code:addons/account_financial_report/report/open_items_xlsx.py:0 @@ -901,6 +955,8 @@ msgid "Hierarchy Levels to display" msgstr "" #. module: account_financial_report +#: model:ir.model.fields,field_description:account_financial_report.field_account_age_report_configuration__id +#: model:ir.model.fields,field_description:account_financial_report.field_account_age_report_configuration_line__id #: model:ir.model.fields,field_description:account_financial_report.field_aged_partner_balance_report_wizard__id #: model:ir.model.fields,field_description:account_financial_report.field_general_ledger_report_wizard__id #: model:ir.model.fields,field_description:account_financial_report.field_journal_ledger_report_wizard__id @@ -942,6 +998,13 @@ msgstr "" msgid "Initial balance" msgstr "" +#. module: account_financial_report +#: model:ir.model.fields,field_description:account_financial_report.field_aged_partner_balance_report_wizard__age_partner_config_id +#: model:ir.model.fields,field_description:account_financial_report.field_res_company__age_partner_config_id +#: model:ir.model.fields,field_description:account_financial_report.field_res_config_settings__default_age_partner_config_id +msgid "Intervals configuration" +msgstr "" + #. module: account_financial_report #: code:addons/account_financial_report/report/aged_partner_balance_xlsx.py:0 #: code:addons/account_financial_report/report/general_ledger_xlsx.py:0 @@ -1008,6 +1071,8 @@ msgid "Journals" msgstr "" #. module: account_financial_report +#: model:ir.model.fields,field_description:account_financial_report.field_account_age_report_configuration____last_update +#: model:ir.model.fields,field_description:account_financial_report.field_account_age_report_configuration_line____last_update #: model:ir.model.fields,field_description:account_financial_report.field_aged_partner_balance_report_wizard____last_update #: model:ir.model.fields,field_description:account_financial_report.field_general_ledger_report_wizard____last_update #: model:ir.model.fields,field_description:account_financial_report.field_journal_ledger_report_wizard____last_update @@ -1018,6 +1083,8 @@ msgid "Last Modified on" msgstr "" #. module: account_financial_report +#: model:ir.model.fields,field_description:account_financial_report.field_account_age_report_configuration__write_uid +#: model:ir.model.fields,field_description:account_financial_report.field_account_age_report_configuration_line__write_uid #: model:ir.model.fields,field_description:account_financial_report.field_aged_partner_balance_report_wizard__write_uid #: model:ir.model.fields,field_description:account_financial_report.field_general_ledger_report_wizard__write_uid #: model:ir.model.fields,field_description:account_financial_report.field_journal_ledger_report_wizard__write_uid @@ -1028,6 +1095,8 @@ msgid "Last Updated by" msgstr "" #. module: account_financial_report +#: model:ir.model.fields,field_description:account_financial_report.field_account_age_report_configuration__write_date +#: model:ir.model.fields,field_description:account_financial_report.field_account_age_report_configuration_line__write_date #: model:ir.model.fields,field_description:account_financial_report.field_aged_partner_balance_report_wizard__write_date #: model:ir.model.fields,field_description:account_financial_report.field_general_ledger_report_wizard__write_date #: model:ir.model.fields,field_description:account_financial_report.field_journal_ledger_report_wizard__write_date @@ -1058,13 +1127,24 @@ msgid "Limit hierarchy levels" msgstr "" #. module: account_financial_report -#: code:addons/account_financial_report/report/general_ledger.py:0 -#: code:addons/account_financial_report/report/general_ledger.py:0 -#: code:addons/account_financial_report/report/open_items.py:0 -#: code:addons/account_financial_report/report/trial_balance.py:0 -#: code:addons/account_financial_report/report/trial_balance.py:0 +#: model:ir.model.fields,field_description:account_financial_report.field_account_age_report_configuration__line_ids +msgid "Line" +msgstr "" + +#. module: account_financial_report +#: code:addons/account_financial_report/models/account_age_report_configuration.py:0 #, python-format -msgid "Missing Partner" +msgid "Inferior Limit must be greather than zero" +msgstr "" + +#. module: account_financial_report +#: model:ir.model,name:account_financial_report.model_account_age_report_configuration_line +msgid "Model to set interval lines for Age partner balance report" +msgstr "" + +#. module: account_financial_report +#: model:ir.model,name:account_financial_report.model_account_age_report_configuration +msgid "Model to set intervals for Age partner balance report" msgstr "" #. module: account_financial_report @@ -1077,9 +1157,17 @@ msgstr "" msgid "Moves" msgstr "" +#. module: account_financial_report +#: code:addons/account_financial_report/models/account_age_report_configuration.py:0 +#, python-format +msgid "Must complete Configuration Lines" +msgstr "" + #. module: account_financial_report #: code:addons/account_financial_report/report/journal_ledger_xlsx.py:0 #: code:addons/account_financial_report/report/vat_report_xlsx.py:0 +#: model:ir.model.fields,field_description:account_financial_report.field_account_age_report_configuration__name +#: model:ir.model.fields,field_description:account_financial_report.field_account_age_report_configuration_line__name #: model_terms:ir.ui.view,arch_db:account_financial_report.report_journal_all_taxes #: model_terms:ir.ui.view,arch_db:account_financial_report.report_journal_ledger_journal_taxes #: model_terms:ir.ui.view,arch_db:account_financial_report.report_vat_report_base @@ -1140,6 +1228,11 @@ msgstr "" msgid "Not due" msgstr "" +#. module: account_financial_report +#: model_terms:ir.ui.view,arch_db:account_financial_report.res_config_settings_view_form +msgid "OCA Aged Report Configuration" +msgstr "" + #. module: account_financial_report #: model:ir.ui.menu,name:account_financial_report.menu_oca_reports msgid "OCA accounting reports" @@ -1445,6 +1538,11 @@ msgstr "" msgid "Starting account in a range" msgstr "" +#. module: account_financial_report +#: model:ir.model.fields,field_description:account_financial_report.field_account_age_report_configuration_line__inferior_limir +msgid "Inferior Limit" +msgstr "" + #. module: account_financial_report #: code:addons/account_financial_report/report/general_ledger_xlsx.py:0 #: model_terms:ir.ui.view,arch_db:account_financial_report.report_general_ledger_lines diff --git a/account_financial_report/i18n/es.po b/account_financial_report/i18n/es.po index 8bcc8a1c69d9..090c6794f18d 100644 --- a/account_financial_report/i18n/es.po +++ b/account_financial_report/i18n/es.po @@ -53,6 +53,11 @@ msgstr "91 - 120 d." msgid "Taxes summary" msgstr "Resumen de Impuestos" +#. module: account_financial_report +#: model_terms:ir.ui.view,arch_db:account_financial_report.res_config_settings_view_form +msgid "Intervals configuration" +msgstr "Configuración de intervalos" + #. module: account_financial_report #: model_terms:ir.ui.view,arch_db:account_financial_report.aged_partner_balance_wizard #: model_terms:ir.ui.view,arch_db:account_financial_report.general_ledger_wizard @@ -92,6 +97,11 @@ msgstr "Extracto XLSX Account Financial Report" msgid "Account" msgstr "Cuenta" +#. module: account_financial_report +#: model:ir.model.fields,field_description:account_financial_report.field_account_age_report_configuration_line__account_age_report_config_id +msgid "Account Age Report Config" +msgstr "Configuración del informe de calidad de deuda" + #. module: account_financial_report #: model:ir.model.fields,field_description:account_financial_report.field_aged_partner_balance_report_wizard__account_code_from #: model:ir.model.fields,field_description:account_financial_report.field_general_ledger_report_wizard__account_code_from @@ -150,14 +160,17 @@ msgstr "Activar centralización" msgid "Additional Filtering" msgstr "Filtrado adicional" +#. module: account_financial_report +#: model:ir.actions.act_window,name:account_financial_report.action_aged_partner_report_configuration +msgid "Age Partner Report Configuration" +msgstr "Configuración Calidad de deuda" + #. module: account_financial_report #: model_terms:ir.ui.view,arch_db:account_financial_report.report_aged_partner_balance_move_lines msgid "" "Age ≤ 120\n" -" d." +" d." msgstr "" -"Tiempo ≤ 120\n" -" d." #. module: account_financial_report #: code:addons/account_financial_report/report/aged_partner_balance_xlsx.py:0 @@ -398,8 +411,21 @@ msgstr "Grupos Hijos" msgid "Code" msgstr "Código" +#. module: account_financial_report +#: code:addons/account_financial_report/models/account_age_report_configuration.py:0 +#: model:ir.model.constraint,message:account_financial_report.constraint_account_age_report_configuration_line_unique_name_config_combination +#, python-format +msgid "Name must be unique per report configuration" +msgstr "El nombre debe ser único por cada configuración del informe" + +#. module: account_financial_report +#: model:ir.model,name:account_financial_report.model_res_company +msgid "Companies" +msgstr "Compañías" + #. module: account_financial_report #: code:addons/account_financial_report/report/journal_ledger_xlsx.py:0 +#: model:ir.model.fields,field_description:account_financial_report.field_account_age_report_configuration__company_id #: model:ir.model.fields,field_description:account_financial_report.field_account_financial_report_abstract_wizard__company_id #: model:ir.model.fields,field_description:account_financial_report.field_aged_partner_balance_report_wizard__company_id #: model:ir.model.fields,field_description:account_financial_report.field_general_ledger_report_wizard__company_id @@ -417,6 +443,18 @@ msgid "Compute accounts" msgstr "Cuentas calculadas" #. module: account_financial_report +#: model:ir.model,name:account_financial_report.model_res_config_settings +msgid "Config Settings" +msgstr "Opciones de configuración" + +#. module: account_financial_report +#: model_terms:ir.ui.view,arch_db:account_financial_report.res_config_settings_view_form +msgid "Configurations" +msgstr "Configuraciones" + +#. module: account_financial_report +#: model:ir.model.fields,field_description:account_financial_report.field_account_age_report_configuration__create_uid +#: model:ir.model.fields,field_description:account_financial_report.field_account_age_report_configuration_line__create_uid #: model:ir.model.fields,field_description:account_financial_report.field_aged_partner_balance_report_wizard__create_uid #: model:ir.model.fields,field_description:account_financial_report.field_general_ledger_report_wizard__create_uid #: model:ir.model.fields,field_description:account_financial_report.field_journal_ledger_report_wizard__create_uid @@ -427,6 +465,8 @@ msgid "Created by" msgstr "Creado por" #. module: account_financial_report +#: model:ir.model.fields,field_description:account_financial_report.field_account_age_report_configuration__create_date +#: model:ir.model.fields,field_description:account_financial_report.field_account_age_report_configuration_line__create_date #: model:ir.model.fields,field_description:account_financial_report.field_aged_partner_balance_report_wizard__create_date #: model:ir.model.fields,field_description:account_financial_report.field_general_ledger_report_wizard__create_date #: model:ir.model.fields,field_description:account_financial_report.field_journal_ledger_report_wizard__create_date @@ -600,6 +640,8 @@ msgid "Detail Taxes" msgstr "Detalle de impuestos" #. module: account_financial_report +#: model:ir.model.fields,field_description:account_financial_report.field_account_age_report_configuration__display_name +#: model:ir.model.fields,field_description:account_financial_report.field_account_age_report_configuration_line__display_name #: model:ir.model.fields,field_description:account_financial_report.field_aged_partner_balance_report_wizard__display_name #: model:ir.model.fields,field_description:account_financial_report.field_general_ledger_report_wizard__display_name #: model:ir.model.fields,field_description:account_financial_report.field_journal_ledger_report_wizard__display_name @@ -614,13 +656,11 @@ msgstr "Nombre mostrado" #: model:ir.model.fields,help:account_financial_report.field_open_items_report_wizard__foreign_currency #: model:ir.model.fields,help:account_financial_report.field_trial_balance_report_wizard__foreign_currency msgid "" -"Display foreign currency for move lines, unless account currency is not " -"setup through chart of accounts will display initial and final balance in " -"that currency." +"Display foreign currency for move lines, unless account currency is not setup through chart of accounts " +"will display initial and final balance in that currency." msgstr "" -"Mostrar moneda extranjera para líneas de movimiento contable, a menos que la " -"moneda de la cuenta no esté configurada a través del plan de cuentas " -"mostrará el saldo inicial y final en esa moneda." +"Mostrar moneda extranjera para líneas de movimiento contable, a menos que la moneda de la cuenta no esté " +"configurada a través del plan de cuentas mostrará el saldo inicial y final en esa moneda." #. module: account_financial_report #: model:ir.model.fields,field_description:account_financial_report.field_trial_balance_report_wizard__hide_parent_hierarchy_level @@ -875,8 +915,7 @@ msgid "" " only one unaffected earnings account." msgstr "" "El Libro mayor solo se puede calcular si la empresa seleccionada tiene \n" -" solo una " -"cuenta de resultados no afectados." +" solo una cuenta de resultados no afectados." #. module: account_financial_report #: model:ir.model.fields,field_description:account_financial_report.field_journal_ledger_report_wizard__group_option @@ -888,6 +927,13 @@ msgstr "Agrupar por" msgid "Grouped By" msgstr "Agrupado por" +#. module: account_financial_report +#: model:ir.model.fields,help:account_financial_report.field_res_company__age_partner_config_id +#: model:ir.model.fields,help:account_financial_report.field_res_config_settings__default_age_partner_config_id +#: model_terms:ir.ui.view,arch_db:account_financial_report.res_config_settings_view_form +msgid "Here you can set the intervals that will appear on the Aged Partner Balance." +msgstr "Aquí puede configurar los intervalos que aparecerán en el informe de Calidad de la deuda." + #. module: account_financial_report #: code:addons/account_financial_report/report/general_ledger_xlsx.py:0 #: code:addons/account_financial_report/report/open_items_xlsx.py:0 @@ -916,6 +962,8 @@ msgid "Hierarchy Levels to display" msgstr "Niveles de Jerarquía a mostrar" #. module: account_financial_report +#: model:ir.model.fields,field_description:account_financial_report.field_account_age_report_configuration__id +#: model:ir.model.fields,field_description:account_financial_report.field_account_age_report_configuration_line__id #: model:ir.model.fields,field_description:account_financial_report.field_aged_partner_balance_report_wizard__id #: model:ir.model.fields,field_description:account_financial_report.field_general_ledger_report_wizard__id #: model:ir.model.fields,field_description:account_financial_report.field_journal_ledger_report_wizard__id @@ -923,16 +971,16 @@ msgstr "Niveles de Jerarquía a mostrar" #: model:ir.model.fields,field_description:account_financial_report.field_trial_balance_report_wizard__id #: model:ir.model.fields,field_description:account_financial_report.field_vat_report_wizard__id msgid "ID" -msgstr "ID" +msgstr "" #. module: account_financial_report #: model:ir.model.fields,help:account_financial_report.field_account_account__centralized msgid "" -"If flagged, no details will be displayed in the General Ledger report (the " -"webkit one only), only centralized amounts per period." +"If flagged, no details will be displayed in the General Ledger report (the webkit one only), only " +"centralized amounts per period." msgstr "" -"Si se marca, no se mostrarán detalles en el informe del libro mayor (solo el " -"webkit), solo importes centralizados por período." +"Si se marca, no se mostrarán detalles en el informe del libro mayor (solo el webkit), solo importes " +"centralizados por período." #. module: account_financial_report #: model_terms:ir.ui.view,arch_db:account_financial_report.report_trial_balance_lines_header @@ -960,6 +1008,13 @@ msgstr "" msgid "Initial balance" msgstr "Saldo inicial" +#. module: account_financial_report +#: model:ir.model.fields,field_description:account_financial_report.field_aged_partner_balance_report_wizard__age_partner_config_id +#: model:ir.model.fields,field_description:account_financial_report.field_res_company__age_partner_config_id +#: model:ir.model.fields,field_description:account_financial_report.field_res_config_settings__default_age_partner_config_id +msgid "Intervals configuration" +msgstr "Configuración de intervalos" + #. module: account_financial_report #: code:addons/account_financial_report/report/aged_partner_balance_xlsx.py:0 #: code:addons/account_financial_report/report/general_ledger_xlsx.py:0 @@ -1026,6 +1081,8 @@ msgid "Journals" msgstr "Diarios" #. module: account_financial_report +#: model:ir.model.fields,field_description:account_financial_report.field_account_age_report_configuration____last_update +#: model:ir.model.fields,field_description:account_financial_report.field_account_age_report_configuration_line____last_update #: model:ir.model.fields,field_description:account_financial_report.field_aged_partner_balance_report_wizard____last_update #: model:ir.model.fields,field_description:account_financial_report.field_general_ledger_report_wizard____last_update #: model:ir.model.fields,field_description:account_financial_report.field_journal_ledger_report_wizard____last_update @@ -1036,6 +1093,8 @@ msgid "Last Modified on" msgstr "Última modificación en" #. module: account_financial_report +#: model:ir.model.fields,field_description:account_financial_report.field_account_age_report_configuration__write_uid +#: model:ir.model.fields,field_description:account_financial_report.field_account_age_report_configuration_line__write_uid #: model:ir.model.fields,field_description:account_financial_report.field_aged_partner_balance_report_wizard__write_uid #: model:ir.model.fields,field_description:account_financial_report.field_general_ledger_report_wizard__write_uid #: model:ir.model.fields,field_description:account_financial_report.field_journal_ledger_report_wizard__write_uid @@ -1046,6 +1105,8 @@ msgid "Last Updated by" msgstr "Última actualización por" #. module: account_financial_report +#: model:ir.model.fields,field_description:account_financial_report.field_account_age_report_configuration__write_date +#: model:ir.model.fields,field_description:account_financial_report.field_account_age_report_configuration_line__write_date #: model:ir.model.fields,field_description:account_financial_report.field_aged_partner_balance_report_wizard__write_date #: model:ir.model.fields,field_description:account_financial_report.field_general_ledger_report_wizard__write_date #: model:ir.model.fields,field_description:account_financial_report.field_journal_ledger_report_wizard__write_date @@ -1076,12 +1137,25 @@ msgid "Limit hierarchy levels" msgstr "Limitar niveles de jerarquía" #. module: account_financial_report -#: code:addons/account_financial_report/report/general_ledger.py:0 -#: code:addons/account_financial_report/report/open_items.py:0 -#: code:addons/account_financial_report/report/trial_balance.py:0 +#: model:ir.model.fields,field_description:account_financial_report.field_account_age_report_configuration__line_ids +msgid "Line" +msgstr "Línea" + +#. module: account_financial_report +#: code:addons/account_financial_report/models/account_age_report_configuration.py:0 #, python-format -msgid "Missing Partner" -msgstr "Falta el Socio" +msgid "Inferior Limit must be greather than zero" +msgstr "El límite inferior debe ser mayor que cero" + +#. module: account_financial_report +#: model:ir.model,name:account_financial_report.model_account_age_report_configuration_line +msgid "Model to set interval lines for Age partner balance report" +msgstr "Modelo para establecer líneas de intervalo para el informe de Calidad de deuda" + +#. module: account_financial_report +#: model:ir.model,name:account_financial_report.model_account_age_report_configuration +msgid "Model to set intervals for Age partner balance report" +msgstr "Modelo para establecer intervalos en el informe de Calidad de deudaFalta el Socio" #. module: account_financial_report #: model:ir.model.fields,field_description:account_financial_report.field_journal_ledger_report_wizard__move_target @@ -1093,9 +1167,17 @@ msgstr "Asiento Objetivo" msgid "Moves" msgstr "Asientos" +#. module: account_financial_report +#: code:addons/account_financial_report/models/account_age_report_configuration.py:0 +#, python-format +msgid "Must complete Configuration Lines" +msgstr "Debe completar las líneas de configuración" + #. module: account_financial_report #: code:addons/account_financial_report/report/journal_ledger_xlsx.py:0 #: code:addons/account_financial_report/report/vat_report_xlsx.py:0 +#: model:ir.model.fields,field_description:account_financial_report.field_account_age_report_configuration__name +#: model:ir.model.fields,field_description:account_financial_report.field_account_age_report_configuration_line__name #: model_terms:ir.ui.view,arch_db:account_financial_report.report_journal_all_taxes #: model_terms:ir.ui.view,arch_db:account_financial_report.report_journal_ledger_journal_taxes #: model_terms:ir.ui.view,arch_db:account_financial_report.report_vat_report_base @@ -1154,6 +1236,11 @@ msgstr "Sin Postear" msgid "Not due" msgstr "Deuda" +#. module: account_financial_report +#: model_terms:ir.ui.view,arch_db:account_financial_report.res_config_settings_view_form +msgid "OCA Aged Report Configuration" +msgstr "Configuración del informe Calidad de deuda OCA" + #. module: account_financial_report #: model:ir.ui.menu,name:account_financial_report.menu_oca_reports msgid "OCA accounting reports" @@ -1460,6 +1547,11 @@ msgstr "Fecha de inicio" msgid "Starting account in a range" msgstr "Cuenta inicial en un rango" +#. module: account_financial_report +#: model:ir.model.fields,field_description:account_financial_report.field_account_age_report_configuration_line__inferior_limit +msgid "Inferior Limit" +msgstr "Límite inferior" + #. module: account_financial_report #: code:addons/account_financial_report/report/general_ledger_xlsx.py:0 #: model_terms:ir.ui.view,arch_db:account_financial_report.report_general_ledger_lines @@ -1566,31 +1658,22 @@ msgstr "Impuestos" #. module: account_financial_report #: code:addons/account_financial_report/wizard/general_ledger_wizard.py:0 #, python-format -msgid "" -"The Company in the General Ledger Report Wizard and in Date Range must be " -"the same." +msgid "The Company in the General Ledger Report Wizard and in Date Range must be the same." msgstr "" -"La empresa en el Asistente de informe de Contabilidad General y de rango de " -"fechas debe ser la misma." +"La empresa en el Asistente de informe de Contabilidad General y de rango de fechas debe ser la misma." #. module: account_financial_report #: code:addons/account_financial_report/wizard/trial_balance_wizard.py:0 #, python-format -msgid "" -"The Company in the Trial Balance Report Wizard and in Date Range must be the " -"same." +msgid "The Company in the Trial Balance Report Wizard and in Date Range must be the same." msgstr "" -"La empresa en el Asistente de informe de Balance de comprobación y en rango " -"de fechas debe ser la misma." +"La empresa en el Asistente de informe de Balance de comprobación y en rango de fechas debe ser la misma." #. module: account_financial_report #: code:addons/account_financial_report/wizard/vat_report_wizard.py:0 #, python-format -msgid "" -"The Company in the Vat Report Wizard and in Date Range must be the same." -msgstr "" -"La empresa en el Asistente para informes de IVA y en rango de fechas debe " -"ser la misma." +msgid "The Company in the Vat Report Wizard and in Date Range must be the same." +msgstr "La empresa en el Asistente para informes de IVA y en rango de fechas debe ser la misma." #. module: account_financial_report #: code:addons/account_financial_report/wizard/trial_balance_wizard.py:0 @@ -1601,9 +1684,7 @@ msgstr "El nivel de jerarquía a filtrar debe ser mayor que 0." #. module: account_financial_report #: model:ir.model.fields,help:account_financial_report.field_general_ledger_report_wizard__domain msgid "This domain will be used to select specific domain for Journal Items" -msgstr "" -"Este dominio se usará para seleccionar dominios específicos para Apuntes " -"Contables" +msgstr "Este dominio se usará para seleccionar dominios específicos para Apuntes Contables" #. module: account_financial_report #: model_terms:ir.ui.view,arch_db:account_financial_report.report_trial_balance_filters @@ -1618,7 +1699,7 @@ msgstr "A:" #. module: account_financial_report #: model_terms:ir.ui.view,arch_db:account_financial_report.report_aged_partner_balance_account_ending_cumul msgid "Total" -msgstr "Total" +msgstr "" #. module: account_financial_report #: code:addons/account_financial_report/report/trial_balance_xlsx.py:0 @@ -1661,10 +1742,8 @@ msgid "" "Trial Balance can be computed only if selected company have only\n" " one unaffected earnings account." msgstr "" -"El balance de sumas y saldos solo puede calcularse si la compañía " -"seleccionada tiene una y solo \n" -" una cuenta de " -"ganancias." +"El balance de sumas y saldos solo puede calcularse si la compañía seleccionada tiene una y solo \n" +" una cuenta de ganancias." #. module: account_financial_report #: model:ir.model.fields,field_description:account_financial_report.field_general_ledger_report_wizard__unaffected_earnings_account @@ -1676,10 +1755,11 @@ msgstr "Cuenta de Ganancias No Afectadas" #: model:ir.model.fields,help:account_financial_report.field_general_ledger_report_wizard__hide_account_at_0 #: model:ir.model.fields,help:account_financial_report.field_open_items_report_wizard__hide_account_at_0 msgid "" -"Use this filter to hide an account or a partner with an ending balance at 0. " -"If partners are filtered, debits and credits totals will not match the trial " -"balance." -msgstr "Use este filtro para ocultar las cuentas sin actividad." +"Use this filter to hide an account or a partner with an ending balance at 0. If partners are filtered, " +"debits and credits totals will not match the trial balance." +msgstr "" +"Use este filtro para ocultar las cuentas o empresas con saldo final 0. Si las empresas se filtran, los " +"debe y haber totales no coincidirán con el balance de sumas y saldos." #. module: account_financial_report #: model:ir.model.fields,help:account_financial_report.field_trial_balance_report_wizard__show_hierarchy @@ -1743,11 +1823,11 @@ msgstr "Ver" #. module: account_financial_report #: model:ir.model.fields,help:account_financial_report.field_trial_balance_report_wizard__hide_account_at_0 msgid "" -"When this option is enabled, the trial balance will not display accounts " -"that have initial balance = debit = credit = end balance = 0" +"When this option is enabled, the trial balance will not display accounts that have initial balance = debit " +"= credit = end balance = 0" msgstr "" -"Cuando habilite esta opción el balance de sumas y saldos no va a mostrar " -"cuentas que tengan saldo inicial = débito = crédito = saldo final = 0" +"Cuando habilite esta opción el balance de sumas y saldos no va a mostrar cuentas que tengan saldo inicial " +"= débito = crédito = saldo final = 0" #. module: account_financial_report #: model:ir.model.fields,field_description:account_financial_report.field_journal_ledger_report_wizard__with_account_name @@ -1818,35 +1898,3 @@ msgstr "ancho: 38.92%;" #: model_terms:ir.ui.view,arch_db:account_financial_report.report_journal_ledger_journal_table_header msgid "width: 8.11%;" msgstr "ancho: 8.11%;" - -#~ msgid "Child Accounts" -#~ msgstr "Cuentas Hijas" - -#~ msgid "Computed Accounts" -#~ msgstr "Cuentas Calculadas" - -#~ msgid "" -#~ "Computed Accounts: Use when the account group have codes\n" -#~ " that represent prefixes of the actual accounts.\n" -#~ "\n" -#~ " Child Accounts: Use when your account groups are hierarchical.\n" -#~ "\n" -#~ " No hierarchy: Use to display just the accounts, without any " -#~ "grouping.\n" -#~ " " -#~ msgstr "" -#~ "Cuentas Calculadas: Usar cuando el grupo de cuentas tiene códigos \n" -#~ " que representan prefijos de las cuentas reales.\n" -#~ "\n" -#~ " Cuentas Hijas: Usar cuando los grupos de cuentas son " -#~ "jerárquicos.\n" -#~ "\n" -#~ " Sin jerarquía: Usar para mostrar sólo las cuentas, sin ninguna " -#~ "agrupación.\n" -#~ " " - -#~ msgid "Hierarchy On" -#~ msgstr "Jerarquía en" - -#~ msgid "No hierarchy" -#~ msgstr "Sin jerarquía" diff --git a/account_financial_report/models/__init__.py b/account_financial_report/models/__init__.py index af829b36a4e4..154d80e38603 100644 --- a/account_financial_report/models/__init__.py +++ b/account_financial_report/models/__init__.py @@ -3,3 +3,4 @@ from . import account from . import account_move_line from . import ir_actions_report +from . import res_config_settings diff --git a/account_financial_report/models/account_age_report_configuration.py b/account_financial_report/models/account_age_report_configuration.py index 235c01283fb8..9d69d5a1abba 100644 --- a/account_financial_report/models/account_age_report_configuration.py +++ b/account_financial_report/models/account_age_report_configuration.py @@ -1,24 +1,47 @@ # Copyright 2023 Ernesto García +# Copyright 2023 Carolina Fernandez # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -from odoo import fields, models +from odoo import _, api, fields, models +from odoo.exceptions import ValidationError class AccountAgeReportConfiguration(models.Model): _name = "account.age.report.configuration" _description = "Model to set intervals for Age partner balance report" - name = fields.Char() - company_id = fields.Many2one("res.company", default=lambda self: self.env.company) + name = fields.Char(required=True) + company_id = fields.Many2one( + "res.company", default=lambda self: self.env.company, readonly=True + ) line_ids = fields.One2many( "account.age.report.configuration.line", "account_age_report_config_id" ) + @api.constrains("line_ids") + def _check_line_ids(self): + for rec in self: + if not rec.line_ids: + raise ValidationError(_("Must complete Configuration Lines")) + class AccountAgeReportConfigurationLine(models.Model): _name = "account.age.report.configuration.line" + _description = "Model to set interval lines for Age partner balance report" - name = fields.Char() - code = fields.Char() + name = fields.Char(required=True) account_age_report_config_id = fields.Many2one("account.age.report.configuration") - lower_limit = fields.Integer() - superior_limit = fields.Integer() + inferior_limit = fields.Integer() + + @api.constrains("inferior_limit") + def _check_inferior_limit(self): + for rec in self: + if rec.inferior_limit <= 0: + raise ValidationError(_("Inferior Limit must be greather than zero")) + + _sql_constraints = [ + ( + "unique_name_config_combination", + "UNIQUE(name,account_age_report_config_id)", + _("Name must be unique per report configuration"), + ) + ] diff --git a/account_financial_report/models/res_config_settings.py b/account_financial_report/models/res_config_settings.py new file mode 100644 index 000000000000..56826b0e927e --- /dev/null +++ b/account_financial_report/models/res_config_settings.py @@ -0,0 +1,14 @@ +# Copyright 2023 Tecnativa - Carolina Fernandez +# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). + +from odoo import fields, models + + +class ResConfigSettings(models.TransientModel): + _inherit = "res.config.settings" + + default_age_partner_config_id = fields.Many2one( + "account.age.report.configuration", + string="Intervals configuration", + default_model="aged.partner.balance.report.wizard", + ) diff --git a/account_financial_report/readme/CONFIGURE.rst b/account_financial_report/readme/CONFIGURE.rst new file mode 100644 index 000000000000..ca27ac3c0ade --- /dev/null +++ b/account_financial_report/readme/CONFIGURE.rst @@ -0,0 +1,26 @@ +To configure dynamic intervals for Aged Partner Balance you need to: + +Go on 'Settings' -> 'Invoicing' -> 'OCA Aged Report Configuration'. + +Click on option 'Configurations' and create new record. + +Create new interval. +The name established on line will be the column to display in Aged Partner Balance. +Superior limit established on line is the interval + +Example of configuration superior limit: + +-> 15 +-> 30 +-> 60 + +It means the first interval is from 0 to 15, the second from 16 to 30, and the third is 61+. + +Go on 'Invoicing' -> 'Reports' -> 'OCA accounting reports' -> 'Aged Partner Balance' + +When wizard is open, you need to select your interval configuration and print report. + +If you want to get default interval configuration any time you wish to print Aged Partner Report, +you can set default interval configuration per company in: + +'Settings' -> 'Invoicing' -> 'OCA Aged Report Configuration'. diff --git a/account_financial_report/readme/CONTRIBUTORS.rst b/account_financial_report/readme/CONTRIBUTORS.rst index f0bb7b8bcf3e..f8373c582104 100644 --- a/account_financial_report/readme/CONTRIBUTORS.rst +++ b/account_financial_report/readme/CONTRIBUTORS.rst @@ -24,6 +24,7 @@ * João Marques * Alexandre D. Díaz * Víctor Martínez + * Carolina Fernandez * `Sygel `__: diff --git a/account_financial_report/readme/DESCRIPTION.rst b/account_financial_report/readme/DESCRIPTION.rst index f638de8b901b..353fa34e2af7 100644 --- a/account_financial_report/readme/DESCRIPTION.rst +++ b/account_financial_report/readme/DESCRIPTION.rst @@ -14,3 +14,7 @@ currency used in account move lines is properly shown. In case that in an account has not been configured a second currency foreign currency balances are not available. + +Invoicing / Settings / Invoicing / OCA Aged Report Configuration you will be able to set +dynamic intervals that will appear on the Aged Partner Balance. +For further information, check CONFIGURE.rst diff --git a/account_financial_report/report/aged_partner_balance.py b/account_financial_report/report/aged_partner_balance.py index 173dfc9e4c89..eb07eaa427b7 100644 --- a/account_financial_report/report/aged_partner_balance.py +++ b/account_financial_report/report/aged_partner_balance.py @@ -26,7 +26,7 @@ def _initialize_account(self, ag_pb_data, acc_id): ag_pb_data[acc_id]["120_days"] = 0.0 ag_pb_data[acc_id]["older"] = 0.0 for interval_line in self.env.context["age_partner_config"].line_ids: - ag_pb_data[acc_id][interval_line.code] = 0.0 + ag_pb_data[acc_id][interval_line] = 0.0 return ag_pb_data @api.model @@ -42,7 +42,7 @@ def _initialize_partner(self, ag_pb_data, acc_id, prt_id): ag_pb_data[acc_id][prt_id]["older"] = 0.0 ag_pb_data[acc_id][prt_id]["move_lines"] = [] for interval_line in self.env.context["age_partner_config"].line_ids: - ag_pb_data[acc_id][prt_id][interval_line.code] = 0.0 + ag_pb_data[acc_id][prt_id][interval_line] = 0.0 return ag_pb_data @api.model @@ -71,15 +71,22 @@ def _calculate_amounts( else: ag_pb_data[acc_id]["older"] += residual ag_pb_data[acc_id][prt_id]["older"] += residual - for line in interval_lines.sorted("superior_limit"): - if today >= due_date + timedelta( - days=line.lower_limit - ) and today <= due_date + timedelta(days=line.superior_limit): - ag_pb_data[acc_id][line.code] += residual - ag_pb_data[acc_id][prt_id][line.code] += residual - else: - ag_pb_data[acc_id][line.code] += 0 - ag_pb_data[acc_id][prt_id][line.code] += 0 + for index, line in enumerate(interval_lines): + next_line = ( + interval_lines[index + 1] if index + 1 < len(interval_lines) else None + ) + lower_limit = 0 if not index else line.inferior_limit + if ( + next_line + and today >= due_date + timedelta(days=lower_limit) + and today <= due_date + timedelta(days=next_line.inferior_limit) + ): + ag_pb_data[acc_id][line] += residual + ag_pb_data[acc_id][prt_id][line] += residual + if not next_line: + if today >= due_date + timedelta(days=line.inferior_limit): + ag_pb_data[acc_id][line] += residual + ag_pb_data[acc_id][prt_id][line] += residual return ag_pb_data def _get_account_partial_reconciled(self, company_id, date_at_object): @@ -251,7 +258,7 @@ def _compute_maturity_date(self, ml, date_at_object): ) interval_lines = self.env.context["age_partner_config"].line_ids for interval_line in interval_lines: - ml[interval_line.code] = 0.0 + ml[interval_line] = 0.0 due_date = ml["due_date"] amount = ml["residual"] today = date_at_object @@ -267,12 +274,23 @@ def _compute_maturity_date(self, ml, date_at_object): ml["120_days"] += amount else: ml["older"] += amount - match_interval = interval_lines.filtered( - lambda line: today >= due_date + timedelta(days=line.lower_limit) - and today <= due_date + timedelta(days=line.superior_limit) - ) - if match_interval: - ml[match_interval.code] += amount + + for index, interval_line in enumerate(interval_lines): + next_line = ( + interval_lines[index + 1] if index + 1 < len(interval_lines) else None + ) + lower_limit = 0 if not index else interval_lines[index].inferior_limit + if ( + next_line + and today >= due_date + timedelta(days=lower_limit) + and today <= due_date + timedelta(days=next_line.inferior_limit) + ): + ml[interval_line] += amount + break + if not next_line: + if today >= due_date + timedelta(days=interval_line.inferior_limit): + ml[interval_line] += amount + break def _create_account_list( self, @@ -300,7 +318,7 @@ def _create_account_list( } ) for interval_line in interval_lines: - account[interval_line.code] = ag_pb_data[acc_id][interval_line.code] + account[interval_line] = ag_pb_data[acc_id][interval_line] for prt_id in ag_pb_data[acc_id]: if isinstance(prt_id, int): partner = { @@ -314,8 +332,8 @@ def _create_account_list( "older": ag_pb_data[acc_id][prt_id]["older"], } for interval_line in interval_lines: - partner[interval_line.code] = ag_pb_data[acc_id][prt_id][ - interval_line.code + partner[interval_line] = ag_pb_data[acc_id][prt_id][ + interval_line ] if show_move_line_details: move_lines = [] @@ -363,8 +381,8 @@ def _calculate_percent(self, aged_partner_data): } ) for interval_line in interval_lines: - account[f"percent_{interval_line.code}"] = abs( - round((account[interval_line.code] / total) * 100, 2) + account[f"percent_{interval_line.id}"] = abs( + round((account[interval_line] / total) * 100, 2) ) else: account.update( @@ -378,7 +396,7 @@ def _calculate_percent(self, aged_partner_data): } ) for interval_line in interval_lines: - account[f"percent_{interval_line.code}"] = 0.0 + account[f"percent_{interval_line.id}"] = 0.0 return aged_partner_data def _get_report_values(self, docids, data): diff --git a/account_financial_report/report/aged_partner_balance_xlsx.py b/account_financial_report/report/aged_partner_balance_xlsx.py index c282f13e6be7..3e672aacadf4 100644 --- a/account_financial_report/report/aged_partner_balance_xlsx.py +++ b/account_financial_report/report/aged_partner_balance_xlsx.py @@ -1,6 +1,7 @@ # Author: Julien Coux # Copyright 2016 Camptocamp SA # Copyright 2021 Tecnativa - João Marques +# Copyright 2023 Tecnativa - Carolina Fernandez # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from odoo import _, models @@ -20,86 +21,83 @@ def _get_report_name(self, report, data=False): report_name = report_name + suffix return report_name - def _get_report_columns(self, report): - column_index = 2 if not report.show_move_line_details else 8 - report_columns = {} - if not report.show_move_line_details: - report_columns = { - 0: {"header": _("Partner"), "field": "name", "width": 70}, - 1: { - "header": _("Residual"), - "field": "residual", - "field_footer_total": "residual", - "type": "amount", - "width": 14, - }, - } - if report.age_partner_config_id: - for interval in report.age_partner_config_id.line_ids: - report_columns[column_index] = { - "header": interval.name, - "field": interval.code, - "field_footer_total": interval.code, - "field_footer_percent": f"percent_{interval.code}", + def _get_report_columns_without_move_line_details(self, report, column_index): + report_columns = { + 0: {"header": _("Partner"), "field": "name", "width": 70}, + 1: { + "header": _("Residual"), + "field": "residual", + "field_footer_total": "residual", + "type": "amount", + "width": 14, + }, + 2: { + "header": _("Current"), + "field": "current", + "field_footer_total": "current", + "field_footer_percent": "percent_current", + "type": "amount", + "width": 14, + }, + } + if not report.age_partner_config_id: + report_columns.update( + { + 3: { + "header": _("Age ≤ 30 d."), + "field": "30_days", + "field_footer_total": "30_days", + "field_footer_percent": "percent_30_days", "type": "amount", "width": 14, - } - column_index += 1 - else: - report_columns.update( - { - 2: { - "header": _("Current"), - "field": "current", - "field_footer_total": "current", - "field_footer_percent": "percent_current", - "type": "amount", - "width": 14, - }, - 3: { - "header": _("Age ≤ 30 d."), - "field": "30_days", - "field_footer_total": "30_days", - "field_footer_percent": "percent_30_days", - "type": "amount", - "width": 14, - }, - 4: { - "header": _("Age ≤ 60 d."), - "field": "60_days", - "field_footer_total": "60_days", - "field_footer_percent": "percent_60_days", - "type": "amount", - "width": 14, - }, - 5: { - "header": _("Age ≤ 90 d."), - "field": "90_days", - "field_footer_total": "90_days", - "field_footer_percent": "percent_90_days", - "type": "amount", - "width": 14, - }, - 6: { - "header": _("Age ≤ 120 d."), - "field": "120_days", - "field_footer_total": "120_days", - "field_footer_percent": "percent_120_days", - "type": "amount", - "width": 14, - }, - 7: { - "header": _("Older"), - "field": "older", - "field_footer_total": "older", - "field_footer_percent": "percent_older", - "type": "amount", - "width": 14, - }, - } - ) - return report_columns + }, + 4: { + "header": _("Age ≤ 60 d."), + "field": "60_days", + "field_footer_total": "60_days", + "field_footer_percent": "percent_60_days", + "type": "amount", + "width": 14, + }, + 5: { + "header": _("Age ≤ 90 d."), + "field": "90_days", + "field_footer_total": "90_days", + "field_footer_percent": "percent_90_days", + "type": "amount", + "width": 14, + }, + 6: { + "header": _("Age ≤ 120 d."), + "field": "120_days", + "field_footer_total": "120_days", + "field_footer_percent": "percent_120_days", + "type": "amount", + "width": 14, + }, + 7: { + "header": _("Older"), + "field": "older", + "field_footer_total": "older", + "field_footer_percent": "percent_older", + "type": "amount", + "width": 14, + }, + } + ) + for interval in report.age_partner_config_id.line_ids: + report_columns[column_index] = { + "header": interval.name, + "field": interval, + "field_footer_total": interval.id, + "field_footer_percent": f"percent_{interval.id}", + "type": "amount", + "width": 14, + } + column_index += 1 + return report_columns + def _get_report_columns_with_move_line_details(self, report, column_index): report_columns = { 0: {"header": _("Date"), "field": "date", "width": 11}, 1: {"header": _("Entry"), "field": "entry", "width": 18}, @@ -116,30 +114,19 @@ def _get_report_columns(self, report): "type": "amount", "width": 14, }, + 8: { + "header": _("Current"), + "field": "current", + "field_footer_total": "current", + "field_footer_percent": "percent_current", + "field_final_balance": "current", + "type": "amount", + "width": 14, + }, } - if report.age_partner_config_id: - for interval in report.age_partner_config_id.line_ids: - report_columns[column_index] = { - "header": interval.name, - "field": interval.code, - "field_footer_total": interval.code, - "field_footer_percent": f"percent_{interval.code}", - "type": "amount", - "width": 14, - } - column_index += 1 - else: + if not report.age_partner_config_id: report_columns.update( { - 8: { - "header": _("Current"), - "field": "current", - "field_footer_total": "current", - "field_footer_percent": "percent_current", - "field_final_balance": "current", - "type": "amount", - "width": 14, - }, 9: { "header": _("Age ≤ 30 d."), "field": "30_days", @@ -187,8 +174,25 @@ def _get_report_columns(self, report): }, } ) + for interval in report.age_partner_config_id.line_ids: + report_columns[column_index] = { + "header": interval.name, + "field": interval, + "field_footer_total": interval.id, + "field_footer_percent": f"percent_{interval.id}", + "type": "amount", + "width": 14, + } + column_index += 1 return report_columns + def _get_report_columns(self, report): + if not report.show_move_line_details: + return self._get_report_columns_without_move_line_details( + report, column_index=3 + ) + return self._get_report_columns_with_move_line_details(report, column_index=8) + def _get_report_filters(self, report): return [ [_("Date at filter"), report.date_at.strftime("%d/%m/%Y")], diff --git a/account_financial_report/report/templates/aged_partner_balance.xml b/account_financial_report/report/templates/aged_partner_balance.xml index 6ddff6cf9ca6..5eb70c78932f 100644 --- a/account_financial_report/report/templates/aged_partner_balance.xml +++ b/account_financial_report/report/templates/aged_partner_balance.xml @@ -108,7 +108,7 @@ - + diff --git a/account_financial_report/security/ir.model.access.csv b/account_financial_report/security/ir.model.access.csv index 4d39bb20ca12..eed1828565bb 100644 --- a/account_financial_report/security/ir.model.access.csv +++ b/account_financial_report/security/ir.model.access.csv @@ -5,5 +5,5 @@ access_journal_ledger_report_wizard,access_journal_ledger_report_wizard,model_jo access_open_items_report_wizard,access_open_items_report_wizard,model_open_items_report_wizard,base.group_user,1,1,1,1 access_trial_balance_report_wizard,access_trial_balance_report_wizard,model_trial_balance_report_wizard,base.group_user,1,1,1,1 access_vat_report_wizard,access_vat_report_wizard,model_vat_report_wizard,base.group_user,1,1,1,1 -access_account_age_report_configuration,access_account_age_report_configuration,model_account_age_report_configuration,base.group_user,1,1,1,0 -access_account_age_report_configuration_line,access_account_age_report_configuration_line,model_account_age_report_configuration_line,base.group_user,1,1,1,0 +access_account_age_report_configuration,access_account_age_report_configuration,model_account_age_report_configuration,base.group_user,1,1,1,1 +access_account_age_report_configuration_line,access_account_age_report_configuration_line,model_account_age_report_configuration_line,base.group_user,1,1,1,1 diff --git a/account_financial_report/static/description/index.html b/account_financial_report/static/description/index.html index 2a34dca715e7..991bf126f8de 100644 --- a/account_financial_report/static/description/index.html +++ b/account_financial_report/static/description/index.html @@ -1,3 +1,4 @@ + @@ -366,7 +367,7 @@

Account Financial Reports

!! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!! source digest: sha256:63c22ffc36a866253069bb79e215fde2ac28e02e6aff126107095dfdf6e50206 +!! source digest: sha256:c2a836a62811dc8ebd92aba44122bb5e2ec69ccb6d39c53568bcaf35ce3da550 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->

Beta License: AGPL-3 OCA/account-financial-reporting Translate me on Weblate Try me on Runboat

This module adds a set of financial reports. They are accessible under @@ -384,27 +385,50 @@

Account Financial Reports

currency used in account move lines is properly shown.

In case that in an account has not been configured a second currency foreign currency balances are not available.

+

Invoicing / Settings / Invoicing / OCA Aged Report Configuration you will be able to set +dynamic intervals that will appear on the Aged Partner Balance. +For further information, check CONFIGURE.rst

Table of contents

+
+

Configuration

+

To configure dynamic intervals for Aged Partner Balance you need to:

+

Go on ‘Settings’ -> ‘Invoicing’ -> ‘OCA Aged Report Configuration’.

+

Click on option ‘Configurations’ and create new record.

+

Create new interval. +The name established on line will be the column to display in Aged Partner Balance. +Superior limit established on line is the interval

+

Example of configuration superior limit:

+

-> 15 +-> 30 +-> 60

+

It means the first interval is from 0 to 15, the second from 16 to 30, and the third is 61+.

+

Go on ‘Invoicing’ -> ‘Reports’ -> ‘OCA accounting reports’ -> ‘Aged Partner Balance’

+

When wizard is open, you need to select your interval configuration and print report.

+

If you want to get default interval configuration any time you wish to print Aged Partner Report, +you can set default interval configuration per company in:

+

‘Settings’ -> ‘Invoicing’ -> ‘OCA Aged Report Configuration’.

+
-

Known issues / Roadmap

+

Known issues / Roadmap

  • ‘VAT Report’ is valid only for cases where it’s met that for each Tax defined: all the “Account tags” of all the @@ -416,15 +440,15 @@

    Known issues / Roadmap

-

Changelog

+

Changelog

-

11.0.2.5.0 (2019-04-26)

+

11.0.2.5.0 (2019-04-26)

  • In the Trial Balance you have an option to hide parent hierarchy levels
-

11.0.2.4.1 (2019-01-08)

+

11.0.2.4.1 (2019-01-08)

  • Handle better multicompany behaviour
  • Improve how title appears in the reports
  • @@ -432,7 +456,7 @@

    11.0.2.4.1 (2019-01-08)

-

11.0.2.3.1 (2018-11-29)

+

11.0.2.3.1 (2018-11-29)

  • In the Trial Balance you can apply a filter by hierarchy levels
  • In the General Ledger you can apply a filter by Analytic Tag
  • @@ -441,7 +465,7 @@

    11.0.2.3.1 (2018-11-29)

-

Bug Tracker

+

Bug Tracker

Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed @@ -449,9 +473,9 @@

Bug Tracker

Do not contact contributors directly about support or help with technical issues.

-

Credits

+

Credits

-

Authors

+

Authors

  • Camptocamp SA
  • initOS GmbH
  • @@ -460,7 +484,7 @@

    Authors

-

Contributors

+

Contributors

  • Sygel:
  • -

    Maintainers

    +

    Maintainers

    This module is maintained by the OCA.

    Odoo Community Association

    OCA, or the Odoo Community Association, is a nonprofit organization whose diff --git a/account_financial_report/tests/__init__.py b/account_financial_report/tests/__init__.py index 90ec389b6249..ad6fd1ef7e80 100644 --- a/account_financial_report/tests/__init__.py +++ b/account_financial_report/tests/__init__.py @@ -7,3 +7,4 @@ from . import test_open_items from . import test_trial_balance from . import test_vat_report +from . import test_age_report_configuration diff --git a/account_financial_report/tests/test_age_report_configuration.py b/account_financial_report/tests/test_age_report_configuration.py new file mode 100644 index 000000000000..56eb41963122 --- /dev/null +++ b/account_financial_report/tests/test_age_report_configuration.py @@ -0,0 +1,41 @@ +# Copyright 2023 Tecnativa - Carolina Fernandez +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo.exceptions import ValidationError +from odoo.tests import common + + +class TestAccountAgeReportConfiguration(common.TransactionCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.account_age_report_config = cls.env[ + "account.age.report.configuration" + ].create( + { + "name": "Intervals configuration", + "line_ids": [ + ( + 0, + 0, + { + "name": "1-30", + "inferior_limit": 30, + }, + ), + ], + } + ) + + def test_check_line_ids_constraint(self): + with self.assertRaises(ValidationError): + self.env["account.age.report.configuration"].create( + {"name": "Interval configuration", "line_ids": False} + ) + + def test_check_lower_inferior_limit_constraint(self): + with self.assertRaises(ValidationError): + self.account_age_report_config.line_ids.inferior_limit = 0 + + with self.assertRaises(ValidationError): + self.account_age_report_config.line_ids.inferior_limit = -1 diff --git a/account_financial_report/tests/test_aged_partner_balance.py b/account_financial_report/tests/test_aged_partner_balance.py index 1c5c767384c5..75b4918c6d64 100644 --- a/account_financial_report/tests/test_aged_partner_balance.py +++ b/account_financial_report/tests/test_aged_partner_balance.py @@ -1,4 +1,5 @@ # Copyright 2021 Simone Rubino - Agile Business Group +# Copyright 2023 Tecnativa - Carolina Fernandez # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from odoo.tests import TransactionCase @@ -30,15 +31,41 @@ def setUpClass(cls): "reconcile": True, } ) - - def test_report(self): - """Check that report is produced correctly.""" - wizard = self.wizard_model.create( + # Check that report is produced correctly + cls.wizard_with_line_details = cls.wizard_model.create( { "show_move_line_details": True, "receivable_accounts_only": True, } ) + cls.wizard_without_line_details = cls.wizard_model.create( + { + "show_move_line_details": False, + "receivable_accounts_only": True, + } + ) + cls.account_age_report_config = cls.env[ + "account.age.report.configuration" + ].create( + { + "name": "Intervals configuration", + "line_ids": [ + ( + 0, + 0, + { + "name": "1-30", + "inferior_limit": 30, + }, + ), + ], + } + ) + + def test_report_without_aged_report_configuration(self): + """Check that report is produced correctly.""" + wizard = self.wizard_with_line_details + wizard.onchange_type_accounts_only() data = wizard._prepare_report_aged_partner_balance() @@ -54,6 +81,22 @@ def test_report(self): ) self.assertTrue(result) + second_wizard = self.wizard_without_line_details + second_wizard.onchange_type_accounts_only() + data = second_wizard._prepare_report_aged_partner_balance() + + # Simulate web client behavior: + # default value is a datetime.date but web client sends back strings + data.update({"date_at": data["date_at"].strftime(DEFAULT_SERVER_DATE_FORMAT)}) + result = test_reports.try_report( + self.env.cr, + self.env.uid, + "account_financial_report.aged_partner_balance", + second_wizard.ids, + data=data, + ) + self.assertTrue(result) + def test_all_accounts_loaded(self): # Tests if all accounts are loaded when the account_code_ fields changed all_accounts = self.env["account.account"].search( @@ -79,3 +122,41 @@ def test_all_accounts_loaded(self): ] self.assertEqual(len(aged_partner_balance_code_set), len(all_accounts_code_set)) self.assertTrue(aged_partner_balance_code_set == all_accounts_code_set) + + def test_report_with_aged_report_configuration(self): + """Check that report is produced correctly.""" + wizard = self.wizard_with_line_details + wizard.age_partner_config_id = self.account_age_report_config.id + + wizard.onchange_type_accounts_only() + data = wizard._prepare_report_aged_partner_balance() + + # Simulate web client behavior: + # default value is a datetime.date but web client sends back strings + data.update({"date_at": data["date_at"].strftime(DEFAULT_SERVER_DATE_FORMAT)}) + result = test_reports.try_report( + self.env.cr, + self.env.uid, + "account_financial_report.aged_partner_balance", + wizard.ids, + data=data, + ) + self.assertTrue(result) + + second_wizard = self.wizard_without_line_details + second_wizard.age_partner_config_id = self.account_age_report_config.id + + second_wizard.onchange_type_accounts_only() + data = second_wizard._prepare_report_aged_partner_balance() + + # Simulate web client behavior: + # default value is a datetime.date but web client sends back strings + data.update({"date_at": data["date_at"].strftime(DEFAULT_SERVER_DATE_FORMAT)}) + result = test_reports.try_report( + self.env.cr, + self.env.uid, + "account_financial_report.aged_partner_balance", + second_wizard.ids, + data=data, + ) + self.assertTrue(result) diff --git a/account_financial_report/tests/test_general_ledger.py b/account_financial_report/tests/test_general_ledger.py index b9594d784b2b..94e627e76a35 100644 --- a/account_financial_report/tests/test_general_ledger.py +++ b/account_financial_report/tests/test_general_ledger.py @@ -54,6 +54,7 @@ def setUpClass(cls, chart_template_ref=None): "user_type_id": cls.env.ref( "account.data_account_type_other_income" ).id, + "company_id": cls.env.user.company_id.id, } ) @@ -743,7 +744,10 @@ def test_validate_date_range(self): def test_all_accounts_loaded(self): # Tests if all accounts are loaded when the account_code_ fields changed - all_accounts = self.env["account.account"].search([], order="code") + all_accounts = self.env["account.account"].search( + [], + order="code", + ) general_ledger = self.env["general.ledger.report.wizard"].create( { "date_from": self.fy_date_start, diff --git a/account_financial_report/tests/test_open_items.py b/account_financial_report/tests/test_open_items.py index 18da327d9fd1..1423c1388f01 100644 --- a/account_financial_report/tests/test_open_items.py +++ b/account_financial_report/tests/test_open_items.py @@ -53,7 +53,10 @@ def test_partner_filter(self): def test_all_accounts_loaded(self): # Tests if all accounts are loaded when the account_code_ fields changed all_accounts = self.env["account.account"].search( - [("reconcile", "=", True)], order="code" + [ + ("reconcile", "=", True), + ], + order="code", ) open_items = self.env["open.items.report.wizard"].create( { diff --git a/account_financial_report/view/account_age_report_configuration_views.xml b/account_financial_report/view/account_age_report_configuration_views.xml index 58412efb6ef9..f2988df5bf00 100644 --- a/account_financial_report/view/account_age_report_configuration_views.xml +++ b/account_financial_report/view/account_age_report_configuration_views.xml @@ -1,5 +1,6 @@ @@ -12,17 +13,32 @@ - - - - + + + + Age partner report configuration tree + account.age.report.configuration + + + + + + + + + + Age Partner Report Configuration + account.age.report.configuration + tree,form + + diff --git a/account_financial_report/view/res_config_settings_views.xml b/account_financial_report/view/res_config_settings_views.xml new file mode 100644 index 000000000000..91509e85fa19 --- /dev/null +++ b/account_financial_report/view/res_config_settings_views.xml @@ -0,0 +1,56 @@ + + + + + res.config.settings + + + +

    +

    OCA Aged Report Configuration

    +
    +
    +
    +
    + Intervals configuration +
    + Here you can set the intervals that will appear on the Aged Partner Balance. +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    + + + + diff --git a/account_financial_report/wizard/aged_partner_balance_wizard.py b/account_financial_report/wizard/aged_partner_balance_wizard.py index c91693d14428..3786440bae27 100644 --- a/account_financial_report/wizard/aged_partner_balance_wizard.py +++ b/account_financial_report/wizard/aged_partner_balance_wizard.py @@ -40,7 +40,9 @@ class AgedPartnerBalanceWizard(models.TransientModel): comodel_name="account.account", help="Ending account in a range", ) - age_partner_config_id = fields.Many2one("account.age.report.configuration") + age_partner_config_id = fields.Many2one( + "account.age.report.configuration", string="Intervals configuration" + ) @api.onchange("account_code_from", "account_code_to") def on_change_account_range(self): diff --git a/account_financial_report/wizard/aged_partner_balance_wizard_view.xml b/account_financial_report/wizard/aged_partner_balance_wizard_view.xml index 686c9c658174..12b1900dd11d 100644 --- a/account_financial_report/wizard/aged_partner_balance_wizard_view.xml +++ b/account_financial_report/wizard/aged_partner_balance_wizard_view.xml @@ -31,10 +31,10 @@ widget="many2many_tags" options="{'no_create': True}" /> -