From fa0eb88b468f0c496356a4dba437bfe7825bbeb2 Mon Sep 17 00:00:00 2001 From: oihane Date: Thu, 18 Sep 2014 10:49:56 +0200 Subject: [PATCH 01/19] --- product_supplierinfo_for_customer/__init__.py | 19 +++ .../__openerp__.py | 41 +++++++ product_supplierinfo_for_customer/i18n/es.po | 57 +++++++++ .../product_supplierinfo_for_customer.pot | 57 +++++++++ .../models/__init__.py | 21 ++++ .../models/product_supplierinfo.py | 36 ++++++ .../models/product_template.py | 32 +++++ .../models/res_partner.py | 34 ++++++ .../views/product_view.xml | 113 ++++++++++++++++++ 9 files changed, 410 insertions(+) create mode 100644 product_supplierinfo_for_customer/__init__.py create mode 100644 product_supplierinfo_for_customer/__openerp__.py create mode 100644 product_supplierinfo_for_customer/i18n/es.po create mode 100644 product_supplierinfo_for_customer/i18n/product_supplierinfo_for_customer.pot create mode 100644 product_supplierinfo_for_customer/models/__init__.py create mode 100644 product_supplierinfo_for_customer/models/product_supplierinfo.py create mode 100644 product_supplierinfo_for_customer/models/product_template.py create mode 100644 product_supplierinfo_for_customer/models/res_partner.py create mode 100644 product_supplierinfo_for_customer/views/product_view.xml diff --git a/product_supplierinfo_for_customer/__init__.py b/product_supplierinfo_for_customer/__init__.py new file mode 100644 index 00000000000..7fc7c09f9b0 --- /dev/null +++ b/product_supplierinfo_for_customer/__init__.py @@ -0,0 +1,19 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# 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 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/. +# +############################################################################## + +from . import models diff --git a/product_supplierinfo_for_customer/__openerp__.py b/product_supplierinfo_for_customer/__openerp__.py new file mode 100644 index 00000000000..2fc53288647 --- /dev/null +++ b/product_supplierinfo_for_customer/__openerp__.py @@ -0,0 +1,41 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# 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 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": "Use product supplier info for customers too", + "version": "1.0", + "depends": [ + "base", + "product", + ], + "author": "OdooMRP team", + "contributors": [ + "Oihane Crucelaegui ", + ], + "category": "Sales Management", + "website": "http://www.odoomrp.com", + "summary": "", + "description": """ +This module extends product.supplierinfo object with a combo to allow using +it for sale pricelists + """, + "data": [ + "views/product_view.xml", + ], + "installable": True, +} diff --git a/product_supplierinfo_for_customer/i18n/es.po b/product_supplierinfo_for_customer/i18n/es.po new file mode 100644 index 00000000000..1b8f413639d --- /dev/null +++ b/product_supplierinfo_for_customer/i18n/es.po @@ -0,0 +1,57 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * product_supplierinfo_for_customer +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 8.0rc1\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2014-09-05 11:46+0000\n" +"PO-Revision-Date: 2014-09-05 11:46+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: product_supplierinfo_for_customer +#: selection:product.supplierinfo,type:0 +msgid "Customer" +msgstr "Cliente" + +#. module: product_supplierinfo_for_customer +#: view:product.template:product_supplierinfo_for_customer.product_template_extended_form_view +msgid "Customers" +msgstr "Clientes" + +#. module: product_supplierinfo_for_customer +#: model:ir.model,name:product_supplierinfo_for_customer.model_product_supplierinfo +msgid "Information about a product supplier" +msgstr "Información de un proveedor de producto" + +#. module: product_supplierinfo_for_customer +#: model:ir.model,name:product_supplierinfo_for_customer.model_product_template +msgid "Product Template" +msgstr "Plantilla de producto" + +#. module: product_supplierinfo_for_customer +#: selection:product.supplierinfo,type:0 +msgid "Supplier" +msgstr "Proveedor" + +#. module: product_supplierinfo_for_customer +#: field:product.supplierinfo,type:0 +msgid "Type" +msgstr "Tipo" + +#. module: product_supplierinfo_for_customer +#: view:product.template:product_supplierinfo_for_customer.product_template_extended_form_view +msgid "[('type','=','supplier')]" +msgstr "[('type','=','supplier')]" + +#. module: product_supplierinfo_for_customer +#: view:product.template:product_supplierinfo_for_customer.product_template_extended_form_view +msgid "{'default_search_type':'supplier','default_type':'supplier'}" +msgstr "{'default_search_type':'supplier','default_type':'supplier'}" + diff --git a/product_supplierinfo_for_customer/i18n/product_supplierinfo_for_customer.pot b/product_supplierinfo_for_customer/i18n/product_supplierinfo_for_customer.pot new file mode 100644 index 00000000000..a48ab71467d --- /dev/null +++ b/product_supplierinfo_for_customer/i18n/product_supplierinfo_for_customer.pot @@ -0,0 +1,57 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * product_supplierinfo_for_customer +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 8.0rc1\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2014-09-05 11:46+0000\n" +"PO-Revision-Date: 2014-09-05 11:46+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: product_supplierinfo_for_customer +#: selection:product.supplierinfo,type:0 +msgid "Customer" +msgstr "" + +#. module: product_supplierinfo_for_customer +#: view:product.template:product_supplierinfo_for_customer.product_template_extended_form_view +msgid "Customers" +msgstr "" + +#. module: product_supplierinfo_for_customer +#: model:ir.model,name:product_supplierinfo_for_customer.model_product_supplierinfo +msgid "Information about a product supplier" +msgstr "" + +#. module: product_supplierinfo_for_customer +#: model:ir.model,name:product_supplierinfo_for_customer.model_product_template +msgid "Product Template" +msgstr "" + +#. module: product_supplierinfo_for_customer +#: selection:product.supplierinfo,type:0 +msgid "Supplier" +msgstr "" + +#. module: product_supplierinfo_for_customer +#: field:product.supplierinfo,type:0 +msgid "Type" +msgstr "" + +#. module: product_supplierinfo_for_customer +#: view:product.template:product_supplierinfo_for_customer.product_template_extended_form_view +msgid "[('type','=','supplier')]" +msgstr "" + +#. module: product_supplierinfo_for_customer +#: view:product.template:product_supplierinfo_for_customer.product_template_extended_form_view +msgid "{'default_search_type':'supplier','default_type':'supplier'}" +msgstr "" + diff --git a/product_supplierinfo_for_customer/models/__init__.py b/product_supplierinfo_for_customer/models/__init__.py new file mode 100644 index 00000000000..67021782557 --- /dev/null +++ b/product_supplierinfo_for_customer/models/__init__.py @@ -0,0 +1,21 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# 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 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/. +# +############################################################################## + +from . import product_supplierinfo +from . import product_template +from . import res_partner diff --git a/product_supplierinfo_for_customer/models/product_supplierinfo.py b/product_supplierinfo_for_customer/models/product_supplierinfo.py new file mode 100644 index 00000000000..8d9f5f6538a --- /dev/null +++ b/product_supplierinfo_for_customer/models/product_supplierinfo.py @@ -0,0 +1,36 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# 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 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/. +# +############################################################################## + +from openerp import models, fields, api + + +class ProductSupplierinfo(models.Model): + _inherit = 'product.supplierinfo' + + type = fields.Selection([('customer', 'Customer'), + ('supplier', 'Supplier')], string='Type', + default='supplier') + + @api.multi + @api.onchange('type') + def onchange_type(self): + if self.type == 'supplier': + return {'domain': {'name': [('supplier', '=', True)]}} + elif self.type == 'customer': + return {'domain': {'name': [('customer', '=', True)]}} + return {'domain': {'name': []}} diff --git a/product_supplierinfo_for_customer/models/product_template.py b/product_supplierinfo_for_customer/models/product_template.py new file mode 100644 index 00000000000..1c9fd3749d1 --- /dev/null +++ b/product_supplierinfo_for_customer/models/product_template.py @@ -0,0 +1,32 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# 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 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/. +# +############################################################################## + +from openerp import models, fields + + +class ProductTemplate(models.Model): + _inherit = 'product.template' + + customer_ids = fields.One2many(comodel_name='product.supplierinfo', + inverse_name='product_tmpl_id', + string='Customer', + domain=[('type', '=', 'customer')]) + supplier_ids = fields.One2many(comodel_name='product.supplierinfo', + inverse_name='product_tmpl_id', + string='Supplier', + domain=[('type', '=', 'supplier')]) diff --git a/product_supplierinfo_for_customer/models/res_partner.py b/product_supplierinfo_for_customer/models/res_partner.py new file mode 100644 index 00000000000..97d8bb467a8 --- /dev/null +++ b/product_supplierinfo_for_customer/models/res_partner.py @@ -0,0 +1,34 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# 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 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/. +# +############################################################################## + +from openerp import models, api + + +class ResPartner(models.Model): + _inherit = 'res.partner' + + @api.model + def default_get(self, fields): + res = super(ResPartner, self).default_get(fields) + select_type = self.env.context.get('select_type', False) + if select_type: + res.update({ + 'customer': select_type == 'customer', + 'supplier': select_type == 'supplier', + }) + return res diff --git a/product_supplierinfo_for_customer/views/product_view.xml b/product_supplierinfo_for_customer/views/product_view.xml new file mode 100644 index 00000000000..ca1f111fac5 --- /dev/null +++ b/product_supplierinfo_for_customer/views/product_view.xml @@ -0,0 +1,113 @@ + + + + + + product.supplierinfo.extended.form + product.supplierinfo + + + + Partner + {'select_type': type} + + + Partner Product Name + + + Partner Product Code + + + Partner Unit of Measure + + + + + + + + + product.supplierinfo.extended.tree + product.supplierinfo + + + + + + + Partner + + + + + + product.template.extended.form + product.template + + + + {'default_search_type':'supplier','default_type':'supplier','default_product_tmpl_id':id} + [('type','=','supplier')] + 1 + + + + + + + + + + + + + + product.supplierinfo.search + product.supplierinfo + + + + + + + + + + + + + + + + + + Information about a product + ir.actions.act_window + product.supplierinfo + tree,form + form + + [] + { + 'search_default_is_customer_filter': 1 + } + + +

+ Click to define a new product.supplierinfo. +

+
+
+ + + +
+
From 352ef984486b11ff4d86d745edf902162bc73380 Mon Sep 17 00:00:00 2001 From: "Pedro M. Baeza" Date: Thu, 5 Feb 2015 17:30:02 +0100 Subject: [PATCH 02/19] product_supplierinfo_for_customer: Views and documentation --- product_supplierinfo_for_customer/README.rst | 19 +++++ .../__openerp__.py | 7 -- product_supplierinfo_for_customer/i18n/es.po | 71 +++++++++++++++---- .../product_supplierinfo_for_customer.pot | 67 +++++++++++++---- .../views/product_view.xml | 31 ++++---- 5 files changed, 147 insertions(+), 48 deletions(-) create mode 100644 product_supplierinfo_for_customer/README.rst diff --git a/product_supplierinfo_for_customer/README.rst b/product_supplierinfo_for_customer/README.rst new file mode 100644 index 00000000000..35c4a20fab6 --- /dev/null +++ b/product_supplierinfo_for_customer/README.rst @@ -0,0 +1,19 @@ +Use product supplier info also for customers +============================================ + +This modules allows to use supplier info, available in _Procurements_ tab +from the product, also for customers, allowing to define prices per +customer and product. + +For these prices to be used in sale prices calculations, you will have +to create a pricelist with a rule with option "Based on" is "Supplier prices +on the product form" (although the text is not clear enough). + +Credits +======= + +Contributors +------------ +* Oihane Crucelaegui +* Pedro M. Baeza + diff --git a/product_supplierinfo_for_customer/__openerp__.py b/product_supplierinfo_for_customer/__openerp__.py index 2fc53288647..33cef3643c3 100644 --- a/product_supplierinfo_for_customer/__openerp__.py +++ b/product_supplierinfo_for_customer/__openerp__.py @@ -24,16 +24,9 @@ "product", ], "author": "OdooMRP team", - "contributors": [ - "Oihane Crucelaegui ", - ], "category": "Sales Management", "website": "http://www.odoomrp.com", "summary": "", - "description": """ -This module extends product.supplierinfo object with a combo to allow using -it for sale pricelists - """, "data": [ "views/product_view.xml", ], diff --git a/product_supplierinfo_for_customer/i18n/es.po b/product_supplierinfo_for_customer/i18n/es.po index 1b8f413639d..df5232cbaa4 100644 --- a/product_supplierinfo_for_customer/i18n/es.po +++ b/product_supplierinfo_for_customer/i18n/es.po @@ -4,10 +4,10 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 8.0rc1\n" +"Project-Id-Version: Odoo Server 8.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-09-05 11:46+0000\n" -"PO-Revision-Date: 2014-09-05 11:46+0000\n" +"POT-Creation-Date: 2015-02-05 14:08+0000\n" +"PO-Revision-Date: 2015-02-05 14:08+0000\n" "Last-Translator: <>\n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -16,7 +16,19 @@ msgstr "" "Plural-Forms: \n" #. module: product_supplierinfo_for_customer +#: model:ir.actions.act_window,help:product_supplierinfo_for_customer.product_supplierinfo_action +msgid "

\n" +" Click to define a new product.supplierinfo.\n" +"

\n" +" " +msgstr "

\n" +"Pulse para definir una nueva definición de producto-empresa.\n" +"

\n" + +#. module: product_supplierinfo_for_customer +#: view:product.supplierinfo:product_supplierinfo_for_customer.product_supplierinfo_search_view #: selection:product.supplierinfo,type:0 +#: field:product.template,customer_ids:0 msgid "Customer" msgstr "Cliente" @@ -25,33 +37,66 @@ msgstr "Cliente" msgid "Customers" msgstr "Clientes" +#. module: product_supplierinfo_for_customer +#: view:product.supplierinfo:product_supplierinfo_for_customer.product_supplierinfo_search_view +msgid "Group By" +msgstr "Agrupar por" + +#. module: product_supplierinfo_for_customer +#: model:ir.actions.act_window,name:product_supplierinfo_for_customer.product_supplierinfo_action +#: model:ir.ui.menu,name:product_supplierinfo_for_customer.product_supplierinfo_sale_menu +msgid "Information about a product" +msgstr "Información sobre un producto" + #. module: product_supplierinfo_for_customer #: model:ir.model,name:product_supplierinfo_for_customer.model_product_supplierinfo msgid "Information about a product supplier" msgstr "Información de un proveedor de producto" +#. module: product_supplierinfo_for_customer +#: model:ir.model,name:product_supplierinfo_for_customer.model_res_partner +#: view:product.supplierinfo:product_supplierinfo_for_customer.product_supplierinfo_extended_form_view +#: view:product.supplierinfo:product_supplierinfo_for_customer.product_supplierinfo_extended_tree_view +#: view:product.supplierinfo:product_supplierinfo_for_customer.product_supplierinfo_search_view +msgid "Partner" +msgstr "Empresa" + +#. module: product_supplierinfo_for_customer +#: view:product.supplierinfo:product_supplierinfo_for_customer.product_supplierinfo_extended_form_view +msgid "Partner Product Code" +msgstr "Código de producto para la empresa" + +#. module: product_supplierinfo_for_customer +#: view:product.supplierinfo:product_supplierinfo_for_customer.product_supplierinfo_extended_form_view +msgid "Partner Product Name" +msgstr "Nombre de producto para la empresa" + +#. module: product_supplierinfo_for_customer +#: view:product.supplierinfo:product_supplierinfo_for_customer.product_supplierinfo_extended_form_view +msgid "Partner Unit of Measure" +msgstr "Unidad de medida de empresa" + #. module: product_supplierinfo_for_customer #: model:ir.model,name:product_supplierinfo_for_customer.model_product_template +#: view:product.supplierinfo:product_supplierinfo_for_customer.product_supplierinfo_search_view msgid "Product Template" msgstr "Plantilla de producto" #. module: product_supplierinfo_for_customer +#: view:product.supplierinfo:product_supplierinfo_for_customer.product_supplierinfo_search_view #: selection:product.supplierinfo,type:0 +#: field:product.template,supplier_ids:0 msgid "Supplier" msgstr "Proveedor" #. module: product_supplierinfo_for_customer +#: view:product.supplierinfo:product_supplierinfo_for_customer.product_supplierinfo_search_view +msgid "Supplierinfo search" +msgstr "Búsqueda de producto-empresa" + +#. module: product_supplierinfo_for_customer +#: view:product.supplierinfo:product_supplierinfo_for_customer.product_supplierinfo_search_view #: field:product.supplierinfo,type:0 msgid "Type" msgstr "Tipo" -#. module: product_supplierinfo_for_customer -#: view:product.template:product_supplierinfo_for_customer.product_template_extended_form_view -msgid "[('type','=','supplier')]" -msgstr "[('type','=','supplier')]" - -#. module: product_supplierinfo_for_customer -#: view:product.template:product_supplierinfo_for_customer.product_template_extended_form_view -msgid "{'default_search_type':'supplier','default_type':'supplier'}" -msgstr "{'default_search_type':'supplier','default_type':'supplier'}" - diff --git a/product_supplierinfo_for_customer/i18n/product_supplierinfo_for_customer.pot b/product_supplierinfo_for_customer/i18n/product_supplierinfo_for_customer.pot index a48ab71467d..32dbe81b428 100644 --- a/product_supplierinfo_for_customer/i18n/product_supplierinfo_for_customer.pot +++ b/product_supplierinfo_for_customer/i18n/product_supplierinfo_for_customer.pot @@ -4,10 +4,10 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 8.0rc1\n" +"Project-Id-Version: Odoo Server 8.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-09-05 11:46+0000\n" -"PO-Revision-Date: 2014-09-05 11:46+0000\n" +"POT-Creation-Date: 2015-02-05 14:08+0000\n" +"PO-Revision-Date: 2015-02-05 14:08+0000\n" "Last-Translator: <>\n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -16,7 +16,17 @@ msgstr "" "Plural-Forms: \n" #. module: product_supplierinfo_for_customer +#: model:ir.actions.act_window,help:product_supplierinfo_for_customer.product_supplierinfo_action +msgid "

\n" +" Click to define a new product.supplierinfo.\n" +"

\n" +" " +msgstr "" + +#. module: product_supplierinfo_for_customer +#: view:product.supplierinfo:product_supplierinfo_for_customer.product_supplierinfo_search_view #: selection:product.supplierinfo,type:0 +#: field:product.template,customer_ids:0 msgid "Customer" msgstr "" @@ -25,33 +35,66 @@ msgstr "" msgid "Customers" msgstr "" +#. module: product_supplierinfo_for_customer +#: view:product.supplierinfo:product_supplierinfo_for_customer.product_supplierinfo_search_view +msgid "Group By" +msgstr "" + +#. module: product_supplierinfo_for_customer +#: model:ir.actions.act_window,name:product_supplierinfo_for_customer.product_supplierinfo_action +#: model:ir.ui.menu,name:product_supplierinfo_for_customer.product_supplierinfo_sale_menu +msgid "Information about a product" +msgstr "" + #. module: product_supplierinfo_for_customer #: model:ir.model,name:product_supplierinfo_for_customer.model_product_supplierinfo msgid "Information about a product supplier" msgstr "" +#. module: product_supplierinfo_for_customer +#: model:ir.model,name:product_supplierinfo_for_customer.model_res_partner +#: view:product.supplierinfo:product_supplierinfo_for_customer.product_supplierinfo_extended_form_view +#: view:product.supplierinfo:product_supplierinfo_for_customer.product_supplierinfo_extended_tree_view +#: view:product.supplierinfo:product_supplierinfo_for_customer.product_supplierinfo_search_view +msgid "Partner" +msgstr "" + +#. module: product_supplierinfo_for_customer +#: view:product.supplierinfo:product_supplierinfo_for_customer.product_supplierinfo_extended_form_view +msgid "Partner Product Code" +msgstr "" + +#. module: product_supplierinfo_for_customer +#: view:product.supplierinfo:product_supplierinfo_for_customer.product_supplierinfo_extended_form_view +msgid "Partner Product Name" +msgstr "" + +#. module: product_supplierinfo_for_customer +#: view:product.supplierinfo:product_supplierinfo_for_customer.product_supplierinfo_extended_form_view +msgid "Partner Unit of Measure" +msgstr "" + #. module: product_supplierinfo_for_customer #: model:ir.model,name:product_supplierinfo_for_customer.model_product_template +#: view:product.supplierinfo:product_supplierinfo_for_customer.product_supplierinfo_search_view msgid "Product Template" msgstr "" #. module: product_supplierinfo_for_customer +#: view:product.supplierinfo:product_supplierinfo_for_customer.product_supplierinfo_search_view #: selection:product.supplierinfo,type:0 +#: field:product.template,supplier_ids:0 msgid "Supplier" msgstr "" #. module: product_supplierinfo_for_customer -#: field:product.supplierinfo,type:0 -msgid "Type" +#: view:product.supplierinfo:product_supplierinfo_for_customer.product_supplierinfo_search_view +msgid "Supplierinfo search" msgstr "" #. module: product_supplierinfo_for_customer -#: view:product.template:product_supplierinfo_for_customer.product_template_extended_form_view -msgid "[('type','=','supplier')]" -msgstr "" - -#. module: product_supplierinfo_for_customer -#: view:product.template:product_supplierinfo_for_customer.product_template_extended_form_view -msgid "{'default_search_type':'supplier','default_type':'supplier'}" +#: view:product.supplierinfo:product_supplierinfo_for_customer.product_supplierinfo_search_view +#: field:product.supplierinfo,type:0 +msgid "Type" msgstr "" diff --git a/product_supplierinfo_for_customer/views/product_view.xml b/product_supplierinfo_for_customer/views/product_view.xml index ca1f111fac5..9024a2babf3 100644 --- a/product_supplierinfo_for_customer/views/product_view.xml +++ b/product_supplierinfo_for_customer/views/product_view.xml @@ -21,7 +21,7 @@ Partner Unit of Measure - + @@ -31,9 +31,6 @@ product.supplierinfo - - - Partner @@ -51,15 +48,14 @@ 1 - + - + + context="{'default_search_type':'customer','default_type':'customer','default_product_tmpl_id':id}"> @@ -75,13 +71,16 @@ - - + + - + From bb4cacb82c38db5be38d6ee69bd4970d5b5fe958 Mon Sep 17 00:00:00 2001 From: oihane Date: Wed, 11 Feb 2015 13:20:42 +0100 Subject: [PATCH 03/19] Related to #638 --- .../views/product_view.xml | 77 +++++++++++++++---- 1 file changed, 60 insertions(+), 17 deletions(-) diff --git a/product_supplierinfo_for_customer/views/product_view.xml b/product_supplierinfo_for_customer/views/product_view.xml index 9024a2babf3..1482579b694 100644 --- a/product_supplierinfo_for_customer/views/product_view.xml +++ b/product_supplierinfo_for_customer/views/product_view.xml @@ -21,7 +21,20 @@ Partner Unit of Measure - + + + + + + + product.supplierinfo.template.form + product.supplierinfo + + primary + + + + @@ -37,6 +50,19 @@ + + product.supplierinfo.template.tree + product.supplierinfo + + primary + + + + + + + + product.template.extended.form product.template @@ -49,13 +75,15 @@ + context="{'default_search_type':'supplier','default_type':'supplier','default_product_tmpl_id':id}" + domain="[('type','=','supplier')]" /> - + + context="{'default_search_type':'customer','default_type':'customer','default_product_tmpl_id':id}"> @@ -68,26 +96,25 @@ - - + + - - + + - + - Information about a product + Information about a product (customer) ir.actions.act_window product.supplierinfo tree,form @@ -105,6 +132,22 @@ + + + form + + + + + + + tree + + + + From 5063d21bf145cd42a3abc4c7ad171db9c0837d17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matja=C5=BE=20Mozeti=C4=8D?= Date: Sat, 15 Aug 2015 18:53:19 +0200 Subject: [PATCH 04/19] Slovene translations of odoomrp modules --- product_supplierinfo_for_customer/i18n/sl.po | 104 +++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 product_supplierinfo_for_customer/i18n/sl.po diff --git a/product_supplierinfo_for_customer/i18n/sl.po b/product_supplierinfo_for_customer/i18n/sl.po new file mode 100644 index 00000000000..e0423baa22e --- /dev/null +++ b/product_supplierinfo_for_customer/i18n/sl.po @@ -0,0 +1,104 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * product_supplierinfo_for_customer +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 8.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2015-02-05 14:08+0000\n" +"PO-Revision-Date: 2015-08-15 13:06+0200\n" +"Last-Translator: Matjaz Mozetic \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: \n" +"Language: sl\n" +"X-Generator: Poedit 1.8.4\n" + +#. module: product_supplierinfo_for_customer +#: model:ir.actions.act_window,help:product_supplierinfo_for_customer.product_supplierinfo_action +msgid "" +"

\n" +" Click to define a new product.supplierinfo.\n" +"

\n" +" " +msgstr "" +"

\n" +" Kliknite za nov product.supplierinfo.\n" +"

\n" +" " + +#. module: product_supplierinfo_for_customer +#: view:product.supplierinfo:product_supplierinfo_for_customer.product_supplierinfo_search_view +#: selection:product.supplierinfo,type:0 field:product.template,customer_ids:0 +msgid "Customer" +msgstr "Kupec" + +#. module: product_supplierinfo_for_customer +#: view:product.template:product_supplierinfo_for_customer.product_template_extended_form_view +msgid "Customers" +msgstr "Kupci" + +#. module: product_supplierinfo_for_customer +#: view:product.supplierinfo:product_supplierinfo_for_customer.product_supplierinfo_search_view +msgid "Group By" +msgstr "Združi po" + +#. module: product_supplierinfo_for_customer +#: model:ir.actions.act_window,name:product_supplierinfo_for_customer.product_supplierinfo_action +#: model:ir.ui.menu,name:product_supplierinfo_for_customer.product_supplierinfo_sale_menu +msgid "Information about a product" +msgstr "Podatki o proizvodu" + +#. module: product_supplierinfo_for_customer +#: model:ir.model,name:product_supplierinfo_for_customer.model_product_supplierinfo +msgid "Information about a product supplier" +msgstr "Podatki o dobavitelju proizvoda" + +#. module: product_supplierinfo_for_customer +#: model:ir.model,name:product_supplierinfo_for_customer.model_res_partner +#: view:product.supplierinfo:product_supplierinfo_for_customer.product_supplierinfo_extended_form_view +#: view:product.supplierinfo:product_supplierinfo_for_customer.product_supplierinfo_extended_tree_view +#: view:product.supplierinfo:product_supplierinfo_for_customer.product_supplierinfo_search_view +msgid "Partner" +msgstr "Partner" + +#. module: product_supplierinfo_for_customer +#: view:product.supplierinfo:product_supplierinfo_for_customer.product_supplierinfo_extended_form_view +msgid "Partner Product Code" +msgstr "Partnerjeva koda proizvoda" + +#. module: product_supplierinfo_for_customer +#: view:product.supplierinfo:product_supplierinfo_for_customer.product_supplierinfo_extended_form_view +msgid "Partner Product Name" +msgstr "Partnerjev naziv proizvoda" + +#. module: product_supplierinfo_for_customer +#: view:product.supplierinfo:product_supplierinfo_for_customer.product_supplierinfo_extended_form_view +msgid "Partner Unit of Measure" +msgstr "Partnerjeva EM" + +#. module: product_supplierinfo_for_customer +#: model:ir.model,name:product_supplierinfo_for_customer.model_product_template +#: view:product.supplierinfo:product_supplierinfo_for_customer.product_supplierinfo_search_view +msgid "Product Template" +msgstr "Predloga proizvoda" + +#. module: product_supplierinfo_for_customer +#: view:product.supplierinfo:product_supplierinfo_for_customer.product_supplierinfo_search_view +#: selection:product.supplierinfo,type:0 field:product.template,supplier_ids:0 +msgid "Supplier" +msgstr "Dobavitelj" + +#. module: product_supplierinfo_for_customer +#: view:product.supplierinfo:product_supplierinfo_for_customer.product_supplierinfo_search_view +msgid "Supplierinfo search" +msgstr "Iskanje podatkov o dobavitelju" + +#. module: product_supplierinfo_for_customer +#: view:product.supplierinfo:product_supplierinfo_for_customer.product_supplierinfo_search_view +#: field:product.supplierinfo,type:0 +msgid "Type" +msgstr "Tip" From b30eaf070701e84cc6a9417eddb9e3f8f2ac4418 Mon Sep 17 00:00:00 2001 From: "Pedro M. Baeza" Date: Thu, 27 Aug 2015 04:00:40 +0200 Subject: [PATCH 05/19] product_supplierinfo_for_customer: Avoid side effects + improve README --- product_supplierinfo_for_customer/README.rst | 37 ++++++++++++++++--- product_supplierinfo_for_customer/__init__.py | 2 +- .../__openerp__.py | 6 ++- .../models/__init__.py | 3 +- .../models/product_pricelist.py | 18 +++++++++ .../models/product_supplierinfo.py | 23 ++++++++++-- .../models/product_template.py | 16 ++++---- .../models/res_partner.py | 2 +- .../views/product_view.xml | 1 + 9 files changed, 85 insertions(+), 23 deletions(-) create mode 100644 product_supplierinfo_for_customer/models/product_pricelist.py diff --git a/product_supplierinfo_for_customer/README.rst b/product_supplierinfo_for_customer/README.rst index 35c4a20fab6..8f1fd69696d 100644 --- a/product_supplierinfo_for_customer/README.rst +++ b/product_supplierinfo_for_customer/README.rst @@ -1,13 +1,40 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :alt: License: AGPL-3 + +============================================ Use product supplier info also for customers ============================================ -This modules allows to use supplier info, available in _Procurements_ tab -from the product, also for customers, allowing to define prices per -customer and product. +This modules allows to use supplier info structure, available in +*Procurements* tab of the product form, also for defining customer information, +allowing to define prices per customer and product. + +Configuration +============= For these prices to be used in sale prices calculations, you will have -to create a pricelist with a rule with option "Based on" is "Supplier prices -on the product form" (although the text is not clear enough). +to create a pricelist with a rule with option "Based on" with the value +"Supplier prices on the product form" (although the text is not clear enough). + +Usage +===== + +There's a new section on *Sales* tab of the product form called "Customers", +where you can define records for customers with the same structure of the +suppliers. + +.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas + :alt: Try me on Runbot + :target: https://runbot.odoo-community.org/runbot/188/8.0 + +Known issues / Roadmap +====================== + +* Product prices through this method are only guaranteed on the standard sale + order workflow. Other custom flows maybe don't reflect the price. +* The product code / product name specified for the customer will not be + reflected on the sale orders. +* The minimum quantity will not also be applied on sale orders. Credits ======= diff --git a/product_supplierinfo_for_customer/__init__.py b/product_supplierinfo_for_customer/__init__.py index 7fc7c09f9b0..a9609aa0b11 100644 --- a/product_supplierinfo_for_customer/__init__.py +++ b/product_supplierinfo_for_customer/__init__.py @@ -1,4 +1,4 @@ -# -*- encoding: utf-8 -*- +# -*- coding: utf-8 -*- ############################################################################## # # This program is free software: you can redistribute it and/or modify diff --git a/product_supplierinfo_for_customer/__openerp__.py b/product_supplierinfo_for_customer/__openerp__.py index 33cef3643c3..b9fc4c5384a 100644 --- a/product_supplierinfo_for_customer/__openerp__.py +++ b/product_supplierinfo_for_customer/__openerp__.py @@ -1,4 +1,4 @@ -# -*- encoding: utf-8 -*- +# -*- coding: utf-8 -*- ############################################################################## # # This program is free software: you can redistribute it and/or modify @@ -23,7 +23,9 @@ "base", "product", ], - "author": "OdooMRP team", + "author": "OdooMRP team," + "AvanzOSC," + "Serv. Tecnol. Avanzados - Pedro M. Baeza", "category": "Sales Management", "website": "http://www.odoomrp.com", "summary": "", diff --git a/product_supplierinfo_for_customer/models/__init__.py b/product_supplierinfo_for_customer/models/__init__.py index 67021782557..b60c45a6539 100644 --- a/product_supplierinfo_for_customer/models/__init__.py +++ b/product_supplierinfo_for_customer/models/__init__.py @@ -1,4 +1,4 @@ -# -*- encoding: utf-8 -*- +# -*- coding: utf-8 -*- ############################################################################## # # This program is free software: you can redistribute it and/or modify @@ -19,3 +19,4 @@ from . import product_supplierinfo from . import product_template from . import res_partner +from . import product_pricelist diff --git a/product_supplierinfo_for_customer/models/product_pricelist.py b/product_supplierinfo_for_customer/models/product_pricelist.py new file mode 100644 index 00000000000..49ee7421be6 --- /dev/null +++ b/product_supplierinfo_for_customer/models/product_pricelist.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- +# (c) 2015 Pedro M. Baeza +# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html + +from openerp import models, api + + +class ProductPricelist(models.Model): + _inherit = 'product.pricelist' + + @api.multi + def price_rule_get(self, prod_id, qty, partner=None): + """Pass context if the type of the pricelist is sale for restricting + on the search product.supplierinfo records of type customer.""" + obj = (self.with_context(supplierinfo_type='customer') if + self.type == 'sale' else self) + return super(ProductPricelist, obj).price_rule_get( + prod_id, qty, partner=partner) diff --git a/product_supplierinfo_for_customer/models/product_supplierinfo.py b/product_supplierinfo_for_customer/models/product_supplierinfo.py index 8d9f5f6538a..a957eb839e5 100644 --- a/product_supplierinfo_for_customer/models/product_supplierinfo.py +++ b/product_supplierinfo_for_customer/models/product_supplierinfo.py @@ -1,4 +1,4 @@ -# -*- encoding: utf-8 -*- +# -*- coding: utf-8 -*- ############################################################################## # # This program is free software: you can redistribute it and/or modify @@ -22,9 +22,10 @@ class ProductSupplierinfo(models.Model): _inherit = 'product.supplierinfo' - type = fields.Selection([('customer', 'Customer'), - ('supplier', 'Supplier')], string='Type', - default='supplier') + type = fields.Selection( + selection=[('customer', 'Customer'), + ('supplier', 'Supplier')], string='Type', + default='supplier') @api.multi @api.onchange('type') @@ -34,3 +35,17 @@ def onchange_type(self): elif self.type == 'customer': return {'domain': {'name': [('customer', '=', True)]}} return {'domain': {'name': []}} + + def search(self, cr, uid, args, offset=0, limit=None, order=None, + context=None, count=False): + """Add search argument for field type if the context says so. This + should be in old API because context argument is not the last one. + """ + if context is None: + context = {} + if not any(arg[0] == 'type' for arg in args): + args += [('type', '=', + context.get('supplierinfo_type', 'supplier'))] + return super(ProductSupplierinfo, self).search( + cr, uid, args, offset=offset, limit=limit, order=order, + context=context, count=count) diff --git a/product_supplierinfo_for_customer/models/product_template.py b/product_supplierinfo_for_customer/models/product_template.py index 1c9fd3749d1..8e84ddb61b8 100644 --- a/product_supplierinfo_for_customer/models/product_template.py +++ b/product_supplierinfo_for_customer/models/product_template.py @@ -1,4 +1,4 @@ -# -*- encoding: utf-8 -*- +# -*- coding: utf-8 -*- ############################################################################## # # This program is free software: you can redistribute it and/or modify @@ -22,11 +22,9 @@ class ProductTemplate(models.Model): _inherit = 'product.template' - customer_ids = fields.One2many(comodel_name='product.supplierinfo', - inverse_name='product_tmpl_id', - string='Customer', - domain=[('type', '=', 'customer')]) - supplier_ids = fields.One2many(comodel_name='product.supplierinfo', - inverse_name='product_tmpl_id', - string='Supplier', - domain=[('type', '=', 'supplier')]) + customer_ids = fields.One2many( + comodel_name='product.supplierinfo', inverse_name='product_tmpl_id', + string='Customer', domain=[('type', '=', 'customer')]) + supplier_ids = fields.One2many( + comodel_name='product.supplierinfo', inverse_name='product_tmpl_id', + string='Supplier', domain=[('type', '=', 'supplier')]) diff --git a/product_supplierinfo_for_customer/models/res_partner.py b/product_supplierinfo_for_customer/models/res_partner.py index 97d8bb467a8..6c7e0303075 100644 --- a/product_supplierinfo_for_customer/models/res_partner.py +++ b/product_supplierinfo_for_customer/models/res_partner.py @@ -1,4 +1,4 @@ -# -*- encoding: utf-8 -*- +# -*- coding: utf-8 -*- ############################################################################## # # This program is free software: you can redistribute it and/or modify diff --git a/product_supplierinfo_for_customer/views/product_view.xml b/product_supplierinfo_for_customer/views/product_view.xml index 1482579b694..30f841710c1 100644 --- a/product_supplierinfo_for_customer/views/product_view.xml +++ b/product_supplierinfo_for_customer/views/product_view.xml @@ -114,6 +114,7 @@ + Information about a product (customer) Information about a product (customer) ir.actions.act_window product.supplierinfo From 34099b8b24fa1d89ea6ca5dfd06377487d05e53e Mon Sep 17 00:00:00 2001 From: oihane Date: Thu, 3 Sep 2015 15:45:54 +0200 Subject: [PATCH 06/19] Create 'customer' type from menu option --- .../views/product_view.xml | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/product_supplierinfo_for_customer/views/product_view.xml b/product_supplierinfo_for_customer/views/product_view.xml index 30f841710c1..f6db3069922 100644 --- a/product_supplierinfo_for_customer/views/product_view.xml +++ b/product_supplierinfo_for_customer/views/product_view.xml @@ -21,7 +21,7 @@ Partner Unit of Measure - + @@ -40,7 +40,7 @@ - product.supplierinfo.extended.tree + product.supplierinfo.partner.tree product.supplierinfo @@ -75,15 +75,15 @@ + context="{'default_search_type':'supplier','default_type':'supplier','default_product_tmpl_id':id}" + domain="[('type','=','supplier')]" /> + context="{'default_search_type':'customer','default_type':'customer','default_product_tmpl_id':id}"> @@ -97,33 +97,33 @@ + name="is_customer_filter" /> + name="is_supplier_filter" /> + domain="[]" context="{'group_by':'name'}" /> + context="{'group_by':'product_tmpl_id'}" /> + context="{'group_by':'type'}" /> - Information about a product (customer) Information about a product (customer) ir.actions.act_window product.supplierinfo tree,form form - [] { - 'search_default_is_customer_filter': 1 + 'search_default_is_customer_filter': 1, + 'default_type': 'customer', + 'supplierinfo_type': 'customer', } @@ -134,7 +134,7 @@ + model="ir.actions.act_window.view"> form @@ -142,7 +142,7 @@ + model="ir.actions.act_window.view"> tree @@ -150,7 +150,7 @@ + action="product_supplierinfo_action" /> From 9193ae8ec2c7d4ea8ad03df2b1e46dde9229aa0b Mon Sep 17 00:00:00 2001 From: oihane Date: Fri, 4 Sep 2015 12:57:15 +0200 Subject: [PATCH 07/19] Added know issue with computed fields --- product_supplierinfo_for_customer/README.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/product_supplierinfo_for_customer/README.rst b/product_supplierinfo_for_customer/README.rst index 8f1fd69696d..dfacd33ea3f 100644 --- a/product_supplierinfo_for_customer/README.rst +++ b/product_supplierinfo_for_customer/README.rst @@ -35,6 +35,8 @@ Known issues / Roadmap * The product code / product name specified for the customer will not be reflected on the sale orders. * The minimum quantity will not also be applied on sale orders. +* Computed fields in product.supplierinfo object won't properly work for + customer type Credits ======= @@ -43,4 +45,3 @@ Contributors ------------ * Oihane Crucelaegui * Pedro M. Baeza - From 4c607f4083fedf3fe6d444dc5fee0279ea270052 Mon Sep 17 00:00:00 2001 From: alfredoavanzosc Date: Mon, 28 Sep 2015 16:50:37 +0200 Subject: [PATCH 08/19] product_supplierinfo_for_customer: Create "demo" data, and "tests" folder. --- product_supplierinfo_for_customer/__init__.py | 16 +------- .../__openerp__.py | 18 +++++---- .../demo/product_demo.xml | 15 +++++++ .../models/__init__.py | 16 +------- .../models/product_pricelist.py | 6 +-- .../models/product_supplierinfo.py | 16 +------- .../models/product_template.py | 16 +------- .../models/res_partner.py | 16 +------- .../tests/__init__.py | 5 +++ .../test_product_supplierinfo_for_customer.py | 40 +++++++++++++++++++ 10 files changed, 78 insertions(+), 86 deletions(-) create mode 100644 product_supplierinfo_for_customer/demo/product_demo.xml create mode 100644 product_supplierinfo_for_customer/tests/__init__.py create mode 100644 product_supplierinfo_for_customer/tests/test_product_supplierinfo_for_customer.py diff --git a/product_supplierinfo_for_customer/__init__.py b/product_supplierinfo_for_customer/__init__.py index a9609aa0b11..2bbe2de9996 100644 --- a/product_supplierinfo_for_customer/__init__.py +++ b/product_supplierinfo_for_customer/__init__.py @@ -1,19 +1,5 @@ # -*- coding: utf-8 -*- ############################################################################## -# -# 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 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/. -# +# For copyright and license notices, see __openerp__.py file in root directory ############################################################################## - from . import models diff --git a/product_supplierinfo_for_customer/__openerp__.py b/product_supplierinfo_for_customer/__openerp__.py index b9fc4c5384a..e0de40d6284 100644 --- a/product_supplierinfo_for_customer/__openerp__.py +++ b/product_supplierinfo_for_customer/__openerp__.py @@ -15,22 +15,24 @@ # along with this program. If not, see http://www.gnu.org/licenses/. # ############################################################################## - { "name": "Use product supplier info for customers too", - "version": "1.0", - "depends": [ - "base", - "product", - ], + "version": "8.0.1.0.0", "author": "OdooMRP team," "AvanzOSC," "Serv. Tecnol. Avanzados - Pedro M. Baeza", - "category": "Sales Management", "website": "http://www.odoomrp.com", - "summary": "", + "category": "Sales Management", + "license": 'AGPL-3', + "depends": [ + "base", + "product", + ], "data": [ "views/product_view.xml", ], + "demo": [ + "demo/product_demo.xml", + ], "installable": True, } diff --git a/product_supplierinfo_for_customer/demo/product_demo.xml b/product_supplierinfo_for_customer/demo/product_demo.xml new file mode 100644 index 00000000000..d667cc72421 --- /dev/null +++ b/product_supplierinfo_for_customer/demo/product_demo.xml @@ -0,0 +1,15 @@ + + + + + + + 1 + 1 + customer + + + + diff --git a/product_supplierinfo_for_customer/models/__init__.py b/product_supplierinfo_for_customer/models/__init__.py index b60c45a6539..3e4ccebb841 100644 --- a/product_supplierinfo_for_customer/models/__init__.py +++ b/product_supplierinfo_for_customer/models/__init__.py @@ -1,21 +1,7 @@ # -*- coding: utf-8 -*- ############################################################################## -# -# 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 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/. -# +# For copyright and license notices, see __openerp__.py file in root directory ############################################################################## - from . import product_supplierinfo from . import product_template from . import res_partner diff --git a/product_supplierinfo_for_customer/models/product_pricelist.py b/product_supplierinfo_for_customer/models/product_pricelist.py index 49ee7421be6..cac559a0c09 100644 --- a/product_supplierinfo_for_customer/models/product_pricelist.py +++ b/product_supplierinfo_for_customer/models/product_pricelist.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- -# (c) 2015 Pedro M. Baeza -# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html - +############################################################################## +# For copyright and license notices, see __openerp__.py file in root directory +############################################################################## from openerp import models, api diff --git a/product_supplierinfo_for_customer/models/product_supplierinfo.py b/product_supplierinfo_for_customer/models/product_supplierinfo.py index a957eb839e5..635c2ec1887 100644 --- a/product_supplierinfo_for_customer/models/product_supplierinfo.py +++ b/product_supplierinfo_for_customer/models/product_supplierinfo.py @@ -1,21 +1,7 @@ # -*- coding: utf-8 -*- ############################################################################## -# -# 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 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/. -# +# For copyright and license notices, see __openerp__.py file in root directory ############################################################################## - from openerp import models, fields, api diff --git a/product_supplierinfo_for_customer/models/product_template.py b/product_supplierinfo_for_customer/models/product_template.py index 8e84ddb61b8..4fa58d94acd 100644 --- a/product_supplierinfo_for_customer/models/product_template.py +++ b/product_supplierinfo_for_customer/models/product_template.py @@ -1,21 +1,7 @@ # -*- coding: utf-8 -*- ############################################################################## -# -# 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 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/. -# +# For copyright and license notices, see __openerp__.py file in root directory ############################################################################## - from openerp import models, fields diff --git a/product_supplierinfo_for_customer/models/res_partner.py b/product_supplierinfo_for_customer/models/res_partner.py index 6c7e0303075..8e41b79cb5d 100644 --- a/product_supplierinfo_for_customer/models/res_partner.py +++ b/product_supplierinfo_for_customer/models/res_partner.py @@ -1,21 +1,7 @@ # -*- coding: utf-8 -*- ############################################################################## -# -# 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 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/. -# +# For copyright and license notices, see __openerp__.py file in root directory ############################################################################## - from openerp import models, api diff --git a/product_supplierinfo_for_customer/tests/__init__.py b/product_supplierinfo_for_customer/tests/__init__.py new file mode 100644 index 00000000000..bc0476c8174 --- /dev/null +++ b/product_supplierinfo_for_customer/tests/__init__.py @@ -0,0 +1,5 @@ +# -*- coding: utf-8 -*- +############################################################################## +# For copyright and license notices, see __openerp__.py file in root directory +############################################################################## +from . import test_product_supplierinfo_for_customer diff --git a/product_supplierinfo_for_customer/tests/test_product_supplierinfo_for_customer.py b/product_supplierinfo_for_customer/tests/test_product_supplierinfo_for_customer.py new file mode 100644 index 00000000000..c2723f1e217 --- /dev/null +++ b/product_supplierinfo_for_customer/tests/test_product_supplierinfo_for_customer.py @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- +############################################################################## +# For copyright and license notices, see __openerp__.py file in root directory +############################################################################## +import openerp.tests.common as common + + +class TestProductSupplierinfoForCustomer(common.TransactionCase): + + def setUp(self): + super(TestProductSupplierinfoForCustomer, self).setUp() + self.supplierinfo_model = self.env['product.supplierinfo'] + self.pricelist_item_model = self.env['product.pricelist.item'] + self.pricelist_model = self.env['product.pricelist'] + self.customer = self.env.ref('base.res_partner_2') + self.product = self.env.ref('product.product_product_4') + self.pricelist = self.env.ref('product.list0') + self.pricelist_item = self.pricelist_item_model.browse( + self.env.ref('product.item0').id) + self.pricelist_item.write({'base': -2}) + + def test_product_supplierinfo_for_customer(self): + cond = [('name', '=', self.customer.id)] + supplierinfos = self.supplierinfo_model.search(cond) + self.assertEqual(len(supplierinfos), 0, + "Error: Supplier found in Supplierinfo") + cond = [('name', '=', self.customer.id)] + customerinfos = self.supplierinfo_model.with_context( + supplierinfo_type='customer').search(cond) + self.assertNotEqual(len(customerinfos), 0, + "Error: Supplier not found in Supplierinfo") + price_unit = self.pricelist_model.with_context( + supplierinfo_type='customer').price_rule_get( + self.product.id, 7, partner=self.customer.id) + self.assertTrue( + price_unit.get(self.pricelist.id, False), + "Error: Price unit not found for customer") + price = price_unit.get(self.pricelist.id, False)[0] + self.assertEqual(price, 20.0, + "Error: Price not found for product and customer") From 5aab198b7d7ad8b150195abc7486b632549bed51 Mon Sep 17 00:00:00 2001 From: Javier Iniesta Date: Thu, 22 Oct 2015 13:30:50 +0200 Subject: [PATCH 09/19] license target link --- product_supplierinfo_for_customer/README.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/product_supplierinfo_for_customer/README.rst b/product_supplierinfo_for_customer/README.rst index dfacd33ea3f..a51a69d4454 100644 --- a/product_supplierinfo_for_customer/README.rst +++ b/product_supplierinfo_for_customer/README.rst @@ -1,5 +1,6 @@ .. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg :alt: License: AGPL-3 + :target: http://www.gnu.org/licenses/agpl-3.0.en.html ============================================ Use product supplier info also for customers From 9030f72cfcf009d6d0e552e23d864267aef5886e Mon Sep 17 00:00:00 2001 From: Javier Iniesta Date: Thu, 22 Oct 2015 13:51:45 +0200 Subject: [PATCH 10/19] OCA as author added --- product_supplierinfo_for_customer/__openerp__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/product_supplierinfo_for_customer/__openerp__.py b/product_supplierinfo_for_customer/__openerp__.py index e0de40d6284..dcf3495737c 100644 --- a/product_supplierinfo_for_customer/__openerp__.py +++ b/product_supplierinfo_for_customer/__openerp__.py @@ -20,7 +20,8 @@ "version": "8.0.1.0.0", "author": "OdooMRP team," "AvanzOSC," - "Serv. Tecnol. Avanzados - Pedro M. Baeza", + "Serv. Tecnol. Avanzados - Pedro M. Baeza," + "Odoo Community Association (OCA)", "website": "http://www.odoomrp.com", "category": "Sales Management", "license": 'AGPL-3', From 0bf236ea434d0f06f119796f97099158b6166b7d Mon Sep 17 00:00:00 2001 From: OCA Transbot Date: Tue, 29 Nov 2016 09:26:01 -0500 Subject: [PATCH 11/19] OCA Transbot updated translations from Transifex --- product_supplierinfo_for_customer/i18n/de.po | 128 +++++++++++++++++++ product_supplierinfo_for_customer/i18n/es.po | 53 +++++--- product_supplierinfo_for_customer/i18n/fr.po | 123 ++++++++++++++++++ product_supplierinfo_for_customer/i18n/sl.po | 46 +++++-- 4 files changed, 324 insertions(+), 26 deletions(-) create mode 100644 product_supplierinfo_for_customer/i18n/de.po create mode 100644 product_supplierinfo_for_customer/i18n/fr.po diff --git a/product_supplierinfo_for_customer/i18n/de.po b/product_supplierinfo_for_customer/i18n/de.po new file mode 100644 index 00000000000..49246583ecf --- /dev/null +++ b/product_supplierinfo_for_customer/i18n/de.po @@ -0,0 +1,128 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * product_supplierinfo_for_customer +# +# Translators: +# OCA Transbot , 2016 +# Rudolf Schnapka , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 8.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-04-21 02:49+0000\n" +"PO-Revision-Date: 2017-04-21 02:49+0000\n" +"Last-Translator: Rudolf Schnapka , 2017\n" +"Language-Team: German (https://www.transifex.com/oca/teams/23907/de/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: de\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: product_supplierinfo_for_customer +#: model:ir.actions.act_window,help:product_supplierinfo_for_customer.product_supplierinfo_action +msgid "" +"

