Browse Source

[FIX] Combined passport and passport_partner into passport, removed redundant view changes, general cleanup

pull/2/head
Sandy Carter 11 years ago
parent
commit
6b7d1343fd
  1. 5
      passport/__init__.py
  2. 12
      passport/__openerp__.py
  3. 60
      passport/i18n/fr.po
  4. 53
      passport/i18n/passport.pot
  5. 16
      passport/res_partner.py
  6. 17
      passport/res_partner_view.xml
  7. 48
      passport/res_passport.py
  8. 6
      passport/res_passport_view.xml
  9. 24
      passport_partner/__init__.py
  10. 57
      passport_partner/__openerp__.py
  11. 76
      passport_partner/i18n/fr.po
  12. 76
      passport_partner/i18n/passport_partner.pot
  13. 60
      passport_partner/res_partner.py
  14. 49
      passport_partner/res_partner_view.xml

5
passport/__init__.py

@ -2,7 +2,7 @@
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2013 Savoir-faire Linux
# This module copyright (C) 2013-2014 Savoir-faire Linux
# (<http://www.savoirfairelinux.com>).
#
# This program is free software: you can redistribute it and/or modify
@ -21,5 +21,4 @@
##############################################################################
from . import res_passport
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
from . import res_partner

12
passport/__openerp__.py

@ -2,7 +2,7 @@
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2013 Savoir-faire Linux
# This module copyright (C) 2013-2014 Savoir-faire Linux
# (<http://www.savoirfairelinux.com>).
#
# This program is free software: you can redistribute it and/or modify
@ -26,6 +26,7 @@
'author': 'Savoir-faire Linux',
'maintainer': 'Savoir-faire Linux',
'website': 'http://www.savoirfairelinux.com',
'license': 'AGPL-3',
'category': 'Customer Relationship Management',
'description': """
Passport Management
@ -34,19 +35,16 @@ Passport Management
Contributors
------------
* El Hadji Dem (elhadji.dem@savoirfairelinux.com)
* Sandy Carter (sandy.carter@savoirfairelinux.com)
""",
'depends': [
'base',
],
'depends': [],
'external_dependencies': {},
'data': [
'res_passport_view.xml',
"res_partner_view.xml",
'security/ir.model.access.csv',
],
'demo': [],
'test': [],
'installable': True,
'active': False,
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

60
passport/i18n/fr.po

@ -6,15 +6,26 @@ msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 7.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-01-17 16:27+0000\n"
"PO-Revision-Date: 2014-01-17 11:30-0500\n"
"Last-Translator: EL Hadji DEM <elhadji.dem@savoirfairelinux.com>\n"
"POT-Creation-Date: 2014-02-24 23:40+0000\n"
"PO-Revision-Date: 2014-02-24 18:47-0500\n"
"Last-Translator: Sandy Carter <sandy.carter@savoirfairelinux.com>\n"
"Language-Team: \n"
"Language: fr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: \n"
"X-Generator: Poedit 1.5.4\n"
"X-Generator: Poedit 1.6.4\n"
#. module: passport
#: help:res.passport,country_id:0
msgid "Country of deliverance."
msgstr "Pays émetteur."
#. module: passport
#: help:res.passport,birth_date:0
msgid "Date of birth on passport."
msgstr "Date de naissance sur le passeport."
#. module: passport
#: help:res.passport,gender:0
@ -23,7 +34,8 @@ msgstr "Sexe."
#. module: passport
#: model:ir.actions.act_window,name:passport.action_passport_tree_list
#: model:ir.model,name:passport.model_res_passport
#: model:ir.model,name:passport.model_res_passport view:res.partner:0
#: field:res.partner,passport_ids:0
msgid "Passport"
msgstr "Passeport"
@ -42,10 +54,15 @@ msgstr "Nom du propriétaire"
msgid "Gender"
msgstr "Sexe"
#. module: passport
#: field:res.passport,number:0
msgid "Passport No"
msgstr "No du passeport"
#. module: passport
#: help:res.passport,expiration_date:0
msgid "Expiration date."
msgstr "Date d'expiration."
msgid "Expiration date of passport."
msgstr "Date d'expiration sur le passeport."
#. module: passport
#: view:res.passport:0
@ -53,15 +70,21 @@ msgid "PassportTree"
msgstr "PassportTree"
#. module: passport
#: view:res.passport:0
msgid "Owner name (As printed into the passport)"
msgstr "Nom du propriétaire (Comme écrit sur le passeport)"
#: code:addons/passport/res_partner.py:39
#, python-format
msgid "New Passport"
msgstr "Nouveau passeport"
#. module: passport
#: view:res.passport:0
msgid "PassportForm"
msgstr "PassportForm"
#. module: passport
#: field:res.passport,partner_id:0
msgid "Contact"
msgstr "Contact"
#. module: passport
#: help:res.passport,number:0
msgid "Passport number."
@ -78,14 +101,9 @@ msgid "Owner name (As printed into the passport)."
msgstr "Nom du propriétaire (Comme écrit sur le passeport)."
#. module: passport
#: field:res.passport,number:0
msgid "Passport No"
msgstr "No du passeport"
#. module: passport
#: help:res.passport,birth_date:0
msgid "Birth Date."
msgstr "Date de naissance."
#: model:ir.model,name:passport.model_res_partner
msgid "Partner"
msgstr "Organisme"
#. module: passport
#: selection:res.passport,gender:0
@ -93,9 +111,9 @@ msgid "Male"
msgstr "Homme"
#. module: passport
#: help:res.passport,country_id:0
msgid "Delivery country."
msgstr "Pays de délivrance."
#: view:res.passport:0
msgid "Owner name (As printed into the passport)"
msgstr "Nom du propriétaire (Comme écrit sur le passeport)"
#. module: passport
#: field:res.passport,expiration_date:0

53
passport/i18n/passport.pot

@ -1,20 +1,29 @@
# Translation of OpenERP Server.
# This file contains the translation of the following modules:
# * passport
# * passport
#
msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 7.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-01-17 16:26+0000\n"
"PO-Revision-Date: 2014-01-17 11:26-0500\n"
"Last-Translator: EL Hadji DEM <elhadji.dem@savoirfairelinux.com>\n"
"POT-Creation-Date: 2014-02-24 23:40+0000\n"
"PO-Revision-Date: 2014-02-24 23:40+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
"X-Generator: Poedit 1.5.4\n"
#. module: passport
#: help:res.passport,country_id:0
msgid "Country of deliverance."
msgstr ""
#. module: passport
#: help:res.passport,birth_date:0
msgid "Date of birth on passport."
msgstr ""
#. module: passport
#: help:res.passport,gender:0
@ -24,6 +33,8 @@ msgstr ""
#. module: passport
#: model:ir.actions.act_window,name:passport.action_passport_tree_list
#: model:ir.model,name:passport.model_res_passport
#: view:res.partner:0
#: field:res.partner,passport_ids:0
msgid "Passport"
msgstr ""
@ -42,9 +53,14 @@ msgstr ""
msgid "Gender"
msgstr ""
#. module: passport
#: field:res.passport,number:0
msgid "Passport No"
msgstr ""
#. module: passport
#: help:res.passport,expiration_date:0
msgid "Expiration date."
msgid "Expiration date of passport."
msgstr ""
#. module: passport
@ -53,8 +69,9 @@ msgid "PassportTree"
msgstr ""
#. module: passport
#: view:res.passport:0
msgid "Owner name (As printed into the passport)"
#: code:addons/passport/res_partner.py:39
#, python-format
msgid "New Passport"
msgstr ""
#. module: passport
@ -62,6 +79,11 @@ msgstr ""
msgid "PassportForm"
msgstr ""
#. module: passport
#: field:res.passport,partner_id:0
msgid "Contact"
msgstr ""
#. module: passport
#: help:res.passport,number:0
msgid "Passport number."
@ -78,13 +100,8 @@ msgid "Owner name (As printed into the passport)."
msgstr ""
#. module: passport
#: field:res.passport,number:0
msgid "Passport No"
msgstr ""
#. module: passport
#: help:res.passport,birth_date:0
msgid "Birth Date."
#: model:ir.model,name:passport.model_res_partner
msgid "Partner"
msgstr ""
#. module: passport
@ -93,8 +110,8 @@ msgid "Male"
msgstr ""
#. module: passport
#: help:res.passport,country_id:0
msgid "Delivery country."
#: view:res.passport:0
msgid "Owner name (As printed into the passport)"
msgstr ""
#. module: passport

16
passport_partner/res_passport.py → passport/res_partner.py

@ -1,8 +1,8 @@
# -*- encoding: utf-8 -*-
###############################################################################
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2013 Savoir-faire Linux
# This module copyright (C) 2013-2014 Savoir-faire Linux
# (<http://www.savoirfairelinux.com>).
#
# This program is free software: you can redistribute it and/or modify
@ -18,14 +18,14 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
###############################################################################
##############################################################################
from openerp.osv import fields, orm
from openerp.osv import orm, fields
class res_passport(orm.Model):
"""Add contact"""
_inherit = 'res.passport'
class res_partner(orm.Model):
_inherit = 'res.partner'
_columns = {
'partner_id': fields.many2one('res.partner', 'Contact', help="Contact."),
'passport_ids': fields.one2many(
'res.passport', 'partner_id', 'Passport'),
}

17
passport/res_partner_view.xml

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_partner_form" model="ir.ui.view">
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<notebook position="inside">
<page string="Passport" attrs="{'invisible': [('is_company','=',True)]}">
<field name="passport_ids" nolabel="1"/>
</page>
</notebook>
</field>
</record>
</data>
</openerp>

48
passport/res_passport.py

@ -2,7 +2,7 @@
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2013 Savoir-faire Linux
# This module copyright (C) 2013-2014 Savoir-faire Linux
# (<http://www.savoirfairelinux.com>).
#
# This program is free software: you can redistribute it and/or modify
@ -27,34 +27,30 @@ class res_passport(orm.Model):
_description = 'Passport'
_name = 'res.passport'
_columns = {
'name': fields.char('Owner name', size=256, select=True,
help='Owner name (As printed into the passport).'),
'number': fields.char('Passport No', size=50,
help='Passport number.'),
'country_id': fields.many2one('res.country', 'Delivery country',
help="Delivery country."),
'expiration_date': fields.date('Expiration date',
help="Expiration date."),
'birth_date': fields.date('Birth Date', help="Birth Date."),
'gender': fields.selection([('male', 'Male'),
('female', 'Female')],
'Gender',
help="Gender."),
'name': fields.char(
'Owner name', help='Owner name (As printed into the passport).'),
'number': fields.char(
'Passport No', size=50, help='Passport number.'),
'country_id': fields.many2one(
'res.country', 'Delivery country', help="Country of deliverance."),
'expiration_date': fields.date(
'Expiration date', help="Expiration date of passport."),
'birth_date': fields.date('Birth Date',
help="Date of birth on passport."),
'gender': fields.selection(
[('male', 'Male'),
('female', 'Female')],
'Gender', help="Gender."),
'partner_id': fields.many2one('res.partner', 'Contact'),
}
def name_get(self, cr, uid, ids, context=None):
if context is None:
context = {}
if isinstance(ids, (int, long)):
if type(ids) in (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))
for res_passport in self.browse(cr, uid, ids, context=context):
name = res_passport.name
if res_passport.country_id and res_passport.country_id.name:
name = '%s | %s' % (res_passport.country_id.name, name)
res.append((res_passport.id, name))
return res
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

6
passport/res_passport_view.xml

@ -8,12 +8,10 @@
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="PassportTree" version="7.0">
<field name="name"/>
<field name="number"/>
<field name="country_id"/>
<field name="number"/>
<field name="expiration_date"/>
<field name="gender"/>
<field name="birth_date"/>
<field name="name"/>
</tree>
</field>
</record>

24
passport_partner/__init__.py

@ -1,24 +0,0 @@
# -*- encoding: utf-8 -*-
###############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2013 Savoir-faire Linux
# (<http://www.savoirfairelinux.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
###############################################################################
from . import res_passport
from . import res_partner

57
passport_partner/__openerp__.py

