Merge branch 'imp/16.0/clean_up_2024' into '16.0-test'

imp/16.0/clean_up_2024 into 16.0-test

See merge request hibou-io/hibou-odoo/suite!1711
This commit is contained in:
Jared Kipe
2024-09-11 05:38:25 +00:00
42 changed files with 0 additions and 1346 deletions

View File

@@ -1,15 +0,0 @@
from . import models
def attn_payroll_pre_init_hook(cr):
"""
This module installs a Work Entry Type with code "ATTN"
If you have undergone a migration (either for this module
or even your own Payslip Work Entry lines with code "ATTN")
then the uniqueness constraint will prevent this module
from installing.
"""
cr.execute("UPDATE hr_work_entry_type "
"SET code = 'ATTN-PRE-INSTALL' "
"WHERE code = 'ATTN';"
)

View File

@@ -1,33 +0,0 @@
{
'name': 'Attendance Work Entry Type',
'description': 'Set work types on attendance records.',
'version': '16.0.1.0.0',
'website': 'https://hibou.io/',
'author': 'Hibou Corp. <hello@hibou.io>',
'license': 'AGPL-3',
'category': 'Human Resources',
'depends': [
'hr_attendance',
'hr_work_entry',
],
'data': [
'data/hr_attendance_work_entry_data.xml',
'views/attendance_views.xml',
'views/employee_views.xml',
'views/work_entry_views.xml',
],
'demo': [
'data/hr_attendance_work_entry_demo.xml',
],
'assets': {
'web.assets_qweb': [
'hr_attendance_work_entry/static/src/xml/hr_attendance.xml',
],
'web.assets_backend': [
'hr_attendance_work_entry/static/src/js/kiosk_confirm.js',
'hr_attendance_work_entry/static/src/js/my_attendances.js',
'hr_attendance_work_entry/static/src/scss/hr_attendances.scss',
],
},
'pre_init_hook': 'attn_payroll_pre_init_hook',
}

View File

@@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="work_input_attendance" model="hr.work.entry.type">
<field name="name">Attendance</field>
<field name="code">ATTN</field>
<field name="allow_attendance" eval="True"/>
<field name="attendance_state">checked_in</field>
<field name="attendance_icon">fa-sign-in</field>
</record>
<!-- Rename Stock "Attendance" type -->
<record id="hr_work_entry.work_entry_type_attendance" model="hr.work.entry.type">
<field name="name">Work Calendar</field>
</record>
</odoo>

View File

@@ -1,20 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="work_input_attendance_break" model="hr.work.entry.type">
<field name="name">Break</field>
<field name="code">ATTN_BREAK</field>
<field name="allow_attendance" eval="True"/>
<field name="attendance_state">break</field>
<field name="attendance_icon">fa-hourglass-1</field>
</record>
<record id="work_input_attendance_lunch" model="hr.work.entry.type">
<field name="name">Lunch</field>
<field name="code">ATTN_LUNCH</field>
<field name="allow_attendance" eval="True"/>
<field name="attendance_state">lunch</field>
<field name="attendance_icon">fa-coffee</field>
</record>
</odoo>

View File

