Skip to content

Commit

Permalink
[IMP] maintenance_location: Add new fields and behavior, remove widge…
Browse files Browse the repository at this point in the history
…t_selection dependency
  • Loading branch information
etobella committed Oct 4, 2023
1 parent 49baf52 commit 9a66874
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 17 deletions.
2 changes: 1 addition & 1 deletion maintenance_location/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"license": "AGPL-3",
"author": "CreuBlanca,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/maintenance",
"depends": ["maintenance_plan", "web_widget_child_selector"],
"depends": ["maintenance_plan"],
"data": [
"views/maintenance_plan.xml",
"views/maintenance_equipment.xml",
Expand Down
4 changes: 3 additions & 1 deletion maintenance_location/models/maintenance_location.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class MaintenanceLocation(models.Model):
_order = "complete_name,id"

name = fields.Char(required=True)
description = fields.Char()
complete_name = fields.Char(
"Complete Name", compute="_compute_complete_name", store=True
)
Expand All @@ -30,7 +31,8 @@ class MaintenanceLocation(models.Model):
)
child_id = fields.One2many("maintenance.location", "parent_id", "Child Locations")
parent_path = fields.Char(index=True)

latitude = fields.Float(digits=(16, 5))
longitude = fields.Float(digits=(16, 5))
sequence = fields.Integer(string="Sequence", default=10)

@api.depends("name", "parent_id.complete_name")
Expand Down
6 changes: 1 addition & 5 deletions maintenance_location/views/maintenance_equipment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,7 @@
<attribute name="invisible">1</attribute>
</field>
<field name="location" position="before">
<field
name="location_id"
widget="child_selector"
options="{'child_selection_field': 'name', 'no_open': True}"
/>
<field name="location_id" />
</field>
<xpath expr="//tree/field[@name='maintenance_team_id']" position="after">
<field
Expand Down
6 changes: 6 additions & 0 deletions maintenance_location/views/maintenance_location.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,13 @@
</h1>
</div>
<group name="first" col="2">
<field name="description" />
<field name="parent_id" class="oe_inline" />
<label for="latitude" string="Location" />
<span class="oe_inline">
Latitude: <field name="latitude" nolabel="1" /><br />
Longitude: <field name="longitude" nolabel="1" />
</span>
</group>
</sheet>
</form>
Expand Down
6 changes: 1 addition & 5 deletions maintenance_location/views/maintenance_plan.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@
<field name="inherit_id" ref="maintenance_plan.maintenance_plan_view_form" />
<field name="arch" type="xml">
<field name="maintenance_team_id" position="after">
<field
name="location_id"
widget="child_selector"
options="{'child_selection_field': 'name'}"
/>
<field name="location_id" />
</field>
</field>
</record>
Expand Down
6 changes: 1 addition & 5 deletions maintenance_location/views/maintenance_request.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@
<field name="inherit_id" ref="maintenance.hr_equipment_request_view_form" />
<field name="arch" type="xml">
<field name="company_id" position="after">
<field
name="location_id"
widget="child_selector"
options="{'child_selection_field': 'name'}"
/>
<field name="location_id" />
</field>
</field>
</record>
Expand Down

0 comments on commit 9a66874

Please sign in to comment.