Odoo Help

1

How to make kanban text ellipsis

By
Nikola Gjorgjievski
on 4/28/16, 4:35 AM 649 views

I want to make text ellipsis in kanban view.

Here is my code:

<kanban>
	<field name="logo_img"/>
	<field name="name"/>
	<field name="info"/>
	<templates>
		<t t-name="kanban-box">
			<div class="oe_kanban_global_click">
				<div class="o_kanban_image">
					<img t-att-src="kanban_image('product.manufacturer', 'logo_img', record.id.value)"/>
				</div>
				<div class="oe_kanban_details">
					<strong>
						<field name="name"/>
					</strong>
					<div>
						<t t-esc="kanban_text_ellipsis(record.info.value, 32)" />
					</div>
				</div>
			</div>
		</t>
	</templates>
</kanban>

But I get an error

TypeError: dict.kanban_text_ellipsis is not a function
0
Jérôme Thériault
On 5/18/17, 2:36 PM

This part of the web_kanban addon was completely rewritten and kanban_text_ellipsis() was dropped since you can achieve the same goal with CSS. The docs has been updated to reflect this.

More info: https://github.com/odoo/odoo/pull/17082

If you really need that exact functionnality, you'll have to make a JS extension which includes the function on web_kanban.Record. Here's the JS I did for Odoo 10:

odoo.define('my_module.Record', function (require) {
  "use strict";

  var Record = require('web_kanban.Record');

  var KanbanRecord = Record.include({
    kanban_text_ellipsis: function(s, size) {
      size = size || 160;
      if (!s) {
        return '';
      } else if (s.length <= size) {
        return s;
      } else {
        return s.substr(0, size) + '...';
      }
    }
  });

  return KanbanRecord;
});


0
Gustavo Seluja
On 1/22/17, 9:58 PM

Hi Nikola, I have the same issue with version 9. Were you able to solve it?

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 4/28/16, 4:35 AM
Seen: 649 times
Last updated: 5/18/17, 2:36 PM