Odoo Help

7 Answers

Ivan Elizaryev

--Ivan Elizaryev--
| 4 3 7
Ufa, Russian Federation
--Ivan Elizaryev--

I tried odoo at the end of 2013. I fell in love in it and have been working with odoo as a freelancer for almost two years. In September 2015 I began operate as a Company and have 5 developers for now.

Ivan, March 2016.

Ivan Elizaryev
6/15/14, 8:53 AM

You can modify web client to fit your needs. You can inject some javascript code in OpenERP, which will do things you described. Also, you probably should make some modifications via python code.


Here you can find some example. It overwrite the write function to check changes in the state field. If some conditions is not passed it raises warning and doesn't allows to make such changes. I think this approach doesn't allow to raise widget with a form you need. I can suggest another simple solution: add button to a kanban card, which will raise widget and if user will move state and some conditions is not passed show to him warning "Click button ... before moving to new state"

    def write(self, vals):
        if 'stage_id' in vals:
            new_stage = self.env['crm.case.stage'].browse(vals['stage_id'])
            for r in self:
                res = r.try_update_stage(new_stage)[0]
                if res.get('warning'):
                    raise exceptions.Warning(res.get('warning'))
        result = super(crm_lead, self).write(vals)
        return result 

1/12/15, 3:45 AM

Hi how we can write the python function ......... can you provide some example

Ivan Elizaryev
1/12/15, 4:12 AM

@Soohoo try to find information about how to write modules in odoo


Leonardo Donelli

--Leonardo Donelli--
| 5 4 8
Roma, Italy
--Leonardo Donelli--

Physics student and part-time developer.

Leonardo Donelli
1/12/15, 11:26 AM

If you want to automatically open a wizard/popup or another window when a kanban card is moved, you'll have to modify the web client, which is usually not easy and not recommended.

I was in a similar situation where I created a kanban view for sale orders based on the "expected delivery week". So if a sale order was having some problems in production, the user could just move the card to the next week. The idea was originally to open a wizard when the card was moved to send a mail alerting the customer of the change of the date, so similar to what you want to do, but we quickly discovered it was not possible without modifying the client code of Odoo.

We ended up using two field "previously agreed delivery week" and "expected delivery week". When the user moves the kanban the "expected delivery week" is changed, and when "expected delivery week" and "previously agreed delivery week" are different, it shows a button "alert customer of change" which opens the wizard to send the email.

You could try to work around the problem in a similar fashion. For example, in the kanban view, you could show a "Insert closing information" button/link when the state = closed, so that when an user drags a card to the closed column the link will appear. It will not be automatic (the user will have to remember to click the link to open the wizard instead of having it opens automatically) but I think it's a good compromise.



Ray Carnes (ray)

--Ray Carnes (ray)--
| 3 2 6
Greater Los Angeles, United States
--Ray Carnes (ray)--

Business Analyst - Custom Projects


Ray Carnes (ray)
3/16/19, 12:26 AM

This can easily be achieved with an Automated Action that 'listens' to the update of the record being moved.

It can check that certain data is populated, and can prevent movement if the conditions in the Automated Action are not met.

Example Python Code you can use:

stage_new = 'New'
stage_opp = 'Opportunities'
stage_gath = 'Requirements'
stage_eng = 'Scoping'
stage_pqc = 'Pending Quotation'
stage_pca = 'Customer Approval'
stage_pma = 'Manager Approval'
stage_ver = 'Verbally Approved'
stage_po = 'Purchase Order'
stage_app = 'Approved Orders'
stage_tm = 'T & M'
stage_hand = 'Project Handoff'
stage_done = 'Completed'

# Require Project 
if record.stage_id.name in [stage_gath,stage_eng, stage_pqc, stage_pca, stage_pma, stage_ver, stage_po, stage_app, stage_tm, stage_hand, stage_done] and not record.x_project: 
raise Warning('Please create a Project for this Opportunity!')

# Opportunity cannot be moved into Project Handoff OR Completed.
if record.stage_id.name in [stage_hand, stage_done]:   
needs_warning = False   
for quote in record.order_ids:      
if quote.state not in ['sale','done','cancel']:          
needs_warning = True   
if needs_warning:       
raise Warning('Please confirm or cancel each Quote before moving!')

Note: This does not require development of a module.  Automated Actions can be created within Odoo like another other record. 

Ask a Question
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