Odoo Help


Timesheet Activities Invalid XML for View Architecture!'

oussama Lachiheb
on 6/2/13, 12:30 PM 2,408 views

Hi , I'm working on openErp 7.0 ,on the module Timesheet i want to add 2 attributes to the tree view (start_at and end_at) but when updating the module i have the following error message : * Invalid XML for View Architecture!'* would some one tell me what i should correct in the following xml and python code : My XML hr_timesheet_view.xml

<record id="hr_timesheet_line_tree" model="ir.ui.view">
        <field name="name">hr.analytic.timesheet.tree</field>
        <field name="model">hr.analytic.timesheet</field>
        <field name="arch" type="xml">
            <tree editable="top" string="Timesheet Activities" version="7.0">                  
                <field name="date" on_change="on_change_date(date)"/>
                <field name="user_id" on_change="on_change_user_id(user_id)" required="1" options='{"no_open": True}'/>
                <field name="name"/>
                <field domain="[('type','=','normal'),('use_timesheets','=',1)]" name="account_id" context="{'default_use_timesheets': 1, 'default_type': 'contract'}"/>                                        
                <field name="unit_amount" string="Duration" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id)" sum="Total time" widget="float_time"/>                    
                <field name="start_at"/>
                <field name="end_at"/>
                <field name="product_uom_id" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id)" invisible="1"/>
                <field name="journal_id" invisible="1"/>                    
                <field name="amount" sum="Total cost" invisible="1"/>
                <field name="general_account_id" invisible="1"/>
                <field name="product_id" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id)" required="1" domain="[('type','=','service')]" invisible="1"/>

my python code :

class hr_analytic_timesheet(osv.osv):
_name = "hr.analytic.timesheet"
_table = 'hr_analytic_timesheet'
_description = "Timesheet Line"
_inherits = {'account.analytic.line': 'line_id'}
_order = "id desc"
_columns = {
    'line_id': fields.many2one('account.analytic.line', 'Analytic Line', ondelete='cascade', required=True),
    'partner_id': fields.related('account_id', 'partner_id', type='many2one', string='Partner', relation='res.partner', store=True),                


With regards



--Borni DHIFI--
| 6 8 9
Tunis, Tunisia
--Borni DHIFI--

Techno Functional Consultant Odoo(OpenERP) 


Skype : dhifi.borni

On 6/2/13, 6:29 PM


should not modify the original code openerp , if you want add fields must create a

new module :


from osv import osv, fields
class hr_analytic_timesheet(osv.osv):
    _inherit = "hr.analytic.timesheet"
    _columns = {


<?xml version="1.0" encoding="utf-8"?>
        <record model="ir.ui.view" id="hr_timesheet_inherit">
            <field name="name">hr_timesheet_inherit_tree</field>
            <field name="model">hr.analytic.timesheet</field>
            <field name="type">form</field>
            <field name="inherit_id" ref="hr_timesheet.hr_timesheet_line_tree" />
            <field name="arch" type="xml">
                <xpath expr="//field[@name='unit_amount']" position="after">
                    <field name="start_at" />
                    <field name="end_at" />


Another thing to do when modifying code, is to restart the openERP server, than reload the module (Settings -> installed modules -> search for module and click on it -> Click button Upgrade)

on 6/2/13, 6:45 PM

Thank's a lot , it works now :)

oussama Lachiheb
on 6/2/13, 7:37 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.


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

0 follower(s)


Asked: 6/2/13, 12:30 PM
Seen: 2408 times
Last updated: 3/16/15, 8:10 AM