Please review this at http://codereview.appspot.com/2247042/

Affected files:
  M trytond/ir/ir.xml
  M trytond/ir/lang.xml
  M trytond/model/modelsql.py


Index: trytond/ir/ir.xml
===================================================================
--- a/trytond/ir/ir.xml
+++ b/trytond/ir/ir.xml
@@ -3,6 +3,19 @@
 this repository contains the full copyright notices and license terms. -->
 <tryton>
     <data>
+
+        <!--
+        lang_en is defined here to be in translation lang selection
+        -->
+        <record model="ir.lang" id="lang_en">
+            <field name="code">en_US</field>
+            <field name="name">English</field>
+            <field name="date">%m/%d/%Y</field>
+            <field name="grouping">[]</field>
+            <field name="decimal_point">.</field>
+            <field name="thousands_sep">,</field>
+        </record>
+
         <menuitem name="Administration" id="menu_administration"
             icon="tryton-preferences-system"/>
     </data>
Index: trytond/ir/lang.xml
===================================================================
--- a/trytond/ir/lang.xml
+++ b/trytond/ir/lang.xml
@@ -22,14 +22,9 @@
             <field name="decimal_point">,</field>
             <field name="thousands_sep">.</field>
         </record>
-        <record model="ir.lang" id="lang_en">
-            <field name="code">en_US</field>
-            <field name="name">English</field>
-            <field name="date">%m/%d/%Y</field>
-            <field name="grouping">[]</field>
-            <field name="decimal_point">.</field>
-            <field name="thousands_sep">,</field>
-        </record>
+        <!--
+        lang_en is defined in ir.xml
+        -->
         <record model="ir.lang" id="lang_es">
             <field name="code">es_ES</field>
             <field name="name">Spanish (Spain)</field>
Index: trytond/model/modelsql.py
===================================================================
--- a/trytond/model/modelsql.py
+++ b/trytond/model/modelsql.py
@@ -384,6 +384,12 @@

         Transaction().create_records.setdefault(self._name,
set()).add(id_new)

+        for field in values:
+            if getattr(self._columns[field], 'translate', False):
+                self.pool.get('ir.translation')._set_ids(
+                        self._name + ',' + field, 'model',
+                        Transaction().language, [id_new], values[field])
+
         upd_todo.sort(lambda x, y: self._columns[x].priority - \
                 self._columns[y].priority)
         for field in upd_todo:



-- 
Cédric Krier

B2CK SPRL
Rue de Rotterdam, 4
4000 Liège
Belgium
Tel: +32 472 54 46 59
Email/Jabber: [email protected]
Website: http://www.b2ck.com/

Attachment: pgpCUhZXCJ5W7.pgp
Description: PGP signature

Reply via email to