diff --git a/product_customer_code/README.rst b/product_customer_code/README.rst index 0997ce96838..4aecdc3d2a3 100644 --- a/product_customer_code/README.rst +++ b/product_customer_code/README.rst @@ -1,5 +1,10 @@ -Customer' codes in product -========================== +.. 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 + +====================== +Products Customer Code +====================== This module does just like the product.supplierinfo but for customers instead. For instance it allows to have different references for the same product according to the customer. @@ -9,4 +14,67 @@ allows to have different references for the same product according to the custom .. tip:: You will need install some of the Apps which enable the product menu to see this module in - action, like Sales, Purchase or Warehouse Management \ No newline at end of file + action, like Sales, Purchase or Warehouse Management + +Installation +============ + +To install this module, you need to: + +1. Clone the branch 8.0 of the repository https://github.com/OCA/product-attribute +2. Add the path to this repository in your configuration (addons-path) +3. Update the module list +4. Go to menu *Setting -> Modules -> Local Modules* +5. Search For *Products Customer Code* +6. Install the module + +Usage +===== + +.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas + :alt: Try me on Runbot + :target: https://runbot.odoo-community.org/runbot/135/8.0 + + +Bug Tracker +=========== + +Bugs are tracked on `GitHub 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 `_. + +Contributors +------------ + +* Hurrinico +* OpenSynergy Indonesia +* Michael Viriyananda + +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. diff --git a/product_customer_code/__init__.py b/product_customer_code/__init__.py index 31dba0968e0..c3fd553c6a0 100644 --- a/product_customer_code/__init__.py +++ b/product_customer_code/__init__.py @@ -1,27 +1,6 @@ -# -*- encoding: utf-8 -*- -########################################################################### -# Module Writen to OpenERP, Open Source Management Solution -# -# Copyright (c) 2012 Vauxoo - http://www.vauxoo.com/ -# All Rights Reserved. -# info Vauxoo (info@vauxoo.com) -############################################################################ -# Coded by: el_rodo_1 (rodo@vauxoo.com) -############################################################################ -# Migrated to Odoo 8.0 by Acysos S.L. - http://www.acysos.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 . -# -############################################################################## +# -*- coding: utf-8 -*- +# © 2014 Acsone SA/NV (http://www.acsone.eu) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + from . import models +from . import tests diff --git a/product_customer_code/__openerp__.py b/product_customer_code/__openerp__.py index 80701c8c8c3..8a8413138d7 100644 --- a/product_customer_code/__openerp__.py +++ b/product_customer_code/__openerp__.py @@ -1,29 +1,7 @@ -# -*- encoding: utf-8 -*- -########################################################################### -# Module Writen to OpenERP, Open Source Management Solution -# -# Copyright (c) 2012 Vauxoo - http://www.vauxoo.com/ -# All Rights Reserved. -# info Vauxoo (info@vauxoo.com) -############################################################################ -# Coded by: el_rodo_1 (rodo@vauxoo.com) -############################################################################ -# Migrated to Odoo 8.0 by Acysos S.L. - http://www.acysos.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 . -# -############################################################################## +# -*- coding: utf-8 -*- +# © 2014 Acsone SA/NV (http://www.acsone.eu) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + { "name": "Products Customer Code", "version": "1.0", diff --git a/product_customer_code/models/__init__.py b/product_customer_code/models/__init__.py index 47d55d4964b..69d00e818ec 100644 --- a/product_customer_code/models/__init__.py +++ b/product_customer_code/models/__init__.py @@ -1,28 +1,6 @@ -# -*- encoding: utf-8 -*- -########################################################################### -# Module Writen to OpenERP, Open Source Management Solution -# -# Copyright (c) 2012 Vauxoo - http://www.vauxoo.com/ -# All Rights Reserved. -# info Vauxoo (info@vauxoo.com) -############################################################################ -# Coded by: el_rodo_1 (rodo@vauxoo.com) -############################################################################ -# Migrated to Odoo 8.0 by Acysos S.L. - http://www.acysos.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 . -# -############################################################################## +# -*- coding: utf-8 -*- +# © 2014 Acsone SA/NV (http://www.acsone.eu) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + from . import product_customer_code from . import product diff --git a/product_customer_code/models/product.py b/product_customer_code/models/product.py index f0ec40e764e..eeb83822669 100644 --- a/product_customer_code/models/product.py +++ b/product_customer_code/models/product.py @@ -1,28 +1,7 @@ # -*- coding: utf-8 -*- -########################################################################### -# Module Writen to OpenERP, Open Source Management Solution -# -# Copyright (c) 2012 Vauxoo - http://www.vauxoo.com -# All Rights Reserved. -# info@vauxoo.com -############################################################################ -# Coded by: Rodo (rodo@vauxoo.com),Moy (moylop260@vauxoo.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 . -# -############################################################################## +# © 2014 Acsone SA/NV (http://www.acsone.eu) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + from openerp.osv import orm, fields diff --git a/product_customer_code/models/product_customer_code.py b/product_customer_code/models/product_customer_code.py index 45992b95fbc..f4c3cbd1294 100644 --- a/product_customer_code/models/product_customer_code.py +++ b/product_customer_code/models/product_customer_code.py @@ -1,29 +1,7 @@ # -*- coding: utf-8 -*- -########################################################################### -# Module Writen to OpenERP, Open Source Management Solution -# -# Copyright (c) 2012 Vauxoo - http://www.vauxoo.com -# All Rights Reserved. -# info@vauxoo.com -############################################################################ -# Coded by: Rodo (rodo@vauxoo.com),Moy (moylop260@vauxoo.com) -############################################################################ -# Migrated to Odoo 8.0 by Acysos S.L. - http://www.acysos.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 . -# -############################################################################## +# © 2014 Acsone SA/NV (http://www.acsone.eu) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + from openerp import models, fields diff --git a/product_customer_code/static/description/icon.png b/product_customer_code/static/description/icon.png new file mode 100644 index 00000000000..3a0328b516c Binary files /dev/null and b/product_customer_code/static/description/icon.png differ diff --git a/product_customer_code/tests/__init__.py b/product_customer_code/tests/__init__.py new file mode 100644 index 00000000000..7c47b606f9d --- /dev/null +++ b/product_customer_code/tests/__init__.py @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# © 2014 Acsone SA/NV (http://www.acsone.eu) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from . import test_copy +from . import test_name_search diff --git a/product_customer_code/tests/test_copy.py b/product_customer_code/tests/test_copy.py new file mode 100644 index 00000000000..7e7d50d4ee4 --- /dev/null +++ b/product_customer_code/tests/test_copy.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +# © 2014 Acsone SA/NV (http://www.acsone.eu) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from openerp.tests.common import TransactionCase + + +class ProductCaseCopy(TransactionCase): + def setUp(self, *args, **kwargs): + super(ProductCaseCopy, self).setUp(*args, **kwargs) + # Data Products + self.prod = self.env.ref('product.product_product_5') + + def test_copy(self): + prod_copy = self.prod.copy() + self.assertFalse(prod_copy.product_customer_code_ids) diff --git a/product_customer_code/tests/test_name_search.py b/product_customer_code/tests/test_name_search.py new file mode 100644 index 00000000000..198cf2ba2ce --- /dev/null +++ b/product_customer_code/tests/test_name_search.py @@ -0,0 +1,60 @@ +# -*- coding: utf-8 -*- +# © 2014 Acsone SA/NV (http://www.acsone.eu) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from openerp.tests.common import TransactionCase + + +class ProductCaseNameSearch(TransactionCase): + def setUp(self, *args, **kwargs): + super(ProductCaseNameSearch, self).setUp(*args, **kwargs) + # Objects + self.obj_product = self.env['product.product'] + + # Data Category Product + self.categ = self.ref('product.accessories') + + # Data UOM + self.uom = self.ref('product.product_uom_unit') + + # Data Partner + self.partner = self.ref('base.res_partner_3') + + def _prepare_product_data(self): + data = { + 'name': 'Test Product - 1', + 'categ_id': self.categ, + 'standard_price': 500.0, + 'list_price': 150.5, + 'type': 'consu', + 'uom_id': self.uom, + 'uom_po_id': self.uom, + 'default_code': 'TST001', + 'product_customer_code_ids': [ + (0, 0, {'product_name': 'Test Product - 1', + 'product_code': 'CUST001', + 'partner_id': self.partner}) + ] + } + + return data + + def _create_product(self): + data = self._prepare_product_data() + product = self.obj_product.create(data) + + return product + + def test_name_search(self): + prod_id = self._create_product().id + # Check Create Product + self.assertIsNotNone(prod_id) + + # Check Name Search + self.prod_ids = [prod_id] + search_ids = self.obj_product.with_context(partner_id=self.partner).\ + name_search( + name="CUST001", + operator='ilike', + args=[('id', 'in', self.prod_ids)]) + self.assertEqual(set([prod_id]), set([a[0] for a in search_ids]))