Odoo Help

0

invalid xml architecture?

By
David Brilliant
on 9/20/13, 12:29 PM 1,591 views

I've been wrangling with this annoying bug for a week. Its really hacking me off.

I'm trying to inherit the Account_Voucher class, and modify the existing wizard with a few extra buttons so our sales guys can validate credit cards before accepting payment. code follows:

<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>
    <record id="novak_custom_payment_view" model="ir.ui.view">
        <field name="name">account.voucher.novak</field>
        <field name="model">account.voucher</field>
        <field name="inherit_id" ref="account_voucher.view_vendor_receipt_dialog_form" />
            <field name="arch" type="xml">
                <field name="journal_id" position="after">
                <field name="card_number" string="card number" />
            </field>
        </field>
    </record>
    </data>
</openerp>

Removing the Inherit_id field allows the module to install, but fails to insert the fields after the journal_id field.

Help! I'm on a work deadline!

0
David Brilliant
On 9/23/13, 5:05 PM

I needed to create the database entries in the _columns variable, so the solution was to make a .py file and insert the following:

_columns={'card_number']: fields.char('credit card number', size=256, help="CC Number")}

Thanks ray and crew!

0
Keyur
On 9/21/13, 7:10 AM

Hi David,

I think the problem is in view architecture.

There are total two </field> & </field> tags which are closed. You just have to remove one of them (</field>) & then it will work.

0
Ray Carnes
On 9/20/13, 3:36 PM

Does your module depend on account_voucher?

UPDATE: Code snippet:

# -*- coding: utf-8 -*- 

from openerp.osv import fields, osv

class custom_account_voucher(osv.osv):

    _inherit = 'account.voucher'

    _columns = {
        'card_number':fields.char('Card Number', size=16, readonly=True, 
                                   states={'draft':[('readonly',False)]}),
    }

# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

from the __openerp__.py: 'depends': ['base','account_voucher'],

David Brilliant
on 9/20/13, 5:15 PM

Comment out the record tag and install your module. Is card_number shown in Settings --> Technical --> Database Structure --> Models when you look at the list of fields for the account.voucher model.

Bista Solutions US, Ray Carnes
on 9/20/13, 6:02 PM

it does not, should I add it from there?

David Brilliant
on 9/20/13, 6:14 PM

If the model is not showing your field, then it hasn't been defined properly (or at all) in your custom python class. If you add it via the database UI, it will only be available in that database. It would be better to create the field via python. I've edited my answer to provide a code snippet.

Bista Solutions US, Ray Carnes
on 9/20/13, 9:04 PM

About This Community

This platform 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.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 9/20/13, 12:29 PM
Seen: 1591 times
Last updated: 3/16/15, 8:10 AM