[IMP] account: Improve distinction between payment and bank statement
Increase the distinction between a journal entry linked to a bank statement line and another one linked to a payment by adding a smart button linked to them. Also improve the navigation from the Bank And Cash view to directly open the linked bank statement line or payment. Task id #2448618 closes odoo/odoo#65316 Signed-off-by: William André (wan) <wan@odoo.com>
This commit is contained in:
@@ -196,6 +196,12 @@ class AccountMove(models.Model):
|
||||
statement_line_id = fields.Many2one(
|
||||
comodel_name='account.bank.statement.line',
|
||||
string="Statement Line", copy=False, check_company=True)
|
||||
statement_id = fields.Many2one(
|
||||
related='statement_line_id.statement_id',
|
||||
copy=False,
|
||||
readonly=True,
|
||||
help="Technical field used to open the linked bank statement from the edit button in a group by view,"
|
||||
" or via the smart button on journal entries.")
|
||||
|
||||
# === Amount fields ===
|
||||
amount_untaxed = fields.Monetary(string='Untaxed Amount', store=True, readonly=True, tracking=True,
|
||||
@@ -2331,6 +2337,24 @@ class AccountMove(models.Model):
|
||||
def open_reconcile_view(self):
|
||||
return self.line_ids.open_reconcile_view()
|
||||
|
||||
def open_bank_statement_view(self):
|
||||
return {
|
||||
'type': 'ir.actions.act_window',
|
||||
'res_model': 'account.bank.statement',
|
||||
'view_mode': 'form',
|
||||
'res_id': self.statement_id.id,
|
||||
'views': [(False, 'form')],
|
||||
}
|
||||
|
||||
def open_payment_view(self):
|
||||
return {
|
||||
'type': 'ir.actions.act_window',
|
||||
'res_model': 'account.payment',
|
||||
'view_mode': 'form',
|
||||
'res_id': self.payment_id.id,
|
||||
'views': [(False, 'form')],
|
||||
}
|
||||
|
||||
@api.model
|
||||
def message_new(self, msg_dict, custom_values=None):
|
||||
# OVERRIDE
|
||||
|
||||
@@ -214,7 +214,12 @@
|
||||
domain="[('applicability', '=', 'taxes')]"/>
|
||||
<groupby name="move_id">
|
||||
<field name="state" invisible="1"/>
|
||||
<button name="edit" type="edit" icon="fa-edit" title="Edit"/>
|
||||
<field name="move_type" invisible="1"/>
|
||||
<field name="statement_id" invisible="1"/>
|
||||
<field name="payment_id" invisible="1"/>
|
||||
<button name="edit" type="edit" icon="fa-edit" title="Edit" attrs="{'invisible': ['&', ('move_type', '=', 'entry'), '|', ('statement_id', '!=', False), ('payment_id', '!=', False)]}"/>
|
||||
<button name="open_bank_statement_view" type="object" icon="fa-edit" title="Edit" attrs="{'invisible': ['|', ('move_type', '!=', 'entry'), ('statement_id', '=', False)]}"/>
|
||||
<button name="open_payment_view" type="object" icon="fa-edit" title="Edit" attrs="{'invisible': ['|', ('move_type', '!=', 'entry'), ('payment_id', '=', False)]}"/>
|
||||
<button name="action_post" states="draft" icon="fa-check" title="Post" type="object" groups="account.group_account_invoice"/>
|
||||
<button name="%(action_view_account_move_reversal)d" states="posted" title="Reverse" icon="fa-refresh" type="action" groups="account.group_account_invoice"/>
|
||||
<button name="action_duplicate" icon="fa-files-o" title="Duplicate" type="object" groups="account.group_account_invoice"/>
|
||||
@@ -610,6 +615,20 @@
|
||||
</div>
|
||||
<sheet>
|
||||
<div name="button_box" class="oe_button_box">
|
||||
<button name="open_bank_statement_view"
|
||||
class="oe_stat_button"
|
||||
icon="fa-bars"
|
||||
type="object"
|
||||
attrs="{'invisible': ['|', '|', ('move_type', '!=', 'entry'), ('id', '=', False), ('statement_id', '=', False)]}"
|
||||
string="1 Statement">
|
||||
</button>
|
||||
<button name="open_payment_view"
|
||||
class="oe_stat_button"
|
||||
icon="fa-bars"
|
||||
type="object"
|
||||
attrs="{'invisible': ['|', '|', ('move_type', '!=', 'entry'), ('id', '=', False), ('payment_id', '=', False)]}"
|
||||
string="1 Payment">
|
||||
</button>
|
||||
<button name="open_reconcile_view"
|
||||
class="oe_stat_button"
|
||||
icon="fa-bars"
|
||||
@@ -655,6 +674,8 @@
|
||||
<field name="restrict_mode_hash_table" invisible="1"/>
|
||||
<field name="country_code" invisible="1"/>
|
||||
<field name="display_inactive_currency_warning" invisible="1"/>
|
||||
<field name="statement_id" invisible="1"/>
|
||||
<field name="payment_id" invisible="1"/>
|
||||
|
||||
<div class="oe_title">
|
||||
<!-- Invoice draft header -->
|
||||
|
||||
Reference in New Issue
Block a user