[MIG] account_loan: Finish migration to 17.0

Changes done:
- Purge translation files
- Remove unnecessary readonly=true to some fields (fields defining the readonly in the view and/or related)
- Remove unnecesary default=false to boolean fields (redundant, is the default behavior)
- Remove unnecessary 'or' text from views
- Improve multi-company rule + migration script
- Improve tests

TT51502
This commit is contained in:
Víctor Martínez
2024-10-30 14:50:01 +01:00
parent 539827a322
commit 4a63616d13
65 changed files with 61 additions and 547 deletions

View File

@@ -1029,6 +1029,3 @@ msgstr ""
#: model_terms:ir.ui.view,arch_db:account_loan.account_loan_post_form
msgid "or"
msgstr "o"
#~ msgid "Account Entry"
#~ msgstr "Asiento contable"

View File

@@ -1031,10 +1031,3 @@ msgstr ""
#: model_terms:ir.ui.view,arch_db:account_loan.account_loan_post_form
msgid "or"
msgstr "أو"
#~ msgid "Invoice"
#~ msgstr "فاتورة"
#, fuzzy
#~ msgid "Journal Entries"
#~ msgstr "السجل اليومي"

View File

@@ -1030,6 +1030,3 @@ msgstr ""
#: model_terms:ir.ui.view,arch_db:account_loan.account_loan_post_form
msgid "or"
msgstr "или"
#~ msgid "Invoice"
#~ msgstr "Фактура"

View File

@@ -1031,10 +1031,3 @@ msgstr ""
#: model_terms:ir.ui.view,arch_db:account_loan.account_loan_post_form
msgid "or"
msgstr "ili"
#~ msgid "Invoice"
#~ msgstr "Faktura"
#, fuzzy
#~ msgid "Journal Entries"
#~ msgstr "Dnevnik"

View File

@@ -1045,13 +1045,3 @@ msgstr "Quan es comprovi, el primer pagament serà a la data d'inici"
#: model_terms:ir.ui.view,arch_db:account_loan.account_loan_post_form
msgid "or"
msgstr "o"
#~ msgid "Invoice"
#~ msgstr "Factura"
#, fuzzy
#~ msgid "Journal Entries"
#~ msgstr "Diari"
#~ msgid "Account Entry"
#~ msgstr "Assentament comptable"

View File

@@ -1030,10 +1030,3 @@ msgstr ""
#: model_terms:ir.ui.view,arch_db:account_loan.account_loan_post_form
msgid "or"
msgstr "nebo"
#~ msgid "Invoice"
#~ msgstr "Faktura"
#, fuzzy
#~ msgid "Journal Entries"
#~ msgstr "Deník"

View File

@@ -1045,28 +1045,3 @@ msgstr "Wenn angehakt, erfolgt die erste Zahlung am Anfangsdatum"
#: model_terms:ir.ui.view,arch_db:account_loan.account_loan_post_form
msgid "or"
msgstr "oder"
#~ msgid "Followers (Channels)"
#~ msgstr "Abonnenten (Kanäle)"
#~ msgid "If checked new messages require your attention."
#~ msgstr ""
#~ "Wenn es gesetzt ist, erfordern neue Nachrichten Ihre Aufmerksamkeit."
#~ msgid "Invoice"
#~ msgstr "Rechnung"
#~ msgid "Journal Entries"
#~ msgstr "Journal-Buchungen"
#~ msgid "Loan items"
#~ msgstr "Darlehenspositionen"
#~ msgid "Account Entry"
#~ msgstr "Kontobuchung"
#~ msgid "account.loan.pay.amount"
#~ msgstr "account.loan.pay.amount"
#~ msgid "account.loan.post"
#~ msgstr "account.loan.post"

View File

@@ -1031,6 +1031,3 @@ msgstr ""
#: model_terms:ir.ui.view,arch_db:account_loan.account_loan_post_form
msgid "or"
msgstr "ή"
#~ msgid "Invoice"
#~ msgstr "Τιμολόγιο"

View File

@@ -1031,10 +1031,3 @@ msgstr ""
#: model_terms:ir.ui.view,arch_db:account_loan.account_loan_post_form
msgid "or"
msgstr "or"
#~ msgid "Invoice"
#~ msgstr "Invoice"
#, fuzzy
#~ msgid "Journal Entries"
#~ msgstr "Journal"

View File

