Skip to content

Commit 69e272e

Browse files
Jaime ArroyoTobias Zehntner
Jaime Arroyo
authored and
Tobias Zehntner
committed
[IMP] hr_contract_reference: black, isort, prettier
1 parent 723578a commit 69e272e

File tree

6 files changed

+18
-29
lines changed

6 files changed

+18
-29
lines changed

hr_contract_reference/__manifest__.py

+5-8
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,12 @@
44
"name": "HR Contract Reference",
55
"version": "12.0.1.0.0",
66
"category": "Generic Modules/Human Resources",
7-
"author": 'Michael Telahun Makonnen, '
8-
'Fekete Mihai (Forest and Biomass Services Romania), '
9-
'Odoo Community Association (OCA)',
7+
"author": "Michael Telahun Makonnen, "
8+
"Fekete Mihai (Forest and Biomass Services Romania), "
9+
"Odoo Community Association (OCA)",
1010
"website": "https://github.com/OCA/hr",
1111
"license": "AGPL-3",
1212
"depends": ["hr_contract"],
13-
"data": [
14-
'views/hr_contract_view.xml',
15-
'data/hr_contract_sequence.xml',
16-
],
17-
'installable': True,
13+
"data": ["views/hr_contract_view.xml", "data/hr_contract_sequence.xml"],
14+
"installable": True,
1815
}
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
<?xml version="1.0" encoding="utf-8"?>
1+
<?xml version="1.0" encoding="utf-8" ?>
22
<odoo noupdate="1">
3-
43
<record id="seq_contract_ref" model="ir.sequence">
54
<field name="name">Contract Reference</field>
65
<field name="code">contract.ref</field>
76
<field name="prefix">EC/%(year)s/</field>
87
<field name="padding">5</field>
98
</record>
10-
119
</odoo>

hr_contract_reference/models/hr_contract.py

+4-8
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,14 @@
55

66

77
class HrContract(models.Model):
8-
_inherit = 'hr.contract'
8+
_inherit = "hr.contract"
99

1010
name = fields.Char(
11-
'Contract Reference',
12-
required=False,
13-
readonly=True,
14-
copy=False,
15-
default='/'
11+
"Contract Reference", required=False, readonly=True, copy=False, default="/"
1612
)
1713

1814
@api.model
1915
def create(self, vals):
20-
if vals.get('name', '/') == '/':
21-
vals['name'] = self.env['ir.sequence'].next_by_code('contract.ref')
16+
if vals.get("name", "/") == "/":
17+
vals["name"] = self.env["ir.sequence"].next_by_code("contract.ref")
2218
return super(HrContract, self).create(vals)
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
This module was written to extend the functionality of employees contracts
22
to support sequence of contract reference which will be generated
3-
automatically from the sequence predefined.
3+
automatically from the sequence predefined.

hr_contract_reference/tests/test_contract_reference.py

+5-7
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,12 @@
55

66

77
class TestContractReference(TransactionCase):
8-
98
def setUp(self):
109
super(TestContractReference, self).setUp()
11-
self.employee = self.env['hr.employee'].create({'name': 'Emp'})
10+
self.employee = self.env["hr.employee"].create({"name": "Emp"})
1211

1312
def test_contract_reference(self):
14-
contract = self.employee = self.env['hr.contract'].create({
15-
'employee_id': self.employee.id,
16-
'wage': 1000
17-
})
18-
self.assertNotEqual(contract.name, '/')
13+
contract = self.employee = self.env["hr.contract"].create(
14+
{"employee_id": self.employee.id, "wage": 1000}
15+
)
16+
self.assertNotEqual(contract.name, "/")

hr_contract_reference/views/hr_contract_view.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
<?xml version="1.0" encoding="utf-8"?>
1+
<?xml version="1.0" encoding="utf-8" ?>
22
<odoo>
33
<record id="hr_contract_view" model="ir.ui.view">
44
<field name="name">hr.contract.form.view.inherit.ref</field>
55
<field name="model">hr.contract</field>
66
<field name="type">form</field>
7-
<field name="inherit_id" ref="hr_contract.hr_contract_view_form"/>
7+
<field name="inherit_id" ref="hr_contract.hr_contract_view_form" />
88
<field name="arch" type="xml">
99
<field name="name" position="attributes">
1010
<attribute name="readonly">True</attribute>

0 commit comments

Comments
 (0)