[MIG] account_check_deposit: Migration to 15.0

TT36937
This commit is contained in:
Víctor Martínez
2022-11-23 13:56:34 +01:00
parent 372f705ca5
commit aaf86c0252
26 changed files with 132 additions and 483 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/14.0/account_check_deposit
:target: https://github.com/OCA/account-financial-tools/tree/15.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-14-0/account-financial-tools-14-0-account_check_deposit
:target: https://translation.odoo-community.org/projects/account-financial-tools-15-0/account-financial-tools-15-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/14.0
:target: https://runbot.odoo-community.org/runbot/92/15.0
:alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -45,9 +45,9 @@ journal:
* Name: Checks Received
* Type: Bank
* Short Code: CHK (or any code you want)
* Outstanding Receipts Account: select an account for checks received
* in the tab *Incoming Payments*, add a line with *Payment Method* = *Manual* and *Outstanding receipts account* set to the account for the checks in hand.
Note that, on this *Checks Received* journal, the bank account and suspense account will not be used, so don't worry about these parameters.
Note that, on this *Checks Received* journal, the bank account and suspense account will not be used, so don't worry about these parameters. The field *Account number* must be empty.
This bank journal will be available as a payment method in Odoo. The account
you configured as *Outstanding Receipts Account* is the
@@ -78,7 +78,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:%2014.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:%2015.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.
@@ -122,6 +122,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/14.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/15.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

@@ -512,62 +512,3 @@ msgstr ""
#: model:ir.model.fields,help:account_check_deposit.field_account_check_deposit__website_message_ids
msgid "Website communication history"
msgstr ""
#~ msgid "Check Deposit - Ref. Check %s"
#~ msgstr "Scheck-Konto - Scheckref. %s"
#~ msgid "Check Deposit Offsetting Account"
#~ msgstr "Gegenkonto zu Scheckeinzahlung"
#, fuzzy
#~ msgid "Check Deposits"
#~ msgstr "Scheck-Konten"
#~ msgid "Companies"
#~ msgstr "Unternehmen"
#, fuzzy
#~ msgid "Config Settings"
#~ msgstr "account.config.settings"
#~ msgid "Currency (False if same as company)"
#~ msgstr "Währung (Falsch wenn gleich wie Unternehmenswährung)"
#~ msgid "Default Debit Account of the Journal"
#~ msgstr "Standard Aufwandskonto des Journals"
#~ msgid "It acts as a default account for debit amount"
#~ msgstr "Es dient als Standardkonto bei Sollbeträgen"
#, fuzzy
#~ msgid "Missing 'Check Deposit Offsetting Account' on the company '%s'."
#~ msgstr "'Konto zu Scheckeinzahlungen' fehlt im Unternehmen '%s'."
#~ msgid "Missing 'Default Debit Account' on bank journal '%s'"
#~ msgstr "'Vorgabe-Soll-Konto' fehlt im Bank-Journal '%s'"
#, fuzzy
#~ msgid "Post Move for Check Deposits"
#~ msgstr "Transferkonto bei Scheckeinreichern"
#~ msgid "Total Credit"
#~ msgstr "Gesamt-Soll"
#~ msgid "Total Debit"
#~ msgstr "Gesamt-Haben"
#~ msgid "Transfer Account"
#~ msgstr "Transfer-Konto"
#~ msgid "Transfer Account for Check Deposits"
#~ msgstr "Transferkonto bei Scheckeinreichern"
#~ msgid ""
#~ "You must configure the 'Check Deposit Offsetting Account' on the "
#~ "Accounting Settings page"
#~ msgstr ""
#~ "Sie müssen das 'Scheckeinzahlungs-Gegenkonto' in den Konteneinstellungen "
#~ "pflegen"
#~ msgid "Checks Deposit Search"
#~ msgstr "Scheckdepotsuche"

View File

@@ -507,6 +507,3 @@ msgstr ""
#: model:ir.model.fields,help:account_check_deposit.field_account_check_deposit__website_message_ids
msgid "Website communication history"
msgstr ""
#~ msgid "Companies"
#~ msgstr "Εταιρείες"

View File

@@ -507,12 +507,3 @@ msgstr ""
#: model:ir.model.fields,help:account_check_deposit.field_account_check_deposit__website_message_ids
msgid "Website communication history"
msgstr ""
#~ msgid "Currency (False if same as company)"
#~ msgstr "Currency (False if same as company)"
#~ msgid "Default Debit Account of the Journal"
#~ msgstr "Default Debit Account of the Journal"
#~ msgid "It acts as a default account for debit amount"
#~ msgstr "It acts as a default account for debit amount"

View File

@@ -507,6 +507,3 @@ msgstr ""
#: model:ir.model.fields,help:account_check_deposit.field_account_check_deposit__website_message_ids
msgid "Website communication history"
msgstr ""
#~ msgid "Companies"
#~ msgstr "Compañías"

View File

@@ -508,54 +508,3 @@ msgstr ""
#: model:ir.model.fields,help:account_check_deposit.field_account_check_deposit__website_message_ids
msgid "Website communication history"
msgstr ""
#~ msgid "Check Deposit - Ref. Check %s"
#~ msgstr "Depósito de Cheque - Ref. Cheque %s"
#~ msgid "Check Deposit Offsetting Account"
#~ msgstr "Cuenta Cheque deposito"
#, fuzzy
#~ msgid "Check Deposits"
#~ msgstr "Depósitos"
#~ msgid "Companies"
#~ msgstr "Compañías"
#~ msgid "Currency (False if same as company)"
#~ msgstr "Moneda"
#~ msgid "Default Debit Account of the Journal"
#~ msgstr "Cta. por defecto para Débito del Diario"
#~ msgid "It acts as a default account for debit amount"
#~ msgstr "Actua como cuenta por defecto para el débito"
#, fuzzy
#~ msgid "Missing 'Check Deposit Offsetting Account' on the company '%s'."
#~ msgstr "Sin configurar 'Cta. para Depósito de cheques' en la compañía '%s'."
#, fuzzy
#~ msgid "Post Move for Check Deposits"
#~ msgstr "Cta. de Transferencia para Depósitos"
#~ msgid "Total Credit"
#~ msgstr "Total Crédito"
#~ msgid "Total Debit"
#~ msgstr "Total Débito"
#~ msgid "Transfer Account"
#~ msgstr "Cuenta de Transferencia"
#~ msgid "Transfer Account for Check Deposits"
#~ msgstr "Cta. de Transferencia para Depósitos"
#~ msgid ""
#~ "You must configure the 'Check Deposit Offsetting Account' on the "
#~ "Accounting Settings page"
#~ msgstr ""
#~ "Debe configurar la 'Cta. de Depósitos' en la configuración Financiera"
#~ msgid "Checks Deposit Search"
#~ msgstr "Buscar Depósitos"

View File

@@ -506,6 +506,3 @@ msgstr ""
#: model:ir.model.fields,help:account_check_deposit.field_account_check_deposit__website_message_ids
msgid "Website communication history"
msgstr ""
#~ msgid "Companies"
#~ msgstr "Yritykset"

View File

@@ -522,30 +522,3 @@ msgstr ""
#: model:ir.model.fields,help:account_check_deposit.field_account_check_deposit__website_message_ids
msgid "Website communication history"
msgstr ""
#~ msgid "Check Deposit - Ref. Check %s"
#~ msgstr "Remise - Ref. Cheque %s"
#~ msgid "Check Deposits"
#~ msgstr "Remises de chèques"
#~ msgid "Companies"
#~ msgstr "Sociétés"
#~ msgid "Currency (False if same as company)"
#~ msgstr "Devise (False s'il s'agit de la même que la société)"
#~ msgid "Default Debit Account of the Journal"
#~ msgstr "Compte de débit par défaut du journal"
#~ msgid "Post Move for Check Deposits"
#~ msgstr "Comptabiliser les écritures des remises de chèques"
#~ msgid "Transfer Account"
#~ msgstr "Compte de transfert"
#~ msgid "Transfer Account for Check Deposits"
#~ msgstr "Compte de transfert pour les remises de chèques"
#~ msgid "Checks Deposit Search"
#~ msgstr "Rechercher une Remise de Chèques"

