Bỏ qua để đến Nội dung
Odoo Menu
  • Đăng nhập
  • Dùng thử miễn phí
  • Ứng dụng
    Tài chính
    • Kế toán
    • Hóa đơn
    • Chi phí
    • Bảng tính (BI)
    • Tài liệu
    • Ký tên
    Bán hàng
    • CRM
    • Bán hàng
    • POS Cửa hàng
    • POS Nhà hàng
    • Đăng ký
    • Cho thuê
    Trang web
    • Trình tạo trang web
    • Thương mại điện tử
    • Blog
    • Diễn đàn
    • Trò chuyện trực tiếp
    • Học trực tuyến
    Chuỗi cung ứng
    • Tồn kho
    • Sản xuất
    • PLM
    • Mua hàng
    • Bảo dưỡng
    • Chất lượng
    Nhân sự
    • Nhân viên
    • Tuyển dụng
    • Ngày nghỉ
    • Đánh giá
    • Giới thiệu
    • Đội xe
    Marketing
    • Marketing trên MXH
    • Marketing qua email
    • Marketing qua SMS
    • Sự kiện
    • Tự động hóa Marketing
    • Khảo sát
    Dịch vụ
    • Dự án
    • Bảng chấm công
    • Dịch vụ hiện trường
    • Hỗ trợ
    • Kế hoạch
    • Lịch hẹn
    Năng suất
    • Thảo luận
    • Phê duyệt
    • IoT
    • VoIP
    • Kiến thức
    • WhatsApp
    Ứng dụng của bên thứ ba Studio Odoo Nền tảng Đám mây Odoo
  • Ngành
    Bán lẻ
    • Nhà sách
    • Cửa hàng quần áo
    • Cửa hàng nội thất
    • Cửa hàng tạp hóa
    • Cửa hàng đồ kim khí
    • Cửa hàng đồ chơi
    Ẩm thực & Dịch vụ lưu trú
    • Bar và quán rượu
    • Nhà hàng
    • Đồ ăn nhanh
    • Guest house
    • Nhà phân phối đồ uống
    • Khách sạn
    Bất động sản
    • Công ty môi giới bất động sản
    • Công ty kiến trúc
    • Xây dựng
    • Quản lý bất động sản
    • Làm vườn
    • Hiệp hội chủ sở hữu bất động sản
    Tư vấn
    • Công ty kế toán
    • Đối tác Odoo
    • Công ty marketing
    • Công ty luật
    • Tuyển dụng
    • Thanh tra & chứng nhận
    Sản xuất
    • Dệt may
    • Kim loại
    • Nội thất
    • Ẩm thực
    • Nhà máy bia
    • Quà tặng doanh nghiệp
    Sức khoẻ & fitness
    • CLB thể thao
    • Cửa hàng kính mắt
    • Trung tâm fitness
    • Chuyên gia chăm sóc sức khỏe
    • Hiệu thuốc
    • Tiệm làm tóc
    Thương mại
    • Dịch vụ sửa chữa
    • Phần cứng CNTT & Hỗ trợ
    • Hệ thống năng lượng mặt trời
    • Công ty sản xuất giày
    • Dịch vụ vệ sinh
    • Dịch vụ HVAC
    Khác
    • Tổ chức phi lợi nhuận
    • Cơ quan môi trường
    • Cho thuê biển quảng cáo
    • Nhiếp ảnh
    • Cho thuê xe đạp
    • Đại lý phần mềm
    Xem tất cả ngành
  • Cộng đồng
    Học tập
    • Khóa học
    • Tài liệu
    • Chứng chỉ
    • Đào tạo
    • Blog
    • Podcast
    Thúc đẩy đào tạo
    • Chương trình đào tạo
    • Trò chơi kinh doanh Scale Up!
    • Tham quan Odoo
    Nhận phần mềm
    • Tải xuống
    • So sánh các phiên bản
    • Phiên bản
    Hợp tác
    • Github
    • Diễn đàn
    • Sự kiện
    • Dịch thuật
    • Trở thành đối tác
    • Dịch vụ dành cho Đối tác
    • Đăng ký công ty kế toán của bạn
    Nhận dịch vụ
    • Tìm đối tác
    • Tìm kế toán
    • Gặp chuyên gia hỗ trợ
    • Dịch vụ Triển khai
    • Khách hàng tham khảo
    • Hỗ trợ
    • Nâng cấp
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Nhận một buổi demo
  • Bảng giá
  • Trợ giúp

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
  • Dự án
  • MRP
All apps
Bạn cần phải đăng ký để tương tác với cộng đồng.
Tất cả bài viết Người Huy hiệu
Thẻ (Xem tất cả)
odoo accounting v14 pos v15
Về diễn đàn này
Bạn cần phải đăng ký để tương tác với cộng đồng.
Tất cả bài viết Người Huy hiệu
Thẻ (Xem tất cả)
odoo accounting v14 pos v15
Về diễn đàn này
Hỗ trợ

[Solved] Inherit fields to existing tables

Đăng ký nhận tin

Nhận thông báo khi có hoạt động trên bài viết này

Câu hỏi này đã bị gắn cờ
pythonpython2.7odooodoo10
4 Trả lời
10427 Lượt xem
Ảnh đại diện
Fazryan Fareka Riznendi

Hiiii,
How to inherit field to existing tables?

I've tried various things, but it's hard to understand,

i want to inherit my field(on my addons) to model asset.

this my code ;

class Aset(models.Model): #addons field
    _inherit='asset.asset' 
    
    asset_number = fields.Char('Item Code/Reg', size=64)
    no_pol=fields.Char('Police Number')
    many_units=fields.Char('Number Of Units', default='1')
    item_type_id=fields.Many2one('item_type', string='Item Type')
    colour=fields.Char('Colour')
    machine_number=fields.Char('Number Machine')
    chassiss=fields.Char('Chassis Number')
    fill_in_the_slider=fields.Char('Slider')
    bpkb_no=fields.Char('BPKB No')
    year=fields.Char('Year')

xml ;

<record model="ir.ui.view" id="asset_asset_form_view">
    <field name="name">asset_asset_form</field>
    <field name="model">asset.asset</field>
    <field name="inherit_id" ref="asset.assets_form_view" />
    <field name="arch" type="xml">
        <page position='inside'>
            <group position="inside">
                <field name='serial'>
            <group>
                <field name='color'/>
            </group>
                </field>
       </group>
</page>

Thanks before...

0
Ảnh đại diện
Huỷ bỏ
Ảnh đại diện
La Jayuhni Yarsyah
Câu trả lời hay nhất

Based on your code  on <page position='inside'> that  means "Put new tags Inside Element <Page> on referenced view (asset.assets_form_view)"

So the result as attached images. because odoo will render xml structure like this
<page string="Info">
    <group>
        <group>
            ******original fields on group top left
        </group>
    </group>
    <group string="Warranty">
        <group>
            *** Original fields on group bottom left
        </group>
        <group>
            *** Original fields on group bottom right
        </group>
    </group>


    <!-- THE APPENDED TAGS by <page position="inside">**TAGS**</page> -->
    <group>
        <field name='serial'>
    </group>
    <group>
        <field name='color'/>
    </group>
    <!-- END -->
</page>


So for you expected result like image that you attached, maybe you can try like this

<xpath expr="//form/sheet/notebook/page/group[1]" position="inside">
    **Appended tags
</xpath>
** Using group[1] or group (depends on referenced structure)

or

<xpath expr="//form/sheet/notebook/page/group[1]/group" position="after">
    **Appended tags
</xpath>

Note:
The expression depends by referenced views,,so you must modify it base on referenced xml view structure (asset.assets_form_view)

You can see the video that referenced by @Cybrosys before
And please learn about \XPATH\ expression\\ \/\ i\nheriting  View ON Odoo.

Regards

1
Ảnh đại diện
Huỷ bỏ
Fazryan Fareka Riznendi
Tác giả

Thanks for response.

I do both examples,

still not as I expected sir.

the example above makes the field in an existing group, it is almost exactly what I want, but rather want to create a new group and be next to the existing group (as in the picture)

La Jayuhni Yarsyah

So for more please post the original view to inherit (asset.assets_form_view)

And your full xml view code , so me or anyone can help more detail,,

Regards..

Fazryan Fareka Riznendi
Tác giả

can it be like this? and which object should I edit?

https://drive.google.com/file/d/1375H_YpkqVBw7FSQb_-BmXCwku-b7NOx/view?usp=sharing

Fazryan Fareka Riznendi
Tác giả

<record model="ir.ui.view" id="asset_asset_form_view">

<field name="name">asset_asset_form</field>

<field name="model">asset.asset</field>

<field name="inherit_id" ref="asset.assets_form_view" />

<field name="arch" type="xml">

<xpath expr="//form/sheet/notebook/page/group" position="inside">

<group>

</group>

<group>

<field name='colour'/>

<field name='machine_number'/>

<field name='chassiss'/>

<field name='fill_in_the_slider'/>

<field name='bpkb_no'/>

<field name='year'/>

</group>

</xpath>

<field name='asset_number' position='replace'>

<field name='asset_number'/>

</field>

<field name='active' position='after'>

<field name='item_type_id' />

</field>

<field name='serial' position='after'>

<field name='many_units' />

</field>

</field>

</record>

La Jayuhni Yarsyah

Can you share screen shoot origin form (before inheriting) ?? i wanna see the structure ,, before it inherited

