Jam.py documentation

select_records

select_records(field_name, all_records)

domain: client

language: javascript

class Item class

Description

Use the select_records method to add records to an item by selecting them from the lookup item of a field.

For example, this method is used in the Demo application to add tracks to an invoice by selecting them from Tracks catalog.

Parameters:

  • The field_name parameter is a field name of a lookup field of the item

  • If the all_records parameter is set to true, all selected records are added, otherwise the method omits existing records (they were selected earlier).

Example

function on_view_form_created(item) {
    var btn = item.add_view_button('Select', {type: 'primary'});
    btn.click(function() {
        item.select_records('track');
    });
}