[MIG] account_bank_statement_import_move_line: Migration to v12

This commit is contained in:
Victor M.M. Torres
2019-08-20 18:26:20 +02:00
committed by Pedro M. Baeza
parent a22ec2a2b6
commit dc40c9cb1b
9 changed files with 92 additions and 46 deletions

View File

@@ -7,20 +7,20 @@ Bank statement import move lines
!! changes will be overwritten. !! !! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png .. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png
:target: https://odoo-community.org/page/development-status :target: https://odoo-community.org/page/development-status
:alt: Beta :alt: Production/Stable
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png .. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
: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/11.0/account_bank_statement_import_move_line :target: https://github.com/OCA/bank-statement-import/tree/12.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-11-0/bank-statement-import-11-0-account_bank_statement_import_move_line :target: https://translation.odoo-community.org/projects/bank-statement-import-12-0/bank-statement-import-12-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/11.0 :target: https://runbot.odoo-community.org/runbot/174/12.0
:alt: Try me on Runbot :alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5| |badge1| |badge2| |badge3| |badge4| |badge5|
@@ -34,6 +34,15 @@ statement.
.. contents:: .. contents::
:local: :local:
Configuration
=============
To configure this module, you need to:
#. Go to *Settings > Users & Companies > Users*.
#. Open the user that needs to use this feature.
#. Mark the check *Show Full Accounting Features*.
Usage Usage
===== =====
@@ -52,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:%2011.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:%2012.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.
@@ -67,7 +76,10 @@ Authors
Contributors Contributors
~~~~~~~~~~~~ ~~~~~~~~~~~~
* Luis M. Ontalba luis.martinez@tecnativa.com> * `Tecnativa <https://www.tecnativa.com>`_:
* Luis M. Ontalba
* Victor M.M. Torres
Maintainers Maintainers
~~~~~~~~~~~ ~~~~~~~~~~~
@@ -82,6 +94,14 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and mission is to support the collaborative development of Odoo features and
promote its widespread use. promote its widespread use.
This module is part of the `OCA/bank-statement-import <https://github.com/OCA/bank-statement-import/tree/11.0/account_bank_statement_import_move_line>`_ project on GitHub. .. |maintainer-pedrobaeza| image:: https://github.com/pedrobaeza.png?size=40px
:target: https://github.com/pedrobaeza
:alt: pedrobaeza
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.
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,11 +3,12 @@
{ {
'name': 'Bank statement import move lines', 'name': 'Bank statement import move lines',
'version': '11.0.1.0.0', 'version': '12.0.1.0.0',
'category': 'Accounting', 'category': 'Accounting',
'summary': 'Import journal items into bank statement', 'summary': 'Import journal items into bank statement',
'author': 'Tecnativa, ' 'author': 'Tecnativa, '
'Odoo Community Association (OCA)', 'Odoo Community Association (OCA)',
'maintainers': ['pedrobaeza'],
'website': 'https://www.tecnativa.com', 'website': 'https://www.tecnativa.com',
'depends': [ 'depends': [
'account', 'account',
@@ -17,6 +18,7 @@
'views/account_bank_statement_view.xml', 'views/account_bank_statement_view.xml',
], ],
'license': 'AGPL-3', 'license': 'AGPL-3',
'development_status': 'Production/Stable',
'installable': True, 'installable': True,
'auto_install': False, 'auto_install': False,
} }

View File

@@ -10,7 +10,6 @@ class AccountMoveLine(models.Model):
@api.multi @api.multi
def _prepare_statement_line_vals(self, statement): def _prepare_statement_line_vals(self, statement):
self.ensure_one() self.ensure_one()
assert statement, 'Missing statement'
amount = 0.0 amount = 0.0
if self.debit > 0: if self.debit > 0:
amount = self.debit amount = self.debit
@@ -25,7 +24,7 @@ class AccountMoveLine(models.Model):
'date': self.date_maturity, 'date': self.date_maturity,
'amount_currency': self.amount_currency, 'amount_currency': self.amount_currency,
'currency_id': self.currency_id.id, 'currency_id': self.currency_id.id,
} }
return vals return vals
@api.multi @api.multi

View File

@@ -0,0 +1,5 @@
To configure this module, you need to:
#. Go to *Settings > Users & Companies > Users*.
#. Open the user that needs to use this feature.
#. Mark the check *Show Full Accounting Features*.

View File

@@ -1 +1,4 @@
* Luis M. Ontalba luis.martinez@tecnativa.com> * `Tecnativa <https://www.tecnativa.com>`_:
* Luis M. Ontalba
* Victor M.M. Torres

View File

