Hi how to change odoo 12 view.xml to add more column, or add something in the module? i trying to create odoo 12 module from scratch using command like this
& "c:\Program Files (x86)\Odoo 12.0\python\python.exe" "C:\Program Files (x86)\Odoo 12.0\server\odoo-bin" scaffold ms_produk "C:\Program Files (x86)\Odoo 12.0\server\odoo\addons"
then my base project generated, and then i trying to add model named "produk.py" in models folder which is look like this :
# -*- coding: utf-8 -*-
from odoo import models, fields, api
class ProdukProduk(models.Model):
_name = 'ms_produk.ms_produk'
kd_produk = fields.Char(String='Kode Produk', required=True)
nm_produk = fields.Char(String='Nama Produk', required=True)
then in the same folder i edit files named init.py and add an import, which is looked like this :
# -*- coding: utf-8 -*-
from . import models
from . import produk
then i add a view for my module, i go to views folder and add a file named master_produk_view.xml then i add some code that looked like this :
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<data>
<record id="masterproduk_menu_action" model="ir.actions.act_window">
<field name="name">Master Produk</field>
<field name="res_model">ms_produk.ms_produk</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">Create Product
</p>
</field>
</record>
<menuitem id="masterproduk_menu" name="MasterProduk"/>
<menuitem id="Masterproduk_new_product_menu"
parent="masterproduk_menu"
name="New Produk"
action="masterproduk_menu_action"/>
</data>
</odoo>
booms, and my module is complete with CRUD action, but when i looked at the view, it's not showing all of my database column, only showing ID column, which is i think it should showing kd_produk and nm_produk column, how do i change this?
i trying to modified the view xml code to be looked like this :
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<data>
<record id="masterproduk_menu_action" model="ir.actions.act_window">
<field name="name">Master Produk</field>
<field name="res_model">ms_produk.ms_produk</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="arch" type="xml">
<tree>
<field name="kd_produk"/>
<field name="nm_produk"/>
</tree>
</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">Create Product
</p>
</field>
</record>
<menuitem id="masterproduk_menu" name="MasterProduk"/>
<menuitem id="Masterproduk_new_product_menu"
parent="masterproduk_menu"
name="New Produk"
action="masterproduk_menu_action"/>
</data>
</odoo>
and nothing happened, it still showing ID column only, which is drive me nuts, i already restart my odoo server, upgrade the module in apps option, what did i missed here?