@@ -1,266 +0,0 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * hr_attendance_work_entry
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.0+e\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-10-30 01:04+0000\n"
"PO-Revision-Date: 2021-10-30 01:04+0000\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_attendance_work_entry
#: model_terms:ir.ui.view,arch_db:hr_attendance_work_entry.hr_employees_view_kanban_inherit
#: model_terms:ir.ui.view,arch_db:hr_attendance_work_entry.hr_kanban_view_employees_inherit
msgid ""
"<span id=\"oe_hr_attendance_status\" class=\"fa fa-circle "
"oe_hr_attendance_status_blue\" role=\"img\" aria-label=\"On Break\" "
"title=\"On Break\"/>"
msgstr ""
"<span id=\"oe_hr_attendance_status\" class=\"fa fa-circle "
"oe_hr_attendance_status_blue\" role=\"img\" aria-label=\"En descanso\" "
"title=\"En descanso\"/>"
#. module: hr_attendance_work_entry
#: model_terms:ir.ui.view,arch_db:hr_attendance_work_entry.hr_employees_view_kanban_inherit
#: model_terms:ir.ui.view,arch_db:hr_attendance_work_entry.hr_kanban_view_employees_inherit
msgid ""
"<span id=\"oe_hr_attendance_status\" class=\"fa fa-circle "
"oe_hr_attendance_status_green\" role=\"img\" aria-label=\"Available\" "
"title=\"Available\"/>"
msgstr ""
"<span id=\"oe_hr_attendance_status\" class=\"fa fa-circle "
"oe_hr_attendance_status_green\" role=\"img\" aria-label=\"Disponible\" "
"title=\"Disponible\"/"
#. module: hr_attendance_work_entry
#: model_terms:ir.ui.view,arch_db:hr_attendance_work_entry.hr_employees_view_kanban_inherit
#: model_terms:ir.ui.view,arch_db:hr_attendance_work_entry.hr_kanban_view_employees_inherit
msgid ""
"<span id=\"oe_hr_attendance_status\" class=\"fa fa-circle "
"oe_hr_attendance_status_orange\" role=\"img\" aria-label=\"At Lunch\" "
"title=\"At Lunch\"/>"
msgstr ""
"<span id=\"oe_hr_attendance_status\" class=\"fa fa-circle "
"oe_hr_attendance_status_orange\" role=\"img\" aria-label=\"En el almuerzo\" "
"title=\"En el almuerzo\"/>"
#. module: hr_attendance_work_entry
#: model_terms:ir.ui.view,arch_db:hr_attendance_work_entry.hr_employees_view_kanban_inherit
#: model_terms:ir.ui.view,arch_db:hr_attendance_work_entry.hr_kanban_view_employees_inherit
msgid ""
"<span id=\"oe_hr_attendance_status\" class=\"fa fa-circle "
"oe_hr_attendance_status_red\" role=\"img\" aria-label=\"Not available\" "
"title=\"Not available\"/>"
msgstr ""
"<span id=\"oe_hr_attendance_status\" class=\"fa fa-circle "
"oe_hr_attendance_status_red\" role=\"img\" aria-label=\"No Disponible\" "
"title=\"No Disponible\"/>"
#. module: hr_attendance_work_entry
#: model:ir.model.fields,field_description:hr_attendance_work_entry.field_hr_work_entry_type__allow_attendance
msgid "Allow in Attendance"
msgstr "Permitido en Asistencia"
#. module: hr_attendance_work_entry
#: model:hr.work.entry.type,name:hr_attendance_work_entry.work_input_attendance
#: model:ir.model,name:hr_attendance_work_entry.model_hr_attendance
#: model_terms:ir.ui.view,arch_db:hr_attendance_work_entry.hr_work_entry_type_view_form_inherit
msgid "Attendance"
msgstr "Asistencia"
#. module: hr_attendance_work_entry
#: model:ir.model.fields,field_description:hr_attendance_work_entry.field_hr_work_entry_type__attendance_icon
msgid "Attendance Icon"
msgstr "Icono de Asistencia"
#. module: hr_attendance_work_entry
#: model:ir.model.fields,field_description:hr_attendance_work_entry.field_hr_work_entry_type__attendance_state
msgid "Attendance State"
msgstr "Estado de Asistencia"
#. module: hr_attendance_work_entry
#: model:ir.model.fields,field_description:hr_attendance_work_entry.field_hr_employee__attendance_state
msgid "Attendance Status"
msgstr "Estado de Asistencia"
#. module: hr_attendance_work_entry
#: code:addons/hr_attendance_work_entry/models/work_entry.py:0
#: model:ir.model.fields.selection,name:hr_attendance_work_entry.selection__hr_employee__attendance_state__break
#: model:ir.model.fields.selection,name:hr_attendance_work_entry.selection__hr_work_entry_type__attendance_state__break
#, python-format
msgid "Break"
msgstr "Descanso"
#. module: hr_attendance_work_entry
#: code:addons/hr_attendance_work_entry/models/employee.py:0
#, python-format
msgid ""
"Cannot perform check out on %(empl_name)s, could not find corresponding "
"check in. Your attendances have probably been modified manually by human "
"resources."
msgstr ""
"No se pudo realizar un registro de salida para %(empl_name)s, ya que no se "
"encontro un registro de entrada correspondiente. Sus asistencias han "
"probablemente sido modificado manualmente for recursos humanos"
#. module: hr_attendance_work_entry
#: model:ir.model.fields.selection,name:hr_attendance_work_entry.selection__hr_work_entry_type__attendance_state__checked_in
msgid "Checked in"
msgstr "Registro de Entrada"
#. module: hr_attendance_work_entry
#: model:ir.model,name:hr_attendance_work_entry.model_hr_employee
msgid "Employee"
msgstr "Empleado"
#. module: hr_attendance_work_entry
#. openerp-web
#: code:addons/hr_attendance_work_entry/static/src/xml/hr_attendance.xml:0
#, python-format
msgid "Error: could not find corresponding employee."
msgstr "Error: No se pudo encontrar el empleado correspondiente"
#. module: hr_attendance_work_entry
#. openerp-web
#: code:addons/hr_attendance_work_entry/static/src/xml/hr_attendance.xml:0
#: code:addons/hr_attendance_work_entry/static/src/xml/hr_attendance.xml:0
#: code:addons/hr_attendance_work_entry/static/src/xml/hr_attendance.xml:0
#, python-format
msgid "Go back"
msgstr "Volver"
#. module: hr_attendance_work_entry
#: model:ir.model,name:hr_attendance_work_entry.model_hr_work_entry_type
msgid "HR Work Entry Type"
msgstr "Tipo de entrada de trabajo de RRHH"
#. module: hr_attendance_work_entry
#: model:ir.model.fields.selection,name:hr_attendance_work_entry.selection__hr_employee__attendance_state__lunch
#: model:ir.model.fields.selection,name:hr_attendance_work_entry.selection__hr_work_entry_type__attendance_state__lunch
msgid "Lunch"
msgstr "Almuerzo"
#. module: hr_attendance_work_entry
#. openerp-web
#: code:addons/hr_attendance_work_entry/static/src/xml/hr_attendance.xml:0
#: code:addons/hr_attendance_work_entry/static/src/xml/hr_attendance.xml:0
#, python-format
msgid "Or, continue working as:"
msgstr "O, Sigue trabajando como:"
#. module: hr_attendance_work_entry
#. openerp-web
#: code:addons/hr_attendance_work_entry/static/src/xml/hr_attendance.xml:0
#, python-format
msgid "Please enter your PIN to"
msgstr "Por favor ingrese su PIN para"
#. module: hr_attendance_work_entry
#. openerp-web
#: code:addons/hr_attendance_work_entry/static/src/xml/hr_attendance.xml:0
#, python-format
msgid "Please return to the main menu."
msgstr "Por favor regrese al menú principal"
#. module: hr_attendance_work_entry
#. openerp-web
#: code:addons/hr_attendance_work_entry/static/src/xml/hr_attendance.xml:0
#, python-format
msgid "Sign Out"
msgstr "Cerrar Sesión"
#. module: hr_attendance_work_entry
#. openerp-web
#: code:addons/hr_attendance_work_entry/static/src/xml/hr_attendance.xml:0
#: code:addons/hr_attendance_work_entry/static/src/xml/hr_attendance.xml:0
#: code:addons/hr_attendance_work_entry/static/src/xml/hr_attendance.xml:0
#: code:addons/hr_attendance_work_entry/static/src/xml/hr_attendance.xml:0
#, python-format
msgid "Sign in"
msgstr "Iniciar Sesión"
#. module: hr_attendance_work_entry
#. openerp-web
#: code:addons/hr_attendance_work_entry/static/src/xml/hr_attendance.xml:0
#: code:addons/hr_attendance_work_entry/static/src/xml/hr_attendance.xml:0
#: code:addons/hr_attendance_work_entry/static/src/xml/hr_attendance.xml:0
#: code:addons/hr_attendance_work_entry/static/src/xml/hr_attendance.xml:0
#: code:addons/hr_attendance_work_entry/static/src/xml/hr_attendance.xml:0
#: code:addons/hr_attendance_work_entry/static/src/xml/hr_attendance.xml:0
#, python-format
msgid "Sign out"
msgstr "Cerrar Sesión"
#. module: hr_attendance_work_entry
#. openerp-web
#: code:addons/hr_attendance_work_entry/static/src/xml/hr_attendance.xml:0
#: code:addons/hr_attendance_work_entry/static/src/xml/hr_attendance.xml:0
#, python-format
msgid "Stop"
msgstr "Detener"
#. module: hr_attendance_work_entry
#. openerp-web
#: code:addons/hr_attendance_work_entry/static/src/xml/hr_attendance.xml:0
#: code:addons/hr_attendance_work_entry/static/src/xml/hr_attendance.xml:0
#, python-format
msgid "Today's work hours:"
msgstr "Horas de trabajo de hoy:"
#. module: hr_attendance_work_entry
#. openerp-web
#: code:addons/hr_attendance_work_entry/static/src/xml/hr_attendance.xml:0
#: code:addons/hr_attendance_work_entry/static/src/xml/hr_attendance.xml:0
#, python-format
msgid "Want to check out?"
msgstr "¿Desea registrar una salida?"
#. module: hr_attendance_work_entry
#. openerp-web
#: code:addons/hr_attendance_work_entry/static/src/xml/hr_attendance.xml:0
#, python-format
msgid ""
"Warning : Your user should be linked to an employee to use attendance. "
"Please contact your administrator."
msgstr ""
"Advertencia : Su usuario debe estar vinculado a un empleado para usarla en asistencias."
"Por favor contacte su administrador"
#. module: hr_attendance_work_entry
#. openerp-web
#: code:addons/hr_attendance_work_entry/static/src/xml/hr_attendance.xml:0
#: code:addons/hr_attendance_work_entry/static/src/xml/hr_attendance.xml:0
#, python-format
msgid "Welcome!"
msgstr "¡Bienvenida!"
#. module: hr_attendance_work_entry
#: model:ir.ui.menu,name:hr_attendance_work_entry.hr_work_entry_type_menu
msgid "Work Entry Types"
msgstr "Tipos de entradas de trabajo"
#. module: hr_attendance_work_entry
#: model:ir.model.fields,field_description:hr_attendance_work_entry.field_hr_attendance__work_type_id
msgid "Work Type"
msgstr "Tipo de trabajo"
#. module: hr_attendance_work_entry
#. openerp-web
#: code:addons/hr_attendance_work_entry/static/src/xml/hr_attendance.xml:0
#, python-format
msgid "check in"
msgstr "el Registro de entrada"
#. module: hr_attendance_work_entry
#. openerp-web
#: code:addons/hr_attendance_work_entry/static/src/xml/hr_attendance.xml:0
#, python-format
msgid "check out"
msgstr "el Registro de salida"

View File

@@ -1,3 +0,0 @@
from . import attendance
from . import employee
from . import work_entry

View File

@@ -1,14 +0,0 @@
from odoo import api, fields, models
class HrAttendance(models.Model):
_inherit = 'hr.attendance'
work_type_id = fields.Many2one('hr.work.entry.type', string='Work Type',
default=lambda self: self.env.ref('hr_attendance_work_entry.work_input_attendance',
raise_if_not_found=False))
@api.model
def gather_attendance_work_types(self):
work_types = self.env['hr.work.entry.type'].sudo().search([('allow_attendance', '=', True)])
return work_types.read(['id', 'name', 'attendance_icon'])

View File

@@ -1,61 +0,0 @@
from odoo import api, fields, models, _
from odoo.exceptions import UserError
class HrEmployee(models.Model):
_inherit = 'hr.employee'
attendance_state = fields.Selection(selection_add=[('break', 'Break'), ('lunch', 'Lunch')])
@api.depends('last_attendance_id.work_type_id', 'last_attendance_id.check_in', 'last_attendance_id.check_out', 'last_attendance_id')
def _compute_attendance_state(self):
for employee in self:
att = employee.last_attendance_id.sudo()
if not att or att.check_out:
employee.attendance_state = 'checked_out'
elif employee.last_attendance_id.work_type_id.attendance_state:
employee.attendance_state = employee.last_attendance_id.work_type_id.attendance_state
else:
employee.attendance_state = 'checked_in'
def attendance_manual(self, next_action, entered_pin=None, work_type_id=None):
self = self.with_context(work_type_id=work_type_id)
if not entered_pin:
# fix for pin mode with specific argument order for work_type_id
entered_pin = None
return super(HrEmployee, self).attendance_manual(next_action, entered_pin=entered_pin)
def _attendance_action_change(self):
""" Check In/Check Out action
Check In: create a new attendance record
Check Out: modify check_out field of appropriate attendance record
"""
self.ensure_one()
action_date = fields.Datetime.now()
work_type_id = self._context.get('work_type_id', False)
if self.attendance_state == 'checked_out':
vals = {
'employee_id': self.id,
'check_in': action_date,
}
if work_type_id:
# if we don't have a work_type_id, we want the default
vals['work_type_id'] = work_type_id
return self.env['hr.attendance'].create(vals)
attendance = self.env['hr.attendance'].search([('employee_id', '=', self.id), ('check_out', '=', False)], limit=1)
if attendance and work_type_id:
# work_type_id is the "next" attendance type
attendance.check_out = action_date
vals = {
'employee_id': self.id,
'check_in': action_date,
'work_type_id': work_type_id,
}
return self.env['hr.attendance'].create(vals)
if attendance:
attendance.check_out = action_date
else:
raise UserError(_('Cannot perform check out on %(empl_name)s, could not find corresponding check in. '
'Your attendances have probably been modified manually by human resources.') % {'empl_name': self.sudo().name, })
return attendance

View File

@@ -1,15 +0,0 @@
from odoo import fields, models
class HrWorkEntryType(models.Model):
_inherit = 'hr.work.entry.type'
_order = 'sequence, id'
allow_attendance = fields.Boolean(string='Allow in Attendance')
attendance_icon = fields.Char(string='Attendance Icon', default='fa-sign-in')
attendance_state = fields.Selection([
# ('checked_out', "Checked out"), # reserved for detecting new punch in
('checked_in', "Checked in"),
('break', 'Break'),
('lunch', 'Lunch'),
], string='Attendance State', default='checked_in')

View File

@@ -1,69 +0,0 @@
odoo.define('hr_attendance_work_entry.kiosk_confirm', function (require) {
"use strict";
var KioskConfirm = require('hr_attendance.kiosk_confirm');
var KioskConfirmTyped = KioskConfirm.extend({
events: _.extend({}, KioskConfirm.prototype.events, {
"click .o_hr_attendance_punch_type": _.debounce(function(e) {
var work_entry_type = $(e.target).data('work-entry-type');
this.update_attendance(work_entry_type);
}, 200, true),
"click .o_hr_attendance_pin_pad_button_work": _.debounce(function(e) {
var work_entry_type = $(e.target).data('work-entry-type');
this.update_attendance_pin(work_entry_type);
}, 200, true),
}),
willStart: function () {
var self = this;
var def = this._rpc({
model: 'hr.attendance',
method: 'gather_attendance_work_types',
args: []})
.then(function (res) {
self.work_types = res;
});
return Promise.all([def, this._super.apply(this, arguments)]);
},
update_attendance: function (type) {
var self = this;
this._rpc({
model: 'hr.employee',
method: 'attendance_manual',
args: [[self.employee_id], this.next_action, false, type],
})
.then(function(result) {
if (result.action) {
self.do_action(result.action);
} else if (result.warning) {
self.do_warn(result.warning);
}
});
},
update_attendance_pin: function (type) {
var self = this;
this.$('.o_hr_attendance_pin_pad_button_ok').attr("disabled", "disabled");
this.$('.o_hr_attendance_pin_pad_button_work').attr("disabled", "disabled");
this._rpc({
model: 'hr.employee',
method: 'attendance_manual',
args: [[this.employee_id], this.next_action, this.$('.o_hr_attendance_PINbox').val(), type],
})
.then(function(result) {
if (result.action) {
self.do_action(result.action);
} else if (result.warning) {
self.do_warn(result.warning);
self.$('.o_hr_attendance_PINbox').val('');
setTimeout( function() {
self.$('.o_hr_attendance_pin_pad_button_ok').removeAttr("disabled");
self.$('.o_hr_attendance_pin_pad_button_work').removeAttr("disabled");
}, 500);
}
});
},
});
return KioskConfirmTyped;
});

