Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
4530 Zobrazení

Hi all,

when i create a closing date in my custom model .it should  add in caledar view with some indication like  leave request  in hr module how to do it via a form ..need a help

Here I attached my code -----

class crm_lead(osv.osv):
    
    _inherit = 'crm.lead'

    _columns = {
            'closing_date':fields.date('Closing Date',required=True),# I want to add this date in openerp calendar view when #form is save
            'walk_thorugh_date': fields.date('Walk-through Date',required=True),
            'tender_no': fields.char('Tender No:')

    }
    
    _defaults={
                'tender_no': lambda obj, cr, uid, context: '',
                
              }
    
    def create(self, cr, uid, vals, context=None):
           vals['tender_no'] = self.pool.get('ir.sequence').get(cr, uid,'crm.lead')
           return super(crm_lead, self).create(cr, uid, vals, context=context)
 
crm_lead()

<record model="ir.ui.view" id="crm_calendar_view_inherit">
    <field name="name">CRM Calendar</field>
    <field name="model">crm.lead</field>
    <field name="inherit_id" ref="crm.crm_case_calendar_view_leads"/>
    <field name="type">calendar</field>
    <field name="arch" type="xml">
    <field name="name" position="after">
       <field name="closing_date" />
    </field>
    </field>
</record>

               

 

   <record id="opertunities_view_inherited" model="ir.ui.view">
                <field name="name">Opertunity view</field>
                <field name="model">crm.lead</field>
                <field name="type">form</field>
                <field name="inherit_id" ref="crm.crm_case_form_view_oppor"/>
                <field name="arch" type="xml">
                    <xpath expr="/form/sheet/group/group/field[@name='phone']" position="after">
                    
                       <group> <field name="closing_date"/>
                        <field name="walk_thorugh_date"/>
                                                        </group>
                    </xpath>
                    
                    
                    <xpath expr="/form/sheet/group/group/field[@name='priority']" position="after">
                    
                    <group>
                    
                     <field name="tender_no" />
                                                             </group>
                    
                    
                    </xpath>
                    
                </field>
                </record>

 

 

Avatar
Zrušit
Nejlepší odpověď

In CRM Module Inherit Calendar view and add closing_date field.

Example,

<record model="ir.ui.view" id="crm_calendar_view_inherit">
    <field name="name">CRM Calendar</field>
    <field name="model">crm.lead</field>
    <field name="inherit_id" ref="crm.crm_case_calendar_view_leads"/>
    <field name="type">calendar</field>
    <field name="arch" type="xml">
    <field name="name" position="after">
       <field name="closing_date" />
    </field>
</record>
    

Avatar
Zrušit
Autor

it is not working in calendar i added your code but not shows in calender pls check my code...

closing_data field is it shows in form view?...

Autor

yes this two fields are showing... in form view

Autor

yes showing in form view

The above inherit calendar here working its shows date in the menu Sales --> Opportunities calendar view shows extra added field.

The above inherit calendar here working its shows date in the menu Sales --> Opportunities calendar view shows extra added field.