Skip to content

Commit

Permalink
[MIG] hr_expense_invoice: Migration to 18.0
Browse files Browse the repository at this point in the history
  • Loading branch information
cav-adhoc committed Dec 12, 2024
1 parent e890a97 commit e3fad11
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion hr_expense_invoice/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

{
"name": "Supplier invoices on HR expenses",
"version": "17.0.1.0.2",
"version": "18.0.1.0.0",
"category": "Human Resources",
"author": "Tecnativa, Odoo Community Association (OCA)",
"license": "AGPL-3",
Expand Down
4 changes: 2 additions & 2 deletions hr_expense_invoice/models/hr_expense_sheet.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def set_to_paid(self):

def _compute_invoice_count(self):
Invoice = self.env["account.move"]
can_read = Invoice.check_access_rights("read", raise_exception=False)
can_read = Invoice.check_access("read")
for sheet in self:
sheet.invoice_count = (
can_read and len(sheet.expense_line_ids.mapped("invoice_id")) or 0
Expand Down Expand Up @@ -141,7 +141,7 @@ def action_view_invoices(self):
action["view_mode"] = "form"
action["views"] = [(view.id, "form")]
else:
action["view_mode"] = "tree,form"
action["view_mode"] = "list,form"
action["domain"] = [("id", "in", invoice_ids)]
return action

Expand Down
7 changes: 3 additions & 4 deletions hr_expense_invoice/tests/test_hr_expense_invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@

from odoo import fields
from odoo.exceptions import UserError, ValidationError
from odoo.tests import tagged
from odoo.tests.common import Form
from odoo.tests import tagged, Form

from odoo.addons.base.tests.common import DISABLED_MAIL_CONTEXT
from odoo.addons.hr_expense.tests.common import TestExpenseCommon
Expand All @@ -16,8 +15,8 @@
@tagged("post_install", "-at_install")
class TestHrExpenseInvoice(TestExpenseCommon):
@classmethod
def setUpClass(cls, chart_template_ref=None):
super().setUpClass(chart_template_ref=chart_template_ref)
def setUpClass(cls):
super().setUpClass()
cls.env = cls.env(context=dict(cls.env.context, **DISABLED_MAIL_CONTEXT))
cls.account_payment_register = cls.env["account.payment.register"]
cls.payment_obj = cls.env["account.payment"]
Expand Down
4 changes: 2 additions & 2 deletions hr_expense_invoice/views/hr_expense_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,14 @@
<field name="inherit_id" ref="hr_expense.view_hr_expense_sheet_form" />
<field name="arch" type="xml">
<xpath
expr="//field[@name='expense_line_ids']/tree/field[@name='name']"
expr="//field[@name='expense_line_ids']/list/field[@name='name']"
position="after"
>
<field name="invoice_id" groups="account.group_account_invoice" />
<field name="quantity" invisible="1" />
</xpath>
<xpath
expr="//field[@name='expense_line_ids']/tree/field[@name='total_amount_currency']"
expr="//field[@name='expense_line_ids']/list/field[@name='total_amount_currency']"
position="after"
>
<field name="sheet_id_state" invisible="1" />
Expand Down

0 comments on commit e3fad11

Please sign in to comment.