| 1 |
<?xml version="1.0" encoding="utf-8"?> |
| 2 |
<odoo> |
| 3 |
|
| 4 |
<!-- This view should only be used from the product o2m because the required field product_tmpl_id has to be automatically set. --> |
| 5 |
<record id="view_product_image_form" model="ir.ui.view"> |
| 6 |
<field name="name">product.image.view.form</field> |
| 7 |
<field name="model">product.image</field> |
| 8 |
<field name="arch" type="xml"> |
| 9 |
<form string="Product Images"> |
| 10 |
<field name="sequence" invisible="1"/> |
| 11 |
<div class="row o_website_sale_image_modal"> |
| 12 |
<div class="col-md-6 col-xl-5"> |
| 13 |
<label for="name" string="Image Name"/> |
| 14 |
<h2><field name="name" placeholder="Image Name"/></h2> |
| 15 |
<label for="video_url" string="Video URL"/><br/> |
| 16 |
<field name="video_url"/><br/> |
| 17 |
</div> |
| 18 |
<div class="col-md-6 col-xl-7 text-center o_website_sale_image_modal_container"> |
| 19 |
<div class="row"> |
| 20 |
<div class="col"> |
| 21 |
<field name="image_1920" widget="image"/> |
| 22 |
</div> |
| 23 |
<div class="col" invisible="video_url in ['', False]"> |
| 24 |
<div class="o_video_container p-2"> |
| 25 |
<span>Video Preview</span> |
| 26 |
<field name="embed_code" class="mt-2" widget="video_preview"/> |
| 27 |
<h4 class="o_invalid_warning text-muted text-center" invisible="embed_code"> |
| 28 |
Please enter a valid Video URL. |
| 29 |
</h4> |
| 30 |
</div> |
| 31 |
</div> |
| 32 |
</div> |
| 33 |
</div> |
| 34 |
</div> |
| 35 |
</form> |
| 36 |
</field> |
| 37 |
</record> |
| 38 |
|
| 39 |
<record id="product_image_view_kanban" model="ir.ui.view"> |
| 40 |
<field name="name">product.image.view.kanban</field> |
| 41 |
<field name="model">product.image</field> |
| 42 |
<field name="arch" type="xml"> |
| 43 |
<kanban string="Product Images" default_order="sequence"> |
| 44 |
<field name="video_url" invisible="1"/> |
| 45 |
<field name="sequence" widget="handle"/> |
| 46 |
<templates> |
| 47 |
<t t-name="card" class="p-0 border-0"> |
| 48 |
<div class="card"> |
| 49 |
<div class="o_squared_image"> |
| 50 |
<field class="card-img-top" name="image_1920" widget="x2_many_image"/> |
| 51 |
</div> |
| 52 |
<div class="p-2 m-0 bg-200" t-attf-title="#{record.name.value}"> |
| 53 |
<field name="name" class="small fs-5 text-truncate d-block"/> |
| 54 |
</div> |
| 55 |
<!-- below 100 Kb: good --> |
| 56 |
<t t-if="record.image_1920.raw_value.length < 100*1000"> |
| 57 |
<t t-set="size_status" t-value="'text-bg-success'"/> |
| 58 |
<t t-set="message">Acceptable file size</t> |
| 59 |
</t> |
| 60 |
<!-- below 1000 Kb: decent --> |
| 61 |
<t t-elif="record.image_1920.raw_value.length < 1000*1000"> |
| 62 |
<t t-set="size_status" t-value="'text-bg-warning'" /> |
| 63 |
<t t-set="message">Huge file size. The image should be optimized/reduced.</t> |
| 64 |
</t> |
| 65 |
<!-- above 1000 Kb: bad --> |
| 66 |
<t t-else="1"> |
| 67 |
<t t-set="size_status" t-value="'text-bg-danger'"/> |
| 68 |
<t t-set="message">Optimization required! Reduce the image size or increase your compression settings.</t> |
| 69 |
</t> |
| 70 |
<span t-attf-class="badge #{size_status} o_product_image_size" t-att-title="message"></span> |
| 71 |
</div> |
| 72 |
</t> |
| 73 |
</templates> |
| 74 |
</kanban> |
| 75 |
</field> |
| 76 |
</record> |
| 77 |
|
| 78 |
</odoo> |