Browse Source

[IMP] mis_builder_cash_flow: black, isort, prettier

pull/676/head
mreficent 5 years ago
parent
commit
a96ec4e1dd
  1. 37
      mis_builder_cash_flow/__manifest__.py
  2. 104
      mis_builder_cash_flow/data/mis_report.xml
  3. 66
      mis_builder_cash_flow/data/mis_report_instance.xml
  4. 48
      mis_builder_cash_flow/data/mis_report_style.xml
  5. 6
      mis_builder_cash_flow/models/account_account.py
  6. 44
      mis_builder_cash_flow/models/mis_cash_flow_forecast_line.py
  7. 78
      mis_builder_cash_flow/report/mis_cash_flow.py
  8. 104
      mis_builder_cash_flow/report/mis_cash_flow_views.xml
  9. 30
      mis_builder_cash_flow/security/mis_cash_flow_security.xml
  10. 145
      mis_builder_cash_flow/tests/test_cash_flow.py
  11. 9
      mis_builder_cash_flow/views/account_account_views.xml
  12. 83
      mis_builder_cash_flow/views/mis_cash_flow_forecast_line_views.xml

37
mis_builder_cash_flow/__manifest__.py

@ -2,25 +2,22 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{ {
'name': 'MIS Builder Cash Flow',
'version': '12.0.1.3.0',
'license': 'LGPL-3',
'author': 'ADHOC SA, '
'Odoo Community Association (OCA)',
'website': 'https://github.com/OCA/mis-builder',
'depends': [
'mis_builder',
"name": "MIS Builder Cash Flow",
"version": "12.0.1.3.0",
"license": "LGPL-3",
"author": "ADHOC SA, " "Odoo Community Association (OCA)",
"website": "https://github.com/OCA/mis-builder",
"depends": ["mis_builder",],
"data": [
"security/mis_cash_flow_security.xml",
"report/mis_cash_flow_views.xml",
"views/mis_cash_flow_forecast_line_views.xml",
"views/account_account_views.xml",
"data/mis_report_style.xml",
"data/mis_report.xml",
"data/mis_report_instance.xml",
], ],
'data': [
'security/mis_cash_flow_security.xml',
'report/mis_cash_flow_views.xml',
'views/mis_cash_flow_forecast_line_views.xml',
'views/account_account_views.xml',
'data/mis_report_style.xml',
'data/mis_report.xml',
'data/mis_report_instance.xml',
],
'installable': True,
'maintainers': ['jjscarafia'],
'development_status': 'Beta',
"installable": True,
"maintainers": ["jjscarafia"],
"development_status": "Beta",
} }

104
mis_builder_cash_flow/data/mis_report.xml

