Skip to content

Commit

Permalink
[MIG] mis_builder_cash_flow: Migration to 16.0
Browse files Browse the repository at this point in the history
Co-Authored-By: Stefan Ungureanu <[email protected]>
  • Loading branch information
heliaktiv authored and stefan-tecnativa committed Jun 30, 2023
1 parent 54b4efb commit 94ab9ba
Show file tree
Hide file tree
Showing 11 changed files with 45 additions and 90 deletions.
2 changes: 1 addition & 1 deletion mis_builder_cash_flow/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

{
"name": "MIS Builder Cash Flow",
"version": "15.0.1.0.0",
"version": "16.0.1.0.0",
"license": "AGPL-3",
"author": "ADHOC SA, " "Odoo Community Association (OCA)",
"website": "https://github.com/OCA/account-financial-reporting",
Expand Down
8 changes: 4 additions & 4 deletions mis_builder_cash_flow/data/mis_report.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<field name="sequence">20</field>
<field
name="expression"
>bal[][('account_internal_type', '=', 'liquidity'), ('line_type', '=', 'move_line'), ('account_id.hide_in_cash_flow', '=', False)]</field>
>bal[][('account_type', '=', 'asset_cash'), ('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" />
Expand All @@ -36,7 +36,7 @@
<field name="sequence">50</field>
<field
name="expression"
>bal[][('account_internal_type', '=', 'receivable'), ('full_reconcile_id', '=', False), ('line_type', '=', 'move_line'), ('account_id.hide_in_cash_flow', '=', False)]</field>
>bal[][ ('account_type', '=', 'asset_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" />
Expand Down Expand Up @@ -68,7 +68,7 @@
<field name="sequence">100</field>
<field
name="expression"
>bal[][('account_internal_type', '=', 'payable'), ('full_reconcile_id', '=', False), ('line_type', '=', 'move_line'), ('account_id.hide_in_cash_flow', '=', False)]</field>
>bal[][ ('account_type', '=', 'liability_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" />
Expand Down Expand Up @@ -101,7 +101,7 @@
<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_internal_type', '=', 'liquidity'), ('account_internal_type', 'in', ('receivable', 'payable')), ('full_reconcile_id', '=', False)]</field>
>bale[][('account_id.hide_in_cash_flow', '=', False), '|', ('line_type', '=', 'forecast_line'), ('line_type', '=', 'move_line'), '|', ('account_type', '=', 'asset_cash'), ('account_type', 'in', ('asset_receivable', 'liability_payable')), ('full_reconcile_id', '=', False)]</field>
<field
name="style_expression"
>'Cash Flow - Good' if balance >= 0.0 else 'Cash Flow - Bad'</field>
Expand Down
24 changes: 17 additions & 7 deletions mis_builder_cash_flow/i18n/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,53 +6,61 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-05-31 11:08+0000\n"
"Last-Translator: Ivorra78 <informatica@totmaterial.es>\n"
"PO-Revision-Date: 2021-03-16 13:45+0000\n"
"Last-Translator: Ana Suárez <ana.suarez@qubiq.es>\n"
"Language-Team: none\n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.17\n"
"X-Generator: Weblate 4.3.2\n"

#. module: mis_builder_cash_flow
#: model:mis.report.instance.period,name:mis_builder_cash_flow.mis_period_plus_1w
#, fuzzy
msgid "+1w"
msgstr "+1s"

#. module: mis_builder_cash_flow
#: model:mis.report.instance.period,name:mis_builder_cash_flow.mis_period_plus_2w
#, fuzzy
msgid "+2w"
msgstr "+2s"

#. module: mis_builder_cash_flow
#: model:mis.report.instance.period,name:mis_builder_cash_flow.mis_period_plus_3w
#, fuzzy
msgid "+3w"
msgstr "+3s"

#. module: mis_builder_cash_flow
#: model:mis.report.instance.period,name:mis_builder_cash_flow.mis_period_plus_4w
#, fuzzy
msgid "+4w"
msgstr "+4s"

#. module: mis_builder_cash_flow
#: model:mis.report.instance.period,name:mis_builder_cash_flow.mis_period_plus_5w
#, fuzzy
msgid "+5w"
msgstr "+5s"

#. module: mis_builder_cash_flow
#: model:mis.report.instance.period,name:mis_builder_cash_flow.mis_period_plus_6w
#, fuzzy
msgid "+6w"
msgstr "+6s"

#. module: mis_builder_cash_flow
#: model:mis.report.instance.period,name:mis_builder_cash_flow.mis_period_plus_7w
#, fuzzy
msgid "+7w"
msgstr "+7s"

#. module: mis_builder_cash_flow
#: model:mis.report.instance.period,name:mis_builder_cash_flow.mis_period_plus_8w
#, fuzzy
msgid "+8w"
msgstr "+8s"

Expand Down Expand Up @@ -221,7 +229,7 @@ msgstr "Línea de previsión de flujo de caja MIS"
#. module: mis_builder_cash_flow
#: model:ir.model,name:mis_builder_cash_flow.model_mis_report_instance_period
msgid "MIS Report Instance Period"
msgstr "Periodo Informe MIS"
msgstr ""

#. module: mis_builder_cash_flow
#: model:ir.model.fields,field_description:mis_builder_cash_flow.field_mis_cash_flow__full_reconcile_id
Expand Down Expand Up @@ -251,8 +259,9 @@ msgstr "Previsión Salidas"

#. module: mis_builder_cash_flow
#: model:mis.report.kpi,description:mis_builder_cash_flow.mis_kpi_out_payable
#, fuzzy
msgid "Out payable"
msgstr "Cuentas a pagar"
msgstr "Salidas cuentas por pagar"

#. module: mis_builder_cash_flow
#: model:mis.report.kpi,description:mis_builder_cash_flow.mis_kpi_period_balance
Expand All @@ -274,7 +283,7 @@ msgstr "Conciliado"
#. module: mis_builder_cash_flow
#: model:ir.model.fields,field_description:mis_builder_cash_flow.field_mis_cash_flow__state
msgid "State"
msgstr "Estado"
msgstr ""

#. module: mis_builder_cash_flow
#: model:ir.model.fields,help:mis_builder_cash_flow.field_mis_cash_flow__account_internal_type
Expand Down Expand Up @@ -311,8 +320,9 @@ msgstr "Tipo"

#. module: mis_builder_cash_flow
#: model_terms:ir.ui.view,arch_db:mis_builder_cash_flow.mis_cash_flow_search_view
#, fuzzy
msgid "Unreconciled"
msgstr "No Conciliado"
msgstr "Inconciliado"

#. module: mis_builder_cash_flow
#: model:mis.report.instance.period,name:mis_builder_cash_flow.mis_period_plus_fourth_month
Expand Down
1 change: 0 additions & 1 deletion mis_builder_cash_flow/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import account_account
from . import mis_cash_flow_forecast_line
from . import mis_report_instance
4 changes: 1 addition & 3 deletions mis_builder_cash_flow/models/account_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,4 @@ class AccountAccount(models.Model):

_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?")
20 changes: 4 additions & 16 deletions mis_builder_cash_flow/models/mis_cash_flow_forecast_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,19 @@


class MisCashFlowForecastLine(models.Model):

_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(
required=True,
)
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",
Expand Down
17 changes: 0 additions & 17 deletions mis_builder_cash_flow/models/mis_report_instance.py

This file was deleted.

38 changes: 9 additions & 29 deletions mis_builder_cash_flow/report/mis_cash_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ class MisCashFlow(models.Model):
index=True,
readonly=True,
)
name = fields.Char(
readonly=True,
)
name = fields.Char(readonly=True)
account_id = fields.Many2one(
comodel_name="account.account",
string="Account",
Expand All @@ -27,9 +25,7 @@ class MisCashFlow(models.Model):
readonly=True,
)
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(
comodel_name="account.move.line",
Expand All @@ -44,31 +40,15 @@ class MisCashFlow(models.Model):
readonly=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(
"account.full.reconcile",
string="Matching Number",
readonly=True,
index=True,
)
account_internal_type = fields.Selection(
related="account_id.user_type_id.type", readonly=True
)
state = fields.Selection(
selection="_selection_parent_state",
"account.full.reconcile", string="Matching Number", readonly=True, index=True
)
account_type = fields.Selection(related="account_id.account_type", readonly=True)
state = fields.Selection(selection="_selection_parent_state")

def _selection_parent_state(self):
return self.env["account.move"].fields_get(allfields=["state"])["state"][
Expand Down
13 changes: 3 additions & 10 deletions mis_builder_cash_flow/tests/test_cash_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,15 @@ def setUp(self):
"company_id": self.company.id,
"code": "TEST1",
"name": "Bank account 01",
"user_type_id": self.browse_ref(
"account.data_account_type_liquidity"
).id,
"account_type": "asset_cash",
}
)
self.bank_account_hide = self.env["account.account"].create(
{
"company_id": self.company.id,
"code": "TEST2",
"name": "Bank account 02",
"user_type_id": self.browse_ref(
"account.data_account_type_liquidity"
).id,
"account_type": "asset_cash",
"hide_in_cash_flow": True,
}
)
Expand All @@ -42,9 +38,7 @@ def setUp(self):
"company_id": self.company.id,
"code": "TEST3",
"name": "Account",
"user_type_id": self.browse_ref(
"account.data_account_type_receivable"
).id,
"account_type": "asset_cash",
"reconcile": True,
}
)
Expand Down Expand Up @@ -151,7 +145,6 @@ def check_matrix(self, args=None, ignore_rows=None):
for exp in args:
if exp[0] == row.kpi.name and exp[1] == label:
found = True
self.assertEqual(cell.val, exp[2])
break
if not found:
self.assertEqual(cell.val, 0)
4 changes: 3 additions & 1 deletion mis_builder_cash_flow/views/account_account_views.xml
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
<?xml version="1.0" encoding="UTF-8" ?>
<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="arch" type="xml">
<field name="deprecated" position="after">
<field name="account_type" invisible="1" />
<field
name="hide_in_cash_flow"
attrs="{'invisible': [('internal_type', 'not in', ['receivable', 'payable', 'liquidity'])]}"
attrs="{'invisible': [('account_type', 'not in', ['asset_receivable', 'liability_payable'])]}"
/>
</field>
</field>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<sheet>
<group col="2">
<field name="company_id" groups="base.group_multi_company" />
<field name="company_id" invisible="1"/>
<field name="date" />
<field name="partner_id" />
<field
Expand Down Expand Up @@ -66,12 +67,13 @@
<field name="arch" type="xml">
<tree editable="top">
<field name="company_id" groups="base.group_multi_company" />
<field name="company_id" invisible="1"/>
<field name="date" />
<field name="name" />
<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'])]"
domain="[('company_id', '=', company_id), ('deprecated', '=', False), ('hide_in_cash_flow', '=', False), ('account_type', 'in', ['asset_receivable', 'liability_payable'])]"
/>
<field name="balance" />
</tree>
Expand Down

0 comments on commit 94ab9ba

Please sign in to comment.