View File

@@ -508,10 +508,3 @@ msgstr ""
#: model:ir.model.fields,help:account_check_deposit.field_account_check_deposit__website_message_ids
msgid "Website communication history"
msgstr ""
#~ msgid "Companies"
#~ msgstr "Poduzeća"
#, fuzzy
#~ msgid "Config Settings"
#~ msgstr "account.config.settings"

View File

@@ -508,10 +508,3 @@ msgstr ""
#: model:ir.model.fields,help:account_check_deposit.field_account_check_deposit__website_message_ids
msgid "Website communication history"
msgstr ""
#~ msgid "Companies"
#~ msgstr "Poduzeća"
#, fuzzy
#~ msgid "Config Settings"
#~ msgstr "account.config.settings"

View File

@@ -509,6 +509,3 @@ msgstr ""
#: model:ir.model.fields,help:account_check_deposit.field_account_check_deposit__website_message_ids
msgid "Website communication history"
msgstr ""
#~ msgid "Companies"
#~ msgstr "Azienda"

View File

@@ -508,6 +508,3 @@ msgstr ""
#: model:ir.model.fields,help:account_check_deposit.field_account_check_deposit__website_message_ids
msgid "Website communication history"
msgstr ""
#~ msgid "Companies"
#~ msgstr "Įmonės"

View File

@@ -507,6 +507,3 @@ msgstr ""
#: model:ir.model.fields,help:account_check_deposit.field_account_check_deposit__website_message_ids
msgid "Website communication history"
msgstr ""
#~ msgid "Companies"
#~ msgstr "Bedrijven"

View File

@@ -507,6 +507,3 @@ msgstr ""
#: model:ir.model.fields,help:account_check_deposit.field_account_check_deposit__website_message_ids
msgid "Website communication history"
msgstr ""
#~ msgid "Companies"
#~ msgstr "Bedrijven"

View File

@@ -525,57 +525,3 @@ msgstr "Mensagens do Website"
#: model:ir.model.fields,help:account_check_deposit.field_account_check_deposit__website_message_ids
msgid "Website communication history"
msgstr "Histórico de Comunicação do Website"
#~ msgid "Check Deposit - Ref. Check %s"
#~ msgstr "Depósito de Cheque - Ref. do Cheque %s"
#~ msgid "Check Deposit Offsetting Account"
#~ msgstr "Conta de Compensação do Depósito de Cheque"
#~ msgid "Check Deposits"
#~ msgstr "Depósitos de Cheques"
#~ msgid "Companies"
#~ msgstr "Empresas"
#~ msgid "Config Settings"
#~ msgstr "Configurações"
#~ msgid "Currency (False if same as company)"
#~ msgstr "Moeda (Falso se for a mesma da empresa)"
#~ msgid "Default Debit Account of the Journal"
#~ msgstr "Conta de Débito pré-definida do Diário"
#~ msgid "It acts as a default account for debit amount"
#~ msgstr "Atua como a conta predefinida para o valor a débito"
#~ msgid "Missing 'Check Deposit Offsetting Account' on the company '%s'."
#~ msgstr ""
#~ "A 'Conta de Offsetting de Depósitos de Cheques' está em falta na empresa "
#~ "'%s'."
#~ msgid "Missing 'Default Debit Account' on bank journal '%s'"
#~ msgstr "Em falta 'Conta Pré-definida para Débito' no diário '%s'"
#~ msgid "Post Move for Check Deposits"
#~ msgstr "Movimento publicado o Depósito de Cheques"
#~ msgid "Total Credit"
#~ msgstr "Crédito Total"
#~ msgid "Total Debit"
#~ msgstr "Débito Total"
#~ msgid "Transfer Account"
#~ msgstr "Conta de Transferência"
#~ msgid "Transfer Account for Check Deposits"
#~ msgstr "Conta de Transferência para Depósito de Cheques"
#~ msgid ""
#~ "You must configure the 'Check Deposit Offsetting Account' on the "
#~ "Accounting Settings page"
#~ msgstr ""
#~ "Deve configurar a 'Conta de Compensação do Depósito de Cheques' na página "
#~ "de Configuração da Contabilidade"

