[MIG] account_check_deposit: Migration to 13.0

This commit is contained in:
ps-tubtim
2020-04-10 13:02:16 +07:00
parent c93debe331
commit 2f23dcedbd
8 changed files with 55 additions and 42 deletions

View File

@@ -14,13 +14,13 @@ Account Check Deposit
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Faccount--financial--tools-lightgray.png?logo=github
:target: https://github.com/OCA/account-financial-tools/tree/12.0/account_check_deposit
:target: https://github.com/OCA/account-financial-tools/tree/13.0/account_check_deposit
:alt: OCA/account-financial-tools
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/account-financial-tools-12-0/account-financial-tools-12-0-account_check_deposit
:target: https://translation.odoo-community.org/projects/account-financial-tools-13-0/account-financial-tools-13-0-account_check_deposit
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/92/12.0
:target: https://runbot.odoo-community.org/runbot/92/13.0
:alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -82,7 +82,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/account-financial-tools/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/account-financial-tools/issues/new?body=module:%20account_check_deposit%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/account-financial-tools/issues/new?body=module:%20account_check_deposit%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.
@@ -109,6 +109,10 @@ Contributors
* Pedro M. Baeza
* `Ecosoft <http://ecosoft.co.th>`__:
* Pimolnat Suntian <pimolnats@ecosoft.co.th>
Maintainers
~~~~~~~~~~~
@@ -122,6 +126,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.
This module is part of the `OCA/account-financial-tools <https://github.com/OCA/account-financial-tools/tree/12.0/account_check_deposit>`_ project on GitHub.
This module is part of the `OCA/account-financial-tools <https://github.com/OCA/account-financial-tools/tree/13.0/account_check_deposit>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@@ -9,8 +9,6 @@
from odoo import _, api, fields, models
from odoo.exceptions import UserError, ValidationError
import odoo.addons.decimal_precision as dp
class AccountCheckDeposit(models.Model):
_name = "account.check.deposit"
@@ -112,14 +110,14 @@ class AccountCheckDeposit(models.Model):
string="Company",
required=True,
states={"done": [("readonly", "=", True)]},
default=lambda self: self.env["res.company"]._company_default_get(),
default=lambda self: self.env.company,
)
total_amount = fields.Float(
compute="_compute_check_deposit",
string="Total Amount",
readonly=True,
store=True,
digits=dp.get_precision("Account"),
digits="Account",
)
check_count = fields.Integer(
compute="_compute_check_deposit",

View File

@@ -8,3 +8,7 @@
* `Tecnativa <https://www.tecnativa.com>`_:
* Pedro M. Baeza
* `Ecosoft <http://ecosoft.co.th>`__:
* Pimolnat Suntian <pimolnats@ecosoft.co.th>

View File

@@ -8,8 +8,8 @@
<record id="check_deposit_rule" model="ir.rule">
<field name="name">Check Deposit multi-company</field>
<field name="model_id" ref="model_account_check_deposit" />
<field
name="domain_force"
>['|', ('company_id', '=', False), ('company_id', 'child_of', [user.company_id.id])]</field>
<field name="domain_force">
['|', ('company_id', '=', False), ('company_id', 'child_of', [user.company_id.id])]
</field>
</record>
</odoo>

View File

