This question has been flagged
1 Reply
5801 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

Avatar
Discard
Best Answer

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'),
Avatar
Discard

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

Author

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

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

Author

now it works thanks