And i see you wanna inherit form view from module wich named "asset" ,, i try to find the module at odoo source code on github (https://github.com/odoo/odoo/tree/10.0/addons) , but cant find "asset" module. It's your own custom module ??

If it right,, can you share the original form view xml structure...??

La Jayuhni Yarsyah

And What the result looks like , if your xpath like this:

<xpath expr="//form/sheet/notebook/page/group[1]/group[1]" position="after">

<group>

<field name='colour'/>

<field name='machine_number'/>

<field name='chassiss'/>

<field name='fill_in_the_slider'/>

<field name='bpkb_no'/>

<field name='year'/>

</group>

</xpath>

Fazryan Fareka Riznendi
Tác giả

now code like this,

<xpath expr="//form/sheet/notebook/page/group" position="inside">

<group>

</group>

<group>

<field name='colour'/>

<field name='machine_number'/>

<field name='chassiss'/>

<field name='fill_in_the_slider'/>

<field name='bpkb_no'/>

<field name='year'/>

</group>

</xpath>

and result like in image before...

Fazryan Fareka Riznendi
Tác giả

origin like this image https://drive.google.com/file/d/1mTJx570PVSSy8XnLmSwGaX38xmyzx3lS/view

and this for module,

https://apps.odoo.com/apps/modules/10.0/asset/

I just added a new field to the module, because when I tried to add a field directly to the module it couldn't, so I made simple addons for the inheritance

La Jayuhni Yarsyah

I see on that module repository on -> https://github.com/codup/odoo-eam/blob/10.0/asset/asset_view.xml#L72

There's Empty Group Already defined on origin form view, it post wil be rendered on top right of form

So in this case, can you try to put this code:

<xpath expr="//form/sheet/notebook/page/group[1]/group[2]" position="inside">

<field name='colour'/>

<field name='machine_number'/>

<field name='chassiss'/>

<field name='fill_in_the_slider'/>

<field name='bpkb_no'/>

<field name='year'/>

</xpath>

and see the result

Fazryan Fareka Riznendi
Tác giả

Hi La Jayuhni,

Big Thanks, now it's appropriate

Ảnh đại diện
Cybrosys Techno Solutions Pvt.Ltd
Câu trả lời hay nhất

Hi,

If you are looking to inherit and add new custom fields to the model asset.asset , what you have done seems to be fine, if there is an issue in the same, please post the issue or update the question with the error message.

Additional field to existing view

Thanks


1
Ảnh đại diện
Huỷ bỏ
Fazryan Fareka Riznendi
Tác giả

Hello, Thanks for response

there was no error, but the addons field that I added was not in the 'Info' table and grouped there. but instead adds the fields below.

and essentially I want to add fields with new groups next to existing groups,

regards.

Fazryan Fareka Riznendi
Tác giả

if you are confused, you can see this picture for what I mean;

https://drive.google.com/file/d/1mTJx570PVSSy8XnLmSwGaX38xmyzx3lS/view?usp=sharing

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
[SOLVED] How to Hide or Delete Trash Icon in One2many field Đã xử lý
python python2.7 odoo odoo10
Ảnh đại diện
Ảnh đại diện
2
thg 8 25
13029
Filter value 2 field of Many2one
python python2.7 odoo odoo10
Ảnh đại diện
Ảnh đại diện
Ảnh đại diện
5
thg 9 20
7074
Filter field domain one2many to many2one Đã xử lý
python python2.7 odoo odoo10
Ảnh đại diện
Ảnh đại diện
1
thg 12 19
10426
How to calculate the value of results in one2many field
python python2.7 odoo odoo10
Ảnh đại diện
Ảnh đại diện
1
thg 1 19
7255
Generate XLSX(Excel) report in odoo 10 from custom module?
python python2.7 odoo odoo10
Ảnh đại diện
Ảnh đại diện
Ảnh đại diện
2
thg 7 18
15446
Cộng đồng
  • Khóa học
  • Tài liệu
  • Diễn đàn
Open source
  • Tải xuống
  • Github
  • Runbot
  • Dịch thuật
Dịch vụ
  • Lưu trữ Odoo.sh
  • Hỗ trợ
  • Nâng cấp
  • Phát triển tùy chỉnh
  • Đào tạo
  • Tìm kế toán
  • Tìm đối tác
  • Trở thành đối tác
Giới thiệu công ty
  • Công ty của chúng tôi
  • Tài sản thương hiệu
  • Liên hệ
  • Việc làm
  • Sự kiện
  • Podcast
  • Blog
  • Khách hàng
  • Pháp lý • Riêng tư
  • Bảo mật
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo là bộ ứng dụng kinh doanh có open source đáp ứng tất cả các nhu cầu của công ty bạn: CRM, thương mại điện tử, kế toán, tồn kho, POS, quản lý dự án, v.v.

Định hướng giá trị riêng biệt của Odoo là tích hợp hoàn toàn và dễ dàng sử dụng.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now