Browse Source

Add sequence to images.

pull/402/head
Jairo Llopis 9 years ago
parent
commit
0f600d472b
  1. 3
      base_multi_image/models/image.py
  2. 3
      base_multi_image/views/image_view.xml

3
base_multi_image/models/image.py

@ -16,6 +16,7 @@ _logger = logging.getLogger(__name__)
class Image(models.Model): class Image(models.Model):
_name = "base_multi_image.image" _name = "base_multi_image.image"
_order = "sequence, owner_model, owner_id, id"
_sql_constraints = [ _sql_constraints = [
('uniq_name_owner', 'UNIQUE(owner_id, owner_model, name)', ('uniq_name_owner', 'UNIQUE(owner_id, owner_model, name)',
_('A document can have only one image with the same name.')), _('A document can have only one image with the same name.')),
@ -63,6 +64,8 @@ class Image(models.Model):
comments = fields.Text( comments = fields.Text(
'Comments', 'Comments',
translate=True) translate=True)
sequence = fields.Integer(
default=10)
show_technical = fields.Boolean( show_technical = fields.Boolean(
compute="_show_technical") compute="_show_technical")

3
base_multi_image/views/image_view.xml

@ -18,6 +18,7 @@
<field name="show_technical" invisible="True"/> <field name="show_technical" invisible="True"/>
<field name="owner_model"/> <field name="owner_model"/>
<field name="owner_id"/> <field name="owner_id"/>
<field name="sequence"/>
</group> </group>
<group string="Name"> <group string="Name">
<field name="name"/> <field name="name"/>
@ -72,6 +73,7 @@
<field name="storage"/> <field name="storage"/>
<field name="owner_model"/> <field name="owner_model"/>
<field name="owner_id"/> <field name="owner_id"/>
<field name="sequence" invisible="True"/>
</tree> </tree>
</field> </field>
</record> </record>
@ -83,6 +85,7 @@
<kanban string="Product Images"> <kanban string="Product Images">
<field name="name"/> <field name="name"/>
<field name="storage"/> <field name="storage"/>
<field name="sequence"/>
<templates> <templates>
<t t-name="kanban-box"> <t t-name="kanban-box">
<div style="position: relative"> <div style="position: relative">

Loading…
Cancel
Save