Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 71 additions & 3 deletions product_customer_code/README.rst
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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
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
<https://github.com/OCA/product-attribute/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
<https://github.com/OCA/
product-attribute/issues/new?body=module:%20
product_customer_code%0Aversion:%20
8.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.


Credits
=======

Images
------

* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_.

Contributors
------------

* Hurrinico
* OpenSynergy Indonesia
* Michael Viriyananda <viriyananda.michael@gmail.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.
31 changes: 5 additions & 26 deletions product_customer_code/__init__.py
Original file line number Diff line number Diff line change
@@ -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 <http://www.gnu.org/licenses/>.
#
##############################################################################
# -*- 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
30 changes: 4 additions & 26 deletions product_customer_code/__openerp__.py
Original file line number Diff line number Diff line change
@@ -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 <http://www.gnu.org/licenses/>.
#
##############################################################################
# -*- 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",
Expand Down
30 changes: 4 additions & 26 deletions product_customer_code/models/__init__.py
Original file line number Diff line number Diff line change
@@ -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 <http://www.gnu.org/licenses/>.
#
##############################################################################
# -*- 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
27 changes: 3 additions & 24 deletions product_customer_code/models/product.py
Original file line number Diff line number Diff line change
@@ -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 <http://www.gnu.org/licenses/>.
#
##############################################################################
# © 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


Expand Down
28 changes: 3 additions & 25 deletions product_customer_code/models/product_customer_code.py
Original file line number Diff line number Diff line change
@@ -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 <http://www.gnu.org/licenses/>.
#
##############################################################################
# © 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


Expand Down
Binary file added product_customer_code/static/description/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions product_customer_code/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -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
16 changes: 16 additions & 0 deletions product_customer_code/tests/test_copy.py
Original file line number Diff line number Diff line change
@@ -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)
60 changes: 60 additions & 0 deletions product_customer_code/tests/test_name_search.py
Original file line number Diff line number Diff line change
@@ -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]))