View File

@@ -1,47 +0,0 @@
odoo.define('hr_attendance_work_entry.my_attendances', function (require) {
"use strict";
var MyAttendances = require('hr_attendance.my_attendances');
var MyTypedAttendances = MyAttendances.extend({
events: _.extend({}, MyAttendances.prototype.events, {
"click .o_hr_attendance_punch_type": _.debounce(function(e) {
var work_entry_type = $(e.target).data('work-entry-type');
this.update_attendance(work_entry_type);
}, 200, true),
}),
willStart: function () {
var self = this;
var def = this._rpc({
model: 'hr.attendance',
method: 'gather_attendance_work_types',
args: []})
.then(function (res) {
self.work_types = res;
});
return Promise.all([def, this._super.apply(this, arguments)]);
},
update_attendance: function (type) {
var self = this;
this._rpc({
model: 'hr.employee',
method: 'attendance_manual',
args: [[self.employee.id], 'hr_attendance.hr_attendance_action_my_attendances', false, type],
})
.then(function(result) {
if (result.action) {
self.do_action(result.action);
} else if (result.warning) {
self.do_warn(result.warning);
}
});
},
});
return MyTypedAttendances;
});

View File

@@ -1,31 +0,0 @@
.o_hr_attendance_sign_in_out_icon {
cursor: pointer;
border-radius: .1em;
box-shadow: inset 0 -3px 0 fade-out(black, 0.7);
&.btn-secondary:hover {
color: $o-brand-primary;
}
}
#oe_hr_attendance_status {
color: $o-brand-secondary;
&.oe_hr_attendance_status_blue {
color: theme-color('info');
}
&.oe_hr_attendance_status_orange {
color: theme-color('warning');
}
}
.o_hr_attendance_kiosk_mode p.o_hr_attendance_continue {
margin-bottom: 0;
text-align: center;
font-weight: bold;
}
.o_hr_attendance_pin_pad_button_work {
font-size: 0.9em;
}

View File

@@ -1,134 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates xml:space="preserve">
<t t-extend="HrAttendanceMyMainMenu">
<t t-jquery=".o_hr_attendance_kiosk_mode" t-operation="replace">
<div class="o_hr_attendance_kiosk_mode">
<t t-set="checked_in" t-value="widget.employee.attendance_state=='checked_in'"/>
<t t-set="checked_out" t-value="widget.employee.attendance_state=='checked_out'"/>
<t t-if="widget.employee">
<div class="o_hr_attendance_user_badge o_home_menu_background">
<img class="img rounded-circle"
t-attf-src="/web/image?model=hr.employee&amp;field=image_128&amp;id=#{widget.employee.id}"
t-att-title="widget.employee.name" t-att-alt="widget.employee.name"/>
</div>
<h1 class="mb8"><t t-esc="widget.employee.name"/></h1>
<h3 class="mt8 mb24"><t t-if="!checked_in">Welcome!</t>
<t t-else="">Want to check out?</t></h3>
<h4 class="mt0 mb0 text-muted" t-if="checked_in">Today's work hours: <span
t-esc="widget.hours_today"/></h4>
<div class="container">
<div class="row">
<div id="kiosk_action_container" class="col-md-12 kiosk_action_container">
<!-- SIGN OUT OF CURRENT PUNCH TYPES -->
<a t-if="!checked_out" class="btn btn-secondary btn-block btn-warning o_hr_attendance_sign_in_out_icon"
aria-label="Sign out" title="Sign out">
<i class="fa fa-1x fa-sign-out mr-1 mt-3 mb-3"></i>
<span>
<b>Stop</b>
</span>
</a>
<p t-if="!checked_out" class="o_hr_attendance_continue">
Or, continue working as:
</p>
<t t-foreach="widget.work_types" t-as="work_type">
<a class="btn btn-block btn-secondary o_hr_attendance_punch_type mt-2 mb-2"
aria-label="Sign in" title="Sign in" t-attf-data-work-entry-type="#{work_type.id}">
<i t-attf-class="fa #{work_type.attendance_icon} fa-1x mr-1 mt-3 mb-3"> </i>
<span t-esc="work_type.name"/>
</a>
</t>
</div>
</div>
</div>
</t>
<t t-else="">
Warning : Your user should be linked to an employee to use attendance. Please contact your administrator.
</t>
</div>
</t>
</t>
<t t-extend="HrAttendanceKioskConfirm">
<t t-jquery=".o_hr_attendance_kiosk_mode" t-operation="replace">
<div class="o_hr_attendance_kiosk_mode">
<t t-set="checked_in" t-value="widget.employee_state=='checked_in'"/>
<t t-set="checked_out" t-value="widget.employee_state=='checked_out'"/>
<div class="o_hr_attendance_back_button">
<span class="btn btn-secondary btn-lg d-block d-md-none"><i class="fa fa-chevron-left mr8"/> Go back</span>
<span class="btn btn-secondary d-none d-md-inline-block"><i class="fa fa-chevron-left" role="img" aria-label="Go back" title="Go back"/></span>
</div>
<t t-if="widget.employee_id">
<div class="o_hr_attendance_user_badge o_home_menu_background">
<img class="img rounded-circle" t-attf-src="/web/image?model=hr.employee&amp;field=image_128&amp;id=#{widget.employee_id}" t-att-title="widget.employee_name" t-att-alt="widget.employee_name"/>
</div>
<h1 class="mb8"><t t-esc="widget.employee_name"/></h1>
<h3 class="mt8 mb24"><t t-if="!checked_in">Welcome! </t><t t-else="">Want to check out?</t></h3>
<h4 class="mt0 mb0 text-muted" t-if="checked_in">Today's work hours: <span t-esc="widget.employee_hours_today"/></h4>
<t t-if="!widget.use_pin">
<div id="kiosk_action_container" class="col-md-12 kiosk_action_container">
<!-- SIGN OUT OF CURRENT PUNCH TYPES -->
<a t-if="!checked_out" class="btn btn-secondary btn-block btn-warning o_hr_attendance_sign_in_out_icon"
aria-label="Sign out" title="Sign out">
<i class="fa fa-1x fa-sign-out mr-1 mt-3 mb-3"></i>
<span>
<b>Stop</b>
</span>
</a>
<p t-if="!checked_out" class="o_hr_attendance_continue">
Or, continue working as:
</p>
<t t-foreach="widget.work_types" t-as="work_type">
<a class="btn btn-block btn-secondary o_hr_attendance_punch_type mt-2 mb-2"
aria-label="Sign in" title="Sign in" t-attf-data-work-entry-type="#{work_type.id}">
<i t-attf-class="fa #{work_type.attendance_icon} fa-1x mr-1 mt-3 mb-3"> </i>
<span t-esc="work_type.name"/>
</a>
</t>
</div>
</t>
<t t-else="">
<h3 class="mt0 mb0 text-muted">Please enter your PIN to <b t-if="checked_in">check out</b><b t-else="">check in</b></h3>
<div class="row">
<div class="col-md-8 offset-md-2 o_hr_attendance_pin_pad">
<div class="row" >
<div class="col-12 mb8 mt8"><input class="o_hr_attendance_PINbox text-center" type="password" disabled="true"/></div>
</div>
<div class="row">
<t t-foreach="['1', '2', '3', '4', '5', '6', '7', '8', '9', ['C', 'btn-warning'], '0', ['ok', 'btn-primary']]" t-as="btn_name">
<div class="col-4 mb4" t-if="btn_name[0] != 'ok'">
<a t-attf-class="btn {{btn_name[1]? btn_name[1] : 'btn-secondary'}} btn-block btn-lg {{ 'o_hr_attendance_pin_pad_button_' + btn_name[0] }}"><t t-esc="btn_name[0]"/></a>
</div>
<t t-else="">
<div class="col-4 mb4" t-if="!checked_out">
<a class="btn btn-primary btn-block btn-lg o_hr_attendance_pin_pad_button_ok">Sign Out</a>
</div>
<div class="col-4 mb4" t-else=""/>
<!-- ok button -->
<div class="col-4 mb4" t-foreach="widget.work_types" t-as="work_type">
<a href="#" class="btn btn-primary btn-block btn-lg o_hr_attendance_pin_pad_button_work small" t-attf-data-work-entry-type="#{work_type.id}"><i t-attf-class="fa fa-1x #{work_type.attendance_icon} mr-1 mt-3 mb-3"></i> <t t-esc="work_type.name"/></a>
</div>
</t>
</t>
</div>
</div>
</div>
</t>
</t>
<div t-else="" class="alert alert-danger" role="alert">
<b>Error: could not find corresponding employee.</b><br/>Please return to the main menu.
</div>
<a role="button" class="oe_attendance_sign_in_out" aria-label="Sign out" title="Sign out"/>
</div>
</t>
</t>
</templates>

View File

@@ -1 +0,0 @@
from . import test_attendance_work_type

View File

@@ -1,52 +0,0 @@
from time import sleep
from odoo.tests import common
class TestAttendanceWorkType(common.TransactionCase):
def setUp(self):
super().setUp()
self.employee = self.env.ref('hr.employee_hne')
self.default_work_type = self.env.ref('hr_attendance_work_entry.work_input_attendance')
def test_01_work_type(self):
attendance = self.env['hr.attendance'].create({
'employee_id': self.employee.id,
'check_in': '2020-01-06 10:00:00', # Monday
'check_out': '2020-01-06 19:00:00',
})
self.assertTrue(attendance.work_type_id)
self.assertEqual(attendance.work_type_id, self.default_work_type)
def test_11_employee_clock_in(self):
self.assertEqual(self.employee.attendance_state, 'checked_out')
attendance = self.employee._attendance_action_change()
self.assertEqual(attendance.work_type_id, self.default_work_type)
self.assertEqual(self.employee.attendance_state, 'checked_in')
# check out
self.employee._attendance_action_change()
self.assertEqual(self.employee.attendance_state, 'checked_out')
def test_12_employee_clock_in_break(self):
# check in with non-standard work type
break_type = self.env['hr.work.entry.type'].create({
'name': 'Test Break',
'code': 'TESTBREAK',
'allow_attendance': True,
'attendance_state': 'break',
})
self.employee = self.employee.with_context(work_type_id=break_type.id)
attendance = self.employee._attendance_action_change()
self.assertEqual(attendance.work_type_id, break_type)
self.assertEqual(self.employee.attendance_state, 'break')
# tests likely won't pass as the timestamps will be the same
sleep(1)
# check back in immediately with default
self.employee = self.employee.with_context(work_type_id=self.default_work_type.id)
attendance = self.employee._attendance_action_change()
self.assertEqual(attendance.work_type_id, self.default_work_type)
self.assertEqual(attendance.work_type_id.attendance_state, 'checked_in')
self.assertEqual(self.employee.last_attendance_id, attendance)
self.assertEqual(self.employee.attendance_state, 'checked_in')

View File

@@ -1,15 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="hr_attendance_tree_inherit" model="ir.ui.view">
<field name="name">hr.attendance.tree.inherit</field>
<field name="model">hr.attendance</field>
<field name="inherit_id" ref="hr_attendance.view_attendance_tree"/>
<field name="arch" type="xml">
<xpath expr="//tree/field[@name='worked_hours']" position="before">
<field name="work_type_id" />
</xpath>
</field>
</record>
</odoo>

View File

@@ -1,58 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="hr_kanban_view_employees_inherit" model="ir.ui.view">
<field name="name">hr.employee.kanban.inherit</field>
<field name="model">hr.employee</field>
<field name="inherit_id" ref="hr.hr_kanban_view_employees"/>
<field name="arch" type="xml">
<xpath expr="//kanban/field[@name='hr_presence_state']" position="after">
<field name="attendance_state"/>
</xpath>
<xpath expr="//strong[@class='o_kanban_record_title']/t[1]/div[1]" position="before">
<div class="float-right" t-if="record.attendance_state.raw_value == 'checked_in'">
<span id="oe_hr_attendance_status" class="fa fa-circle oe_hr_attendance_status_green" role="img" aria-label="Available" title="Available"></span>
</div>
<div class="float-right" t-if="record.attendance_state.raw_value == 'checked_out'">
<span id="oe_hr_attendance_status" class="fa fa-circle oe_hr_attendance_status_red" role="img" aria-label="Not available" title="Not available"></span>
</div>
<div class="float-right" t-if="record.attendance_state.raw_value == 'lunch'">
<span id="oe_hr_attendance_status" class="fa fa-circle oe_hr_attendance_status_orange" role="img" aria-label="At Lunch" title="At Lunch"></span>
</div>
<div class="float-right" t-if="record.attendance_state.raw_value == 'break'">
<span id="oe_hr_attendance_status" class="fa fa-circle oe_hr_attendance_status_blue" role="img" aria-label="On Break" title="On Break"></span>
</div>
</xpath>
</field>
</record>
<!-- employee kanban view specifically for hr_attendance (to check in/out) -->
<record id="hr_employees_view_kanban_inherit" model="ir.ui.view">
<field name="name">hr.employee.kanban.inherit</field>
<field name="model">hr.employee</field>
<field name="inherit_id" ref="hr_attendance.hr_employees_view_kanban"/>
<field name="arch" type="xml">
<xpath expr="//div[@id='textbox']" position="replace">
<div id="textbox">
<div class="float-right" t-if="record.attendance_state.raw_value == 'checked_in'">
<span id="oe_hr_attendance_status" class="fa fa-circle oe_hr_attendance_status_green" role="img" aria-label="Available" title="Available"></span>
</div>
<div class="float-right" t-if="record.attendance_state.raw_value == 'checked_out'">
<span id="oe_hr_attendance_status" class="fa fa-circle oe_hr_attendance_status_red" role="img" aria-label="Not available" title="Not available"></span>
</div>
<div class="float-right" t-if="record.attendance_state.raw_value == 'lunch'">
<span id="oe_hr_attendance_status" class="fa fa-circle oe_hr_attendance_status_orange" role="img" aria-label="At Lunch" title="At Lunch"></span>
</div>
<div class="float-right" t-if="record.attendance_state.raw_value == 'break'">
<span id="oe_hr_attendance_status" class="fa fa-circle oe_hr_attendance_status_blue" role="img" aria-label="On Break" title="On Break"></span>
</div>
<strong>
<field name="name"/>
</strong>
</div>
</xpath>
</field>
</record>
</odoo>

View File

@@ -1,37 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="hr_work_entry_type_view_form_inherit" model="ir.ui.view">
<field name="name">hr.work.type.view.form.inherit</field>
<field name="model">hr.work.entry.type</field>
<field name="inherit_id" ref="hr_work_entry.hr_work_entry_type_view_form"/>
<field name="arch" type="xml">
<xpath expr="//group/group" position="after">
<group name="attendance" string="Attendance">
<field name="allow_attendance"/>
<field name="attendance_icon" attrs="{'invisible': [('allow_attendance', '=', False)]}" />
<field name="attendance_state" attrs="{'invisible': [('allow_attendance', '=', False)]}" />
</group>
</xpath>
</field>
</record>
<record id="hr_work_entry_type_view_tree_inherit" model="ir.ui.view">
<field name="name">hr.work.type.view.tree.inherit</field>
<field name="model">hr.work.entry.type</field>
<field name="inherit_id" ref="hr_work_entry.hr_work_entry_type_view_tree"/>
<field name="arch" type="xml">
<xpath expr="//tree/field[1]" position="before">
<field name="sequence" widget="handle"/>
</xpath>
</field>
</record>
<menuitem
id="hr_work_entry_type_menu"
name="Work Entry Types"
parent="hr_attendance.menu_hr_attendance_root"
sequence="90"
action="hr_work_entry.hr_work_entry_type_action"/>
</odoo>

View File

@@ -1,15 +0,0 @@
from . import models
def ts_work_type_pre_init_hook(cr):
"""
This module installs a Work Entry Type with code "TS"
If you have undergone a migration (either for this module
or even your own Payslip Work Entry lines with code "TS")
then the uniqueness constraint will prevent this module
from installing.
"""
cr.execute("UPDATE hr_work_entry_type "
"SET code = 'TS-PRE-INSTALL-14' "
"WHERE code = 'TS';"
)

View File

@@ -1,24 +0,0 @@
{
'name': 'Timesheet Work Entry Type',
'description': 'Set work types on timesheet records.',
'version': '16.0.1.0.0',
'website': 'https://hibou.io/',
'author': 'Hibou Corp. <hello@hibou.io>',
'license': 'AGPL-3',
'category': 'Human Resources',
'depends': [
'project',
'hr_timesheet',
'hr_work_entry',
],
'data': [
'security/ir.model.access.csv',
'data/hr_timesheet_work_entry_data.xml',
'views/timesheet_views.xml',
'views/work_entry_views.xml',
],
'demo': [
'data/hr_timesheet_work_entry_demo.xml',
],
'pre_init_hook': 'ts_work_type_pre_init_hook',
}

View File

@@ -1,10 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="work_input_timesheet" model="hr.work.entry.type">
<field name="name">Timesheet</field>
<field name="code">TS</field>
<field name="allow_timesheet" eval="True"/>
</record>
</odoo>

View File

@@ -1,10 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="work_input_timesheet_internal" model="hr.work.entry.type">
<field name="name">Internal</field>
<field name="code">TS_INTERNAL</field>
<field name="allow_timesheet" eval="True"/>
</record>
</odoo>

View File

@@ -1,51 +0,0 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * hr_timesheet_work_entry
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.0+e\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-10-12 01:31+0000\n"
"PO-Revision-Date: 2021-10-12 01:31+0000\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_timesheet_work_entry
#: model:ir.model.fields,field_description:hr_timesheet_work_entry.field_hr_work_entry_type__allow_timesheet
msgid "Allow on Timesheet"
msgstr "Permitir en Ficha de Horario"
#. module: hr_timesheet_work_entry
#: model:ir.model,name:hr_timesheet_work_entry.model_account_analytic_line
msgid "Analytic Line"
msgstr "Línea Analítica"
#. module: hr_timesheet_work_entry
#: model:ir.model,name:hr_timesheet_work_entry.model_hr_work_entry_type
msgid "HR Work Entry Type"
msgstr "Tipo de entrada de trabajo de RRHH"
#. module: hr_timesheet_work_entry
#: model:hr.work.entry.type,name:hr_timesheet_work_entry.work_input_timesheet
msgid "Timesheet"
msgstr "Ficha de Horario"
#. module: hr_timesheet_work_entry
#: model_terms:ir.ui.view,arch_db:hr_timesheet_work_entry.hr_work_entry_type_view_form_inherit
msgid "Timesheets"
msgstr "Fichas de Horario"
#. module: hr_timesheet_work_entry
#: model:ir.ui.menu,name:hr_timesheet_work_entry.hr_work_entry_type_menu
msgid "Work Entry Types"
msgstr "Tipos de Entradas de Trabajo"
#. module: hr_timesheet_work_entry
#: model:ir.model.fields,field_description:hr_timesheet_work_entry.field_account_analytic_line__work_type_id
msgid "Work Type"
msgstr "Tipo de Trabajo"

