[IMP] expense: Add smart button on expense connected to his entry.

Task ID: #2464735

closes odoo/odoo#69020

Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
This commit is contained in:
Florian Gilbert
2021-05-03 06:06:10 +00:00
parent 0763d3a4f4
commit 061a811aff
2 changed files with 20 additions and 3 deletions
+11
View File
@@ -1025,6 +1025,17 @@ class HrExpenseSheet(models.Model):
}
return res
def action_open_account_move(self):
self.ensure_one()
return {
'name': self.account_move_id.name,
'type': 'ir.actions.act_window',
'view_type': 'form',
'view_mode': 'form',
'res_model': 'account.move',
'res_id': self.account_move_id.id
}
# --------------------------------------------
# Business
# --------------------------------------------
+9 -3
View File
@@ -696,6 +696,15 @@
</header>
<sheet>
<div class="oe_button_box" name="button_box">
<button name="action_open_account_move"
class="oe_stat_button"
icon="fa-file-text-o"
type="object"
attrs="{'invisible': ['|', ('state', 'not in', ['post', 'done']), ('account_move_id', '=', False)]}"
groups="account.group_account_invoice,account.group_account_readonly">
Journal Entry
</button>
<field name="account_move_id" invisible="1"/>
<button name="action_get_attachment_view"
class="oe_stat_button"
icon="fa-file-text-o"
@@ -768,9 +777,6 @@
<field name="bank_journal_id" groups="account.group_account_invoice,account.group_account_readonly" options="{'no_open': True, 'no_create': True}" attrs="{'invisible': [('payment_mode', '!=', 'company_account')]}" context="{'default_company_id': company_id}"/>
<field name="accounting_date" groups="account.group_account_invoice,account.group_account_readonly" attrs="{'invisible': [('state', 'not in', ['approve', 'post', 'done'])]}"/>
</group>
<group>
<field name="account_move_id" groups="account.group_account_invoice,account.group_account_readonly" attrs="{'invisible': [('state', 'not in', ['post', 'done'])]}" readonly="1"/>
</group>
</group>
</page>
</notebook>