python - Readonly field is not saving in database in openerp? -


I am using Python and XML to create an OpenerPid module. I have created a module with many fields, all the fields are read-only fields except the customer ID field, when I fill in the customer ID in the customer area, the other fields are filled automatically. But this customer ID field is all in the database The field values ​​do not save.

This will save when all fields are not readable only, it will not save when all fields are read only

What do I need

  1. When I enter the customer ID, other fields should be filled automatically.
  2. All fields except the Customer ID field should be read-only.
  3. All prices must be saved in the database, when click on Save. Can anyone tell me? What should I do?

    Thank you in advance

    You state 'varaible' and especially 'state' For readonly = true, make their required variables. And to change the state to build or write your class.

    Example: Use your variable instead of client_id in the following code

      class archive_details (osv.osv)): _name = "collection.details" _description = "archive Details "('[' 'draft', 'draft sales order'], ('done', 'done'),], 'status', readonly = true, invisible = true, Track_visibility = 'onchange', help = "", select = true), 'client_id': fields.char ('client id', size = 64, read only = true, states = {'draft': [ ('Read only', false)]}}}} _defaults = {'state': 'draft',}   

    Hope this will help you

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -