Set party lang as a configuration option

This commit is contained in:
Nicolas Évrard
2011-03-29 15:17:39 +02:00
parent c0eb2ed70d
commit 5f488eaffc
3 changed files with 10 additions and 0 deletions
+3
View File
@@ -14,5 +14,8 @@ class Configuration(ModelSingleton, ModelSQL, ModelView):
('company', 'in', [Eval('company'), False]),
('code', '=', 'party.party'),
], required=True))
party_lang = fields.Property(fields.Many2One("ir.lang", 'Party Language',
help=('The value set on this field will preset the language on new '
'parties')))
Configuration()
+2
View File
@@ -11,6 +11,8 @@ this repository contains the full copyright notices and license terms. -->
<form string="Party Configuration">
<label name="party_sequence"/>
<field name="party_sequence"/>
<label name="party_lang" />
<field name="party_lang" widget="selection" />
</form>
]]>
</field>
+5
View File
@@ -87,6 +87,11 @@ class Party(ModelSQL, ModelView):
'write_uid', 'write_date'])
return [address_obj.default_get(fields_names)]
def default_lang(self):
config_obj = self.pool.get('party.configuration')
config = config_obj.browse(1)
return config.party_lang.id
def on_change_with_vat_code(self, vals):
return (vals.get('vat_country') or '') + (vals.get('vat_number') or '')