Odoo Help


Hiding delivery prices that has 0.0 sale value [Closed]

on 9/18/13, 10:05 AM 2,009 views

The Question has been closed

on 12/19/2013 09:35:22
     am using V6.1 on windows

I am trying to use the delivery pricing methods on OpenERP and I have been able to use it but I would like to hide any delivery carrier that has a price of 0.0 in the sales order. So when delivery cost is selected in Sales order only carriers with price greater than 0.0 shows up in the drop-down list of the pop-up so that the sales person doesn't select a 0 delivery price by mistake. Can anyone help on this please? Thank you in advance.

def get_price(self, cr, uid, ids, field_name, arg=None, context=None):
    if context is None:
        context = {}
    for carrier in self.browse(cr, uid, ids, context=context):
        if order_id:
          order = sale_obj.browse(cr, uid, order_id, context=context)
          if carrier_grid:
              price=grid_obj.get_price(cr, uid, carrier_grid, order, time.strftime('%Y-%m-%d'), context)
              price = 0.0
#              attrs="{'invisible':[('carrier_id','!=',carrier_grid.carrier_id)]}
  #            carrier_id (invisible=True)
    return res

I would like to make the carrier invisible if price is 0.0

you should set the rules in attrs dict it will be better should set at the xml part so that you can easily debug the program try it!

Abhishek H Menon
on 9/18/13, 11:03 AM

am not trying to hide a field, I am trying to hide some rows in the list. where the price is 0, so that the sales person does not select the wrong delivery price

on 9/18/13, 2:05 PM

Cyril Gaspard (GEM)

--Cyril Gaspard (GEM)--

| 5 6 8
Paris, France
--Cyril Gaspard (GEM)--

Forum contributor since 2008

Cyril Gaspard (GEM)
On 11/14/13, 9:27 AM


in xml file tree section, just use domain with attribute

domain="[('your_field', '!=', "0")]"


Thanks but this did not work.

on 11/15/13, 3:58 AM

I am trying to hide delivery carriers that do not have a price to go to a destination. This carriers usually display a value of 0.0 when delivery price is computed on sales order

on 11/15/13, 4:04 AM

Try to change in domain 0 by "0" or "0.0".

Cyril Gaspard (GEM)
on 11/16/13, 8:32 PM

Thanks a lot GEM, you are right and gave me the direction to what I needed to do or at least an alternative to what I was trying to achieve. The 0.0 prices still get displayed but it comes up with an error message and is not added to the sales order line. PS I added the code to the window action

on 12/18/13, 9:26 AM

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: 9/18/13, 10:05 AM
Seen: 2009 times
Last updated: 3/16/15, 8:10 AM