@ -1,105 +1,109 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2019 ADHOC SA <!-- Copyright 2019 ADHOC SA
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). --> License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<odoo noupdate="True"> <odoo noupdate="True">
<record id="mis_report_cash_flow" model="mis.report"> <record id="mis_report_cash_flow" model="mis.report">
<field name="name">Cash Flow</field> <field name="name">Cash Flow</field>
<field name="style_id" ref="mis_style_cash_flow"/>
<field name="style_id" ref="mis_style_cash_flow" />
</record> </record>
<record id="mis_kpi_aliquidity" model="mis.report.kpi"> <record id="mis_kpi_aliquidity" model="mis.report.kpi">
<field name="report_id" ref="mis_report_cash_flow"/>
<field name="report_id" ref="mis_report_cash_flow" />
<field name="name">liquidity</field> <field name="name">liquidity</field>
<field name="description">LIQUIDITY</field> <field name="description">LIQUIDITY</field>
<field name="style_id" ref="mis_style_account_sub_total"/>
<field name="auto_expand_accounts" eval="True"/>
<field name="auto_expand_accounts_style_id" ref="mis_style_account_detail"/>
<field name="style_id" ref="mis_style_account_sub_total" />
<field name="auto_expand_accounts" eval="True" />
<field name="auto_expand_accounts_style_id" ref="mis_style_account_detail" />
<field name="sequence">20</field> <field name="sequence">20</field>
<field name="expression">bal[][('account_id.internal_type', '=', 'liquidity'), ('line_type', '=', 'move_line'), ('account_id.hide_in_cash_flow', '=', False)]</field>
<field
name="expression"
>bal[][('account_id.internal_type', '=', 'liquidity'), ('line_type', '=', 'move_line'), ('account_id.hide_in_cash_flow', '=', False)]</field>
</record> </record>
<record id="mis_kpi_in_total" model="mis.report.kpi"> <record id="mis_kpi_in_total" model="mis.report.kpi">
<field name="report_id" ref="mis_report_cash_flow"/>
<field name="report_id" ref="mis_report_cash_flow" />
<field name="name">in_total</field> <field name="name">in_total</field>
<field name="description">IN TOTAL</field> <field name="description">IN TOTAL</field>
<field name="style_id" ref="mis_style_account_sub_total"/>
<field name="style_id" ref="mis_style_account_sub_total" />
<field name="sequence">30</field> <field name="sequence">30</field>
<field name="expression">in_receivable + in_forecast</field> <field name="expression">in_receivable + in_forecast</field>
</record> </record>
<record id="mis_kpi_in_receivable" model="mis.report.kpi"> <record id="mis_kpi_in_receivable" model="mis.report.kpi">
<field name="report_id" ref="mis_report_cash_flow"/>
<field name="report_id" ref="mis_report_cash_flow" />
<field name="name">in_receivable</field> <field name="name">in_receivable</field>
<field name="description">In receivable</field> <field name="description">In receivable</field>
<field name="style_id" ref="mis_style_account_line"/>
<field name="auto_expand_accounts" eval="True"/>
<field name="auto_expand_accounts_style_id" ref="mis_style_account_detail"/>
<field name="style_id" ref="mis_style_account_line" />
<field name="auto_expand_accounts" eval="True" />
<field name="auto_expand_accounts_style_id" ref="mis_style_account_detail" />
<field name="sequence">50</field> <field name="sequence">50</field>
<field name="expression">bal[][('account_id.internal_type', '=', 'receivable'), ('full_reconcile_id', '=', False), ('line_type', '=', 'move_line'), ('account_id.hide_in_cash_flow', '=', False)]</field>
<field
name="expression"
>bal[][('account_id.internal_type', '=', 'receivable'), ('full_reconcile_id', '=', False), ('line_type', '=', 'move_line'), ('account_id.hide_in_cash_flow', '=', False)]</field>
</record> </record>
<record id="mis_kpi_in_forecast" model="mis.report.kpi"> <record id="mis_kpi_in_forecast" model="mis.report.kpi">
<field name="report_id" ref="mis_report_cash_flow"/>
<field name="report_id" ref="mis_report_cash_flow" />
<field name="name">in_forecast</field> <field name="name">in_forecast</field>
<field name="description">In forecast</field> <field name="description">In forecast</field>
<field name="style_id" ref="mis_style_account_line"/>
<field name="auto_expand_accounts" eval="True"/>
<field name="auto_expand_accounts_style_id" ref="mis_style_account_detail"/>
<field name="style_id" ref="mis_style_account_line" />
<field name="auto_expand_accounts" eval="True" />
<field name="auto_expand_accounts_style_id" ref="mis_style_account_detail" />
<field name="sequence">70</field> <field name="sequence">70</field>
<field name="expression">bal[][('line_type', '=', 'forecast_line'), ('debit', '!=', 0.0), ('account_id.hide_in_cash_flow', '=', False)]</field>
<field
name="expression"
>bal[][('line_type', '=', 'forecast_line'), ('debit', '!=', 0.0), ('account_id.hide_in_cash_flow', '=', False)]</field>
</record> </record>
<record id="mis_kpi_out_total" model="mis.report.kpi"> <record id="mis_kpi_out_total" model="mis.report.kpi">
<field name="report_id" ref="mis_report_cash_flow"/>
<field name="report_id" ref="mis_report_cash_flow" />
<field name="name">out_total</field> <field name="name">out_total</field>
<field name="description">OUT TOTAL</field> <field name="description">OUT TOTAL</field>
<field name="style_id" ref="mis_style_account_sub_total"/>
<field name="style_id" ref="mis_style_account_sub_total" />
<field name="sequence">80</field> <field name="sequence">80</field>
<field name="expression">out_payable + out_forecast</field> <field name="expression">out_payable + out_forecast</field>
</record> </record>
<record id="mis_kpi_out_payable" model="mis.report.kpi"> <record id="mis_kpi_out_payable" model="mis.report.kpi">
<field name="report_id" ref="mis_report_cash_flow"/>
<field name="report_id" ref="mis_report_cash_flow" />
<field name="name">out_payable</field> <field name="name">out_payable</field>
<field name="description">Out payable</field> <field name="description">Out payable</field>
<field name="style_id" ref="mis_style_account_line"/>
<field name="auto_expand_accounts" eval="True"/>
<field name="auto_expand_accounts_style_id" ref="mis_style_account_detail"/>
<field name="style_id" ref="mis_style_account_line" />
<field name="auto_expand_accounts" eval="True" />
<field name="auto_expand_accounts_style_id" ref="mis_style_account_detail" />
<field name="sequence">100</field> <field name="sequence">100</field>
<field name="expression">bal[][('account_id.internal_type', '=', 'payable'), ('full_reconcile_id', '=', False), ('line_type', '=', 'move_line'), ('account_id.hide_in_cash_flow', '=', False)]</field>
<field
name="expression"
>bal[][('account_id.internal_type', '=', 'payable'), ('full_reconcile_id', '=', False), ('line_type', '=', 'move_line'), ('account_id.hide_in_cash_flow', '=', False)]</field>
</record> </record>
<record id="mis_kpi_out_forecast" model="mis.report.kpi"> <record id="mis_kpi_out_forecast" model="mis.report.kpi">
<field name="report_id" ref="mis_report_cash_flow"/>
<field name="report_id" ref="mis_report_cash_flow" />
<field name="name">out_forecast</field> <field name="name">out_forecast</field>
<field name="description">Out forecast</field> <field name="description">Out forecast</field>
<field name="style_id" ref="mis_style_account_line"/>
<field name="auto_expand_accounts" eval="True"/>
<field name="auto_expand_accounts_style_id" ref="mis_style_account_detail"/>
<field name="style_id" ref="mis_style_account_line" />
<field name="auto_expand_accounts" eval="True" />
<field name="auto_expand_accounts_style_id" ref="mis_style_account_detail" />
<field name="sequence">120</field> <field name="sequence">120</field>
<field name="expression">bal[][('line_type', '=', 'forecast_line'), ('credit', '!=', 0.0), ('account_id.hide_in_cash_flow', '=', False)]</field>
<field
name="expression"
>bal[][('line_type', '=', 'forecast_line'), ('credit', '!=', 0.0), ('account_id.hide_in_cash_flow', '=', False)]</field>
</record> </record>
<record id="mis_kpi_period_balance" model="mis.report.kpi"> <record id="mis_kpi_period_balance" model="mis.report.kpi">
<field name="report_id" ref="mis_report_cash_flow"/>
<field name="report_id" ref="mis_report_cash_flow" />
<field name="name">period_balance</field> <field name="name">period_balance</field>
<field name="description">PERIOD BALANCE</field> <field name="description">PERIOD BALANCE</field>
<field name="style_id" ref="mis_style_account_sub_total"/>
<field name="style_id" ref="mis_style_account_sub_total" />
<field name="sequence">130</field> <field name="sequence">130</field>
<field name="expression">in_total + out_total</field> <field name="expression">in_total + out_total</field>
<field name="style_expression">'Cash Flow - Good' if period_balance >= 0.0 else 'Cash Flow - Bad'</field>
<field
name="style_expression"
>'Cash Flow - Good' if period_balance >= 0.0 else 'Cash Flow - Bad'</field>
</record> </record>
<record id="mis_kpi_balance" model="mis.report.kpi"> <record id="mis_kpi_balance" model="mis.report.kpi">
<field name="report_id" ref="mis_report_cash_flow"/>
<field name="report_id" ref="mis_report_cash_flow" />
<field name="name">balance</field> <field name="name">balance</field>
<field name="description">BALANCE</field> <field name="description">BALANCE</field>
<field name="style_id" ref="mis_style_account_total"/>
<field name="style_id" ref="mis_style_account_total" />
<field name="sequence">150</field> <field name="sequence">150</field>
<field name="expression">bale[][('account_id.hide_in_cash_flow', '=', False), '|', ('line_type', '=', 'forecast_line'), ('line_type', '=', 'move_line'), '|', ('account_id.internal_type', '=', 'liquidity'), ('account_id.internal_type', 'in', ('receivable', 'payable')), ('full_reconcile_id', '=', False)]</field>
<field name="style_expression">'Cash Flow - Good' if balance >= 0.0 else 'Cash Flow - Bad'</field>
<field
name="expression"
>bale[][('account_id.hide_in_cash_flow', '=', False), '|', ('line_type', '=', 'forecast_line'), ('line_type', '=', 'move_line'), '|', ('account_id.internal_type', '=', 'liquidity'), ('account_id.internal_type', 'in', ('receivable', 'payable')), ('full_reconcile_id', '=', False)]</field>
<field
name="style_expression"
>'Cash Flow - Good' if balance >= 0.0 else 'Cash Flow - Bad'</field>
</record> </record>
</odoo> </odoo>

66
mis_builder_cash_flow/data/mis_report_instance.xml

@ -1,146 +1,132 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2019 ADHOC SA <!-- Copyright 2019 ADHOC SA
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). --> License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<odoo noupdate="True"> <odoo noupdate="True">
<record id="mis_instance_cash_flow" model="mis.report.instance"> <record id="mis_instance_cash_flow" model="mis.report.instance">
<field name="name">Cash Flow</field> <field name="name">Cash Flow</field>
<field name="report_id" ref="mis_report_cash_flow"/>
<field name="comparison_mode" eval="True"/>
<field name="landscape_pdf" eval="True"/>
<field name="report_id" ref="mis_report_cash_flow" />
<field name="comparison_mode" eval="True" />
<field name="landscape_pdf" eval="True" />
</record> </record>
<record id="mis_period_current" model="mis.report.instance.period"> <record id="mis_period_current" model="mis.report.instance.period">
<field name="name">Current</field> <field name="name">Current</field>
<field name="report_instance_id" ref="mis_instance_cash_flow"/>
<field name="report_instance_id" ref="mis_instance_cash_flow" />
<field name="source">actuals_alt</field> <field name="source">actuals_alt</field>
<field name="source_aml_model_id" ref="model_mis_cash_flow"/>
<field name="source_aml_model_id" ref="model_mis_cash_flow" />
<field name="mode">relative</field> <field name="mode">relative</field>
<field name="type">w</field> <field name="type">w</field>
<field name="offset">-4000</field> <field name="offset">-4000</field>
<field name="duration">4001</field> <field name="duration">4001</field>
<field name="sequence">4</field> <field name="sequence">4</field>
</record> </record>
<record id="mis_period_plus_1w" model="mis.report.instance.period"> <record id="mis_period_plus_1w" model="mis.report.instance.period">
<field name="name">+1w</field> <field name="name">+1w</field>
<field name="report_instance_id" ref="mis_instance_cash_flow"/>
<field name="report_instance_id" ref="mis_instance_cash_flow" />
<field name="source">actuals_alt</field> <field name="source">actuals_alt</field>
<field name="source_aml_model_id" ref="model_mis_cash_flow"/>
<field name="source_aml_model_id" ref="model_mis_cash_flow" />
<field name="mode">relative</field> <field name="mode">relative</field>
<field name="type">w</field> <field name="type">w</field>
<field name="offset">1</field> <field name="offset">1</field>
<field name="duration">1</field> <field name="duration">1</field>
<field name="sequence">10</field> <field name="sequence">10</field>
</record> </record>
<record id="mis_period_plus_2w" model="mis.report.instance.period"> <record id="mis_period_plus_2w" model="mis.report.instance.period">
<field name="name">+2w</field> <field name="name">+2w</field>
<field name="report_instance_id" ref="mis_instance_cash_flow"/>
<field name="report_instance_id" ref="mis_instance_cash_flow" />
<field name="source">actuals_alt</field> <field name="source">actuals_alt</field>
<field name="source_aml_model_id" ref="model_mis_cash_flow"/>
<field name="source_aml_model_id" ref="model_mis_cash_flow" />
<field name="mode">relative</field> <field name="mode">relative</field>
<field name="type">w</field> <field name="type">w</field>
<field name="offset">2</field> <field name="offset">2</field>
<field name="duration">1</field> <field name="duration">1</field>
<field name="sequence">20</field> <field name="sequence">20</field>
</record> </record>
<record id="mis_period_plus_3w" model="mis.report.instance.period"> <record id="mis_period_plus_3w" model="mis.report.instance.period">
<field name="name">+3w</field> <field name="name">+3w</field>
<field name="report_instance_id" ref="mis_instance_cash_flow"/>
<field name="report_instance_id" ref="mis_instance_cash_flow" />
<field name="source">actuals_alt</field> <field name="source">actuals_alt</field>
<field name="source_aml_model_id" ref="model_mis_cash_flow"/>
<field name="source_aml_model_id" ref="model_mis_cash_flow" />
<field name="mode">relative</field> <field name="mode">relative</field>
<field name="type">w</field> <field name="type">w</field>
<field name="offset">3</field> <field name="offset">3</field>
<field name="duration">1</field> <field name="duration">1</field>
<field name="sequence">30</field> <field name="sequence">30</field>
</record> </record>
<record id="mis_period_plus_4w" model="mis.report.instance.period"> <record id="mis_period_plus_4w" model="mis.report.instance.period">
<field name="name">+4w</field> <field name="name">+4w</field>
<field name="report_instance_id" ref="mis_instance_cash_flow"/>
<field name="report_instance_id" ref="mis_instance_cash_flow" />
<field name="source">actuals_alt</field> <field name="source">actuals_alt</field>
<field name="source_aml_model_id" ref="model_mis_cash_flow"/>
<field name="source_aml_model_id" ref="model_mis_cash_flow" />
<field name="mode">relative</field> <field name="mode">relative</field>
<field name="type">w</field> <field name="type">w</field>
<field name="offset">4</field> <field name="offset">4</field>
<field name="duration">1</field> <field name="duration">1</field>
<field name="sequence">40</field> <field name="sequence">40</field>
</record> </record>
<record id="mis_period_plus_5w" model="mis.report.instance.period"> <record id="mis_period_plus_5w" model="mis.report.instance.period">
<field name="name">+5w</field> <field name="name">+5w</field>
<field name="report_instance_id" ref="mis_instance_cash_flow"/>
<field name="report_instance_id" ref="mis_instance_cash_flow" />
<field name="source">actuals_alt</field> <field name="source">actuals_alt</field>
<field name="source_aml_model_id" ref="model_mis_cash_flow"/>
<field name="source_aml_model_id" ref="model_mis_cash_flow" />
<field name="mode">relative</field> <field name="mode">relative</field>
<field name="type">w</field> <field name="type">w</field>
<field name="offset">5</field> <field name="offset">5</field>
<field name="duration">1</field> <field name="duration">1</field>
<field name="sequence">50</field> <field name="sequence">50</field>
</record> </record>
<record id="mis_period_plus_6w" model="mis.report.instance.period"> <record id="mis_period_plus_6w" model="mis.report.instance.period">
<field name="name">+6w</field> <field name="name">+6w</field>
<field name="report_instance_id" ref="mis_instance_cash_flow"/>
<field name="report_instance_id" ref="mis_instance_cash_flow" />
<field name="source">actuals_alt</field> <field name="source">actuals_alt</field>
<field name="source_aml_model_id" ref="model_mis_cash_flow"/>
<field name="source_aml_model_id" ref="model_mis_cash_flow" />
<field name="mode">relative</field> <field name="mode">relative</field>
<field name="type">w</field> <field name="type">w</field>
<field name="offset">6</field> <field name="offset">6</field>
<field name="duration">1</field> <field name="duration">1</field>
<field name="sequence">60</field> <field name="sequence">60</field>
</record> </record>
<record id="mis_period_plus_7w" model="mis.report.instance.period"> <record id="mis_period_plus_7w" model="mis.report.instance.period">
<field name="name">+7w</field> <field name="name">+7w</field>
<field name="report_instance_id" ref="mis_instance_cash_flow"/>
<field name="report_instance_id" ref="mis_instance_cash_flow" />
<field name="source">actuals_alt</field> <field name="source">actuals_alt</field>
<field name="source_aml_model_id" ref="model_mis_cash_flow"/>
<field name="source_aml_model_id" ref="model_mis_cash_flow" />
<field name="mode">relative</field> <field name="mode">relative</field>
<field name="type">w</field> <field name="type">w</field>
<field name="offset">7</field> <field name="offset">7</field>
<field name="duration">1</field> <field name="duration">1</field>
<field name="sequence">70</field> <field name="sequence">70</field>
</record> </record>
<record id="mis_period_plus_8w" model="mis.report.instance.period"> <record id="mis_period_plus_8w" model="mis.report.instance.period">
<field name="name">+8w</field> <field name="name">+8w</field>
<field name="report_instance_id" ref="mis_instance_cash_flow"/>
<field name="report_instance_id" ref="mis_instance_cash_flow" />
<field name="source">actuals_alt</field> <field name="source">actuals_alt</field>
<field name="source_aml_model_id" ref="model_mis_cash_flow"/>
<field name="source_aml_model_id" ref="model_mis_cash_flow" />
<field name="mode">relative</field> <field name="mode">relative</field>
<field name="type">w</field> <field name="type">w</field>
<field name="offset">8</field> <field name="offset">8</field>
<field name="duration">1</field> <field name="duration">1</field>
<field name="sequence">80</field> <field name="sequence">80</field>
</record> </record>
<record id="mis_period_plus_third_month" model="mis.report.instance.period"> <record id="mis_period_plus_third_month" model="mis.report.instance.period">
<field name="name">third month</field> <field name="name">third month</field>
<field name="report_instance_id" ref="mis_instance_cash_flow"/>
<field name="report_instance_id" ref="mis_instance_cash_flow" />
<field name="source">actuals_alt</field> <field name="source">actuals_alt</field>
<field name="source_aml_model_id" ref="model_mis_cash_flow"/>
<field name="source_aml_model_id" ref="model_mis_cash_flow" />
<field name="mode">relative</field> <field name="mode">relative</field>
<field name="type">w</field> <field name="type">w</field>
<field name="offset">9</field> <field name="offset">9</field>
<field name="duration">4</field> <field name="duration">4</field>
<field name="sequence">90</field> <field name="sequence">90</field>
</record> </record>
<record id="mis_period_plus_fourth_month" model="mis.report.instance.period"> <record id="mis_period_plus_fourth_month" model="mis.report.instance.period">
<field name="name">fourth month</field> <field name="name">fourth month</field>
<field name="report_instance_id" ref="mis_instance_cash_flow"/>
<field name="report_instance_id" ref="mis_instance_cash_flow" />
<field name="source">actuals_alt</field> <field name="source">actuals_alt</field>
<field name="source_aml_model_id" ref="model_mis_cash_flow"/>
<field name="source_aml_model_id" ref="model_mis_cash_flow" />
<field name="mode">relative</field> <field name="mode">relative</field>
<field name="type">w</field> <field name="type">w</field>
<field name="offset">13</field> <field name="offset">13</field>
<field name="duration">4</field> <field name="duration">4</field>
<field name="sequence">90</field> <field name="sequence">90</field>
</record> </record>
</odoo> </odoo>

