Skip to content
Extraits de code Groupes Projets
Valider e00bd7a8 rédigé par Benjamin - Le Filament's avatar Benjamin - Le Filament
Parcourir les fichiers

[cgscop #144] Ne faire apparaitre sur la fiche organisme la convention...

[cgscop #144] Ne faire apparaitre sur la fiche organisme la convention régionale et le dispositif financier que si au moins une ligne a été paramétrée ou cette UR
parent afc3ce0c
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -59,16 +59,16 @@ class ScopHrTimesheet(models.Model): ...@@ -59,16 +59,16 @@ class ScopHrTimesheet(models.Model):
# ------------------------------------------------------ # ------------------------------------------------------
@api.depends('ur_id') @api.depends('ur_id')
def _compute_ur_system_nb(self): def _compute_ur_system_nb(self):
for time in self: for timesheet in self:
# Calcul nombre de dispositifs financiers # Calcul nombre de dispositifs financiers
financial_system = time.env['ur.financial.system'].search([ financial_system = timesheet.env['ur.financial.system'].search([
('ur_id', '=', time.ur_id.id)]) ('ur_id', '=', timesheet.ur_id.id)])
time.ur_financial_system_nb = len( timesheet.ur_financial_system_nb = len(
financial_system) financial_system)
# Calcul nombre de conventions # Calcul nombre de conventions
regional_convention = time.env['ur.regional.convention'].search([ regional_convention = timesheet.env['ur.regional.convention'].search([
('ur_id', '=', time.ur_id.id)]) ('ur_id', '=', timesheet.ur_id.id)])
time.ur_regional_convention_nb = len( timesheet.ur_regional_convention_nb = len(
regional_convention) regional_convention)
@api.depends('sheet_id', 'sheet_id.state') @api.depends('sheet_id', 'sheet_id.state')
......
...@@ -19,3 +19,25 @@ class ScopPartnerTimesheet(models.Model): ...@@ -19,3 +19,25 @@ class ScopPartnerTimesheet(models.Model):
ondelete='set null') ondelete='set null')
ur_regional_convention_date = fields.Date( ur_regional_convention_date = fields.Date(
"Date de fin de convention") "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)
...@@ -25,9 +25,11 @@ ...@@ -25,9 +25,11 @@
<field name="arch" type="xml"> <field name="arch" type="xml">
<xpath expr="//field[@name='activity_federation_com']" position="before"> <xpath expr="//field[@name='activity_federation_com']" position="before">
<separator></separator> <separator></separator>
<field name="ur_financial_system_id" options="{'no_open': True, 'no_create': True}"/> <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_financial_system_date" attrs="{'invisible':[('ur_financial_system_id','=',False)]}"/>
<field name="ur_regional_convention_id" options="{'no_open': True, 'no_create': True}"/> <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)]}"/> <field name="ur_regional_convention_date" attrs="{'invisible':[('ur_regional_convention_id','=',False)]}"/>
<separator></separator> <separator></separator>
</xpath> </xpath>
......
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