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

State statusbar in form view alligns left

By
Kris Coenen
on 8/29/13, 12:30 PM 1,781 views

I've added alternet statusbar in the form view for helpdesk. The Statusbar works perfactly but it is alligned to the left after the buttuns and not on the right side of the header how do i solve this. Here is my code

helpdesk.py

from openerp.osv import osv, fields

class helpdesk(osv.Model):

_inherit = 'crm.helpdesk'

_columns = {
    'category' : fields.selection([('opsturen','Opsturen'),('ter_plaatse','Ter plaatse herstellen')],'categorie',states={'draft': [('readonly', False)], 'verwacht': [('readonly', True)], 'inplannen': [('readonly', True)], 'toegekomen': [('readonly', True)], 'ingepland': [('readonly', True)], 'offerte': [('readonly', True)], 'afgekeurd': [('readonly', True)], 'pending': [('readonly', True)], 'hersteld': [('readonly', True)], 'done': [('readonly', True)], 'cancel': [('readonly', True)]}),
    'dienst' : fields.many2one('sn_helpdesk.dienst','Dienst'),
    'state': fields.selection((('draft','Concept'),('verwacht','Toestel wordt verwacht'),('inplannen','Inplannen technieker'),('toegekomen','Toestel toegekomen'),('ingepland','Technieker ingepland'),('offerte','Offerte'),('afgekeurd','Afgekeurd'),('pending','In herstelling'),('hersteld','Hersteld'),('afgeleverd','Afgeleverd'),('factuur','Factureren'),('done','afgehandeld'),('cancel','geannuleerd')),'status helpdesk'),
    'offerte_id': fields.many2one('sale.order','offerte'),
    'invoice_id': fields.many2one('account.invoice','factuur'),
    'calendar_id': fields.many2one('crm.meeting','inplannen', states={'draft': [('invisible', True)], 'verwacht': [('invisible', True)], 'inplannen': [('invisible', False)], 'toegekomen': [('invisible', True)], 'ingepland': [('invisible', False)], 'offerte': [('invisible', False)], 'afgekeurd': [('invisible', False)], 'pending': [('invisible', False)], 'hersteld': [('invisible', False)], 'done': [('invisible', False)], 'cancel': [('invisible', False)]}),
    'tel_from': fields.char('Telefoon'),
    }

helpdesk()

helpdesk.xml

<?xml version="1.0" encoding="UTF-8"?>

<openerp> <data>

    <record id="base_helpdesk_category_view" model="ir.ui.view">
        <field name="name">helpdesk categorie</field>
        <field name="model">crm.helpdesk</field>
        <field name="inherit_id" ref="crm_helpdesk.crm_case_form_view_helpdesk"/>
        <field name="arch" type="xml">

            <header position="replace">

                <button string="toestel verwacht" type="object" name="action_helpdesk_verwacht" class="oe_highlight" states="draft"/>
                <button string="technieker inplannen" type="object" name="action_helpdesk_inplannen" class="oe_highlight" states="draft"/>
                <button string="toegekomen" type="object" name="action_helpdesk_toegekomen" class="oe_highlight" states="verwacht"/>
                <button string="technieker ingepland" type="object" name="action_helpdesk_ingepland" class="oe_highlight" states="inplannen"/>
                <button string="Offerte" type="object" name="action_helpdesk_offerte" class="oe_highlight" states="toegekomen,ingepland"/>
                <button string="In herstelling" type="object" name="action_helpdesk_herstelling" class="oe_highlight" states="offerte"/>
                <button string="hersteld" type="object" name="action_helpdesk_hersteld" class="oe_highlight" states="pending"/>
                <button string="Afgeleverd" type="object" name="action_helpdesk_afgeleverd" class="oe_highlight" states="hersteld"/>
                <button string="Factureren" type="object" name="action_helpdesk_factureer" class="oe_highlight" states="afgeleverd"/>
                <button string="Afgehandeld" type="object" name="action_helpdesk_done" class="oe_highlight" states="factuur"/>
                <button string="terug naar Concept" type="object" name="action_helpdesk_draft" class="oe_highlight" states="cancel"/>

                <button string="annuleren" type="object" name="action_helpdesk_annuleren" states="draft,verwacht,inplannen,toegekomen,ingepland,offerte,afgekeurd,pending,hersteld,afgeleverd,done"/>


                <field name="state" nolabel="1" widget="statusbar" statusbar_visible="draft,offerte,done"/>
            </header>


            <field name="channel_id" position="after">
                <field name="category"/>
            </field>

            <field name="section_id" position="replace">
                <field name="dienst"/>
                <field name="offerte_id" states="toegekomen,ingepland,offerte,pending,hersteld,afgeleverd,done"/>
                <field name="invoice_id" states="hersteld,afgeleverd,done"/>
            </field>

            <field name="partner_id" position="replace">
                <field name="partner_id" on_change="onchange_partner_id_helpdesk(partner_id,email_from,tel_from)"/>
            </field>

            <field name="email_from" position="after">µ
                <field name="tel_from"/>
                <field name="calendar_id"/>
            </field>

        </field>
    </record>

