Skip to Content
मेन्यू
This question has been flagged
1 Reply
4879 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()
Avatar
Discard
Best Answer

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.

Avatar
Discard
Author

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

Related Posts Replies Views Activity
2
दिस॰ 23
20967
1
मार्च 15
12114
0
मार्च 15
4036
1
मार्च 15
11018
2
अक्तू॰ 24
12630