@@ -1052,45 +1052,3 @@ msgstr "Cuando se marque, el primero pago será en la fecha de inicio"
#: model_terms:ir.ui.view,arch_db:account_loan.account_loan_post_form
msgid "or"
msgstr "o"
#~ msgid "Followers (Channels)"
#~ msgstr "Seguidores (Canales)"
#~ msgid "If checked new messages require your attention."
#~ msgstr "Si está marcado los mensajes nuevos requieren su atención."
#~ msgid "Invoice"
#~ msgstr "Factura"
#~ msgid "Journal Entries"
#~ msgstr "Asientos contables"
#~ msgid "Loan items"
#~ msgstr "Elementos de préstamos"
#~ msgid "Number of error"
#~ msgstr "Número de errores"
#~ msgid "Number of messages which requires an action"
#~ msgstr "Número de mensajes que requieren una acción"
#~ msgid "Number of unread messages"
#~ msgstr "Número de mensajes no leídos"
#~ msgid "Overdue"
#~ msgstr "Atrasado"
#~ msgid "Planned"
#~ msgstr "Planificado"
#~ msgid "Today"
#~ msgstr "Hoy"
#~ msgid "Unread Messages"
#~ msgstr "Mensajes no leídos"
#~ msgid "Unread Messages Counter"
#~ msgstr "Número de mensajes no leídos"
#~ msgid "Account Entry"
#~ msgstr "Asiento contable"

View File

@@ -1032,6 +1032,3 @@ msgstr ""
#: model_terms:ir.ui.view,arch_db:account_loan.account_loan_post_form
msgid "or"
msgstr "o"
#~ msgid "Account Entry"
#~ msgstr "Registro Contable"

View File

@@ -1031,10 +1031,3 @@ msgstr ""
#: model_terms:ir.ui.view,arch_db:account_loan.account_loan_post_form
msgid "or"
msgstr "o"
#~ msgid "Invoice"
#~ msgstr "Factura"
#, fuzzy
#~ msgid "Journal Entries"
#~ msgstr "Diario"

View File

@@ -1031,10 +1031,3 @@ msgstr ""
#: model_terms:ir.ui.view,arch_db:account_loan.account_loan_post_form
msgid "or"
msgstr "o"
#~ msgid "Invoice"
#~ msgstr "Factura"
#, fuzzy
#~ msgid "Journal Entries"
#~ msgstr "Diario"

View File

@@ -1031,10 +1031,3 @@ msgstr ""
#: model_terms:ir.ui.view,arch_db:account_loan.account_loan_post_form
msgid "or"
msgstr "ó"
#~ msgid "Invoice"
#~ msgstr "Factura"
#, fuzzy
#~ msgid "Journal Entries"
#~ msgstr "Diario"

View File

@@ -1030,7 +1030,3 @@ msgstr ""
#: model_terms:ir.ui.view,arch_db:account_loan.account_loan_post_form
msgid "or"
msgstr ""
#, fuzzy
#~ msgid "Journal Entries"
#~ msgstr "Diario"

View File

@@ -1030,10 +1030,3 @@ msgstr ""
#: model_terms:ir.ui.view,arch_db:account_loan.account_loan_post_form
msgid "or"
msgstr "või"
#~ msgid "Invoice"
#~ msgstr "Arve"
#, fuzzy
#~ msgid "Journal Entries"
#~ msgstr "Päevik"

View File

@@ -1030,6 +1030,3 @@ msgstr ""
#: model_terms:ir.ui.view,arch_db:account_loan.account_loan_post_form
msgid "or"
msgstr "tai"
#~ msgid "Invoice"
#~ msgstr "Lasku"

View File

@@ -1039,13 +1039,3 @@ msgstr ""
#: model_terms:ir.ui.view,arch_db:account_loan.account_loan_post_form
msgid "or"
msgstr "ou"
#~ msgid "Invoice"
#~ msgstr "Facture"
#, fuzzy
#~ msgid "Journal Entries"
#~ msgstr "Journal"
#~ msgid "Account Entry"
#~ msgstr "Pièce comptable"

View File

@@ -1031,6 +1031,3 @@ msgstr ""
#: model_terms:ir.ui.view,arch_db:account_loan.account_loan_post_form
msgid "or"
msgstr "ou"
#~ msgid "Invoice"
#~ msgstr "Facture"

View File

@@ -1031,6 +1031,3 @@ msgstr ""
#: model_terms:ir.ui.view,arch_db:account_loan.account_loan_post_form
msgid "or"
msgstr "ou"
#~ msgid "Invoice"
#~ msgstr "Facture"

View File

@@ -1031,6 +1031,3 @@ msgstr ""
#: model_terms:ir.ui.view,arch_db:account_loan.account_loan_post_form
msgid "or"
msgstr "ou"
#~ msgid "Account Entry"
#~ msgstr "Pièce comptable"

View File

@@ -1030,9 +1030,3 @@ msgstr ""
#: model_terms:ir.ui.view,arch_db:account_loan.account_loan_post_form
msgid "or"
msgstr "ou"
#~ msgid "Invoice"
#~ msgstr "Factura"
#~ msgid "Account Entry"
#~ msgstr "Asento contable"

View File

@@ -1031,13 +1031,3 @@ msgstr ""
#: model_terms:ir.ui.view,arch_db:account_loan.account_loan_post_form
msgid "or"
msgstr "ili"
#~ msgid "Invoice"
#~ msgstr "Račun"
#, fuzzy
#~ msgid "Journal Entries"
#~ msgstr "Temeljnica"
#~ msgid "Account Entry"
#~ msgstr "Stavka knjiženja"

View File

@@ -1032,9 +1032,3 @@ msgstr ""
#: model_terms:ir.ui.view,arch_db:account_loan.account_loan_post_form
msgid "or"
msgstr ""
#~ msgid "Invoice"
#~ msgstr "Račun"
#~ msgid "Account Entry"
#~ msgstr "Stavka dnevnika"

View File

@@ -1030,10 +1030,3 @@ msgstr ""
#: model_terms:ir.ui.view,arch_db:account_loan.account_loan_post_form
msgid "or"
msgstr "vagy"
#~ msgid "Invoice"
#~ msgstr "Számla"
#, fuzzy
#~ msgid "Journal Entries"
#~ msgstr "Napló"

View File

@@ -1030,10 +1030,3 @@ msgstr ""
#: model_terms:ir.ui.view,arch_db:account_loan.account_loan_post_form
msgid "or"
msgstr "atau"
#~ msgid "Invoice"
#~ msgstr "Faktur"
#, fuzzy
#~ msgid "Journal Entries"
#~ msgstr "Jurnal"

View File

@@ -1050,45 +1050,3 @@ msgstr "Quando spuntato, il primo pagamento sarà alla data inizio"
#: model_terms:ir.ui.view,arch_db:account_loan.account_loan_post_form
msgid "or"
msgstr "o"
#~ msgid "Followers (Channels)"
#~ msgstr "Seguito da (canali)"
#~ msgid "If checked new messages require your attention."
#~ msgstr "Se selezionata, nuovi messaggi richiedono attenzione."
#~ msgid "Invoice"
#~ msgstr "Fattura"
#~ msgid "Journal Entries"
#~ msgstr "Registrazioni contabili"
#~ msgid "Loan items"
#~ msgstr "Piano prestito"
#~ msgid "Number of error"
#~ msgstr "Numero di errori"
#~ msgid "Number of messages which requires an action"
#~ msgstr "Numero di messaggi che richiedono un'azione"
#~ msgid "Number of unread messages"
#~ msgstr "Numero di messaggi non letti"
#~ msgid "Overdue"
#~ msgstr "In Ritardo"
#~ msgid "Planned"
#~ msgstr "Pianificato"
#~ msgid "Today"
#~ msgstr "Oggi"
#~ msgid "Unread Messages"
#~ msgstr "Messaggi non letti"
#~ msgid "Unread Messages Counter"
#~ msgstr "Numero messaggi non letti"
#~ msgid "Account Entry"
#~ msgstr "Registrazione Contabile"

View File

@@ -1030,10 +1030,3 @@ msgstr ""
#: model_terms:ir.ui.view,arch_db:account_loan.account_loan_post_form
msgid "or"
msgstr "または"
#~ msgid "Invoice"
#~ msgstr "請求書"
#, fuzzy
#~ msgid "Journal Entries"
#~ msgstr "仕訳帳"

View File

@@ -1031,10 +1031,3 @@ msgstr ""
#: model_terms:ir.ui.view,arch_db:account_loan.account_loan_post_form
msgid "or"
msgstr "arba"
#~ msgid "Invoice"
#~ msgstr "Sąskaita-faktūra"
#, fuzzy
#~ msgid "Journal Entries"
#~ msgstr "Žurnalas"

View File

@@ -1030,10 +1030,3 @@ msgstr ""
#: model_terms:ir.ui.view,arch_db:account_loan.account_loan_post_form
msgid "or"
msgstr "или"
#~ msgid "Invoice"
#~ msgstr "Фактура"
#, fuzzy
#~ msgid "Journal Entries"
#~ msgstr "Дневник"

View File

@@ -1030,10 +1030,3 @@ msgstr ""
#: model_terms:ir.ui.view,arch_db:account_loan.account_loan_post_form
msgid "or"
msgstr "эсвэл"
#~ msgid "Invoice"
#~ msgstr "Нэхэмжлэл"
#, fuzzy
#~ msgid "Journal Entries"
#~ msgstr "Журнал"

View File

