diff --git a/__unported__/product_customer_code/__init__.py b/__unported__/product_customer_code/__init__.py
deleted file mode 100644
index df5910868b45..000000000000
--- a/__unported__/product_customer_code/__init__.py
+++ /dev/null
@@ -1,2 +0,0 @@
-import product_customer_code
-import product
diff --git a/__unported__/product_customer_code/product.py b/__unported__/product_customer_code/product.py
deleted file mode 100644
index 350a66f23db1..000000000000
--- a/__unported__/product_customer_code/product.py
+++ /dev/null
@@ -1,73 +0,0 @@
-# -*- 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 .
-#
-##############################################################################
-from openerp.osv import orm, fields
-from openerp.tools.translate import _
-
-
-class product_product(orm.Model):
- _inherit = "product.product"
-
- _columns = {
- 'product_customer_code_ids': fields.one2many('product.customer.code',
- 'product_id',
- 'Customer Codes'),
- }
-
- def copy(self, cr, uid, id, default=None, context=None):
- if not default:
- default = {}
- default['product_customer_code_ids'] = False
- res = super(product_product, self).copy(
- cr, uid, id, default=default, context=context)
- return res
-
- def name_search(self, cr, user, name='', args=None, operator='ilike',
- context=None, limit=80):
- res = super(product_product, 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
diff --git a/__unported__/product_customer_code/product_customer_code.py b/__unported__/product_customer_code/product_customer_code.py
deleted file mode 100644
index d3593891a20c..000000000000
--- a/__unported__/product_customer_code/product_customer_code.py
+++ /dev/null
@@ -1,67 +0,0 @@
-# -*- 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 .
-#
-##############################################################################
-from openerp.osv import orm, fields
-from openerp.tools.translate import _
-
-
-class product_customer_code(orm.Model):
- _name = "product.customer.code"
- _description = "Add manies Code of Customer's"
-
- _rec_name = 'product_code'
-
- _columns = {
- 'product_code': fields.char('Customer Product Code', size=64,
- required=True,
- help="""This customer's product code
- will be used when searching into
- a request for quotation."""),
- 'product_name': fields.char('Customer Product Name', size=128,
- help="""This customer's product name will
- be used when searching into a
- request for quotation."""),
- 'product_id': fields.many2one('product.product', 'Product',
- required=True),
- 'partner_id': fields.many2one('res.partner', 'Customer',
- required=True),
- 'company_id': fields.many2one('res.company', 'Company',
- required=False),
- }
-
- _defaults = {
- 'company_id': lambda s, cr,
- uid, c: s.pool.get('res.company').
- _company_default_get(cr, uid,
- 'product.customer.code',
- context=c),
- }
-
- _sql_constraints = [
- ('unique_code', 'unique(product_code,company_id,partner_id)',
- 'Product Code of customer must be unique'),
- ]
-
- # TODO: Add index to product_code, partner_id
diff --git a/product_customer_code/README.rst b/product_customer_code/README.rst
new file mode 100644
index 000000000000..0997ce968387
--- /dev/null
+++ b/product_customer_code/README.rst
@@ -0,0 +1,12 @@
+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.
+
+.. 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
\ No newline at end of file
diff --git a/product_customer_code/__init__.py b/product_customer_code/__init__.py
new file mode 100644
index 000000000000..31dba0968e07
--- /dev/null
+++ b/product_customer_code/__init__.py
@@ -0,0 +1,27 @@
+# -*- 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 .
+#
+##############################################################################
+from . import models
diff --git a/__unported__/product_customer_code/__openerp__.py b/product_customer_code/__openerp__.py
similarity index 55%
rename from __unported__/product_customer_code/__openerp__.py
rename to product_customer_code/__openerp__.py
index daba78448cbf..73bd5a145fe9 100644
--- a/__unported__/product_customer_code/__openerp__.py
+++ b/product_customer_code/__openerp__.py
@@ -8,6 +8,7 @@
############################################################################
# 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
@@ -24,37 +25,24 @@
#
##############################################################################
{
- "name": "Products Customer Code",
- "version": "1.0",
- "author": "Vauxoo",
- "website": "http://www.vauxoo.com/",
- "license": "AGPL-3",
- "category": "Generic Modules/Product",
- "summary": "Add many Customers' Codes in product",
- "depends": [
- "base",
- "product",
+ 'name': 'Products Customer Code',
+ 'version': '1.0',
+ 'author': 'Vauxoo',
+ 'website': 'http://www.vauxoo.com/',
+ 'contributors': ['Acysos S.L.'],
+ '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.
-
-.. 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",
+ '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,
+ 'active': False,
+ 'installable': True,
}
diff --git a/__unported__/product_customer_code/i18n/es.po b/product_customer_code/i18n/es.po
similarity index 100%
rename from __unported__/product_customer_code/i18n/es.po
rename to product_customer_code/i18n/es.po
diff --git a/__unported__/product_customer_code/i18n/es_MX.po b/product_customer_code/i18n/es_MX.po
similarity index 100%
rename from __unported__/product_customer_code/i18n/es_MX.po
rename to product_customer_code/i18n/es_MX.po
diff --git a/__unported__/product_customer_code/i18n/es_VE.po b/product_customer_code/i18n/es_VE.po
similarity index 100%
rename from __unported__/product_customer_code/i18n/es_VE.po
rename to product_customer_code/i18n/es_VE.po
diff --git a/__unported__/product_customer_code/i18n/product_customer_code.pot b/product_customer_code/i18n/product_customer_code.pot
similarity index 100%
rename from __unported__/product_customer_code/i18n/product_customer_code.pot
rename to product_customer_code/i18n/product_customer_code.pot
diff --git a/product_customer_code/models/__init__.py b/product_customer_code/models/__init__.py
new file mode 100644
index 000000000000..47d55d4964b0
--- /dev/null
+++ b/product_customer_code/models/__init__.py
@@ -0,0 +1,28 @@
+# -*- 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 .
+#
+##############################################################################
+from . import product_customer_code
+from . import product
diff --git a/product_customer_code/models/product.py b/product_customer_code/models/product.py
new file mode 100644
index 000000000000..63cd7b5fd988
--- /dev/null
+++ b/product_customer_code/models/product.py
@@ -0,0 +1,117 @@
+# -*- 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 .
+#
+##############################################################################
+from openerp import models, fields, api
+from openerp.tools.translate import _
+
+
+class ProductTemplate(models.Model):
+ _inherit = "product.template"
+
+ product_customer_code_ids = fields.One2many(
+ comodel_name='product.customer.code', inverse_name='product_id',
+ string='Customer Codes')
+
+ @api.model
+ def copy(self, default):
+ if not default:
+ default = {}
+ default['product_customer_code_ids'] = False
+ res = super(ProductTemplate, self).copy(default)
+ return res
+
+ def search(self, cr, uid, args, offset=0, limit=None, order=None,
+ context=None, count=False):
+ res = super(ProductTemplate, self).search(cr, uid, args, offset=offset,
+ limit=limit, order=order,
+ count=count)
+ operator = False
+ term = False
+ for arg in args:
+ if arg[0] == 'name':
+ operator = arg[1]
+ term = arg[2]
+ if not res and operator is not False and term is not False:
+ product_customer_code_obj = self.pool.get('product.customer.code')
+ product_ids = set(product_customer_code_obj.search(
+ cr, uid, [('product_code', operator, term)], limit=limit,
+ context=context))
+ if not limit or len(product_ids) < limit:
+ limit2 = (limit - len(product_ids)) if limit else False
+ product_ids.update(product_customer_code_obj.search(
+ cr, uid, [('product_name', operator, term)], limit=limit2,
+ context=context))
+ product_ids = list(product_ids)
+
+ product_datas = product_customer_code_obj.browse(cr, uid,
+ product_ids,
+ context)
+
+ prod_ids = []
+ for product_data in product_datas:
+ prod_ids.append(product_data.product_id.id)
+ res = prod_ids
+
+ return res
+
+
+class ProductProduct(models.Model):
+ _inherit = "product.product"
+
+ def search(self, cr, uid, args, offset=0, limit=None, order=None,
+ context=None, count=False):
+ res = super(ProductProduct, self).search(cr, uid, args, offset=offset,
+ limit=limit, order=order,
+ context=context, count=count)
+ operator = False
+ term = False
+ for arg in args:
+ if arg[0] == 'name':
+ operator = arg[1]
+ term = arg[2]
+
+ if not res and operator is not False and term is not False:
+ cust_data_obj = self.pool.get('product.customer.code')
+ cust_ids = set(cust_data_obj.search(
+ cr, uid, [('product_code', operator, term)], limit=limit,
+ context=context))
+ if not limit or len(cust_ids) < limit:
+ limit2 = (limit - len(cust_ids)) if limit else False
+ cust_ids.update(cust_data_obj.search(
+ cr, uid, [('product_name', operator, term)], limit=limit2,
+ context=context))
+ cust_ids = list(cust_ids)
+
+ products_template = cust_data_obj.read(cr, uid, cust_ids,
+ ['product_id'], context)
+ product_obj = self.pool.get('product.product')
+ for template in products_template:
+ prod_ids = product_obj.search(
+ cr, uid, [('product_tmpl_id', '=',
+ template['product_id'][0])], context=context)
+ for prod_id in prod_ids:
+ res.append(prod_id)
+ return res
diff --git a/product_customer_code/models/product_customer_code.py b/product_customer_code/models/product_customer_code.py
new file mode 100644
index 000000000000..f19e70d10845
--- /dev/null
+++ b/product_customer_code/models/product_customer_code.py
@@ -0,0 +1,50 @@
+# -*- 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 .
+#
+##############################################################################
+from openerp import models, fields, api
+from openerp.tools.translate import _
+
+
+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.template',
+ 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'))
diff --git a/__unported__/product_customer_code/security/ir.model.access.csv b/product_customer_code/security/ir.model.access.csv
similarity index 100%
rename from __unported__/product_customer_code/security/ir.model.access.csv
rename to product_customer_code/security/ir.model.access.csv
diff --git a/__unported__/product_customer_code/security/product_customer_code_security.xml b/product_customer_code/security/product_customer_code_security.xml
similarity index 100%
rename from __unported__/product_customer_code/security/product_customer_code_security.xml
rename to product_customer_code/security/product_customer_code_security.xml
diff --git a/__unported__/product_customer_code/static/src/img/screenshot1.png b/product_customer_code/static/src/img/screenshot1.png
similarity index 100%
rename from __unported__/product_customer_code/static/src/img/screenshot1.png
rename to product_customer_code/static/src/img/screenshot1.png
diff --git a/__unported__/product_customer_code/product_customer_code_view.xml b/product_customer_code/views/product_customer_code_view.xml
similarity index 83%
rename from __unported__/product_customer_code/product_customer_code_view.xml
rename to product_customer_code/views/product_customer_code_view.xml
index 0fddfd30f013..dcb2d243c3e6 100644
--- a/__unported__/product_customer_code/product_customer_code_view.xml
+++ b/product_customer_code/views/product_customer_code_view.xml
@@ -6,11 +6,14 @@
view.product.customer.code.form
product.customer.code
-
@@ -20,10 +23,11 @@
product.customer.code
+
+
-
@@ -40,10 +44,11 @@
product.customer.code
+
+
-
diff --git a/__unported__/product_customer_code/product_product_view.xml b/product_customer_code/views/product_product_view.xml
similarity index 63%
rename from __unported__/product_customer_code/product_product_view.xml
rename to product_customer_code/views/product_product_view.xml
index 3aec998b5914..c4c91dce3fc8 100644
--- a/__unported__/product_customer_code/product_product_view.xml
+++ b/product_customer_code/views/product_product_view.xml
@@ -2,23 +2,22 @@
-
- product.normal.form.inh.product.customer.code.01
- product.product
-
+
+ product.template.form.inh.product.customer.code.01
+ product.template
+
-
+
+
-
-