I have an entity with 2 fields payment (manetary) and its currency. The currency_id field in the view displays a list of all possible currencies. How can I set domain to the curency_id field so the user only will be able to select two possible currencies? In this case the options would be: US Dollar (USD) and Dominican Peso (DOP)
payment = fields.Monetary(string='Payment',currency_field='currency_id')
currency_id = fields.Many2one('res.currency', string='Currency', required=True)
And in the view:
<field name="payment"/>
<field name="currency_id"/>
You need to add domain on currency_id
field. Name
field available on res.currency
object to find desire currency.
Try with following code:
currency_id = fields.Many2one(
'res.currency',
string='Currency',
required=True,
domain=[('name', 'in', ('USD', 'DOP'))])