Skip to content
78 changes: 78 additions & 0 deletions product_customer_code/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
.. 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.

.. figure:: static/src/img/screenshot1.png
:alt: alternative description
:width: 600 px

.. 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

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.


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.
8 changes: 6 additions & 2 deletions product_customer_code/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
import product_customer_code
import product
# -*- 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
75 changes: 18 additions & 57 deletions product_customer_code/__openerp__.py
Original file line number Diff line number Diff line change
@@ -1,60 +1,21 @@
# -*- 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)
############################################################################
#
# 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": "Products Customer Code",
"version": "1.0",
"author": "Vauxoo,Odoo Community Association (OCA)",
"website": "http://www.vauxoo.com/",
"license": "AGPL-3",
"category": "Generic Modules/Product",
"summary": "Add many Customers' Codes in product",
"depends": [
"base",
"product",
],
"description": """
Customer' codes in product
==========================

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.
# -*- coding: utf-8 -*-
# © 2014 Acsone SA/NV (http://www.acsone.eu)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

.. image:: product_customer_code/static/src/img/screenshot1.png

.. 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
""",
"data": [
"security/product_customer_code_security.xml",
"security/ir.model.access.csv",
"product_customer_code_view.xml",
"product_product_view.xml",
{
'name': 'Products Customer Code',
'version': '8.0.1.0.0',
'summary': 'Add many Customers Codes in product',
'author': 'Vauxoo,Odoo Community Association (OCA)',
'website': 'http://www.vauxoo.com/',
'category': 'Generic Modules/Product',
'depends': ['base', 'product'],
'data': [
'security/product_customer_code_security.xml',
'security/ir.model.access.csv',
'views/product_customer_code_view.xml',
'views/product_product_view.xml',
],
"active": False,
'installable': False,
'installable': True,
'license': 'AGPL-3',
}
6 changes: 6 additions & 0 deletions product_customer_code/models/__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 product_customer_code
from . import product
51 changes: 51 additions & 0 deletions product_customer_code/models/product.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# -*- 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 import api, fields, models


class ProductProduct(models.Model):
_inherit = "product.product"

product_customer_code_ids = fields.One2many(
string='Customer Codes',
comodel_name='product.customer.code',
inverse_name='product_id'
)

@api.multi
def copy(self, default=None):
if not default:
default = {}
default['product_customer_code_ids'] = False
return super(ProductProduct, self.with_context(copy=True))\
.copy(default)

def name_search(self, cr, user, name='', args=None, operator='ilike',
context=None, limit=80):
res = super(ProductProduct, self).name_search(
cr, user, name, args, operator, context, limit)
if not context:
context = {}
product_customer_code_obj = self.pool.get('product.customer.code')
if not res:
ids = []
partner_id = context.get('partner_id', False)
if partner_id:
id_prod_code = \
product_customer_code_obj.search(cr, user,
[('product_code',
'=', name),
('partner_id', '=',
partner_id)],
limit=limit,
context=context)
# TODO: Search for product customer name
id_prod = id_prod_code and product_customer_code_obj.browse(
cr, user, id_prod_code, context=context) or []
for ppu in id_prod:
ids.append(ppu.product_id.id)
if ids:
res = self.name_get(cr, user, ids, context)
return res
27 changes: 27 additions & 0 deletions product_customer_code/models/product_customer_code.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# -*- 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 import models, fields


class ProductCustomerCode(models.Model):
_name = "product.customer.code"
_description = "Add manies Code of Customer's"

product_name = fields.Char(string='Customer Product Name',
help="""This customer's product name will
be used when searching into a
request for quotation.""")
product_code = fields.Char(string='Customer Product Code',
help="""This customer's product code
will be used when searching into
a request for quotation.""")
product_id = fields.Many2one(comodel_name='product.product',
string='Product', required=True)
partner_id = fields.Many2one(comodel_name='res.partner', string='Customer',
required=True)
company_id = fields.Many2one(
comodel_name='res.company', string='Company', required=False,
default=lambda self: self.env['res.company']._company_default_get(
'product.customer.code'))
73 changes: 0 additions & 73 deletions product_customer_code/product.py

This file was deleted.

67 changes: 0 additions & 67 deletions product_customer_code/product_customer_code.py

This file was deleted.

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.
Loading