View File

@@ -1,2 +0,0 @@
from . import timesheet
from . import work_entry

View File

@@ -1,9 +0,0 @@
from odoo import api, fields, models
class AccountAnalyticLine(models.Model):
_inherit = 'account.analytic.line'
work_type_id = fields.Many2one('hr.work.entry.type', string='Work Type',
default=lambda self: self.env.ref('hr_timesheet_work_entry.work_input_timesheet',
raise_if_not_found=False))

View File

@@ -1,7 +0,0 @@
from odoo import fields, models
class HrWorkEntryType(models.Model):
_inherit = 'hr.work.entry.type'
allow_timesheet = fields.Boolean(string='Allow on Timesheet')

View File

@@ -1,2 +0,0 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_hr_work_entry_type_employee,access_hr_work_entry_type_employee,model_hr_work_entry_type,base.group_user,1,0,0,0
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_hr_work_entry_type_employee access_hr_work_entry_type_employee model_hr_work_entry_type base.group_user 1 0 0 0

View File

@@ -1 +0,0 @@
from . import test_timesheet_work_type

View File

@@ -1,19 +0,0 @@
from odoo.tests import common
class TestTimesheetWorkType(common.TransactionCase):
def setUp(self):
super().setUp()
self.employee = self.env.ref('hr.employee_hne')
self.project = self.env.ref('project.project_project_2')
self.default_work_type = self.env.ref('hr_timesheet_work_entry.work_input_timesheet')
def test_01_work_type(self):
timesheet = self.env['account.analytic.line'].create({
'name': '/',
'employee_id': self.employee.id,
'unit_amount': 1.0,
'project_id': self.project.id,
})
self.assertTrue(timesheet.work_type_id)
self.assertEqual(timesheet.work_type_id, self.default_work_type)

View File

@@ -1,48 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="hr_timesheet_line_tree_inherit" model="ir.ui.view">
<field name="name">account.analytic.line.tree.hr_timesheet.inherit</field>
<field name="model">account.analytic.line</field>
<field name="inherit_id" ref="hr_timesheet.hr_timesheet_line_tree"/>
<field name="arch" type="xml">
<xpath expr="//tree/field[@name='task_id']" position="after">
<field name="work_type_id"
domain="[('allow_timesheet', '=', True)]"
context="{'default_allow_timesheet': True}" />
</xpath>
</field>
</record>
<record id="hr_timesheet_line_form_inherit" model="ir.ui.view">
<field name="name">account.analytic.line.form.inherit</field>
<field name="model">account.analytic.line</field>
<field name="inherit_id" ref="hr_timesheet.hr_timesheet_line_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='task_id']" position="after">
<field name="work_type_id"
domain="[('allow_timesheet', '=', True)]"
context="{'default_allow_timesheet': True}" />
</xpath>
</field>
</record>
<record id="view_task_form2_inherit" model="ir.ui.view">
<field name="name">project.task.form.inherit</field>
<field name="model">project.task</field>
<field name="inherit_id" ref="hr_timesheet.view_task_form2_inherited" />
<field name="arch" type="xml">
<xpath expr="//field[@name='timesheet_ids']/tree//field[@name='employee_id']" position="after">
<field name="work_type_id"
domain="[('allow_timesheet', '=', True)]"
context="{'default_allow_timesheet': True}" />
</xpath>
<xpath expr="//field[@name='timesheet_ids']/form//field[@name='task_id']" position="after">
<field name="work_type_id"
domain="[('allow_timesheet', '=', True)]"
context="{'default_allow_timesheet': True}" />
</xpath>
</field>
</record>
</odoo>

View File

@@ -1,23 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="hr_work_entry_type_view_form_inherit" model="ir.ui.view">
<field name="name">hr.work.type.view.form.inherit</field>
<field name="model">hr.work.entry.type</field>
<field name="inherit_id" ref="hr_work_entry.hr_work_entry_type_view_form"/>
<field name="arch" type="xml">
<xpath expr="//group/group" position="after">
<group name="timesheet" string="Timesheets">
<field name="allow_timesheet"/>
</group>
</xpath>
</field>
</record>
<menuitem
id="hr_work_entry_type_menu"
name="Work Entry Types"
parent="hr_timesheet.hr_timesheet_menu_configuration"
action="hr_work_entry.hr_work_entry_type_action"/>
</odoo>

View File

@@ -1 +0,0 @@
from . import models

View File

@@ -1,22 +0,0 @@
{
'name': 'Sale Exception Portal',
'summary': 'Display sale exceptions on customer portal',
'version': '16.0.1.0.0',
'author': "Hibou Corp.",
'category': 'Sale',
'license': 'AGPL-3',
'website': "https://hibou.io",
'description': """
Display sale exceptions on customer portal and prevent further action
""",
'depends': [
'sale_exception',
],
'demo': [],
'data': [
'views/sale_portal_templates.xml',
'views/sale_views.xml',
],
'auto_install': False,
'installable': True,
}

View File

@@ -1 +0,0 @@
from . import sale

View File

@@ -1,17 +0,0 @@
from odoo import fields, models
class ExceptionRule(models.Model):
_inherit = 'exception.rule'
website_description = fields.Text('Description for Website')
class SaleOrder(models.Model):
_inherit = 'sale.order'
def _check_sale_order_exceptions(self):
exception_ids = self.detect_exceptions()
exceptions = self.env['exception.rule'].browse(exception_ids)
reasons = [{'title': ex.name, 'description': ex.website_description or ex.description} for ex in exceptions]
return reasons

View File

@@ -1 +0,0 @@
from . import test_check_so_exceptions

View File

