Skip to content

Commit

Permalink
[MIG] account_bank_statement_import_move_line: Migration to 13.0
Browse files Browse the repository at this point in the history
Co-authored-by: Pedro Gonzalez <[email protected]>
Co-authored-by: Joao Marques <[email protected]>
  • Loading branch information
2 people authored and Luis D. Lafaurie committed May 4, 2022
1 parent 77762b8 commit 3a6177d
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 28 deletions.
13 changes: 8 additions & 5 deletions account_statement_import_move_line/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ Bank statement import move lines
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fbank--statement--import-lightgray.png?logo=github
:target: https://github.com/OCA/bank-statement-import/tree/12.0/account_bank_statement_import_move_line
:target: https://github.com/OCA/bank-statement-import/tree/13.0/account_bank_statement_import_move_line
:alt: OCA/bank-statement-import
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/bank-statement-import-12-0/bank-statement-import-12-0-account_bank_statement_import_move_line
:target: https://translation.odoo-community.org/projects/bank-statement-import-13-0/bank-statement-import-13-0-account_bank_statement_import_move_line
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/174/12.0
:target: https://runbot.odoo-community.org/runbot/174/13.0
:alt: Try me on Runbot

|badge1| |badge2| |badge3| |badge4| |badge5|
Expand Down Expand Up @@ -61,7 +61,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/bank-statement-import/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/bank-statement-import/issues/new?body=module:%20account_bank_statement_import_move_line%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/bank-statement-import/issues/new?body=module:%20account_bank_statement_import_move_line%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

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

Expand All @@ -80,6 +80,9 @@ Contributors

* Luis M. Ontalba
* Victor M.M. Torres
* João Marques

* Pedro Gonzalez <[email protected]>

Maintainers
~~~~~~~~~~~
Expand All @@ -102,6 +105,6 @@ Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-pedrobaeza|

