OpenERP can not save the readonly field in sale order

Bug #881974 reported by Abdellatif Benzbiria

This bug report was converted into a question: question #177080: OpenERP can not save the readonly field in sale order.

6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Fleet manager
Invalid
Undecided
Unassigned

Bug Description

Salam ,

In a sale order line, I try to make price_unit readonly for certain group , so to do this :
1- I created 2 groups : Sales / Readonly price unit & Sales / Write price unit
2- I used fields_get to redfine rights access like this :
  if group.name == 'Sales / Readonly price unit':
                        res[field].setdefault('states', {})
                        res[field]['states']['draft'] = [('readonly', False)]

                    if group.name == 'Sales / Write price unit':
                        res[field].setdefault('states', {})
                        res[field]['states']['draft'] = [('readonly', False)]

Everything works fine except that by recording the sale order the unit price is set by default to 0.00 for users who have the readonly group.

Thanks for your help

Revision history for this message
Abdellatif Benzbiria (abenzbiria) wrote :

if group.name == 'Sales / Readonly price unit':
                        res[field].setdefault('states', {})
                        res[field]['states']['draft'] = [('readonly', True)]

Changed in fleetmanager:
status: New → Invalid
Revision history for this message
Andrea Garcia (andrea-garcia) wrote :

Readonly works to achieve save when you call a function or field from any resulting estimates and calls a function. For example 'amount_tax': fields.function(_amount_all, string='Taxes', digits_compute=dp.get_precision('Point Of Sale'), multi='all'),

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.