[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:
@@ -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
|
||||
# --------------------------------------------
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user