</data>

</openerp>

how do i resolve the issue with the statusbar

sincerily

Kris

1
ZEeineb
On 8/30/13, 7:26 AM

Hi Kris,

Try to do so:

in your xml file:

<xpath expr="//form/sheet" position="before">
        <header>
            <button string="toestel verwacht" type="object"
            name="action_helpdesk_verwacht" class="oe_highlight" states="draft" />
            <button string="technieker inplannen" type="object"
            name="action_helpdesk_inplannen" class="oe_highlight" states="draft" />
            <button string="toegekomen" type="object"
            name="action_helpdesk_toegekomen" class="oe_highlight" states="verwacht" />
            <button string="technieker ingepland" type="object"
            name="action_helpdesk_ingepland" class="oe_highlight" states="inplannen" />
            <button string="Offerte" type="object" name="action_helpdesk_offerte"
            class="oe_highlight" states="toegekomen,ingepland" />
            <button string="In herstelling" type="object"
            name="action_helpdesk_herstelling" class="oe_highlight" states="offerte" />
            <button string="hersteld" type="object" name="action_helpdesk_hersteld"
            class="oe_highlight" states="pending" />
            <button string="Afgeleverd" type="object"
            name="action_helpdesk_afgeleverd" class="oe_highlight" states="hersteld" />
            <button string="Factureren" type="object"
            name="action_helpdesk_factureer" class="oe_highlight" states="afgeleverd" />
            <button string="Afgehandeld" type="object" name="action_helpdesk_done"
            class="oe_highlight" states="factuur" />
            <button string="terug naar Concept" type="object"
            name="action_helpdesk_draft" class="oe_highlight" states="cancel" />
            <button string="annuleren" type="object" name="action_helpdesk_annuleren"  states="draft,verwacht,inplannen,toegekomen,ingepland,offerte,afgekeurd,pending,hersteld,afgeleverd,done" />
            <field name="state" nolabel="1" widget="statusbar" statusbar_visible="draft,offerte,done" />
        </header>
</xpath>

in your python file:

'state': fields.selection([
                            ('draft', 'Concept'),
                            ('verwacht', 'Toestel wordt verwacht'),
                            ('inplannen', 'Inplannen technieker'),
                            ('toegekomen', 'Toestel toegekomen'),
                            ('ingepland', 'Technieker ingepland'),
                            ('offerte', 'Offerte')
                            , ('afgekeurd', 'Afgekeurd'),
                            ('pending', 'In herstelling'),
                            ('hersteld', 'Hersteld'),
                            ('afgeleverd', 'Afgeleverd'),
                            ('factuur', 'Factureren'),
                            ('done', 'afgehandeld'),
                            ('cancel', 'geannuleerd'), ], 'status helpdesk'),

See more at: [http://www.zbeanztech.com/blog/tags-used-openerp-70#sthash.VfgiA

ZEeineb
on 8/30/13, 7:26 AM

Didn't work for me statusbar is still on the left

ANALYS4IT, Kris Coenen
on 9/4/13, 11:57 AM

Hi Kris , I have edited the answer . Try to follow it. I hope it works now.

ZEeineb
on 9/6/13, 7:27 PM

now it works thanks

ANALYS4IT, Kris Coenen
on 9/10/13, 11:02 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

1 follower(s)

Stats

Asked: 8/29/13, 12:30 PM
Seen: 1781 times
Last updated: 3/16/15, 8:10 AM