Skip to content

Commit

Permalink
Merge b9e223f into 93dbe5e
Browse files Browse the repository at this point in the history
  • Loading branch information
mikevhe18 committed Sep 24, 2018
2 parents 93dbe5e + b9e223f commit 17bf3f0
Show file tree
Hide file tree
Showing 5 changed files with 229 additions and 74 deletions.
2 changes: 1 addition & 1 deletion hr_attendance_import_from_machine/__openerp__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# pylint: disable=locally-disabled, manifest-required-author
{
"name": "Import Attendance Data From Machine",
"version": "8.0.1.0.0",
"version": "8.0.1.2.0",
"website": "https://opensynergy-indonesia.com",
"author": "OpenSynergy Indonesia",
"license": "AGPL-3",
Expand Down
13 changes: 10 additions & 3 deletions hr_attendance_import_from_machine/models/hr_attendance_machine.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,21 @@ class HrAttendanceMachine(models.Model):
)
sign_in_code = fields.Char(
string="Sign In Code",
required=True,
required=False,
)
sign_out_code = fields.Char(
string="Sign Out Code",
required=True,
required=False,
)
delimiter = fields.Char(
delimiter = fields.Selection(
string="Delimiter",
selection=[
(",", ","),
(";", ";"),
(":", ":"),
("\t", "{tab}"),
(" ", "{space}")
],
default=",",
required=True,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,23 @@ class HrAttendanceMachineCsvDetail(models.Model):
domain="[('model', '=', 'hr.attendance')]",
required=True,
)
field_type = fields.Char(
string="Field Type"
)
date_format = fields.Selection(
string="Format Date",
selection=[
("datetime", "Datetime"),
("date", "Date"),
("time", "Time")
],
)

@api.onchange("field_id")
def onchange_field_type(self):
if self.field_id:
self.field_type = self.field_id.ttype
self.date_format = False

@api.constrains("attendance_machine_id", "csv_column")
def _check_duplicate_column(self):
Expand All @@ -46,6 +63,7 @@ def _check_duplicate_field(self):
("id", "!=", self.id),
("field_id.id", "=", self.field_id.id),
("attendance_machine_id", "=", self.attendance_machine_id.id),
("field_id.ttype", "<>", "datetime")
]
result = obj_machine.search_count(criteria)
if result > 0:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
<tree editable="bottom">
<field name="csv_column"/>
<field name="field_id"/>
<field name="field_type" invisible="0"/>
<field name="date_format" attrs="{'readonly':[('field_type','&lt;&gt;','datetime')],'required':[('field_type','=','datetime')]}" />
</tree>
</field>
</page>
Expand Down
Loading

0 comments on commit 17bf3f0

Please sign in to comment.