Commit 06c8c6d3 authored by vincent.hatakeyama's avatar vincent.hatakeyama

馃殤 fix error in period name_search

--HG--
branch : 13.0
parent 1dfd322dd0d2
Pipeline #14518 passed with stages
in 9 minutes and 58 seconds
=========
Changelog
=========
13.0.1.1.1
----------
Fix error in period name_search.
13.0.1.1.0
----------
......
.. _README:
==================
Accounting Periods
==================
......
##############################################################################
#
# Accounting Periods, for Odoo
# Copyright (C) 2018, 2020 XCG Consulting <http://odoo.consulting>
# Copyright (C) 2018, 2020-2021 XCG Consulting <https://odoo.consulting/>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
......@@ -22,10 +22,10 @@
"name": "Accounting Periods",
"license": "AGPL-3",
"summary": "Add period accounting concept",
"version": "13.0.1.1.0",
"version": "13.0.1.1.1",
"category": "Accounting/Accounting",
"author": "XCG Consulting",
"website": "http://odoo.consulting/",
"website": "https://odoo.consulting/",
"depends": ["account"],
"data": [
"security/ir.model.access.csv",
......
##############################################################################
#
# Accounting periods, for Odoo
# Copyright (C) 2018 XCG Consulting <http://odoo.consulting>
# Copyright (C) 2018, 2021 XCG Consulting <https://odoo.consulting/>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
......@@ -144,8 +144,9 @@ class AccountPeriod(models.Model):
@api.model
def name_search(self, name="", args=None, operator="ilike", limit=100):
"""Override to add company filter."""
"""Override to add company filter.
"""
args = list(args or [])
args.append(("company_id", "=", self.env.company.id))
return super(AccountPeriod, self).name_search(
name=name, args=args, operator=operator, limit=limit
......
......@@ -207,3 +207,8 @@ class Test(odoo.tests.TransactionCase):
self.assertEqual(invoice.state, "draft")
invoice.post()
self.assertEqual(invoice.state, "posted")
def test_name_search(self):
results = self.env["account.period"].name_search()
# 12 periods for 2017, and the current year are created in demo data
self.assertEqual(len(results), 24)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment