OpenERP can not save the readonly field in sale order

Asked by Abdellatif Benzbiria

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

Question information

Language:
English Edit question
Status:
Expired
For:
Fleet manager Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Abdellatif Benzbiria (abenzbiria) said :
#1

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

Revision history for this message
Launchpad Janitor (janitor) said :
#2

This question was expired because it remained in the 'Open' state without activity for the last 15 days.