[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:
@@ -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',
|
||||
|
||||
@@ -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"/>
|
||||
|
||||
Reference in New Issue
Block a user