← Back to team overview

openerp-community-reviewer team mailing list archive

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

 

You have been requested to review the proposed merge of lp:~savoirfairelinux-openerp/openerp-hr/unique_code into lp:openerp-hr.

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 name_search and name_get as '[CODE] Department name'
Added french locale

-- 
https://code.launchpad.net/~savoirfairelinux-openerp/openerp-hr/unique_code/+merge/196184
Your team HR Core Editors is requested to review the proposed merge of lp:~savoirfairelinux-openerp/openerp-hr/unique_code into lp:openerp-hr.
=== 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-12-03 19:24:38 +0000
@@ -37,3 +37,20 @@
     _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 with name
+        """
+        if isinstance(ids, (int, long)):
+            ids = [ids]
+        return [(record.id, '[%s] %s' % (record.code, record.name) if record.code else record.name)
+                for record in self.browse(cr, uid, ids, context=context or {})]
+
+    def name_search(self, cr, uid, name='', args=None, operator='ilike',  context=None, limit=100):
+        ids = self.search(cr, uid, ['|', ('code', 'ilike', name), ('name', 'ilike', name)] + args,
+                          limit=limit, context=context)
+        return self.name_get(cr, uid, ids, context=context)

=== 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-12-03 19:24:38 +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-12-03 19:24:38 +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 ""
+


References