For your first question you can overwrite the name_get method in the model that you have a m2o relation with and configure the concatenation string as you like. See the bellow example
def name_get(self):
return [(record.id, record.name) for record in self]
Fleet module example link
@api.depends('name', 'brand_id')
def name_get(self):
res = []
for record in self:
name = record.name
if record.brand_id.name:
name = record.brand_id.name + '/' + name
res.append((record.id, name))
return res
or make a new computed field with your string. See the below example from odoo product category link
class ProductCategory(models.Model):
_name = "product.category"
#...
_rec_name = 'complete_name'
_order = 'complete_name'
name = fields.Char('Name', index=True, required=True)
complete_name = fields.Char(
'Complete Name', compute='_compute_complete_name',
store=True)
#...
@api.depends('name', 'parent_id.complete_name')
def _compute_complete_name(self):
for category in self:
if category.parent_id:
category.complete_name = '%s / %s' % (category.parent_id.complete_name, category.name)
else:
category.complete_name = category.
For the second question you can read the data like so. See the below example form website_sale module link
<div t-attf-class="form-group #{error.get('country_id') and 'o_has_error' or ''} col-lg-6 div_country">
<label class="col-form-label" for="country_id">Country</label>
<select id="country_id" name="country_id" t-attf-class="form-control #{error.get('country_id') and 'is-invalid' or ''}">
<option value="">Country...</option>
<t t-foreach="countries" t-as="c">
<option t-att-value="c.id" t-att-selected="c.id == (country and country.id or -1)">
<t t-esc="c.name" />
</option>
</t>
</select>
</div>