48
mis_builder_cash_flow/data/mis_report_style.xml

@ -1,71 +1,61 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2019 ADHOC SA <!-- Copyright 2019 ADHOC SA
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). --> License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<odoo noupdate="True"> <odoo noupdate="True">
<record id="mis_style_cash_flow" model="mis.report.style"> <record id="mis_style_cash_flow" model="mis.report.style">
<field name="name">Cash Flow</field> <field name="name">Cash Flow</field>
<field name="hide_empty_inherit" eval="False"/>
<field name="hide_empty" eval="True"/>
<field name="hide_empty_inherit" eval="False" />
<field name="hide_empty" eval="True" />
</record> </record>
<record id="mis_style_account_detail" model="mis.report.style"> <record id="mis_style_account_detail" model="mis.report.style">
<field name="name">Cash flow style account detail</field> <field name="name">Cash flow style account detail</field>
<field name="font_style_inherit" eval="False"/>
<field name="font_style_inherit" eval="False" />
<field name="font_style">italic</field> <field name="font_style">italic</field>
<field name="indent_level_inherit" eval="False"/>
<field name="indent_level_inherit" eval="False" />
<field name="indent_level">2</field> <field name="indent_level">2</field>
<field name="font_size_inherit" eval="False"/>
<field name="font_size_inherit" eval="False" />
<field name="font_size">x-small</field> <field name="font_size">x-small</field>
</record> </record>
<record id="mis_style_account_line" model="mis.report.style"> <record id="mis_style_account_line" model="mis.report.style">
<field name="name">Cash flow line</field> <field name="name">Cash flow line</field>
<field name="color_inherit" eval="False"/>
<field name="color_inherit" eval="False" />
<field name="color">#FFFFFF</field> <field name="color">#FFFFFF</field>
<field name="background_color_inherit" eval="False"/>
<field name="background_color_inherit" eval="False" />
<field name="background_color">#D4AFC4</field> <field name="background_color">#D4AFC4</field>
<field name="indent_level_inherit" eval="False"/>
<field name="indent_level_inherit" eval="False" />
<field name="indent_level">1</field> <field name="indent_level">1</field>
</record> </record>
<record id="mis_style_account_sub_total" model="mis.report.style"> <record id="mis_style_account_sub_total" model="mis.report.style">
<field name="name">Cash flow style sub-total</field> <field name="name">Cash flow style sub-total</field>
<field name="color_inherit" eval="False"/>
<field name="color_inherit" eval="False" />
<field name="color">#FFFFFF</field> <field name="color">#FFFFFF</field>
<field name="background_color_inherit" eval="False"/>
<field name="background_color_inherit" eval="False" />
<field name="background_color">#967C8B</field> <field name="background_color">#967C8B</field>
<field name="font_weight_inherit" eval="False"/>
<field name="font_weight_inherit" eval="False" />
<field name="font_weight">bold</field> <field name="font_weight">bold</field>
</record> </record>
<record id="mis_style_account_total" model="mis.report.style"> <record id="mis_style_account_total" model="mis.report.style">
<field name="name">Cash flow style total</field> <field name="name">Cash flow style total</field>
<field name="color_inherit" eval="False"/>
<field name="color_inherit" eval="False" />
<field name="color">#FFFFFF</field> <field name="color">#FFFFFF</field>
<field name="background_color_inherit" eval="False"/>
<field name="background_color_inherit" eval="False" />
<field name="background_color">#7A6571</field> <field name="background_color">#7A6571</field>
<field name="font_weight_inherit" eval="False"/>
<field name="font_weight_inherit" eval="False" />
<field name="font_weight">bold</field> <field name="font_weight">bold</field>
</record> </record>
<record id="mis_style_hidden" model="mis.report.style"> <record id="mis_style_hidden" model="mis.report.style">
<field name="name">Cash Flow - hidden</field> <field name="name">Cash Flow - hidden</field>
<field name="hide_always_inherit" eval="False"/>
<field name="hide_always" eval="True"/>
<field name="hide_always_inherit" eval="False" />
<field name="hide_always" eval="True" />
</record> </record>
<record id="mis_style_good" model="mis.report.style"> <record id="mis_style_good" model="mis.report.style">
<field name="name">Cash Flow - Good</field> <field name="name">Cash Flow - Good</field>
<field name="color_inherit" eval="False"/>
<field name="color_inherit" eval="False" />
<field name="color">#005700</field> <field name="color">#005700</field>
</record> </record>
<record id="mis_style_bad" model="mis.report.style"> <record id="mis_style_bad" model="mis.report.style">
<field name="name">Cash Flow - Bad</field> <field name="name">Cash Flow - Bad</field>
<field name="color_inherit" eval="False"/>
<field name="color_inherit" eval="False" />
<field name="color">#7A0000</field> <field name="color">#7A0000</field>
</record> </record>
</odoo> </odoo>