\n" +" Click to define a new product.supplierinfo.\n" +"

\n" +" " +msgstr "" +"

\n" +" Klicken für neue product.supplierinfo Lieferanteninfo.\n" +"

\n" +" " + +#. module: product_supplierinfo_for_customer +#: view:product.supplierinfo:product_supplierinfo_for_customer.product_supplierinfo_search_view +#: selection:product.supplierinfo,type:0 field:product.template,customer_ids:0 +msgid "Customer" +msgstr "Kunde" + +#. module: product_supplierinfo_for_customer +#: view:product.template:product_supplierinfo_for_customer.product_template_extended_form_view +msgid "Customers" +msgstr "Kunden" + +#. module: product_supplierinfo_for_customer +#: view:product.supplierinfo:product_supplierinfo_for_customer.product_supplierinfo_search_view +msgid "Group By" +msgstr "Gruppiere nach" + +#. module: product_supplierinfo_for_customer +#: model:ir.actions.act_window,name:product_supplierinfo_for_customer.product_supplierinfo_action +#: model:ir.ui.menu,name:product_supplierinfo_for_customer.product_supplierinfo_sale_menu +msgid "Information about a product (customer)" +msgstr "Information zu einem (Kunden-) Produkt" + +#. module: product_supplierinfo_for_customer +#: model:ir.model,name:product_supplierinfo_for_customer.model_product_supplierinfo +msgid "Information about a product supplier" +msgstr "Information zu Produktlieferant" + +#. module: product_supplierinfo_for_customer +#: model:ir.model,name:product_supplierinfo_for_customer.model_res_partner +#: view:product.supplierinfo:product_supplierinfo_for_customer.product_supplierinfo_extended_form_view +#: view:product.supplierinfo:product_supplierinfo_for_customer.product_supplierinfo_extended_tree_view +#: view:product.supplierinfo:product_supplierinfo_for_customer.product_supplierinfo_search_view +msgid "Partner" +msgstr "Partner" + +#. module: product_supplierinfo_for_customer +#: view:product.supplierinfo:product_supplierinfo_for_customer.product_supplierinfo_extended_form_view +msgid "Partner Product Code" +msgstr "Artikelnummer des Partners" + +#. module: product_supplierinfo_for_customer +#: view:product.supplierinfo:product_supplierinfo_for_customer.product_supplierinfo_extended_form_view +msgid "Partner Product Name" +msgstr "Produktbezeichnung des Partners" + +#. module: product_supplierinfo_for_customer +#: view:product.supplierinfo:product_supplierinfo_for_customer.product_supplierinfo_extended_form_view +msgid "Partner Unit of Measure" +msgstr "Mengeneinheit des Partners" + +#. module: product_supplierinfo_for_customer +#: model:ir.model,name:product_supplierinfo_for_customer.model_product_pricelist +msgid "Pricelist" +msgstr "Preisliste" + +#. module: product_supplierinfo_for_customer +#: model:ir.model,name:product_supplierinfo_for_customer.model_product_template +#: view:product.supplierinfo:product_supplierinfo_for_customer.product_supplierinfo_search_view +msgid "Product Template" +msgstr "Produktvorlage" + +#. module: product_supplierinfo_for_customer +#: view:product.supplierinfo:product_supplierinfo_for_customer.product_supplierinfo_search_view +#: selection:product.supplierinfo,type:0 field:product.template,supplier_ids:0 +msgid "Supplier" +msgstr "Lieferant" + +#. module: product_supplierinfo_for_customer +#: view:product.supplierinfo:product_supplierinfo_for_customer.product_supplierinfo_search_view +msgid "Supplierinfo search" +msgstr "Lieferantenauskunft-Suche" + +#. module: product_supplierinfo_for_customer +#: view:product.supplierinfo:product_supplierinfo_for_customer.product_supplierinfo_search_view +#: field:product.supplierinfo,type:0 +msgid "Type" +msgstr "Art" + +#. module: product_supplierinfo_for_customer +#: view:product.template:product_supplierinfo_for_customer.product_template_extended_form_view +msgid "[('type','=','supplier')]" +msgstr "[('type','=','supplier')]" + +#. module: product_supplierinfo_for_customer +#: view:product.template:product_supplierinfo_for_customer.product_template_extended_form_view +msgid "" +"{'default_search_type':'supplier','default_type':'supplier','default_product_tmpl_id':id}" +msgstr "" +"{'default_search_type':'supplier','default_type':'supplier','default_product_tmpl_id':id}" + +#. module: product_supplierinfo_for_customer +#: view:product.supplierinfo:product_supplierinfo_for_customer.product_supplierinfo_extended_form_view +msgid "{'select_type': type}" +msgstr "{'select_type': type}" diff --git a/product_supplierinfo_for_customer/i18n/es.po b/product_supplierinfo_for_customer/i18n/es.po index df5232cbaa4..027bca24642 100644 --- a/product_supplierinfo_for_customer/i18n/es.po +++ b/product_supplierinfo_for_customer/i18n/es.po @@ -1,34 +1,38 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * product_supplierinfo_for_customer -# +# * product_supplierinfo_for_customer +# +# Translators: +# OCA Transbot , 2016 msgid "" msgstr "" "Project-Id-Version: Odoo Server 8.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-02-05 14:08+0000\n" -"PO-Revision-Date: 2015-02-05 14:08+0000\n" -"Last-Translator: <>\n" -"Language-Team: \n" +"POT-Creation-Date: 2016-11-03 10:07+0000\n" +"PO-Revision-Date: 2016-11-03 10:07+0000\n" +"Last-Translator: OCA Transbot , 2016\n" +"Language-Team: Spanish (https://www.transifex.com/oca/teams/23907/es/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" -"Plural-Forms: \n" +"Language: es\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" #. module: product_supplierinfo_for_customer #: model:ir.actions.act_window,help:product_supplierinfo_for_customer.product_supplierinfo_action -msgid "

\n" +msgid "" +"

\n" " Click to define a new product.supplierinfo.\n" "

\n" " " -msgstr "

\n" +msgstr "" +"

\n" "Pulse para definir una nueva definición de producto-empresa.\n" "

\n" #. module: product_supplierinfo_for_customer #: view:product.supplierinfo:product_supplierinfo_for_customer.product_supplierinfo_search_view -#: selection:product.supplierinfo,type:0 -#: field:product.template,customer_ids:0 +#: selection:product.supplierinfo,type:0 field:product.template,customer_ids:0 msgid "Customer" msgstr "Cliente" @@ -45,8 +49,8 @@ msgstr "Agrupar por" #. module: product_supplierinfo_for_customer #: model:ir.actions.act_window,name:product_supplierinfo_for_customer.product_supplierinfo_action #: model:ir.ui.menu,name:product_supplierinfo_for_customer.product_supplierinfo_sale_menu -msgid "Information about a product" -msgstr "Información sobre un producto" +msgid "Information about a product (customer)" +msgstr "" #. module: product_supplierinfo_for_customer #: model:ir.model,name:product_supplierinfo_for_customer.model_product_supplierinfo @@ -76,6 +80,11 @@ msgstr "Nombre de producto para la empresa" msgid "Partner Unit of Measure" msgstr "Unidad de medida de empresa" +#. module: product_supplierinfo_for_customer +#: model:ir.model,name:product_supplierinfo_for_customer.model_product_pricelist +msgid "Pricelist" +msgstr "" + #. module: product_supplierinfo_for_customer #: model:ir.model,name:product_supplierinfo_for_customer.model_product_template #: view:product.supplierinfo:product_supplierinfo_for_customer.product_supplierinfo_search_view @@ -84,8 +93,7 @@ msgstr "Plantilla de producto" #. module: product_supplierinfo_for_customer #: view:product.supplierinfo:product_supplierinfo_for_customer.product_supplierinfo_search_view -#: selection:product.supplierinfo,type:0 -#: field:product.template,supplier_ids:0 +#: selection:product.supplierinfo,type:0 field:product.template,supplier_ids:0 msgid "Supplier" msgstr "Proveedor" @@ -100,3 +108,18 @@ msgstr "Búsqueda de producto-empresa" msgid "Type" msgstr "Tipo" +#. module: product_supplierinfo_for_customer +#: view:product.template:product_supplierinfo_for_customer.product_template_extended_form_view +msgid "[('type','=','supplier')]" +msgstr "" + +#. module: product_supplierinfo_for_customer +#: view:product.template:product_supplierinfo_for_customer.product_template_extended_form_view +msgid "" +"{'default_search_type':'supplier','default_type':'supplier','default_product_tmpl_id':id}" +msgstr "" + +#. module: product_supplierinfo_for_customer +#: view:product.supplierinfo:product_supplierinfo_for_customer.product_supplierinfo_extended_form_view +msgid "{'select_type': type}" +msgstr "" diff --git a/product_supplierinfo_for_customer/i18n/fr.po b/product_supplierinfo_for_customer/i18n/fr.po new file mode 100644 index 00000000000..a0c9aad1161 --- /dev/null +++ b/product_supplierinfo_for_customer/i18n/fr.po @@ -0,0 +1,123 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * product_supplierinfo_for_customer +# +# Translators: +# OCA Transbot , 2016 +# Christophe CHAUVET , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 8.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-04-21 02:49+0000\n" +"PO-Revision-Date: 2017-04-21 02:49+0000\n" +"Last-Translator: Christophe CHAUVET , 2017\n" +"Language-Team: French (https://www.transifex.com/oca/teams/23907/fr/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: fr\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" + +#. module: product_supplierinfo_for_customer +#: model:ir.actions.act_window,help:product_supplierinfo_for_customer.product_supplierinfo_action +msgid "" +"

\n" +" Click to define a new product.supplierinfo.\n" +"

\n" +" " +msgstr "" + +#. module: product_supplierinfo_for_customer +#: view:product.supplierinfo:product_supplierinfo_for_customer.product_supplierinfo_search_view +#: selection:product.supplierinfo,type:0 field:product.template,customer_ids:0 +msgid "Customer" +msgstr "" + +#. module: product_supplierinfo_for_customer +#: view:product.template:product_supplierinfo_for_customer.product_template_extended_form_view +msgid "Customers" +msgstr "" + +#. module: product_supplierinfo_for_customer +#: view:product.supplierinfo:product_supplierinfo_for_customer.product_supplierinfo_search_view +msgid "Group By" +msgstr "" + +#. module: product_supplierinfo_for_customer +#: model:ir.actions.act_window,name:product_supplierinfo_for_customer.product_supplierinfo_action +#: model:ir.ui.menu,name:product_supplierinfo_for_customer.product_supplierinfo_sale_menu +msgid "Information about a product (customer)" +msgstr "" + +#. module: product_supplierinfo_for_customer +#: model:ir.model,name:product_supplierinfo_for_customer.model_product_supplierinfo +msgid "Information about a product supplier" +msgstr "Information à propos du fournisseur du produit" + +#. module: product_supplierinfo_for_customer +#: model:ir.model,name:product_supplierinfo_for_customer.model_res_partner +#: view:product.supplierinfo:product_supplierinfo_for_customer.product_supplierinfo_extended_form_view +#: view:product.supplierinfo:product_supplierinfo_for_customer.product_supplierinfo_extended_tree_view +#: view:product.supplierinfo:product_supplierinfo_for_customer.product_supplierinfo_search_view +msgid "Partner" +msgstr "Partenaire" + +#. module: product_supplierinfo_for_customer +#: view:product.supplierinfo:product_supplierinfo_for_customer.product_supplierinfo_extended_form_view +msgid "Partner Product Code" +msgstr "" + +#. module: product_supplierinfo_for_customer +#: view:product.supplierinfo:product_supplierinfo_for_customer.product_supplierinfo_extended_form_view +msgid "Partner Product Name" +msgstr "" + +#. module: product_supplierinfo_for_customer +#: view:product.supplierinfo:product_supplierinfo_for_customer.product_supplierinfo_extended_form_view +msgid "Partner Unit of Measure" +msgstr "" + +#. module: product_supplierinfo_for_customer +#: model:ir.model,name:product_supplierinfo_for_customer.model_product_pricelist +msgid "Pricelist" +msgstr "Liste de prix" + +#. module: product_supplierinfo_for_customer +#: model:ir.model,name:product_supplierinfo_for_customer.model_product_template +#: view:product.supplierinfo:product_supplierinfo_for_customer.product_supplierinfo_search_view +msgid "Product Template" +msgstr "Modèle d'article" + +#. module: product_supplierinfo_for_customer +#: view:product.supplierinfo:product_supplierinfo_for_customer.product_supplierinfo_search_view +#: selection:product.supplierinfo,type:0 field:product.template,supplier_ids:0 +msgid "Supplier" +msgstr "" + +#. module: product_supplierinfo_for_customer +#: view:product.supplierinfo:product_supplierinfo_for_customer.product_supplierinfo_search_view +msgid "Supplierinfo search" +msgstr "" + +#. module: product_supplierinfo_for_customer +#: view:product.supplierinfo:product_supplierinfo_for_customer.product_supplierinfo_search_view +#: field:product.supplierinfo,type:0 +msgid "Type" +msgstr "Type" + +#. module: product_supplierinfo_for_customer +#: view:product.template:product_supplierinfo_for_customer.product_template_extended_form_view +msgid "[('type','=','supplier')]" +msgstr "" + +#. module: product_supplierinfo_for_customer +#: view:product.template:product_supplierinfo_for_customer.product_template_extended_form_view +msgid "" +"{'default_search_type':'supplier','default_type':'supplier','default_product_tmpl_id':id}" +msgstr "" + +#. module: product_supplierinfo_for_customer +#: view:product.supplierinfo:product_supplierinfo_for_customer.product_supplierinfo_extended_form_view +msgid "{'select_type': type}" +msgstr "" diff --git a/product_supplierinfo_for_customer/i18n/sl.po b/product_supplierinfo_for_customer/i18n/sl.po index e0423baa22e..ad5fa16f4dd 100644 --- a/product_supplierinfo_for_customer/i18n/sl.po +++ b/product_supplierinfo_for_customer/i18n/sl.po @@ -1,21 +1,23 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * product_supplierinfo_for_customer -# +# * product_supplierinfo_for_customer +# +# Translators: +# OCA Transbot , 2016 +# Matjaž Mozetič , 2016 msgid "" msgstr "" "Project-Id-Version: Odoo Server 8.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-02-05 14:08+0000\n" -"PO-Revision-Date: 2015-08-15 13:06+0200\n" -"Last-Translator: Matjaz Mozetic \n" -"Language-Team: \n" +"POT-Creation-Date: 2016-11-03 10:07+0000\n" +"PO-Revision-Date: 2016-11-03 10:07+0000\n" +"Last-Translator: Matjaž Mozetič , 2016\n" +"Language-Team: Slovenian (https://www.transifex.com/oca/teams/23907/sl/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: \n" +"Content-Transfer-Encoding: \n" "Language: sl\n" -"X-Generator: Poedit 1.8.4\n" +"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);\n" #. module: product_supplierinfo_for_customer #: model:ir.actions.act_window,help:product_supplierinfo_for_customer.product_supplierinfo_action @@ -49,8 +51,8 @@ msgstr "Združi po" #. module: product_supplierinfo_for_customer #: model:ir.actions.act_window,name:product_supplierinfo_for_customer.product_supplierinfo_action #: model:ir.ui.menu,name:product_supplierinfo_for_customer.product_supplierinfo_sale_menu -msgid "Information about a product" -msgstr "Podatki o proizvodu" +msgid "Information about a product (customer)" +msgstr "Podatki o proizvodu (kupec)" #. module: product_supplierinfo_for_customer #: model:ir.model,name:product_supplierinfo_for_customer.model_product_supplierinfo @@ -80,6 +82,11 @@ msgstr "Partnerjev naziv proizvoda" msgid "Partner Unit of Measure" msgstr "Partnerjeva EM" +#. module: product_supplierinfo_for_customer +#: model:ir.model,name:product_supplierinfo_for_customer.model_product_pricelist +msgid "Pricelist" +msgstr "Cenik" + #. module: product_supplierinfo_for_customer #: model:ir.model,name:product_supplierinfo_for_customer.model_product_template #: view:product.supplierinfo:product_supplierinfo_for_customer.product_supplierinfo_search_view @@ -102,3 +109,20 @@ msgstr "Iskanje podatkov o dobavitelju" #: field:product.supplierinfo,type:0 msgid "Type" msgstr "Tip" + +#. module: product_supplierinfo_for_customer +#: view:product.template:product_supplierinfo_for_customer.product_template_extended_form_view +msgid "[('type','=','supplier')]" +msgstr "[('type','=','supplier')]" + +#. module: product_supplierinfo_for_customer +#: view:product.template:product_supplierinfo_for_customer.product_template_extended_form_view +msgid "" +"{'default_search_type':'supplier','default_type':'supplier','default_product_tmpl_id':id}" +msgstr "" +"{'default_search_type':'supplier','default_type':'supplier','default_product_tmpl_id':id}" + +#. module: product_supplierinfo_for_customer +#: view:product.supplierinfo:product_supplierinfo_for_customer.product_supplierinfo_extended_form_view +msgid "{'select_type': type}" +msgstr "{'select_type': type}" From b7bbd524256a01c0f42075da989b4cf36862fb30 Mon Sep 17 00:00:00 2001 From: Yennifer Santiago Date: Wed, 28 Jun 2017 14:41:57 +0000 Subject: [PATCH 12/19] product_customer_code: New README. [REF] product_supplierinfo_for_customer: Complete README. --- product_supplierinfo_for_customer/README.rst | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/product_supplierinfo_for_customer/README.rst b/product_supplierinfo_for_customer/README.rst index a51a69d4454..0faca127474 100644 --- a/product_supplierinfo_for_customer/README.rst +++ b/product_supplierinfo_for_customer/README.rst @@ -28,13 +28,16 @@ suppliers. :alt: Try me on Runbot :target: https://runbot.odoo-community.org/runbot/188/8.0 + +The product code / product name specified for the customer can be reflected +on the sale orders using module `product_supplierinfo_for_customer_sale +`_ + Known issues / Roadmap ====================== * Product prices through this method are only guaranteed on the standard sale order workflow. Other custom flows maybe don't reflect the price. -* The product code / product name specified for the customer will not be - reflected on the sale orders. * The minimum quantity will not also be applied on sale orders. * Computed fields in product.supplierinfo object won't properly work for customer type From 2c82565c1f7cd1c3356fa2170dc458a297288456 Mon Sep 17 00:00:00 2001 From: aheficent Date: Mon, 31 Jul 2017 15:21:58 +0200 Subject: [PATCH 13/19] product_supplierinfo_for_customer to v9 --- product_supplierinfo_for_customer/README.rst | 5 +- .../__openerp__.py | 28 ++------ .../demo/product_demo.xml | 3 - .../models/__init__.py | 1 - .../models/product_pricelist.py | 18 ----- .../test_product_supplierinfo_for_customer.py | 69 ++++++++++++++++--- .../views/product_view.xml | 27 ++++---- 7 files changed, 82 insertions(+), 69 deletions(-) delete mode 100644 product_supplierinfo_for_customer/models/product_pricelist.py diff --git a/product_supplierinfo_for_customer/README.rst b/product_supplierinfo_for_customer/README.rst index 0faca127474..a2d9df46b21 100644 --- a/product_supplierinfo_for_customer/README.rst +++ b/product_supplierinfo_for_customer/README.rst @@ -7,7 +7,7 @@ Use product supplier info also for customers ============================================ This modules allows to use supplier info structure, available in -*Procurements* tab of the product form, also for defining customer information, +*Inventory* tab of the product form, also for defining customer information, allowing to define prices per customer and product. Configuration @@ -26,7 +26,7 @@ suppliers. .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas :alt: Try me on Runbot - :target: https://runbot.odoo-community.org/runbot/188/8.0 + :target: https://runbot.odoo-community.org/runbot/188/9.0 The product code / product name specified for the customer can be reflected @@ -49,3 +49,4 @@ Contributors ------------ * Oihane Crucelaegui * Pedro M. Baeza +* Aaron Henriquez diff --git a/product_supplierinfo_for_customer/__openerp__.py b/product_supplierinfo_for_customer/__openerp__.py index dcf3495737c..24881a189a5 100644 --- a/product_supplierinfo_for_customer/__openerp__.py +++ b/product_supplierinfo_for_customer/__openerp__.py @@ -1,28 +1,14 @@ # -*- coding: utf-8 -*- -############################################################################## -# -# 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 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/. -# -############################################################################## +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). { "name": "Use product supplier info for customers too", - "version": "8.0.1.0.0", - "author": "OdooMRP team," - "AvanzOSC," - "Serv. Tecnol. Avanzados - Pedro M. Baeza," + "version": "9.0.1.0.0", + "author": "OdooMRP team, " + "AvanzOSC, " + "Tecnativa, " + "Eficent, " "Odoo Community Association (OCA)", - "website": "http://www.odoomrp.com", + "website": "https://github.com/OCA/product-attribute", "category": "Sales Management", "license": 'AGPL-3', "depends": [ diff --git a/product_supplierinfo_for_customer/demo/product_demo.xml b/product_supplierinfo_for_customer/demo/product_demo.xml index d667cc72421..c6a331f13d3 100644 --- a/product_supplierinfo_for_customer/demo/product_demo.xml +++ b/product_supplierinfo_for_customer/demo/product_demo.xml @@ -7,9 +7,6 @@ 1 1 customer - diff --git a/product_supplierinfo_for_customer/models/__init__.py b/product_supplierinfo_for_customer/models/__init__.py index 3e4ccebb841..f4daa63b35a 100644 --- a/product_supplierinfo_for_customer/models/__init__.py +++ b/product_supplierinfo_for_customer/models/__init__.py @@ -5,4 +5,3 @@ from . import product_supplierinfo from . import product_template from . import res_partner -from . import product_pricelist diff --git a/product_supplierinfo_for_customer/models/product_pricelist.py b/product_supplierinfo_for_customer/models/product_pricelist.py deleted file mode 100644 index cac559a0c09..00000000000 --- a/product_supplierinfo_for_customer/models/product_pricelist.py +++ /dev/null @@ -1,18 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# For copyright and license notices, see __openerp__.py file in root directory -############################################################################## -from openerp import models, api - - -class ProductPricelist(models.Model): - _inherit = 'product.pricelist' - - @api.multi - def price_rule_get(self, prod_id, qty, partner=None): - """Pass context if the type of the pricelist is sale for restricting - on the search product.supplierinfo records of type customer.""" - obj = (self.with_context(supplierinfo_type='customer') if - self.type == 'sale' else self) - return super(ProductPricelist, obj).price_rule_get( - prod_id, qty, partner=partner) diff --git a/product_supplierinfo_for_customer/tests/test_product_supplierinfo_for_customer.py b/product_supplierinfo_for_customer/tests/test_product_supplierinfo_for_customer.py index c2723f1e217..23940de587f 100644 --- a/product_supplierinfo_for_customer/tests/test_product_supplierinfo_for_customer.py +++ b/product_supplierinfo_for_customer/tests/test_product_supplierinfo_for_customer.py @@ -12,12 +12,62 @@ def setUp(self): self.supplierinfo_model = self.env['product.supplierinfo'] self.pricelist_item_model = self.env['product.pricelist.item'] self.pricelist_model = self.env['product.pricelist'] - self.customer = self.env.ref('base.res_partner_2') + self.customer = self._create_customer('customer1') self.product = self.env.ref('product.product_product_4') - self.pricelist = self.env.ref('product.list0') - self.pricelist_item = self.pricelist_item_model.browse( - self.env.ref('product.item0').id) - self.pricelist_item.write({'base': -2}) + self.supplierinfo = self._create_supplierinfo( + 'customer', self.customer, self.product) + self.pricelist = self.env['product.pricelist'].create({ + 'name': 'Test Pricelist', + 'currency_id': self.env.ref('base.USD').id, + }) + self.pricelist_item = self.env['product.pricelist.item'].create({ + 'applied_on': '1_product', + 'base': 'list_price', + 'name': 'Test Pricelist Item', + 'pricelist_id': self.pricelist.id, + 'compute_price': 'fixed', + 'fixed_price': 100.0, + 'product_tmpl_id': self.product.id, + 'sequence': 5, + }) + + def _create_customer(self, name): + """Create a Partner.""" + return self.env['res.partner'].create({ + 'name': name, + 'email': 'example@yourcompany.com', + 'customer': True, + 'phone': 123456, + }) + + def _create_supplierinfo(self, type, partner, product): + return self.env['product.supplierinfo'].create({ + 'name': partner.id, + 'product_id': product.id, + 'product_code': '00001', + 'type': type, + 'price': 100.0, + }) + + def test_default_get(self): + """ checking values returned by default_get() """ + fields = ['name'] + values = self.customer.with_context( + select_type=True).default_get(fields) + self.assertEqual(values['customer'], False, "Incorrect default") + + def test_onchange_type(self): + sup_info = self._create_supplierinfo( + 'supplier', self.customer, self.product) + res = sup_info.onchange_type() + domain = res.get('domain', False) + name_dom = domain.get('name', False) + self.assertEqual(name_dom, [('supplier', '=', True)]) + sup_info.write({'type': 'customer'}) + res = sup_info.onchange_type() + domain = res.get('domain', False) + name_dom = domain.get('name', False) + self.assertEqual(name_dom, [('customer', '=', True)]) def test_product_supplierinfo_for_customer(self): cond = [('name', '=', self.customer.id)] @@ -28,13 +78,12 @@ def test_product_supplierinfo_for_customer(self): customerinfos = self.supplierinfo_model.with_context( supplierinfo_type='customer').search(cond) self.assertNotEqual(len(customerinfos), 0, - "Error: Supplier not found in Supplierinfo") - price_unit = self.pricelist_model.with_context( - supplierinfo_type='customer').price_rule_get( - self.product.id, 7, partner=self.customer.id) + "Error: Customer not found in Supplierinfo") + price_unit = self.pricelist_model.price_rule_get( + self.product.id, 1, partner=self.customer.id) self.assertTrue( price_unit.get(self.pricelist.id, False), "Error: Price unit not found for customer") price = price_unit.get(self.pricelist.id, False)[0] - self.assertEqual(price, 20.0, + self.assertEqual(price, 100.0, "Error: Price not found for product and customer") diff --git a/product_supplierinfo_for_customer/views/product_view.xml b/product_supplierinfo_for_customer/views/product_view.xml index f6db3069922..ddeee2e809e 100644 --- a/product_supplierinfo_for_customer/views/product_view.xml +++ b/product_supplierinfo_for_customer/views/product_view.xml @@ -66,7 +66,7 @@ product.template.extended.form product.template - + {'default_search_type':'supplier','default_type':'supplier','default_product_tmpl_id':id} @@ -78,14 +78,12 @@ context="{'default_search_type':'supplier','default_type':'supplier','default_product_tmpl_id':id}" domain="[('type','=','supplier')]" /> - +
- +
@@ -94,20 +92,21 @@ product.supplierinfo - - + + + name="is_customer_filter"/> - + name="is_supplier_filter"/> + + domain="[]" context="{'group_by':'name'}"/> + name="gb_product_template" + context="{'group_by':'product_tmpl_id'}"/> - + From a275bb91993126b4603f107e25141a77ba9ffc70 Mon Sep 17 00:00:00 2001 From: aheficent Date: Fri, 29 Sep 2017 16:13:53 +0200 Subject: [PATCH 14/19] [MIG] product_supplierinfo_for_customer to v10 --- product_supplierinfo_for_customer/README.rst | 17 ++--- product_supplierinfo_for_customer/__init__.py | 3 - .../{__openerp__.py => __manifest__.py} | 10 +-- .../demo/product_demo.xml | 4 +- .../models/__init__.py | 3 - .../models/product_supplierinfo.py | 20 +++--- .../models/product_template.py | 9 +-- .../models/res_partner.py | 9 +-- .../tests/__init__.py | 3 - .../test_product_supplierinfo_for_customer.py | 9 +-- .../views/product_view.xml | 64 +++++++++++++------ 11 files changed, 81 insertions(+), 70 deletions(-) rename product_supplierinfo_for_customer/{__openerp__.py => __manifest__.py} (77%) diff --git a/product_supplierinfo_for_customer/README.rst b/product_supplierinfo_for_customer/README.rst index a2d9df46b21..601c1edec91 100644 --- a/product_supplierinfo_for_customer/README.rst +++ b/product_supplierinfo_for_customer/README.rst @@ -1,4 +1,4 @@ -.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.png :alt: License: AGPL-3 :target: http://www.gnu.org/licenses/agpl-3.0.en.html @@ -15,7 +15,7 @@ Configuration For these prices to be used in sale prices calculations, you will have to create a pricelist with a rule with option "Based on" with the value -"Supplier prices on the product form" (although the text is not clear enough). +"Supplier prices on the product form". Usage ===== @@ -26,21 +26,14 @@ suppliers. .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas :alt: Try me on Runbot - :target: https://runbot.odoo-community.org/runbot/188/9.0 - - -The product code / product name specified for the customer can be reflected -on the sale orders using module `product_supplierinfo_for_customer_sale -`_ + :target: https://runbot.odoo-community.org/runbot/188/10.0 Known issues / Roadmap ====================== * Product prices through this method are only guaranteed on the standard sale order workflow. Other custom flows maybe don't reflect the price. -* The minimum quantity will not also be applied on sale orders. -* Computed fields in product.supplierinfo object won't properly work for - customer type +* The minimum quantity will neither apply on sale orders. Credits ======= @@ -48,5 +41,5 @@ Credits Contributors ------------ * Oihane Crucelaegui -* Pedro M. Baeza +* Tecnativa - Pedro M. Baeza * Aaron Henriquez diff --git a/product_supplierinfo_for_customer/__init__.py b/product_supplierinfo_for_customer/__init__.py index 2bbe2de9996..a0fdc10fe11 100644 --- a/product_supplierinfo_for_customer/__init__.py +++ b/product_supplierinfo_for_customer/__init__.py @@ -1,5 +1,2 @@ # -*- coding: utf-8 -*- -############################################################################## -# For copyright and license notices, see __openerp__.py file in root directory -############################################################################## from . import models diff --git a/product_supplierinfo_for_customer/__openerp__.py b/product_supplierinfo_for_customer/__manifest__.py similarity index 77% rename from product_supplierinfo_for_customer/__openerp__.py rename to product_supplierinfo_for_customer/__manifest__.py index 24881a189a5..f61cd9647dd 100644 --- a/product_supplierinfo_for_customer/__openerp__.py +++ b/product_supplierinfo_for_customer/__manifest__.py @@ -1,12 +1,13 @@ # -*- coding: utf-8 -*- +# Copyright 2015 OdooMRP team +# Copyright 2015 AvanzOSC +# Copyright 2015 Tecnativa # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). { "name": "Use product supplier info for customers too", - "version": "9.0.1.0.0", - "author": "OdooMRP team, " - "AvanzOSC, " + "version": "10.0.1.0.0", + "author": "AvanzOSC, " "Tecnativa, " - "Eficent, " "Odoo Community Association (OCA)", "website": "https://github.com/OCA/product-attribute", "category": "Sales Management", @@ -14,6 +15,7 @@ "depends": [ "base", "product", + "purchase", ], "data": [ "views/product_view.xml", diff --git a/product_supplierinfo_for_customer/demo/product_demo.xml b/product_supplierinfo_for_customer/demo/product_demo.xml index c6a331f13d3..123cbe06e8a 100644 --- a/product_supplierinfo_for_customer/demo/product_demo.xml +++ b/product_supplierinfo_for_customer/demo/product_demo.xml @@ -1,5 +1,5 @@ - + @@ -9,4 +9,4 @@ customer - + diff --git a/product_supplierinfo_for_customer/models/__init__.py b/product_supplierinfo_for_customer/models/__init__.py index f4daa63b35a..fe99cab361e 100644 --- a/product_supplierinfo_for_customer/models/__init__.py +++ b/product_supplierinfo_for_customer/models/__init__.py @@ -1,7 +1,4 @@ # -*- coding: utf-8 -*- -############################################################################## -# For copyright and license notices, see __openerp__.py file in root directory -############################################################################## from . import product_supplierinfo from . import product_template from . import res_partner diff --git a/product_supplierinfo_for_customer/models/product_supplierinfo.py b/product_supplierinfo_for_customer/models/product_supplierinfo.py index 635c2ec1887..5c01d9ab558 100644 --- a/product_supplierinfo_for_customer/models/product_supplierinfo.py +++ b/product_supplierinfo_for_customer/models/product_supplierinfo.py @@ -1,8 +1,9 @@ # -*- coding: utf-8 -*- -############################################################################## -# For copyright and license notices, see __openerp__.py file in root directory -############################################################################## -from openerp import models, fields, api +# Copyright 2015 OdooMRP team +# Copyright 2015 AvanzOSC +# Copyright 2015 Tecnativa +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). +from odoo import api, fields, models class ProductSupplierinfo(models.Model): @@ -22,16 +23,13 @@ def onchange_type(self): return {'domain': {'name': [('customer', '=', True)]}} return {'domain': {'name': []}} - def search(self, cr, uid, args, offset=0, limit=None, order=None, - context=None, count=False): + @api.model + def search(self, args, offset=0, limit=None, order=None, count=False): """Add search argument for field type if the context says so. This should be in old API because context argument is not the last one. """ - if context is None: - context = {} if not any(arg[0] == 'type' for arg in args): args += [('type', '=', - context.get('supplierinfo_type', 'supplier'))] + self.env.context.get('supplierinfo_type', 'supplier'))] return super(ProductSupplierinfo, self).search( - cr, uid, args, offset=offset, limit=limit, order=order, - context=context, count=count) + args, offset=offset, limit=limit, order=order, count=count) diff --git a/product_supplierinfo_for_customer/models/product_template.py b/product_supplierinfo_for_customer/models/product_template.py index 4fa58d94acd..360562a9cd3 100644 --- a/product_supplierinfo_for_customer/models/product_template.py +++ b/product_supplierinfo_for_customer/models/product_template.py @@ -1,8 +1,9 @@ # -*- coding: utf-8 -*- -############################################################################## -# For copyright and license notices, see __openerp__.py file in root directory -############################################################################## -from openerp import models, fields +# Copyright 2015 OdooMRP team +# Copyright 2015 AvanzOSC +# Copyright 2015 Tecnativa +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). +from odoo import fields, models class ProductTemplate(models.Model): diff --git a/product_supplierinfo_for_customer/models/res_partner.py b/product_supplierinfo_for_customer/models/res_partner.py index 8e41b79cb5d..7ca95f3abe7 100644 --- a/product_supplierinfo_for_customer/models/res_partner.py +++ b/product_supplierinfo_for_customer/models/res_partner.py @@ -1,8 +1,9 @@ # -*- coding: utf-8 -*- -############################################################################## -# For copyright and license notices, see __openerp__.py file in root directory -############################################################################## -from openerp import models, api +# Copyright 2015 OdooMRP team +# Copyright 2015 AvanzOSC +# Copyright 2015 Tecnativa +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). +from odoo import api, models class ResPartner(models.Model): diff --git a/product_supplierinfo_for_customer/tests/__init__.py b/product_supplierinfo_for_customer/tests/__init__.py index bc0476c8174..02b8a718f29 100644 --- a/product_supplierinfo_for_customer/tests/__init__.py +++ b/product_supplierinfo_for_customer/tests/__init__.py @@ -1,5 +1,2 @@ # -*- coding: utf-8 -*- -############################################################################## -# For copyright and license notices, see __openerp__.py file in root directory -############################################################################## from . import test_product_supplierinfo_for_customer diff --git a/product_supplierinfo_for_customer/tests/test_product_supplierinfo_for_customer.py b/product_supplierinfo_for_customer/tests/test_product_supplierinfo_for_customer.py index 23940de587f..41cdf12aacd 100644 --- a/product_supplierinfo_for_customer/tests/test_product_supplierinfo_for_customer.py +++ b/product_supplierinfo_for_customer/tests/test_product_supplierinfo_for_customer.py @@ -1,8 +1,9 @@ # -*- coding: utf-8 -*- -############################################################################## -# For copyright and license notices, see __openerp__.py file in root directory -############################################################################## -import openerp.tests.common as common +# Copyright 2015 OdooMRP team +# Copyright 2015 AvanzOSC +# Copyright 2015 Tecnativa +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). +import odoo.tests.common as common class TestProductSupplierinfoForCustomer(common.TransactionCase): diff --git a/product_supplierinfo_for_customer/views/product_view.xml b/product_supplierinfo_for_customer/views/product_view.xml index ddeee2e809e..5721a982615 100644 --- a/product_supplierinfo_for_customer/views/product_view.xml +++ b/product_supplierinfo_for_customer/views/product_view.xml @@ -3,26 +3,42 @@ + product.supplierinfo.extended.form product.supplierinfo - - - Partner - {'select_type': type} - - - Partner Product Name - - - Partner Product Code - - - Partner Unit of Measure - - - - +
+ + + + + + + + + + + + + + + +
@@ -63,10 +79,10 @@
- + product.template.extended.form product.template - + {'default_search_type':'supplier','default_type':'supplier','default_product_tmpl_id':id} @@ -78,6 +94,14 @@ context="{'default_search_type':'supplier','default_type':'supplier','default_product_tmpl_id':id}" domain="[('type','=','supplier')]" /> + + + + + product.template.extended.form + product.template + +
- From 0dc95a32171df6e3e102fd325383ef25226f90bf Mon Sep 17 00:00:00 2001 From: aheficent Date: Mon, 6 Nov 2017 18:02:06 +0100 Subject: [PATCH 15/19] [IMP] Add back the option to import the prices from supplierinfo to PL --- product_supplierinfo_for_customer/README.rst | 5 +- .../models/__init__.py | 2 + .../models/pricelist.py | 24 ++ .../models/product_product.py | 50 +++ .../test_product_supplierinfo_for_customer.py | 22 ++ .../views/product_view.xml | 321 +++++++++--------- 6 files changed, 261 insertions(+), 163 deletions(-) create mode 100644 product_supplierinfo_for_customer/models/pricelist.py create mode 100644 product_supplierinfo_for_customer/models/product_product.py diff --git a/product_supplierinfo_for_customer/README.rst b/product_supplierinfo_for_customer/README.rst index 601c1edec91..a6f4d2f41e2 100644 --- a/product_supplierinfo_for_customer/README.rst +++ b/product_supplierinfo_for_customer/README.rst @@ -15,7 +15,7 @@ Configuration For these prices to be used in sale prices calculations, you will have to create a pricelist with a rule with option "Based on" with the value -"Supplier prices on the product form". +"Partner Prices: Take the price from the customer info on the 'product form')". Usage ===== @@ -24,6 +24,9 @@ There's a new section on *Sales* tab of the product form called "Customers", where you can define records for customers with the same structure of the suppliers. +There's a new option on pricelist items that allows to get the prices from the + supplierinfo at the product form. + .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas :alt: Try me on Runbot :target: https://runbot.odoo-community.org/runbot/188/10.0 diff --git a/product_supplierinfo_for_customer/models/__init__.py b/product_supplierinfo_for_customer/models/__init__.py index fe99cab361e..6ab9a3a8829 100644 --- a/product_supplierinfo_for_customer/models/__init__.py +++ b/product_supplierinfo_for_customer/models/__init__.py @@ -1,4 +1,6 @@ # -*- coding: utf-8 -*- +from . import pricelist from . import product_supplierinfo +from . import product_product from . import product_template from . import res_partner diff --git a/product_supplierinfo_for_customer/models/pricelist.py b/product_supplierinfo_for_customer/models/pricelist.py new file mode 100644 index 00000000000..c180d689642 --- /dev/null +++ b/product_supplierinfo_for_customer/models/pricelist.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +# Copyright 2015 OdooMRP team +# Copyright 2015 AvanzOSC +# Copyright 2015 Tecnativa +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). +from odoo import fields, models + + +class ProductPricelistItem(models.Model): + _inherit = "product.pricelist.item" + + base = fields.Selection([ + ('list_price', 'Public Price'), + ('standard_price', 'Cost'), + ('pricelist', 'Other Pricelist'), + ('partner', 'Partner Prices on the product form')], + default='list_price', required=True, + help='Base price for computation.\n' + 'Public Price: The base price will be the Sale/public Price.\n' + 'Cost Price : The base price will be the cost price.\n' + 'Other Pricelist : Computation of the base price based on another' + ' Pricelist.' + 'Partner Prices: Take the price from the customer info on the' + ' product form') diff --git a/product_supplierinfo_for_customer/models/product_product.py b/product_supplierinfo_for_customer/models/product_product.py new file mode 100644 index 00000000000..4f5a5cbbbc2 --- /dev/null +++ b/product_supplierinfo_for_customer/models/product_product.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- +# Copyright 2015 OdooMRP team +# Copyright 2015 AvanzOSC +# Copyright 2015 Tecnativa +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). +from odoo import api, models + + +class ProductProduct(models.Model): + _inherit = 'product.product' + + @api.multi + def _get_price_from_supplierinfo(self, partner_id): + for product in self: + if partner_id: + supplierinfo = self.env['product.supplierinfo'].search( + ['|', ('product_tmpl_id', '=', product.product_tmpl_id.id), + ('product_id', '=', product.id), + ('type', '=', 'customer'), + ('name', '=', partner_id)]) + if supplierinfo: + return supplierinfo.price + return 0.0 + + @api.multi + def price_compute( + self, price_type, uom=False, currency=False, company=False): + for product in self: + if price_type == 'partner': + partner = self.env.context.get('partner_id', False) + price = product._get_price_from_supplierinfo(partner) + if not price: + return super(ProductProduct, self).price_compute( + 'list_price', uom, currency, company) + prices = dict.fromkeys(self.ids, 0.0) + prices[product.id] = price + if not uom and self._context.get('uom'): + uom = self.env['product.uom'].browse(self._context['uom']) + if not currency and self._context.get('currency'): + currency = self.env['res.currency'].browse( + self._context['currency']) + if uom: + prices[product.id] = product.uom_id._compute_price( + prices[product.id], uom) + if currency: + prices[product.id] = product.currency_id.compute( + prices[product.id], currency) + return prices + return super(ProductProduct, self).price_compute( + price_type, uom, currency, company) diff --git a/product_supplierinfo_for_customer/tests/test_product_supplierinfo_for_customer.py b/product_supplierinfo_for_customer/tests/test_product_supplierinfo_for_customer.py index 41cdf12aacd..bfe104094d1 100644 --- a/product_supplierinfo_for_customer/tests/test_product_supplierinfo_for_customer.py +++ b/product_supplierinfo_for_customer/tests/test_product_supplierinfo_for_customer.py @@ -14,6 +14,7 @@ def setUp(self): self.pricelist_item_model = self.env['product.pricelist.item'] self.pricelist_model = self.env['product.pricelist'] self.customer = self._create_customer('customer1') + self.unknown = self._create_customer('customer2') self.product = self.env.ref('product.product_product_4') self.supplierinfo = self._create_supplierinfo( 'customer', self.customer, self.product) @@ -21,6 +22,7 @@ def setUp(self): 'name': 'Test Pricelist', 'currency_id': self.env.ref('base.USD').id, }) + self.company = self.env.ref('base.main_company') self.pricelist_item = self.env['product.pricelist.item'].create({ 'applied_on': '1_product', 'base': 'list_price', @@ -88,3 +90,23 @@ def test_product_supplierinfo_for_customer(self): price = price_unit.get(self.pricelist.id, False)[0] self.assertEqual(price, 100.0, "Error: Price not found for product and customer") + + def test_product_supplierinfo_price(self): + price = self.product._get_price_from_supplierinfo( + partner_id=self.customer.id) + self.assertEqual(price, 100.0, + "Error: Price not found for product and customer") + res = self.product.with_context( + partner_id=self.customer.id).price_compute( + 'partner', self.product.uom_id, self.company.currency_id, + self.company) + self.assertEqual( + res[self.product.id], 100.0, + "Error: Wrong price for product and customer") + res = self.product.with_context( + partner_id=self.unknown.id).price_compute( + 'partner', self.product.uom_id, self.company.currency_id, + self.company) + self.assertEqual( + res[self.product.id], 750.0, + "Error: price does not match list price") diff --git a/product_supplierinfo_for_customer/views/product_view.xml b/product_supplierinfo_for_customer/views/product_view.xml index 5721a982615..5f3ba00d696 100644 --- a/product_supplierinfo_for_customer/views/product_view.xml +++ b/product_supplierinfo_for_customer/views/product_view.xml @@ -1,179 +1,176 @@ - - - - - - product.supplierinfo.extended.form - product.supplierinfo - -
- - - - - - - - - - - - - - + + + + product.supplierinfo.extended.form + product.supplierinfo + + + + + + + + + + - - - + + + + + + +
+ +
+
- - product.supplierinfo.template.form - product.supplierinfo - - primary - - - - - + + product.supplierinfo.template.form + product.supplierinfo + + primary + + + + - + + - - product.supplierinfo.partner.tree - product.supplierinfo - - - - Partner - + + product.supplierinfo.partner.tree + product.supplierinfo + + + + Partner - + + - - product.supplierinfo.template.tree - product.supplierinfo - - primary - - - - - + + product.supplierinfo.template.tree + product.supplierinfo + + primary + + + + - + + - - product.template.extended.form - product.template - - - - {'default_search_type':'supplier','default_type':'supplier','default_product_tmpl_id':id} - [('type','=','supplier')] - 1 - - - - + + product.template.extended.form + product.template + + + + {'default_search_type':'supplier','default_type':'supplier','default_product_tmpl_id':id} + [('type','=','supplier')] + 1 - - - - product.template.extended.form - product.template - - -
- - - -
+ + -
+
+
- - product.supplierinfo.search - product.supplierinfo - - - - - - - - - - - - - - - + + product.template.extended.form + product.template + + +
+ + + +
+
+
- - Information about a product (customer) - ir.actions.act_window - product.supplierinfo - tree,form - form - - { - 'search_default_is_customer_filter': 1, - 'default_type': 'customer', - 'supplierinfo_type': 'customer', - } - - -

- Click to define a new product.supplierinfo. -

-
-
+ + product.supplierinfo.search + product.supplierinfo + + + + + + + + + + + + + + + + + + Information about a product (customer) + ir.actions.act_window + product.supplierinfo + tree,form + form + + { + 'search_default_is_customer_filter': 1, + 'default_type': 'customer', + 'supplierinfo_type': 'customer', + } + + +

+ Click to define a new product.supplierinfo. +

+
+
- - - form - - - + + + form + + + - - - tree - - - + + + tree + + + - + -
-
+ From 50d1172749b10fc9b185d8f1706a6f90c196a2f2 Mon Sep 17 00:00:00 2001 From: mreficent Date: Thu, 28 Jun 2018 19:44:43 +0200 Subject: [PATCH 16/19] [FIX] product_multi_category: E7901 error pylint in readme --- product_multi_category/README.rst | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/product_multi_category/README.rst b/product_multi_category/README.rst index 60854b8603b..5daf3ab5565 100644 --- a/product_multi_category/README.rst +++ b/product_multi_category/README.rst @@ -9,10 +9,11 @@ Product - Many Categories This module Extends the existing functionality of Odoo Products (One product - One Catgory) to One product -> Many Categories -*Note: This module was built generically but in focus of the Magento -Odoo connector -**Note: The additional categories are only for classification and does -not affect other operations +* Note: This module was built generically but in focus of the Magento + Odoo connector + +* Note: The additional categories are only for classification and does + not affect other operations Usage ===== From 092bffe0aa92d0c073e7d578b1dfbb23826e5519 Mon Sep 17 00:00:00 2001 From: mreficent Date: Thu, 28 Jun 2018 19:49:20 +0200 Subject: [PATCH 17/19] [FIX] product_sequence: E8103 sql-injection pylint error --- product_sequence/tests/test_product_sequence.py | 1 + 1 file changed, 1 insertion(+) diff --git a/product_sequence/tests/test_product_sequence.py b/product_sequence/tests/test_product_sequence.py index 9d344dbd2cd..4fe7e4be2b5 100644 --- a/product_sequence/tests/test_product_sequence.py +++ b/product_sequence/tests/test_product_sequence.py @@ -39,6 +39,7 @@ def test_pre_init_hook(self): name="Apple", default_code='PROD03' )) + # pylint: disable=sql-injection self.cr.execute( "update product_product set default_code='/' where id=%s" % (product_3.id,)) From e6d6619399d9507dd4cf68f1aa13df1c4778b360 Mon Sep 17 00:00:00 2001 From: mreficent Date: Thu, 28 Jun 2018 19:50:17 +0200 Subject: [PATCH 18/19] [FIX] customer_pricing_in_product_view: E7901 pylint error --- customer_pricing_in_product_view/README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/customer_pricing_in_product_view/README.rst b/customer_pricing_in_product_view/README.rst index 82fa988a831..f2b77572082 100644 --- a/customer_pricing_in_product_view/README.rst +++ b/customer_pricing_in_product_view/README.rst @@ -38,7 +38,7 @@ Known issues / Roadmap * Previous versions of this module allowed the customers name to be typed directly in the view. * While fields.dummy has been deprecated the functionality can still be acheived by an unstored many2one -on product.template in the same way as pricelist_id is currently stored. + on product.template in the same way as pricelist_id is currently stored. However, the way in which the context is set presents two issues. From 38684746cc0f393768217b2a0395b798d71cf93e Mon Sep 17 00:00:00 2001 From: mreficent Date: Thu, 28 Jun 2018 19:52:48 +0200 Subject: [PATCH 19/19] [FIX] product_variant_inactive: E7901 pylint error --- product_variant_inactive/README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/product_variant_inactive/README.rst b/product_variant_inactive/README.rst index 373615b156b..a40e37bd5e2 100644 --- a/product_variant_inactive/README.rst +++ b/product_variant_inactive/README.rst @@ -63,7 +63,7 @@ Installation To install this module, you need to: -*To install Product module +* To install Product module For further information, please visit: