mreficent
5 years ago
13 changed files with 588 additions and 600 deletions
-
37mis_builder_cash_flow/__manifest__.py
-
104mis_builder_cash_flow/data/mis_report.xml
-
66mis_builder_cash_flow/data/mis_report_instance.xml
-
48mis_builder_cash_flow/data/mis_report_style.xml
-
6mis_builder_cash_flow/models/account_account.py
-
44mis_builder_cash_flow/models/mis_cash_flow_forecast_line.py
-
78mis_builder_cash_flow/report/mis_cash_flow.py
-
104mis_builder_cash_flow/report/mis_cash_flow_views.xml
-
30mis_builder_cash_flow/security/mis_cash_flow_security.xml
-
145mis_builder_cash_flow/tests/test_cash_flow.py
-
9mis_builder_cash_flow/views/account_account_views.xml
-
83mis_builder_cash_flow/views/mis_cash_flow_forecast_line_views.xml
@ -1,105 +1,109 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<?xml version="1.0" encoding="utf-8" ?> |
|||
<!-- Copyright 2019 ADHOC SA |
|||
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). --> |
|||
|
|||
<odoo noupdate="True"> |
|||
|
|||
<record id="mis_report_cash_flow" model="mis.report"> |
|||
<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 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="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="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 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="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="expression">in_receivable + in_forecast</field> |
|||
</record> |
|||
|
|||
<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="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="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 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="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="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 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="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="expression">out_payable + out_forecast</field> |
|||
</record> |
|||
|
|||
<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="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="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 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="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="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 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="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="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 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="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="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> |
|||
|
|||
</odoo> |
@ -1,146 +1,132 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<?xml version="1.0" encoding="utf-8" ?> |
|||
<!-- Copyright 2019 ADHOC SA |
|||
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). --> |
|||
|
|||
<odoo noupdate="True"> |
|||
|
|||
<record id="mis_instance_cash_flow" model="mis.report.instance"> |
|||
<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 id="mis_period_current" model="mis.report.instance.period"> |
|||
<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_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="type">w</field> |
|||
<field name="offset">-4000</field> |
|||
<field name="duration">4001</field> |
|||
<field name="sequence">4</field> |
|||
</record> |
|||
|
|||
<record id="mis_period_plus_1w" model="mis.report.instance.period"> |
|||
<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_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="type">w</field> |
|||
<field name="offset">1</field> |
|||
<field name="duration">1</field> |
|||
<field name="sequence">10</field> |
|||
</record> |
|||
|
|||
<record id="mis_period_plus_2w" model="mis.report.instance.period"> |
|||
<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_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="type">w</field> |
|||
<field name="offset">2</field> |
|||
<field name="duration">1</field> |
|||
<field name="sequence">20</field> |
|||
</record> |
|||
|
|||
<record id="mis_period_plus_3w" model="mis.report.instance.period"> |
|||
<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_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="type">w</field> |
|||
<field name="offset">3</field> |
|||
<field name="duration">1</field> |
|||
<field name="sequence">30</field> |
|||
</record> |
|||
|
|||
<record id="mis_period_plus_4w" model="mis.report.instance.period"> |
|||
<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_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="type">w</field> |
|||
<field name="offset">4</field> |
|||
<field name="duration">1</field> |
|||
<field name="sequence">40</field> |
|||
</record> |
|||
|
|||
<record id="mis_period_plus_5w" model="mis.report.instance.period"> |
|||
<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_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="type">w</field> |
|||
<field name="offset">5</field> |
|||
<field name="duration">1</field> |
|||
<field name="sequence">50</field> |
|||
</record> |
|||
|
|||
<record id="mis_period_plus_6w" model="mis.report.instance.period"> |
|||
<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_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="type">w</field> |
|||
<field name="offset">6</field> |
|||
<field name="duration">1</field> |
|||
<field name="sequence">60</field> |
|||
</record> |
|||
|
|||
<record id="mis_period_plus_7w" model="mis.report.instance.period"> |
|||
<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_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="type">w</field> |
|||
<field name="offset">7</field> |
|||
<field name="duration">1</field> |
|||
<field name="sequence">70</field> |
|||
</record> |
|||
|
|||
<record id="mis_period_plus_8w" model="mis.report.instance.period"> |
|||
<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_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="type">w</field> |
|||
<field name="offset">8</field> |
|||
<field name="duration">1</field> |
|||
<field name="sequence">80</field> |
|||
</record> |
|||
|
|||
<record id="mis_period_plus_third_month" model="mis.report.instance.period"> |
|||
<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_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="type">w</field> |
|||
<field name="offset">9</field> |
|||
<field name="duration">4</field> |
|||
<field name="sequence">90</field> |
|||
</record> |
|||
|
|||
<record id="mis_period_plus_fourth_month" model="mis.report.instance.period"> |
|||
<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_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="type">w</field> |
|||
<field name="offset">13</field> |
|||
<field name="duration">4</field> |
|||
<field name="sequence">90</field> |
|||
</record> |
|||
|
|||
</odoo> |
@ -1,71 +1,61 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<?xml version="1.0" encoding="utf-8" ?> |
|||
<!-- Copyright 2019 ADHOC SA |
|||
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). --> |
|||
|
|||
<odoo noupdate="True"> |
|||
|
|||
<record id="mis_style_cash_flow" model="mis.report.style"> |
|||
<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 id="mis_style_account_detail" model="mis.report.style"> |
|||
<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="indent_level_inherit" eval="False"/> |
|||
<field name="indent_level_inherit" eval="False" /> |
|||
<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> |
|||
</record> |
|||
|
|||
<record id="mis_style_account_line" model="mis.report.style"> |
|||
<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="background_color_inherit" eval="False"/> |
|||
<field name="background_color_inherit" eval="False" /> |
|||
<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> |
|||
</record> |
|||
|
|||
<record id="mis_style_account_sub_total" model="mis.report.style"> |
|||
<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="background_color_inherit" eval="False"/> |
|||
<field name="background_color_inherit" eval="False" /> |
|||
<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> |
|||
</record> |
|||
|
|||
<record id="mis_style_account_total" model="mis.report.style"> |
|||
<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="background_color_inherit" eval="False"/> |
|||
<field name="background_color_inherit" eval="False" /> |
|||
<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> |
|||
</record> |
|||
|
|||
<record id="mis_style_hidden" model="mis.report.style"> |
|||
<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 id="mis_style_good" model="mis.report.style"> |
|||
<field name="name">Cash Flow - Good</field> |
|||
<field name="color_inherit" eval="False"/> |
|||
<field name="color_inherit" eval="False" /> |
|||
<field name="color">#005700</field> |
|||
</record> |
|||
|
|||
<record id="mis_style_bad" model="mis.report.style"> |
|||
<field name="name">Cash Flow - Bad</field> |
|||
<field name="color_inherit" eval="False"/> |
|||
<field name="color_inherit" eval="False" /> |
|||
<field name="color">#7A0000</field> |
|||
</record> |
|||
|
|||
</odoo> |
@ -1,48 +1,36 @@ |
|||
# Copyright 2019 ADHOC SA |
|||
# 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 |
|||
|
|||
|
|||
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( |
|||
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, |
|||
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( |
|||
'res.company', |
|||
string='Company', |
|||
"res.company", |
|||
string="Company", |
|||
required=True, |
|||
default=lambda self: self.env.user.company_id.id, |
|||
index=True, |
|||
) |
|||
|
|||
@api.multi |
|||
@api.constrains('company_id', 'account_id') |
|||
@api.constrains("company_id", "account_id") |
|||
def _check_company_id_account_id(self): |
|||
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.") |
|||
) |
@ -1,27 +1,23 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<?xml version="1.0" encoding="utf-8" ?> |
|||
<!-- Copyright 2019 ADHOC SA |
|||
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). --> |
|||
|
|||
<odoo> |
|||
|
|||
<record model="ir.model.access" id="mis_cash_flow_access_name"> |
|||
<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 model="ir.model.access" id="mis_cash_flow_forecast_line_access_name"> |
|||
<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> |
|||
|
|||
</odoo> |
@ -1,14 +1,15 @@ |
|||
<odoo> |
|||
|
|||
<record id="view_account_form" model="ir.ui.view"> |
|||
<field name="model">account.account</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="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> |
|||
</record> |
|||
|
|||
</odoo> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue