Browse Source

IMP animal: ergonomy with fields sequence, active

14.0
David Beal 3 years ago
parent
commit
389f37de19
  1. 2
      animal/models/animal_breed.py
  2. 2
      animal/models/animal_species.py
  3. 8
      animal/views/animal_breed.xml
  4. 8
      animal/views/animal_species.xml

2
animal/models/animal_breed.py

@ -10,3 +10,5 @@ class AnimalBreed(models.Model):
name = fields.Char(string="Name", translate=True) name = fields.Char(string="Name", translate=True)
species_id = fields.Many2one("animal.species", string="Species", required=True) species_id = fields.Many2one("animal.species", string="Species", required=True)
active = fields.Boolean(default=True)
sequence = fields.Integer()

2
animal/models/animal_species.py

@ -9,4 +9,6 @@ class AnimalSpecies(models.Model):
_order = "name" _order = "name"
name = fields.Char(string="Name", translate=True) name = fields.Char(string="Name", translate=True)
active = fields.Boolean(default=True)
sequence = fields.Integer()
breed_ids = fields.One2many("animal.breed", "species_id", string="Breeds") breed_ids = fields.One2many("animal.breed", "species_id", string="Breeds")

8
animal/views/animal_breed.xml

@ -6,6 +6,7 @@
<field name="model">animal.breed</field> <field name="model">animal.breed</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<tree string="Breeds"> <tree string="Breeds">
<field name="sequence" widget="handle" />
<field name="name" /> <field name="name" />
<field name="species_id" /> <field name="species_id" />
</tree> </tree>
@ -21,6 +22,13 @@
<header /> <header />
<sheet> <sheet>
<div class="oe_button_box" name="button_box" /> <div class="oe_button_box" name="button_box" />
<widget
name="web_ribbon"
title="Archived"
bg_color="bg-danger"
attrs="{'invisible': [('active', '=', True)]}"
/>
<field name="active" invisible="1" />
<div class="oe_title"> <div class="oe_title">
<h1> <h1>
<field name="name" /> <field name="name" />

8
animal/views/animal_species.xml

@ -6,6 +6,7 @@
<field name="model">animal.species</field> <field name="model">animal.species</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<tree string="Species"> <tree string="Species">
<field name="sequence" widget="handle" />
<field name="name" /> <field name="name" />
</tree> </tree>
</field> </field>
@ -20,6 +21,13 @@
<header /> <header />
<sheet> <sheet>
<div class="oe_button_box" name="button_box" /> <div class="oe_button_box" name="button_box" />
<widget
name="web_ribbon"
title="Archived"
bg_color="bg-danger"
attrs="{'invisible': [('active', '=', True)]}"
/>
<field name="active" invisible="1" />
<div class="oe_title"> <div class="oe_title">
<h1> <h1>
<field name="name" /> <field name="name" />

Loading…
Cancel
Save