@@ -1031,10 +1031,3 @@ msgstr ""
#: model_terms:ir.ui.view,arch_db:account_loan.account_loan_post_form
msgid "or"
msgstr "eller"
#~ msgid "Invoice"
#~ msgstr "Faktura"
#, fuzzy
#~ msgid "Journal Entries"
#~ msgstr "Journal"

View File

@@ -1031,6 +1031,3 @@ msgstr ""
#: model_terms:ir.ui.view,arch_db:account_loan.account_loan_post_form
msgid "or"
msgstr ""
#~ msgid "Invoice"
#~ msgstr "Innmelding"

View File

@@ -1030,13 +1030,3 @@ msgstr ""
#: model_terms:ir.ui.view,arch_db:account_loan.account_loan_post_form
msgid "or"
msgstr "of"
#~ msgid "Invoice"
#~ msgstr "Factuur"
#, fuzzy
#~ msgid "Journal Entries"
#~ msgstr "Dagboek"
#~ msgid "Account Entry"
#~ msgstr "Boeking"

View File

@@ -1031,10 +1031,3 @@ msgstr ""
#: model_terms:ir.ui.view,arch_db:account_loan.account_loan_post_form
msgid "or"
msgstr "of"
#~ msgid "Invoice"
#~ msgstr "Factuur"
#, fuzzy
#~ msgid "Journal Entries"
#~ msgstr "Journaal"

View File

@@ -1031,6 +1031,3 @@ msgstr ""
#: model_terms:ir.ui.view,arch_db:account_loan.account_loan_post_form
msgid "or"
msgstr ""
#~ msgid "Invoice"
#~ msgstr "Factuur"

View File

@@ -1032,10 +1032,3 @@ msgstr ""
#: model_terms:ir.ui.view,arch_db:account_loan.account_loan_post_form
msgid "or"
msgstr "lub"
#~ msgid "Invoice"
#~ msgstr "Faktura"
#, fuzzy
#~ msgid "Journal Entries"
#~ msgstr "Dziennik"

View File

@@ -1038,42 +1038,3 @@ msgstr ""
#: model_terms:ir.ui.view,arch_db:account_loan.account_loan_post_form
msgid "or"
msgstr "ou"
#~ msgid "Followers (Channels)"
#~ msgstr "Seguidores (Canais)"
#~ msgid "If checked new messages require your attention."
#~ msgstr "Se selecionado novas mensagens necessitam da sua atenção."
#~ msgid "Invoice"
#~ msgstr "Fatura"
#~ msgid "Journal Entries"
#~ msgstr "Movimentos de Diário"
#~ msgid "Number of error"
#~ msgstr "Número de erros"
#~ msgid "Number of messages which requires an action"
#~ msgstr "Número de mensagens que requerem atenção"
#~ msgid "Number of unread messages"
#~ msgstr "Número de mensagens não lidas"
#~ msgid "Overdue"
#~ msgstr "Em mora"
#~ msgid "Planned"
#~ msgstr "Planeado"
#~ msgid "Today"
#~ msgstr "Hoje"
#~ msgid "Unread Messages"
#~ msgstr "Mensagens Não lidas"
#~ msgid "Unread Messages Counter"
#~ msgstr "Contador de Mensagens Não Lidas"
#~ msgid "Account Entry"
#~ msgstr "Movimento de Conta"

View File

@@ -1042,42 +1042,3 @@ msgstr ""
#: model_terms:ir.ui.view,arch_db:account_loan.account_loan_post_form
msgid "or"
msgstr "ou"
#~ msgid "Followers (Channels)"
#~ msgstr "Seguidores (Canais)"
#~ msgid "If checked new messages require your attention."
#~ msgstr "Se marcado, novas mensagens solicitarão sua atenção."
#~ msgid "Invoice"
#~ msgstr "Fatura"
#~ msgid "Journal Entries"
#~ msgstr "Lançamentos de Diário"
#~ msgid "Number of error"
#~ msgstr "Número do erro"
#~ msgid "Number of messages which requires an action"
#~ msgstr "Número de mensagens que requer uma ação"
#~ msgid "Number of unread messages"
#~ msgstr "Quantidade de mensagens não lidas"
#~ msgid "Overdue"
#~ msgstr "Vencido(a)"
#~ msgid "Planned"
#~ msgstr "Planejado"
#~ msgid "Today"
#~ msgstr "Hoje"
#~ msgid "Unread Messages"
#~ msgstr "Mensagens não lidas"
#~ msgid "Unread Messages Counter"
#~ msgstr "Contador de Mensagens Não Lidas"
#~ msgid "Account Entry"
#~ msgstr "Entrada de conta"

View File

@@ -1031,13 +1031,3 @@ msgstr ""
#: model_terms:ir.ui.view,arch_db:account_loan.account_loan_post_form
msgid "or"
msgstr "ou"
#~ msgid "Invoice"
#~ msgstr "Fatura"
#, fuzzy
#~ msgid "Journal Entries"
#~ msgstr "Diário"
#~ msgid "Account Entry"
#~ msgstr "Movimento de Conta"

View File

@@ -1031,10 +1031,3 @@ msgstr ""
#: model_terms:ir.ui.view,arch_db:account_loan.account_loan_post_form
msgid "or"
msgstr "sau"
#~ msgid "Invoice"
#~ msgstr "Factura"
#, fuzzy
#~ msgid "Journal Entries"
#~ msgstr "Registru"

View File

@@ -1032,10 +1032,3 @@ msgstr ""
#: model_terms:ir.ui.view,arch_db:account_loan.account_loan_post_form
msgid "or"
msgstr "или"
#~ msgid "Invoice"
#~ msgstr "Счет"
#, fuzzy
#~ msgid "Journal Entries"
#~ msgstr "Журнал"

View File

@@ -1031,6 +1031,3 @@ msgstr ""
#: model_terms:ir.ui.view,arch_db:account_loan.account_loan_post_form
msgid "or"
msgstr ""
#~ msgid "Invoice"
#~ msgstr "Faktúra"

View File

@@ -1032,15 +1032,3 @@ msgstr ""
#: model_terms:ir.ui.view,arch_db:account_loan.account_loan_post_form
msgid "or"
msgstr "ali"
#~ msgid "Invoice"
#~ msgstr "Račun"
#~ msgid "Journal Entries"
#~ msgstr "Dnevniški vnosi"
#~ msgid "Planned"
#~ msgstr "Planirano"
#~ msgid "Account Entry"
#~ msgstr "Knjigovodski vnos"

View File

@@ -1031,7 +1031,3 @@ msgstr ""
#: model_terms:ir.ui.view,arch_db:account_loan.account_loan_post_form
msgid "or"
msgstr "ili"
#, fuzzy
#~ msgid "Journal Entries"
#~ msgstr "Dnevnik"

View File

@@ -1048,10 +1048,3 @@ msgstr "Vid kontroll kommer den första betalningen att vara på startdatum"
#: model_terms:ir.ui.view,arch_db:account_loan.account_loan_post_form
msgid "or"
msgstr "eller"
#~ msgid "Invoice"
#~ msgstr "Faktura"
#, fuzzy
#~ msgid "Journal Entries"
#~ msgstr "Journal"

View File

@@ -1030,6 +1030,3 @@ msgstr ""
#: model_terms:ir.ui.view,arch_db:account_loan.account_loan_post_form
msgid "or"
msgstr "หรือ"
#~ msgid "Invoice"
#~ msgstr "ใบแจ้งหนี้"

View File

@@ -1030,10 +1030,3 @@ msgstr ""
#: model_terms:ir.ui.view,arch_db:account_loan.account_loan_post_form
msgid "or"
msgstr "ya da"
#~ msgid "Invoice"
#~ msgstr "Fatura"
#, fuzzy
#~ msgid "Journal Entries"
#~ msgstr "Günlük"

View File

@@ -1031,10 +1031,3 @@ msgstr ""
#: model_terms:ir.ui.view,arch_db:account_loan.account_loan_post_form
msgid "or"
msgstr "ya da "
#~ msgid "Invoice"
#~ msgstr "Fatura"
#, fuzzy
#~ msgid "Journal Entries"
#~ msgstr "Yevmiye"

View File

@@ -1029,7 +1029,3 @@ msgstr ""
#: model_terms:ir.ui.view,arch_db:account_loan.account_loan_post_form
msgid "or"
msgstr "hoặc"
#, fuzzy
#~ msgid "Journal Entries"
#~ msgstr "Sổ nhật ký"

View File

@@ -1031,10 +1031,3 @@ msgstr ""
#: model_terms:ir.ui.view,arch_db:account_loan.account_loan_post_form
msgid "or"
msgstr "或"
#~ msgid "Invoice"
#~ msgstr "发票"
#, fuzzy
#~ msgid "Journal Entries"
#~ msgstr "凭证簿"

View File

@@ -1031,10 +1031,3 @@ msgstr ""
#: model_terms:ir.ui.view,arch_db:account_loan.account_loan_post_form
msgid "or"
msgstr "或"
#~ msgid "Invoice"
#~ msgstr "發票"
#, fuzzy
#~ msgid "Journal Entries"
#~ msgstr "帳簿"

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="account_loan_multi_company_rule" model="ir.rule">
<field name="domain_force">[('company_id', 'in', company_ids + [False])]</field>
</record>
<record id="account_loan_line_multi_company_rule" model="ir.rule">
<field name="domain_force">[('company_id', 'in', company_ids + [False])]</field>
</record>
</odoo>

View File

@@ -0,0 +1,10 @@
# Copyright 2024 Tecnativa - Víctor Martínez
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openupgradelib import openupgrade
@openupgrade.migrate()
def migrate(env, version):
openupgrade.load_data(
env.cr, "account_loan", "migrations/17.0.1.0.0/noupdate_changes.xml"
)

View File

@@ -27,7 +27,6 @@ class AccountLoan(models.Model):
name = fields.Char(
copy=False,
required=True,
readonly=True,
default="/",
)
partner_id = fields.Many2one(
@@ -35,13 +34,11 @@ class AccountLoan(models.Model):
required=True,
string="Lender",
help="Company or individual that lends the money at an interest rate.",
readonly=True,
)
company_id = fields.Many2one(
"res.company",
required=True,
default=_default_company,
readonly=True,
)
state = fields.Selection(
[
@@ -62,7 +59,6 @@ class AccountLoan(models.Model):
)
periods = fields.Integer(
required=True,
readonly=True,
help="Number of periods that the loan will last",
)
method_period = fields.Integer(
@@ -70,11 +66,9 @@ class AccountLoan(models.Model):
default=1,
help="State here the time between 2 depreciations, in months",
required=True,
readonly=True,
)
start_date = fields.Date(
help="Start of the moves",
readonly=True,
copy=False,
)
rate = fields.Float(
@@ -94,7 +88,6 @@ class AccountLoan(models.Model):
required=True,
help="Method of computation of the applied rate",
default="napr",
readonly=True,
)
loan_type = fields.Selection(
[
@@ -105,7 +98,6 @@ class AccountLoan(models.Model):
],
required=True,
help="Method of computation of the period annuity",
readonly=True,
default="fixed-annuity",
)
fixed_amount = fields.Monetary(
@@ -126,26 +118,20 @@ class AccountLoan(models.Model):
loan_amount = fields.Monetary(
currency_field="currency_id",
required=True,
readonly=True,
)
residual_amount = fields.Monetary(
currency_field="currency_id",
default=0.0,
required=True,
readonly=True,
help="Residual amount of the lease that must be payed on the end in "
"order to acquire the asset",
)
round_on_end = fields.Boolean(
default=False,
help="When checked, the differences will be applied on the last period"
", if it is unchecked, the annuity will be recalculated on each "
"period.",
readonly=True,
)
payment_on_first_period = fields.Boolean(
default=False,
readonly=True,
help="When checked, the first payment will be on start date",
)
currency_id = fields.Many2one(
@@ -158,7 +144,6 @@ class AccountLoan(models.Model):
"account.journal",
domain="[('company_id', '=', company_id),('type', '=', journal_type)]",
required=True,
readonly=True,
)
short_term_loan_account_id = fields.Many2one(
"account.account",
@@ -166,14 +151,12 @@ class AccountLoan(models.Model):
string="Short term account",
help="Account that will contain the pending amount on short term",
required=True,
readonly=True,
)
long_term_loan_account_id = fields.Many2one(
"account.account",
string="Long term account",
help="Account that will contain the pending amount on Long term",
domain="[('company_id', '=', company_id)]",
readonly=True,
)
interest_expenses_account_id = fields.Many2one(
"account.account",
@@ -181,16 +164,11 @@ class AccountLoan(models.Model):
string="Interests account",
help="Account where the interests will be assigned to",
required=True,
readonly=True,
)
is_leasing = fields.Boolean(
default=False,
readonly=True,
)
is_leasing = fields.Boolean()
leased_asset_account_id = fields.Many2one(
"account.account",
domain="[('company_id', '=', company_id)]",
readonly=True,
)
product_id = fields.Many2one(
"product.product",

View File

@@ -27,35 +27,27 @@ class AccountLoanLine(models.Model):
)
company_id = fields.Many2one(
"res.company",
readonly=True,
related="loan_id.company_id",
store=True,
)
partner_id = fields.Many2one(
"res.partner", readonly=True, related="loan_id.partner_id"
)
partner_id = fields.Many2one("res.partner", related="loan_id.partner_id")
is_leasing = fields.Boolean(
related="loan_id.is_leasing",
readonly=True,
)
journal_id = fields.Many2one(
"account.journal",
readonly=True,
related="loan_id.journal_id",
)
short_term_loan_account_id = fields.Many2one(
"account.account",
readonly=True,
related="loan_id.short_term_loan_account_id",
)
interest_expenses_account_id = fields.Many2one(
"account.account",
readonly=True,
related="loan_id.interest_expenses_account_id",
)
loan_type = fields.Selection(
related="loan_id.loan_type",
readonly=True,
)
loan_state = fields.Selection(
related="loan_id.state",
@@ -70,7 +62,6 @@ class AccountLoanLine(models.Model):
)
long_term_loan_account_id = fields.Many2one(
"account.account",
readonly=True,
related="loan_id.long_term_loan_account_id",
)
currency_id = fields.Many2one(

View File

@@ -4,17 +4,13 @@
<field name="name">Account loan multi-company</field>
<field ref="model_account_loan" name="model_id" />
<field eval="True" name="global" />
<field name="domain_force">
['|',('company_id','=',False),('company_id','in',company_ids)]
</field>
<field name="domain_force">[('company_id', 'in', company_ids + [False])]</field>
</record>
<record id="account_loan_line_multi_company_rule" model="ir.rule">
<field name="name">Account loan line multi-company</field>
<field ref="model_account_loan_line" name="model_id" />
<field eval="True" name="global" />
<field name="domain_force">
['|',('company_id','=',False),('company_id','in',company_ids)]
</field>
<field name="domain_force">[('company_id', 'in', company_ids + [False])]</field>
</record>
</odoo>

View File

@@ -7,7 +7,10 @@ from dateutil.relativedelta import relativedelta
from odoo import fields
from odoo.exceptions import UserError
from odoo.tests import TransactionCase, tagged
from odoo.tests import Form, tagged
from odoo.tools import mute_logger
from odoo.addons.base.tests.common import BaseCommon
_logger = logging.getLogger(__name__)
try:
@@ -17,7 +20,7 @@ except (OSError, ImportError) as err:
@tagged("post_install", "-at_install")
class TestLoan(TransactionCase):
class TestLoan(BaseCommon):
@classmethod
def setUpClass(cls):
super().setUpClass()
@@ -53,7 +56,7 @@ class TestLoan(TransactionCase):
)
def test_onchange(self):
loan = self.env["account.loan"].new(
loan = self.env["account.loan"].create(
{
"name": "LOAN",
"company_id": self.company.id,
@@ -69,13 +72,11 @@ class TestLoan(TransactionCase):
"partner_id": self.partner.id,
}
)
journal = loan.journal_id.id
loan.is_leasing = True
loan._onchange_is_leasing()
self.assertNotEqual(journal, loan.journal_id.id)
loan.company_id = self.company_02
loan._onchange_company()
self.assertFalse(loan.interest_expenses_account_id)
loan_form = Form(loan)
loan_form.is_leasing = True
self.assertNotEqual(loan.journal_id, loan_form.journal_id)
loan_form.company_id = self.company_02
self.assertFalse(loan_form.interest_expenses_account_id)
def test_partner_loans(self):
self.assertFalse(self.partner.lended_loan_count)
@@ -84,6 +85,7 @@ class TestLoan(TransactionCase):
action = self.partner.action_view_partner_lended_loans()
self.assertEqual(loan, self.env[action["res_model"]].search(action["domain"]))
@mute_logger("odoo.models.unlink")
def test_round_on_end(self):
loan = self.create_loan("fixed-annuity", 500000, 1, 60)
loan.round_on_end = True
@@ -103,6 +105,7 @@ class TestLoan(TransactionCase):
self.assertEqual(line_1.principal_amount, 0)
self.assertEqual(line_end.principal_amount, 500000)
@mute_logger("odoo.models.unlink")
def test_increase_amount_validation(self):
amount = 10000
periods = 24
@@ -149,6 +152,7 @@ class TestLoan(TransactionCase):
default_loan_id=loan.id
).create({"amount": -100, "date": line.date}).run()
@mute_logger("odoo.models.unlink")
def test_pay_amount_validation(self):
amount = 10000
periods = 24
@@ -200,6 +204,7 @@ class TestLoan(TransactionCase):
default_loan_id=loan.id
).create({"amount": -100, "fees": 100, "date": line.date}).run()
@mute_logger("odoo.models.unlink")
def test_increase_amount_loan(self):
amount = 10000
periods = 24
@@ -246,6 +251,7 @@ class TestLoan(TransactionCase):
self.assertEqual(loan, new_move.loan_id)
self.assertEqual(loan.pending_principal_amount, pending_principal_amount + 1000)
@mute_logger("odoo.models.unlink")
def test_increase_amount_leasing(self):
amount = 10000
periods = 24
@@ -298,6 +304,7 @@ class TestLoan(TransactionCase):
self.assertEqual(loan, new_move.loan_id)
self.assertEqual(loan.pending_principal_amount, pending_principal_amount + 1000)
@mute_logger("odoo.models.unlink")
def test_fixed_annuity_begin_loan(self):
amount = 10000
periods = 24
@@ -348,6 +355,7 @@ class TestLoan(TransactionCase):
with self.assertRaises(UserError):
line.view_process_values()
@mute_logger("odoo.models.unlink")
def test_fixed_annuity_loan(self):
amount = 10000
periods = 24
@@ -394,6 +402,7 @@ class TestLoan(TransactionCase):
with self.assertRaises(UserError):
line.view_process_values()
@mute_logger("odoo.models.unlink")
def test_fixed_principal_loan_leasing(self):
amount = 24000
periods = 24
@@ -498,6 +507,7 @@ class TestLoan(TransactionCase):
with self.assertRaises(UserError):
line.view_process_values()
@mute_logger("odoo.models.unlink")
def test_fixed_principal_loan_auto_post_leasing(self):
amount = 24000
periods = 24
@@ -525,6 +535,7 @@ class TestLoan(TransactionCase):
self.assertTrue(line.has_invoices)
self.assertTrue(line.has_moves)
@mute_logger("odoo.models.unlink")
def test_interests_on_end_loan(self):
amount = 10000
periods = 10
@@ -555,6 +566,7 @@ class TestLoan(TransactionCase):
self.assertEqual(loan.payment_amount - loan.interests_amount, amount)
self.assertEqual(loan.pending_principal_amount, 0)
@mute_logger("odoo.models.unlink")
def test_cancel_loan(self):
amount = 10000
periods = 10

View File

@@ -33,14 +33,14 @@
string="Values"
type="object"
icon="fa-eye"
invisible="has_moves == False and has_invoices == False"
invisible="not has_moves and not has_invoices"
/>
<button
name="view_process_values"
string="Process"
type="object"
icon="fa-cogs"
invisible="has_moves == True or has_invoices == True or loan_state != 'posted'"
invisible="has_moves or has_invoices or loan_state != 'posted'"
/>
</tree>
</field>
@@ -86,7 +86,11 @@
<field name="interests_amount" />
<field name="long_term_pending_principal_amount" />
<field name="long_term_principal_amount" />
<field name="company_id" optional="hide" />
<field
name="company_id"
optional="hide"
groups="base.group_multi_company"
/>
<field name="partner_id" optional="hide" />
<field name="journal_id" optional="hide" />
<field name="short_term_loan_account_id" optional="hide" />

View File

@@ -21,7 +21,7 @@
<tree>
<field name="name" />
<field name="partner_id" optional="hide" />
<field name="company_id" />
<field name="company_id" groups="base.group_multi_company" />
<field name="is_leasing" />
<field name="state" />
<field name="rate" optional="hide" />
@@ -62,7 +62,7 @@
name="view_account_invoices"
class="oe_stat_button"
icon="fa-pencil-square-o"
invisible="state == 'draft' or is_leasing == False"
invisible="state == 'draft' or not is_leasing"
type="object"
string="Invoices"
/>
@@ -98,10 +98,12 @@
</h1>
<group>
<group>
<field name="company_id" invisible="1" />
<field
name="company_id"
options="{'no_create': True}"
readonly="state != 'draft'"
groups="base.group_multi_company"
/>
<field name="loan_type" readonly="state != 'draft'" />
<field name="loan_amount" readonly="state != 'draft'" />
@@ -168,16 +170,12 @@
</group>
</group>
</page>
<page
string="Leasing"
id="leasing"
invisible="is_leasing == False"
>
<page string="Leasing" id="leasing" invisible="not is_leasing">
<group>
<group>
<field
name="leased_asset_account_id"
required="is_leasing == True"
required="is_leasing"
readonly="state != 'draft'"
/>
<field
@@ -186,13 +184,10 @@
/>
</group>
<group>
<field
name="product_id"
required="is_leasing == True"
/>
<field name="product_id" required="is_leasing" />
<field
name="interests_product_id"
required="is_leasing == True"
required="is_leasing"
/>
<field name="post_invoice" />
</group>

View File

@@ -11,7 +11,7 @@
<field name="date" position="after">
<field
name="loan_line_id"
invisible="loan_line_id == False"
invisible="not loan_line_id"
readonly="True"
/>
</field>

View File

@@ -19,7 +19,6 @@
type="object"
class="oe_highlight"
/>
or
<button string="Cancel" class="oe_link" special="cancel" />
</footer>
</form>

View File

@@ -21,7 +21,6 @@
type="object"
class="oe_highlight"
/>
or
<button string="Cancel" class="oe_link" special="cancel" />
</footer>
</form>

View File

@@ -23,7 +23,6 @@
type="object"
class="oe_highlight"
/>
or
<button string="Cancel" class="oe_link" special="cancel" />
</footer>
</form>

View File

@@ -20,7 +20,6 @@
type="object"
class="oe_highlight"
/>
or
<button string="Cancel" class="oe_link" special="cancel" />
</footer>
</form>