View File

@@ -508,6 +508,3 @@ msgstr ""
#: model:ir.model.fields,help:account_check_deposit.field_account_check_deposit__website_message_ids
msgid "Website communication history"
msgstr ""
#~ msgid "Companies"
#~ msgstr "Empresas"

View File

@@ -506,6 +506,3 @@ msgstr ""
#: model:ir.model.fields,help:account_check_deposit.field_account_check_deposit__website_message_ids
msgid "Website communication history"
msgstr ""
#~ msgid "Companies"
#~ msgstr "Spoločnosti"

View File

@@ -510,29 +510,3 @@ msgstr ""
#: model:ir.model.fields,help:account_check_deposit.field_account_check_deposit__website_message_ids
msgid "Website communication history"
msgstr ""
#~ msgid "Check Deposit - Ref. Check %s"
#~ msgstr "Čekovni depozit - sklic čeka %s"
#, fuzzy
#~ msgid "Check Deposits"
#~ msgstr "Čekovni depoziti"
#~ msgid "Companies"
#~ msgstr "Družbe"
#~ msgid "Currency (False if same as company)"
#~ msgstr "Valuta (neveljavno če je ista kot valuta družbe)"
#~ msgid "Default Debit Account of the Journal"
#~ msgstr "Privzeti konto obveznosti za dnevnik"
#~ msgid "It acts as a default account for debit amount"
#~ msgstr "Deluje kot privzeti konto za znesek obveznosti"
#, fuzzy
#~ msgid "Post Move for Check Deposits"
#~ msgstr "Čekovni depoziti"
#~ msgid "Checks Deposit Search"
#~ msgstr "Iskalnik čekovnih depozitov"

View File

@@ -507,6 +507,3 @@ msgstr ""
#: model:ir.model.fields,help:account_check_deposit.field_account_check_deposit__website_message_ids
msgid "Website communication history"
msgstr ""
#~ msgid "Companies"
#~ msgstr "Firmalar"

View File

@@ -508,6 +508,3 @@ msgstr ""
#: model:ir.model.fields,help:account_check_deposit.field_account_check_deposit__website_message_ids
msgid "Website communication history"
msgstr ""
#~ msgid "Companies"
#~ msgstr "Firmalar"

View File

@@ -99,9 +99,6 @@ class AccountCheckDeposit(models.Model):
string="Number of Checks",
tracking=True,
)
is_reconcile = fields.Boolean(
compute="_compute_check_deposit", store=True, string="Reconcile"
)
_sql_constraints = [
(
@@ -134,36 +131,23 @@ class AccountCheckDeposit(models.Model):
}
for deposit in self:
reconcile = False
company_cur = deposit.company_id.currency_id
if company_cur != deposit.currency_id:
if deposit.company_id.currency_id != deposit.currency_id:
total = mapped_data.get(deposit.id, {"amount_currency": 0.0})[
"amount_currency"
]
else:
total = mapped_data.get(deposit.id, {"debit": 0.0})["debit"]
count = mapped_data.get(deposit.id, {"count": 0})["count"]
if deposit.move_id:
for line in deposit.move_id.line_ids:
if not company_cur.is_zero(line.debit) and line.reconciled:
reconcile = True
deposit.total_amount = total
deposit.is_reconcile = reconcile
deposit.check_count = count
@api.depends("journal_id")
def _compute_in_hand_check_account_id(self):
for rec in self:
in_hand_check_account_id = False
if rec.journal_id:
for line in rec.journal_id.inbound_payment_method_line_ids:
if (
line.payment_method_id.code == "manual"
and line.payment_account_id
):
in_hand_check_account_id = line.payment_account_id.id
break
rec.in_hand_check_account_id = in_hand_check_account_id
account = rec.journal_id.inbound_payment_method_line_ids.filtered(
lambda line: line.payment_method_id.code == "manual"
).payment_account_id
rec.in_hand_check_account_id = account
@api.model
def default_get(self, fields_list):
@@ -200,15 +184,14 @@ class AccountCheckDeposit(models.Model):
)
def unlink(self):
for deposit in self:
if deposit.state == "done":
raise UserError(
_(
"The deposit '%s' is in valid state, so you must "
"cancel it before deleting it."
)
% deposit.name
for deposit in self.filtered(lambda x: x.state == "done"):
raise UserError(
_(
"The deposit '%s' is in valid state, so you must "
"cancel it before deleting it."
)
% deposit.name
)
return super().unlink()
def backtodraft(self):
@@ -285,8 +268,7 @@ class AccountCheckDeposit(models.Model):
am_obj = self.env["account.move"]
move_line_obj = self.env["account.move.line"]
for deposit in self:
move_vals = deposit._prepare_account_move_vals()
move = am_obj.create(move_vals)
move = am_obj.create(deposit._prepare_account_move_vals())
total_debit = 0.0
total_amount_currency = 0.0
to_reconcile_lines = []
@@ -316,25 +298,22 @@ class AccountCheckDeposit(models.Model):
@api.onchange("company_id")
def onchange_company_id(self):
if self.company_id:
bank_journals = self.env["account.journal"].search(
self.bank_journal_id = self.env["account.journal"].search(
[
("company_id", "=", self.company_id.id),
("type", "=", "bank"),
("bank_account_id", "!=", False),
]
],
limit=1,
)
if len(bank_journals) == 1:
self.bank_journal_id = bank_journals[0]
else:
self.bank_journal_id = False
@api.onchange("journal_id")
def onchange_journal_id(self):
if self.journal_id:
if self.journal_id.currency_id:
self.currency_id = self.journal_id.currency_id
else:
self.currency_id = self.journal_id.company_id.currency_id
self.currency_id = (
self.journal_id.currency_id or self.journal_id.company_id.currency_id
)
def get_report(self):
report = self.env.ref("account_check_deposit.report_account_check_deposit")

View File

@@ -5,16 +5,16 @@
The licence is in the file __manifest__.py
-->
<odoo>
<record id="report_account_check_deposit" model="ir.actions.report">
<field name="name">Check Deposit</field>
<field name="model">account.check.deposit</field>
<field name="report_type">qweb-pdf</field>
<field name="report_name">account_check_deposit.report_checkdeposit</field>
<field name="report_file">account_check_deposit.report_checkdeposit</field>
<field
<record id="report_account_check_deposit" model="ir.actions.report">
<field name="name">Check Deposit</field>
<field name="model">account.check.deposit</field>
<field name="report_type">qweb-pdf</field>
<field name="report_name">account_check_deposit.report_checkdeposit</field>
<field name="report_file">account_check_deposit.report_checkdeposit</field>
<field
name="print_report_name"
>'check_deposit-%s%s' % (object.name, object.state == 'draft' and '-draft' or '')</field>
<field name="binding_model_id" ref="model_account_check_deposit" />
<field name="binding_type">report</field>
</record>
<field name="binding_model_id" ref="model_account_check_deposit" />
<field name="binding_type">report</field>
</record>
</odoo>

View File

@@ -8,7 +8,7 @@
<template id="report_checkdeposit">
<t t-call="web.html_container">
<t t-foreach="docs" t-as="o">
<t t-call="web.internal_layout">
<t t-call="web.external_layout">
<div class="page">
<h1>Check Deposit n°<span t-field="o.name" /></h1>
<h3>Bank:</h3>

View File

@@ -3,7 +3,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.15.1: http://docutils.sourceforge.net/" />
<meta name="generator" content="Docutils: http://docutils.sourceforge.net/" />
<title>Account Check Deposit</title>
<style type="text/css">
@@ -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/14.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-14-0/account-financial-tools-14-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/14.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/15.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-15-0/account-financial-tools-15-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/15.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
@@ -395,9 +395,9 @@ journal:</p>
<li>Name: Checks Received</li>
<li>Type: Bank</li>
<li>Short Code: CHK (or any code you want)</li>
<li>Outstanding Receipts Account: select an account for checks received</li>
<li>in the tab <em>Incoming Payments</em>, add a line with <em>Payment Method</em> = <em>Manual</em> and <em>Outstanding receipts account</em> set to the account for the checks in hand.</li>
</ul>
<p>Note that, on this <em>Checks Received</em> journal, the bank account and suspense account will not be used, so dont worry about these parameters.</p>
<p>Note that, on this <em>Checks Received</em> journal, the bank account and suspense account will not be used, so dont worry about these parameters. The field <em>Account number</em> must be empty.</p>
<p>This bank journal will be available as a payment method in Odoo. The account
you configured as <em>Outstanding Receipts Account</em> is the
account via which the amounts of checks will transit between the reception of a
@@ -421,7 +421,7 @@ credit the checks.</p>
<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:%2014.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:%2015.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">
@@ -460,7 +460,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/14.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/15.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

@@ -1,5 +1,6 @@
# Copyright 2014-2016 Akretion - Mourad EL HADJ MIMOUNE
# Copyright 2018 Tecnativa - Pedro M. Baeza
# Copyright 2022 Tecnativa - Víctor Martínez
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo.tests import tagged
@@ -10,150 +11,89 @@ from odoo.tests.common import TransactionCase
class TestPayment(TransactionCase):
def setUp(self):
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.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"]
self.partner_agrolait = self.env.ref("base.res_partner_2")
self.main_company = self.env.ref("base.main_company")
self.currency_id = self.main_company.currency_id.id
self.env.cr.execute(
"""UPDATE res_company SET currency_id = %s
WHERE id = %s""",
(self.main_company.id, self.currency_id),
)
self.product = self.env.ref("product.product_product_4")
self.payment_method_manual_in = self.env.ref(
"account.account_payment_method_manual_in"
)
self.payment_method_manual_out = self.env.ref(
"account.account_payment_method_manual_out"
)
self.partner = self.env["res.partner"].create({"name": "Test partner"})
self.main_company = self.env.company
self.currency = self.main_company.currency_id
self.product = self.env["product.product"].create({"name": "Test product"})
# check if those accounts exist otherwise create them
self.account_receivable = self.account_model.search(
[("company_id", "=", self.main_company.id), ("code", "=", "411100")],
limit=1,
)
if not self.account_receivable:
self.account_receivable = self.account_model.create(
{
"code": "411100",
"name": "Debtors - (test)",
"reconcile": True,
"user_type_id": self.ref("account.data_account_type_receivable"),
"company_id": self.main_company.id,
}
)
self.account_revenue = self.account_model.search(
[("code", "=", "707100"), ("company_id", "=", self.main_company.id)],
limit=1,
)
if not self.account_revenue:
self.account_revenue = self.account_model.create(
{
"code": "707100",
"name": "Product Sales - (test)",
"user_type_id": self.ref("account.data_account_type_revenue"),
"company_id": self.main_company.id,
}
)
self.received_check_account_id = self.account_model.search(
[("code", "=", "511200"), ("company_id", "=", self.main_company.id)],
limit=1,
)
if self.received_check_account_id:
if not self.received_check_account_id.reconcile:
self.received_check_account_id.reconcile = True
else:
self.received_check_account_id = self.account_model.create(
{
"code": "511200",
"name": "Received check - (test)",
"reconcile": True,
"user_type_id": self.ref(
"account.data_account_type_current_assets"
),
"company_id": self.main_company.id,
}
)
self.transfer_account_id = self.account_model.search(
[("code", "=", "511500"), ("company_id", "=", self.main_company.id)],
limit=1,
)
if not self.transfer_account_id:
self.transfer_account_id = self.account_model.create(
{
"code": "511500",
"name": "Check deposis waiting for credit on bank account - (test)",
"reconcile": True,
"user_type_id": self.ref(
"account.data_account_type_current_assets"
),
"company_id": self.main_company.id,
}
)
self.manual_method_in = self.env.ref("account.account_payment_method_manual_in")
self.check_journal = self.journal_model.create(
self.account_model.create(
{
"name": "received check",
"type": "bank",
"code": "CHK",
"code": "411100",
"name": "Debtors - (test)",
"reconcile": True,
"user_type_id": self.ref("account.data_account_type_receivable"),
"company_id": self.main_company.id,
"inbound_payment_method_line_ids": [
(
0,
0,
{
"payment_method_id": self.manual_method_in.id,
"payment_account_id": self.received_check_account_id.id,
},
)
],
}
)
self.partner_bank_id = self.res_partner_bank_model.create(
self.account_model.create(
{
"code": "707100",
"name": "Product Sales - (test)",
"user_type_id": self.ref("account.data_account_type_revenue"),
"company_id": self.main_company.id,
}
)
received_check_account = self.account_model.create(
{
"code": "511200",
"name": "Received check - (test)",
"reconcile": True,
"user_type_id": self.ref("account.data_account_type_current_assets"),
"company_id": self.main_company.id,
}
)
self.transfer_account = self.account_model.create(
{
"code": "511500",
"name": "Check deposis waiting for credit on bank account - (test)",
"reconcile": True,
"user_type_id": self.ref("account.data_account_type_current_assets"),
"company_id": self.main_company.id,
}
)
self.manual_method_in = self.env.ref("account.account_payment_method_manual_in")
self.check_journal = self._create_journal(
"received check", "bank", "CHK", received_check_account
)
self.bank_journal = self._create_journal(
"Bank Test Chq", "bank", "TEST@@", self.transfer_account
)
self.bank_journal.bank_account_id = self.env["res.partner.bank"].create(
{
"acc_number": "SI56 1910 0000 0123 438 584",
"partner_id": self.main_company.partner_id.id,
}
)
self.bank_journal = self.journal_model.create(
def _create_journal(self, name, journal_type, code, payment_account):
return self.env["account.journal"].create(
{
"name": "Bank Test Chq",
"type": "bank",
"code": "TEST@@",
"name": name,
"type": journal_type,
"code": code,
"company_id": self.main_company.id,
"bank_account_id": self.partner_bank_id.id,
"inbound_payment_method_line_ids": [
(
0,
0,
{
"payment_method_id": self.manual_method_in.id,
"payment_account_id": self.transfer_account_id.id,
"payment_account_id": payment_account.id,
},
)
],
}
)
def create_invoice(self, amount=100, inv_type="out_invoice", currency_id=None):
def create_invoice(self, amount=100):
"""Returns an open invoice"""
invoice = self.move_model.create(
invoice = self.env["account.move"].create(
{
"company_id": self.main_company.id,
"move_type": inv_type,
"partner_id": self.partner_agrolait.id,
"currency_id": currency_id,
"move_type": "out_invoice",
"partner_id": self.partner.id,
"currency_id": self.currency.id,
"invoice_line_ids": [
(
0,
@@ -172,12 +112,12 @@ class TestPayment(TransactionCase):
def create_check_deposit(self):
"""Returns an validated check deposit"""
check_deposit = self.check_deposit_model.create(
check_deposit = self.env["account.check.deposit"].create(
{
"company_id": self.main_company.id,
"journal_id": self.check_journal.id,
"bank_journal_id": self.bank_journal.id,
"currency_id": self.currency_id,
"currency_id": self.currency.id,
}
)
check_deposit.get_all_checks()
@@ -187,27 +127,31 @@ class TestPayment(TransactionCase):
def test_full_payment_process(self):
"""Create a payment for on invoice by check,
post it and create check deposit"""
inv_1 = self.create_invoice(amount=100, currency_id=self.currency_id)
inv_2 = self.create_invoice(amount=200, currency_id=self.currency_id)
register_payments = self.register_payments_model.with_context(
active_model="account.move",
active_ids=[inv_1.id, inv_2.id],
default_journal_id=self.check_journal.id,
).create({"group_payment": True})
register_payments.action_create_payments()
payment = self.payment_model.search([], order="id desc", limit=1)
inv_1 = self.create_invoice(amount=100)
inv_2 = self.create_invoice(amount=200)
register_payments = (
self.env["account.payment.register"]
.with_context(
active_model="account.move",
active_ids=[inv_1.id, inv_2.id],
default_journal_id=self.check_journal.id,
)
.create({"group_payment": True})
)
payment = register_payments._create_payments()
self.assertAlmostEqual(payment.amount, 300)
self.assertEqual(payment.state, "posted")
self.assertEqual(inv_1.state, "posted")
self.assertEqual(inv_2.state, "posted")
check_deposit = self.create_check_deposit()
liquidity_aml = check_deposit.move_id.line_ids.filtered(
lambda r: r.account_id == self.transfer_account_id
lambda r: r.account_id == self.transfer_account
)
self.assertAlmostEqual(check_deposit.total_amount, 300)
self.assertAlmostEqual(liquidity_aml.debit, 300)
self.assertEqual(check_deposit.move_id.state, "posted")
self.assertEqual(check_deposit.state, "done")
res = (
self.env["ir.actions.report"]
._get_report_from_name("account_check_deposit.report_checkdeposit")
._render_qweb_text(check_deposit.ids, False)
)
self.assertRegex(str(res[0]), "SI56 1910 0000 0123 438 584")

View File

@@ -11,7 +11,7 @@
<field name="model">account.check.deposit</field>
<field name="arch" type="xml">
<form>
<header>
<header>
<button
name="get_all_checks"
states="draft"
@@ -107,12 +107,12 @@
</tree>
</field>
</group>
</sheet>
<div class="oe_chatter">
<field name="message_follower_ids" widget="mail_followers" />
<field name="activity_ids" widget="mail_activity" />
<field name="message_ids" widget="mail_thread" />
</div>
</sheet>
<div class="oe_chatter">
<field name="message_follower_ids" widget="mail_followers" />
<field name="activity_ids" widget="mail_activity" />
<field name="message_ids" widget="mail_thread" />
</div>
</form>
</field>
</record>
@@ -132,7 +132,6 @@
groups="base.group_multi_currency"
optional="show"
/>
<field name="is_reconcile" optional="show" />
<field name="company_id" groups="base.group_multi_company" />
<field
name="state"
@@ -183,17 +182,17 @@
</group>
</search>
</field>
</record>
<record id="check_deposit_pivot" model="ir.ui.view">
</record>
<record id="check_deposit_pivot" model="ir.ui.view">
<field name="model">account.check.deposit</field>
<field name="arch" type="xml">
<pivot>
<field name="deposit_date" interval="month" type="row" />
<field name="bank_journal_id" type="col" />
<field name="check_count" type="measure" />
<field name="deposit_date" interval="month" type="row" />
<field name="bank_journal_id" type="col" />
<field name="check_count" type="measure" />
</pivot>
</field>
</record>
</record>
<record id="action_check_deposit_tree" model="ir.actions.act_window">
<field name="name">Checks Deposits</field>
<field name="res_model">account.check.deposit</field>