usually it shows the field right aligned. How to change it to left aligned.
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Kế toán
- Tồn kho
- PoS
- Project
- MRP
Câu hỏi này đã bị gắn cờ
3
Trả lời
2367
Lượt xem
Just add class="oe_left" to your field in view.
Thaks For Your Answaer, it works for data only, Iwant for the th i mean Heading, thanks in advance
<tree>
<field name="name"/>
<field name="amount" style="text-align:right;"/>
</tree>
Through the JS, you can do it like this :
/** @odoo-module **/
import { patch } from "@web/core/utils/patch";
import { ListRenderer } from '@web/views/list/list_renderer';
import { onMounted, onPatched } from "@odoo/owl";
patch(ListRenderer.prototype, "align_left_area_size", {
setup() {
this._super(...arguments);
const alignAreaSizeLeft = () => {
const headers = document.querySelectorAll('div[name="one2many_field"] th[data-name="your_field"]');
const cells = document.querySelectorAll('div[name="one2many_field"] td[name="your_field"]');
headers.forEach((el) => {
el.classList.remove("text-end");
el.style.textAlign = "left";
const span_text_end = el.querySelector('span.text-end');
if (span_text_end) {
span_text_end.classList.remove("text-end");
span_text_end.style.textAlign = "left";
}
const span_o_list_number_th = el.querySelector('span.o_list_number_th');
if (span_o_list_number_th) {
span_o_list_number_th.classList.remove("o_list_number_th");
span_o_list_number_th.style.textAlign = "left";
}
});
cells.forEach((el) => {
el.classList.remove("o_list_number");
el.style.textAlign = "left";
});
document.querySelectorAll('div[name="room_ids"] th[data-name="area_size"] div.d-flex').forEach((div) => {
div.classList.remove("text-end");
div.classList.remove("flex-row-reverse");
});
};
onMounted(() => {
alignAreaSizeLeft();
});
onPatched(() => {
alignAreaSizeLeft();
});
},
});
Bạn có hứng thú với cuộc thảo luận không? Đừng chỉ đọc, hãy tham gia nhé!
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng kýBài viết liên quan | Trả lời | Lượt xem | Hoạt động | |
---|---|---|---|---|
|
2
thg 1 24
|
4342 | ||
|
0
thg 12 23
|
1737 | ||
|
2
thg 8 23
|
4489 | ||
|
0
thg 5 23
|
117 | ||
|
1
thg 5 23
|
6879 |