From 0e946daadd67c4b9a99c8567c31ac37320507311 Mon Sep 17 00:00:00 2001
From: ps-tubtim
Date: Mon, 17 Aug 2020 14:57:43 +0700
Subject: [PATCH 01/16] [12.0][ADD] hr_expense_advance_clearing_sequence
---
.../README.rst | 84 ++++
.../__init__.py | 3 +
.../__manifest__.py | 20 +
.../data/hr_expense_data.xml | 11 +
.../models/__init__.py | 3 +
.../models/hr_expense_sheet.py | 24 +
.../readme/CONFIGURE.rst | 6 +
.../readme/CONTRIBUTORS.rst | 1 +
.../readme/DESCRIPTION.rst | 2 +
.../static/description/icon.png | Bin 0 -> 9455 bytes
.../static/description/index.html | 429 ++++++++++++++++++
.../tests/__init__.py | 3 +
...st_hr_expense_advance_clearing_sequence.py | 96 ++++
13 files changed, 682 insertions(+)
create mode 100644 hr_expense_advance_clearing_sequence/README.rst
create mode 100644 hr_expense_advance_clearing_sequence/__init__.py
create mode 100644 hr_expense_advance_clearing_sequence/__manifest__.py
create mode 100644 hr_expense_advance_clearing_sequence/data/hr_expense_data.xml
create mode 100644 hr_expense_advance_clearing_sequence/models/__init__.py
create mode 100644 hr_expense_advance_clearing_sequence/models/hr_expense_sheet.py
create mode 100644 hr_expense_advance_clearing_sequence/readme/CONFIGURE.rst
create mode 100644 hr_expense_advance_clearing_sequence/readme/CONTRIBUTORS.rst
create mode 100644 hr_expense_advance_clearing_sequence/readme/DESCRIPTION.rst
create mode 100644 hr_expense_advance_clearing_sequence/static/description/icon.png
create mode 100644 hr_expense_advance_clearing_sequence/static/description/index.html
create mode 100644 hr_expense_advance_clearing_sequence/tests/__init__.py
create mode 100644 hr_expense_advance_clearing_sequence/tests/test_hr_expense_advance_clearing_sequence.py
diff --git a/hr_expense_advance_clearing_sequence/README.rst b/hr_expense_advance_clearing_sequence/README.rst
new file mode 100644
index 000000000..8b924fc92
--- /dev/null
+++ b/hr_expense_advance_clearing_sequence/README.rst
@@ -0,0 +1,84 @@
+====================================
+HR Expense Advance Clearing Sequence
+====================================
+
+.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ !! This file is generated by oca-gen-addon-readme !!
+ !! changes will be overwritten. !!
+ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
+ :target: https://odoo-community.org/page/development-status
+ :alt: Beta
+.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
+ :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
+ :alt: License: AGPL-3
+.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fhr-lightgray.png?logo=github
+ :target: https://github.com/OCA/hr/tree/12.0/hr_expense_advance_clearing_sequence
+ :alt: OCA/hr
+.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
+ :target: https://translation.odoo-community.org/projects/hr-12-0/hr-12-0-hr_expense_advance_clearing_sequence
+ :alt: Translate me on Weblate
+.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
+ :target: https://runbot.odoo-community.org/runbot/116/12.0
+ :alt: Try me on Runbot
+
+|badge1| |badge2| |badge3| |badge4| |badge5|
+
+This module adds the possibility to define a sequence for the expense report's reference that Employee advance.
+This reference is then set as default when you create a new expense report, using the defined sequence.
+
+**Table of contents**
+
+.. contents::
+ :local:
+
+Configuration
+=============
+
+You can change the default sequence (EXAV0001) by the one of your choice
+going to *Settings > Technical > Sequences & Identifiers > Sequences*, and
+editing the record `Expense report sequence (Advance)`.
+
+You will only have access to that section if your section has `Technical features`
+permission check marked.
+
+Bug Tracker
+===========
+
+Bugs are tracked on `GitHub Issues `_.
+In case of trouble, please check there if your issue has already been reported.
+If you spotted it first, help us smashing it by providing a detailed and welcomed
+`feedback `_.
+
+Do not contact contributors directly about support or help with technical issues.
+
+Credits
+=======
+
+Authors
+~~~~~~~
+
+* Ecosoft
+
+Contributors
+~~~~~~~~~~~~
+
+* Pimolnat Suntian
+
+Maintainers
+~~~~~~~~~~~
+
+This module is maintained by the OCA.
+
+.. image:: https://odoo-community.org/logo.png
+ :alt: Odoo Community Association
+ :target: https://odoo-community.org
+
+OCA, or the Odoo Community Association, is a nonprofit organization whose
+mission is to support the collaborative development of Odoo features and
+promote its widespread use.
+
+This module is part of the `OCA/hr `_ project on GitHub.
+
+You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
diff --git a/hr_expense_advance_clearing_sequence/__init__.py b/hr_expense_advance_clearing_sequence/__init__.py
new file mode 100644
index 000000000..8ebc8a7c5
--- /dev/null
+++ b/hr_expense_advance_clearing_sequence/__init__.py
@@ -0,0 +1,3 @@
+# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html)
+
+from . import models
diff --git a/hr_expense_advance_clearing_sequence/__manifest__.py b/hr_expense_advance_clearing_sequence/__manifest__.py
new file mode 100644
index 000000000..d5f174ee0
--- /dev/null
+++ b/hr_expense_advance_clearing_sequence/__manifest__.py
@@ -0,0 +1,20 @@
+# Copyright 2019 Ecosoft Co., Ltd (http://ecosoft.co.th/)
+# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html)
+
+{
+ 'name': 'HR Expense Advance Clearing Sequence',
+ 'version': '12.0.1.0.0',
+ 'license': 'AGPL-3',
+ 'category': 'Human Resources',
+ 'author': 'Ecosoft, Odoo Community Association (OCA)',
+ 'website': 'https://github.com/OCA/hr',
+ 'depends': [
+ 'hr_expense_sequence',
+ 'hr_expense_advance_clearing',
+ ],
+ 'data': [
+ 'data/hr_expense_data.xml',
+ ],
+ 'installable': True,
+ 'maintainer': 'ps-tubtim',
+}
diff --git a/hr_expense_advance_clearing_sequence/data/hr_expense_data.xml b/hr_expense_advance_clearing_sequence/data/hr_expense_data.xml
new file mode 100644
index 000000000..495198211
--- /dev/null
+++ b/hr_expense_advance_clearing_sequence/data/hr_expense_data.xml
@@ -0,0 +1,11 @@
+
+
+
+
+ Expense report sequence (Advance)
+ hr.expense.sheet.advance
+
+ EXAV
+
+
+
diff --git a/hr_expense_advance_clearing_sequence/models/__init__.py b/hr_expense_advance_clearing_sequence/models/__init__.py
new file mode 100644
index 000000000..38117e21e
--- /dev/null
+++ b/hr_expense_advance_clearing_sequence/models/__init__.py
@@ -0,0 +1,3 @@
+# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html)
+
+from . import hr_expense_sheet
diff --git a/hr_expense_advance_clearing_sequence/models/hr_expense_sheet.py b/hr_expense_advance_clearing_sequence/models/hr_expense_sheet.py
new file mode 100644
index 000000000..ef21157ed
--- /dev/null
+++ b/hr_expense_advance_clearing_sequence/models/hr_expense_sheet.py
@@ -0,0 +1,24 @@
+# Copyright 2019 Ecosoft Co., Ltd (http://ecosoft.co.th/)
+# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html)
+
+from odoo import api, models
+
+
+class HrExpenseSheet(models.Model):
+ _inherit = 'hr.expense.sheet'
+ _rec_name = 'number'
+
+ @api.model
+ def create(self, vals):
+ if 'expense_line_ids' in vals.keys():
+ from_expense = vals['expense_line_ids'][0][1]
+ if from_expense:
+ expense = self.env['hr.expense'].browse(from_expense)
+ else:
+ from_report = vals['expense_line_ids'][0][2][0]
+ expense = self.env['hr.expense'].browse(from_report)
+ if vals.get('number', '/') == '/' and expense.advance:
+ number = self.env['ir.sequence'].next_by_code(
+ 'hr.expense.sheet.advance')
+ vals['number'] = number
+ return super(HrExpenseSheet, self).create(vals)
diff --git a/hr_expense_advance_clearing_sequence/readme/CONFIGURE.rst b/hr_expense_advance_clearing_sequence/readme/CONFIGURE.rst
new file mode 100644
index 000000000..f4f415a42
--- /dev/null
+++ b/hr_expense_advance_clearing_sequence/readme/CONFIGURE.rst
@@ -0,0 +1,6 @@
+You can change the default sequence (EXAV0001) by the one of your choice
+going to *Settings > Technical > Sequences & Identifiers > Sequences*, and
+editing the record `Expense report sequence (Advance)`.
+
+You will only have access to that section if your section has `Technical features`
+permission check marked.
diff --git a/hr_expense_advance_clearing_sequence/readme/CONTRIBUTORS.rst b/hr_expense_advance_clearing_sequence/readme/CONTRIBUTORS.rst
new file mode 100644
index 000000000..0ef1f84c3
--- /dev/null
+++ b/hr_expense_advance_clearing_sequence/readme/CONTRIBUTORS.rst
@@ -0,0 +1 @@
+* Pimolnat Suntian
diff --git a/hr_expense_advance_clearing_sequence/readme/DESCRIPTION.rst b/hr_expense_advance_clearing_sequence/readme/DESCRIPTION.rst
new file mode 100644
index 000000000..2d68ce3ba
--- /dev/null
+++ b/hr_expense_advance_clearing_sequence/readme/DESCRIPTION.rst
@@ -0,0 +1,2 @@
+This module adds the possibility to define a sequence for the expense report's reference that Employee advance.
+This reference is then set as default when you create a new expense report, using the defined sequence.
diff --git a/hr_expense_advance_clearing_sequence/static/description/icon.png b/hr_expense_advance_clearing_sequence/static/description/icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..3a0328b516c4980e8e44cdb63fd945757ddd132d
GIT binary patch
literal 9455
zcmW++2RxMjAAjx~&dlBk9S+%}OXg)AGE&Cb*&}d0jUxM@u(PQx^-s)697TX`ehR4?GS^qbkof1cslKgkU)h65qZ9Oc=ml_0temigYLJfnz{IDzUf>bGs4N!v3=Z3jMq&A#7%rM5eQ#dc?k~!
zVpnB`o+K7|Al`Q_U;eD$B
zfJtP*jH`siUq~{KE)`jP2|#TUEFGRryE2`i0**z#*^6~AI|YzIWy$Cu#CSLW3q=GA
z6`?GZymC;dCPk~rBS%eCb`5OLr;RUZ;D`}um=H)BfVIq%7VhiMr)_#G0N#zrNH|__
zc+blN2UAB0=617@>_u;MPHN;P;N#YoE=)R#i$k_`UAA>WWCcEVMh~L_
zj--gtp&|K1#58Yz*AHCTMziU1Jzt_jG0I@qAOHsk$2}yTmVkBp_eHuY$A9)>P6o~I
z%aQ?!(GqeQ-Y+b0I(m9pwgi(IIZZzsbMv+9w{PFtd_<_(LA~0H(xz{=FhLB@(1&qHA5EJw1>>=%q2f&^X>IQ{!GJ4e9U
z&KlB)z(84HmNgm2hg2C0>WM{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KjpEFsgQc4{amtiHb95KQEwvf<(3T<9-Zm$xIew#P22
zc2Ix|App^>v6(3L_MCU0d3W##AB0M~3D00EWoKZqsJYT(#@w$Y_H7G22M~ApVFTRHMI_3be)Lkn#0F*V8Pq
zc}`Cjy$bE;FJ6H7p=0y#R>`}-m4(0F>%@P|?7fx{=R^uFdISRnZ2W_xQhD{YuR3t<
z{6yxu=4~JkeA;|(J6_nv#>Nvs&FuLA&PW^he@t(UwFFE8)|a!R{`E`K`i^ZnyE4$k
z;(749Ix|oi$c3QbEJ3b~D_kQsPz~fIUKym($a_7dJ?o+40*OLl^{=&oq$<#Q(yyrp
z{J-FAniyAw9tPbe&IhQ|a`DqFTVQGQ&Gq3!C2==4x{6EJwiPZ8zub-iXoUtkJiG{}
zPaR&}_fn8_z~(=;5lD-aPWD3z8PZS@AaUiomF!G8I}Mf>e~0g#BelA-5#`cj;O5>N
Xviia!U7SGha1wx#SCgwmn*{w2TRX*I
literal 0
HcmV?d00001
diff --git a/hr_expense_advance_clearing_sequence/static/description/index.html b/hr_expense_advance_clearing_sequence/static/description/index.html
new file mode 100644
index 000000000..c0ddaf36e
--- /dev/null
+++ b/hr_expense_advance_clearing_sequence/static/description/index.html
@@ -0,0 +1,429 @@
+
+
+
+
+
+
+HR Expense Advance Clearing Sequence
+
+
+
+
+
HR Expense Advance Clearing Sequence
+
+
+

+
This module adds the possibility to define a sequence for the expense report’s reference that Employee advance.
+This reference is then set as default when you create a new expense report, using the defined sequence.
+
Table of contents
+
+
+
+
You can change the default sequence (EXAV0001) by the one of your choice
+going to Settings > Technical > Sequences & Identifiers > Sequences, and
+editing the record Expense report sequence (Advance).
+
You will only have access to that section if your section has Technical features
+permission check marked.
+
+
+
+
Bugs are tracked on GitHub Issues.
+In case of trouble, please check there if your issue has already been reported.
+If you spotted it first, help us smashing it by providing a detailed and welcomed
+feedback.
+
Do not contact contributors directly about support or help with technical issues.
+
+
+
+
+
+
+
+
This module is maintained by the OCA.
+

+
OCA, or the Odoo Community Association, is a nonprofit organization whose
+mission is to support the collaborative development of Odoo features and
+promote its widespread use.
+
This module is part of the OCA/hr project on GitHub.
+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
+
+
+
+
+
diff --git a/hr_expense_advance_clearing_sequence/tests/__init__.py b/hr_expense_advance_clearing_sequence/tests/__init__.py
new file mode 100644
index 000000000..7cb5c3276
--- /dev/null
+++ b/hr_expense_advance_clearing_sequence/tests/__init__.py
@@ -0,0 +1,3 @@
+# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html)
+
+from . import test_hr_expense_advance_clearing_sequence
diff --git a/hr_expense_advance_clearing_sequence/tests/test_hr_expense_advance_clearing_sequence.py b/hr_expense_advance_clearing_sequence/tests/test_hr_expense_advance_clearing_sequence.py
new file mode 100644
index 000000000..84e6b3c42
--- /dev/null
+++ b/hr_expense_advance_clearing_sequence/tests/test_hr_expense_advance_clearing_sequence.py
@@ -0,0 +1,96 @@
+# Copyright 2019 Ecosoft Co., Ltd (http://ecosoft.co.th/)
+# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html)
+
+from odoo.tests.common import Form, SavepointCase
+
+
+class TestHrExpenseAdvanceClearingSequence(SavepointCase):
+
+ @classmethod
+ def setUpClass(self):
+ super().setUpClass()
+ self.expense_model = self.env['hr.expense']
+ self.expense_sheet_model = self.env['hr.expense.sheet']
+ self.product = self.env.ref('product.product_product_4')
+
+ employee_home = self.env['res.partner'].create({
+ 'name': 'Employee Home Address',
+ })
+ self.employee = self.env['hr.employee'].create({
+ 'name': 'Employee',
+ 'address_home_id': employee_home.id,
+ })
+ advance_account = self.env['account.account'].create({
+ 'code': '154000',
+ 'name': 'Employee Advance',
+ 'user_type_id': self.env.ref(
+ 'account.data_account_type_current_assets').id,
+ 'reconcile': True,
+ })
+ self.emp_advance = self.env.ref('hr_expense_advance_clearing.'
+ 'product_emp_advance')
+ self.emp_advance.property_account_expense_id = advance_account
+
+ self.expense = self._create_expense(self, 'Advance 1,000', self.employee,
+ self.emp_advance, 1000.0, advance=True)
+
+ self.sheet = self._create_expense_sheet(
+ self, 'Advance 1,000', self.employee, self.emp_advance, 1000.0,
+ advance=True)
+
+ def _create_expense(self, description, employee,
+ product, amount, advance=False,
+ payment_mode='own_account'):
+ with Form(self.env['hr.expense']) as expense:
+ expense.advance = advance
+ expense.name = description
+ expense.employee_id = employee
+ expense.product_id = product
+ expense.unit_amount = amount
+ expense.payment_mode = payment_mode
+ expense = expense.save()
+ expense.tax_ids = False # Test no vat
+ return expense
+
+ def _create_expense_sheet(self, description, employee,
+ product, amount, advance=False):
+ expense = self._create_expense(self, description, employee,
+ product, amount, advance)
+ # Add expense to expense sheet
+ expense_sheet = self.env['hr.expense.sheet'].create({
+ 'name': description,
+ 'employee_id': expense.employee_id.id,
+ 'expense_line_ids': [(6, 0, [expense.id])],
+ })
+ return expense_sheet
+
+ def test_create_sequence_from_expense(self):
+ # Test number != '/'
+ expense_sheet = self.env['hr.expense.sheet'].create({
+ 'name': 'Advance 1,000',
+ 'employee_id': self.expense.employee_id.id,
+ 'expense_line_ids': [[4, self.expense.id, False]],
+ })
+ self.assertNotEqual(expense_sheet.number, '/', 'Number create')
+ # Test number 1 != number 2
+ sheet_number_1 = expense_sheet.number
+ sheet2 = expense_sheet.copy()
+ sheet_number_2 = sheet2.number
+ self.assertNotEqual(
+ sheet_number_1,
+ sheet_number_2,
+ 'Numbers are different'
+ )
+
+ def test_create_sequence_from_report(self):
+ # Test number != '/'
+ self.assertNotEqual(self.sheet.number, '/', 'Number create')
+ # Test number 1 != number 2
+ sheet_number_1 = self.sheet.number
+ sheet2 = self.sheet.copy()
+ sheet_number_2 = sheet2.number
+ self.assertNotEqual(
+ sheet_number_1,
+ sheet_number_2,
+ 'Numbers are different'
+ )
From 941ce3c3846d476739d37d6351da6c6e77bede1f Mon Sep 17 00:00:00 2001
From: oca-travis
Date: Mon, 17 Aug 2020 08:43:51 +0000
Subject: [PATCH 02/16] [UPD] Update hr_expense_advance_clearing_sequence.pot
---
.../hr_expense_advance_clearing_sequence.pot | 20 +++++++++++++++++++
1 file changed, 20 insertions(+)
create mode 100644 hr_expense_advance_clearing_sequence/i18n/hr_expense_advance_clearing_sequence.pot
diff --git a/hr_expense_advance_clearing_sequence/i18n/hr_expense_advance_clearing_sequence.pot b/hr_expense_advance_clearing_sequence/i18n/hr_expense_advance_clearing_sequence.pot
new file mode 100644
index 000000000..c2fa170ab
--- /dev/null
+++ b/hr_expense_advance_clearing_sequence/i18n/hr_expense_advance_clearing_sequence.pot
@@ -0,0 +1,20 @@
+# Translation of Odoo Server.
+# This file contains the translation of the following modules:
+# * hr_expense_advance_clearing_sequence
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Odoo Server 12.0\n"
+"Report-Msgid-Bugs-To: \n"
+"Last-Translator: <>\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: \n"
+"Plural-Forms: \n"
+
+#. module: hr_expense_advance_clearing_sequence
+#: model:ir.model,name:hr_expense_advance_clearing_sequence.model_hr_expense_sheet
+msgid "Expense Report"
+msgstr ""
+
From fd96bf04200db6fec6b2cfde088ed957b4a3ed59 Mon Sep 17 00:00:00 2001
From: Saran440
Date: Sat, 10 Oct 2020 21:57:16 +0700
Subject: [PATCH 03/16] [IMP] hr_expense_advance_clearing_sequence : black,
isort, prettier
---
.../__manifest__.py | 25 ++--
.../data/hr_expense_data.xml | 6 +-
.../models/hr_expense_sheet.py | 23 ++--
...st_hr_expense_advance_clearing_sequence.py | 119 +++++++++---------
4 files changed, 86 insertions(+), 87 deletions(-)
diff --git a/hr_expense_advance_clearing_sequence/__manifest__.py b/hr_expense_advance_clearing_sequence/__manifest__.py
index d5f174ee0..8f96d0328 100644
--- a/hr_expense_advance_clearing_sequence/__manifest__.py
+++ b/hr_expense_advance_clearing_sequence/__manifest__.py
@@ -2,19 +2,14 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html)
{
- 'name': 'HR Expense Advance Clearing Sequence',
- 'version': '12.0.1.0.0',
- 'license': 'AGPL-3',
- 'category': 'Human Resources',
- 'author': 'Ecosoft, Odoo Community Association (OCA)',
- 'website': 'https://github.com/OCA/hr',
- 'depends': [
- 'hr_expense_sequence',
- 'hr_expense_advance_clearing',
- ],
- 'data': [
- 'data/hr_expense_data.xml',
- ],
- 'installable': True,
- 'maintainer': 'ps-tubtim',
+ "name": "HR Expense Advance Clearing Sequence",
+ "version": "12.0.1.0.0",
+ "license": "AGPL-3",
+ "category": "Human Resources",
+ "author": "Ecosoft, Odoo Community Association (OCA)",
+ "website": "https://github.com/OCA/hr",
+ "depends": ["hr_expense_sequence", "hr_expense_advance_clearing"],
+ "data": ["data/hr_expense_data.xml"],
+ "installable": True,
+ "maintainer": "ps-tubtim",
}
diff --git a/hr_expense_advance_clearing_sequence/data/hr_expense_data.xml b/hr_expense_advance_clearing_sequence/data/hr_expense_data.xml
index 495198211..1789f14d2 100644
--- a/hr_expense_advance_clearing_sequence/data/hr_expense_data.xml
+++ b/hr_expense_advance_clearing_sequence/data/hr_expense_data.xml
@@ -1,11 +1,9 @@
-
+
-
Expense report sequence (Advance)
hr.expense.sheet.advance
-
+
EXAV
-
diff --git a/hr_expense_advance_clearing_sequence/models/hr_expense_sheet.py b/hr_expense_advance_clearing_sequence/models/hr_expense_sheet.py
index ef21157ed..0a48e6e3a 100644
--- a/hr_expense_advance_clearing_sequence/models/hr_expense_sheet.py
+++ b/hr_expense_advance_clearing_sequence/models/hr_expense_sheet.py
@@ -5,20 +5,21 @@
class HrExpenseSheet(models.Model):
- _inherit = 'hr.expense.sheet'
- _rec_name = 'number'
+ _inherit = "hr.expense.sheet"
+ _rec_name = "number"
@api.model
def create(self, vals):
- if 'expense_line_ids' in vals.keys():
- from_expense = vals['expense_line_ids'][0][1]
+ if "expense_line_ids" in vals.keys():
+ from_expense = vals["expense_line_ids"][0][1]
if from_expense:
- expense = self.env['hr.expense'].browse(from_expense)
+ expense = self.env["hr.expense"].browse(from_expense)
else:
- from_report = vals['expense_line_ids'][0][2][0]
- expense = self.env['hr.expense'].browse(from_report)
- if vals.get('number', '/') == '/' and expense.advance:
- number = self.env['ir.sequence'].next_by_code(
- 'hr.expense.sheet.advance')
- vals['number'] = number
+ from_report = vals["expense_line_ids"][0][2][0]
+ expense = self.env["hr.expense"].browse(from_report)
+ if vals.get("number", "/") == "/" and expense.advance:
+ number = self.env["ir.sequence"].next_by_code(
+ "hr.expense.sheet.advance"
+ )
+ vals["number"] = number
return super(HrExpenseSheet, self).create(vals)
diff --git a/hr_expense_advance_clearing_sequence/tests/test_hr_expense_advance_clearing_sequence.py b/hr_expense_advance_clearing_sequence/tests/test_hr_expense_advance_clearing_sequence.py
index 84e6b3c42..ac81168fb 100644
--- a/hr_expense_advance_clearing_sequence/tests/test_hr_expense_advance_clearing_sequence.py
+++ b/hr_expense_advance_clearing_sequence/tests/test_hr_expense_advance_clearing_sequence.py
@@ -5,43 +5,50 @@
class TestHrExpenseAdvanceClearingSequence(SavepointCase):
-
@classmethod
- def setUpClass(self):
+ def setUpClass(cls):
super().setUpClass()
- self.expense_model = self.env['hr.expense']
- self.expense_sheet_model = self.env['hr.expense.sheet']
- self.product = self.env.ref('product.product_product_4')
+ cls.expense_model = cls.env["hr.expense"]
+ cls.expense_sheet_model = cls.env["hr.expense.sheet"]
+ cls.product = cls.env.ref("product.product_product_4")
- employee_home = self.env['res.partner'].create({
- 'name': 'Employee Home Address',
- })
- self.employee = self.env['hr.employee'].create({
- 'name': 'Employee',
- 'address_home_id': employee_home.id,
- })
- advance_account = self.env['account.account'].create({
- 'code': '154000',
- 'name': 'Employee Advance',
- 'user_type_id': self.env.ref(
- 'account.data_account_type_current_assets').id,
- 'reconcile': True,
- })
- self.emp_advance = self.env.ref('hr_expense_advance_clearing.'
- 'product_emp_advance')
- self.emp_advance.property_account_expense_id = advance_account
+ employee_home = cls.env["res.partner"].create({"name": "Employee Home Address"})
+ cls.employee = cls.env["hr.employee"].create(
+ {"name": "Employee", "address_home_id": employee_home.id}
+ )
+ advance_account = cls.env["account.account"].create(
+ {
+ "code": "154000",
+ "name": "Employee Advance",
+ "user_type_id": cls.env.ref(
+ "account.data_account_type_current_assets"
+ ).id,
+ "reconcile": True,
+ }
+ )
+ cls.emp_advance = cls.env.ref(
+ "hr_expense_advance_clearing." "product_emp_advance"
+ )
+ cls.emp_advance.property_account_expense_id = advance_account
- self.expense = self._create_expense(self, 'Advance 1,000', self.employee,
- self.emp_advance, 1000.0, advance=True)
+ cls.expense = cls._create_expense(
+ cls, "Advance 1,000", cls.employee, cls.emp_advance, 1000.0, advance=True
+ )
- self.sheet = self._create_expense_sheet(
- self, 'Advance 1,000', self.employee, self.emp_advance, 1000.0,
- advance=True)
+ cls.sheet = cls._create_expense_sheet(
+ cls, "Advance 1,000", cls.employee, cls.emp_advance, 1000.0, advance=True
+ )
- def _create_expense(self, description, employee,
- product, amount, advance=False,
- payment_mode='own_account'):
- with Form(self.env['hr.expense']) as expense:
+ def _create_expense(
+ self,
+ description,
+ employee,
+ product,
+ amount,
+ advance=False,
+ payment_mode="own_account",
+ ):
+ with Form(self.env["hr.expense"]) as expense:
expense.advance = advance
expense.name = description
expense.employee_id = employee
@@ -52,45 +59,43 @@ def _create_expense(self, description, employee,
expense.tax_ids = False # Test no vat
return expense
- def _create_expense_sheet(self, description, employee,
- product, amount, advance=False):
- expense = self._create_expense(self, description, employee,
- product, amount, advance)
+ def _create_expense_sheet(
+ self, description, employee, product, amount, advance=False
+ ):
+ expense = self._create_expense(
+ self, description, employee, product, amount, advance
+ )
# Add expense to expense sheet
- expense_sheet = self.env['hr.expense.sheet'].create({
- 'name': description,
- 'employee_id': expense.employee_id.id,
- 'expense_line_ids': [(6, 0, [expense.id])],
- })
+ expense_sheet = self.env["hr.expense.sheet"].create(
+ {
+ "name": description,
+ "employee_id": expense.employee_id.id,
+ "expense_line_ids": [(6, 0, [expense.id])],
+ }
+ )
return expense_sheet
def test_create_sequence_from_expense(self):
# Test number != '/'
- expense_sheet = self.env['hr.expense.sheet'].create({
- 'name': 'Advance 1,000',
- 'employee_id': self.expense.employee_id.id,
- 'expense_line_ids': [[4, self.expense.id, False]],
- })
- self.assertNotEqual(expense_sheet.number, '/', 'Number create')
+ expense_sheet = self.env["hr.expense.sheet"].create(
+ {
+ "name": "Advance 1,000",
+ "employee_id": self.expense.employee_id.id,
+ "expense_line_ids": [[4, self.expense.id, False]],
+ }
+ )
+ self.assertNotEqual(expense_sheet.number, "/", "Number create")
# Test number 1 != number 2
sheet_number_1 = expense_sheet.number
sheet2 = expense_sheet.copy()
sheet_number_2 = sheet2.number
- self.assertNotEqual(
- sheet_number_1,
- sheet_number_2,
- 'Numbers are different'
- )
+ self.assertNotEqual(sheet_number_1, sheet_number_2, "Numbers are different")
def test_create_sequence_from_report(self):
# Test number != '/'
- self.assertNotEqual(self.sheet.number, '/', 'Number create')
+ self.assertNotEqual(self.sheet.number, "/", "Number create")
# Test number 1 != number 2
sheet_number_1 = self.sheet.number
sheet2 = self.sheet.copy()
sheet_number_2 = sheet2.number
- self.assertNotEqual(
- sheet_number_1,
- sheet_number_2,
- 'Numbers are different'
- )
+ self.assertNotEqual(sheet_number_1, sheet_number_2, "Numbers are different")
From c4c889e9a31ec88076857efaf78c4a028b0a838f Mon Sep 17 00:00:00 2001
From: Saran440
Date: Sun, 11 Oct 2020 09:58:41 +0700
Subject: [PATCH 04/16] [13.0][MIG] hr_expense_advance_clearing_sequence
---
.../README.rst | 17 +++---
.../__manifest__.py | 6 +-
.../models/hr_expense_sheet.py | 11 +---
.../readme/CONTRIBUTORS.rst | 1 +
.../static/description/index.html | 9 +--
...st_hr_expense_advance_clearing_sequence.py | 57 ++++++++++---------
6 files changed, 50 insertions(+), 51 deletions(-)
diff --git a/hr_expense_advance_clearing_sequence/README.rst b/hr_expense_advance_clearing_sequence/README.rst
index 8b924fc92..67698d532 100644
--- a/hr_expense_advance_clearing_sequence/README.rst
+++ b/hr_expense_advance_clearing_sequence/README.rst
@@ -13,14 +13,14 @@ HR Expense Advance Clearing Sequence
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
-.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fhr-lightgray.png?logo=github
- :target: https://github.com/OCA/hr/tree/12.0/hr_expense_advance_clearing_sequence
- :alt: OCA/hr
+.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fhr--expense-lightgray.png?logo=github
+ :target: https://github.com/OCA/hr-expense/tree/13.0/hr_expense_advance_clearing_sequence
+ :alt: OCA/hr-expense
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
- :target: https://translation.odoo-community.org/projects/hr-12-0/hr-12-0-hr_expense_advance_clearing_sequence
+ :target: https://translation.odoo-community.org/projects/hr-expense-13-0/hr-expense-13-0-hr_expense_advance_clearing_sequence
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
- :target: https://runbot.odoo-community.org/runbot/116/12.0
+ :target: https://runbot.odoo-community.org/runbot/289/13.0
:alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -46,10 +46,10 @@ permission check marked.
Bug Tracker
===========
-Bugs are tracked on `GitHub Issues `_.
+Bugs are tracked on `GitHub Issues `_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
-`feedback `_.
+`feedback `_.
Do not contact contributors directly about support or help with technical issues.
@@ -65,6 +65,7 @@ Contributors
~~~~~~~~~~~~
* Pimolnat Suntian
+* Saran Lim.
Maintainers
~~~~~~~~~~~
@@ -79,6 +80,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.
-This module is part of the `OCA/hr `_ project on GitHub.
+This module is part of the `OCA/hr-expense `_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
diff --git a/hr_expense_advance_clearing_sequence/__manifest__.py b/hr_expense_advance_clearing_sequence/__manifest__.py
index 8f96d0328..589e99c59 100644
--- a/hr_expense_advance_clearing_sequence/__manifest__.py
+++ b/hr_expense_advance_clearing_sequence/__manifest__.py
@@ -3,13 +3,13 @@
{
"name": "HR Expense Advance Clearing Sequence",
- "version": "12.0.1.0.0",
+ "version": "13.0.1.0.0",
"license": "AGPL-3",
"category": "Human Resources",
"author": "Ecosoft, Odoo Community Association (OCA)",
- "website": "https://github.com/OCA/hr",
+ "website": "https://github.com/OCA/hr-expense",
"depends": ["hr_expense_sequence", "hr_expense_advance_clearing"],
"data": ["data/hr_expense_data.xml"],
"installable": True,
- "maintainer": "ps-tubtim",
+ "maintainer": ["ps-tubtim"],
}
diff --git a/hr_expense_advance_clearing_sequence/models/hr_expense_sheet.py b/hr_expense_advance_clearing_sequence/models/hr_expense_sheet.py
index 0a48e6e3a..8d9e1eff7 100644
--- a/hr_expense_advance_clearing_sequence/models/hr_expense_sheet.py
+++ b/hr_expense_advance_clearing_sequence/models/hr_expense_sheet.py
@@ -6,20 +6,15 @@
class HrExpenseSheet(models.Model):
_inherit = "hr.expense.sheet"
- _rec_name = "number"
@api.model
def create(self, vals):
if "expense_line_ids" in vals.keys():
- from_expense = vals["expense_line_ids"][0][1]
- if from_expense:
- expense = self.env["hr.expense"].browse(from_expense)
- else:
- from_report = vals["expense_line_ids"][0][2][0]
- expense = self.env["hr.expense"].browse(from_report)
+ from_expense = vals["expense_line_ids"][0][2]
+ expense = self.env["hr.expense"].browse(from_expense)
if vals.get("number", "/") == "/" and expense.advance:
number = self.env["ir.sequence"].next_by_code(
"hr.expense.sheet.advance"
)
vals["number"] = number
- return super(HrExpenseSheet, self).create(vals)
+ return super().create(vals)
diff --git a/hr_expense_advance_clearing_sequence/readme/CONTRIBUTORS.rst b/hr_expense_advance_clearing_sequence/readme/CONTRIBUTORS.rst
index 0ef1f84c3..720bec61f 100644
--- a/hr_expense_advance_clearing_sequence/readme/CONTRIBUTORS.rst
+++ b/hr_expense_advance_clearing_sequence/readme/CONTRIBUTORS.rst
@@ -1 +1,2 @@
* Pimolnat Suntian
+* Saran Lim.
diff --git a/hr_expense_advance_clearing_sequence/static/description/index.html b/hr_expense_advance_clearing_sequence/static/description/index.html
index c0ddaf36e..ba8828797 100644
--- a/hr_expense_advance_clearing_sequence/static/description/index.html
+++ b/hr_expense_advance_clearing_sequence/static/description/index.html
@@ -367,7 +367,7 @@ HR Expense Advance Clearing Sequence
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
-

+

This module adds the possibility to define a sequence for the expense report’s reference that Employee advance.
This reference is then set as default when you create a new expense report, using the defined sequence.
Table of contents
@@ -393,10 +393,10 @@
-
Bugs are tracked on GitHub Issues.
+
Bugs are tracked on GitHub Issues.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
-feedback.
+
feedback.
Do not contact contributors directly about support or help with technical issues.
@@ -420,7 +421,7 @@
OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.
-
This module is part of the OCA/hr project on GitHub.
+
This module is part of the OCA/hr-expense project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
diff --git a/hr_expense_advance_clearing_sequence/tests/test_hr_expense_advance_clearing_sequence.py b/hr_expense_advance_clearing_sequence/tests/test_hr_expense_advance_clearing_sequence.py
index ac81168fb..ae2fb38ea 100644
--- a/hr_expense_advance_clearing_sequence/tests/test_hr_expense_advance_clearing_sequence.py
+++ b/hr_expense_advance_clearing_sequence/tests/test_hr_expense_advance_clearing_sequence.py
@@ -1,42 +1,43 @@
# Copyright 2019 Ecosoft Co., Ltd (http://ecosoft.co.th/)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html)
+from odoo import tools
+from odoo.modules.module import get_resource_path
from odoo.tests.common import Form, SavepointCase
class TestHrExpenseAdvanceClearingSequence(SavepointCase):
+ @classmethod
+ def _load(cls, module, *args):
+ tools.convert_file(
+ cls.cr,
+ module,
+ get_resource_path(module, *args),
+ {},
+ "init",
+ False,
+ "test",
+ cls.registry._assertion_report,
+ )
+
@classmethod
def setUpClass(cls):
super().setUpClass()
+ cls._load("account", "test", "account_minimal_test.xml")
cls.expense_model = cls.env["hr.expense"]
cls.expense_sheet_model = cls.env["hr.expense.sheet"]
- cls.product = cls.env.ref("product.product_product_4")
-
- employee_home = cls.env["res.partner"].create({"name": "Employee Home Address"})
- cls.employee = cls.env["hr.employee"].create(
- {"name": "Employee", "address_home_id": employee_home.id}
- )
- advance_account = cls.env["account.account"].create(
- {
- "code": "154000",
- "name": "Employee Advance",
- "user_type_id": cls.env.ref(
- "account.data_account_type_current_assets"
- ).id,
- "reconcile": True,
- }
- )
- cls.emp_advance = cls.env.ref(
- "hr_expense_advance_clearing." "product_emp_advance"
- )
- cls.emp_advance.property_account_expense_id = advance_account
-
+ cls.partner_1 = cls.env.ref("base.res_partner_12")
+ cls.employee_1 = cls.env.ref("hr.employee_hne")
+ cls.employee_1.address_home_id = cls.partner_1.id
+ transfer_account = cls.browse_ref(cls, "account.transfer_account")
+ cls.emp_advance = cls.env.ref("hr_expense_advance_clearing.product_emp_advance")
+ cls.emp_advance.property_account_expense_id = transfer_account
cls.expense = cls._create_expense(
- cls, "Advance 1,000", cls.employee, cls.emp_advance, 1000.0, advance=True
+ cls, "Advance 1,000", cls.employee_1, cls.emp_advance, 1000.0, advance=True
)
cls.sheet = cls._create_expense_sheet(
- cls, "Advance 1,000", cls.employee, cls.emp_advance, 1000.0, advance=True
+ cls, "Advance 1,000", cls.employee_1, cls.emp_advance, 1000.0, advance=True
)
def _create_expense(
@@ -48,7 +49,7 @@ def _create_expense(
advance=False,
payment_mode="own_account",
):
- with Form(self.env["hr.expense"]) as expense:
+ with Form(self.expense_model) as expense:
expense.advance = advance
expense.name = description
expense.employee_id = employee
@@ -66,7 +67,7 @@ def _create_expense_sheet(
self, description, employee, product, amount, advance
)
# Add expense to expense sheet
- expense_sheet = self.env["hr.expense.sheet"].create(
+ expense_sheet = self.expense_sheet_model.create(
{
"name": description,
"employee_id": expense.employee_id.id,
@@ -75,9 +76,9 @@ def _create_expense_sheet(
)
return expense_sheet
- def test_create_sequence_from_expense(self):
+ def test_01_create_sequence_from_expense(self):
# Test number != '/'
- expense_sheet = self.env["hr.expense.sheet"].create(
+ expense_sheet = self.expense_sheet_model.create(
{
"name": "Advance 1,000",
"employee_id": self.expense.employee_id.id,
@@ -91,7 +92,7 @@ def test_create_sequence_from_expense(self):
sheet_number_2 = sheet2.number
self.assertNotEqual(sheet_number_1, sheet_number_2, "Numbers are different")
- def test_create_sequence_from_report(self):
+ def test_02_create_sequence_from_report(self):
# Test number != '/'
self.assertNotEqual(self.sheet.number, "/", "Number create")
# Test number 1 != number 2
From 986d439514c95c37087b86adac91550bd59292e3 Mon Sep 17 00:00:00 2001
From: oca-travis
Date: Sat, 15 May 2021 17:12:07 +0000
Subject: [PATCH 05/16] [UPD] Update hr_expense_advance_clearing_sequence.pot
---
.../i18n/hr_expense_advance_clearing_sequence.pot | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/hr_expense_advance_clearing_sequence/i18n/hr_expense_advance_clearing_sequence.pot b/hr_expense_advance_clearing_sequence/i18n/hr_expense_advance_clearing_sequence.pot
index c2fa170ab..bbfec204a 100644
--- a/hr_expense_advance_clearing_sequence/i18n/hr_expense_advance_clearing_sequence.pot
+++ b/hr_expense_advance_clearing_sequence/i18n/hr_expense_advance_clearing_sequence.pot
@@ -1,12 +1,12 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
-# * hr_expense_advance_clearing_sequence
+# * hr_expense_advance_clearing_sequence
#
msgid ""
msgstr ""
-"Project-Id-Version: Odoo Server 12.0\n"
+"Project-Id-Version: Odoo Server 13.0\n"
"Report-Msgid-Bugs-To: \n"
-"Last-Translator: <>\n"
+"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@@ -17,4 +17,3 @@ msgstr ""
#: model:ir.model,name:hr_expense_advance_clearing_sequence.model_hr_expense_sheet
msgid "Expense Report"
msgstr ""
-
From 3567e77c754c898e5a61f5b7856b5334cfcd0f75 Mon Sep 17 00:00:00 2001
From: Saran440
Date: Sun, 16 May 2021 20:11:56 +0700
Subject: [PATCH 06/16] [14.0][MIG] hr_expense_advance_clearing_sequence
---
.../__manifest__.py | 2 +-
.../data/hr_expense_data.xml | 2 +-
.../models/hr_expense_sheet.py | 11 ++--
...st_hr_expense_advance_clearing_sequence.py | 53 +++++++++----------
4 files changed, 31 insertions(+), 37 deletions(-)
diff --git a/hr_expense_advance_clearing_sequence/__manifest__.py b/hr_expense_advance_clearing_sequence/__manifest__.py
index 589e99c59..1e8a51f98 100644
--- a/hr_expense_advance_clearing_sequence/__manifest__.py
+++ b/hr_expense_advance_clearing_sequence/__manifest__.py
@@ -3,7 +3,7 @@
{
"name": "HR Expense Advance Clearing Sequence",
- "version": "13.0.1.0.0",
+ "version": "14.0.1.0.0",
"license": "AGPL-3",
"category": "Human Resources",
"author": "Ecosoft, Odoo Community Association (OCA)",
diff --git a/hr_expense_advance_clearing_sequence/data/hr_expense_data.xml b/hr_expense_advance_clearing_sequence/data/hr_expense_data.xml
index 1789f14d2..6f93de1e9 100644
--- a/hr_expense_advance_clearing_sequence/data/hr_expense_data.xml
+++ b/hr_expense_advance_clearing_sequence/data/hr_expense_data.xml
@@ -4,6 +4,6 @@
Expense report sequence (Advance)
hr.expense.sheet.advance
- EXAV
+ AV
diff --git a/hr_expense_advance_clearing_sequence/models/hr_expense_sheet.py b/hr_expense_advance_clearing_sequence/models/hr_expense_sheet.py
index 8d9e1eff7..d2745022e 100644
--- a/hr_expense_advance_clearing_sequence/models/hr_expense_sheet.py
+++ b/hr_expense_advance_clearing_sequence/models/hr_expense_sheet.py
@@ -9,12 +9,7 @@ class HrExpenseSheet(models.Model):
@api.model
def create(self, vals):
- if "expense_line_ids" in vals.keys():
- from_expense = vals["expense_line_ids"][0][2]
- expense = self.env["hr.expense"].browse(from_expense)
- if vals.get("number", "/") == "/" and expense.advance:
- number = self.env["ir.sequence"].next_by_code(
- "hr.expense.sheet.advance"
- )
- vals["number"] = number
+ if vals.get("advance") or self.env.context.get("default_advance"):
+ number = self.env["ir.sequence"].next_by_code("hr.expense.sheet.advance")
+ vals["number"] = number
return super().create(vals)
diff --git a/hr_expense_advance_clearing_sequence/tests/test_hr_expense_advance_clearing_sequence.py b/hr_expense_advance_clearing_sequence/tests/test_hr_expense_advance_clearing_sequence.py
index ae2fb38ea..0d50dd632 100644
--- a/hr_expense_advance_clearing_sequence/tests/test_hr_expense_advance_clearing_sequence.py
+++ b/hr_expense_advance_clearing_sequence/tests/test_hr_expense_advance_clearing_sequence.py
@@ -1,37 +1,28 @@
# Copyright 2019 Ecosoft Co., Ltd (http://ecosoft.co.th/)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html)
-from odoo import tools
-from odoo.modules.module import get_resource_path
from odoo.tests.common import Form, SavepointCase
class TestHrExpenseAdvanceClearingSequence(SavepointCase):
- @classmethod
- def _load(cls, module, *args):
- tools.convert_file(
- cls.cr,
- module,
- get_resource_path(module, *args),
- {},
- "init",
- False,
- "test",
- cls.registry._assertion_report,
- )
-
@classmethod
def setUpClass(cls):
super().setUpClass()
- cls._load("account", "test", "account_minimal_test.xml")
cls.expense_model = cls.env["hr.expense"]
cls.expense_sheet_model = cls.env["hr.expense.sheet"]
cls.partner_1 = cls.env.ref("base.res_partner_12")
cls.employee_1 = cls.env.ref("hr.employee_hne")
cls.employee_1.address_home_id = cls.partner_1.id
- transfer_account = cls.browse_ref(cls, "account.transfer_account")
+ user_type_expense = cls.env.ref("account.data_account_type_expenses")
+ account_expense = cls.env["account.account"].create(
+ {
+ "code": "NC1113",
+ "name": "HR Expense - Test Purchase Account",
+ "user_type_id": user_type_expense.id,
+ }
+ )
cls.emp_advance = cls.env.ref("hr_expense_advance_clearing.product_emp_advance")
- cls.emp_advance.property_account_expense_id = transfer_account
+ cls.emp_advance.property_account_expense_id = account_expense
cls.expense = cls._create_expense(
cls, "Advance 1,000", cls.employee_1, cls.emp_advance, 1000.0, advance=True
)
@@ -48,14 +39,19 @@ def _create_expense(
amount,
advance=False,
payment_mode="own_account",
+ account=False,
):
- with Form(self.expense_model) as expense:
- expense.advance = advance
+ with Form(
+ self.env["hr.expense"].with_context(default_advance=advance)
+ ) as expense:
expense.name = description
expense.employee_id = employee
- expense.product_id = product
+ if not advance:
+ expense.product_id = product
expense.unit_amount = amount
expense.payment_mode = payment_mode
+ if account:
+ expense.account_id = account
expense = expense.save()
expense.tax_ids = False # Test no vat
return expense
@@ -70,6 +66,7 @@ def _create_expense_sheet(
expense_sheet = self.expense_sheet_model.create(
{
"name": description,
+ "advance": advance,
"employee_id": expense.employee_id.id,
"expense_line_ids": [(6, 0, [expense.id])],
}
@@ -78,23 +75,25 @@ def _create_expense_sheet(
def test_01_create_sequence_from_expense(self):
# Test number != '/'
- expense_sheet = self.expense_sheet_model.create(
+ advance_sheet = self.expense_sheet_model.create(
{
"name": "Advance 1,000",
+ "advance": True,
"employee_id": self.expense.employee_id.id,
"expense_line_ids": [[4, self.expense.id, False]],
}
)
- self.assertNotEqual(expense_sheet.number, "/", "Number create")
+ self.assertNotEqual(advance_sheet.number, "/", "Number create")
+ self.assertNotEqual(advance_sheet.number.find("AV"), -1)
# Test number 1 != number 2
- sheet_number_1 = expense_sheet.number
- sheet2 = expense_sheet.copy()
- sheet_number_2 = sheet2.number
- self.assertNotEqual(sheet_number_1, sheet_number_2, "Numbers are different")
+ self.assertNotEqual(
+ advance_sheet.number, advance_sheet.copy().number, "Numbers are different"
+ )
def test_02_create_sequence_from_report(self):
# Test number != '/'
self.assertNotEqual(self.sheet.number, "/", "Number create")
+ self.assertNotEqual(self.sheet.number.find("AV"), -1)
# Test number 1 != number 2
sheet_number_1 = self.sheet.number
sheet2 = self.sheet.copy()
From 175ae7a41d095dca41df6d9c3a04b7c09d0e28e1 Mon Sep 17 00:00:00 2001
From: oca-travis
Date: Wed, 15 Jun 2022 05:08:05 +0000
Subject: [PATCH 07/16] [UPD] Update hr_expense_advance_clearing_sequence.pot
---
hr_expense_advance_clearing_sequence/README.rst | 10 +++++-----
.../hr_expense_advance_clearing_sequence.pot | 17 ++++++++++++++++-
.../static/description/index.html | 6 +++---
3 files changed, 24 insertions(+), 9 deletions(-)
diff --git a/hr_expense_advance_clearing_sequence/README.rst b/hr_expense_advance_clearing_sequence/README.rst
index 67698d532..ce37e4ae9 100644
--- a/hr_expense_advance_clearing_sequence/README.rst
+++ b/hr_expense_advance_clearing_sequence/README.rst
@@ -14,13 +14,13 @@ HR Expense Advance Clearing Sequence
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fhr--expense-lightgray.png?logo=github
- :target: https://github.com/OCA/hr-expense/tree/13.0/hr_expense_advance_clearing_sequence
+ :target: https://github.com/OCA/hr-expense/tree/14.0/hr_expense_advance_clearing_sequence
:alt: OCA/hr-expense
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
- :target: https://translation.odoo-community.org/projects/hr-expense-13-0/hr-expense-13-0-hr_expense_advance_clearing_sequence
+ :target: https://translation.odoo-community.org/projects/hr-expense-14-0/hr-expense-14-0-hr_expense_advance_clearing_sequence
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
- :target: https://runbot.odoo-community.org/runbot/289/13.0
+ :target: https://runbot.odoo-community.org/runbot/289/14.0
:alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -49,7 +49,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues `_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
-`feedback `_.
+`feedback `_.
Do not contact contributors directly about support or help with technical issues.
@@ -80,6 +80,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.
-This module is part of the `OCA/hr-expense `_ project on GitHub.
+This module is part of the `OCA/hr-expense `_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
diff --git a/hr_expense_advance_clearing_sequence/i18n/hr_expense_advance_clearing_sequence.pot b/hr_expense_advance_clearing_sequence/i18n/hr_expense_advance_clearing_sequence.pot
index bbfec204a..29530da77 100644
--- a/hr_expense_advance_clearing_sequence/i18n/hr_expense_advance_clearing_sequence.pot
+++ b/hr_expense_advance_clearing_sequence/i18n/hr_expense_advance_clearing_sequence.pot
@@ -4,7 +4,7 @@
#
msgid ""
msgstr ""
-"Project-Id-Version: Odoo Server 13.0\n"
+"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
@@ -13,7 +13,22 @@ msgstr ""
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
+#. module: hr_expense_advance_clearing_sequence
+#: model:ir.model.fields,field_description:hr_expense_advance_clearing_sequence.field_hr_expense_sheet__display_name
+msgid "Display Name"
+msgstr ""
+
#. module: hr_expense_advance_clearing_sequence
#: model:ir.model,name:hr_expense_advance_clearing_sequence.model_hr_expense_sheet
msgid "Expense Report"
msgstr ""
+
+#. module: hr_expense_advance_clearing_sequence
+#: model:ir.model.fields,field_description:hr_expense_advance_clearing_sequence.field_hr_expense_sheet__id
+msgid "ID"
+msgstr ""
+
+#. module: hr_expense_advance_clearing_sequence
+#: model:ir.model.fields,field_description:hr_expense_advance_clearing_sequence.field_hr_expense_sheet____last_update
+msgid "Last Modified on"
+msgstr ""
diff --git a/hr_expense_advance_clearing_sequence/static/description/index.html b/hr_expense_advance_clearing_sequence/static/description/index.html
index ba8828797..1de3de567 100644
--- a/hr_expense_advance_clearing_sequence/static/description/index.html
+++ b/hr_expense_advance_clearing_sequence/static/description/index.html
@@ -367,7 +367,7 @@ HR Expense Advance Clearing Sequence
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
-

+

This module adds the possibility to define a sequence for the expense report’s reference that Employee advance.
This reference is then set as default when you create a new expense report, using the defined sequence.
Table of contents
@@ -396,7 +396,7 @@
Bugs are tracked on GitHub Issues.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
-feedback.
+feedback.
Do not contact contributors directly about support or help with technical issues.
@@ -421,7 +421,7 @@
OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.
-
This module is part of the OCA/hr-expense project on GitHub.
+
This module is part of the OCA/hr-expense project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
From 707df10d59d28a6795bde506898e9310298f7d6d Mon Sep 17 00:00:00 2001
From: Saran440
Date: Fri, 10 Mar 2023 16:07:09 +0700
Subject: [PATCH 08/16] [MIG] hr_expense_advance_clearing_sequence: Migration
to 15.0
---
hr_expense_advance_clearing_sequence/README.rst | 10 +++++-----
.../__manifest__.py | 2 +-
.../hr_expense_advance_clearing_sequence.pot | 17 +----------------
.../models/hr_expense_sheet.py | 4 +++-
.../static/description/index.html | 6 +++---
...test_hr_expense_advance_clearing_sequence.py | 9 ++-------
6 files changed, 15 insertions(+), 33 deletions(-)
diff --git a/hr_expense_advance_clearing_sequence/README.rst b/hr_expense_advance_clearing_sequence/README.rst
index ce37e4ae9..51bd046e2 100644
--- a/hr_expense_advance_clearing_sequence/README.rst
+++ b/hr_expense_advance_clearing_sequence/README.rst
@@ -14,13 +14,13 @@ HR Expense Advance Clearing Sequence
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fhr--expense-lightgray.png?logo=github
- :target: https://github.com/OCA/hr-expense/tree/14.0/hr_expense_advance_clearing_sequence
+ :target: https://github.com/OCA/hr-expense/tree/15.0/hr_expense_advance_clearing_sequence
:alt: OCA/hr-expense
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
- :target: https://translation.odoo-community.org/projects/hr-expense-14-0/hr-expense-14-0-hr_expense_advance_clearing_sequence
+ :target: https://translation.odoo-community.org/projects/hr-expense-15-0/hr-expense-15-0-hr_expense_advance_clearing_sequence
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
- :target: https://runbot.odoo-community.org/runbot/289/14.0
+ :target: https://runbot.odoo-community.org/runbot/289/15.0
:alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -49,7 +49,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues `_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
-`feedback `_.
+`feedback `_.
Do not contact contributors directly about support or help with technical issues.
@@ -80,6 +80,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.
-This module is part of the `OCA/hr-expense `_ project on GitHub.
+This module is part of the `OCA/hr-expense `_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
diff --git a/hr_expense_advance_clearing_sequence/__manifest__.py b/hr_expense_advance_clearing_sequence/__manifest__.py
index 1e8a51f98..5d276af17 100644
--- a/hr_expense_advance_clearing_sequence/__manifest__.py
+++ b/hr_expense_advance_clearing_sequence/__manifest__.py
@@ -3,7 +3,7 @@
{
"name": "HR Expense Advance Clearing Sequence",
- "version": "14.0.1.0.0",
+ "version": "15.0.1.0.0",
"license": "AGPL-3",
"category": "Human Resources",
"author": "Ecosoft, Odoo Community Association (OCA)",
diff --git a/hr_expense_advance_clearing_sequence/i18n/hr_expense_advance_clearing_sequence.pot b/hr_expense_advance_clearing_sequence/i18n/hr_expense_advance_clearing_sequence.pot
index 29530da77..8a765dab7 100644
--- a/hr_expense_advance_clearing_sequence/i18n/hr_expense_advance_clearing_sequence.pot
+++ b/hr_expense_advance_clearing_sequence/i18n/hr_expense_advance_clearing_sequence.pot
@@ -4,7 +4,7 @@
#
msgid ""
msgstr ""
-"Project-Id-Version: Odoo Server 14.0\n"
+"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
@@ -13,22 +13,7 @@ msgstr ""
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
-#. module: hr_expense_advance_clearing_sequence
-#: model:ir.model.fields,field_description:hr_expense_advance_clearing_sequence.field_hr_expense_sheet__display_name
-msgid "Display Name"
-msgstr ""
-
#. module: hr_expense_advance_clearing_sequence
#: model:ir.model,name:hr_expense_advance_clearing_sequence.model_hr_expense_sheet
msgid "Expense Report"
msgstr ""
-
-#. module: hr_expense_advance_clearing_sequence
-#: model:ir.model.fields,field_description:hr_expense_advance_clearing_sequence.field_hr_expense_sheet__id
-msgid "ID"
-msgstr ""
-
-#. module: hr_expense_advance_clearing_sequence
-#: model:ir.model.fields,field_description:hr_expense_advance_clearing_sequence.field_hr_expense_sheet____last_update
-msgid "Last Modified on"
-msgstr ""
diff --git a/hr_expense_advance_clearing_sequence/models/hr_expense_sheet.py b/hr_expense_advance_clearing_sequence/models/hr_expense_sheet.py
index d2745022e..c40e6caa8 100644
--- a/hr_expense_advance_clearing_sequence/models/hr_expense_sheet.py
+++ b/hr_expense_advance_clearing_sequence/models/hr_expense_sheet.py
@@ -10,6 +10,8 @@ class HrExpenseSheet(models.Model):
@api.model
def create(self, vals):
if vals.get("advance") or self.env.context.get("default_advance"):
- number = self.env["ir.sequence"].next_by_code("hr.expense.sheet.advance")
+ number = (
+ self.env["ir.sequence"].next_by_code("hr.expense.sheet.advance") or "/"
+ )
vals["number"] = number
return super().create(vals)
diff --git a/hr_expense_advance_clearing_sequence/static/description/index.html b/hr_expense_advance_clearing_sequence/static/description/index.html
index 1de3de567..3c38a5567 100644
--- a/hr_expense_advance_clearing_sequence/static/description/index.html
+++ b/hr_expense_advance_clearing_sequence/static/description/index.html
@@ -367,7 +367,7 @@ HR Expense Advance Clearing Sequence
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
-

+

This module adds the possibility to define a sequence for the expense report’s reference that Employee advance.
This reference is then set as default when you create a new expense report, using the defined sequence.
Table of contents
@@ -396,7 +396,7 @@
Bugs are tracked on GitHub Issues.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
-feedback.
+feedback.
Do not contact contributors directly about support or help with technical issues.
@@ -421,7 +421,7 @@
OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.
-
This module is part of the OCA/hr-expense project on GitHub.
+
This module is part of the OCA/hr-expense project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
diff --git a/hr_expense_advance_clearing_sequence/tests/test_hr_expense_advance_clearing_sequence.py b/hr_expense_advance_clearing_sequence/tests/test_hr_expense_advance_clearing_sequence.py
index 0d50dd632..6ca746a5d 100644
--- a/hr_expense_advance_clearing_sequence/tests/test_hr_expense_advance_clearing_sequence.py
+++ b/hr_expense_advance_clearing_sequence/tests/test_hr_expense_advance_clearing_sequence.py
@@ -1,10 +1,10 @@
# Copyright 2019 Ecosoft Co., Ltd (http://ecosoft.co.th/)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html)
-from odoo.tests.common import Form, SavepointCase
+from odoo.tests.common import Form, TransactionCase
-class TestHrExpenseAdvanceClearingSequence(SavepointCase):
+class TestHrExpenseAdvanceClearingSequence(TransactionCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
@@ -39,19 +39,14 @@ def _create_expense(
amount,
advance=False,
payment_mode="own_account",
- account=False,
):
with Form(
self.env["hr.expense"].with_context(default_advance=advance)
) as expense:
expense.name = description
expense.employee_id = employee
- if not advance:
- expense.product_id = product
expense.unit_amount = amount
expense.payment_mode = payment_mode
- if account:
- expense.account_id = account
expense = expense.save()
expense.tax_ids = False # Test no vat
return expense
From 2819e9f4cefa97ae640c4cbbd904690115eec2ea Mon Sep 17 00:00:00 2001
From: mymage
Date: Wed, 28 Jun 2023 14:26:44 +0000
Subject: [PATCH 09/16] Added translation using Weblate (Italian)
---
.../i18n/it.po | 20 +++++++++++++++++++
1 file changed, 20 insertions(+)
create mode 100644 hr_expense_advance_clearing_sequence/i18n/it.po
diff --git a/hr_expense_advance_clearing_sequence/i18n/it.po b/hr_expense_advance_clearing_sequence/i18n/it.po
new file mode 100644
index 000000000..f1cd49f4e
--- /dev/null
+++ b/hr_expense_advance_clearing_sequence/i18n/it.po
@@ -0,0 +1,20 @@
+# Translation of Odoo Server.
+# This file contains the translation of the following modules:
+# * hr_expense_advance_clearing_sequence
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Odoo Server 15.0\n"
+"Report-Msgid-Bugs-To: \n"
+"Last-Translator: Automatically generated\n"
+"Language-Team: none\n"
+"Language: it\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: \n"
+"Plural-Forms: nplurals=2; plural=n != 1;\n"
+
+#. module: hr_expense_advance_clearing_sequence
+#: model:ir.model,name:hr_expense_advance_clearing_sequence.model_hr_expense_sheet
+msgid "Expense Report"
+msgstr ""
From 2b1d2c9e747a64d73260d112e615ae8acfb1feef Mon Sep 17 00:00:00 2001
From: mymage
Date: Wed, 28 Jun 2023 14:27:31 +0000
Subject: [PATCH 10/16] Translated using Weblate (Italian)
Currently translated at 100.0% (1 of 1 strings)
Translation: hr-expense-15.0/hr-expense-15.0-hr_expense_advance_clearing_sequence
Translate-URL: https://translation.odoo-community.org/projects/hr-expense-15-0/hr-expense-15-0-hr_expense_advance_clearing_sequence/it/
---
.../README.rst | 15 +++++---
.../i18n/it.po | 6 ++-
.../static/description/index.html | 38 ++++++++++---------
3 files changed, 33 insertions(+), 26 deletions(-)
diff --git a/hr_expense_advance_clearing_sequence/README.rst b/hr_expense_advance_clearing_sequence/README.rst
index 51bd046e2..9e68ec143 100644
--- a/hr_expense_advance_clearing_sequence/README.rst
+++ b/hr_expense_advance_clearing_sequence/README.rst
@@ -2,10 +2,13 @@
HR Expense Advance Clearing Sequence
====================================
-.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+..
+ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ !! source digest: sha256:bd7e0c67df8c4c24f503ae64b5fe115680ede878874802964d283e7f92bec65d
+ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
@@ -19,11 +22,11 @@ HR Expense Advance Clearing Sequence
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/hr-expense-15-0/hr-expense-15-0-hr_expense_advance_clearing_sequence
:alt: Translate me on Weblate
-.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
- :target: https://runbot.odoo-community.org/runbot/289/15.0
- :alt: Try me on Runbot
+.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
+ :target: https://runboat.odoo-community.org/builds?repo=OCA/hr-expense&target_branch=15.0
+ :alt: Try me on Runboat
-|badge1| |badge2| |badge3| |badge4| |badge5|
+|badge1| |badge2| |badge3| |badge4| |badge5|
This module adds the possibility to define a sequence for the expense report's reference that Employee advance.
This reference is then set as default when you create a new expense report, using the defined sequence.
@@ -48,7 +51,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues `_.
In case of trouble, please check there if your issue has already been reported.
-If you spotted it first, help us smashing it by providing a detailed and welcomed
+If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback `_.
Do not contact contributors directly about support or help with technical issues.
diff --git a/hr_expense_advance_clearing_sequence/i18n/it.po b/hr_expense_advance_clearing_sequence/i18n/it.po
index f1cd49f4e..cfbf0117f 100644
--- a/hr_expense_advance_clearing_sequence/i18n/it.po
+++ b/hr_expense_advance_clearing_sequence/i18n/it.po
@@ -6,15 +6,17 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n"
-"Last-Translator: Automatically generated\n"
+"PO-Revision-Date: 2023-06-28 17:08+0000\n"
+"Last-Translator: mymage \n"
"Language-Team: none\n"
"Language: it\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
+"X-Generator: Weblate 4.17\n"
#. module: hr_expense_advance_clearing_sequence
#: model:ir.model,name:hr_expense_advance_clearing_sequence.model_hr_expense_sheet
msgid "Expense Report"
-msgstr ""
+msgstr "Nota spese"
diff --git a/hr_expense_advance_clearing_sequence/static/description/index.html b/hr_expense_advance_clearing_sequence/static/description/index.html
index 3c38a5567..9deb54ed9 100644
--- a/hr_expense_advance_clearing_sequence/static/description/index.html
+++ b/hr_expense_advance_clearing_sequence/static/description/index.html
@@ -1,20 +1,20 @@
-
+
-
+
HR Expense Advance Clearing Sequence
-
-
HR Expense Advance Clearing Sequence
+
+
+
+
+
+
+
HR Expense Advance Clearing Sequence
-

-
This module adds the possibility to define a sequence for the expense
-report’s reference that Employee advance. This reference is then set as
-default when you create a new expense report, using the defined
-sequence.
+

+
This module gives advance (clearing) expenses their own numbering
+sequence, separate from regular employee expenses. When you create an
+advance expense, its reference number is drawn from a dedicated sequence
+(prefixed AV by default) instead of the generic expense sequence.
Table of contents
@@ -388,7 +393,7 @@ HR Expense Advance Clearing Sequence
-
+
You can change the default sequence (EXAV0001) by the one of your choice
going to Settings > Technical > Sequences & Identifiers > Sequences,
and editing the record Expense report sequence (Advance).
@@ -396,30 +401,30 @@
features permission check marked.
-
+
Bugs are tracked on GitHub Issues.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
-feedback.
+
feedback.
Do not contact contributors directly about support or help with technical issues.
+
From c3a703b25d3ce717b4d231a6c791c426e84141b3 Mon Sep 17 00:00:00 2001
From: Don Kendall
Date: Fri, 19 Jun 2026 15:12:17 -0400
Subject: [PATCH 15/16] [MIG] hr_expense_advance_clearing_sequence: Migration
to 19.0
- Inherit hr.expense (was hr.expense.sheet); key off expense_type='advance'
and assign the sequence in create() (sheet model removed in 19.0).
---
.../__manifest__.py | 3 +-
.../data/hr_expense_data.xml | 4 +--
.../models/__init__.py | 2 +-
.../models/hr_expense.py | 17 +++++++++++
.../models/hr_expense_sheet.py | 20 -------------
...st_hr_expense_advance_clearing_sequence.py | 30 ++++++++++++-------
6 files changed, 41 insertions(+), 35 deletions(-)
create mode 100644 hr_expense_advance_clearing_sequence/models/hr_expense.py
delete mode 100644 hr_expense_advance_clearing_sequence/models/hr_expense_sheet.py
diff --git a/hr_expense_advance_clearing_sequence/__manifest__.py b/hr_expense_advance_clearing_sequence/__manifest__.py
index 77514c21d..1e04963f5 100644
--- a/hr_expense_advance_clearing_sequence/__manifest__.py
+++ b/hr_expense_advance_clearing_sequence/__manifest__.py
@@ -3,7 +3,7 @@
{
"name": "HR Expense Advance Clearing Sequence",
- "version": "18.0.1.0.0",
+ "version": "19.0.1.0.0",
"license": "AGPL-3",
"category": "Human Resources",
"author": "Ecosoft, Odoo Community Association (OCA)",
@@ -11,5 +11,4 @@
"depends": ["hr_expense_sequence", "hr_expense_advance_clearing"],
"data": ["data/hr_expense_data.xml"],
"installable": True,
- "maintainer": ["ps-tubtim"],
}
diff --git a/hr_expense_advance_clearing_sequence/data/hr_expense_data.xml b/hr_expense_advance_clearing_sequence/data/hr_expense_data.xml
index d69d120c8..b7f33011b 100644
--- a/hr_expense_advance_clearing_sequence/data/hr_expense_data.xml
+++ b/hr_expense_advance_clearing_sequence/data/hr_expense_data.xml
@@ -1,8 +1,8 @@
- Expense report sequence (Advance)
- hr.expense.sheet.advance
+ Employee Advance sequence
+ hr.expense.advance
AV
diff --git a/hr_expense_advance_clearing_sequence/models/__init__.py b/hr_expense_advance_clearing_sequence/models/__init__.py
index 38117e21e..36af45d93 100644
--- a/hr_expense_advance_clearing_sequence/models/__init__.py
+++ b/hr_expense_advance_clearing_sequence/models/__init__.py
@@ -1,3 +1,3 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html)
-from . import hr_expense_sheet
+from . import hr_expense
diff --git a/hr_expense_advance_clearing_sequence/models/hr_expense.py b/hr_expense_advance_clearing_sequence/models/hr_expense.py
new file mode 100644
index 000000000..38430a912
--- /dev/null
+++ b/hr_expense_advance_clearing_sequence/models/hr_expense.py
@@ -0,0 +1,17 @@
+# Copyright 2019 Ecosoft Co., Ltd (http://ecosoft.co.th/)
+# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html)
+
+from odoo import api, models
+
+
+class HrExpense(models.Model):
+ _inherit = "hr.expense"
+
+ @api.model_create_multi
+ def create(self, vals_list):
+ for vals in vals_list:
+ if vals.get("expense_type") == "advance" and vals.get("number", "/") == "/":
+ vals["number"] = (
+ self.env["ir.sequence"].next_by_code("hr.expense.advance") or "/"
+ )
+ return super().create(vals_list)
diff --git a/hr_expense_advance_clearing_sequence/models/hr_expense_sheet.py b/hr_expense_advance_clearing_sequence/models/hr_expense_sheet.py
deleted file mode 100644
index 2be1473b5..000000000
--- a/hr_expense_advance_clearing_sequence/models/hr_expense_sheet.py
+++ /dev/null
@@ -1,20 +0,0 @@
-# Copyright 2019 Ecosoft Co., Ltd (http://ecosoft.co.th/)
-# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html)
-
-from odoo import api, models
-
-
-class HrExpenseSheet(models.Model):
- _inherit = "hr.expense.sheet"
-
- @api.model_create_multi
- def create(self, vals_list):
- default_advance = self.env.context.get("default_advance")
- for vals in vals_list:
- if vals.get("advance") or default_advance:
- number = (
- self.env["ir.sequence"].next_by_code("hr.expense.sheet.advance")
- or "/"
- )
- vals["number"] = number
- return super().create(vals)
diff --git a/hr_expense_advance_clearing_sequence/tests/test_hr_expense_advance_clearing_sequence.py b/hr_expense_advance_clearing_sequence/tests/test_hr_expense_advance_clearing_sequence.py
index 2ca89fbdd..669f4befd 100644
--- a/hr_expense_advance_clearing_sequence/tests/test_hr_expense_advance_clearing_sequence.py
+++ b/hr_expense_advance_clearing_sequence/tests/test_hr_expense_advance_clearing_sequence.py
@@ -10,15 +10,25 @@
@tagged("-at_install", "post_install")
class TestHrExpenseAdvanceClearingSequence(TestHrExpenseAdvanceClearing):
- @classmethod
- def setUpClass(cls):
- super().setUpClass()
+ def test_advance_gets_AV_sequence_number(self):
+ """Creating an advance expense fills `number` from the AV sequence."""
+ advance = self._new_advance(500.0)
+ self.assertNotEqual(advance.number, "/")
+ self.assertIn("AV", advance.number)
+ # Second advance gets a different number.
+ advance2 = self._new_advance(500.0)
+ self.assertNotEqual(advance.number, advance2.number)
- def test_01_create_sequence_from_sheet(self):
- advance_sheet = self.advance
- self.assertNotEqual(advance_sheet.number, "/", "Number create")
- self.assertNotEqual(advance_sheet.number.find("AV"), -1)
- # Test duplicate advance, number should be different
- self.assertNotEqual(
- advance_sheet.number, advance_sheet.copy().number, "Numbers are different"
+ def test_regular_expense_uses_default_sequence(self):
+ """A regular (non-advance) expense uses the standard hr.expense
+ sequence (provided by hr_expense_sequence), not the advance one."""
+ regular = self.env["hr.expense"].create(
+ {
+ "name": "regular",
+ "employee_id": self.expense_employee.id,
+ "product_id": self.product_a.id,
+ "total_amount_currency": 100.0,
+ "payment_mode": "own_account",
+ }
)
+ self.assertNotIn("AV", regular.number or "")
From bf9b9454ec73210cf7b568fd114dc8e95dec811e Mon Sep 17 00:00:00 2001
From: Don Kendall
Date: Fri, 19 Jun 2026 15:12:17 -0400
Subject: [PATCH 16/16] [DO NOT MERGE] hr_expense_advance_clearing_sequence:
pin hr_expense_sequence + hr_expense_advance_clearing to open PRs
---
test-requirements.txt | 5 +++++
1 file changed, 5 insertions(+)
create mode 100644 test-requirements.txt
diff --git a/test-requirements.txt b/test-requirements.txt
new file mode 100644
index 000000000..1253cf427
--- /dev/null
+++ b/test-requirements.txt
@@ -0,0 +1,5 @@
+# DO NOT MERGE — temporary pins until upstream deps land.
+# - OCA/hr-expense#353: hr_expense_sequence 19.0 MIG (A2 dep)
+# - OCA/hr-expense#358: hr_expense_advance_clearing 19.0 MIG (D2 dep)
+odoo-addon-hr_expense_sequence @ git+https://github.com/OCA/hr-expense.git@refs/pull/353/head#subdirectory=hr_expense_sequence
+odoo-addon-hr_expense_advance_clearing @ git+https://github.com/OCA/hr-expense.git@refs/pull/358/head#subdirectory=hr_expense_advance_clearing