Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

⬆️1️⃣2️⃣ base_attendance #688

Merged
merged 1 commit into from Nov 26, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 8 additions & 4 deletions base_attendance/README.rst
Expand Up @@ -25,7 +25,9 @@ Maintainers
-----------
* `IT-Projects LLC <https://it-projects.info>`__

To get a guaranteed support you are kindly requested to purchase the module at `odoo apps store <https://apps.odoo.com/apps/modules/10.0/base_attendance/>`__.
To get a guaranteed support
you are kindly requested to purchase the module
at `odoo apps store <https://apps.odoo.com/apps/modules/12.0/base_attendance/>`__.

Thank you for understanding!

Expand All @@ -34,12 +36,14 @@ Maintainers
Further information
===================

Demo: http://runbot.it-projects.info/demo/misc-addons/10.0
Demo: http://runbot.it-projects.info/demo/pos-addons/12.0

HTML Description: https://apps.odoo.com/apps/modules/10.0/base_attendance/
HTML Description: https://apps.odoo.com/apps/modules/12.0/base_attendance/

Usage instructions: `<doc/index.rst>`_

Changelog: `<doc/changelog.rst>`_

Tested on Odoo 10.0 7a63d471edec45a106fef5f783aeb7eaf43447f6
Notifications on updates: `via Atom <https://github.com/it-projects-llc/pos-addons/commits/12.0/base_attendance.atom>`_, `by Email <https://blogtrottr.com/?subscribe=https://github.com/it-projects-llc/pos-addons/commits/12.0/base_attendance.atom>`_

Tested on Odoo 12.0 b0844a4882e7ed089a861da357fed96dfc4abe55
6 changes: 3 additions & 3 deletions base_attendance/__manifest__.py
Expand Up @@ -7,12 +7,12 @@
"category": "Extra Tools",
# "live_test_url": "",
"images": [],
"version": "11.0.1.0.0",
"version": "12.0.1.0.0",
"application": False,

"author": "IT-Projects LLC, Kolushov Alexandr",
"support": "apps@it-projects.info",
"website": "https://it-projects.info/team/KolushovAlexandr",
"website": "https://www.odoo.com/apps/modules/12.0/base_attendance/",
"license": "LGPL-3",
"price": 60.00,
"currency": "EUR",
Expand All @@ -34,6 +34,6 @@
'qweb': [
"static/src/xml/attendance.xml",
],
'installable': False,
'installable': True,
'auto_install': False,
}
6 changes: 1 addition & 5 deletions base_attendance/models/res_attendance.py
Expand Up @@ -2,10 +2,7 @@
# Copyright 2018 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr>
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).

from datetime import datetime

from odoo import models, fields, api, exceptions, _
from odoo.tools import DEFAULT_SERVER_DATETIME_FORMAT


class HrAttendance(models.Model):
Expand Down Expand Up @@ -45,8 +42,7 @@ def name_get(self):
def _compute_worked_hours(self):
for attendance in self:
if attendance.check_out:
delta = datetime.strptime(attendance.check_out, DEFAULT_SERVER_DATETIME_FORMAT) - datetime.strptime(
attendance.check_in, DEFAULT_SERVER_DATETIME_FORMAT)
delta = attendance.check_out - attendance.check_in
attendance.worked_hours = delta.total_seconds() / 3600.0

@api.constrains('check_in', 'check_out')
Expand Down
4 changes: 2 additions & 2 deletions base_attendance/static/description/index.html
Expand Up @@ -67,7 +67,7 @@ <h2>Need our service?</h2>
-o-transform: rotate(-10deg);
-moz-transform: rotate(-10deg);
-ms-transform: rotate(-10deg);">
Tested on Odoo<br/>10.0 community
Tested on Odoo<br/>12.0 community
</div>
<!--<div style="margin-top: 15px;
position: relative;
Expand All @@ -84,7 +84,7 @@ <h2>Need our service?</h2>
-o-transform: rotate(0deg);
-moz-transform: rotate(0deg);
-ms-transform: rotate(0deg);">
Tested on Odoo<br/>10.0 enterprise
Tested on Odoo<br/>12.0 enterprise
</div>-->
</div>
</div>
Expand Down
5 changes: 3 additions & 2 deletions base_attendance/static/src/js/greeting_message.js
Expand Up @@ -4,12 +4,13 @@
odoo.define('base_attendance.greeting_message', function (require) {
"use strict";

var AbstractAction = require('web.AbstractAction');
var core = require('web.core');
var Widget = require('web.Widget');

var _t = core._t;


var GreetingMessage = Widget.extend({
var GreetingMessage = AbstractAction.extend({
template: 'BaseAttendanceGreetingMessage',

events: {
Expand Down
4 changes: 2 additions & 2 deletions base_attendance/static/src/js/kiosk_confirm.js
Expand Up @@ -4,12 +4,12 @@
odoo.define('base_attendance.kiosk_confirm', function (require) {
"use strict";

var AbstractAction = require('web.AbstractAction');
var core = require('web.core');
var Widget = require('web.Widget');
var QWeb = core.qweb;


var KioskConfirm = Widget.extend({
var KioskConfirm = AbstractAction.extend({
events: {
"click .o_hr_attendance_back_button": function () {
this.do_action(this.next_action, {clear_breadcrumbs: true});
Expand Down
5 changes: 3 additions & 2 deletions base_attendance/static/src/js/kiosk_mode.js
Expand Up @@ -4,13 +4,14 @@
odoo.define('base_attendance.kiosk_mode', function (require) {
"use strict";

var AbstractAction = require('web.AbstractAction');
var ajax = require('web.ajax');
var core = require('web.core');
var Widget = require('web.Widget');
var Session = require('web.session');

var QWeb = core.qweb;

var KioskMode = Widget.extend({
var KioskMode = AbstractAction.extend({
events: {
"click .o_hr_attendance_button_partners": function(){
this.do_action('base_attendance.res_partner_action_kanban_view');
Expand Down
4 changes: 2 additions & 2 deletions base_attendance/static/src/js/presence_widgets.js
Expand Up @@ -4,14 +4,14 @@
odoo.define('base_attendance.presence_widgets', function (require) {
"use strict";

var AbstractAction = require('web.AbstractAction');
var core = require('web.core');
var Widget = require('web.Widget');

var QWeb = core.qweb;
var _t = core._t;


var MyAttendances = Widget.extend({
var MyAttendances = AbstractAction.extend({
events: {
"click .o_hr_attendance_sign_in_out_icon": function() {
this.$('.o_hr_attendance_sign_in_out_icon').attr("disabled", "disabled");
Expand Down
Expand Up @@ -10,7 +10,7 @@ KanbanRecord.include({

_openRecord: function () {
if (this.modelName === 'res.partner' && this.$el.parents('.o_res_partner_attendance_kanban').length) {
// needed to diffentiate : check in/out kanban view of employees <-> standard employee kanban view
// needed to diffentiate : check in/out kanban view of employees <-> standard employee kanban view
var action = {
type: 'ir.actions.client',
name: 'Confirm',
Expand Down
Expand Up @@ -11,22 +11,21 @@
font-size: 1.2em;
margin-right: .3em;
display: inline-block;
color: @odoo-brand-secondary;

color: #f0eeee;
&.oe_hr_attendance_status_green {
color: @brand-success;
color: theme-color('success');
}
&.oe_hr_attendance_status_red {
color: @brand-danger;
color: theme-color('danger');
}
}

.o_form_view .oe_button_box .oe_stat_button .o_button_icon {
&.oe_hr_attendance_status_green {
color: @brand-success !important;
color: theme-color('success') !important;
}
&.oe_hr_attendance_status_red {
color: @brand-danger !important;
color: theme-color('danger') !important;
}
}

Expand All @@ -41,8 +40,8 @@
right: 0px;
top: 0px;
bottom: auto;
@media (min-width: @screen-xs-max) {

@include media-breakpoint-up(xs) {
transform: translate(50%, -50%);
}
}
Expand Down Expand Up @@ -71,16 +70,16 @@
background: white;
border: 1px solid #d5d5d5;
text-align: center;
margin: 5px 0px 5px 0px;
margin: 5px 0px 5px 0px;
}

.o_hr_attendance_kiosk_mode_container {
.o-flex-display();
.o-flex-flow(column, nowrap);
.o-justify-content(center);
.o-align-items(center);
display: flex;
flex-flow: column nowrap;
justify-content: flex-start;
align-items: center;

@media (min-width: @screen-xs-max) {
@include media-breakpoint-up(xs) {
background: url("../../../../web_enterprise/static/src/img/application-switcher-bg.jpg") no-repeat center center fixed;
background-size: cover;
position: absolute;
Expand All @@ -92,7 +91,7 @@
}

.o_hr_attendance_warning_message {
color: @brand-warning;
color: theme-color('warning');
}
.o_hr_attendance_random_message {
font-style: italic;
Expand Down Expand Up @@ -134,7 +133,7 @@
margin-bottom: 0;
}

@media (min-width: @screen-xs-max) {
@include media-breakpoint-up(xs) {
flex: 0 0 auto;
width: 550px;
border-radius: 10px;
Expand All @@ -152,7 +151,7 @@
top: 20px;
right: 20px;

@media (min-width: @screen-xs-max) {
@include media-breakpoint-up(xs) {
flex: 0 0 auto;
border-radius: 3px;
background-color: rgba(255,255,255,0.5);
Expand All @@ -161,12 +160,12 @@
}

.o_hr_attendance_message_container {
.o-flex-display();
.o-flex-flow(column, nowrap);
.o-justify-content(center);
.o-align-items(center);
display: flex;
flex-flow: column nowrap;
justify-content: flex-start;
align-items: center;

@media (min-width: @screen-xs-max) {
@include media-breakpoint-up(xs) {
background: url("../../../../web_enterprise/static/src/img/application-switcher-bg.jpg") no-repeat center center fixed;
background-size: cover;
position: absolute;
Expand Down Expand Up @@ -213,7 +212,7 @@
margin-bottom: 0;
}

@media (min-width: @screen-xs-max) {
@include media-breakpoint-up(xs) {
flex: 0 0 auto;
width: 550px;
border-radius: 10px;
Expand Down
2 changes: 1 addition & 1 deletion base_attendance/tests/test_hr_attendance_constraints.py
Expand Up @@ -12,7 +12,7 @@ class TestHrAttendance(TransactionCase):
def setUp(self):
super(TestHrAttendance, self).setUp()
self.attendance = self.env['res.partner.attendance']
self.test_partner = self.env['res.partner'].search([('name', '=', 'David Simpson')])
self.test_partner = self.env.ref('base.partner_demo')

def test_attendance_in_before_out(self):
# Make sure check_out is before check_in
Expand Down
2 changes: 1 addition & 1 deletion base_attendance/tests/test_hr_attendance_process.py
Expand Up @@ -10,7 +10,7 @@ class TestHrAttendance(TransactionCase):

def setUp(self):
super(TestHrAttendance, self).setUp()
self.test_partner_attendance = self.env['res.partner'].search([('name', '=', 'Thomas Passot')])
self.test_partner_attendance = self.env.ref('base.partner_demo')

def test_partner_attendance_state(self):
# Make sure the attendance of the partner will display correctly
Expand Down
5 changes: 1 addition & 4 deletions base_attendance/tests/test_kiosk_tour.py
Expand Up @@ -2,7 +2,6 @@
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).

import odoo.tests
from odoo.api import Environment


@odoo.tests.common.at_install(True)
Expand All @@ -14,10 +13,8 @@ def test_kiosk(self):
# installed. In js web will only load qweb coming from modules
# that are returned by the backend in module_boot. Without
# this you end up with js, css but no qweb.
cr = self.registry.cursor()
env = Environment(cr, self.uid, {})
env = self.env
env['ir.module.module'].search([('name', '=', 'base_attendance')], limit=1).state = 'installed'
cr.release()
# without a delay there might be problems on the steps whilst opening a POS
# caused by a not yet loaded button's action
self.phantom_js("/web",
Expand Down