diff options
| -rw-r--r-- | addons/account/models/account_journal.py | 2 | ||||
| -rw-r--r-- | addons/account/views/account_journal_dashboard_view.xml | 3 | ||||
| -rw-r--r-- | addons/account/wizard/setup_wizards.py | 8 | ||||
| -rw-r--r-- | addons/account/wizard/setup_wizards_view.xml | 6 |
4 files changed, 10 insertions, 9 deletions
diff --git a/addons/account/models/account_journal.py b/addons/account/models/account_journal.py index f9e5ef905fa..310b394770e 100644 --- a/addons/account/models/account_journal.py +++ b/addons/account/models/account_journal.py @@ -60,7 +60,7 @@ class AccountJournal(models.Model): default_account_type = fields.Many2one('account.account.type', compute="_compute_default_account_type") default_account_id = fields.Many2one( comodel_name='account.account', check_company=True, copy=False, ondelete='restrict', - string='Default Account', help="It acts as a default account", + string='Default Account', domain="[('deprecated', '=', False), ('company_id', '=', company_id)," "('user_type_id', '=', default_account_type)," "('user_type_id.type', 'not in', ('receivable', 'payable'))]") diff --git a/addons/account/views/account_journal_dashboard_view.xml b/addons/account/views/account_journal_dashboard_view.xml index bddfb61a391..f9b9efdfe5d 100644 --- a/addons/account/views/account_journal_dashboard_view.xml +++ b/addons/account/views/account_journal_dashboard_view.xml @@ -12,6 +12,7 @@ <field name="kanban_dashboard"/> <field name="activity_ids"/> <field name="activity_state"/> + <field name="alias_domain"/> <templates> <t t-name="kanban-box"> <div t-attf-class="#{!selection_mode ? kanban_color(record.color.raw_value) : ''}"> @@ -37,7 +38,7 @@ <div class="o_primary"> <a type="object" name="open_action"><field name="name"/></a> </div> - <div class="o_secondary" t-att-title="dashboard.title" t-if="alias_id != ''"> + <div class="o_secondary" t-att-title="dashboard.title" t-if="journal_type == 'purchase' && record.alias_domain.raw_value"> <field name="alias_id"/> </div> </div> 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', '<', 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> |
