Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
2 Odpowiedzi
6035 Widoki

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
Awatar
Odrzuć
Najlepsza odpowiedź

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;
});


Awatar
Odrzuć
Najlepsza odpowiedź

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

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
1
sty 25
1786
2
maj 23
2482
0
sie 22
2656
0
mar 22
2629
1
paź 19
5570