Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

tree issue : unable to edit in place ?

By
Alkivi SAS
on 2/5/14, 6:07 AM 1,226 views

Hi there,

I'm trying to make an editable tree, but after dozain of tries, I'm unable to do so ...

Test I've made :

  • added all the columns of the class in the tree as invisible
  • added/removed readonly attributes from both class/xml
  • various other test

Any pointers would be appreciated :)

xml data :

     <!-- Accounts Search View-->
    <record model="ir.ui.view" id="view_linxo_account_search">
        <field name="name">linxo.account.search</field>
        <field name="model">linxo.account</field>
        <field name="arch" type="xml">
            <search string="Linxo Bank Accounts">
                <field name="name" string="Account"/>
                <field name="account_number" string="Account Number"/>
            </search>
        </field>
    </record>

    <!-- Account Tree View -->
    <record model="ir.ui.view" id="view_linxo_account_tree">
        <field name="name">linxo.account.tree</field>
        <field name="model">linxo.account</field>
        <field name="type">tree</field>
        <field name="test">
            <tree string="Linxo Bank Accounts" editable="bottom">
                <field name="name" />
                <field name="linxo_id" invisible="True" />
                <field name="journal_id" />
                <field name="account_group_name" invisible="True" />
                <field name="account_number" />
                <field name="type" invisible="True" />
            </tree>
        </field>
    </record>

    <!-- Account Action -->
    <record model="ir.actions.act_window" id="action_linxo_account">
        <field name="name">Linxo Bank Accounts</field>
        <field name="res_model">linxo.account</field>
        <field name="view_type">tree</field>
        <field name="view_mode">tree</field>
        <field name="search_view_id" ref="view_linxo_account_search"/>
    </record>

Python data :

class linxo_account(osv.osv):
""" Bank Account stored on Linxo """
_name = "linxo.account"
_description = "Linxo Bank Account"
_columns = {
    'name': fields.char('Account Name', size=120, required=True),
    'linxo_id' : fields.integer('Linxo Account ID', required=True),
    'journal_id': fields.many2one('account.journal', 'OpenERP Journal Id', ondelete='cascade'),
    'account_group_name': fields.char('Account Group Name', size=30, required=True),
    'account_number': fields.char('Account Number', size=30, required=True),
    'type': fields.char('Account Type', size=30, required=True),
}
_sql_constraints = [
    ('name', 'unique(name)', 'The name of the bank account must be unique'),
    ('account_number', 'unique(account_number)', 'The account number must be unique'),
    ('linxo_id', 'unique(linxo_id)', 'The account number must be unique')
]
_order = 'name asc'
linxo_account()
1

Hiral Patel (hip)

--Hiral Patel (hip)--
Tiny ERP Pvt Ltd
http://www.odoo.com
913
| 2 1 5
India
--Hiral Patel (hip)--


Hiral Patel (hip)
On 2/5/14, 9:11 AM

Hello,

Update the xml code :

<record model="ir.ui.view" id="view_linxo_account_search">
        <field name="name">linxo.account.search</field>
        <field name="model">linxo.account</field>
        <field name="arch" type="xml">
            <search string="Linxo Bank Accounts">
                <field name="name" string="Account"/>
                <field name="account_number" string="Account Number"/>
            </search>
        </field>
    </record>

    <!-- Account Tree View -->
    <record model="ir.ui.view" id="view_linxo_account_tree">
        <field name="name">linxo.account.tree</field>
        <field name="model">linxo.account</field>
        <field name="arch" type="xml">
            <tree string="Linxo Bank Accounts" editable="bottom">
                <field name="name" />
                <field name="linxo_id" invisible="True" />
                <field name="journal_id" />
                <field name="account_group_name" invisible="True" />
                <field name="account_number" />
                <field name="type" invisible="True" />
            </tree>
        </field>
    </record>

    <!-- Account Action -->
    <record model="ir.actions.act_window" id="action_linxo_account">
        <field name="name">Linxo Bank Accounts</field>
        <field name="res_model">linxo.account</field>
        <field name="view_type">form</field>
        <field name="view_mode">tree</field>
        <field name="search_view_id" ref="view_linxo_account_search"/>
    </record>

After updating xml, update the module.

Thanks.

Thanks a lot for the reactivity and the correct answer :)

Alkivi SAS
on 2/5/14, 10:29 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

Asked: 2/5/14, 6:07 AM
Seen: 1226 times
Last updated: 3/16/15, 8:10 AM