Use selection widget in create chart wizard for issue1394

It breaks the record rules if user create company from this wizard and it is
not allow to create chart template so selection widget prevent this
Add default value for company
This commit is contained in:
Cédric Krier
2010-02-23 11:52:06 +01:00
parent 6d40e5c1af
commit 797310f8ef
2 changed files with 9 additions and 2 deletions
+7
View File
@@ -1746,6 +1746,13 @@ class CreateChartAccountAccount(ModelView):
account_template = fields.Many2One('account.account.template',
'Account Template', required=True, domain=[('parent', '=', False)])
def default_company(self, cursor, user, context=None):
if context is None:
context = {}
if context.get('company'):
return context['company']
return False
CreateChartAccountAccount()
+2 -2
View File
@@ -461,9 +461,9 @@ this repository contains the full copyright notices and license terms. -->
<![CDATA[
<form string="Create Chart of Account" col="2">
<label name="company"/>
<field name="company"/>
<field name="company" widget="selection"/>
<label name="account_template"/>
<field name="account_template"/>
<field name="account_template" widget="selection"/>
</form>
]]>
</field>