6
mis_builder_cash_flow/models/account_account.py

@ -5,8 +5,6 @@ from odoo import fields, models
class AccountAccount(models.Model): class AccountAccount(models.Model):
_inherit = 'account.account'
_inherit = "account.account"
hide_in_cash_flow = fields.Boolean(
string='Hide in Cash Flow?',
)
hide_in_cash_flow = fields.Boolean(string="Hide in Cash Flow?",)

44
mis_builder_cash_flow/models/mis_cash_flow_forecast_line.py

@ -1,48 +1,36 @@
# Copyright 2019 ADHOC SA # Copyright 2019 ADHOC SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models, api, _
from odoo import _, api, fields, models
from odoo.exceptions import ValidationError from odoo.exceptions import ValidationError
class MisCashFlowForecastLine(models.Model): class MisCashFlowForecastLine(models.Model):
_name = 'mis.cash_flow.forecast_line'
_description = 'MIS Cash Flow Forecast Line'
_name = "mis.cash_flow.forecast_line"
_description = "MIS Cash Flow Forecast Line"
date = fields.Date(
required=True,
index=True,
)
date = fields.Date(required=True, index=True,)
account_id = fields.Many2one( account_id = fields.Many2one(
comodel_name='account.account',
string='Account',
required=True,
help='The account of the forecast line is only for informative '
'purpose',
)
partner_id = fields.Many2one(
comodel_name='res.partner',
string='Partner',
)
name = fields.Char(
required=True,
default='/',
)
balance = fields.Float(
comodel_name="account.account",
string="Account",
required=True, required=True,
help="The account of the forecast line is only for informative " "purpose",
) )
partner_id = fields.Many2one(comodel_name="res.partner", string="Partner",)
name = fields.Char(required=True, default="/",)
balance = fields.Float(required=True,)
company_id = fields.Many2one( company_id = fields.Many2one(
'res.company',
string='Company',
"res.company",
string="Company",
required=True, required=True,
default=lambda self: self.env.user.company_id.id, default=lambda self: self.env.user.company_id.id,
index=True, index=True,
) )
@api.multi @api.multi
@api.constrains('company_id', 'account_id')
@api.constrains("company_id", "account_id")
def _check_company_id_account_id(self): def _check_company_id_account_id(self):
if self.filtered(lambda x: x.company_id != x.account_id.company_id): if self.filtered(lambda x: x.company_id != x.account_id.company_id):
raise ValidationError(_(
'The Company and the Company of the Account must be the '
'same.'))
raise ValidationError(
_("The Company and the Company of the Account must be the " "same.")
)

78
mis_builder_cash_flow/report/mis_cash_flow.py

@ -1,79 +1,61 @@
# Copyright 2019 ADHOC SA # Copyright 2019 ADHOC SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, fields, models, tools
from psycopg2.extensions import AsIs from psycopg2.extensions import AsIs
from odoo import api, fields, models, tools
class MisCashFlow(models.Model): class MisCashFlow(models.Model):
_name = 'mis.cash_flow'
_description = 'MIS Cash Flow'
_name = "mis.cash_flow"
_description = "MIS Cash Flow"
_auto = False _auto = False
line_type = fields.Selection( line_type = fields.Selection(
[('forecast_line', 'Forecast Line'), ('move_line', 'Journal Item')],
[("forecast_line", "Forecast Line"), ("move_line", "Journal Item")],
index=True, index=True,
readonly=True, readonly=True,
) )
name = fields.Char(
readonly=True,
)
name = fields.Char(readonly=True,)
account_id = fields.Many2one( account_id = fields.Many2one(
comodel_name='account.account',
string='Account',
comodel_name="account.account",
string="Account",
auto_join=True, auto_join=True,
index=True, index=True,
readonly=True, readonly=True,
) )
partner_id = fields.Many2one( partner_id = fields.Many2one(
comodel_name='res.partner',
string='Partner',
readonly=True,
comodel_name="res.partner", string="Partner", readonly=True,
) )
move_line_id = fields.Many2one( move_line_id = fields.Many2one(
comodel_name='account.move.line',
string='Journal Item',
comodel_name="account.move.line",
string="Journal Item",
auto_join=True, auto_join=True,
readonly=True, readonly=True,
) )
company_id = fields.Many2one( company_id = fields.Many2one(
comodel_name='res.company',
string='Company',
comodel_name="res.company",
string="Company",
auto_join=True, auto_join=True,
readonly=True, readonly=True,
index=True, index=True,
) )
credit = fields.Float(
readonly=True,
)
debit = fields.Float(
readonly=True,
)
date = fields.Date(
readonly=True,
index=True,
)
reconciled = fields.Boolean(
readonly=True,
)
credit = fields.Float(readonly=True,)
debit = fields.Float(readonly=True,)
date = fields.Date(readonly=True, index=True,)
reconciled = fields.Boolean(readonly=True,)
full_reconcile_id = fields.Many2one( full_reconcile_id = fields.Many2one(
'account.full.reconcile',
string="Matching Number",
readonly=True,
index=True,
"account.full.reconcile", string="Matching Number", readonly=True, index=True,
) )
user_type_id = fields.Many2one( user_type_id = fields.Many2one(
'account.account.type',
auto_join=True,
readonly=True,
index=True,
"account.account.type", auto_join=True, readonly=True, index=True,
) )
@api.model_cr @api.model_cr
def init(self): def init(self):
account_type_receivable = self.env.ref(
'account.data_account_type_receivable')
query = """
account_type_receivable = self.env.ref("account.data_account_type_receivable")
query = (
"""
SELECT SELECT
-- we use negative id to avoid duplicates and we don't use -- we use negative id to avoid duplicates and we don't use
-- ROW_NUMBER() because the performance was very poor -- ROW_NUMBER() because the performance was very poor
@ -123,18 +105,22 @@ class MisCashFlow(models.Model):
fl.name as name, fl.name as name,
fl.date as date fl.date as date
FROM mis_cash_flow_forecast_line as fl FROM mis_cash_flow_forecast_line as fl
""" % account_type_receivable.id
"""
% account_type_receivable.id
)
tools.drop_view_if_exists(self.env.cr, self._table) tools.drop_view_if_exists(self.env.cr, self._table)
self._cr.execute( self._cr.execute(
'CREATE OR REPLACE VIEW %s AS %s',
(AsIs(self._table), AsIs(query))
"CREATE OR REPLACE VIEW %s AS %s", (AsIs(self._table), AsIs(query))
) )
@api.multi @api.multi
def action_open_related_line(self): def action_open_related_line(self):
self.ensure_one() self.ensure_one()
if self.line_type == 'move_line':
if self.line_type == "move_line":
return self.move_line_id.get_formview_action() return self.move_line_id.get_formview_action()
else: else:
return self.env['mis.cash_flow.forecast_line'].browse(
self.id).get_formview_action()
return (
self.env["mis.cash_flow.forecast_line"]
.browse(self.id)
.get_formview_action()
)

