Search code examples
csvodoo-8openerp-7

How to export-import an odoo custom field? Some custom fields are exportable but others not


I had some custom fields at sale.order model:

drupal_order_name = fields.Char('Drupal order name', index=True, readonly=True)
drupal_total = fields.Float('Drupal total', digits_compute= dp.get_precision('Product Price'), help="Total amount from Drupal. Compare this with the total provided by the ERP.", readonly=True)
payment_method = fields.Selection([
                    ('bank_transfer', 'Bank transference'), 
                    ('commerce_cod', 'Bank debit'),
                    ('commerce_stripe', 'Credit/Debit card'), 
                    ('pagamastarde', 'Funded payment'),
                    ('paypal_wps', 'PayPal'),
    ], string='Payment method', index=True, readonly=False)
client_notes = fields.Text('Client notes')

ship_addr_name = fields.Char('Name (shipment)')
ship_addr_phone = fields.Char('Phone number (shipment)')
ship_addr_street = fields.Char('Street (shipment)')
ship_addr_zip = fields.Char('Zip Code (shipment)', index=True)
ship_addr_city = fields.Char('City (shipment)', index=True)
ship_addr_state = fields.Char('State (shipment)', index=True)
ship_addr_country = fields.Char('Country (shipment)', index=True)
ship_addr_extra_info = fields.Char('Extra info (shipment)', index=True)

I can't understand why are ship_addr_* and client_notes importable (I can select them at column options to import values from CSV import wizard) and drupal_order_name, drupal_total, and payment_method are not selectable as field to match with CSV column.

What am I doing wrong? Is there any configuration I have missed?

Similar case I have exporting from (OpenERP7) sale.order state field. I can't select it to export its data.


Solution

  • If we declare field with readonly=True attribute then fields value are not store in database.

    To avoid such problem, remove readonly=True attribute from your field drupal_order_name, drupal_total, and payment_method.

    Afterwards restart Odoo server and upgrade your custom module.