@ -1,57 +0,0 @@
# -*- encoding: utf-8 -*-
###############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2013 Savoir-faire Linux
# (<http://www.savoirfairelinux.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
###############################################################################
{
'name': 'Passport Management - Partners Bindings',
'version': '0.1',
'author': 'Savoir-faire Linux',
'maintainer': 'Savoir-faire Linux',
'website': 'http://www.savoirfairelinux.com',
'license': 'AGPL-3',
'category': 'Customer Relationship Management',
'summary': 'Partner Multi Passport',
'description': """
Passport Management - Partners Bindings
=======================================
This module allows you to manage several passports for each contact.
Contributors
------------
* El Hadji Dem (elhadji.dem@savoirfairelinux.com)
""",
'depends': [
'passport'
],
'external_dependencies': {
'python': [],
},
'data': [
"res_partner_view.xml",
],
'demo': [],
'test': [],
'installable': True,
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

76
passport_partner/i18n/fr.po

@ -1,76 +0,0 @@
# Translation of OpenERP Server.
# This file contains the translation of the following modules:
# * passport_partner
#
msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 7.0\n"
"Report-Msgid-Bugs-To: \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 <elhadji.dem@savoirfairelinux.com>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"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 view:res.passport:0
msgid "Passport"
msgstr "Passeport"
#. module: passport_partner
#: model:ir.model,name:passport_partner.model_res_partner
msgid "Partner"
msgstr "Organisme"
#. module: passport_partner
#: view:res.passport:0
msgid "Discard"
msgstr "Annuler"
#. module: passport_partner
#: help:res.passport,partner_id:0
msgid "Contact."
msgstr "Contact."
#. module: passport_partner
#: 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)"

76
passport_partner/i18n/passport_partner.pot

@ -1,76 +0,0 @@
# Translation of OpenERP Server.
# This file contains the translation of the following modules:
# * passport_partner
#
msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 7.0\n"
"Report-Msgid-Bugs-To: \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 <elhadji.dem@savoirfairelinux.com>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"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 view:res.passport:0
msgid "Passport"
msgstr ""
#. module: passport_partner
#: model:ir.model,name:passport_partner.model_res_partner
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.passport:0
msgid "Owner name (As printed into the passport)"
msgstr ""

60
passport_partner/res_partner.py

@ -1,60 +0,0 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2013 Savoir-faire Linux
# (<http://www.savoirfairelinux.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from openerp.osv import orm, fields
from openerp.tools.translate import _
class res_partner(orm.Model):
_inherit = 'res.partner'
_columns = {
'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:

49
passport_partner/res_partner_view.xml

@ -1,49 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_passport_partner_form" model="ir.ui.view">
<field name="name">passport.partner.form.inherit</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<notebook position="inside">
<page string="Passport" attrs="{'invisible': ['|','|',('is_company','=',True),('contact_id','!=',False)]}">
<button string="Create" name="action_add_passport_form_view" type="object" class="oe_highlight"/>
<field name="passport_ids" nolabel="1">
<tree string="Passport Details" create="false" version="7.0">
<field name="country_id"/>
<field name="number"/>
<field name="expiration_date"/>
<field name="name"/>
</tree>
</field>
</page>
</notebook>
</field>
</record>
<!-- Form Views passport-contact-->
<record model="ir.ui.view" id="add_passport_form_view">
<field name="name">Passport Form View</field>
<field name="model">res.passport</field>
<field name="arch" type="xml">
<form string="Passport" version="7.0">
<group col="4">
<field name="country_id"/>
<field name="name" string="Owner name (As printed into the passport)"/>
<field name="number"/>
<field name="gender"/>
<field name="expiration_date"/>
<field name="birth_date"/>
<field name="partner_id" invisible="1"/>
</group>
<footer attrs="{'invisible': [('partner_id','=',False)]}">
<button string="Save and Close" name="_" type="action" class="oe_highlight" accesskey="C"/>
or
<button string="Discard" class="oe_link" special="cancel" accesskey="D"/>
</footer>
</form>
</field>
</record>
</data>
</openerp>
Loading…
Cancel
Save