[IMP] product_document: order by name to control on ecommerce appearance

Order name rather than ID so that the user has more control on documents
published in eCommerce and quote builder. Minor CSS cleanup.

closes odoo/odoo#154961

Signed-off-by: Fabien Pinckaers (fp) <fp@odoo.com>
This commit is contained in:
Fabien Pinckaers
2024-02-22 07:47:44 +00:00
parent b5065e9fe4
commit b79f7f8525
2 changed files with 4 additions and 4 deletions
+1 -1
View File
@@ -10,7 +10,7 @@ class ProductDocument(models.Model):
_inherits = {
'ir.attachment': 'ir_attachment_id',
}
_order = 'id desc'
_order = 'name'
ir_attachment_id = fields.Many2one(
'ir.attachment',
+3 -3
View File
@@ -1136,13 +1136,13 @@
</table>
</div>
<t t-set="product_documents" t-value="product.sudo().product_document_ids.filtered(lambda doc: doc.shown_on_product_page)"/>
<div id="product_documents" t-if="product_documents" class="row">
<u class="h5">Documents</u>
<div id="product_documents" class="my-2" t-if="product_documents">
<h5>Documents</h5>
<t t-foreach="product_documents" t-as="document_sudo">
<t t-set="attachment_sudo" t-value="document_sudo.ir_attachment_id"/>
<t t-set="target" t-value="attachment_sudo.type == 'url' and '_blank' or '_self'"/>
<t t-set="icon" t-value="attachment_sudo.type == 'url' and 'fa-link' or 'fa-download'"/>
<div class="d-flex mb-2 mt-2">
<div>
<a t-att-href="'/shop/' + slug(product) + '/document/' + str(document_sudo.id)" t-att-target="target">
<i t-att-class="'fa ' + icon"/>
<t t-out="attachment_sudo.name"/>