104
mis_builder_cash_flow/report/mis_cash_flow_views.xml

@ -1,27 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2019 ADHOC SA <!-- Copyright 2019 ADHOC SA
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). --> License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<odoo> <odoo>
<record model="ir.ui.view" id="mis_cash_flow_tree_view"> <record model="ir.ui.view" id="mis_cash_flow_tree_view">
<field name="name">mis.cash_flow.tree</field> <field name="name">mis.cash_flow.tree</field>
<field name="model">mis.cash_flow</field> <field name="model">mis.cash_flow</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<tree create="false" edit="false" delete="false"> <tree create="false" edit="false" delete="false">
<field name="company_id" groups="base.group_multi_company"/>
<field name="line_type"/>
<field name="date"/>
<field name="name"/>
<field name="company_id" groups="base.group_multi_company" />
<field name="line_type" />
<field name="date" />
<field name="name" />
<field name="partner_id" /> <field name="partner_id" />
<field name="account_id"/>
<field name="debit" sum="Total"/>
<field name="credit" sum="Total"/>
<button type="object" string="Open Journal Item / Forecast Line" icon="fa-external-link" name="action_open_related_line"/>
<field name="account_id" />
<field name="debit" sum="Total" />
<field name="credit" sum="Total" />
<button
type="object"
string="Open Journal Item / Forecast Line"
icon="fa-external-link"
name="action_open_related_line"
/>
</tree> </tree>
</field> </field>
</record> </record>
<record model="ir.ui.view" id="mis_cash_flow_form_view"> <record model="ir.ui.view" id="mis_cash_flow_form_view">
<field name="name">mis.cash_flow.form</field> <field name="name">mis.cash_flow.form</field>
<field name="model">mis.cash_flow</field> <field name="model">mis.cash_flow</field>
@ -29,67 +31,75 @@
<form create="false" edit="false" delete="false"> <form create="false" edit="false" delete="false">
<group> <group>
<group> <group>
<field name="date"/>
<field name="name"/>
<field name="date" />
<field name="name" />
<field name="partner_id" /> <field name="partner_id" />
<field name="account_id"/>
<field name="move_line_id"/>
<field name="account_id" />
<field name="move_line_id" />
</group> </group>
<group> <group>
<field name="debit"
sum="Total"/>
<field name="credit"
sum="Total"/>
<field name="company_id"
groups="base.group_multi_company"/>
<field name="line_type"/>
<field name="debit" sum="Total" />
<field name="credit" sum="Total" />
<field name="company_id" groups="base.group_multi_company" />
<field name="line_type" />
</group> </group>
</group> </group>
</form> </form>
</field> </field>
</record> </record>
<record model="ir.ui.view" id="mis_cash_flow_search_view"> <record model="ir.ui.view" id="mis_cash_flow_search_view">
<field name="name">mis.cash_flow.search</field> <field name="name">mis.cash_flow.search</field>
<field name="model">mis.cash_flow</field> <field name="model">mis.cash_flow</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<search> <search>
<field name="name"/>
<field name="date"/>
<separator/>
<field name="name" />
<field name="date" />
<separator />
<field name="partner_id" /> <field name="partner_id" />
<field name="account_id"/>
<field name="company_id"
groups="base.group_multi_company"/>
<separator/>
<filter string="Unreconciled"
<field name="account_id" />
<field name="company_id" groups="base.group_multi_company" />
<separator />
<filter
string="Unreconciled"
domain="[('full_reconcile_id', '=', False), ('balance','!=', 0), ('account_id.reconcile','=',True)]" domain="[('full_reconcile_id', '=', False), ('balance','!=', 0), ('account_id.reconcile','=',True)]"
help="Journal items where matching number isn't set" help="Journal items where matching number isn't set"
name="unreconciled"/>
<separator/>
<filter string="Journal Item"
name="unreconciled"
/>
<separator />
<filter
string="Journal Item"
name="move_line" name="move_line"
domain="[('line_type','=', 'move_line')]"/>
<filter string="Forecast Line"
domain="[('line_type','=', 'move_line')]"
/>
<filter
string="Forecast Line"
name="forecast_line" name="forecast_line"
domain="[('line_type','=', 'forecast_line')]"/>
domain="[('line_type','=', 'forecast_line')]"
/>
<group> <group>
<filter string="Line Type"
<filter
string="Line Type"
name="group_by_line_type" name="group_by_line_type"
context="{'group_by':'line_type'}"/>
<filter string="Account"
context="{'group_by':'line_type'}"
/>
<filter
string="Account"
name="group_by_account_id" name="group_by_account_id"
context="{'group_by':'account_id'}"/>
<filter string="Date"
context="{'group_by':'account_id'}"
/>
<filter
string="Date"
name="group_by_date" name="group_by_date"
context="{'group_by':'date'}"/>
<filter string="Company"
context="{'group_by':'date'}"
/>
<filter
string="Company"
name="group_by_company_id" name="group_by_company_id"
context="{'group_by':'company_id'}" context="{'group_by':'company_id'}"
groups="base.group_multi_company"/>
groups="base.group_multi_company"
/>
</group> </group>
</search> </search>
</field> </field>
</record> </record>
</odoo> </odoo>

30
mis_builder_cash_flow/security/mis_cash_flow_security.xml

@ -1,27 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2019 ADHOC SA <!-- Copyright 2019 ADHOC SA
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). --> License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<odoo> <odoo>
<record model="ir.model.access" id="mis_cash_flow_access_name"> <record model="ir.model.access" id="mis_cash_flow_access_name">
<field name="name">mis.cash_flow</field> <field name="name">mis.cash_flow</field>
<field name="model_id" ref="model_mis_cash_flow"/>
<field name="group_id" ref="base.group_user"/>
<field name="perm_read" eval="1"/>
<field name="perm_create" eval="0"/>
<field name="perm_write" eval="0"/>
<field name="perm_unlink" eval="0"/>
<field name="model_id" ref="model_mis_cash_flow" />
<field name="group_id" ref="base.group_user" />
<field name="perm_read" eval="1" />
<field name="perm_create" eval="0" />
<field name="perm_write" eval="0" />
<field name="perm_unlink" eval="0" />
</record> </record>
<record model="ir.model.access" id="mis_cash_flow_forecast_line_access_name"> <record model="ir.model.access" id="mis_cash_flow_forecast_line_access_name">
<field name="name">mis.cash_flow.forecast_line</field> <field name="name">mis.cash_flow.forecast_line</field>
<field name="model_id" ref="model_mis_cash_flow_forecast_line"/>
<field name="group_id" ref="base.group_user"/>
<field name="perm_read" eval="1"/>
<field name="perm_create" eval="1"/>
<field name="perm_write" eval="1"/>
<field name="perm_unlink" eval="1"/>
<field name="model_id" ref="model_mis_cash_flow_forecast_line" />
<field name="group_id" ref="base.group_user" />
<field name="perm_read" eval="1" />
<field name="perm_create" eval="1" />
<field name="perm_write" eval="1" />
<field name="perm_unlink" eval="1" />
</record> </record>
</odoo> </odoo>

145
mis_builder_cash_flow/tests/test_cash_flow.py

@ -5,31 +5,30 @@ from datetime import timedelta
from odoo.exceptions import ValidationError from odoo.exceptions import ValidationError
from odoo.fields import Date from odoo.fields import Date
from odoo.tests.common import TransactionCase, at_install, post_install
from odoo.tools import mute_logger from odoo.tools import mute_logger
from odoo.tests.common import TransactionCase, post_install, at_install
@at_install(False) @at_install(False)
@post_install(True) @post_install(True)
class TestCashFlow(TransactionCase): class TestCashFlow(TransactionCase):
def setUp(self): def setUp(self):
super().setUp() super().setUp()
self.company = self.env['res.company'].create({
'name': 'TEST'
})
self.report = self.browse_ref(
'mis_builder_cash_flow.mis_instance_cash_flow')
self.company = self.env["res.company"].create({"name": "TEST"})
self.report = self.browse_ref("mis_builder_cash_flow.mis_instance_cash_flow")
self.report.company_id = self.company self.report.company_id = self.company
self.bank_account = self.env['account.account'].create({
self.bank_account = self.env["account.account"].create(
{
"company_id": self.company.id, "company_id": self.company.id,
"code": "TEST1", "code": "TEST1",
"name": "Bank account 01", "name": "Bank account 01",
"user_type_id": self.browse_ref( "user_type_id": self.browse_ref(
"account.data_account_type_liquidity" "account.data_account_type_liquidity"
).id, ).id,
})
self.bank_account_hide = self.env['account.account'].create({
}
)
self.bank_account_hide = self.env["account.account"].create(
{
"company_id": self.company.id, "company_id": self.company.id,
"code": "TEST2", "code": "TEST2",
"name": "Bank account 02", "name": "Bank account 02",
@ -37,8 +36,10 @@ class TestCashFlow(TransactionCase):
"account.data_account_type_liquidity" "account.data_account_type_liquidity"
).id, ).id,
"hide_in_cash_flow": True, "hide_in_cash_flow": True,
})
self.account = self.env['account.account'].create({
}
)
self.account = self.env["account.account"].create(
{
"company_id": self.company.id, "company_id": self.company.id,
"code": "TEST3", "code": "TEST3",
"name": "Account", "name": "Account",
@ -46,72 +47,98 @@ class TestCashFlow(TransactionCase):
"account.data_account_type_receivable" "account.data_account_type_receivable"
).id, ).id,
"reconcile": True, "reconcile": True,
})
self.journal = self.env["account.journal"].create({
}
)
self.journal = self.env["account.journal"].create(
{
"name": "Journal", "name": "Journal",
"code": "JOURNAL", "code": "JOURNAL",
"company_id": self.company.id, "company_id": self.company.id,
"type": "general", "type": "general",
})
}
)
def test_company_constrain(self): def test_company_constrain(self):
with self.assertRaises(ValidationError): with self.assertRaises(ValidationError):
self.env['mis.cash_flow.forecast_line'].create({
'account_id': self.account.id,
'date': Date.today(),
'balance': 1000,
})
self.env["mis.cash_flow.forecast_line"].create(
{"account_id": self.account.id, "date": Date.today(), "balance": 1000,}
)
def test_report_instance(self): def test_report_instance(self):
self.check_matrix() self.check_matrix()
move = self.env['account.move'].create({
'name': 'Move',
'journal_id': self.journal.id,
'company_id': self.company.id,
'line_ids': [(0, 0, {
'account_id': self.bank_account.id,
'debit': 1500,
'credit': 0,
'company_id': self.company.id,
}), (0, 0, {
'account_id': self.bank_account_hide.id,
'debit': 500,
'credit': 0,
'company_id': self.company.id,
}), (0, 0, {
'account_id': self.account.id,
'debit': 0,
'credit': 2000,
'company_id': self.company.id,
})]
})
move = self.env["account.move"].create(
{
"name": "Move",
"journal_id": self.journal.id,
"company_id": self.company.id,
"line_ids": [
(
0,
0,
{
"account_id": self.bank_account.id,
"debit": 1500,
"credit": 0,
"company_id": self.company.id,
},
),
(
0,
0,
{
"account_id": self.bank_account_hide.id,
"debit": 500,
"credit": 0,
"company_id": self.company.id,
},
),
(
0,
0,
{
"account_id": self.account.id,
"debit": 0,
"credit": 2000,
"company_id": self.company.id,
},
),
],
}
)
move.post() move.post()
self.check_matrix(args=[
('liquidity', 'Current', 1500),
('balance', 'Current', 1500),
('in_receivable', 'Current', -2000),
], ignore_rows=['balance', 'period_balance', 'in_total'],
self.check_matrix(
args=[
("liquidity", "Current", 1500),
("balance", "Current", 1500),
("in_receivable", "Current", -2000),
],
ignore_rows=["balance", "period_balance", "in_total"],
) )
date = Date.from_string(Date.today()) + timedelta(weeks=8) date = Date.from_string(Date.today()) + timedelta(weeks=8)
self.env['mis.cash_flow.forecast_line'].create({
'account_id': self.account.id,
'date': Date.to_string(date),
'balance': 1000,
'company_id': self.company.id,
})
self.check_matrix([
('liquidity', 'Current', 1500),
('balance', 'Current', 1500),
('in_receivable', 'Current', -2000),
('in_forecast', '+8w', 1000),
], ignore_rows=['balance', 'period_balance', 'in_total'])
self.env["mis.cash_flow.forecast_line"].create(
{
"account_id": self.account.id,
"date": Date.to_string(date),
"balance": 1000,
"company_id": self.company.id,
}
)
self.check_matrix(
[
("liquidity", "Current", 1500),
("balance", "Current", 1500),
("in_receivable", "Current", -2000),
("in_forecast", "+8w", 1000),
],
ignore_rows=["balance", "period_balance", "in_total"],
)
def check_matrix(self, args=False, ignore_rows=False): def check_matrix(self, args=False, ignore_rows=False):
if not args: if not args:
args = [] args = []
if not ignore_rows: if not ignore_rows:
ignore_rows = [] ignore_rows = []
with mute_logger('odoo.addons.mis_builder.models.kpimatrix'):
with mute_logger("odoo.addons.mis_builder.models.kpimatrix"):
matrix = self.report._compute_matrix() matrix = self.report._compute_matrix()
for row in matrix.iter_rows(): for row in matrix.iter_rows():
if row.kpi.name in ignore_rows: if row.kpi.name in ignore_rows:

