Browse Source
Merge pull request #359 from grindtildeath/10_migration_partner_sequence
Merge pull request #359 from grindtildeath/10_migration_partner_sequence
[MIG][10.0] base_partner_sequencepull/355/merge
Pedro M. Baeza
8 years ago
committed by
GitHub
14 changed files with 282 additions and 157 deletions
-
84base_partner_sequence/README.rst
-
28base_partner_sequence/__init__.py
-
65base_partner_sequence/__manifest__.py
-
9base_partner_sequence/data/partner_sequence.xml
-
21base_partner_sequence/i18n/base_partner_sequence.pot
-
31base_partner_sequence/i18n/fi.po
-
31base_partner_sequence/i18n/it.po
-
7base_partner_sequence/models/__init__.py
-
64base_partner_sequence/models/partner.py
-
21base_partner_sequence/partner_sequence.xml
-
20base_partner_sequence/partner_view.xml
-
7base_partner_sequence/tests/__init__.py
-
35base_partner_sequence/tests/test_base_partner_sequence.py
-
16base_partner_sequence/views/partner_view.xml
@ -0,0 +1,84 @@ |
|||||
|
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg |
||||
|
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html |
||||
|
:alt: License: AGPL-3 |
||||
|
|
||||
|
===================== |
||||
|
Base Partner Sequence |
||||
|
===================== |
||||
|
|
||||
|
This module adds the possibility to define a sequence for |
||||
|
the partner's reference. This reference is then set as default |
||||
|
when you create a new partner, using the defined sequence. |
||||
|
|
||||
|
The reference field is treated as a commercial field, i.e. it |
||||
|
is managed from the commercial partner and then propagated to |
||||
|
the partner's contacts. The field is visible on the contacts, |
||||
|
but it can only be modified from the commercial partner. |
||||
|
|
||||
|
No references are assigned for contacts such as shipping and |
||||
|
invoice addresses. |
||||
|
|
||||
|
Installation |
||||
|
============ |
||||
|
|
||||
|
There are no special instructions regarding installation. |
||||
|
|
||||
|
Configuration |
||||
|
============= |
||||
|
|
||||
|
No configuration is needed. |
||||
|
|
||||
|
Usage |
||||
|
===== |
||||
|
|
||||
|
To use this module, you need to: |
||||
|
|
||||
|
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas |
||||
|
:alt: Try me on Runbot |
||||
|
:target: https://runbot.odoo-community.org/runbot/134/10.0 |
||||
|
|
||||
|
|
||||
|
Bug Tracker |
||||
|
=========== |
||||
|
|
||||
|
Bugs are tracked on `GitHub Issues |
||||
|
<https://github.com/OCA/partner-contact/issues>`_. In case of trouble, please |
||||
|
check there if your issue has already been reported. If you spotted it first, |
||||
|
help us smashing it by providing a detailed and welcomed feedback. |
||||
|
|
||||
|
Credits |
||||
|
======= |
||||
|
|
||||
|
Images |
||||
|
------ |
||||
|
|
||||
|
* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_. |
||||
|
|
||||
|
Contributors |
||||
|
------------ |
||||
|
|
||||
|
* Thomas Rehn <thomas.rehn@initos.com> |
||||
|
* Stefan Rijnhart <stefan@therp.nl> |
||||
|
* Yannick Vaucher <yannick.vaucher@camptocamp.com> |
||||
|
* Sandy Carter <sandy.carter@savoirfairelinux.com> |
||||
|
* Laurent Mignon (ACSONE) <laurent.mignon@acsone.eu> |
||||
|
* Guewen Baconnier <guewen.baconnier@camptocamp.com> |
||||
|
* Alexandre Fayolle <alexandre.fayolle@camptocamp.com> |
||||
|
* Vicent Cubells <vicent.cubells@tecnativa.com> |
||||
|
* Akim Juillerat <akim.juillerat@camptocamp.com> |
||||
|
|
||||
|
|
||||
|
Maintainer |
||||
|
---------- |
||||
|
|
||||
|
.. image:: https://odoo-community.org/logo.png |
||||
|
:alt: Odoo Community Association |
||||
|
:target: https://odoo-community.org |
||||
|
|
||||
|
This module is maintained by the OCA. |
||||
|
|
||||
|
OCA, or the Odoo Community Association, is a nonprofit organization whose |
||||
|
mission is to support the collaborative development of Odoo features and |
||||
|
promote its widespread use. |
||||
|
|
||||
|
To contribute to this module, please visit https://odoo-community.org. |
@ -1,22 +1,8 @@ |
|||||
# -*- encoding: utf-8 -*- |
|
||||
############################################################################## |
|
||||
# |
|
||||
# OpenERP, Open Source Management Solution |
|
||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). |
|
||||
# |
|
||||
# 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/>. |
|
||||
# |
|
||||
############################################################################## |
|
||||
|
# -*- coding: utf-8 -*- |
||||
|
# Copyright 2004-2009 Tiny SPRL (<http://tiny.be>). |
||||
|
# Copyright 2013 initOS GmbH & Co. KG (<http://www.initos.com>). |
||||
|
# Copyright 2016 Tecnativa - Vicent Cubells |
||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
||||
|
|
||||
from . import partner |
|
||||
|
from . import models |
||||
|
from . import tests |
@ -1,54 +1,27 @@ |
|||||
# -*- encoding: utf-8 -*- |
|
||||
############################################################################## |
|
||||
# |
|
||||
# OpenERP, Open Source Management Solution |
|
||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). |
|
||||
# Copyright (C) 2013 initOS GmbH & Co. KG (<http://www.initos.com>). |
|
||||
# Author Thomas Rehn <thomas.rehn at initos.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/>. |
|
||||
# |
|
||||
############################################################################## |
|
||||
|
# -*- coding: utf-8 -*- |
||||
|
# Copyright 2004-2009 Tiny SPRL (<http://tiny.be>). |
||||
|
# Copyright 2013 initOS GmbH & Co. KG (<http://www.initos.com>). |
||||
|
# Copyright 2016 Tecnativa - Vicent Cubells |
||||
|
# Copyright 2016 Camptocamp - Akim Juillerat (<http://www.camptocamp.com>). |
||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
||||
{ |
{ |
||||
|
"author": "Tiny/initOS GmbH & Co. KG," |
||||
|
"ACSONE SA/NV," |
||||
|
"Tecnativa, " |
||||
|
"Odoo Community Association (OCA), " |
||||
|
"Camptocamp, ", |
||||
"name": "Add a sequence on customers' code", |
"name": "Add a sequence on customers' code", |
||||
"version": "8.0.1.1.0", |
|
||||
"author": "Tiny/initOS GmbH & Co. KG,Odoo Community Association (OCA)", |
|
||||
|
"version": "10.0.1.0.0", |
||||
"category": "Generic Modules/Base", |
"category": "Generic Modules/Base", |
||||
"website": "http://www.initos.com", |
"website": "http://www.initos.com", |
||||
"depends": ["base"], |
|
||||
|
"depends": [ |
||||
|
'base', |
||||
|
], |
||||
"summary": "Sets customer's code from a sequence", |
"summary": "Sets customer's code from a sequence", |
||||
"description": """ |
|
||||
This module adds the possibility to define a sequence for |
|
||||
the partner code. This code is then set as default when you |
|
||||
create a new commercial partner, using the defined sequence. |
|
||||
|
|
||||
The reference field is treated as a commercial field, i.e. it |
|
||||
is managed from the commercial partner and then propagated to |
|
||||
the partner's contacts. The field is visible on the contacts, |
|
||||
but it can only be modified from the commercial partner. |
|
||||
|
|
||||
No codes are assigned for contacts such as shipping and |
|
||||
invoice addresses. |
|
||||
This module is a migration of the original base_partner_sequence |
|
||||
addon to OpenERP version 7.0. |
|
||||
""", |
|
||||
"data": [ |
"data": [ |
||||
'partner_sequence.xml', |
|
||||
'partner_view.xml', |
|
||||
|
'data/partner_sequence.xml', |
||||
|
'views/partner_view.xml', |
||||
], |
], |
||||
"demo": [], |
|
||||
"active": False, |
|
||||
'installable': False |
|
||||
|
"installable": True, |
||||
|
"license": "AGPL-3", |
||||
} |
} |
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
|
@ -0,0 +1,9 @@ |
|||||
|
<?xml version="1.0"?> |
||||
|
<odoo noupdate="1"> |
||||
|
<record model="ir.sequence" id="seq_res_partner"> |
||||
|
<field name="name">Partner code</field> |
||||
|
<field name="code">res.partner</field> |
||||
|
<field name="prefix">P/</field> |
||||
|
<field name="padding">5</field> |
||||
|
</record> |
||||
|
</odoo> |
@ -1,21 +0,0 @@ |
|||||
# Translation of OpenERP Server. |
|
||||
# This file contains the translation of the following modules: |
|
||||
# |
|
||||
msgid "" |
|
||||
msgstr "" |
|
||||
"Project-Id-Version: OpenERP Server 7.0-20131013-231025\n" |
|
||||
"Report-Msgid-Bugs-To: \n" |
|
||||
"POT-Creation-Date: 2013-11-13 13:47+0000\n" |
|
||||
"PO-Revision-Date: 2013-11-13 13:47+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: base_partner_sequence |
|
||||
#: model:ir.model,name:base_partner_sequence.model_res_partner |
|
||||
msgid "Partner" |
|
||||
msgstr "" |
|
||||
|
|
@ -0,0 +1,31 @@ |
|||||
|
# Translation of Odoo Server. |
||||
|
# This file contains the translation of the following modules: |
||||
|
# * base_partner_sequence |
||||
|
# |
||||
|
# Translators: |
||||
|
msgid "" |
||||
|
msgstr "" |
||||
|
"Project-Id-Version: partner-contact (8.0)\n" |
||||
|
"Report-Msgid-Bugs-To: \n" |
||||
|
"POT-Creation-Date: 2016-01-19 01:46+0000\n" |
||||
|
"PO-Revision-Date: 2015-05-21 21:57+0000\n" |
||||
|
"Last-Translator: <>\n" |
||||
|
"Language-Team: Finnish (http://www.transifex.com/oca/OCA-partner-contact-8-0/language/fi/)\n" |
||||
|
"MIME-Version: 1.0\n" |
||||
|
"Content-Type: text/plain; charset=UTF-8\n" |
||||
|
"Content-Transfer-Encoding: \n" |
||||
|
"Language: fi\n" |
||||
|
"Plural-Forms: nplurals=2; plural=(n != 1);\n" |
||||
|
|
||||
|
#. module: base_partner_sequence |
||||
|
#: model:ir.model,name:base_partner_sequence.model_res_partner |
||||
|
msgid "Partner" |
||||
|
msgstr "Kumppani" |
||||
|
|
||||
|
#. module: base_partner_sequence |
||||
|
#: view:res.partner:base_partner_sequence.view_partner_form |
||||
|
msgid "" |
||||
|
"{\n" |
||||
|
" 'readonly': [('is_company', '=', False),\n" |
||||
|
" ('parent_id', '!=', False)]}" |
||||
|
msgstr "" |
@ -0,0 +1,31 @@ |
|||||
|
# Translation of Odoo Server. |
||||
|
# This file contains the translation of the following modules: |
||||
|
# * base_partner_sequence |
||||
|
# |
||||
|
# Translators: |
||||
|
msgid "" |
||||
|
msgstr "" |
||||
|
"Project-Id-Version: partner-contact (8.0)\n" |
||||
|
"Report-Msgid-Bugs-To: \n" |
||||
|
"POT-Creation-Date: 2016-02-27 23:26+0000\n" |
||||
|
"PO-Revision-Date: 2016-03-11 15:30+0000\n" |
||||
|
"Last-Translator: Maxime Chambreuil <maxime.chambreuil@gmail.com>\n" |
||||
|
"Language-Team: Italian (http://www.transifex.com/oca/OCA-partner-contact-8-0/language/it/)\n" |
||||
|
"MIME-Version: 1.0\n" |
||||
|
"Content-Type: text/plain; charset=UTF-8\n" |
||||
|
"Content-Transfer-Encoding: \n" |
||||
|
"Language: it\n" |
||||
|
"Plural-Forms: nplurals=2; plural=(n != 1);\n" |
||||
|
|
||||
|
#. module: base_partner_sequence |
||||
|
#: model:ir.model,name:base_partner_sequence.model_res_partner |
||||
|
msgid "Partner" |
||||
|
msgstr "Partner" |
||||
|
|
||||
|
#. module: base_partner_sequence |
||||
|
#: view:res.partner:base_partner_sequence.view_partner_form |
||||
|
msgid "" |
||||
|
"{\n" |
||||
|
" 'readonly': [('is_company', '=', False),\n" |
||||
|
" ('parent_id', '!=', False)]}" |
||||
|
msgstr "" |
@ -0,0 +1,7 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
# Copyright 2004-2009 Tiny SPRL (<http://tiny.be>). |
||||
|
# Copyright 2013 initOS GmbH & Co. KG (<http://www.initos.com>). |
||||
|
# Copyright 2016 Tecnativa - Vicent Cubells |
||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
||||
|
|
||||
|
from . import partner |
@ -1,21 +0,0 @@ |
|||||
<?xml version="1.0"?> |
|
||||
<openerp> |
|
||||
<data noupdate="1"> |
|
||||
|
|
||||
# |
|
||||
# Sequences for res.partner |
|
||||
# |
|
||||
|
|
||||
<record model="ir.sequence.type" id="seq_type_res_partner"> |
|
||||
<field name="name">Partner code</field> |
|
||||
<field name="code">res.partner</field> |
|
||||
</record> |
|
||||
<record model="ir.sequence" id="seq_res_partner"> |
|
||||
<field name="name">Partner code</field> |
|
||||
<field name="code">res.partner</field> |
|
||||
<field name="prefix">P/</field> |
|
||||
<field name="padding">5</field> |
|
||||
</record> |
|
||||
|
|
||||
</data> |
|
||||
</openerp> |
|
@ -1,20 +0,0 @@ |
|||||
<?xml version="1.0" encoding="UTF-8"?> |
|
||||
<openerp> |
|
||||
<data> |
|
||||
|
|
||||
<record id="view_partner_form" model="ir.ui.view"> |
|
||||
<field name="name">Make partner reference readonly when non-commercial</field> |
|
||||
<field name="model">res.partner</field> |
|
||||
<field name="inherit_id" ref="base.view_partner_form"/> |
|
||||
<field name="arch" type="xml"> |
|
||||
<field name="ref" position="attributes"> |
|
||||
<attribute name="attrs">{ |
|
||||
'readonly': [('is_company', '=', False), |
|
||||
('parent_id', '!=', False)]}</attribute> |
|
||||
</field> |
|
||||
</field> |
|
||||
|
|
||||
</record> |
|
||||
</data> |
|
||||
</openerp> |
|
||||
|
|
@ -0,0 +1,7 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
# Copyright 2004-2009 Tiny SPRL (<http://tiny.be>). |
||||
|
# Copyright 2013 initOS GmbH & Co. KG (<http://www.initos.com>). |
||||
|
# Copyright 2016 Tecnativa - Vicent Cubells |
||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
||||
|
|
||||
|
from . import test_base_partner_sequence |
@ -0,0 +1,35 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
# Copyright 2015 ACSONE SA/NV (<http://acsone.eu>). |
||||
|
# Copyright 2016 Tecnativa - Vicent Cubells |
||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
||||
|
|
||||
|
import openerp.tests.common as common |
||||
|
|
||||
|
|
||||
|
class TestBasePartnerSequence(common.TransactionCase): |
||||
|
|
||||
|
def setUp(self): |
||||
|
super(TestBasePartnerSequence, self).setUp() |
||||
|
|
||||
|
self.res_partner = self.env['res.partner'] |
||||
|
self.partner = self.res_partner.create({ |
||||
|
'name': "test1", |
||||
|
'email': "test@test.com"}) |
||||
|
|
||||
|
def test_ref_sequence_on_partner(self): |
||||
|
# Test sequence on creating partner and copying it |
||||
|
self.assertTrue(self.partner.ref, "A partner has always a ref.") |
||||
|
|
||||
|
copy = self.partner.copy() |
||||
|
self.assertTrue(copy.ref, "A partner with ref created by copy " |
||||
|
"has a ref by default.") |
||||
|
|
||||
|
def test_ref_sequence_on_contact(self): |
||||
|
# Test if sequence doesn't increase on creating a contact child |
||||
|
contact = self.res_partner.create({ |
||||
|
'name': "contact1", |
||||
|
'email': "contact@contact.com", |
||||
|
'parent_id': self.partner.id}) |
||||
|
self.assertEqual( |
||||
|
self.partner.ref, contact.ref, "All it's ok as sequence doesn't " |
||||
|
"increase.") |
@ -0,0 +1,16 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<odoo> |
||||
|
|
||||
|
<record id="view_partner_form" model="ir.ui.view"> |
||||
|
<field name="name">Make partner reference readonly when non-commercial</field> |
||||
|
<field name="model">res.partner</field> |
||||
|
<field name="inherit_id" ref="base.view_partner_form"/> |
||||
|
<field name="arch" type="xml"> |
||||
|
<field name="ref" position="attributes"> |
||||
|
<attribute name="attrs">{'readonly': [('is_company', '=', False), ('parent_id', '!=', False)]}</attribute> |
||||
|
</field> |
||||
|
</field> |
||||
|
</record> |
||||
|
|
||||
|
</odoo> |
||||
|
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue