Skip to content

Commit

Permalink
[REF] rename account.wallet.type 'no_anonymous' field into 'automatic…
Browse files Browse the repository at this point in the history
…_nominative_creation' for better comprehension
  • Loading branch information
legalsylvain committed Aug 2, 2022
1 parent 6b8c6d7 commit 0d0e392
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 7 deletions.
2 changes: 1 addition & 1 deletion account_wallet/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

{
"name": "Account Wallet",
"version": "14.0.1.0.0",
"version": "14.0.2.0.0",
"author": "Odoo Community Association (OCA), ACSONE SA/NV",
"category": "Accounting & Finance",
"website": "https://github.com/OCA/wallet",
Expand Down
13 changes: 13 additions & 0 deletions account_wallet/migrations/14.0.2.0.0/pre-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright (C) 2022-Today: GRAP (http://www.grap.coop)
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from openupgradelib import openupgrade


@openupgrade.migrate()
def migrate(env, version):
if openupgrade.column_exists(env.cr, "account_wallet_type", "no_anonymous"):
openupgrade.rename_columns(
{"account_wallet_type": [("no_anonymous", "automatic_nominative_creation")]}
)
2 changes: 1 addition & 1 deletion account_wallet/models/account_move_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def _prepare_account_wallet_values(self, wallet_type):
vals = {
"wallet_type_id": wallet_type.id,
}
if wallet_type.no_anonymous:
if wallet_type.automatic_nominative_creation:
vals.update(
{
"partner_id": self.partner_id.id,
Expand Down
5 changes: 3 additions & 2 deletions account_wallet/models/account_wallet_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@ class AccountWalletType(models.Model):
required=True,
)

no_anonymous = fields.Boolean(
help="Check this box if you want to generate only nominative wallets."
automatic_nominative_creation = fields.Boolean(
help="Check this box if you want to automaticaly create nominative wallets"
" (related to a partner) when selling products related to a wallet type."
)

_sql_constraints = [
Expand Down
4 changes: 2 additions & 2 deletions account_wallet/tests/test_wallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def test_wallet_name(self):

def test_wallet_anonymous(self):
# Default Configuration
self.wallet_type.no_anonymous = False
self.wallet_type.automatic_nominative_creation = False

# Credit Wallet
invoice, wallet = self._create_invoice_credit_wallet(100)
Expand All @@ -33,7 +33,7 @@ def test_wallet_anonymous(self):
def test_wallet_with_partner(self):

# Forbid anonymous wallet
self.wallet_type.no_anonymous = True
self.wallet_type.automatic_nominative_creation = True

# Credit Wallet
invoice, wallet = self._create_invoice_credit_wallet(200)
Expand Down
2 changes: 1 addition & 1 deletion account_wallet/views/account_wallet_type.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
name="company_id"
groups="base.group_multi_company"
/>
<field name="no_anonymous" />
<field name="automatic_nominative_creation" />
</group>
</group>
</sheet>
Expand Down

0 comments on commit 0d0e392

Please sign in to comment.