Skip to content
Extraits de code Groupes Projets
Valider 0903a054 rédigé par Hervé Silvant - CGScop's avatar Hervé Silvant - CGScop
Parcourir les fichiers

Saisie des lignes de temps sur une vue calendrier

parent f5e1466f
Aucune branche associée trouvée
Aucune étiquette associée trouvée
1 requête de fusion!4Saisie des lignes de temps sur une vue calendrier
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
"analytic", "analytic",
"project", "project",
"cgscop_partner", "cgscop_partner",
'cgscop_fullcalendar',
], ],
"data": [ "data": [
"security/ir.model.access.csv", "security/ir.model.access.csv",
......
...@@ -61,6 +61,15 @@ class ScopHrTimesheet(models.Model): ...@@ -61,6 +61,15 @@ class ScopHrTimesheet(models.Model):
string="Justificatifs", string="Justificatifs",
required=False) required=False)
calendar_l1 = fields.Char(
string='Ligne 1 calendrier',
compute='_compute_calendar_l1',
store=False)
calendar_l2 = fields.Char(
string='Ligne 2 calendrier',
compute='_compute_calendar_l2',
store=False)
# ------------------------------------------------------ # ------------------------------------------------------
# Compute Functions # Compute Functions
# ------------------------------------------------------ # ------------------------------------------------------
...@@ -86,6 +95,33 @@ class ScopHrTimesheet(models.Model): ...@@ -86,6 +95,33 @@ class ScopHrTimesheet(models.Model):
else: else:
timesheet.state = timesheet.sheet_id.state timesheet.state = timesheet.sheet_id.state
@api.depends('project_id', 'partner_id')
def _compute_calendar_l1(self):
for ts in self:
ts.calendar_l1 = ""
if ts.project_id:
ts.calendar_l1 += ts.project_id.name + ', '
if ts.partner_id:
ts.calendar_l1 += ts.partner_id.name
@api.depends('unit_amount')
def _compute_calendar_l2(self):
for ts in self:
ts.calendar_l2 = "Durée : " + str(ts.unit_amount) + " heure(s)"
# ------------------------------------------------------
# Override le _rec_name
# ------------------------------------------------------
@api.multi
@api.depends('project_id', 'partner_id')
def name_get(self):
result = []
for ts in self:
name = ts.calendar_l1
result.append((ts.id, name))
return result
# ------------------------------------------------------ # ------------------------------------------------------
# OnChange Functions # OnChange Functions
# ------------------------------------------------------ # ------------------------------------------------------
......
...@@ -43,29 +43,68 @@ ...@@ -43,29 +43,68 @@
<field name="model">account.analytic.line</field> <field name="model">account.analytic.line</field>
<field name="inherit_id" ref="hr_timesheet.hr_timesheet_line_form"/> <field name="inherit_id" ref="hr_timesheet.hr_timesheet_line_form"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<field name="project_id" position="attributes" > <xpath expr="//form/sheet/group" position="attributes">
<attribute name="options">{'no_open': True, 'no_create': True}</attribute> <attribute name="invisible">1</attribute>
<attribute name="string">Code activité UR</attribute> </xpath>
</field> <xpath expr="//form/sheet/group" position="after">
<field name="project_id" position="after" > <group string="Activité">
<field name="partner_id" domain="[('is_company', '=', True), ('ur_id', '=', ur_id)]" required="True" class="td-ellipsis" options="{'no_open': True, 'no_create': True}" string="Contact" /> <field name="ur_id" options="{'no_open': True, 'no_create': True}" groups="cgscop_partner.group_cg_administrator"/>
<field name="is_present"/> <field name="employee_id" options="{'no_open': True, 'no_create': True}" required="True" groups="hr_timesheet.group_timesheet_manager"/>
<field name="date"/>
<field name="project_id" required="True" options="{'no_open': True, 'no_create': True}" string="Code activité UR" />
<field name="partner_id" domain="[('is_company', '=', True), ('ur_id', '=', ur_id)]" required="True" options="{'no_open': True, 'no_create': True}" string="Contact" />
<field name="name"/>
<field name="unit_amount" widget="float_time"/>
</group>
<group string="Divers">
<field name="is_present" widget="boolean_toggle"/>
</group>
<group name="DF" string="Dispositif financier" attrs="{'invisible': ['&amp;',('ur_regional_convention_nb', '=', 0),('ur_financial_system_nb', '=', 0)]}">
<field name="ur_financial_system_id" options="{'no_open': True, 'no_create': True}" attrs="{'required':[('ur_financial_system_nb', '>', 0)], 'invisible':[('ur_financial_system_nb', '=', 0)]}"/> <field name="ur_financial_system_id" options="{'no_open': True, 'no_create': True}" attrs="{'required':[('ur_financial_system_nb', '>', 0)], 'invisible':[('ur_financial_system_nb', '=', 0)]}"/>
<field name="ur_regional_convention_id" options="{'no_open': True, 'no_create': True}" attrs="{'required':[('ur_regional_convention_nb', '>', 0)], 'invisible':[('ur_regional_convention_nb', '=', 0)]}"/> <field name="ur_regional_convention_id" options="{'no_open': True, 'no_create': True}" attrs="{'required':[('ur_regional_convention_nb', '>', 0)], 'invisible':[('ur_regional_convention_nb', '=', 0)]}"/>
<field name="justificatifs" attrs="{'invisible': [('ur_id', '!=', %(cgscop_partner.riga_14243)d)]}"/> <field name="justificatifs" attrs="{'invisible': [('ur_id', '!=', %(cgscop_partner.riga_14243)d)]}"/>
<field name="ur_id" options="{'no_open': True, 'no_create': True}" groups="cgscop_partner.group_cg_administrator"/>
<field name="ur_regional_convention_nb" invisible="1"/> <field name="ur_regional_convention_nb" invisible="1"/>
<field name="ur_financial_system_nb" invisible="1"/> <field name="ur_financial_system_nb" invisible="1"/>
</group>
</xpath>
</field> </field>
<field name="task_id" position="attributes"> </record>
<attribute name="invisible">True</attribute>
</field>
<field name="amount" position="attributes"> <!-- Form View Timesheet CG -->
<attribute name="invisible">True</attribute> <record id="view_cgscop_hr_timesheet_line_form2" model="ir.ui.view">
</field> <field name="name">account.analytic.line.timesheet.form.cgscop</field>
<field name="model">account.analytic.line</field>
<field name="inherit_id" ref="analytic.view_account_analytic_line_form"/>
<field name="arch" type="xml">
<xpath expr="//form/group" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
<xpath expr="//form/group" position="after">
<group string="Activité">
<field name="ur_id" options="{'no_open': True, 'no_create': True}" groups="cgscop_partner.group_cg_administrator"/>
<field name="employee_id" options="{'no_open': True, 'no_create': True}" required="True" groups="hr_timesheet.group_timesheet_manager"/>
<field name="date"/>
<field name="project_id" required="True" options="{'no_open': True, 'no_create': True}" string="Code activité UR" />
<field name="partner_id" domain="[('is_company', '=', True), ('ur_id', '=', ur_id)]" required="True" options="{'no_open': True, 'no_create': True}" string="Contact" />
<field name="name"/>
<field name="unit_amount" widget="float_time"/>
</group>
<group string="Divers">
<field name="is_present" widget="boolean_toggle"/>
</group>
<group name="DF" string="Dispositif financier" attrs="{'invisible': ['&amp;',('ur_regional_convention_nb', '=', 0),('ur_financial_system_nb', '=', 0)]}">
<field name="ur_financial_system_id" options="{'no_open': True, 'no_create': True}" attrs="{'required':[('ur_financial_system_nb', '>', 0)], 'invisible':[('ur_financial_system_nb', '=', 0)]}"/>
<field name="ur_regional_convention_id" options="{'no_open': True, 'no_create': True}" attrs="{'required':[('ur_regional_convention_nb', '>', 0)], 'invisible':[('ur_regional_convention_nb', '=', 0)]}"/>
<field name="justificatifs" attrs="{'invisible': [('ur_id', '!=', %(cgscop_partner.riga_14243)d)]}"/>
<field name="ur_regional_convention_nb" invisible="1"/>
<field name="ur_financial_system_nb" invisible="1"/>
</group>
</xpath>
</field> </field>
</record> </record>
<!-- Tree View Timesheet CG --> <!-- Tree View Timesheet CG -->
<record id="view_cgscop_hr_timesheet_line_tree" model="ir.ui.view"> <record id="view_cgscop_hr_timesheet_line_tree" model="ir.ui.view">
<field name="name">account.analytic.line.timesheet.cgscop</field> <field name="name">account.analytic.line.timesheet.cgscop</field>
...@@ -119,19 +158,55 @@ ...@@ -119,19 +158,55 @@
</field> </field>
</record> </record>
<!-- Calendar View Timesheet CG -->
<record model="ir.ui.view" id="view_cgscop_hr_timesheet_line_calendar" >
<field name="name">account.analytic.line.timesheet.cgscop.calendar</field>
<field name="model">account.analytic.line</field>
<field name="arch" type="xml">
<calendar string="Ligne de temps" date_start="date" mode="month" quick_add="False" color="project_id" readonly_form_view_id="cgscop_timesheet.view_cgscop_hr_timesheet_line_form">
<field name="calendar_l1"/>
<field name="calendar_l2"/>
</calendar>
</field>
</record>
<!-- <!--
Actions Actions
--> -->
<!-- Hérite l'action de la fenetre --> <!-- Renomme l'action dans hr_timesheet -->
<record id="hr_timesheet.menu_hr_time_tracking" model="ir.actions.act_window"> <record id="hr_timesheet.menu_hr_time_tracking" model="ir.actions.act_window">
<field name="name">Lignes de temps</field> <field name="name">Lignes de temps</field>
</record> </record>
<!-- Hérite l'action de la fenetre dans hr_timesheet -->
<record id="hr_timesheet.act_hr_timesheet_line" model="ir.actions.act_window"> <record id="hr_timesheet.act_hr_timesheet_line" model="ir.actions.act_window">
<field name="name">Mes lignes de temps</field> <field name="name">Mes lignes de temps</field>
<field name="view_mode">tree,form,pivot,graph</field> <field name="view_mode">calendar,tree,form,pivot</field>
<field name="context">{'search_default_no_report': 1}</field> <field name="context">{'search_default_no_report': 1}</field>
<field name="view_ids" eval="[(5, 0, 0),
(0, 0, {'view_mode': 'tree', 'sequence': 5, 'view_id': ref('cgscop_timesheet.view_cgscop_hr_timesheet_line_tree')}),
(0, 0, {'view_mode': 'calendar', 'sequence': 10, 'view_id': ref('cgscop_timesheet.view_cgscop_hr_timesheet_line_calendar')}),
(0, 0, {'view_mode': 'pivot', 'sequence': 15, 'view_id': ref('hr_timesheet.view_hr_timesheet_line_pivot')}),
(0, 0, {'view_mode': 'form', 'sequence': 20, 'view_id': ref('cgscop_timesheet.view_cgscop_hr_timesheet_line_form')})]"/>
</record>
<!-- Hérite l'action de la fenetre dans hr_timesheet -->
<record id="hr_timesheet.timesheet_action_all" model="ir.actions.act_window">
<field name="name">Toutes les lignes de temps</field>
<field name="res_model">account.analytic.line</field>
<field name="search_view_id" ref="cgscop_hr_timesheet_line_search"/>
<field name="domain">[('project_id', '!=', False)]</field>
<field name="context">{
'search_default_week':1,
'search_default_groupby_date':1,
'search_default_groupby_employee':1,
'search_default_groupby_project':1,
}</field>
<field name="view_mode">tree,form</field>
<field name="view_ids" eval="[(5, 0, 0),
(0, 0, {'view_mode': 'tree', 'sequence': 5, 'view_id': ref('cgscop_timesheet.view_cgscop_hr_timesheet_line_tree')}),
(0, 0, {'view_mode': 'form', 'sequence': 20, 'view_id': ref('cgscop_timesheet.view_cgscop_hr_timesheet_line_form')})]"/>
</record> </record>
<!-- Report View per Contact --> <!-- Report View per Contact -->
...@@ -163,10 +238,12 @@ if records: ...@@ -163,10 +238,12 @@ if records:
<!-- <!--
Menus Menus
--> -->
<!-- ajoute des droits sur le menu Configuration --> <!-- ajoute des droits sur le menu Configuration -->
<record model="ir.ui.menu" id="hr_timesheet.hr_timesheet_menu_configuration"> <record model="ir.ui.menu" id="hr_timesheet.hr_timesheet_menu_configuration">
<field name="groups_id" eval="[(6,0, [ref('hr_timesheet.group_timesheet_manager'), ref('cgscop_partner.group_cg_administrator'), ref('cgscop_partner.group_ur_list_modif')])]"/> <field name="groups_id" eval="[(6,0, [ref('hr_timesheet.group_timesheet_manager'), ref('cgscop_partner.group_cg_administrator'), ref('cgscop_partner.group_ur_list_modif')])]"/>
</record> </record>
<!-- ajoute des droits pour gestionnaire uniquement sur le menu Toutes les feuilles de temps --> <!-- ajoute des droits pour gestionnaire uniquement sur le menu Toutes les feuilles de temps -->
<record model="ir.ui.menu" id="hr_timesheet.timesheet_menu_activity_all"> <record model="ir.ui.menu" id="hr_timesheet.timesheet_menu_activity_all">
<field name="groups_id" eval="[(6,0, [ref('hr_timesheet.group_timesheet_manager'), ref('cgscop_partner.group_cg_administrator')])]"/> <field name="groups_id" eval="[(6,0, [ref('hr_timesheet.group_timesheet_manager'), ref('cgscop_partner.group_cg_administrator')])]"/>
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter