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

invalid xml architecture?

By
David Brilliant
on 9/20/13, 12:29 PM 1,286 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

--Keyur--
1165
| 4 4 8
Ahmedabad, India
--Keyur--

Odoo Expert

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

--Ray Carnes--
15717
| 9 7 9
Greater Los Angeles, United States
--Ray Carnes--

Senior Odoo Analyst

OpenERP 6.1, 7.0 and Odoo 8.0, 9.0 (Since 2012)

Completed Functional and Technical Training.

Major Skills:

  • Needs Discovery and Requirements Analysis;

  • Function and Technical Specifications;

  • Project Planning;

  • Prototyping and Proof of concepts;

  • Data migration;

  • Configuration & Customization (UI and modules);

  • Integration - data, business logic and service levels;

  • Training and Knowledge transfer;

  • Go Live support;

  • Help desk;

  • Version Migration.

I have over 20 years of experience empowering and enabling users with enterprise information systems that make a real and measurable difference in their ability to proactively manage their businesses and organizations. 

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

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

1 follower(s)

Stats

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