This module is part of the `OCA/bank-statement-import <https://github.com/OCA/bank-statement-import/tree/12.0/account_bank_statement_import_move_line>`_ project on GitHub.
This module is part of the `OCA/bank-statement-import <https://github.com/OCA/bank-statement-import/tree/13.0/account_bank_statement_import_move_line>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
4 changes: 2 additions & 2 deletions account_statement_import_move_line/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@

{
"name": "Bank statement import move lines",
"version": "12.0.1.0.0",
"version": "13.0.1.0.0",
"category": "Accounting",
"summary": "Import journal items into bank statement",
"author": "Tecnativa, " "Odoo Community Association (OCA)",
"maintainers": ["pedrobaeza"],
"website": "https://github.com/OCA/bank-statement-import",
"depends": ["account",],
"depends": ["account"],
"data": [
"wizards/account_statement_line_create_view.xml",
"views/account_bank_statement_view.xml",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Project-Id-Version: Odoo Server 13.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: <>\n"
"Language-Team: \n"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
# Copyright 2017 Tecnativa - Luis M. Ontalba
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html

from odoo import api, models
from odoo import models


class AccountMoveLine(models.Model):
_inherit = "account.move.line"

@api.multi
def _prepare_statement_line_vals(self, statement):
self.ensure_one()
amount = 0.0
Expand All @@ -27,7 +26,6 @@ def _prepare_statement_line_vals(self, statement):
}
return vals

@api.multi
def create_statement_line_from_move_line(self, statement):
abslo = self.env["account.bank.statement.line"]
for mline in self:
Expand Down
3 changes: 3 additions & 0 deletions account_statement_import_move_line/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@

* Luis M. Ontalba
* Victor M.M. Torres
* João Marques

* Pedro Gonzalez <[email protected]>
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ <h1 class="title">Bank statement import move lines</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Production/Stable" src="https://img.shields.io/badge/maturity-Production%2FStable-green.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/bank-statement-import/tree/12.0/account_bank_statement_import_move_line"><img alt="OCA/bank-statement-import" src="https://img.shields.io/badge/github-OCA%2Fbank--statement--import-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/bank-statement-import-12-0/bank-statement-import-12-0-account_bank_statement_import_move_line"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/174/12.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Production/Stable" src="https://img.shields.io/badge/maturity-Production%2FStable-green.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/bank-statement-import/tree/13.0/account_bank_statement_import_move_line"><img alt="OCA/bank-statement-import" src="https://img.shields.io/badge/github-OCA%2Fbank--statement--import-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/bank-statement-import-13-0/bank-statement-import-13-0-account_bank_statement_import_move_line"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/174/13.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p>This module adds a button to bank statement form view to open a wizard to allow
filtering, selecting and importing lines form journal items into the bank
statement.</p>
Expand Down Expand Up @@ -412,7 +412,7 @@ <h1><a class="toc-backref" href="#id3">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/bank-statement-import/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/bank-statement-import/issues/new?body=module:%20account_bank_statement_import_move_line%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<a class="reference external" href="https://github.com/OCA/bank-statement-import/issues/new?body=module:%20account_bank_statement_import_move_line%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
Expand All @@ -429,8 +429,10 @@ <h2><a class="toc-backref" href="#id6">Contributors</a></h2>
<li><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a>:<ul>
<li>Luis M. Ontalba</li>
<li>Victor M.M. Torres</li>
<li>João Marques</li>
</ul>
</li>
<li>Pedro Gonzalez &lt;<a class="reference external" href="mailto:pegonzalezs&#64;gmail.com">pegonzalezs&#64;gmail.com</a>&gt;</li>
</ul>
</div>
<div class="section" id="maintainers">
Expand All @@ -442,7 +444,7 @@ <h2><a class="toc-backref" href="#id7">Maintainers</a></h2>
promote its widespread use.</p>
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
<p><a class="reference external" href="https://github.com/pedrobaeza"><img alt="pedrobaeza" src="https://github.com/pedrobaeza.png?size=40px" /></a></p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/bank-statement-import/tree/12.0/account_bank_statement_import_move_line">OCA/bank-statement-import</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/bank-statement-import/tree/13.0/account_bank_statement_import_move_line">OCA/bank-statement-import</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ class TestAccountBankStatementImportMoveLine(common.SavepointCase):
@classmethod
def setUpClass(cls):
super(TestAccountBankStatementImportMoveLine, cls).setUpClass()

cls.account_type = cls.env["account.account.type"].create(
{"name": "Test Account Type"}
{"name": "Test Account Type", "type": "other", "internal_group": "asset"}
)

cls.a_receivable = cls.env["account.account"].create(
{
"code": "TAA",
Expand All @@ -21,12 +23,12 @@ def setUpClass(cls):
}
)
cls.partner = cls.env["res.partner"].create(
{"name": "Test Partner 2", "parent_id": False,}
{"name": "Test Partner 2", "parent_id": False}
)
cls.journal = cls.env["account.journal"].create(
{"name": "Test Journal", "type": "bank",}
{"name": "Test Journal", "type": "sale", "code": "TJS0"}
)
cls.invoice = cls.env["account.invoice"].create(
cls.invoice = cls.env["account.move"].create(
{
"name": "Test Invoice 3",
"partner_id": cls.partner.id,
Expand All @@ -51,13 +53,12 @@ def setUpClass(cls):
)

def test_global(self):
self.invoice.action_invoice_open()
self.assertTrue(self.invoice.move_id)
self.invoice.move_id.post()
self.invoice.post()
self.assertTrue(self.invoice.id)
wizard_o = self.env["account.statement.line.create"]
context = wizard_o._context.copy()
context.update(
{"active_model": "account.bank.statement", "active_id": self.statement.id,}
{"active_model": "account.bank.statement", "active_id": self.statement.id}
)
wizard = wizard_o.with_context(context).create(
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ class AccountStatementLineCreate(models.TransientModel):
)
journal_ids = fields.Many2many("account.journal", string="Journals Filter")
target_move = fields.Selection(
[("posted", "All Posted Entries"), ("all", "All Entries"),],
[("posted", "All Posted Entries"), ("all", "All Entries")],
string="Target Moves",
)
allow_blocked = fields.Boolean(string="Allow Litigation Move Lines")
invoice = fields.Boolean(string="Linked to an Invoice or Refund")
date_type = fields.Selection(
[("due", "Due Date"), ("move", "Move Date"),],
[("due", "Due Date"), ("move", "Move Date")],
string="Type of Date Filter",
required=True,
)
Expand Down Expand Up @@ -51,7 +51,6 @@ def default_get(self, field_list):
)
return res

@api.multi
def _prepare_move_line_domain(self):
self.ensure_one()
domain = [
Expand Down Expand Up @@ -79,7 +78,7 @@ def _prepare_move_line_domain(self):
elif self.date_type == "move":
domain.append(("date", "<=", self.move_date))
if self.invoice:
domain.append(("invoice_id", "!=", False))
domain.append(("move_id", "!=", False))
paylines = self.env["account.payment"].search(
[
("state", "in", ("draft", "posted", "sent")),
Expand All @@ -91,7 +90,6 @@ def _prepare_move_line_domain(self):
domain += [("id", "not in", move_in_payment_ids)]
return domain

@api.multi
def populate(self):
domain = self._prepare_move_line_domain()
lines = self.env["account.move.line"].search(domain)
Expand Down Expand Up @@ -123,7 +121,6 @@ def move_line_filters_change(self):
res = {"domain": {"move_line_ids": domain}}
return res

@api.multi
def create_statement_lines(self):
for rec in self:
if rec.move_line_ids and rec.statement_id:
Expand Down

0 comments on commit 3a6177d

Please sign in to comment.