Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions addons/hr_expense/models/hr_expense.py
Original file line number Diff line number Diff line change
Expand Up @@ -1278,6 +1278,12 @@ def action_show_same_receipt_expense_ids(self):
name=_("Expenses with a similar receipt to %(other_expense_name)s", other_expense_name=self.name),
)

def action_show_duplicate_expense_ids(self):
self.ensure_one()
return self.duplicate_expense_ids._get_records_action(
name=self.env._("Duplicate Expenses to %(other_expense_name)s", other_expense_name=self.name),
)
Comment on lines +1281 to +1285

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should subtract self from the recordset you render so you don't show the current record to the user
Rest looks good, good job!


@api.model
def get_expense_dashboard(self):
expense_state = {
Expand Down
3 changes: 3 additions & 0 deletions addons/hr_expense/views/hr_expense_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,9 @@
<div class="alert alert-warning oe_edit_only" role="alert" name="warning_duplicate_receipt_expense" invisible="not same_receipt_expense_ids">
An <a type="object" name="action_show_same_receipt_expense_ids">expense</a> with the same receipt already exists.
</div>
<div class="alert alert-warning oe_edit_only" role="alert" name="warning_duplicate_expense" invisible="not duplicate_expense_ids">
A duplicate <a type="object" name="action_show_duplicate_expense_ids">expense</a> already exists.
</div>
<sheet>
<div class="oe_button_box" name="button_box">
<button name="action_open_split_expense"
Expand Down