Skip to content
Permalink
Browse files

Merge pull request #737 from KolushovAlexandr/11.0-f9668c36975f0df30c…

…a4683e3ce0f3d9601ca696

11.0 f9668c3
  • Loading branch information...
yelizariev committed Apr 12, 2019
2 parents 9029440 + ce6a1aa commit e926e0dc372d2b4f567a0baebe2c0dbe025071b0
Showing with 435 additions and 172 deletions.
  1. +2 −0 README.md
  2. +2 −2 base_attendance/__manifest__.py
  3. +8 −0 base_attendance/doc/changelog.rst
  4. +8 −0 base_attendance/doc/index.rst
  5. +16 −1 base_attendance/models/res_attendance.py
  6. +38 −2 base_attendance/models/res_config.py
  7. +1 −1 base_attendance/models/res_partner.py
  8. +2 −2 base_attendance/static/src/js/kiosk_confirm.js
  9. +31 −2 base_attendance/static/src/js/kiosk_mode.js
  10. +32 −5 base_attendance/views/res_attendance_view.xml
  11. +3 −1 base_attendance/views/res_config_view.xml
  12. +10 −5 ir_attachment_s3/i18n/es_CR.po
  13. +3 −3 ir_config_parameter_multi_company/i18n/es_CR.po
  14. +13 −8 product_category_taxes/i18n/es_CR.po
  15. +17 −16 product_tags/i18n/es_CR.po
  16. +25 −0 production_lot_details/i18n/es_CR.po
  17. +41 −0 project_gantt8/i18n/es_CR.po
  18. +6 −5 project_task_order_kanban_state/i18n/es_CR.po
  19. +30 −36 project_task_subtask/i18n/es_CR.po
  20. +22 −19 reminder_base/i18n/es_CR.po
  21. +7 −6 reminder_crm_next_action/i18n/es_CR.po
  22. +6 −5 reminder_crm_next_action_time/i18n/es_CR.po
  23. +35 −0 reminder_hr_recruitment/i18n/es_CR.po
  24. +6 −5 reminder_task_deadline/i18n/es_CR.po
  25. +6 −5 res_partner_skype/i18n/es_CR.po
  26. +25 −0 sale_order_hide_tax/i18n/es_CR.po
  27. +12 −11 sms_sg/i18n/es_CR.po
  28. +0 −2 web_debranding/__manifest__.py
  29. +10 −10 web_debranding/i18n/es_CR.po
  30. +2 −1 web_debranding/models/ir_ui_view.py
  31. +0 −1 web_debranding/security/ir.model.access.csv
  32. +0 −6 web_debranding/security/web_debranding_security.xml
  33. +0 −2 web_debranding/views.xml
  34. +11 −10 web_preview/i18n/es_CR.po
  35. +5 −0 web_website/doc/changelog.rst
