← Back to team overview

savoirfairelinux-openerp team mailing list archive

[Merge] lp:~savoirfairelinux-openerp/openerp-hr/unique_code into lp:openerp-hr

 

Sandy Carter (http://www.savoirfairelinux.com) has proposed merging lp:~savoirfairelinux-openerp/openerp-hr/unique_code into lp:openerp-hr.

Requested reviews:
  HR Core Editors (hr-core-editors)

For more details, see:
https://code.launchpad.net/~savoirfairelinux-openerp/openerp-hr/unique_code/+merge/196184

Added a unique constraint for department codes per company.
Added a get_name option to display code instead of name in many2one form selection fields using context="{'show_code': True}"
Added french locale

-- 
https://code.launchpad.net/~savoirfairelinux-openerp/openerp-hr/unique_code/+merge/196184
Your team Savoir-faire Linux' OpenERP is subscribed to branch lp:~savoirfairelinux-openerp/openerp-hr/unique_code.
=== modified file 'hr_department_sequence/hr_department.py'
--- hr_department_sequence/hr_department.py	2013-09-23 13:55:07 +0000
+++ hr_department_sequence/hr_department.py	2013-11-21 19:23:27 +0000
@@ -37,3 +37,17 @@
     _parent_store = True
     _parent_order = 'sequence, name'
     _order = 'parent_left'
+    _sql_constraints = [
+        ('code_uniq', 'unique(code, company_id)', 'The code for the department must be unique per company !'),
+    ]
+
+    def name_get(self, cr, uid, ids, context=None):
+        """
+        Show department code instead of name with:
+        <field name="department_id" context="{'show_code': True}"/>
+        """
+        if not context.get('show_code'):
+            return super(hr_department, self).name_get(cr, uid, ids, context=context)
+        if isinstance(ids, (int, long)):
+            ids = [ids]
+        return [(record.id, record.code) for record in self.browse(cr, uid, ids, context=context or {})]

=== added directory 'hr_department_sequence/i18n'
=== added file 'hr_department_sequence/i18n/fr.po'
--- hr_department_sequence/i18n/fr.po	1970-01-01 00:00:00 +0000
+++ hr_department_sequence/i18n/fr.po	2013-11-21 19:23:27 +0000
@@ -0,0 +1,52 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+# 	* hr_department_sequence
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 7.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2013-11-21 19:08+0000\n"
+"PO-Revision-Date: 2013-11-21 14:12-0500\n"
+"Last-Translator: Sandy Carter <sandy.carter@xxxxxxxxxxxxxxxxxxxx>\n"
+"Language-Team: Savoir-faire Linux <http://www.savoirfairelinux.com>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Generator: Poedit 1.5.7\n"
+"Language: fr\n"
+
+#. module: hr_department_sequence
+#: field:hr.department,parent_left:0
+msgid "Left Parent"
+msgstr "Parent de gauche"
+
+#. module: hr_department_sequence
+#: field:hr.department,code:0
+msgid "Code"
+msgstr "Code"
+
+#. module: hr_department_sequence
+#: field:hr.department,sequence:0
+msgid "Sequence"
+msgstr "Séquence"
+
+#. module: hr_department_sequence
+#: help:hr.department,sequence:0
+msgid "Gives the sequence order when displaying a list of departments."
+msgstr "Donne l'ordre dans la liste des départements."
+
+#. module: hr_department_sequence
+#: sql_constraint:hr.department:0
+msgid "The code for the department must be unique per company !"
+msgstr "Le code d'un département doit être unique par compagnie !"
+
+#. module: hr_department_sequence
+#: model:ir.model,name:hr_department_sequence.model_hr_department
+msgid "Department"
+msgstr "Département"
+
+#. module: hr_department_sequence
+#: field:hr.department,parent_right:0
+msgid "Right Parent"
+msgstr "Parent de droite"

=== added file 'hr_department_sequence/i18n/hr_department_sequence.pot'
--- hr_department_sequence/i18n/hr_department_sequence.pot	1970-01-01 00:00:00 +0000
+++ hr_department_sequence/i18n/hr_department_sequence.pot	2013-11-21 19:23:27 +0000
@@ -0,0 +1,52 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+#	* hr_department_sequence
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 7.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2013-11-21 19:08+0000\n"
+"PO-Revision-Date: 2013-11-21 19:08+0000\n"
+"Last-Translator: <>\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: \n"
+"Plural-Forms: \n"
+
+#. module: hr_department_sequence
+#: field:hr.department,parent_left:0
+msgid "Left Parent"
+msgstr ""
+
+#. module: hr_department_sequence
+#: field:hr.department,code:0
+msgid "Code"
+msgstr ""
+
+#. module: hr_department_sequence
+#: field:hr.department,sequence:0
+msgid "Sequence"
+msgstr ""
+
+#. module: hr_department_sequence
+#: help:hr.department,sequence:0
+msgid "Gives the sequence order when displaying a list of departments."
+msgstr ""
+
+#. module: hr_department_sequence
+#: sql_constraint:hr.department:0
+msgid "The code for the department must be unique per company !"
+msgstr ""
+
+#. module: hr_department_sequence
+#: model:ir.model,name:hr_department_sequence.model_hr_department
+msgid "Department"
+msgstr ""
+
+#. module: hr_department_sequence
+#: field:hr.department,parent_right:0
+msgid "Right Parent"
+msgstr ""
+


Follow ups