Skip to content

Instantly share code, notes, and snippets.

@gkliska
Created February 7, 2014 20:38
Show Gist options
  • Save gkliska/8871312 to your computer and use it in GitHub Desktop.
Save gkliska/8871312 to your computer and use it in GitHub Desktop.
Naming convention for OpenERP exists but it is unlikely that it will be enforced in our lifetime.
We can start with this dict as starting point:
def _get_field_map(self, cr, uid, context=None):
return {
'sale_order': {
'lines_field': 'order_line',
'lines_obj': 'sale.order.line',
'curr_date': ['date_order', 'now'],
'date': ['date_order'],
},
'sale_order_line': {
'uom': ['uom_id', 'product_uom', 'product_uos'],
'qty': ['quantity', 'product_uom_qty', 'product_uos_qty'],
'price': ['price_unit', ],
'header_field': 'order_id',
},
'purchase_order': {
'lines_field': 'order_line',
'lines_obj': 'purchase.order.line',
'curr_date': ['date_order', 'now'],
},
'purchase_order_line': {
'uom': ['uom_id', 'product_uom'],
'qty': ['quantity', 'product_qty'],
'price': ['price_unit', ],
'header_field': 'order_id',
},
'stock_picking': {
'lines_field': 'move_lines',
'lines_obj': 'stock.move',
'curr_date': ['date', 'now'],
},
'stock_move': {
'uom': ['uom_id', 'product_uom', 'product_uos'],
'qty': ['quantity', 'product_uom_qty', 'product_uos_qty'],
'price': ['price_unit', ],
'currency': ['price_currency_id', ],
'base_uom_qty': ['product_qty', ],
'other': ['remaining_qty', 'unassigned_qty'],
'header_field': 'picking_id',
},
'account_invoice': {
'lines_field': 'invoice_line',
'lines_obj': 'account.invoice.line',
'curr_date': ['date_invoice', 'now'],
},
'account_invoice_line': {
'uom': ['uom_id', 'uos_id', ],
'qty': ['quantity', ],
'price': ['price_unit', ],
'header_field': 'invoice_id',
},
'procurement_order': {
'uom': ['uom_id', 'product_uom', 'product_uos'],
'qty': ['quantity', 'product_qty', 'product_uos_qty'],
},
'stock_warehouse_orderpoint': {
'uom': ['uom_id', 'product_uom'],
'other': ['product_min_qty', 'product_max_qty'],
},
'product_supplierinfo': {
'uom': ['uom_id', 'product_uom'],
'other': ['qty', 'min_qty'],
},
'stock_inventory_line': {
'uom': ['uom_id', 'product_uom'],
'qty': ['quantity', 'product_qty'],
'price': ['force_price_unit', ],
'other': ['th_qty'],
},
'account_move_line': {
'uom': ['uom_id', 'product_uom_id'],
'qty': ['quantity', 'debit_qty', 'credit_qty'],
'value': ['debit', 'credit'],
'currency': ['currency_id', ],
},
'account_analytic_line': {
'uom': ['uom_id', 'product_uom_id'],
'qty': ['quantity', 'unit_amount'],
'value': ['amount', 'amount_currency'],
'currency': ['currency_id', ],
},
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment