Skip to content

Commit

Permalink
[MIG] account_check_printing_report_base: Migration to 16.0
Browse files Browse the repository at this point in the history
  • Loading branch information
hildickethan-S73 committed Nov 21, 2023
1 parent 4094d85 commit 6bf8c4a
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 117 deletions.
12 changes: 6 additions & 6 deletions account_check_printing_report_base/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Account Check Printing Report Base
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:be02fe72e9fdc9c5e7cf0ae6bfeedd5722a76cb9d6b4bfd49aa211e0debe6834
!! source digest: sha256:bb55783143c1ac5d84c90fa06d598eaaff087b45d912ea989d2b6855892a221d
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
Expand All @@ -17,13 +17,13 @@ Account Check Printing Report Base
: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--payment-lightgray.png?logo=github
:target: https://github.com/OCA/account-payment/tree/15.0/account_check_printing_report_base
:target: https://github.com/OCA/account-payment/tree/16.0/account_check_printing_report_base
:alt: OCA/account-payment
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/account-payment-15-0/account-payment-15-0-account_check_printing_report_base
:target: https://translation.odoo-community.org/projects/account-payment-16-0/account-payment-16-0-account_check_printing_report_base
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/account-payment&target_branch=15.0
:target: https://runboat.odoo-community.org/builds?repo=OCA/account-payment&target_branch=16.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|
Expand Down Expand Up @@ -64,7 +64,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/account-payment/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/account-payment/issues/new?body=module:%20account_check_printing_report_base%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/account-payment/issues/new?body=module:%20account_check_printing_report_base%0Aversion:%2016.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 Down Expand Up @@ -103,6 +103,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-payment <https://github.com/OCA/account-payment/tree/15.0/account_check_printing_report_base>`_ project on GitHub.
This module is part of the `OCA/account-payment <https://github.com/OCA/account-payment/tree/16.0/account_check_printing_report_base>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 1 addition & 1 deletion account_check_printing_report_base/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

{
"name": "Account Check Printing Report Base",
"version": "15.0.1.0.0",
"version": "16.0.1.0.0",
"license": "AGPL-3",
"author": "Eficent,"
"Serpent Consulting Services Pvt. Ltd.,"
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -367,9 +367,9 @@ <h1 class="title">Account Check Printing Report Base</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:be02fe72e9fdc9c5e7cf0ae6bfeedd5722a76cb9d6b4bfd49aa211e0debe6834
!! source digest: sha256:bb55783143c1ac5d84c90fa06d598eaaff087b45d912ea989d2b6855892a221d
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" 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 image-reference" 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 image-reference" href="https://github.com/OCA/account-payment/tree/15.0/account_check_printing_report_base"><img alt="OCA/account-payment" src="https://img.shields.io/badge/github-OCA%2Faccount--payment-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/account-payment-15-0/account-payment-15-0-account_check_printing_report_base"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/account-payment&amp;target_branch=15.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external image-reference" 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 image-reference" 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 image-reference" href="https://github.com/OCA/account-payment/tree/16.0/account_check_printing_report_base"><img alt="OCA/account-payment" src="https://img.shields.io/badge/github-OCA%2Faccount--payment-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/account-payment-16-0/account-payment-16-0-account_check_printing_report_base"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/account-payment&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module provides the basic framework for check printing, and a sample
layout.</p>
<p><strong>Table of contents</strong></p>
Expand Down Expand Up @@ -415,7 +415,7 @@ <h1><a class="toc-backref" href="#toc-entry-4">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/account-payment/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 to smash it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/account-payment/issues/new?body=module:%20account_check_printing_report_base%0Aversion:%2015.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-payment/issues/new?body=module:%20account_check_printing_report_base%0Aversion:%2016.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 Down Expand Up @@ -456,7 +456,7 @@ <h2><a class="toc-backref" href="#toc-entry-8">Maintainers</a></h2>
<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-payment/tree/15.0/account_check_printing_report_base">OCA/account-payment</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/account-payment/tree/16.0/account_check_printing_report_base">OCA/account-payment</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
122 changes: 64 additions & 58 deletions account_check_printing_report_base/tests/test_check_printing_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,113 +10,115 @@


class TestAccountCheckPrintingReportBase(TransactionCase):
def setUp(self):
super().setUp()
self.langs = ("en_US", "es_ES")
self.rl = self.env["res.lang"]
for lang in self.langs:
if not self.rl.search([("code", "=", lang)]):
self.rl.load_lang(lang)
self.account_invoice_model = self.env["account.move"]
self.journal_model = self.env["account.journal"]
self.payment_method_model = self.env["account.payment.method"]
self.account_account_model = self.env["account.account"]
self.payment_model = self.env["account.payment"]
self.report = self.env[
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.langs = ("en_US", "es_ES")
cls.rl = cls.env["res.lang"]
for lang in cls.langs:
if not cls.rl.search([("code", "=", lang)]):
cls.rl.load_lang(lang)
cls.account_invoice_model = cls.env["account.move"]
cls.journal_model = cls.env["account.journal"]
cls.payment_method_model = cls.env["account.payment.method"]
cls.account_account_model = cls.env["account.account"]
cls.payment_model = cls.env["account.payment"]
cls.report = cls.env[
"report.account_check_printing_report_base.report_check_base"
]

self.partner1 = self.env.ref("base.res_partner_1")
self.company = self.env.ref("base.main_company")
self.currency_usd_id = self.env.ref("base.USD").id
self.currency_euro_id = self.env.ref("base.EUR").id
self.acc_payable = self.env.ref("account.data_account_type_payable")
self.acc_expense = self.env.ref("account.data_account_type_expenses")
self.product = self.env.ref("product.product_product_4")
self.check_report = (
"account_check_printing_report_base.action_report_check_base"
)
self.check_report_a4 = (
cls.partner1 = cls.env.ref("base.res_partner_1")
cls.company = cls.env.ref("base.main_company")
cls.currency_usd_id = cls.env.ref("base.USD").id
cls.currency_euro_id = cls.env.ref("base.EUR").id
cls.acc_payable = "liability_payable"
cls.acc_expense = "expense"
cls.product = cls.env.ref("product.product_product_4")
cls.check_report = "account_check_printing_report_base.action_report_check_base"
cls.check_report_a4 = (
"account_check_printing_report_base.action_report_check_base_a4"
)
self.action_check_report = self.env.ref(
cls.action_check_report = (
"account_check_printing_report_base.action_report_check_base"
)
self.payment_method_check = self.payment_method_model.search(
cls.payment_method_check = cls.payment_method_model.search(
[("code", "=", "check_printing")],
limit=1,
)
if not self.payment_method_check:
self.payment_method_check = self.payment_method_model.create(
if not cls.payment_method_check:
cls.payment_method_check = cls.payment_method_model.create(
{
"name": "Check",
"code": "check_printing",
"payment_type": "outbound",
"check": True,
}
)
self.purchase_journal = self.journal_model.create(
cls.purchase_journal = cls.journal_model.create(
{"name": "Purchase Journal - Test", "type": "purchase", "code": "Test"}
)
self.bank_journal = self.journal_model.create(
cls.bank_journal = cls.journal_model.create(
{
"name": "Cash Journal - Test",
"type": "bank",
"code": "bank",
"check_manual_sequencing": True,
# "outbound_payment_method_ids": [
# (4, self.payment_method_check.id, None)
# (4, cls.payment_method_check.id, None)
# ],
}
)
self.acc_payable = self._create_account(
"account payable test", "ACPRB1", self.acc_payable, True
cls.acc_payable = cls._create_account(
"account payable test", "ACPRB1", cls.acc_payable, True
)
self.vendor_bill = self._create_vendor_bill(self.acc_payable)
self.vendor_bill.invoice_date = time.strftime("%Y") + "-07-15"
self.acc_expense = self._create_account(
"account expense test", "ACPRB2", self.acc_expense, False
cls.vendor_bill = cls._create_vendor_bill(cls.acc_payable)
cls.vendor_bill.invoice_date = time.strftime("%Y") + "-07-15"
cls.acc_expense = cls._create_account(
"account expense test", "ACPRB2", cls.acc_expense, False
)
self._create_invoice_line(self.acc_expense, self.vendor_bill)
cls._create_invoice_line(cls.acc_expense, cls.vendor_bill)

self.vendor_bill.action_post()
cls.vendor_bill.action_post()
# Pay the invoice using a bank journal associated to the main company
ctx = {"active_model": "account.move", "active_ids": [self.vendor_bill.id]}
register_payments = self.payment_model.with_context(**ctx).create(
ctx = {"active_model": "account.move", "active_ids": [cls.vendor_bill.id]}
register_payments = cls.payment_model.with_context(**ctx).create(
{
"date": time.strftime("%Y") + "-07-15",
"journal_id": self.bank_journal.id,
"payment_method_line_id": self.payment_method_check.id,
"journal_id": cls.bank_journal.id,
"payment_method_line_id": cls.payment_method_check.id,
}
)
register_payments.action_post()
self.payment = self.payment_model.search([], order="id desc", limit=1)
cls.payment = cls.payment_model.search([], order="id desc", limit=1)

def _create_account(self, name, code, user_type, reconcile):
account = self.account_account_model.create(
@classmethod
def _create_account(cls, name, code, user_type, reconcile):
account = cls.account_account_model.create(
{
"name": name,
"code": code,
"user_type_id": user_type.id,
"company_id": self.company.id,
"account_type": user_type,
"company_id": cls.company.id,
"reconcile": reconcile,
}
)
return account

def _create_vendor_bill(self, account):
vendor_bill = self.account_invoice_model.create(
@classmethod
def _create_vendor_bill(cls, account):
vendor_bill = cls.account_invoice_model.create(
{
"move_type": "in_invoice",
"partner_id": self.partner1.id,
"currency_id": self.company.currency_id.id,
"journal_id": self.purchase_journal.id,
"company_id": self.company.id,
"partner_id": cls.partner1.id,
"currency_id": cls.company.currency_id.id,
"journal_id": cls.purchase_journal.id,
"company_id": cls.company.id,
}
)
return vendor_bill

def _create_invoice_line(self, account, invoice):
@classmethod
def _create_invoice_line(cls, account, invoice):
invoice = invoice.write(
{
"invoice_line_ids": [
Expand All @@ -128,7 +130,7 @@ def _create_invoice_line(self, account, invoice):
"account_id": account.id,
"quantity": 1.000,
"price_unit": 2.99,
"product_id": self.product.id,
"product_id": cls.product.id,
},
)
]
Expand All @@ -151,7 +153,9 @@ def test_01_check_printing_no_layout(self):
self.assertFalse(self.payment.journal_id.account_check_printing_layout)
with self.assertRaises(RedirectWarning):
self.payment.do_print_checks()
content = self.action_check_report._render_qweb_pdf(self.payment.id)
content = self["ir.actions.report"]._render_qweb_pdf(
self.action_check_report, res_ids=self.payment.ids
)
self.assertEqual(content[1], "html")

def test_02_check_printing_with_layout(self):
Expand All @@ -167,7 +171,9 @@ def test_02_check_printing_with_layout(self):
e = e.name
self.assertEqual(e, False)

content = self.action_check_report._render_qweb_pdf(self.payment.id)
content = self["ir.actions.report"]._render_qweb_pdf(
self.action_check_report, res_ids=self.payment.ids
)
self.assertEqual(content[1], "html")

def test_03_fotmat_form(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@


class TestNum2WordsLangSolution(TransactionCase):
def setUp(self):
super().setUp()
self.propissory_note_amount = self.env[
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.propissory_note_amount = cls.env[
"report.account_check_printing_report_base.promissory_footer_a4"
]
self.amount = 3.09
cls.amount = 3.09

def test_num2words_es_correction(self):
amount_in_word = self.propissory_note_amount.with_context(
Expand Down

0 comments on commit 6bf8c4a

Please sign in to comment.