[FIX] base: set current company as default for currency rates
When manually creating/importing a currency rate, there is no default on the company_id field. This is quite unfortunate, as rates are filtered by company then by date, which means that a rate without company will never be taken into account despite being newer. This filter makes sense for multi company setups, but for mono-company setups this is quite annoying. This commit adds a default on the company_id and adds a view for the base_currency_rate model to only display the company field in multi company settings.
This commit is contained in:
@@ -282,6 +282,7 @@ class res_currency_rate(osv.osv):
|
||||
}
|
||||
_defaults = {
|
||||
'name': lambda *a: time.strftime('%Y-%m-%d 00:00:00'),
|
||||
'company_id': lambda s, cr, uid, ctx=None: s.pool['res.users']._get_company(cr, uid, context=ctx)
|
||||
}
|
||||
_order = "name desc"
|
||||
|
||||
|
||||
@@ -23,6 +23,28 @@
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_currency_rate_form" model="ir.ui.view">
|
||||
<field name="name">res.currency.rate.form</field>
|
||||
<field name="model">res.currency.rate</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Currency Rate">
|
||||
<sheet>
|
||||
<group>
|
||||
<group>
|
||||
<field name="name"/>
|
||||
<field name="rate"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="currency_id"/>
|
||||
<field name="company_id" groups="base.group_multi_company"/>
|
||||
</group>
|
||||
|
||||
</group>
|
||||
</sheet>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<act_window
|
||||
id="act_view_currency_rates"
|
||||
name="Currency Rates"
|
||||
|
||||
Reference in New Issue
Block a user