Customizing Accounting and finance module in odoo?

南笙酒味 提交于 2019-12-01 02:38:29
Emipro Technologies Pvt. Ltd.

First of all activate Odoo developer Mode, so you can easily get the external ids of any objects.

Activate Odoo Developer Mode

How to know External ID of any object

Open that form and you can see one drop down field on top of the page only if the developer mode is active.

And select option "Edit Form View" from the drop down and you can see the details of that form view like model name, external id of that view and many more.

In your case to inherit this form use "account.invoice_supplier_form" external id of this form, see this image.

To know the External Id of Menu Items,

Go to Settinsgs => Technical => User Interface => Menu Items

Search menu name that you want, open that record and select View Metadata from the debug mode drop down.

How to hide Menu Items:

To hide menu items there is one easiest way is to do this by creating new group (in which only specified user can have access) and assign that group to the menu item while you re-define that menu.

Create one group using xml file this must be first added in __openerp__.py.

<?xml version="1.0" encoding="utf-8"?>
<openerp>
  <data noupdate="1">
    <record id="new_group_id" model="res.groups">
      <field name="name">New Group Name</field>
      <field name="category_id" ref="base.module_category_hidden"/>
      <field name="users" eval="[(4, ref('base.user_root'))]"/>
    </record>
  </data>
</openerp>

And create another xml file in which is update that menu item with that xml code.

<record id="account.menu_action_tax_code_tree" model="ir.ui.menu">
  <field name="groups_id" eval="[(6, 0, [ref('new_group_id')] )]"/>
</record>

Another way is to do this from UI, directly assign that newly created group to menu items Go to Settings => Technical => User Interface => Menu Items (it's rollback while module will be upgrade in which that menu item defines).

How to hide fields in existing view

TO hide/add any fields in the existing form you must be inherit that view first and find that field using xpath or direct field and assign attributes to hide that field.

Example:

<record id="new_id" model="ir.ui.view">
  <field name="name">New.name</field>
  <field name="inherit_id" ref="account.invoice_supplier_form" />
  <field name="model">account.invoice</field>
  <field name="arch" type="xml">
    <data>
    <!-- path according to the fields that you want to hide from tree -->
      <xpath expr="/form/sheet/notebook/page/field[@name='line_cr_ids']/tree/field[@name='account_id']" position="attributes">
        <attribute name="invisible">True/1</attribute>
      </xpath>

      <field name="tax_line" position="attributes">
        <attribute name="invisible">True/1</attribute>
      </field>
    </data>
  </field>
</record>
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!