From 185e9aaea2c53836cb8d435a69d72d4204224fae Mon Sep 17 00:00:00 2001 From: EL HADJI DEM Date: Fri, 14 Feb 2014 16:31:47 -0500 Subject: [PATCH] [IMP] change view presentation of passport --- passport/res_passport.py | 15 ++++++++ passport/res_passport_view.xml | 12 +++---- passport_partner/i18n/fr.po | 38 +++++++++++++++++--- passport_partner/i18n/passport_partner.pot | 36 ++++++++++++++++--- passport_partner/res_partner.py | 28 +++++++++++++++ passport_partner/res_partner_view.xml | 42 ++++++++++++++-------- 6 files changed, 142 insertions(+), 29 deletions(-) diff --git a/passport/res_passport.py b/passport/res_passport.py index da0a9fa3d..c87432ca1 100644 --- a/passport/res_passport.py +++ b/passport/res_passport.py @@ -42,4 +42,19 @@ class res_passport(orm.Model): help="Gender."), } + def name_get(self, cr, uid, ids, context=None): + if context is None: + context = {} + if isinstance(ids, (int, long)): + ids = [ids] + res = [] + reads = self.read(cr, uid, ids, ['name', 'country_id'], context) + + for record in reads: + name = record['name'] + if record['country_id']: + name = record['country_id'][1] + ' | ' + name + res.append((record['id'], name)) + return res + # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/passport/res_passport_view.xml b/passport/res_passport_view.xml index 1069cffc5..9c200a6ff 100644 --- a/passport/res_passport_view.xml +++ b/passport/res_passport_view.xml @@ -26,12 +26,12 @@
- - - - - - + + + + + +
diff --git a/passport_partner/i18n/fr.po b/passport_partner/i18n/fr.po index cda31baa2..8cd21dd24 100644 --- a/passport_partner/i18n/fr.po +++ b/passport_partner/i18n/fr.po @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: OpenERP Server 7.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-01-17 16:33+0000\n" -"PO-Revision-Date: 2014-01-17 11:34-0500\n" +"POT-Creation-Date: 2014-02-05 22:07+0000\n" +"PO-Revision-Date: 2014-02-05 17:09-0500\n" "Last-Translator: EL Hadji DEM \n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -16,26 +16,54 @@ msgstr "" "Plural-Forms: \n" "X-Generator: Poedit 1.5.4\n" +#. module: passport_partner +#: view:res.partner:0 +msgid "Create" +msgstr "Créer" + #. module: passport_partner #: view:res.partner:0 msgid "Passport Details" msgstr "Détails du passeport" +#. module: passport_partner +#: view:res.passport:0 +msgid "or" +msgstr "ou" + +#. module: passport_partner +#: code:addons/passport_partner/res_partner.py:37 +#: code:addons/passport_partner/res_partner.py:38 +#, python-format +msgid "New Passport" +msgstr "Nouveau passeport" + +#. module: passport_partner +#: view:res.passport:0 +msgid "Save and Close" +msgstr "Enregistrer et fermer" + #. module: passport_partner #: field:res.passport,partner_id:0 msgid "Contact" msgstr "Contact" #. module: passport_partner +#: model:ir.actions.act_window,name:passport_partner.action_passport_list #: model:ir.model,name:passport_partner.model_res_passport view:res.partner:0 -#: field:res.partner,passport_ids:0 +#: field:res.partner,passport_ids:0 view:res.passport:0 msgid "Passport" msgstr "Passeport" #. module: passport_partner #: model:ir.model,name:passport_partner.model_res_partner msgid "Partner" -msgstr "Partenaire" +msgstr "Organisme" + +#. module: passport_partner +#: view:res.passport:0 +msgid "Discard" +msgstr "Annuler" #. module: passport_partner #: help:res.passport,partner_id:0 @@ -43,6 +71,6 @@ msgid "Contact." msgstr "Contact." #. module: passport_partner -#: view:res.partner:0 +#: view:res.partner:0 view:res.passport:0 msgid "Owner name (As printed into the passport)" msgstr "Nom du propriétaire (Comme écrit sur le passeport)" diff --git a/passport_partner/i18n/passport_partner.pot b/passport_partner/i18n/passport_partner.pot index ad4a6a67a..caf8492c9 100644 --- a/passport_partner/i18n/passport_partner.pot +++ b/passport_partner/i18n/passport_partner.pot @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: OpenERP Server 7.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-01-17 16:32+0000\n" -"PO-Revision-Date: 2014-01-17 11:32-0500\n" +"POT-Creation-Date: 2014-02-05 22:05+0000\n" +"PO-Revision-Date: 2014-02-05 17:06-0500\n" "Last-Translator: EL Hadji DEM \n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -16,19 +16,42 @@ msgstr "" "Plural-Forms: \n" "X-Generator: Poedit 1.5.4\n" +#. module: passport_partner +#: view:res.partner:0 +msgid "Create" +msgstr "" + #. module: passport_partner #: view:res.partner:0 msgid "Passport Details" msgstr "" +#. module: passport_partner +#: view:res.passport:0 +msgid "or" +msgstr "" + +#. module: passport_partner +#: code:addons/passport_partner/res_partner.py:37 +#: code:addons/passport_partner/res_partner.py:38 +#, python-format +msgid "New Passport" +msgstr "" + +#. module: passport_partner +#: view:res.passport:0 +msgid "Save and Close" +msgstr "" + #. module: passport_partner #: field:res.passport,partner_id:0 msgid "Contact" msgstr "" #. module: passport_partner +#: model:ir.actions.act_window,name:passport_partner.action_passport_list #: model:ir.model,name:passport_partner.model_res_passport view:res.partner:0 -#: field:res.partner,passport_ids:0 +#: field:res.partner,passport_ids:0 view:res.passport:0 msgid "Passport" msgstr "" @@ -37,12 +60,17 @@ msgstr "" msgid "Partner" msgstr "" +#. module: passport_partner +#: view:res.passport:0 +msgid "Discard" +msgstr "" + #. module: passport_partner #: help:res.passport,partner_id:0 msgid "Contact." msgstr "" #. module: passport_partner -#: view:res.partner:0 +#: view:res.partner:0 view:res.passport:0 msgid "Owner name (As printed into the passport)" msgstr "" diff --git a/passport_partner/res_partner.py b/passport_partner/res_partner.py index 8697c64be..60439455b 100644 --- a/passport_partner/res_partner.py +++ b/passport_partner/res_partner.py @@ -21,6 +21,7 @@ ############################################################################## from openerp.osv import orm, fields +from openerp.tools.translate import _ class res_partner(orm.Model): @@ -29,4 +30,31 @@ class res_partner(orm.Model): 'passport_ids': fields.one2many('res.passport', 'partner_id', 'Passport'), } + def action_add_passport_form_view(self, cr, uid, ids, context=None): + """Call action, if there is a contact, put it in the name.""" + ir_model_data = self.pool.get('ir.model.data') + contacts = self.browse(cr, uid, ids, context=context) + contact_name = ('%s : %s ' % (contacts[0].full_name, _('New Passport')) if len(contacts) == 1 else False) + name = contact_name or _('New Passport') + try: + compose_form_id = ir_model_data.get_object_reference(cr, uid, 'passport_partner', 'add_passport_form_view')[1] + except ValueError: + compose_form_id = False + ctx = dict(context) + ctx.update({ + 'default_res_id': ids[0], + 'default_partner_id': ids[0], + }) + return { + 'name': name, + 'type': 'ir.actions.act_window', + 'view_type': 'form', + 'view_mode': 'form', + 'res_model': 'res.passport', + 'views': [(compose_form_id, 'form')], + 'view_id': compose_form_id, + 'target': 'new', + 'context': ctx, + } + # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/passport_partner/res_partner_view.xml b/passport_partner/res_partner_view.xml index 3dac1f5eb..9a5f72af4 100644 --- a/passport_partner/res_partner_view.xml +++ b/passport_partner/res_partner_view.xml @@ -8,28 +8,42 @@ +