9
mis_builder_cash_flow/views/account_account_views.xml

@ -1,14 +1,15 @@
<odoo> <odoo>
<record id="view_account_form" model="ir.ui.view"> <record id="view_account_form" model="ir.ui.view">
<field name="model">account.account</field> <field name="model">account.account</field>
<field name="name">account.account.form</field> <field name="name">account.account.form</field>
<field name="inherit_id" ref="account.view_account_form"/>
<field name="inherit_id" ref="account.view_account_form" />
<field name="arch" type="xml"> <field name="arch" type="xml">
<field name="deprecated" position="after"> <field name="deprecated" position="after">
<field name="hide_in_cash_flow" attrs="{'invisible': [('internal_type', 'not in', ['receivable', 'payable', 'liquidity'])]}"/>
<field
name="hide_in_cash_flow"
attrs="{'invisible': [('internal_type', 'not in', ['receivable', 'payable', 'liquidity'])]}"
/>
</field> </field>
</field> </field>
</record> </record>
</odoo> </odoo>

83
mis_builder_cash_flow/views/mis_cash_flow_forecast_line_views.xml

@ -1,9 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8" ?>
<!-- Copyright 2019 ADHOC SA <!-- Copyright 2019 ADHOC SA
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). --> License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<odoo> <odoo>
<record model="ir.ui.view" id="mis_cash_flow_forecast_line_view_form"> <record model="ir.ui.view" id="mis_cash_flow_forecast_line_view_form">
<field name="name">mis.cash_flow.forecast_line.tree</field> <field name="name">mis.cash_flow.forecast_line.tree</field>
<field name="model">mis.cash_flow.forecast_line</field> <field name="model">mis.cash_flow.forecast_line</field>
@ -11,77 +9,84 @@
<form string="MIS Cash Flow Forecast Line"> <form string="MIS Cash Flow Forecast Line">
<sheet> <sheet>
<group col="2"> <group col="2">
<field name="company_id"
groups="base.group_multi_company"/>
<field name="date"/>
<field name="company_id" groups="base.group_multi_company" />
<field name="date" />
<field name="partner_id" /> <field name="partner_id" />
<field name="account_id"
domain="[('company_id', '=', company_id)]"/>
<field name="name"/>
<field name="balance"/>
<field
name="account_id"
domain="[('company_id', '=', company_id)]"
/>
<field name="name" />
<field name="balance" />
</group> </group>
</sheet> </sheet>
</form> </form>
</field> </field>
</record> </record>
<record model="ir.ui.view" id="mis_cash_flow_forecast_line_view_search"> <record model="ir.ui.view" id="mis_cash_flow_forecast_line_view_search">
<field name="name">mis.cash_flow.forecast_line.search</field> <field name="name">mis.cash_flow.forecast_line.search</field>
<field name="model">mis.cash_flow.forecast_line</field> <field name="model">mis.cash_flow.forecast_line</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<search> <search>
<field name="name"/>
<field name="date"/>
<separator/>
<field name="name" />
<field name="date" />
<separator />
<field name="partner_id" /> <field name="partner_id" />
<field name="account_id"/>
<field name="company_id"
groups="base.group_multi_company"/>
<field name="account_id" />
<field name="company_id" groups="base.group_multi_company" />
<group> <group>
<filter string="Account"
<filter
string="Account"
name="group_by_account_id" name="group_by_account_id"
context="{'group_by':'account_id'}"/>
<filter string="Partner"
context="{'group_by':'account_id'}"
/>
<filter
string="Partner"
name="group_by_partner_id" name="group_by_partner_id"
context="{'group_by':'partner_id'}"/>
<filter string="Date"
context="{'group_by':'partner_id'}"
/>
<filter
string="Date"
name="group_by_date" name="group_by_date"
context="{'group_by':'date'}"/>
<filter string="Company"
context="{'group_by':'date'}"
/>
<filter
string="Company"
name="group_by_company_id" name="group_by_company_id"
context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
context="{'group_by':'company_id'}"
groups="base.group_multi_company"
/>
</group> </group>
</search> </search>
</field> </field>
</record> </record>
<record model="ir.ui.view" id="mis_cash_flow_forecast_line_view_tree"> <record model="ir.ui.view" id="mis_cash_flow_forecast_line_view_tree">
<field name="name">mis.cash_flow.forecast_line.tree</field> <field name="name">mis.cash_flow.forecast_line.tree</field>
<field name="model">mis.cash_flow.forecast_line</field> <field name="model">mis.cash_flow.forecast_line</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<tree string="MIS Cash Flow Forecast Line" editable="top"> <tree string="MIS Cash Flow Forecast Line" editable="top">
<field name="company_id"
groups="base.group_multi_company"/>
<field name="date"/>
<field name="name"/>
<field name="company_id" groups="base.group_multi_company" />
<field name="date" />
<field name="name" />
<field name="partner_id" /> <field name="partner_id" />
<field name="account_id"
domain="[('company_id', '=', company_id), ('deprecated', '=', False), ('hide_in_cash_flow', '=', False), ('internal_type', '=', ['receivable', 'payable', 'liquidity'])]"/>
<field name="balance"/>
<field
name="account_id"
domain="[('company_id', '=', company_id), ('deprecated', '=', False), ('hide_in_cash_flow', '=', False), ('internal_type', '=', ['receivable', 'payable', 'liquidity'])]"
/>
<field name="balance" />
</tree> </tree>
</field> </field>
</record> </record>
<record model="ir.actions.act_window" id="action_mis_cash_flow_forecast_line"> <record model="ir.actions.act_window" id="action_mis_cash_flow_forecast_line">
<field name="name">Cash Flow Forecast Line</field> <field name="name">Cash Flow Forecast Line</field>
<field name="view_id" ref="mis_cash_flow_forecast_line_view_tree"/>
<field name="view_id" ref="mis_cash_flow_forecast_line_view_tree" />
<field name="res_model">mis.cash_flow.forecast_line</field> <field name="res_model">mis.cash_flow.forecast_line</field>
<field name="view_mode">tree,form</field> <field name="view_mode">tree,form</field>
</record> </record>
<menuitem id="menu_mis_cash_flow_forecast_line"
<menuitem
id="menu_mis_cash_flow_forecast_line"
parent="mis_builder.mis_report_finance_menu" parent="mis_builder.mis_report_finance_menu"
action="action_mis_cash_flow_forecast_line" action="action_mis_cash_flow_forecast_line"
sequence="23"/>
sequence="23"
/>
</odoo> </odoo>
Loading…
Cancel
Save