@@ -1,3 +1,5 @@
[![Build Status](https://travis-ci.com/it-projects-llc/misc-addons.svg?branch=10.0)](https://travis-ci.com/it-projects-llc/misc-addons)

Odoo addons
===========

@@ -1,13 +1,13 @@
# Copyright (c) 2004-2015 Odoo S.A.
# Copyright 2018 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr>
# Copyright 2018-2019 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr>
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
{
"name": """Partner Attendances""",
"summary": """Manage partner attendances""",
"category": "Extra Tools",
# "live_test_url": "",
"images": [],
"version": "11.0.1.0.1",
"version": "11.0.1.1.0",
"application": False,

"author": "IT-Projects LLC, Kolushov Alexandr",
@@ -1,3 +1,11 @@
`1.1.0`
-------

- **New:** Autocheckout option - closes shifts after defined time
- **New:** Option to support HEX barcode scanners in **Kiosk Mode**
- **Fix:** Error related to incorrect attribute name
- **Fix:** Error message even for correct partner PIN codes

`1.0.1`
-------

@@ -57,6 +57,14 @@ Also it is possible to use barcodes to check partners attendance
* Open menu ``[[ Partner Attendances ]] >> Kiosk Mode``
* Scan a partner's barcode to check him in or out, it depends on the actual partner's presence

Auto Checkout
-------------

Restriction on the maximum partner attendance time. Each ten minutes odoo checks for opened partner session, if a session lasts more then defined time it will be closed.

* Open menu ``[[ Partner Attendances ]] >> Configuration``
* Set ``AutoCheckout`` field in minutes.

Installation
============

@@ -1,11 +1,14 @@
# Copyright (c) 2004-2015 Odoo S.A.
# Copyright 2018 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr>
# Copyright 2018-2019 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
import logging

_logger = logging.getLogger(__name__)


class HrAttendance(models.Model):
@@ -109,3 +112,15 @@ def copy(self):
# [W8106(method-required-super), HrAttendance.copy] Missing `super` call in "copy" method.
super(HrAttendance, self).copy()
raise exceptions.UserError(_('You cannot duplicate an attendance.'))

@api.multi
def autocheckout_close_shifts(self):
max_interval = float(self.env["ir.config_parameter"].get_param("base_attendance.shift_autocheckout", default=0))
if max_interval:
shifts = self.search([('check_out', '=', False)]).filtered(
lambda x: (datetime.today() - datetime.strptime(x.check_in, DEFAULT_SERVER_DATETIME_FORMAT)).
total_seconds() / 3600 >= max_interval / 60)
_logger.info("partner session autologout for: %s, interval: %s", shifts.ids, max_interval)
shifts.write({
'check_out': fields.Datetime.now(),
})
@@ -1,8 +1,8 @@
# Copyright (c) 2004-2015 Odoo S.A.
# Copyright 2018 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr>
# Copyright 2018-2019 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr>
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).

from odoo import fields, models
from odoo import fields, models, api


class BaseConfigSettings(models.TransientModel):
@@ -13,3 +13,39 @@ class BaseConfigSettings(models.TransientModel):
string='Partner PIN',
help='Enable or disable partner PIN identification at check in',
implied_group="base_attendance.group_hr_attendance_use_pin")
shift_autocheckout = fields.Integer('Autocheckout ', help="Maximum Shift Time in Minutes")
hex_scanner_is_used = fields.Boolean('HEX Scanner', default=False,
help='Some devices scan regular barcodes as hexadecimal. '
'This option decode those types of barcodes')

@api.multi
def set_values(self):
super(BaseConfigSettings, self).set_values()
config_parameters = self.env["ir.config_parameter"].sudo()
for record in self:
config_parameters.set_param("base_attendance.shift_autocheckout",
record.shift_autocheckout or '0')
config_parameters.set_param("base_attendance.hex_scanner_is_used", record.hex_scanner_is_used)
self.checkout_shifts()

@api.multi
def get_values(self):
res = super(BaseConfigSettings, self).get_values()
config_parameters = self.env["ir.config_parameter"].sudo()
res.update(
shift_autocheckout=int(config_parameters.get_param("base_attendance.shift_autocheckout", default=0)),
hex_scanner_is_used=config_parameters.get_param("base_attendance.hex_scanner_is_used", default=False),
)
return res

@api.model
def checkout_shifts(self):
cron_record = self.env.ref('base_attendance.base_attendance_autocheckout')
if self.shift_autocheckout == 0:
cron_record.write({
'active': False,
})
else:
cron_record.write({
'active': True,
})
@@ -64,7 +64,7 @@ def attendance_scan(self, barcode):
def attendance_manual(self, next_action, entered_pin=None):
self.ensure_one()
if not (entered_pin is None) or \
self.env['res.users'].browse(SUPERUSER_ID).has_group('hr_partner_attendance.group_hr_attendance_use_pin'):
self.env['res.users'].browse(SUPERUSER_ID).has_group('base_attendance.group_hr_attendance_use_pin'):
if entered_pin != self.pin:
return {'warning': _('Wrong PIN')}
return self.attendance_action(next_action)
@@ -69,7 +69,7 @@ var KioskConfirm = Widget.extend({
this._rpc({
model: 'res.partner',
method: 'attendance_manual',
args: [[this.partner], this.next_action, this.$('.o_hr_attendance_PINbox').val()],
args: [[self.partner_id], this.next_action, this.$('.o_hr_attendance_PINbox').val()],
}).then(function(result) {
if (result.action) {
self.do_action(result.action);
@@ -105,7 +105,7 @@ var KioskConfirm = Widget.extend({
start_clock: function () {
this.clock_start = setInterval(function() {
this.$(".o_hr_attendance_clock").text(new Date().toLocaleTimeString(navigator.language, {hour: '2-digit', minute:'2-digit'}));
}, 500);
}, 900);
// First clock refresh before interval to avoid delay
this.$(".o_hr_attendance_clock").text(new Date().toLocaleTimeString(navigator.language, {hour: '2-digit', minute:'2-digit'}));
},
@@ -8,6 +8,8 @@ var ajax = require('web.ajax');
var core = require('web.core');
var Widget = require('web.Widget');
var Session = require('web.session');
var local_storage = require('web.local_storage');

var QWeb = core.qweb;

var KioskMode = Widget.extend({
@@ -17,6 +19,26 @@ var KioskMode = Widget.extend({
},
},

init: function (parent, action) {
action.target = 'fullscreen';
var hex_scanner_is_used = action.context.hex_scanner_is_used;
if (typeof hex_scanner_is_used === 'undefined') {
hex_scanner_is_used = this.get_from_storage('hex_scanner_is_used') || false;
} else {
this.save_locally('hex_scanner_is_used', Boolean(hex_scanner_is_used));
}
this.hex_scanner_is_used = hex_scanner_is_used;
this._super(parent, action);
},

save_locally: function(key, value) {
local_storage.setItem('est.' + key, JSON.stringify(value));
},

get_from_storage: function(key) {
return JSON.parse(local_storage.getItem('est.' + key));
},

start: function () {
var self = this;
core.bus.on('barcode_scanned', this, this._onBarcodeScanned);
@@ -38,10 +60,17 @@ var KioskMode = Widget.extend({

_onBarcodeScanned: function(barcode) {
var self = this;
var res_barcode = barcode;
if (this.hex_scanner_is_used) {
res_barcode = parseInt(barcode, 16).toString();
if (res_barcode.length % 2) {
res_barcode = '0' + res_barcode;
}
}
this._rpc({
model: 'res.partner',
method: 'attendance_scan',
args: [barcode, ],
args: [res_barcode, ],
}).then(function (result) {
if (result.action) {
self.do_action(result.action);
@@ -54,7 +83,7 @@ var KioskMode = Widget.extend({
start_clock: function() {
this.clock_start = setInterval(function() {
this.$(".o_hr_attendance_clock").text(new Date().toLocaleTimeString(navigator.language, {hour: '2-digit', minute:'2-digit'}));
}, 700);
}, 900);
// First clock refresh before interval to avoid delay
this.$(".o_hr_attendance_clock").text(new Date().toLocaleTimeString(navigator.language, {hour: '2-digit', minute:'2-digit'}));
},
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2004-2015 Odoo S.A.
Copyright 2018 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr>
Copyright 2018-2019 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr>
License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).-->
<odoo>

@@ -124,10 +124,22 @@
<field name="view_id"></field> <!-- force empty -->
</record>

<record id="hr_attendance_action_kiosk_mode" model="ir.actions.client">
<field name="name">Attendances</field>
<field name="tag">base_attendance_kiosk_mode</field>
<field name="target">fullscreen</field>
<record model="ir.actions.server" id="hr_attendance_action_kiosk_mode">
<field name="name">Get to the Kiosk Mode</field>
<field name="type">ir.actions.server</field>
<field name="model_id" ref="model_res_partner_attendance"/>
<field name="state">code</field>
<field name="code">
hex_scanner_is_used = model.env["ir.config_parameter"].get_param("base_attendance.hex_scanner_is_used",default=False)
action = {
'type': 'ir.actions.client',
'tag': 'base_attendance_kiosk_mode',
'target': 'fullscreen',
'context': {
'hex_scanner_is_used': hex_scanner_is_used
},
}
</field>
</record>

<record id="hr_attendance_action_greeting_message" model="ir.actions.client">
@@ -266,4 +278,19 @@
<menuitem id="menu_hr_attendance_kiosk_mode" name="Kiosk Mode" parent="menu_hr_attendance_manage_attendances" sequence="20" groups="base_attendance.group_hr_attendance_user" action="hr_attendance_action_kiosk_mode"/>

<menuitem id="menu_hr_attendance_report" name="Reports" parent="menu_base_attendance_root" sequence="30" groups="base_attendance.group_hr_attendance_user" action="hr_attendance_action_graph"/>

<!--IR CRON-->

<record model="ir.cron" id="base_attendance_autocheckout">
<field name="name">Partner Shift Autocheckout</field>
<field name="active" eval="False"/>
<field name="interval_number">10</field>
<field name="interval_type">minutes</field>
<field name="numbercall">-1</field>
<field name="doall" eval="False"/>
<field name="model_id" ref="model_res_partner_attendance"/>
<field name="state">code</field>
<field name="code">model.autocheckout_close_shifts()</field>
</record>

</odoo>
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2004-2015 Odoo S.A.
Copyright 2018 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr>
Copyright 2018-2019 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr>
License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).-->
<odoo>
<record id="hr_attendance_view_config" model="ir.ui.view">
@@ -14,7 +14,9 @@
<button string="Cancel" type="object" name="cancel" class="oe_link" special="cancel"/>
</header>
<group string="Settings">
<field name="hex_scanner_is_used"/>
<field name="group_attendance_use_pin" widget="radio"/>
<field name="shift_autocheckout"/>
</group>
</form>
</field>
@@ -4,7 +4,7 @@
#
# Translators:
# Randall <randall_castro@me.com>, 2018
#
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 11.0\n"
@@ -53,23 +53,23 @@ msgstr ""
#: model:ir.model.fields,field_description:ir_attachment_s3.field_theme_kit_config_s3_bucket
#: model:ir.ui.view,arch_db:ir_attachment_s3.res_config_settings_view_form
msgid "S3 bucket name"
msgstr ""
msgstr "Nombre Bucket S3"

#. module: ir_attachment_s3
#: model:ir.model.fields,field_description:ir_attachment_s3.field_res_config_settings_s3_condition
#: model:ir.model.fields,field_description:ir_attachment_s3.field_test_config_settings_s3_condition
#: model:ir.model.fields,field_description:ir_attachment_s3.field_theme_kit_config_s3_condition
#: model:ir.ui.view,arch_db:ir_attachment_s3.res_config_settings_view_form
msgid "S3 condition"
msgstr ""
msgstr "Condición S3"

#. module: ir_attachment_s3
#: model:ir.model.fields,field_description:ir_attachment_s3.field_res_config_settings_s3_secret_key
#: model:ir.model.fields,field_description:ir_attachment_s3.field_test_config_settings_s3_secret_key
#: model:ir.model.fields,field_description:ir_attachment_s3.field_theme_kit_config_s3_secret_key
#: model:ir.ui.view,arch_db:ir_attachment_s3.res_config_settings_view_form
msgid "S3 secret key"
msgstr ""
msgstr "LLave secreta S3"

#. module: ir_attachment_s3
#: model:ir.actions.act_window,name:ir_attachment_s3.ir_attachment_s3_config_settings_action
@@ -83,6 +83,8 @@ msgid ""
"Some of the S3 connection credentials are missing.\n"
" Don't forget to click the ``[Apply]`` button after any changes you've made"
msgstr ""
"Faltan algunas de las credenciales de conexión al S3.\n"
"No olvide hacer clic en el botón `` [Aplicar] `` después de cualquier cambio que haya realizado"

#. module: ir_attachment_s3
#: model:ir.model.fields,help:ir_attachment_s3.field_res_config_settings_s3_condition
@@ -93,11 +95,14 @@ msgid ""
" e.g. [('res_model', 'in', ['product.image'])] -- store data of product.image only.\n"
" Empty condition means all models"
msgstr ""
"Especifique el dominio de odoo de búsqueda válido aquí,\n"
"p.ej. [('res_model', 'in', ['product.image'])] -- almacena datos de product.image solamente.\n"
"Condición vacía significa todos los modelos"

#. module: ir_attachment_s3
#: model:ir.ui.view,arch_db:ir_attachment_s3.res_config_settings_view_form
msgid "Upload existing attachments"
msgstr ""
msgstr "Cargar adjuntos existentes"

#. module: ir_attachment_s3
#: model:ir.model.fields,help:ir_attachment_s3.field_res_config_settings_s3_bucket
@@ -22,12 +22,12 @@ msgstr ""
#: code:addons/ir_config_parameter_multi_company/models/ir_config_parameter.py:7
#, python-format
msgid "Default value for \"%s\""
msgstr ""
msgstr "Valor por defecto para \"%s\""

#. module: ir_config_parameter_multi_company
#: model:ir.model,name:ir_config_parameter_multi_company.model_res_users
msgid "Users"
msgstr ""
msgstr "Usuarios"

#. module: ir_config_parameter_multi_company
#: model:ir.model,name:ir_config_parameter_multi_company.model_ir_config_parameter
@@ -37,4 +37,4 @@ msgstr "ir.config_parameter"
#. module: ir_config_parameter_multi_company
#: model:ir.model,name:ir_config_parameter_multi_company.model_ir_property
msgid "ir.property"
msgstr ""
msgstr "ir.property"
Oops, something went wrong.

0 comments on commit e926e0d

Please sign in to comment.
You can’t perform that action at this time.