@@ -1,43 +0,0 @@
from odoo.tests.common import TransactionCase
class TestCheckSOExceptions(TransactionCase):
def setUp(self):
super(TestCheckSOExceptions, self).setUp()
self.azure_customer = self.browse_ref('base.res_partner_12')
self.exception_rule = self.env['exception.rule'].create({
'name': 'No Azure',
'description': 'No sales to Azure',
'active': True,
'model': 'sale.order',
'exception_type': 'by_py_code',
'code': 'failed = object.partner_id and object.partner_id.id == %d' % self.azure_customer.id
})
self.sale_product = self.browse_ref('product.product_product_5')
self.sale_product.standard_price = 100.0
def test_00_check_so_exceptions(self):
sale_order = self.env['sale.order'].create({
'partner_id': self.azure_customer.id,
'order_line': [(0, 0, {
'product_id': self.sale_product.id,
'product_uom_qty': 1.0,
'price_unit': 50.0,
})],
})
exceptions = sale_order._check_sale_order_exceptions()
self.assertEqual(len(exceptions), 1)
self.assertEqual(exceptions[0].get('description'), 'No sales to Azure')
self.exception_rule.website_description = 'Different message for website'
exceptions = sale_order._check_sale_order_exceptions()
self.assertEqual(len(exceptions), 1)
self.assertEqual(exceptions[0].get('description'), 'Different message for website')
self.exception_rule.active = False
exceptions = sale_order._check_sale_order_exceptions()
self.assertEqual(len(exceptions), 0)

View File

@@ -1,75 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<template id="sale_order_portal_template_inherit" inherit_id="sale.sale_order_portal_template">
<!-- LEFT COLUMN ACTIONS -->
<xpath expr="//li[1]" position="replace">
<t t-set="sale_order_exceptions" t-value="sale_order._check_sale_order_exceptions()"/>
<li class="list-group-item flex-grow-1">
<a t-if="sale_order._has_to_be_signed(True) and not sale_order_exceptions"
role="button" class="btn btn-primary btn-block mb8"
data-toggle="modal"
data-target="#modalaccept"
href="#">
<i class="fa fa-check"/>
<t t-if="sale_order._has_to_be_paid(True)"> Sign &amp; Pay</t>
<t t-else=""> Accept &amp; Sign</t>
</a>
<a t-elif="sale_order._has_to_be_paid(True) and not sale_order_exceptions"
role="button"
id="o_sale_portal_paynow"
data-toggle="modal"
data-target="#modalaccept"
href="#"
t-att-class="'btn-block mb8 %s' % ('btn btn-light' if sale_order.transaction_ids else 'btn btn-primary')">
<i class="fa fa-check"/>
<t t-if="not sale_order.signature">Accept &amp; Pay</t>
<t t-else="">Pay Now</t>
</a>
<t t-if="sale_order_exceptions">
<t t-foreach="sale_order_exceptions" t-as="exception">
<a href="#discussion" role="button" class="btn btn-danger btn-block mb8"
style="max-width: 180px;">
<i class="fa fa-warning"/>
<span t-esc="exception['description']"/>
</a>
</t>
</t>
</li>
</xpath>
<!-- BOTTOM ACTIONS -->
<xpath expr="//div[@t-if='sale_order._has_to_be_signed(True) or sale_order._has_to_be_paid(True)']" position="replace">
<div t-if="sale_order._has_to_be_signed(True) or sale_order._has_to_be_paid(True)"
class="row justify-content-center text-center d-print-none pt-1 pb-4">
<t t-set="sale_order_exceptions" t-value="sale_order._check_sale_order_exceptions()"/>
<t t-if="sale_order._has_to_be_signed(True)">
<div t-if="not sale_order_exceptions" class="col-sm-auto mt8">
<a role="button" class="btn btn-primary" data-toggle="modal"
data-target="#modalaccept" href="#">
<i class="fa fa-check"/>
<t t-if="sale_order.has_to_be_paid(True)"> Sign &amp; Pay</t>
<t t-else=""> Accept &amp; Sign</t>
</a>
</div>
<div class="col-sm-auto mt8">
<a role="button" class="btn btn-secondary" href="#discussion">
<i class="fa fa-comment"/> Feedback</a>
</div>
<div class="col-sm-auto mt8">
<a role="button" class="btn btn-danger" data-toggle="modal"
data-target="#modaldecline" href="#"> <i class="fa fa-times"/> Reject</a>
</div>
</t>
<div t-elif="sale_order._has_to_be_paid(True) and not sale_order_exceptions" class="col-sm-auto mt8">
<a role="button" data-toggle="modal" data-target="#modalaccept" href="#"
t-att-class="'%s' % ('btn btn-light' if sale_order.transaction_ids else 'btn btn-primary')">
<i class="fa fa-check"/> <t t-if="not sale_order.signature">Accept &amp; Pay</t>
<t t-else="">Pay Now</t>
</a>
</div>
</div>
</xpath>
</template>
</odoo>

View File

@@ -1,15 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="exception_rule_form_inherit" model="ir.ui.view">
<field name="name">exception.rule.form.inherit</field>
<field name="model">exception.rule</field>
<field name="inherit_id" ref="base_exception.view_exception_rule_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='description']" position="after">
<field name="website_description"/>
</xpath>
</field>
</record>
</odoo>

View File

@@ -1,22 +0,0 @@
{
'name': 'Sale Exception Website',
'summary': 'Display sale exceptions on eCommerce site',
'version': '16.0.1.0.0',
'author': "Hibou Corp.",
'category': 'Sale',
'license': 'AGPL-3',
'website': "https://hibou.io",
'description': """
Display sale exceptions on eCommerce site and prevent purchases
""",
'depends': [
'sale_exception_portal',
'website_sale',
],
'demo': [],
'data': [
'views/website_templates.xml',
],
'auto_install': False,
'installable': True,
}

View File

@@ -1,40 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<template id="payment_inherit" inherit_id="website_sale.payment" name="Payment Exceptions">
<!-- Show confirmation page if there are no sale order exceptions -->
<xpath expr="//div[@id='wrap']//div[hasclass('oe_cart')]" position="attributes">
<attribute name="t-if">not order._check_sale_order_exceptions()</attribute>
</xpath>
<!-- Display sale order exceptions if any are found -->
<xpath expr="//div[@id='wrap']//div[hasclass('oe_cart')]" position="after">
<t t-if="order._check_sale_order_exceptions()">
<t t-set="exceptions" t-value="order._check_sale_order_exceptions()" />
<div class="col-12 col-xl order-xl-1">
<div class="card bg-danger text-white">
<div class="card-body">
<t t-foreach="exceptions" t-as="exception">
<h4>
<i class="fa fa-warning mr-1" />
<strong><span t-esc="exception['title']"/></strong>
</h4>
<p><span t-esc="exception['description']"/></p>
</t>
</div>
</div>
<div class="row">
<div class="ml-auto mr-3 mt-2">
<a href="/shop/cart" class="float-right btn btn-primary">
<span>Back to Cart
<span class="fa fa-shopping-cart"/>
</span>
</a>
</div>
</div>
</div>
</t>
</xpath>
</template>
</odoo>