[MIG] account_bank_statement_import_move_line: Migration to 13.0

Co-authored-by: Pedro Gonzalez <pegonzalezs@gmail.com>
Co-authored-by: Joao Marques <joao.marques@tecnativa.com>
This commit is contained in:
Pedro Gonzalez
2019-12-08 12:37:46 +01:00
committed by João Marques
parent d33d86bd30
commit fdc1ade91a
8 changed files with 32 additions and 28 deletions

View File

@@ -14,13 +14,13 @@ Bank statement import move lines
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3 :alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fbank--statement--import-lightgray.png?logo=github .. |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 :alt: OCA/bank-statement-import
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png .. |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 :alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png .. |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 :alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5| |badge1| |badge2| |badge3| |badge4| |badge5|
@@ -61,7 +61,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/bank-statement-import/issues>`_. 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. 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 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. Do not contact contributors directly about support or help with technical issues.
@@ -80,6 +80,9 @@ Contributors
* Luis M. Ontalba * Luis M. Ontalba
* Victor M.M. Torres * Victor M.M. Torres
* João Marques
* Pedro Gonzalez <pegonzalezs@gmail.com>
Maintainers Maintainers
~~~~~~~~~~~ ~~~~~~~~~~~
@@ -102,6 +105,6 @@ Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
|maintainer-pedrobaeza| |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. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@@ -3,13 +3,13 @@
{ {
"name": "Bank statement import move lines", "name": "Bank statement import move lines",
"version": "12.0.1.0.0", "version": "13.0.1.0.0",
"category": "Accounting", "category": "Accounting",
"summary": "Import journal items into bank statement", "summary": "Import journal items into bank statement",
"author": "Tecnativa, " "Odoo Community Association (OCA)", "author": "Tecnativa, " "Odoo Community Association (OCA)",
"maintainers": ["pedrobaeza"], "maintainers": ["pedrobaeza"],
"website": "https://github.com/OCA/bank-statement-import", "website": "https://github.com/OCA/bank-statement-import",
"depends": ["account",], "depends": ["account"],
"data": [ "data": [
"wizards/account_statement_line_create_view.xml", "wizards/account_statement_line_create_view.xml",
"views/account_bank_statement_view.xml", "views/account_bank_statement_view.xml",

View File

@@ -4,7 +4,7 @@
# #
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 12.0\n" "Project-Id-Version: Odoo Server 13.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"Last-Translator: <>\n" "Last-Translator: <>\n"
"Language-Team: \n" "Language-Team: \n"

View File

@@ -1,13 +1,12 @@
# Copyright 2017 Tecnativa - Luis M. Ontalba # Copyright 2017 Tecnativa - Luis M. Ontalba
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html # 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): class AccountMoveLine(models.Model):
_inherit = "account.move.line" _inherit = "account.move.line"
@api.multi
def _prepare_statement_line_vals(self, statement): def _prepare_statement_line_vals(self, statement):
self.ensure_one() self.ensure_one()
amount = 0.0 amount = 0.0
@@ -27,7 +26,6 @@ class AccountMoveLine(models.Model):
} }
return vals return vals
@api.multi
def create_statement_line_from_move_line(self, statement): def create_statement_line_from_move_line(self, statement):
abslo = self.env["account.bank.statement.line"] abslo = self.env["account.bank.statement.line"]
for mline in self: for mline in self:

View File

@@ -2,3 +2,6 @@
* Luis M. Ontalba * Luis M. Ontalba
* Victor M.M. Torres * Victor M.M. Torres
* João Marques
* Pedro Gonzalez <pegonzalezs@gmail.com>

View File

@@ -367,7 +367,7 @@ ul.auto-toc {
!! This file is generated by oca-gen-addon-readme !! !! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !! !! 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 <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 filtering, selecting and importing lines form journal items into the bank
statement.</p> statement.</p>
@@ -412,7 +412,7 @@ lines filtered by the criteria.</li>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/bank-statement-import/issues">GitHub Issues</a>. <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. 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 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> <p>Do not contact contributors directly about support or help with technical issues.</p>
</div> </div>
<div class="section" id="credits"> <div class="section" id="credits">
@@ -429,8 +429,10 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
<li><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a>:<ul> <li><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a>:<ul>
<li>Luis M. Ontalba</li> <li>Luis M. Ontalba</li>
<li>Victor M.M. Torres</li> <li>Victor M.M. Torres</li>
<li>João Marques</li>
</ul> </ul>
</li> </li>
<li>Pedro Gonzalez &lt;<a class="reference external" href="mailto:pegonzalezs&#64;gmail.com">pegonzalezs&#64;gmail.com</a>&gt;</li>
</ul> </ul>
</div> </div>
<div class="section" id="maintainers"> <div class="section" id="maintainers">
@@ -442,7 +444,7 @@ mission is to support the collaborative development of Odoo features and
promote its widespread use.</p> promote its widespread use.</p>
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</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><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> <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>
</div> </div>

View File

@@ -9,9 +9,11 @@ class TestAccountBankStatementImportMoveLine(common.SavepointCase):
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
super(TestAccountBankStatementImportMoveLine, cls).setUpClass() super(TestAccountBankStatementImportMoveLine, cls).setUpClass()
cls.account_type = cls.env["account.account.type"].create( 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( cls.a_receivable = cls.env["account.account"].create(
{ {
"code": "TAA", "code": "TAA",
@@ -21,12 +23,12 @@ class TestAccountBankStatementImportMoveLine(common.SavepointCase):
} }
) )
cls.partner = cls.env["res.partner"].create( 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( 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", "name": "Test Invoice 3",
"partner_id": cls.partner.id, "partner_id": cls.partner.id,
@@ -51,13 +53,12 @@ class TestAccountBankStatementImportMoveLine(common.SavepointCase):
) )
def test_global(self): def test_global(self):
self.invoice.action_invoice_open() self.invoice.post()
self.assertTrue(self.invoice.move_id) self.assertTrue(self.invoice.id)
self.invoice.move_id.post()
wizard_o = self.env["account.statement.line.create"] wizard_o = self.env["account.statement.line.create"]
context = wizard_o._context.copy() context = wizard_o._context.copy()
context.update( 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( wizard = wizard_o.with_context(context).create(
{ {

View File

@@ -16,13 +16,13 @@ class AccountStatementLineCreate(models.TransientModel):
) )
journal_ids = fields.Many2many("account.journal", string="Journals Filter") journal_ids = fields.Many2many("account.journal", string="Journals Filter")
target_move = fields.Selection( target_move = fields.Selection(
[("posted", "All Posted Entries"), ("all", "All Entries"),], [("posted", "All Posted Entries"), ("all", "All Entries")],
string="Target Moves", string="Target Moves",
) )
allow_blocked = fields.Boolean(string="Allow Litigation Move Lines") allow_blocked = fields.Boolean(string="Allow Litigation Move Lines")
invoice = fields.Boolean(string="Linked to an Invoice or Refund") invoice = fields.Boolean(string="Linked to an Invoice or Refund")
date_type = fields.Selection( date_type = fields.Selection(
[("due", "Due Date"), ("move", "Move Date"),], [("due", "Due Date"), ("move", "Move Date")],
string="Type of Date Filter", string="Type of Date Filter",
required=True, required=True,
) )
@@ -51,7 +51,6 @@ class AccountStatementLineCreate(models.TransientModel):
) )
return res return res
@api.multi
def _prepare_move_line_domain(self): def _prepare_move_line_domain(self):
self.ensure_one() self.ensure_one()
domain = [ domain = [
@@ -79,7 +78,7 @@ class AccountStatementLineCreate(models.TransientModel):
elif self.date_type == "move": elif self.date_type == "move":
domain.append(("date", "<=", self.move_date)) domain.append(("date", "<=", self.move_date))
if self.invoice: if self.invoice:
domain.append(("invoice_id", "!=", False)) domain.append(("move_id", "!=", False))
paylines = self.env["account.payment"].search( paylines = self.env["account.payment"].search(
[ [
("state", "in", ("draft", "posted", "sent")), ("state", "in", ("draft", "posted", "sent")),
@@ -91,7 +90,6 @@ class AccountStatementLineCreate(models.TransientModel):
domain += [("id", "not in", move_in_payment_ids)] domain += [("id", "not in", move_in_payment_ids)]
return domain return domain
@api.multi
def populate(self): def populate(self):
domain = self._prepare_move_line_domain() domain = self._prepare_move_line_domain()
lines = self.env["account.move.line"].search(domain) lines = self.env["account.move.line"].search(domain)
@@ -123,7 +121,6 @@ class AccountStatementLineCreate(models.TransientModel):
res = {"domain": {"move_line_ids": domain}} res = {"domain": {"move_line_ids": domain}}
return res return res
@api.multi
def create_statement_lines(self): def create_statement_lines(self):
for rec in self: for rec in self:
if rec.move_line_ids and rec.statement_id: if rec.move_line_ids and rec.statement_id: