summaryrefslogtreecommitdiff
path: root/addons/account/wizard
diff options
context:
space:
mode:
authorNicolas (vin) <vin@odoo.com>2020-08-20 06:11:38 +0000
committerNicolas (vin) <vin@odoo.com>2020-08-20 10:21:33 +0000
commit0a4c093926b3446af6f985931cb6472f1c6d7f09 (patch)
tree28c84bfb5d11571dcdd018b1c6442b05cc7eaf53 /addons/account/wizard
parent4688b2dd9d5ffdb929f4f36fddea1dab1e5a233f (diff)
[FIX] account: misc. fixes
The tooltip message on default_account in the journal is too obvious, and it has an issue (There is no way to control the tooltip title when the field appears multiple times in the view, it is always taking the label of the last time the field appears) which is a limitation of the framework. Thus, it is removed. Fix the display of emails on the accounting dashboard, as they only should be visible when properly set and on the purchase journal. Improve the flow of the new bank account wizard to avoid forcing the user to chose an existing journal when one of them exists without account. This should still be a possibility, but the user should be able to decide to create a new journal if wanted. Task id #2322724 closes odoo/odoo#56177 Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
Diffstat (limited to 'addons/account/wizard')
-rw-r--r--addons/account/wizard/setup_wizards.py8
-rw-r--r--addons/account/wizard/setup_wizards_view.xml6
2 files changed, 7 insertions, 7 deletions
diff --git a/addons/account/wizard/setup_wizards.py b/addons/account/wizard/setup_wizards.py
index 2fde6629520..8ad705468d2 100644
--- a/addons/account/wizard/setup_wizards.py
+++ b/addons/account/wizard/setup_wizards.py
@@ -79,7 +79,8 @@ class SetupBarBankConfigWizard(models.TransientModel):
num_journals_without_account = fields.Integer(default=lambda self: self._number_unlinked_journal())
def _number_unlinked_journal(self):
- return self.env['account.journal'].search([('type', '=', 'bank'), ('bank_account_id', '=', False)], count=True)
+ return self.env['account.journal'].search([('type', '=', 'bank'), ('bank_account_id', '=', False),
+ ('id', '!=', self.default_linked_journal_id())], count=True)
@api.onchange('acc_number')
def _onchange_acc_number(self):
@@ -122,8 +123,8 @@ class SetupBarBankConfigWizard(models.TransientModel):
"""
for record in self:
selected_journal = record.linked_journal_id
- new_journal_code = self.env['account.journal'].get_next_bank_cash_default_code('bank', self.env.company)
- if record.num_journals_without_account == 0:
+ if not selected_journal:
+ new_journal_code = self.env['account.journal'].get_next_bank_cash_default_code('bank', self.env.company)
company = self.env.company
selected_journal = self.env['account.journal'].create({
'name': record.new_journal_name,
@@ -135,7 +136,6 @@ class SetupBarBankConfigWizard(models.TransientModel):
else:
selected_journal.bank_account_id = record.res_partner_bank_id.id
selected_journal.name = record.new_journal_name
- selected_journal.code = new_journal_code
def validate(self):
""" Called by the validation button of this wizard. Serves as an
diff --git a/addons/account/wizard/setup_wizards_view.xml b/addons/account/wizard/setup_wizards_view.xml
index 52f0e5ff1b3..7f4792f32a5 100644
--- a/addons/account/wizard/setup_wizards_view.xml
+++ b/addons/account/wizard/setup_wizards_view.xml
@@ -48,12 +48,12 @@
<field name="bank_id" placeholder="e.g Bank of America"/>
</group>
</group>
- <group attrs="{'invisible': [('num_journals_without_account', '&lt;', 2)]}">
+ <group attrs="{'invisible': [('num_journals_without_account', '=', 0)]}">
<group>
- <field name="linked_journal_id" attrs="{'required': [('num_journals_without_account','!=',0)]}"/>
+ <field name="linked_journal_id" options="{'no_create': True}"/>
</group>
<group>
- <span class="text-muted">Only journals not yet linked to a bank account are proposed</span>
+ <span class="text-muted">Leave empty to create a new journal for this bank account, or select a journal to link it with the bank account.</span>
</group>
</group>
</sheet>