@@ -367,7 +367,7 @@ ul.auto-toc {
!! 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="Mature" src="https://img.shields.io/badge/maturity-Mature-brightgreen.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/account-financial-tools/tree/12.0/account_check_deposit"><img alt="OCA/account-financial-tools" src="https://img.shields.io/badge/github-OCA%2Faccount--financial--tools-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/account-financial-tools-12-0/account-financial-tools-12-0-account_check_deposit"><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/92/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="Mature" src="https://img.shields.io/badge/maturity-Mature-brightgreen.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/account-financial-tools/tree/13.0/account_check_deposit"><img alt="OCA/account-financial-tools" src="https://img.shields.io/badge/github-OCA%2Faccount--financial--tools-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/account-financial-tools-13-0/account-financial-tools-13-0-account_check_deposit"><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/92/13.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p>This module allows you to easily manage check deposits : you can select all
the checks you received and create a global deposit for the selected checks.
This module supports multi-currency ; each deposit has a currency and all the
@@ -429,7 +429,7 @@ deposit at the bank. Eventually, validate the deposit and print the report
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/account-financial-tools/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/account-financial-tools/issues/new?body=module:%20account_check_deposit%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/account-financial-tools/issues/new?body=module:%20account_check_deposit%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">
@@ -455,6 +455,10 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
<li>Pedro M. Baeza</li>
</ul>
</li>
<li><a class="reference external" href="http://ecosoft.co.th">Ecosoft</a>:<ul>
<li>Pimolnat Suntian &lt;<a class="reference external" href="mailto:pimolnats&#64;ecosoft.co.th">pimolnats&#64;ecosoft.co.th</a>&gt;</li>
</ul>
</li>
</ul>
</div>
<div class="section" id="maintainers">
@@ -464,7 +468,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/account-financial-tools/tree/12.0/account_check_deposit">OCA/account-financial-tools</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/account-financial-tools/tree/13.0/account_check_deposit">OCA/account-financial-tools</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>

View File

@@ -9,15 +9,12 @@ from odoo.addons.account.tests.account_test_classes import AccountingTestCase
class TestPayment(AccountingTestCase):
def setUp(self):
super(TestPayment, self).setUp()
self.register_payments_model = self.env["account.register.payments"]
super().setUp()
self.register_payments_model = self.env["account.payment.register"]
self.payment_model = self.env["account.payment"]
self.journal_model = self.env["account.journal"]
self.account_model = self.env["account.account"]
self.invoice_model = self.env["account.invoice"]
self.invoice_line_model = self.env["account.invoice.line"]
self.acc_bank_stmt_model = self.env["account.bank.statement"]
self.acc_bank_stmt_line_model = self.env["account.bank.statement.line"]
self.move_model = self.env["account.move"]
self.res_partner_bank_model = self.env["res.partner.bank"]
self.check_deposit_model = self.env["account.check.deposit"]
@@ -131,29 +128,27 @@ class TestPayment(AccountingTestCase):
def create_invoice(self, amount=100, inv_type="out_invoice", currency_id=None):
""" Returns an open invoice """
invoice = self.invoice_model.create(
invoice = self.move_model.create(
{
"type": inv_type,
"partner_id": self.partner_agrolait.id,
"currency_id": currency_id,
"name": inv_type == "out_invoice"
and "invoice to client"
or "invoice to supplier",
"account_id": self.account_receivable.id,
"type": inv_type,
"date_invoice": time.strftime("%Y-%m-%d"),
"invoice_date": time.strftime("%Y-%m-%d"),
"date": time.strftime("%Y-%m-%d"),
"invoice_line_ids": [
(
0,
0,
{
"product_id": self.product.id,
"quantity": 1,
"price_unit": amount,
},
)
],
}
)
self.invoice_line_model.create(
{
"product_id": self.product.id,
"quantity": 1,
"price_unit": amount,
"invoice_id": invoice.id,
"name": "something",
"account_id": self.account_revenue.id,
}
)
invoice.action_invoice_open()
invoice.post()
return invoice
def create_check_deposit(self, move_lines):
@@ -177,12 +172,13 @@ class TestPayment(AccountingTestCase):
inv_1 = self.create_invoice(amount=100, currency_id=self.currency_eur_id)
inv_2 = self.create_invoice(amount=200, currency_id=self.currency_eur_id)
ctx = {"active_model": "account.invoice", "active_ids": [inv_1.id, inv_2.id]}
ctx = {"active_model": "account.move", "active_ids": [inv_1.id, inv_2.id]}
register_payments = self.register_payments_model.with_context(ctx).create(
{
"payment_date": time.strftime("%Y-%m-%d"),
"journal_id": self.check_journal.id,
"payment_method_id": self.payment_method_manual_in.id,
"group_payment": True,
}
)
register_payments.create_payments()
@@ -190,8 +186,8 @@ class TestPayment(AccountingTestCase):
self.assertAlmostEquals(payment.amount, 300)
self.assertEqual(payment.state, "posted")
self.assertEqual(inv_1.state, "paid")
self.assertEqual(inv_2.state, "paid")
self.assertEqual(inv_1.state, "posted")
self.assertEqual(inv_2.state, "posted")
check_aml = payment.move_line_ids.filtered(
lambda r: r.account_id == self.received_check_account_id

View File

@@ -0,0 +1 @@
../../../../account_check_deposit

View File

@@ -0,0 +1,6 @@
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)