Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision

Target

Select target project
  • lefilament/cgscop/cgscop_timesheet
  • hsilvant/cgscop_timesheet
2 results
Select Git revision
Show changes
<?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_ur_financial_system_tree" model="ir.ui.view">
......@@ -10,8 +9,15 @@
<field name="arch" type="xml">
<tree editable='top'>
<field name="name" />
<field name="ur_id" options="{'no_open': True, 'no_create': True}"/>
<field name="company_id" groups="base.group_no_one" options="{'no_open': True, 'no_create': True}"/>
<field
name="ur_id"
options="{'no_open': True, 'no_create': True}"
/>
<field
name="company_id"
groups="base.group_no_one"
options="{'no_open': True, 'no_create': True}"
/>
</tree>
</field>
</record>
......@@ -22,12 +28,14 @@
<field name="view_mode">tree</field>
</record>
<menuitem id="menu_ur_financial_system"
<menuitem
id="menu_ur_financial_system"
name="Dispositifs financiers"
parent="hr_timesheet.hr_timesheet_menu_configuration"
action="action_ur_financial_system"
sequence="45"
groups="cgscop_partner.group_ur_list_modif"/>
groups="cgscop_partner.group_ur_list_modif"
/>
</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="view_ur_month_timesheet_tree" model="ir.ui.view">
<field name="name">ur.month.timesheet.tree</field>
<field name="model">ur.month.timesheet</field>
<field name="arch" type="xml">
<tree editable='top'>
<field name="year" required="1" />
<field name="month" required="1" />
<field name="working_time" required="1" />
<field
name="ur_id"
options="{'no_open': True, 'no_create': True}"
readonly="1"
/>
<field
name="company_id"
groups="base.group_no_one"
options="{'no_open': True, 'no_create': True}"
/>
</tree>
</field>
</record>
<record id="action_ur_month_timesheet" model="ir.actions.act_window">
<field name="name">Temps de travail mensuel</field>
<field name="res_model">ur.month.timesheet</field>
<field name="view_mode">tree</field>
</record>
<record id="action_ur_month_timesheet_show" model="ir.actions.client">
<field name="name">Temps de travail théorique</field>
<field name="tag">cgscop_timesheet.ur_month_timesheet</field>
<field name="target">new</field>
<field name="binding_model_id" ref="model_ur_month_timesheet" />
<field name="binding_type">action</field>
</record>
<menuitem
id="menu_ur_month_timesheet"
name="Temps de travail mensuel"
parent="hr_timesheet.hr_timesheet_menu_configuration"
action="action_ur_month_timesheet"
sequence="50"
groups="cgscop_partner.group_ur_list_modif"
/>
<menuitem
id="menu_ur_month_timesheet_show"
parent="hr_timesheet.menu_hr_time_tracking"
action="action_ur_month_timesheet_show"
sequence="50"
/>
</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="view_ur_regional_convention_tree" model="ir.ui.view">
<field name="name">ur.regional.convention.tree</field>
<field name="model">ur.regional.convention</field>
<field name="arch" type="xml">
<tree editable='top'>
<field name="name" />
<field
name="ur_id"
options="{'no_open': True, 'no_create': True}"
/>
<field
name="company_id"
groups="base.group_no_one"
options="{'no_open': True, 'no_create': True}"
/>
</tree>
</field>
</record>
<record id="action_ur_regional_convention" model="ir.actions.act_window">
<field name="name">Conventions Régionales</field>
<field name="res_model">ur.regional.convention</field>
<field name="view_mode">tree</field>
</record>
<menuitem
id="menu_ur_regional_convention"
name="Conventions Régionales"
parent="hr_timesheet.hr_timesheet_menu_configuration"
action="action_ur_regional_convention"
sequence="50"
groups="cgscop_partner.group_ur_list_modif"
/>
</data>
</odoo>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
# © 2020 Le Filament (<https://www.le-filament.com>)
# © 2020 Confédération Générale des Scop (<https://www.les-scop.coop>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import print_timesheet
from . import cgscop_timesheet_print_wizard
# © 2020 Le Filament (<https://www.le-filament.com>)
# © 2020 Confédération Générale des Scop (<https://www.les-scop.coop>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import api, fields, models
class CgscopTimesheetPrintWizard(models.TransientModel):
_name = "cgscop_timesheet.print.wizard"
_description = "Wizard de sélection de l'impression"
@api.model
def _default_timesheet_id(self):
return self.env.context.get("active_id")
timesheet_id = fields.Many2one(
comodel_name="cgscop.timesheet.sheet",
string="Fdt",
default=_default_timesheet_id,
)
print_type = fields.Selection(
string="Type de sortie",
selection=[("0", "Tri par date"), ("1", "Tri par code activité")],
required=True,
default="0",
)
# ------------------------------------------------------
# Validation du wizard
# ------------------------------------------------------
def valid_wizard(self):
report_name = "cgscop_timesheet.cgscop_timesheet_sheet_report"
if self.print_type == "0":
report_name = "cgscop_timesheet.cgscop_timesheet_sheet_report"
elif self.print_type == "1":
report_name = "cgscop_timesheet.cgscop_timesheet_sheet_report_act"
return self.env.ref(report_name).report_action(self.timesheet_id)
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<!-- WIZARD FORM -->
<record model="ir.ui.view" id="cgscop_timesheet_print_wizard">
<field name="name">cgscop_timesheet_print_wizard</field>
<field name="model">cgscop_timesheet.print.wizard</field>
<field name="arch" type="xml">
<form string="Sélection du format de sortie">
<group>
<field name="print_type" widget="radio" />
</group>
<footer>
<button
class="btn btn-sm btn-primary"
name="valid_wizard"
string="Impression"
type="object"
/>
<button
class="btn btn-sm btn-default"
special="cancel"
string="Retour"
/>
</footer>
</form>
</field>
</record>
<record model="ir.actions.act_window" id="cgscop_timesheet_print_act">
<field name="name">Sélection du format de sortie</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">cgscop_timesheet.print.wizard</field>
<field name="view_mode">form</field>
<field name="view_id" ref="cgscop_timesheet_print_wizard" />
<field name="target">new</field>
</record>
</odoo>
# Copyright 2019 Le Filament (<http://www.le-filament.com>)
# License AGPL-3 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import models, fields, api
class CGscopTimesheetPrintWizard(models.TransientModel):
_name = "cgscop.timesheet.print"
_description = "Wizard Timesheet Impression"
date_start = fields.Date('Date de début', required=True)
date_end = fields.Date('Date de fin', required=True)
user_id = fields.Many2one(
comodel_name="res.users",
string="Employé",
default=lambda self: self.env.user,
required=True)
timesheet_ids = fields.Many2many(
comodel_name="account.analytic.line")
@api.multi
def print_timesheet(self):
self.timesheet_ids = self.env['account.analytic.line'].sudo().search([
['user_id', '=', self.user_id.id],
['date', '>=', self.date_start],
['date', '<=', self.date_end]])
print(self)
print(self.timesheet_ids)
return self.env.ref(
'cgscop_timesheet.cgscop_timesheet_report').report_action(self)
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<record id="cgscop_timesheet_print_view_form" model="ir.ui.view">
<field name="name">cgscop.timesheet.print.form</field>
<field name="model">cgscop.timesheet.print</field>
<field name="arch" type="xml">
<form string="Impression feuille de temps">
<group>
<group>
<field name="date_start"/>
</group>
<group>
<field name="date_end"/>
</group>
</group>
<group>
<group>
<field name="user_id" />
</group>
</group>
<footer>
<button class="btn btn-sm btn-primary" name="print_timesheet" string="Imprimer" type="object"/>
<button class="btn btn-sm btn-default" special="cancel" string="Fermer"/>
</footer>
</form>
</field>
</record>
<record id="cgscop_timesheet_print_action" model="ir.actions.act_window">
<field name="name">Imprimer Feuille de Temps</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">cgscop.timesheet.print</field>
<field name="view_mode">form</field>
<field name="view_id" ref="cgscop_timesheet_print_view_form"/>
<field name="target">new</field>
</record>
<menuitem action="cgscop_timesheet_print_action" id="menu_cgscop_timesheet_print" name="Imprimer Feuille de Temps" parent="hr_timesheet.menu_hr_time_tracking" sequence="50" />
</odoo>
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<template id="report_timesheet_document">
<t t-call="web.external_layout">
<t t-set="o" t-value="o.with_context(lang=lang)" />
<div class="page">
<h2>
Feuille de Temps
</h2>
<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.user_id.name"/>
</div>
<div class="col-auto mw-100 mb-2" >
<strong>Date de début</strong>
<p class="m-0" t-field="o.date_start"/>
</div>
<div class="col-auto mw-100 mb-2" name="date_end">
<strong>Date de fin</strong>
<p class="m-0" t-field="o.date_end"/>
</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>Dispositif</span></th>
<th class="text-left"><span>Durée</span></th>
</tr>
</thead>
<tbody class="invoice_tbody">
<t t-foreach="o.timesheet_ids" 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.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>
<tr>
<td />
<td />
<td />
<td class="text-right"><strong>Total</strong></td>
<td class="text-right"><strong t-esc="sum(o.timesheet_ids.mapped('unit_amount'))" t-options="{'widget': 'duration', 'digital': True, 'unit': 'hour', 'round': 'minute'}"/></td>
</tr>
</t>
</tbody>
</table>
</div>
</t>
</template>
<template id="report_timesheet">
<t t-call="web.html_container">
<t t-foreach="docs" t-as="o">
<t t-set="lang" t-value="o.user_id.lang"/>
<t t-call="cgscop_timesheet.report_timesheet_document" t-lang="lang"/>
</t>
</t>
</template>
<!-- QWeb Reports -->
<report
id="cgscop_timesheet_report"
model="cgscop.timesheet.print"
string="Feuilles de Temps"
report_type="qweb-pdf"
name="cgscop_timesheet.report_timesheet"
file="cgscop_timesheet.report_timesheet"
menu="False"
/>
</data>
</odoo>