@@ -367,25 +367,35 @@ 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="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.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/11.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-11-0/bank-statement-import-11-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/11.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/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>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>
<p><strong>Table of contents</strong></p> <p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents"> <div class="contents local topic" id="contents">
<ul class="simple"> <ul class="simple">
<li><a class="reference internal" href="#usage" id="id1">Usage</a></li> <li><a class="reference internal" href="#configuration" id="id1">Configuration</a></li>
<li><a class="reference internal" href="#bug-tracker" id="id2">Bug Tracker</a></li> <li><a class="reference internal" href="#usage" id="id2">Usage</a></li>
<li><a class="reference internal" href="#credits" id="id3">Credits</a><ul> <li><a class="reference internal" href="#bug-tracker" id="id3">Bug Tracker</a></li>
<li><a class="reference internal" href="#authors" id="id4">Authors</a></li> <li><a class="reference internal" href="#credits" id="id4">Credits</a><ul>
<li><a class="reference internal" href="#contributors" id="id5">Contributors</a></li> <li><a class="reference internal" href="#authors" id="id5">Authors</a></li>
<li><a class="reference internal" href="#maintainers" id="id6">Maintainers</a></li> <li><a class="reference internal" href="#contributors" id="id6">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="id7">Maintainers</a></li>
</ul> </ul>
</li> </li>
</ul> </ul>
</div> </div>
<div class="section" id="configuration">
<h1><a class="toc-backref" href="#id1">Configuration</a></h1>
<p>To configure this module, you need to:</p>
<ol class="arabic simple">
<li>Go to <em>Settings &gt; Users &amp; Companies &gt; Users</em>.</li>
<li>Open the user that needs to use this feature.</li>
<li>Mark the check <em>Show Full Accounting Features</em>.</li>
</ol>
</div>
<div class="section" id="usage"> <div class="section" id="usage">
<h1><a class="toc-backref" href="#id1">Usage</a></h1> <h1><a class="toc-backref" href="#id2">Usage</a></h1>
<ol class="arabic simple"> <ol class="arabic simple">
<li>Go to Invoicing &gt; Dashboard.</li> <li>Go to Invoicing &gt; Dashboard.</li>
<li>Create a new bank statement from a bank journal.</li> <li>Create a new bank statement from a bank journal.</li>
@@ -398,35 +408,41 @@ lines filtered by the criteria.</li>
</ol> </ol>
</div> </div>
<div class="section" id="bug-tracker"> <div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#id2">Bug Tracker</a></h1> <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>. <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:%2011.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:%2012.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">
<h1><a class="toc-backref" href="#id3">Credits</a></h1> <h1><a class="toc-backref" href="#id4">Credits</a></h1>
<div class="section" id="authors"> <div class="section" id="authors">
<h2><a class="toc-backref" href="#id4">Authors</a></h2> <h2><a class="toc-backref" href="#id5">Authors</a></h2>
<ul class="simple"> <ul class="simple">
<li>Tecnativa</li> <li>Tecnativa</li>
</ul> </ul>
</div> </div>
<div class="section" id="contributors"> <div class="section" id="contributors">
<h2><a class="toc-backref" href="#id5">Contributors</a></h2> <h2><a class="toc-backref" href="#id6">Contributors</a></h2>
<ul class="simple"> <ul class="simple">
<li>Luis M. Ontalba <a class="reference external" href="mailto:luis.martinez&#64;tecnativa.com">luis.martinez&#64;tecnativa.com</a>&gt;</li> <li><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a>:<ul>
<li>Luis M. Ontalba</li>
<li>Victor M.M. Torres</li>
</ul>
</li>
</ul> </ul>
</div> </div>
<div class="section" id="maintainers"> <div class="section" id="maintainers">
<h2><a class="toc-backref" href="#id6">Maintainers</a></h2> <h2><a class="toc-backref" href="#id7">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p> <p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a> <a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose <p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and mission is to support the collaborative development of Odoo features and
promote its widespread use.</p> promote its widespread use.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/bank-statement-import/tree/11.0/account_bank_statement_import_move_line">OCA/bank-statement-import</a> project on GitHub.</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>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

@@ -11,7 +11,8 @@
<button name="%(account_statement_line_create_action)d" <button name="%(account_statement_line_create_action)d"
string="Import Journal Items" type="action" string="Import Journal Items" type="action"
class="oe_highlight" class="oe_highlight"
attrs="{'invisible':[('state', '!=', 'open')]}"/> attrs="{'invisible':[('state', '!=', 'open')]}"
groups="account.group_account_user"/>
</field> </field>
</field> </field>
</record> </record>

View File

@@ -36,19 +36,18 @@ class AccountStatementLineCreate(models.TransientModel):
@api.model @api.model
def default_get(self, field_list): def default_get(self, field_list):
res = super(AccountStatementLineCreate, self).default_get(field_list) res = super().default_get(field_list)
context = self.env.context active_model = self.env.context.get('active_model')
assert context.get('active_model') == 'account.bank.statement',\ if active_model == 'account.bank.statement':
'active_model should be account.bank.statement' statement = self.env[active_model].browse(
assert context.get('active_id'), 'Missing active_id in context !' self.env.context.get('active_id')).exists()
statement = self.env[ if statement:
'account.bank.statement'].browse(context['active_id']) res.update({
res.update({ 'target_move': 'posted',
'target_move': 'posted', 'date_type': 'due',
'date_type': 'due', 'invoice': True,
'invoice': True, 'statement_id': statement.id,
'statement_id': statement.id, })
})
return res return res
@api.multi @api.multi
@@ -112,7 +111,8 @@ class AccountStatementLineCreate(models.TransientModel):
@api.multi @api.multi
def create_statement_lines(self): def create_statement_lines(self):
if self.move_line_ids: for rec in self:
self.move_line_ids.create_statement_line_from_move_line( if rec.move_line_ids and rec.statement_id:
self.statement_id) rec.move_line_ids.create_statement_line_from_move_line(
rec.statement_id)
return True return True

View File

@@ -21,7 +21,7 @@
<field name="target_move" widget="radio"/> <field name="target_move" widget="radio"/>
<field name="invoice"/> <field name="invoice"/>
<field name="allow_blocked"/> <field name="allow_blocked"/>
<label string="Click on Add All Move Lines to auto-select the move lines matching the above criteria or click on Add an item to manually select the move lines filtered by the above criteria." colspan="2"/> <label for="populate" string="Click on Add All Move Lines to auto-select the move lines matching the above criteria or click on Add an item to manually select the move lines filtered by the above criteria." colspan="2"/>
<button name="populate" type="object" string="Add All Move Lines"/> <button name="populate" type="object" string="Add All Move Lines"/>
</group> </group>
<group name="move_lines" <group name="move_lines"