Browse Source

[IMP] animal: black, isort, prettier

14.0
joseph 4 years ago
parent
commit
f839fc2c0a
  1. 2
      animal/__manifest__.py
  2. 7
      animal/security/res_groups.xml
  3. 190
      animal/views/animal.xml
  4. 16
      animal/views/animal_breed.xml
  5. 20
      animal/views/animal_color.xml
  6. 14
      animal/views/animal_species.xml
  7. 41
      animal/views/menu.xml
  8. 1
      setup/animal/odoo/addons/animal
  9. 6
      setup/animal/setup.py

2
animal/__manifest__.py

@ -2,7 +2,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Animal",
"version": "12.0.1.0.0",
"version": "14.0.1.0.0",
"license": "AGPL-3",
"summary": "Manage animals information",
"author": "Open Source Integrators, Odoo Community Association (OCA)",

7
animal/security/res_groups.xml

@ -3,8 +3,11 @@
<!-- Animal groups -->
<record id="group_animal_manager" model="res.groups">
<field name="name">Manager</field>
<field name="category_id" ref="animal"/>
<field name="users" eval="[(4, ref('base.user_root')), (4, ref('base.user_admin'))]"/>
<field name="category_id" ref="animal" />
<field
name="users"
eval="[(4, ref('base.user_root')), (4, ref('base.user_admin'))]"
/>
</record>
</odoo>

190
animal/views/animal.xml

