1.  Enable the option to show Margins on Sales Orders:
       Sales --> Configuration --> Settings  
     
2.  Add the field via the User Interface:
      Settings --> Technical --> Database Structure --> Fields
      Create
      
The code for the Compute section is:
for record in self:
    if record['amount_total'] > 0: 
        record['x_margin_percentage'] = record['margin'] / record['amount_total']
3. Add the field to the User Interface, by creating a view that inherits and overrides the Odoo Sales Order Form view that adds the margin field:
      Settings --> Technical --> User Interface --> Views
      Create
      
The XML for the Architecture field is:
<field name="margin" position="after">    
    <field name="x_margin_percentage">
</field>
Finished Customization:
