[FIX] payment: do not rely on English as default language

If the database is create in monolangue and `en_US` is not present, the default
value computation crashes as tries to assign a value not present in the
selection (all installed languages).

Use the environment language as default (same as the default of res.partner).
It may be empty but not a value not existant in the database.

Fixes #15165 
Closes #15176
This commit is contained in:
George Daramouskas
2017-01-23 12:07:14 +01:00
committed by Martin Trigaux
parent bcc517b6eb
commit 5a992857b8
2 changed files with 12 additions and 1 deletions
+1 -1
View File
@@ -429,7 +429,7 @@ class PaymentTransaction(models.Model):
# duplicate partner / transaction data to store the values at transaction time
partner_id = fields.Many2one('res.partner', 'Partner', track_visibility='onchange')
partner_name = fields.Char('Partner Name')
partner_lang = fields.Selection(_lang_get, 'Language', default='en_US')
partner_lang = fields.Selection(_lang_get, 'Language', default=lambda self: self.env.lang)
partner_email = fields.Char('Email')
partner_zip = fields.Char('Zip')
partner_address = fields.Char('Address')
+11
View File
@@ -0,0 +1,11 @@
Greece, 2017-01-22
I hereby agree to the terms of the Odoo Individual Contributor License
Agreement v1.0.
I declare that I am authorized and able to make this agreement and sign this
declaration.
Signed,
George Daramouskas george.daramouskas@gmail.com https://github.com/daramousk