[IMP] account: Improvement of accounting dashboard kanban

Rework the button displayed on the kanban.
Part of task 3086715

closes odoo/odoo#108024

Related: odoo/upgrade#4394
Related: odoo/enterprise#34992
Signed-off-by: Cedric Snauwaert <csn@odoo.com>
This commit is contained in:
Nicolas (vin)
2023-03-07 01:59:25 +01:00
committed by csnauwaert
parent 3b801a6d48
commit ab14228f01
3 changed files with 18 additions and 7 deletions
+6 -1
View File
@@ -37,7 +37,7 @@ class AccountJournal(models.Model):
_name = "account.journal"
_description = "Journal"
_order = 'sequence, type, code'
_inherit = ['mail.thread', 'mail.activity.mixin']
_inherit = ['mail.thread', 'mail.activity.mixin', 'portal.mixin']
_check_company_auto = True
_rec_names_search = ['name', 'code']
@@ -709,6 +709,11 @@ class AccountJournal(models.Model):
# We simply call the setup bar function.
return self.env['res.company'].setting_init_bank_account_action()
def action_new_transaction(self):
action = self.env['ir.actions.act_window']._for_xml_id('account.action_bank_statement_tree')
action['context'] = {'default_journal_id': self.id}
return action
def _create_document_from_attachment(self, attachment_ids):
""" Create the invoices from files."""
move_type = self._context.get("default_move_type", "entry")
@@ -242,13 +242,18 @@
<!-- On the left, display :
- A button corresponding to the bank_statements_source, if it wasn't configured, a button for each of them
- If there are statements to reconcile, a link to reconcile them -->
<div id="dashboard_bank_cash_left" class="col-12 col-sm-5 mb-3 mb-sm-0 o_kanban_primary_left">
<div id="dashboard_bank_cash_left" class="col-12 col-sm-6 mb-3 mb-sm-0 o_kanban_primary_left">
<t t-if="journal_type == 'bank'">
<t t-if="dashboard.bank_statements_source == 'undefined' or dashboard.bank_statements_source == 'online_sync'">
<a t-if="dashboard.number_to_reconcile > 0" name="action_configure_bank_journal" type="object" class="oe_inline" groups="account.group_account_invoice">Connect</a>
<button t-if="dashboard.number_to_reconcile == 0" name="action_configure_bank_journal" type="object" class="btn btn-primary" groups="account.group_account_invoice">Connect</button>
<button name="action_configure_bank_journal" type="object" class="btn btn-primary" groups="account.group_account_invoice">Connect</button>
</t>
<div name="bank_journal_cta" class="mt-3 mt-sm-0"/>
<div id="transactions" class="d-flex mt-3 mt-sm-0" style="gap: 5px;">
<div name="bank_journal_cta" class="w-100">
<div name="bank_journal_transactions" class="w-100 d-flex" style="gap: 5px;">
<a id="create_transaction" name="action_new_transaction" type="object" groups="account.group_account_invoice">Create</a>
</div>
</div>
</div>
</t>
<t t-if="journal_type == 'cash'">
<a t-if="dashboard.number_to_reconcile > 0" type="object" name="create_cash_statement" class="oe_inline" groups="account.group_account_invoice">New Transaction</a>
@@ -256,7 +261,7 @@
</t>
</div>
<!-- On the right, show other common informations/actions -->
<div id="dashboard_bank_cash_right" class="col-12 col-sm-7 o_kanban_primary_right">
<div id="dashboard_bank_cash_right" class="col-12 col-sm-6 o_kanban_primary_right">
<div class="row" t-if="dashboard.nb_lines_bank_account_balance > 0">
<div id="dashboard_bank_cash_balance" class="col overflow-hidden text-start">
<span title="Balance in General Ledger">Balance in GL</span>
+2 -1
View File
@@ -133,12 +133,13 @@ class SetupBarBankConfigWizard(models.TransientModel):
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({
record.linked_journal_id = self.env['account.journal'].create({
'name': record.new_journal_name,
'code': new_journal_code,
'type': 'bank',
'company_id': company.id,
'bank_account_id': record.res_partner_bank_id.id,
'bank_statements_source': 'file_import',
})
else:
selected_journal.bank_account_id = record.res_partner_bank_id.id