[CLN] global : full pre-commit & ruff lint

This commit is contained in:
jscampucci
2025-09-15 12:58:03 +02:00
parent b63c4b5335
commit 174aabfbbb
71 changed files with 673 additions and 429 deletions

View File

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

View File

@@ -7,16 +7,16 @@
"version": "16.0.1.0.0",
"license": "AGPL-3",
"author": "Elabore",
"website": "https://www.elabore.coop",
"website": "https://github.com/elabore-coop/event-tools",
"category": "",
"depends": ["event", "website_event_track"],
"data": [
'security/ir.model.access.csv',
'views/event_sequence_views.xml',
'views/event_track_views.xml',
'views/event_event_views.xml',
'views/event_sequence_menu.xml',
'data/event_sequence_data.xml',
],
"data": [
"security/ir.model.access.csv",
"views/event_sequence_views.xml",
"views/event_track_views.xml",
"views/event_event_views.xml",
"views/event_sequence_menu.xml",
"data/event_sequence_data.xml",
],
"installable": True,
}

View File

@@ -1,3 +1,3 @@
from . import event_sequence
from . import event_track
from . import event_event
from . import event_event

View File

@@ -1,9 +1,8 @@
from odoo import _, api, Command, fields, models
from lxml import etree, html
from odoo.tools import format_time
from odoo import fields, models
class EventEvent(models.Model):
_inherit = "event.event"
sequence_number = fields.Integer('Number of sequences', default="5")
current_sequence_id = fields.Many2one('event.sequence', 'Current sequence')
sequence_number = fields.Integer("Number of sequences", default="5")
current_sequence_id = fields.Many2one("event.sequence", "Current sequence")

View File

@@ -6,4 +6,4 @@ class EventSequence(models.Model):
_name = "event.sequence"
name = fields.Char("name")
sequence = fields.Integer("Sequence") #for sorting
sequence = fields.Integer("Sequence") # for sorting

View File

@@ -1,21 +1,20 @@
from odoo import _, api, Command, fields, models
from lxml import etree, html
from odoo.tools import format_time
from odoo import api, fields, models
class EventTrack(models.Model):
_inherit = "event.track"
sequence_id = fields.Many2one('event.sequence', 'Sequence', group_expand='_read_group_stage_ids')
sequence = fields.Integer('Sequence') #for sorting
sequence_id = fields.Many2one(
"event.sequence", "Sequence", group_expand="_read_group_stage_ids"
)
sequence = fields.Integer("Sequence") # for sorting
@api.model_create_multi
def create(self, vals_list):
if vals_list and 'sequence' not in vals_list[0]:
vals_list[0]['sequence'] = 999
tracks = super(EventTrack, self).create(vals_list)
def create(self, vals_list):
if vals_list and "sequence" not in vals_list[0]:
vals_list[0]["sequence"] = 999
tracks = super().create(vals_list)
return tracks
@api.model
def _read_group_stage_ids(self, stages, domain, order):
@@ -25,8 +24,7 @@ class EventTrack(models.Model):
event_id = d[2]
if event_id:
event = self.env['event.event'].browse(event_id)
event = self.env["event.event"].browse(event_id)
return stages.search([], order="sequence", limit=event.sequence_number)
return stages.search([], order="sequence")

View File

@@ -1,2 +1,2 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_event_sequence,event.sequence,model_event_sequence,event.group_event_manager,1,1,1,1
access_event_sequence,event.sequence,model_event_sequence,event.group_event_manager,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_event_sequence event.sequence model_event_sequence event.group_event_manager 1 1 1 1

View File

@@ -3,15 +3,19 @@
<record model="ir.ui.view" id="view_event_form_event_sequence">
<field name="name">event.event.form.event.sequence</field>
<field name="model">event.event</field>
<field name="model">event.event</field>
<field name="inherit_id" ref="event.view_event_form" />
<field name="arch" type="xml">
<label for="date_begin" position="before">
<field name="sequence_number" />
</label>
<h1 position="after">
<label for="current_sequence_id" string="Current sequence"/>
<h4><field class="text-break" name="current_sequence_id" style="width:150px;" /></h4>
<label for="current_sequence_id" string="Current sequence" />
<h4><field
class="text-break"
name="current_sequence_id"
style="width:150px;"
/></h4>
</h1>
</field>
</record>

View File

@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<menuitem id="event_sequence_menu"
<menuitem
id="event_sequence_menu"
name="Sequences"
action="event_sequence_action"
parent="event.menu_event_configuration"
sequence="31"/>
parent="event.menu_event_configuration"
sequence="31"
/>
</odoo>

View File

@@ -2,7 +2,7 @@
<odoo>
<record model="ir.ui.view" id="view_event_sequence_tree">
<field name="name">event.sequence</field>
<field name="model">event.sequence</field>
<field name="model">event.sequence</field>
<field name="arch" type="xml">
<tree editable="top">
<field name="sequence" widget="handle" />
@@ -15,6 +15,6 @@
<field name="name">Sequences</field>
<field name="res_model">event.sequence</field>
<field name="view_mode">tree</field>
<field name="view_id" ref="view_event_sequence_tree"/>
<field name="view_id" ref="view_event_sequence_tree" />
</record>
</odoo>

View File

@@ -4,51 +4,108 @@
<field name="name">event.track.by.sequence.kanban</field>
<field name="model">event.track</field>
<field name="arch" type="xml">
<kanban default_order="sequence" group_create="false" default_group_by="sequence_id" quick_create_view="website_event_track.event_track_view_form_quick_create">
<field name="color"/>
<field name="partner_id"/>
<kanban
default_order="sequence"
group_create="false"
default_group_by="sequence_id"
quick_create_view="website_event_track.event_track_view_form_quick_create"
>
<field name="color" />
<field name="partner_id" />
<field name="sequence_id" options="{'create':false}" />
<field name="stage_id" options='{"group_by_tooltip": {"description": "Description"}}'/>
<field name="website_url"/>
<field name="activity_ids"/>
<field name="activity_state"/>
<field name="legend_blocked"/>
<field name="legend_normal"/>
<field name="legend_done"/>
<field
name="stage_id"
options='{"group_by_tooltip": {"description": "Description"}}'
/>
<field name="website_url" />
<field name="activity_ids" />
<field name="activity_state" />
<field name="legend_blocked" />
<field name="legend_normal" />
<field name="legend_done" />
<templates>
<progressbar field="kanban_state" colors='{"done": "success", "blocked": "danger"}'/>
<progressbar
field="kanban_state"
colors='{"done": "success", "blocked": "danger"}'
/>
<t t-name="kanban-box">
<div t-attf-class="{{!selection_mode ? 'oe_kanban_color_' + kanban_getcolor(record.color.raw_value) : ''}} oe_kanban_card oe_kanban_global_click">
<div class="o_dropdown_kanban dropdown" groups="base.group_user">
<div
t-attf-class="{{!selection_mode ? 'oe_kanban_color_' + kanban_getcolor(record.color.raw_value) : ''}} oe_kanban_card oe_kanban_global_click"
>
<div
class="o_dropdown_kanban dropdown"
groups="base.group_user"
>
<a role="button" class="dropdown-toggle o-no-caret btn" data-bs-toggle="dropdown" href="#" aria-label="Dropdown menu" title="Dropdown menu">
<span class="fa fa-ellipsis-v"/>
<a
role="button"
class="dropdown-toggle o-no-caret btn"
data-bs-toggle="dropdown"
href="#"
aria-label="Dropdown menu"
title="Dropdown menu"
>
<span class="fa fa-ellipsis-v" />
</a>
<div class="dropdown-menu" role="menu">
<a role="menuitem" t-att-href="record.website_url.value" class="dropdown-item">View Track</a>
<t t-if="widget.editable"><a role="menuitem" type="edit" class="dropdown-item">Edit Track</a></t>
<t t-if="widget.deletable"><a role="menuitem" type="delete" class="dropdown-item">Delete</a></t>
<ul class="oe_kanban_colorpicker" data-field="color"/>
<a
role="menuitem"
t-att-href="record.website_url.value"
class="dropdown-item"
>View Track</a>
<t t-if="widget.editable"><a
role="menuitem"
type="edit"
class="dropdown-item"
>Edit Track</a></t>
<t t-if="widget.deletable"><a
role="menuitem"
type="delete"
class="dropdown-item"
>Delete</a></t>
<ul
class="oe_kanban_colorpicker"
data-field="color"
/>
</div>
</div>
<div class="oe_kanban_content">
<div class="o_kanban_record_top">
<h4 class="o_kanban_record_title"><field name="name"/></h4>
<h4 class="o_kanban_record_title"><field
name="name"
/></h4>
</div>
<div class="o_kanban_record_body">
<t t-if="duration"><field name="duration" widget="float_time"/> hours</t>
<field name="tag_ids" widget="many2many_tags" options="{'color_field': 'color'}"/>
<t t-if="duration"><field
name="duration"
widget="float_time"
/> hours</t>
<field
name="tag_ids"
widget="many2many_tags"
options="{'color_field': 'color'}"
/>
</div>
<div class="o_kanban_record_bottom">
<div class="oe_kanban_bottom_left">
<field name="priority" widget="priority"/>
<field name="activity_ids" widget="kanban_activity"/>
<field name="priority" widget="priority" />
<field
name="activity_ids"
widget="kanban_activity"
/>
</div>
<div class="oe_kanban_bottom_right">
<field name="kanban_state" widget="state_selection" groups="base.group_user"/>
<img t-att-src="kanban_image('res.partner', 'avatar_128', record.partner_id.raw_value)"
t-att-title="record.partner_id.value" t-att-alt="record.partner_id.value"
class="oe_kanban_avatar"/>
<field
name="kanban_state"
widget="state_selection"
groups="base.group_user"
/>
<img
t-att-src="kanban_image('res.partner', 'avatar_128', record.partner_id.raw_value)"
t-att-title="record.partner_id.value"
t-att-alt="record.partner_id.value"
class="oe_kanban_avatar"
/>
</div>
</div>
</div>
@@ -59,10 +116,19 @@
</field>
</record>
<record model="ir.actions.act_window.view" id="action_event_track_from_event_kanban">
<field name="sequence" eval="1"/>
<record
model="ir.actions.act_window.view"
id="action_event_track_from_event_kanban"
>
<field name="sequence" eval="1" />
<field name="view_mode">kanban</field>
<field name="act_window_id" ref="website_event_track.action_event_track_from_event"/>
<field name="view_id" ref="event_sequence.view_event_track_by_sequence_kanban"/>
<field
name="act_window_id"
ref="website_event_track.action_event_track_from_event"
/>
<field
name="view_id"
ref="event_sequence.view_event_track_by_sequence_kanban"
/>
</record>
</odoo>