Skip to content

Commit

Permalink
[MIG] bank_statement_check_number: Migration to 16.0
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexPForgeFlow committed Nov 20, 2023
1 parent 87e08db commit 6fff0db
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 24 deletions.
4 changes: 2 additions & 2 deletions bank_statement_check_number/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
{
"name": "Bank Statement Check Number",
"summary": "Add the check number in the bank statements",
"version": "14.0.1.0.0",
"depends": ["account_move_line_check_number"],
"version": "16.0.1.0.0",
"depends": ["account_move_line_check_number", "account_statement_base"],
"author": "Ecosoft, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/account-reconcile",
"category": "Accounting & Finance",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ class AccountBankStatementLine(models.Model):
_inherit = "account.bank.statement.line"

check_number = fields.Char(
string="Check Number",
copy=False,
index=True,
)
Expand Down
1 change: 1 addition & 0 deletions bank_statement_check_number/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import test_check_number
39 changes: 39 additions & 0 deletions bank_statement_check_number/tests/test_check_number.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
from odoo.tests import tagged

from odoo.addons.account.tests.common import AccountTestInvoicingCommon


@tagged("post_install", "-at_install")
class TestCheckNumber(AccountTestInvoicingCommon):
@classmethod
def setUpClass(cls, chart_template_ref=None):
super().setUpClass(chart_template_ref=chart_template_ref)

cls.bank_journal = cls.company_data["default_journal_bank"]
cls.currency = cls.currency_data["currency"]
cls.statement = cls.env["account.bank.statement"].create(
{
"name": "test_statement",
"line_ids": [
(
0,
0,
{
"date": "2019-01-01",
"payment_ref": "line_1",
"partner_id": cls.partner_a.id,
"foreign_currency_id": cls.currency.id,
"journal_id": cls.bank_journal.id,
"amount": 1250.0,
"amount_currency": 2500.0,
"check_number": "111",
},
),
],
}
)
cls.statement_line = cls.statement.line_ids

def test_01_check_number(self):

self.assertEqual(self.statement_line.check_number, "111")
40 changes: 19 additions & 21 deletions bank_statement_check_number/views/account_bank_statement_views.xml
Original file line number Diff line number Diff line change
@@ -1,32 +1,30 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="view_bank_statement_form" model="ir.ui.view">
<record id="view_bank_statement_tree" model="ir.ui.view">
<field name="name">account.bank.statement.form</field>
<field name="model">account.bank.statement</field>
<field name="inherit_id" ref="account.view_bank_statement_form" />
<field name="model">account.bank.statement.line</field>
<field
name="inherit_id"
ref="account_statement_base.account_bank_statement_line_tree"
/>
<field name="arch" type="xml">
<xpath
expr="//field[@name='line_ids']/tree/field[@name='date']"
position="after"
>
<field
name="check_number"
optional="show"
attrs="{'readonly': [('parent.state', '!=', 'open')]}"
/>
</xpath>
<field name="date" position="after">
<field name="check_number" optional="show" />
</field>
</field>
</record>

<record id="view_bank_statement_line_tree" model="ir.ui.view">
<field name="name">account.bank.statement.line.tree</field>
<record id="account_bank_statement_line_form" model="ir.ui.view">
<field name="name">account.bank.statement.form</field>
<field name="model">account.bank.statement.line</field>
<field name="priority">8</field>
<field name="inherit_id" ref="account.view_bank_statement_line_tree" />
<field
name="inherit_id"
ref="account_statement_base.account_bank_statement_line_form"
/>
<field name="arch" type="xml">
<xpath expr="//field[@name='date']" position="after">
<field name="check_number" />
</xpath>
<field name="date" position="after">
<field name="check_number" optional="show" />
</field>
</field>
</record>

</odoo>

0 comments on commit 6fff0db

Please sign in to comment.