Skip to content
Extraits de code Groupes Projets

Comparer les révisions

Les modifications sont affichées comme si la révision source était fusionnée avec la révision cible. En savoir plus sur la comparaison des révisions.

Source

Sélectionner le projet cible
No results found
Sélectionner une révision Git

Cible

Sélectionner le projet cible
  • lefilament/cgscop/cgscop_timesheet
  • hsilvant/cgscop_timesheet
2 résultats
Sélectionner une révision Git
Afficher les modifications
Affichage de
avec 1576 ajouts et 116 suppressions
# © 2019 Le Filament (<http://www.le-filament.com>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import fields, models
class ResCompanyTmesheet(models.Model):
_inherit = "res.company"
day_duration = fields.Float(
string="Nb Heures/Jour",
default=8,
help="Nombre d'heures max pour imputation",
)
day_working = fields.Boolean(
string="Forfait Jour",
default=False,
help="Si cette option est cochée, un employé peut imputer sans limite"
" de temps sur une journée",
)
overtime_working = fields.Boolean(
string="Heures supplémentaires",
default=False,
help="Si cette option est cochée, un employé peut déclarer des heures supplémentaire"
)
weekend_working = fields.Boolean(
string="Travail le weekend",
default=False,
help="Si cette option est cochée, un employé peut imputer le weekend",
)
use_travel_time = fields.Boolean(
string="Saisie des temps de déplacement",
default=False,
help="Si cette option est cochée, un employé peut saisir ses temps de déplacement"
)
# © 2020 Le Filament (<http://www.le-filament.com>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import fields, models
class ScopPartnerTimesheet(models.Model):
_inherit = "res.partner"
ur_financial_system_id = fields.Many2one(
comodel_name="ur.financial.system",
string="Dispositif Financier",
ondelete="set null",
)
ur_financial_system_date = fields.Date("Date de fin de dispositif")
ur_regional_convention_id = fields.Many2one(
comodel_name="ur.regional.convention",
string="Convention Régionale",
ondelete="set null",
)
ur_regional_convention_date = fields.Date("Date de fin de convention")
ur_financial_system_nb = fields.Integer(
string="Nb Dispositifs Financiers", compute="_compute_ur_system_nb"
)
ur_regional_convention_nb = fields.Integer(
string="Nb conventions régionales", compute="_compute_ur_system_nb"
)
# ------------------------------------------------------
# Compute Functions
# ------------------------------------------------------
def _compute_ur_system_nb(self):
for partner in self:
# Calcul nombre de dispositifs financiers
financial_system = partner.env["ur.financial.system"].search(
[("ur_id", "=", self.env.user.ur_id.id)]
)
partner.ur_financial_system_nb = len(financial_system)
# Calcul nombre de conventions
regional_convention = partner.env["ur.regional.convention"].search(
[("ur_id", "=", self.env.user.ur_id.id)]
)
partner.ur_regional_convention_nb = len(regional_convention)
# © 2019 Le Filament (<http://www.le-filament.com>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import models, fields
from odoo import fields, models
class ScopTimesheetCode(models.Model):
......@@ -9,16 +9,18 @@ class ScopTimesheetCode(models.Model):
_description = "Dispositif financier UR"
def _default_ur(self):
return self.env['res.company']._ur_default_get()
return self.env["res.company"]._ur_default_get()
name = fields.Char('Nom')
name = fields.Char("Nom")
company_id = fields.Many2one(
comodel_name='res.company',
string='Société',
default=lambda self: self.env.user.company_id)
comodel_name="res.company",
string="Société",
default=lambda self: self.env.company,
)
ur_id = fields.Many2one(
'union.regionale',
string='Union Régionale',
"union.regionale",
string="Union Régionale",
index=True,
on_delete='restrict',
default=_default_ur)
ondelete="restrict",
default=_default_ur,
)
# © 2019 Le Filament (<http://www.le-filament.com>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from datetime import date
from dateutil.relativedelta import relativedelta
from odoo import api, fields, models
def get_years():
year_list = []
for i in range(2019, 2030):
year_list.append((str(i), str(i)))
return year_list
MONTHS = [
("1", "Janv"),
("2", "Fév"),
("3", "Mars"),
("4", "Avr"),
("5", "Mai"),
("6", "Juin"),
("7", "Juil"),
("8", "Août"),
("9", "Sept"),
("10", "Oct"),
("11", "Nov"),
("12", "Dec"),
]
class ScopMonthTimesheet(models.Model):
_name = "ur.month.timesheet"
_description = "Heures theoriques mensuelles"
_order = "date_timesheet"
def _default_ur(self):
return self.env["res.company"]._ur_default_get()
year = fields.Selection(
selection=get_years(), string="Année", default=fields.Date.today().year
)
month = fields.Selection(selection=MONTHS, string="Mois")
date_timesheet = fields.Date(
string="Mois format date",
compute="_compute_date_timesheet",
store=True,
)
company_id = fields.Many2one(
comodel_name="res.company",
string="Société",
default=lambda self: self.env.company,
)
ur_id = fields.Many2one(
"union.regionale",
string="Union Régionale",
index=True,
ondelete="restrict",
default=_default_ur,
)
working_time = fields.Integer("Heures théoriques")
_sql_constraints = [
(
"month_year_uniq",
"UNIQUE (year, month, ur_id)",
"Cette date a déjà été renseignée.",
)
]
@api.depends("year", "month")
def _compute_date_timesheet(self):
for month in self:
date_timesheet = date(int(month.year), int(month.month), 1)
month.date_timesheet = date_timesheet
@api.model
def get_month_values(self):
today = date.today()
first_date = today.replace(day=1) - relativedelta(months=6)
last_date = today.replace(day=1) + relativedelta(months=6)
values = self.search(
[
("date_timesheet", ">=", first_date),
("date_timesheet", "<=", last_date),
("ur_id", "=", self.env.company.ur_id.id),
]
)
return {
"month_values": values.mapped(
lambda m: {
"year": m.year,
"month": self._fields["month"].selection[int(m.month) - 1][1],
"working_time": m.working_time,
"date_timesheet": m.date_timesheet,
}
),
"today": today.replace(day=1),
}
# © 2019 Le Filament (<http://www.le-filament.com>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import fields, models
class ScopRegionalConvention(models.Model):
_name = "ur.regional.convention"
_description = "Convention Régionale UR"
def _default_ur(self):
return self.env["res.company"]._ur_default_get()
name = fields.Char("Nom")
company_id = fields.Many2one(
comodel_name="res.company",
string="Société",
default=lambda self: self.env.company,
)
ur_id = fields.Many2one(
"union.regionale",
string="Union Régionale",
index=True,
ondelete="restrict",
default=_default_ur,
)
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<data>
<template id="report_timesheet_document">
<t t-call="web.external_layout">
<div class="page">
<h2>
Feuille de Temps <t t-if="o.state == 'draft'"> - Brouillon</t>
</h2>
<h3>
<t t-esc="o.name" />
</h3>
<div id="informations" class="row mt32 mb32">
<div class="col-auto mw-100 mb-2" name="employee">
<strong>Employé</strong>
<p class="m-0" t-field="o.employee_id.name" />
</div>
<div class="col-auto mw-100 mb-2">
<strong>Soumis le</strong>
<p class="m-0" t-field="o.submit_date" />
</div>
<div class="col-auto mw-100 mb-2" name="date_end">
<strong>Validé le</strong>
<p class="m-0" t-field="o.validation_date" />
</div>
<div class="col-auto mw-100 mb-2" name="date_end">
<strong>Total</strong>
<p
class="m-0"
t-field="o.total_hour"
t-options="{'widget': 'duration', 'digital': True, 'unit': 'hour', 'round': 'minute'}"
/>
</div>
</div>
<table
class="table table-sm o_main_table"
name="invoice_line_table"
>
<thead>
<tr>
<th class="text-left"><span>Date</span></th>
<th class="text-left"><span>Code activité UR</span></th>
<th class="text-left"><span>Contact</span></th>
<th class="text-left"><span>Description</span></th>
<th class="text-left"><span
>Dispositif Financier</span></th>
<th class="text-left"><span>Durée</span></th>
</tr>
</thead>
<tbody class="invoice_tbody">
<t
t-foreach="o.timesheet_line_ids.sorted('date')"
t-as="line"
>
<tr>
<td><span t-field="line.date" /></td>
<td><span t-field="line.project_id" /></td>
<td><span t-field="line.partner_id" /></td>
<td><span t-field="line.name" /></td>
<td><span
t-field="line.ur_financial_system_id"
/></td>
<td class="text-right"><span
t-field="line.unit_amount"
t-options="{'widget': 'duration', 'digital': True, 'unit': 'hour', 'round': 'minute'}"
/></td>
</tr>
</t>
<tr>
<td />
<td />
<td />
<td />
<td class="text-right"><strong>Total</strong></td>
<td class="text-right"><strong
t-esc="o.total_hour"
t-options="{'widget': 'duration', 'digital': True, 'unit': 'hour', 'round': 'minute'}"
/></td>
</tr>
</tbody>
</table>
<div
t-if="o.state == 'draft'"
>Cette feuille de temps a été éditée en brouillon.</div>
<div t-else="">
<table style="float: right;">
<tr>
<td
style="width: 300px; border-bottom: 1px solid #495057; text-align: center;"
>
Visa salarié
</td>
<td
style="width: 300px; border-bottom: 1px solid #495057; text-align: center;"
>
Visa direction
</td>
</tr>
<tr>
<td><br /><br /><br /></td>
<td><br /><br /><br /></td>
</tr>
</table>
</div>
</div>
</t>
</template>
<template id="report_timesheet_sheet">
<t t-call="web.html_container">
<t t-foreach="docs" t-as="o">
<t t-call="cgscop_timesheet.report_timesheet_document" />
</t>
</t>
</template>
<!-- Paper format -->
<record id="cgscop_paperformat_a4_landscape" model="report.paperformat">
<field name="name">A4 Paysage</field>
<field name="default" eval="True" />
<field name="format">A4</field>
<field name="orientation">Landscape</field>
<field name="margin_top">35</field>
<field name="margin_bottom">20</field>
<field name="margin_left">10</field>
<field name="margin_right">10</field>
<field name="header_line" eval="False" />
<field name="header_spacing">30</field>
<field name="dpi">90</field>
</record>
<!-- QWeb Reports -->
<record id="cgscop_timesheet_sheet_report" model="ir.actions.report">
<field name="name">CG Scop - Feuille de Temps</field>
<field name="model">cgscop.timesheet.sheet</field>
<field name="report_type">qweb-pdf</field>
<field name="report_name">cgscop_timesheet.report_timesheet_sheet</field>
<field name="report_file">cgscop_timesheet.report_timesheet_sheet</field>
<field name="paperformat_id" ref="cgscop_paperformat_a4_landscape" />
</record>
</data>
</odoo>
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<data>
<template id="report_timesheet_document_act">
<t t-call="web.external_layout">
<div class="page">
<h2>
Feuille de Temps par activité <t
t-if="o.state == 'draft'"
> - Brouillon</t>
</h2>
<h3>
<t t-esc="o.name" />
</h3>
<div id="informations" class="row mt32 mb32">
<div class="col-auto mw-100 mb-2" name="employee">
<strong>Employé</strong>
<p class="m-0" t-field="o.employee_id.name" />
</div>
<div class="col-auto mw-100 mb-2">
<strong>Soumis le</strong>
<p class="m-0" t-field="o.submit_date" />
</div>
<div class="col-auto mw-100 mb-2" name="date_end">
<strong>Validé le</strong>
<p class="m-0" t-field="o.validation_date" />
</div>
<div class="col-auto mw-100 mb-2" name="date_end">
<strong>Total</strong>
<p
class="m-0"
t-field="o.total_hour"
t-options="{'widget': 'duration', 'digital': True, 'unit': 'hour', 'round': 'minute'}"
/>
</div>
</div>
<table
class="table table-sm o_main_table"
name="invoice_line_table"
>
<thead>
<tr>
<th class="text-left"><span>Code activité UR</span></th>
<th class="text-left"><span>Date</span></th>
<th class="text-left"><span>Contact</span></th>
<th class="text-left"><span>Description</span></th>
<th class="text-left"><span
>Dispositif Financier</span></th>
<th class="text-left"><span>Durée</span></th>
</tr>
</thead>
<tbody class="invoice_tbody">
<t t-foreach="o._get_timesheet_line_act()" t-as="line">
<tr>
<td><span><t t-esc="line['project']" /></span></td>
<td><span><t t-esc="line['date']" /></span></td>
<td><span><t t-esc="line['partner']" /></span></td>
<td><span><t t-esc="line['name']" /></span></td>
<td><span>
<t t-if="line['total']==1">
<strong>
<t t-esc="line['ur_financial_system']" />
</strong>
</t>
<t t-if="line['total']==0">
<t t-esc="line['ur_financial_system']" />
</t>
</span></td>
<td class="text-right"><span>
<t t-esc="line['unit_amount']" />
</span></td>
</tr>
</t>
<tr>
<td />
<td />
<td />
<td />
<td class="text-right"><strong>Total</strong></td>
<td class="text-right"><strong
t-esc="o.total_hour"
t-options="{'widget': 'duration', 'digital': True, 'unit': 'hour', 'round': 'minute'}"
/></td>
</tr>
</tbody>
</table>
<div
t-if="o.state == 'draft'"
>Cette feuille de temps a été éditée en brouillon.</div>
<div t-else="">
<table style="float: right;">
<tr>
<td
style="width: 300px; border-bottom: 1px solid #495057; text-align: center;"
>
Visa salarié
</td>
<td
style="width: 300px; border-bottom: 1px solid #495057; text-align: center;"
>
Visa direction
</td>
</tr>
<tr>
<td><br /><br /><br /></td>
<td><br /><br /><br /></td>
</tr>
</table>
</div>
</div>
</t>
</template>
<template id="report_timesheet_sheet_act">
<t t-call="web.html_container">
<t t-foreach="docs" t-as="o">
<t t-call="cgscop_timesheet.report_timesheet_document_act" />
</t>
</t>
</template>
<record id="cgscop_timesheet_sheet_report_act" model="ir.actions.report">
<field name="name">CG Scop - Feuille de Temps par activité</field>
<field name="model">cgscop.timesheet.sheet</field>
<field name="report_type">qweb-pdf</field>
<field
name="report_name"
>cgscop_timesheet.report_timesheet_sheet_act</field>
<field
name="report_file"
>cgscop_timesheet.report_timesheet_sheet_act</field>
<field name="paperformat_id" ref="cgscop_paperformat_a4_landscape" />
</record>
</data>
</odoo>
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_cgscop_timesheet_code,access_cgscop_timesheet_code,model_cgscop_timesheet_code,base.group_user,1,0,0,0
access_cgscop_timesheet_code_cg_manager,access_cgscop_timesheet_code_cg,model_cgscop_timesheet_code,cgscop_partner.group_cg_administrator,1,1,1,1
access_ur_financial_system,access_ur_financial_system,model_ur_financial_system,base.group_user,1,0,0,0
access_ur_financial_system_ur_manager,access_ur_financial_system_ur,model_ur_financial_system,cgscop_partner.group_ur_list_modif,1,1,1,1
access_ur_financial_system_cg_manager,access_ur_financial_system_cg,model_ur_financial_system,cgscop_partner.group_cg_administrator,1,1,1,1
......@@ -7,3 +8,11 @@ access_project_project_ur_manager,access_project_project_ur,model_project_projec
access_project_project_cg_manager,access_project_project_cg,model_project_project,cgscop_partner.group_cg_administrator,1,1,1,1
access_account_analytic_account_ur_manager,access_account_analytic_account_ur,analytic.model_account_analytic_account,cgscop_partner.group_ur_list_modif,1,1,1,1
access_account_analytic_account_cg_manager,access_account_analytic_account_cg,analytic.model_account_analytic_account,cgscop_partner.group_cg_administrator,1,1,1,1
access_cgscop_timesheet_sheet_user,access_cgscop_timesheet_sheet_user,model_cgscop_timesheet_sheet,hr_timesheet.group_hr_timesheet_user,1,1,1,1
access_ur_regional_convention,access_ur_regional_convention,model_ur_regional_convention,base.group_user,1,0,0,0
access_ur_regional_convention_ur_manager,access_ur_regional_convention_ur,model_ur_regional_convention,cgscop_partner.group_ur_list_modif,1,1,1,1
access_ur_regional_convention_cg_manager,access_ur_regional_convention_cg,model_ur_regional_convention,cgscop_partner.group_cg_administrator,1,1,1,1
access_ur_month_timesheet,access_ur_month_timesheet,model_ur_month_timesheet,base.group_user,1,0,0,0
access_ur_month_timesheet_ur_manager,access_ur_month_timesheet_ur,model_ur_month_timesheet,cgscop_partner.group_ur_list_modif,1,1,1,1
access_ur_month_timesheet_cg_manager,access_ur_month_timesheet_cg,model_ur_month_timesheet,cgscop_partner.group_cg_administrator,1,1,1,1
access_cgscop_timesheet_print_wizard,access_cgscop_timesheet_print_wizard,model_cgscop_timesheet_print_wizard,base.group_user,1,1,1,1
<?xml version="1.0" ?>
<!-- Copyright 2019 Le Filament
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<odoo>
<data noupdate="1">
<data>
<!-- UR Financial System -->
<record id="ur_financial_system_rule_ur" model="ir.rule">
<field name="name">ur financial system rule per ur</field>
<field name="model_id" ref="model_ur_financial_system" />
<field name="domain_force">[('ur_id','=',user.company_id.ur_id.id)]</field>
<field name="domain_force">[('company_id','in',company_ids)]</field>
<field name="groups" eval="[(6, 0, [ref('base.group_user')])]" />
<field eval="True" name="global" />
</record>
<!-- UR Regional Convention -->
<record id="ur_regional_convention_rule_ur" model="ir.rule">
<field name="name">ur regional convention rule per ur</field>
<field name="model_id" ref="model_ur_regional_convention" />
<field name="domain_force">[('company_id','in',company_ids)]</field>
<field name="groups" eval="[(6, 0, [ref('base.group_user')])]" />
<field eval="True" name="global" />
</record>
<!-- UR Month Timesheet -->
<record id="ur_month_timesheet_rule_ur" model="ir.rule">
<field name="name">ur month timesheet rule per ur</field>
<field name="model_id" ref="model_ur_month_timesheet" />
<field name="domain_force">[('company_id','in',company_ids)]</field>
<field name="groups" eval="[(6, 0, [ref('base.group_user')])]" />
<field eval="True" name="global" />
</record>
<!-- Project -->
<record id="project_rule_ur" model="ir.rule">
<field name="name">project rule per ur</field>
<field name="model_id" ref="project.model_project_project" />
<field name="domain_force">[('ur_id','=',user.company_id.ur_id.id)]</field>
<field name="domain_force">[('company_id','in',company_ids)]</field>
<field name="groups" eval="[(6, 0, [ref('base.group_user')])]" />
<field eval="True" name="global" />
</record>
<record id="project_rule_administrator_ur" model="ir.rule">
<field name="name">project rule for administrator</field>
<field name="model_id" ref="project.model_project_project" />
<field name="domain_force">[(1,'=',1)]</field>
<field name="groups" eval="[(6, 0, [ref('cgscop_partner.group_cg_administrator')])]"/>
<field
name="groups"
eval="[(6, 0, [ref('cgscop_partner.group_cg_administrator')])]"
/>
<field eval="True" name="global" />
</record>
<!-- Analytic Line -->
<record id="analytic_line_ur_rule" model="ir.rule">
<field name="name">Analytic line UR rule</field>
<field name="model_id" ref="analytic.model_account_analytic_line" />
<field name="groups" eval="[(6, 0, [ref('base.group_user')])]" />
<field eval="True" name="global" />
<field name="domain_force">[('ur_id','=',user.current_ur_id.id)]</field>
</record>
<record id="analytic.analytic_line_comp_rule" model="ir.rule">
<field name="name">Analytic line multi company rule</field>
<field name="model_id" ref="model_account_analytic_line" />
<field eval="True" name="global" />
<field name="active" eval="False" />
</record>
<record id="account.account_analytic_line_rule_billing_user" model="ir.rule">
<field name="name">analytic.analytic.line.billing.user</field>
<field name="model_id" ref="model_account_analytic_line" />
<field name="perm_read" eval="False" />
<field name="perm_write" eval="True" />
<field name="perm_create" eval="True" />
<field name="perm_unlink" eval="True" />
<field name="active" eval="False" />
</record>
<!-- CGScop Timesheet Sheet -->
<record id="timesheet_sheet_rule_ur" model="ir.rule">
<field name="name">Feuilles de temps de mon UR</field>
<field
name="model_id"
ref="cgscop_timesheet.model_cgscop_timesheet_sheet"
/>
<field name="domain_force">[('ur_id','=',user.current_ur_id.id)]</field>
<field name="groups" eval="[(6, 0, [ref('base.group_user')])]" />
<field eval="True" name="global" />
</record>
</data>
......
static/description/icon.png

8,95 ko | W: 0px | H: 0px

static/description/icon.png

15,5 ko | W: 0px | H: 0px

static/description/icon.png
static/description/icon.png
static/description/icon.png
static/description/icon.png
  • 2-up
  • Swipe
  • Onion skin
// © 2019 Le Filament (<http://www.le-filament.com>)
// License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
odoo.define("cgscop_timesheet.ur_month_timesheet", function (require) {
"use strict";
var core = require("web.core");
var AbstractAction = require("web.AbstractAction");
var ScopMonthTimesheet = AbstractAction.extend({
template: "ScopMonthTimesheet",
willStart: function () {
var superDef = this._super.apply(this, arguments);
var self = this;
this.values = {};
var def = this._rpc({
model: "ur.month.timesheet",
method: "get_month_values",
args: [],
}).then(function (results) {
self.values = results;
});
return Promise.all([superDef, def]);
},
// Start: function () {},
});
core.action_registry.add("cgscop_timesheet.ur_month_timesheet", ScopMonthTimesheet);
});
<?xml version="1.0" encoding="UTF-8" ?>
<!-- Copyright 2019 Le Filament (<https://www.le-filament.com>)
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<templates xml:space="preserve">
<t t-name="ScopMonthTimesheet">
<t t-if="widget.values.month_values">
<table class="table">
<thead>
<tr>
<th t-foreach="widget.values.month_values" t-as="m">
<div
t-att-class="m.date_timesheet == widget.values.today ? 'text-success' : ''"
>
<t t-esc="m.month" /> <t t-esc="m.year" />
</div>
</th>
</tr>
</thead>
<tbody>
<tr>
<td t-foreach="widget.values.month_values" t-as="m">
<div
t-att-class="m.date_timesheet == widget.values.today ? 'text-right text-success' : 'text-right'"
>
<t t-esc="m.working_time" /> h
</div>
</td>
</tr>
</tbody>
</table>
</t>
<t t-else="">
<p>Aucun temps de travail théorique n'a été configuré.</p>
</t>
</t>
</templates>
<?xml version="1.0" ?>
<!-- Copyright 2019 Le Filament
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<odoo>
<template id="cgscop_assets_backend" name="account assets" inherit_id="web.assets_backend">
<template
id="cgscop_assets_backend"
name="account assets"
inherit_id="web.assets_backend"
>
<xpath expr="." position="inside">
<link rel="stylesheet" type="text/css" href="/cgscop_timesheet/static/src/css/style.css"/>
<link
rel="stylesheet"
type="text/css"
href="/cgscop_timesheet/static/src/css/style.css"
/>
<script
type="text/javascript"
src="/cgscop_timesheet/static/src/js/ur_month_timesheet.js"
/>
</xpath>
</template>
......
<?xml version="1.0" ?>
<!-- Copyright 2019 Le Filament
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<odoo>
<data>
<record id="view_cgscop_timesheet_code_tree" model="ir.ui.view">
......@@ -9,7 +8,8 @@
<field name="model">cgscop.timesheet.code</field>
<field name="arch" type="xml">
<tree editable='top'>
<field name="name" />
<field name="name" required="1" />
<field name="domain" />
</tree>
</field>
</record>
......@@ -21,12 +21,14 @@
<field name="help">Affiche et gère les Codes activité Nationaux</field>
</record>
<menuitem id="menu_cgscop_timesheet_code"
<menuitem
id="menu_cgscop_timesheet_code"
name="Codes Activité National"
parent="hr_timesheet.hr_timesheet_menu_configuration"
action="action_cgscop_timesheet_code_tree"
sequence="40"
groups="cgscop_partner.group_cg_administrator"/>
groups="cgscop_partner.group_cg_administrator"
/>
</data>
</odoo>
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<data>
<!--
Vues
-->
<!-- Tree view -->
<record id="view_cgscop_timesheet_sheet_tree" model="ir.ui.view">
<field name="name">cgscop.timesheet.sheet.tree</field>
<field name="model">cgscop.timesheet.sheet</field>
<field name="arch" type="xml">
<tree string="Timesheet Reports" decoration-warning="state=='draft'">
<field name="name" />
<field name="employee_id" />
<field name="create_date" />
<field name="validation_date" />
<field name="total_hour" sum="Total" />
<field name="state" />
</tree>
</field>
</record>
<!-- Form view -->
<record id="view_cgscop_timesheet_sheet_form" model="ir.ui.view">
<field name="name">cgscop.timesheet.sheet.form</field>
<field name="model">cgscop.timesheet.sheet</field>
<field name="priority" eval="25" />
<field name="arch" type="xml">
<form>
<field name="company_id" invisible="1" />
<header>
<button
name="action_submit_timesheet"
states="draft"
string="Soumettre"
type="object"
class="oe_highlight"
/>
<button
name="approve_timesheet_sheets"
states="submit"
string="Valider"
type="object"
groups="hr_timesheet.group_timesheet_manager"
class="oe_highlight"
/>
<button
string="Imprimer"
type="action"
name="%(cgscop_timesheet_print_act)d"
class="oe_read_only"
/>
<button
name="reset_timesheet_sheets"
string="Remettre en brouillon"
type="object"
attrs="{'invisible': [('state', '=', 'draft')]}"
groups="hr_timesheet.group_timesheet_manager"
/>
<field
name="state"
widget="statusbar"
statusbar_visible="draft,submit,valid"
/>
</header>
<sheet>
<div class="oe_title">
<label for="name" class="oe_edit_only" />
<h1>
<field
name="name"
attrs="{'readonly': [('can_edit','=', False), ('state','!=', 'draft')]}"
/>
</h1>
</div>
<group>
<group>
<field
name="employee_id"
groups="hr_timesheet.group_timesheet_manager"
options="{'no_open': True, 'no_create': True}"
/>
<field
name="company_id"
groups="base.group_multi_company"
options="{'no_open': True, 'no_create': True}"
/>
</group>
<group>
<field name="create_date" readonly="1" />
<field name="submit_date" readonly="1" />
<field name="validation_date" readonly="1" />
<field name="total_hour" widget="float_time" />
</group>
</group>
<field name="can_edit" invisible="1" />
<field
name="timesheet_line_ids"
widget="many2many"
domain="[('sheet_id', '=', False), ('employee_id', '=', employee_id)]"
options="{'reload_on_button': True}"
attrs="{'readonly': [('can_edit','=', False), ('state','!=', 'draft')]}"
context="{'form_view_ref' : 'hr_timesheet.timesheet_view_form_user'}"
>
<tree editable="top">
<field name="company_id" invisible="1" />
<field name="ur_id" invisible="1" />
<field name="date" />
<field name="employee_id" readonly="1" />
<field name="state" invisible="1" />
<field name="sheet_id" invisible="1" />
<field
name="project_id"
options="{'no_open': True, 'no_create': True}"
/>
<field
name="partner_id"
options="{'no_open': True, 'no_create': True}"
/>
<field name="name" />
<field name="unit_amount" widget="float_time" />
<field
name="ur_financial_system_id"
options="{'no_open': True, 'no_create': True}"
/>
<field
name="justificatifs"
attrs="{'invisible': [('ur_id', '!=', %(cgscop_partner.riga_14243)d)]}"
/>
</tree>
</field>
</sheet>
<div class="oe_chatter">
<field
name="message_follower_ids"
options="{'post_refresh':True}"
groups="base.group_user"
/>
<field name="activity_ids" />
<field name="message_ids" />
</div>
</form>
</field>
</record>
<!-- Search view -->
<record id="view_cgscop_timesheet_sheet_filter" model="ir.ui.view">
<field name="name">cgscop.timesheet.sheet.filter</field>
<field name="model">cgscop.timesheet.sheet</field>
<field name="arch" type="xml">
<search string="Feuille de temps">
<field name="name" />
<field name="state" />
<separator />
<field name="employee_id" />
<filter
string="Mes feuilles de temps"
name="my_reports"
domain="[('employee_id.user_id', '=', uid)]"
/>
<filter
string="Mon équipe"
name="my_team_reports"
domain="[('employee_id.parent_id.user_id', '=', uid)]"
groups="hr_timesheet.group_timesheet_manager"
help="Expenses of Your Team Member"
/>
<separator />
<filter
domain="[('state', '=', 'draft')]"
string="Brouillon"
name="draft"
/>
<filter
domain="[('state', '=', 'submit')]"
string="Soumis"
name="submitted"
/>
<filter
domain="[('state', '=', 'valid')]"
string="Validé"
name="valid"
/>
<group expand="0" string="Group By">
<filter
string="Employé"
name="employee"
domain="[]"
context="{'group_by': 'employee_id'}"
/>
<filter
string="Statut"
domain="[]"
context="{'group_by': 'state'}"
name="state"
/>
</group>
</search>
</field>
</record>
<!--
Actions
-->
<record id="action_cgscop_timesheet_sheet_my_all" model="ir.actions.act_window">
<field name="name">Mes feuilles de temps</field>
<field name="res_model">cgscop.timesheet.sheet</field>
<field name="view_mode">tree,form</field>
<field name="search_view_id" ref="view_cgscop_timesheet_sheet_filter" />
<field name="domain">[('employee_id.user_id', '=', uid)]</field>
<field name="context">{'search_default_my_reports': 1}</field>
</record>
<record
id="action_cgscop_timesheet_sheet_to_approve"
model="ir.actions.act_window"
>
<field name="name">Feuilles de temps à valider</field>
<field name="res_model">cgscop.timesheet.sheet</field>
<field name="view_mode">tree,form</field>
<field name="search_view_id" ref="view_cgscop_timesheet_sheet_filter" />
<field name="domain">[]</field>
<field name="context">{'search_default_submitted': 1}</field>
</record>
<record id="action_cgscop_timesheet_sheet_all" model="ir.actions.act_window">
<field name="name">Toutes les feuilles de temps</field>
<field name="res_model">cgscop.timesheet.sheet</field>
<field name="view_mode">tree,form</field>
<field name="search_view_id" ref="view_cgscop_timesheet_sheet_filter" />
<field name="domain">[('company_id', '=', allowed_company_ids[0])]</field>
<field name="context">{}</field>
</record>
<!--
Menus
-->
<menuitem
id="timesheet_sheet_menu"
parent="hr_timesheet.timesheet_menu_root"
name="Feuilles de temps"
sequence="25"
/>
<menuitem
id="menu_hr_timesheet_my_timesheet"
name="Mes feuilles de temps"
sequence="1"
action="cgscop_timesheet.action_cgscop_timesheet_sheet_my_all"
parent="cgscop_timesheet.timesheet_sheet_menu"
/>
<menuitem
id="menu_hr_timesheet_to_approve"
name="À valider"
sequence="1"
action="cgscop_timesheet.action_cgscop_timesheet_sheet_to_approve"
parent="cgscop_timesheet.timesheet_sheet_menu"
groups="hr_timesheet.group_timesheet_manager"
/>
<menuitem
id="menu_hr_timesheet_all"
name="Toutes les feuilles de temps"
sequence="1"
action="cgscop_timesheet.action_cgscop_timesheet_sheet_all"
parent="cgscop_timesheet.timesheet_sheet_menu"
groups="hr_timesheet.group_timesheet_manager"
/>
</data>
</odoo>
Ce diff est replié.
<?xml version="1.0" ?>
<!-- Copyright 2019 Le Filament
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<odoo>
<data>
......@@ -12,14 +11,27 @@
<field name="arch" type="xml">
<form string="Project">
<sheet string="Project">
<div class="oe_button_box" name="button_box" groups="base.group_user">
<button class="oe_stat_button" name="%(hr_timesheet.act_hr_timesheet_line_by_project)d" type="action" icon="fa-calendar" string="Timesheets" attrs="{'invisible': [('allow_timesheets', '=', False)]}" groups="hr_timesheet.group_hr_timesheet_user"/>
<button name="toggle_active" type="object"
confirm="(Un)archiving a project automatically (un)archives its tasks. Do you want to proceed?"
class="oe_stat_button" icon="fa-archive">
<field name="active" widget="boolean_button"
options='{"terminology": "archive"}'/>
</button>
<field name="active" invisible="1" />
<widget
name="web_ribbon"
title="Archivé"
bg_color="bg-danger"
attrs="{'invisible': [('active', '=', True)]}"
/>
<div
class="oe_button_box"
name="button_box"
groups="base.group_user"
>
<button
class="oe_stat_button"
name="%(hr_timesheet.act_hr_timesheet_line_by_project)d"
type="action"
icon="fa-calendar"
string="Timesheets"
attrs="{'invisible': [('allow_timesheets', '=', False)]}"
groups="hr_timesheet.group_hr_timesheet_user"
/>
</div>
<div class="oe_title">
<h1>
......@@ -28,33 +40,73 @@
</div>
<group>
<group>
<field name="partner_id" string="Contact par défaut" help="Contact par défaut auquel est rattaché cette activité. Ce contact sera sélectionné automatiquement dans les feuilles de temps" options="{'no_open': True, 'no_create': True}"/>
<field name="ur_id" string="Union Régionale" options="{'no_open': True, 'no_create': True}" required="1" />
<field name="company_id" groups="base.group_multi_company" options="{'no_open': True, 'no_create': True}" string="Société" invisible="1" />
<field
name="partner_id"
string="Contact par défaut"
domain="[('is_company', '=', True), ('ur_id', '=', ur_id)]"
help="Contact par défaut auquel est rattaché cette activité. Ce contact sera sélectionné automatiquement dans les feuilles de temps"
options="{'no_open': True, 'no_create': True}"
/>
<field
name="ur_id"
string="Union Régionale"
options="{'no_open': True, 'no_create': True}"
required="1"
/>
<field
name="company_id"
groups="base.group_multi_company"
options="{'no_open': True, 'no_create': True}"
string="Société"
invisible="1"
/>
</group>
<group>
<field name="cgscop_timesheet_code_id" required="1" placeholder="Code activité National" options="{'no_open': True, 'no_create': True}"/>
<field
name="cgscop_timesheet_code_id"
required="1"
placeholder="Code activité National"
options="{'no_open': True, 'no_create': True}"
/>
<field name="creation_invoiced" widget="boolean_toggle" />
<field name="analytic_account_id" invisible="1" />
<field name="privacy_visibility" invisible="1" />
<field name="allow_timesheets" invisible="1" />
</group>
</group>
<group string="Configuration" name="project_config" groups="base.group_no_one">
<group
string="Configuration"
name="project_config"
groups="base.group_no_one"
>
<group>
<field name="user_id" string="Project Manager"
attrs="{'readonly':[('active','=',False)]}" options="{'no_open': True, 'no_create': True}"/>
<field
name="user_id"
string="Project Manager"
attrs="{'readonly':[('active','=',False)]}"
options="{'no_open': True, 'no_create': True}"
/>
<field name="sequence" groups="base.group_no_one" />
</group>
<group>
<field name="allow_timesheets" />
<field name="privacy_visibility" widget="radio" />
<field name="resource_calendar_id" groups="base.group_no_one"/>
<field
name="resource_calendar_id"
groups="base.group_no_one"
/>
</group>
</group>
</sheet>
<div class="oe_chatter">
<field name="message_follower_ids" widget="mail_followers" help="Follow this project to automatically track the events associated to tasks and issues of this project." groups="base.group_user"/>
<field
name="message_follower_ids"
options="{'post_refresh':True}"
groups="base.group_user"
/>
<field name="message_ids" />
</div>
</form>
</field>
......@@ -67,13 +119,24 @@
<field name="arch" type="xml">
<search string="Search Project">
<field name="name" string="Code activité UR" />
<field name="cgscop_timesheet_code_id" string="Code activité National"/>
<field
name="cgscop_timesheet_code_id"
string="Code activité National"
/>
<field name="partner_id" string="Contact par défaut" />
<filter string="Archived" name="inactive" domain="[('active','=',False)]"/>
<filter
string="Archived"
name="inactive"
domain="[('active','=',False)]"
/>
<group expand="0" string="Group By">
<filter string="Contact par défaut" name="Partner" context="{'group_by': 'partner_id'}"/>
<filter
string="Contact par défaut"
name="Partner"
context="{'group_by': 'partner_id'}"
/>
</group>
</search>
</field>
......@@ -88,8 +151,15 @@
<field name="sequence" widget="handle" />
<field name="active" invisible="1" />
<field name="name" />
<field name="cgscop_timesheet_code_id" options="{'no_open': True, 'no_create': True}"/>
<field name="partner_id" string="Contact" options="{'no_open': True, 'no_create': True}"/>
<field
name="cgscop_timesheet_code_id"
options="{'no_open': True, 'no_create': True}"
/>
<field
name="partner_id"
string="Contact"
options="{'no_open': True, 'no_create': True}"
/>
</tree>
</field>
</record>
......@@ -103,11 +173,19 @@
<field name="user_id" string="Project Manager" />
<templates>
<t t-name="kanban-box">
<div t-attf-class="oe_kanban_content oe_kanban_global_click o_kanban_get_form">
<div
t-attf-class="oe_kanban_content oe_kanban_global_click o_kanban_get_form"
>
<div class="row">
<div class="col-12">
<strong><field name="name" string="Code activité UR"/></strong>
<field name="cgscop_timesheet_code_id" string="Code activité CG"/>
<strong><field
name="name"
string="Code activité UR"
/></strong>
<field
name="cgscop_timesheet_code_id"
string="Code activité CG"
/>
</div>
</div>
<div class="row">
......@@ -116,7 +194,14 @@
</div>
<div class="col-4">
<div class="oe_kanban_bottom_right">
<img t-att-src="kanban_image('res.users', 'image_small', record.user_id.raw_value)" t-att-title="record.user_id.value" t-att-alt="record.user_id.value" width="24" height="24" class="oe_kanban_avatar float-right"/>
<img
t-att-src="kanban_image('res.users', 'image_small', record.user_id.raw_value)"
t-att-title="record.user_id.value"
t-att-alt="record.user_id.value"
width="24"
height="24"
class="oe_kanban_avatar float-right"
/>
</div>
</div>
</div>
......@@ -130,13 +215,15 @@
<record id="act_cgscop_project_timesheet" model="ir.actions.act_window">
<field name="name">Codes activités UR</field>
<field name="res_model">project.project</field>
<field name="view_type">form</field>
<field name="domain">[]</field>
<field name="view_mode">tree,kanban,form</field>
<field name="view_ids" eval="[(5, 0, 0),
<field
name="view_ids"
eval="[(5, 0, 0),
(0, 0, {'view_mode': 'tree', 'view_id': ref('view_cgscop_project_timesheet_tree')}),
(0, 0, {'view_mode': 'kanban', 'view_id': ref('view_cgscop_project_timesheet_kanban')}),
(0, 0, {'view_mode': 'form', 'view_id': ref('view_cgscop_project_timesheet_form')})]"/>
(0, 0, {'view_mode': 'form', 'view_id': ref('view_cgscop_project_timesheet_form')})]"
/>
<field name="search_view_id" ref="view_cgscop_project_timesheet_filter" />
<field name="context">{
'default_privacy_visibility': 'employees',
......@@ -150,7 +237,8 @@
action="act_cgscop_project_timesheet"
id="menu_action_project_lines_tree"
sequence="35"
groups="cgscop_partner.group_ur_list_modif,cgscop_partner.group_cg_administrator"/>
groups="cgscop_partner.group_ur_list_modif,cgscop_partner.group_cg_administrator"
/>
</data>
</odoo>
<?xml version="1.0" ?>
<!-- Copyright 2019 Le Filament
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<odoo>
<data>
<record id="company_form_with_ur" model="ir.ui.view">
<field name="name">scop.res.company.timesheet.form</field>
<field name="model">res.company</field>
<field name="inherit_id" ref="base.view_company_form" />
<field name="arch" type="xml">
<xpath expr="//notebook/page" position="after">
<page name="company_timesheet" string="Feuilles de temps">
<group>
<group string="Condiguration Imputations">
<field name="day_working" widget="boolean_toggle" />
<field
name="day_duration"
attrs="{'invisible': [('day_working', '=', True)]}"
/>
<field name="overtime_working" widget="boolean_toggle" />
<field name="weekend_working" widget="boolean_toggle" />
<field name="use_travel_time" widget="boolean_toggle" />
</group>
</group>
</page>
</xpath>
</field>
</record>
</data>
</odoo>
<?xml version="1.0" ?>
<!-- Copyright 2019 Le Filament
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<odoo>
<data>
<!-- Tree View Timesheet CG -->
<record id="view_cgscop_hr_timesheet_account_inherit" model="ir.ui.view">
<field name="name">res.partner.cgscop.timesheet.account.inherit</field>
<record id="view_partner_cooperative_timesheet_form" model="ir.ui.view">
<field name="name">cooperative.timesheet.form</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="account.view_partner_property_form"/>
<field name="inherit_id" ref="cgscop_partner.scop_contact_view_form" />
<field name="priority" eval="1" />
<field name="arch" type="xml">
<page name="accounting" position="attributes">
<attribute name="invisible">True</attribute>
</page>
<xpath
expr="//field[@name='activity_federation_indus_ids']"
position="after"
>
<separator />
<field name="ur_regional_convention_nb" invisible="1" />
<field name="ur_financial_system_nb" invisible="1" />
<field
name="ur_financial_system_id"
options="{'no_open': True, 'no_create': True}"
attrs="{'invisible':[('ur_financial_system_nb', '=', 0)]}"
/>
<field
name="ur_financial_system_date"
attrs="{'invisible':[('ur_financial_system_id','=',False)]}"
/>
<field
name="ur_regional_convention_id"
options="{'no_open': True, 'no_create': True}"
attrs="{'invisible':[('ur_regional_convention_nb', '=', 0)]}"
/>
<field
name="ur_regional_convention_date"
attrs="{'invisible':[('ur_regional_convention_id','=',False)]}"
/>
<separator />
</xpath>
</field>
</record>
......