@ -6,12 +6,12 @@
<field name="model">animal</field>
<field name="arch" type="xml">
<tree string="Animals">
<field name="ref"/>
<field name="name"/>
<field name="gender"/>
<field name="species_id"/>
<field name="breed_id"/>
<field name="color_id"/>
<field name="ref" />
<field name="name" />
<field name="gender" />
<field name="species_id" />
<field name="breed_id" />
<field name="color_id" />
</tree>
</field>
</record>
@ -22,44 +22,62 @@
<field name="model">animal</field>
<field name="arch" type="xml">
<form string="Animal">
<header/>
<header />
<sheet>
<div class="oe_button_box" name="button_box">
<button name="toggle_active" type="object"
class="oe_stat_button" icon="fa-archive">
<field name="active" widget="boolean_button"
options='{"terminology": "archive"}'/>
<button
name="toggle_active"
type="object"
class="oe_stat_button"
icon="fa-archive"
>
<field
name="active"
widget="boolean_button"
options='{"terminology": "archive"}'
/>
</button>
</div>
<field name="image" widget='image' class="oe_avatar"/>
<field name="image" widget='image' class="oe_avatar" />
<div class="oe_title">
<h1>
<field name="name"/>
<field name="name" />
</h1>
<field name="gender" widget="radio"
options="{'horizontal': true}"/>
<field
name="gender"
widget="radio"
options="{'horizontal': true}"
/>
</div>
<group id="main">
<group id="left">
<field name="species_id"/>
<field name="breed_id" domain="[('species_id', '=', species_id)]"/>
<field name="color_id" domain="[('breed_id', '=', breed_id)]"/>
<field name="size"/>
<field name="species_id" />
<field
name="breed_id"
domain="[('species_id', '=', species_id)]"
/>
<field
name="color_id"
domain="[('breed_id', '=', breed_id)]"
/>
<field name="size" />
</group>
<group id="right">
<field name="ref"/>
<field name="weight"/>
<field name="birth_date"/>
<field name="ref" />
<field name="weight" />
<field name="birth_date" />
</group>
</group>
<notebook/>
<notebook />
</sheet>
<div class="oe_chatter">
<field name="message_follower_ids"
widget="mail_followers"/>
<field name="activity_ids" widget="mail_activity"/>
<field name="message_ids" widget="mail_thread"
options="{'post_refresh': 'recipients'}"/>
<field name="message_follower_ids" widget="mail_followers" />
<field name="activity_ids" widget="mail_activity" />
<field
name="message_ids"
widget="mail_thread"
options="{'post_refresh': 'recipients'}"
/>
</div>
</form>
</field>
@ -71,26 +89,46 @@
<field name="model">animal</field>
<field name="arch" type="xml">
<kanban class="o_res_partner_kanban">
<field name="id"/>
<field name="image"/>
<field name="name"/>
<field name="id" />
<field name="image" />
<field name="name" />
<templates>
<t t-name="kanban-box">
<div class="oe_kanban_global_click o_kanban_record_has_image_fill o_res_partner_kanban">
<div
class="oe_kanban_global_click o_kanban_record_has_image_fill o_res_partner_kanban"
>
<t t-if="record.image.raw_value">
<img class="o_kanban_image" t-att-src="kanban_image('animal', 'image', record.id.raw_value)" t-att-alt="record.name"/>
<img
class="o_kanban_image"
t-att-src="kanban_image('animal', 'image', record.id.raw_value)"
t-att-alt="record.name"
/>
</t>
<t t-else="">
<img class="o_kanban_image" alt="Avatar" t-att-src='_s + "/animal/static/img/avatar.png"'/>
<img
class="o_kanban_image"
alt="Avatar"
t-att-src='_s + "/animal/static/img/avatar.png"'
/>
</t>
<div class="oe_kanban_details">
<strong class="o_kanban_record_title oe_partner_heading"><field name="display_name"/></strong>
<div class="o_kanban_tags_section oe_kanban_partner_categories"/>
<strong
class="o_kanban_record_title oe_partner_heading"
><field name="display_name" /></strong>
<div
class="o_kanban_tags_section oe_kanban_partner_categories"
/>
<ul>
<li t-if="record.gender.raw_value"><field name="gender"/></li>
<li t-if="record.species_id.raw_value and record.breed_id.raw_value"><field name="breed_id"/>, <field name="species_id"/></li>
<li t-if="record.gender.raw_value"><field
name="gender"
/></li>
<li
t-if="record.species_id.raw_value and record.breed_id.raw_value"
><field name="breed_id" />, <field
name="species_id"
/></li>
</ul>
<div class="oe_kanban_partner_links"/>
<div class="oe_kanban_partner_links" />
</div>
</div>
</t>
@ -105,36 +143,58 @@
<field name="model">animal</field>
<field name="arch" type="xml">
<search string="Animals">
<field name="name"
<field
name="name"
filter_domain="['|', ('name', 'ilike', self), ('ref', 'ilike', self)]"
string="Name"/>
<field name="species_id"/>
<field name="breed_id"/>
<field name="color_id"/>
<field name="size"/>
<separator/>
<filter string="Female"
string="Name"
/>
<field name="species_id" />
<field name="breed_id" />
<field name="color_id" />
<field name="size" />
<separator />
<filter
string="Female"
domain="[('gender', '=', 'female')]"
name="female"/>
<filter string="Male"
domain="[('gender', '=', 'male')]"
name="male"/>
<filter string="Hermaphrodite"
name="female"
/>
<filter string="Male" domain="[('gender', '=', 'male')]" name="male" />
<filter
string="Hermaphrodite"
domain="[('gender', '=', 'hermaphrodite')]"
name="hermaphrodite"/>
<filter string="Neutered"
name="hermaphrodite"
/>
<filter
string="Neutered"
domain="[('gender', '=', 'neutered')]"
name="neutered"/>
<separator/>
name="neutered"
/>
<separator />
<group expand="0" string="Group By">
<filter name="gender" string="Gender" domain=""
context="{'group_by': 'gender'}"/>
<filter name="species_id" string="Species" domain=""
context="{'group_by': 'species_id'}"/>
<filter name="breed_id" string="Breed" domain=""
context="{'group_by': 'breed_id'}"/>
<filter name="color_id" string="Color" domain=""
context="{'group_by': 'color_id'}"/>
<filter
name="gender"
string="Gender"
domain=""
context="{'group_by': 'gender'}"
/>
<filter
name="species_id"
string="Species"
domain=""
context="{'group_by': 'species_id'}"
/>
<filter
name="breed_id"
string="Breed"
domain=""
context="{'group_by': 'breed_id'}"
/>
<filter
name="color_id"
string="Color"
domain=""
context="{'group_by': 'color_id'}"
/>
</group>
</search>
</field>
@ -145,7 +205,7 @@
<field name="res_model">animal</field>
<field name="view_type">form</field>
<field name="view_mode">kanban,tree,form</field>
<field name="search_view_id" ref="view_animal_search"/>
<field name="search_view_id" ref="view_animal_search" />
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
Create an animal.

16
animal/views/animal_breed.xml

@ -6,8 +6,8 @@
<field name="model">animal.breed</field>
<field name="arch" type="xml">
<tree string="Breeds">
<field name="name"/>
<field name="species_id"/>
<field name="name" />
<field name="species_id" />
</tree>
</field>
</record>
@ -18,21 +18,21 @@
<field name="model">animal.breed</field>
<field name="arch" type="xml">
<form string="Breed">
<header/>
<header />
<sheet>
<div class="oe_button_box" name="button_box"/>
<div class="oe_button_box" name="button_box" />
<div class="oe_title">
<h1>
<field name="name"/>
<field name="name" />
</h1>
</div>
<group id="main">
<group id="left">
<field name="species_id"/>
<field name="species_id" />
</group>
<group id="right"/>
<group id="right" />
</group>
<notebook/>
<notebook />
</sheet>
</form>
</field>

20
animal/views/animal_color.xml

@ -6,9 +6,9 @@
<field name="model">animal.color</field>
<field name="arch" type="xml">
<tree string="colors">
<field name="name"/>
<field name="breed_id"/>
<field name="species_id"/>
<field name="name" />
<field name="breed_id" />
<field name="species_id" />
</tree>
</field>
</record>
@ -19,22 +19,22 @@
<field name="model">animal.color</field>
<field name="arch" type="xml">
<form string="Color">
<header/>
<header />
<sheet>
<div class="oe_button_box" name="button_box"/>
<div class="oe_button_box" name="button_box" />
<div class="oe_title">
<h1>
<field name="name"/>
<field name="name" />
</h1>
</div>
<group id="main">
<group id="left">
<field name="breed_id"/>
<field name="species_id"/>
<field name="breed_id" />
<field name="species_id" />
</group>
<group id="right"/>
<group id="right" />
</group>
<notebook/>
<notebook />
</sheet>
</form>
</field>

14
animal/views/animal_species.xml

@ -6,7 +6,7 @@
<field name="model">animal.species</field>
<field name="arch" type="xml">
<tree string="Species">
<field name="name"/>
<field name="name" />
</tree>
</field>
</record>
@ -17,21 +17,21 @@
<field name="model">animal.species</field>
<field name="arch" type="xml">
<form string="Species">
<header/>
<header />
<sheet>
<div class="oe_button_box" name="button_box"/>
<div class="oe_button_box" name="button_box" />
<div class="oe_title">
<h1>
<field name="name"/>
<field name="name" />
</h1>
</div>
<group id="main">
<group id="left"/>
<group id="right"/>
<group id="left" />
<group id="right" />
</group>
<notebook>
<page string="Breeds" id="breeds">
<field name="breed_ids"/>
<field name="breed_ids" />
</page>
</notebook>
</sheet>

41
animal/views/menu.xml

@ -1,41 +1,50 @@
<odoo>
<!-- Main Menu -->
<menuitem id="root"
<menuitem
id="root"
name="Animals"
action="action_animal"
sequence="10"
web_icon="animal,static/description/icon.png"/>
<menuitem id="animal"
web_icon="animal,static/description/icon.png"
/>
<menuitem
id="animal"
name="Animals"
action="action_animal"
sequence="10"
parent="root"/>
<menuitem id="config"
parent="root"
/>
<menuitem
id="config"
name="Configuration"
sequence="100"
parent="root"
groups="group_animal_manager"/>
groups="group_animal_manager"
/>
<!-- Configuration -->
<menuitem id="settings"
name="Settings"
sequence="10"
parent="config"/>
<menuitem id="species"
<menuitem id="settings" name="Settings" sequence="10" parent="config" />
<menuitem
id="species"
name="Species"
action="action_animal_species"
sequence="20"
parent="config"/>
<menuitem id="breed"
parent="config"
/>
<menuitem
id="breed"
name="Breeds"
action="action_animal_breed"
sequence="30"
parent="config"/>
<menuitem id="color"
parent="config"
/>
<menuitem
id="color"
name="Colors"
action="action_animal_color"
sequence="40"
parent="config"/>
parent="config"
/>
</odoo>

1
setup/animal/odoo/addons/animal

@ -0,0 +1 @@
../../../../animal

6
setup/animal/setup.py

@ -0,0 +1,6 @@
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
Loading…
Cancel
Save