From 26202b9bd365d452d844ed52e91840bb1252f167 Mon Sep 17 00:00:00 2001 From: Swapnesh Date: Tue, 6 Feb 2018 15:50:16 +0530 Subject: [PATCH] [MIG] sale_last_price_info: Migration to 11.0 --- sale_last_price_info/README.rst | 4 +- sale_last_price_info/__init__.py | 7 +--- sale_last_price_info/__manifest__.py | 36 ++++------------ sale_last_price_info/i18n/de.po | 42 +++++++++++-------- sale_last_price_info/i18n/es.po | 41 +++++++++++------- sale_last_price_info/i18n/fr.po | 39 ++++++++++------- sale_last_price_info/i18n/it.po | 39 ++++++++++------- .../i18n/sale_last_price_info.pot | 6 +-- sale_last_price_info/i18n/sl.po | 33 --------------- sale_last_price_info/i18n/sl_SI.po | 42 +++++++++++++++++++ sale_last_price_info/models/__init__.py | 7 +--- sale_last_price_info/models/product.py | 18 ++++---- sale_last_price_info/tests/__init__.py | 7 +--- .../tests/test_sale_last_price_info.py | 13 +++--- sale_last_price_info/views/product_view.xml | 22 +++------- 15 files changed, 178 insertions(+), 178 deletions(-) delete mode 100644 sale_last_price_info/i18n/sl.po create mode 100644 sale_last_price_info/i18n/sl_SI.po diff --git a/sale_last_price_info/README.rst b/sale_last_price_info/README.rst index a4da182eac56..12c6a9084d5d 100644 --- a/sale_last_price_info/README.rst +++ b/sale_last_price_info/README.rst @@ -1,6 +1,7 @@ .. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg :alt: License: AGPL-3 +============================== Product Last Price Info - Sale ============================== @@ -13,7 +14,7 @@ Bug Tracker Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed feedback -`here `_. +`here `_. Credits @@ -25,6 +26,7 @@ Contributors * Oihane Crucelaegui * Pedro M. Baeza * Ana Juaristi +* Serpent Consulting Services Pvt. Ltd. Maintainer ---------- diff --git a/sale_last_price_info/__init__.py b/sale_last_price_info/__init__.py index 054c8853d838..2e157e74b1a4 100644 --- a/sale_last_price_info/__init__.py +++ b/sale_last_price_info/__init__.py @@ -1,6 +1,3 @@ -# -*- encoding: utf-8 -*- -############################################################################## -# For copyright and license notices, see __openerp__.py file in root directory -############################################################################## +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -from . import models +from . import models \ No newline at end of file diff --git a/sale_last_price_info/__manifest__.py b/sale_last_price_info/__manifest__.py index 17b105b08572..ac42fae51c86 100644 --- a/sale_last_price_info/__manifest__.py +++ b/sale_last_price_info/__manifest__.py @@ -1,42 +1,24 @@ -# -*- 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/. -# -############################################################################## +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + { "name": "Product Last Price Info - Sale", - "version": "8.0.1.0.0", - "category": "Sales Management", - "license": "AGPL-3", + "version": "11.0.1.0.0", "author": "OdooMRP team, " "AvanzOSC, " "Serv. Tecnol. Avanzados - Pedro M. Baeza, " "Odoo Community Association (OCA)", "website": "http://www.odoomrp.com", + "category": "Sales", + "license": "AGPL-3", "contributors": [ "Alfredo de la Fuente ", "Oihane Crucelaegui ", "Pedro M. Baeza ", "Ana Juaristi ", + "Serpent Consulting Services Pvt. Ltd. ", ], - "depends": [ - "sale", - ], - "data": [ - "views/product_view.xml", - ], - 'installable': False, + "depends": ["sale_management"], + "data": ["views/product_view.xml"], + 'installable': True, } diff --git a/sale_last_price_info/i18n/de.po b/sale_last_price_info/i18n/de.po index 7733cd0d8e73..f92c96c20c0d 100644 --- a/sale_last_price_info/i18n/de.po +++ b/sale_last_price_info/i18n/de.po @@ -1,34 +1,42 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * sale_last_price_info -# -# Translators: -# Rudolf Schnapka , 2015 +# * sale_last_price_info +# msgid "" msgstr "" -"Project-Id-Version: sale-workflow (8.0)\n" +"Project-Id-Version: Odoo Server 11.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-10-08 20:48+0000\n" -"PO-Revision-Date: 2015-10-09 13:42+0000\n" -"Last-Translator: Rudolf Schnapka \n" -"Language-Team: German (http://www.transifex.com/oca/OCA-sale-workflow-8-0/language/de/)\n" +"POT-Creation-Date: 2018-01-19 07:31+0000\n" +"PO-Revision-Date: 2018-01-19 07:31+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" -"Language: de\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"Plural-Forms: \n" #. module: sale_last_price_info -#: view:product.product:sale_last_price_info.product_last_sale_info_form_view -msgid "Last Price Info" -msgstr "Letzter Verkaufspreis" +#: model:ir.model.fields,field_description:sale_last_price_info.field_product_product_last_customer_id +msgid "Last Customer" +msgstr "Last Customer" + +#. module: sale_last_price_info +#: model:ir.model.fields,field_description:sale_last_price_info.field_product_product_last_sale_date +msgid "Last Sale Date" +msgstr "Last Sale Date" + +#. module: sale_last_price_info +#: model:ir.model.fields,field_description:sale_last_price_info.field_product_product_last_sale_price +msgid "Last Sale Price" +msgstr "Last Sale Price" #. module: sale_last_price_info #: model:ir.model,name:sale_last_price_info.model_product_product msgid "Product" -msgstr "Produkt" +msgstr "Product" #. module: sale_last_price_info -#: view:product.product:sale_last_price_info.product_last_sale_info_form_view +#: model:ir.ui.view,arch_db:sale_last_price_info.product_last_sale_info_form_view msgid "Sale" -msgstr "Verkauf" +msgstr "Sale" + diff --git a/sale_last_price_info/i18n/es.po b/sale_last_price_info/i18n/es.po index 041f2d8d2ec3..f92c96c20c0d 100644 --- a/sale_last_price_info/i18n/es.po +++ b/sale_last_price_info/i18n/es.po @@ -1,33 +1,42 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * sale_last_price_info -# -# Translators: +# * sale_last_price_info +# msgid "" msgstr "" -"Project-Id-Version: sale-workflow (8.0)\n" +"Project-Id-Version: Odoo Server 11.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-09-09 12:27+0000\n" -"PO-Revision-Date: 2015-09-03 07:08+0000\n" -"Last-Translator: OCA Transbot \n" -"Language-Team: Spanish (http://www.transifex.com/oca/OCA-sale-workflow-8-0/language/es/)\n" +"POT-Creation-Date: 2018-01-19 07:31+0000\n" +"PO-Revision-Date: 2018-01-19 07:31+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" -"Language: es\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"Plural-Forms: \n" #. module: sale_last_price_info -#: view:product.product:sale_last_price_info.product_last_sale_info_form_view -msgid "Last Price Info" -msgstr "Información último precio" +#: model:ir.model.fields,field_description:sale_last_price_info.field_product_product_last_customer_id +msgid "Last Customer" +msgstr "Last Customer" + +#. module: sale_last_price_info +#: model:ir.model.fields,field_description:sale_last_price_info.field_product_product_last_sale_date +msgid "Last Sale Date" +msgstr "Last Sale Date" + +#. module: sale_last_price_info +#: model:ir.model.fields,field_description:sale_last_price_info.field_product_product_last_sale_price +msgid "Last Sale Price" +msgstr "Last Sale Price" #. module: sale_last_price_info #: model:ir.model,name:sale_last_price_info.model_product_product msgid "Product" -msgstr "Producto" +msgstr "Product" #. module: sale_last_price_info -#: view:product.product:sale_last_price_info.product_last_sale_info_form_view +#: model:ir.ui.view,arch_db:sale_last_price_info.product_last_sale_info_form_view msgid "Sale" -msgstr "Ventas" +msgstr "Sale" + diff --git a/sale_last_price_info/i18n/fr.po b/sale_last_price_info/i18n/fr.po index 9e2f8c65bfd2..f92c96c20c0d 100644 --- a/sale_last_price_info/i18n/fr.po +++ b/sale_last_price_info/i18n/fr.po @@ -1,33 +1,42 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * sale_last_price_info -# -# Translators: +# * sale_last_price_info +# msgid "" msgstr "" -"Project-Id-Version: sale-workflow (8.0)\n" +"Project-Id-Version: Odoo Server 11.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-09-09 12:27+0000\n" -"PO-Revision-Date: 2015-09-03 07:08+0000\n" +"POT-Creation-Date: 2018-01-19 07:31+0000\n" +"PO-Revision-Date: 2018-01-19 07:31+0000\n" "Last-Translator: <>\n" -"Language-Team: French (http://www.transifex.com/oca/OCA-sale-workflow-8-0/language/fr/)\n" +"Language-Team: \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" +"Plural-Forms: \n" #. module: sale_last_price_info -#: view:product.product:sale_last_price_info.product_last_sale_info_form_view -msgid "Last Price Info" -msgstr "" +#: model:ir.model.fields,field_description:sale_last_price_info.field_product_product_last_customer_id +msgid "Last Customer" +msgstr "Last Customer" + +#. module: sale_last_price_info +#: model:ir.model.fields,field_description:sale_last_price_info.field_product_product_last_sale_date +msgid "Last Sale Date" +msgstr "Last Sale Date" + +#. module: sale_last_price_info +#: model:ir.model.fields,field_description:sale_last_price_info.field_product_product_last_sale_price +msgid "Last Sale Price" +msgstr "Last Sale Price" #. module: sale_last_price_info #: model:ir.model,name:sale_last_price_info.model_product_product msgid "Product" -msgstr "Produit" +msgstr "Product" #. module: sale_last_price_info -#: view:product.product:sale_last_price_info.product_last_sale_info_form_view +#: model:ir.ui.view,arch_db:sale_last_price_info.product_last_sale_info_form_view msgid "Sale" -msgstr "Commande" +msgstr "Sale" + diff --git a/sale_last_price_info/i18n/it.po b/sale_last_price_info/i18n/it.po index dec53e3517de..530515cf17d3 100644 --- a/sale_last_price_info/i18n/it.po +++ b/sale_last_price_info/i18n/it.po @@ -1,33 +1,42 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * sale_last_price_info -# -# Translators: +# * sale_last_price_info +# msgid "" msgstr "" -"Project-Id-Version: sale-workflow (8.0)\n" +"Project-Id-Version: Odoo Server 11.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-10-02 17:59+0000\n" -"PO-Revision-Date: 2015-09-03 07:08+0000\n" +"POT-Creation-Date: 2018-01-19 07:32+0000\n" +"PO-Revision-Date: 2018-01-19 07:32+0000\n" "Last-Translator: <>\n" -"Language-Team: Italian (http://www.transifex.com/oca/OCA-sale-workflow-8-0/language/it/)\n" +"Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" -"Language: it\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"Plural-Forms: \n" #. module: sale_last_price_info -#: view:product.product:sale_last_price_info.product_last_sale_info_form_view -msgid "Last Price Info" -msgstr "" +#: model:ir.model.fields,field_description:sale_last_price_info.field_product_product_last_customer_id +msgid "Last Customer" +msgstr "Last Customer" + +#. module: sale_last_price_info +#: model:ir.model.fields,field_description:sale_last_price_info.field_product_product_last_sale_date +msgid "Last Sale Date" +msgstr "Last Sale Date" + +#. module: sale_last_price_info +#: model:ir.model.fields,field_description:sale_last_price_info.field_product_product_last_sale_price +msgid "Last Sale Price" +msgstr "Last Sale Price" #. module: sale_last_price_info #: model:ir.model,name:sale_last_price_info.model_product_product msgid "Product" -msgstr "Produtto" +msgstr "Product" #. module: sale_last_price_info -#: view:product.product:sale_last_price_info.product_last_sale_info_form_view +#: model:ir.ui.view,arch_db:sale_last_price_info.product_last_sale_info_form_view msgid "Sale" -msgstr "Vendite" +msgstr "Sale" + diff --git a/sale_last_price_info/i18n/sale_last_price_info.pot b/sale_last_price_info/i18n/sale_last_price_info.pot index 4eafe790ee05..626d5e74e562 100644 --- a/sale_last_price_info/i18n/sale_last_price_info.pot +++ b/sale_last_price_info/i18n/sale_last_price_info.pot @@ -4,10 +4,10 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 8.0\n" +"Project-Id-Version: Odoo Server 11.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-06-22 10:31+0000\n" -"PO-Revision-Date: 2015-06-22 10:31+0000\n" +"POT-Creation-Date: 2018-01-19 07:32+0000\n" +"PO-Revision-Date: 2018-01-19 07:32+0000\n" "Last-Translator: <>\n" "Language-Team: \n" "MIME-Version: 1.0\n" diff --git a/sale_last_price_info/i18n/sl.po b/sale_last_price_info/i18n/sl.po deleted file mode 100644 index d026ccfe138e..000000000000 --- a/sale_last_price_info/i18n/sl.po +++ /dev/null @@ -1,33 +0,0 @@ -# Translation of Odoo Server. -# This file contains the translation of the following modules: -# * sale_last_price_info -# -# Translators: -msgid "" -msgstr "" -"Project-Id-Version: sale-workflow (8.0)\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-09-09 12:27+0000\n" -"PO-Revision-Date: 2015-09-07 14:31+0000\n" -"Last-Translator: Matjaž Mozetič \n" -"Language-Team: Slovenian (http://www.transifex.com/oca/OCA-sale-workflow-8-0/language/sl/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: \n" -"Language: sl\n" -"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);\n" - -#. module: sale_last_price_info -#: view:product.product:sale_last_price_info.product_last_sale_info_form_view -msgid "Last Price Info" -msgstr "Podatki o zadnji ceni" - -#. module: sale_last_price_info -#: model:ir.model,name:sale_last_price_info.model_product_product -msgid "Product" -msgstr "Proizvod" - -#. module: sale_last_price_info -#: view:product.product:sale_last_price_info.product_last_sale_info_form_view -msgid "Sale" -msgstr "Prodaja" diff --git a/sale_last_price_info/i18n/sl_SI.po b/sale_last_price_info/i18n/sl_SI.po new file mode 100644 index 000000000000..530515cf17d3 --- /dev/null +++ b/sale_last_price_info/i18n/sl_SI.po @@ -0,0 +1,42 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * sale_last_price_info +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 11.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-01-19 07:32+0000\n" +"PO-Revision-Date: 2018-01-19 07:32+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: sale_last_price_info +#: model:ir.model.fields,field_description:sale_last_price_info.field_product_product_last_customer_id +msgid "Last Customer" +msgstr "Last Customer" + +#. module: sale_last_price_info +#: model:ir.model.fields,field_description:sale_last_price_info.field_product_product_last_sale_date +msgid "Last Sale Date" +msgstr "Last Sale Date" + +#. module: sale_last_price_info +#: model:ir.model.fields,field_description:sale_last_price_info.field_product_product_last_sale_price +msgid "Last Sale Price" +msgstr "Last Sale Price" + +#. module: sale_last_price_info +#: model:ir.model,name:sale_last_price_info.model_product_product +msgid "Product" +msgstr "Product" + +#. module: sale_last_price_info +#: model:ir.ui.view,arch_db:sale_last_price_info.product_last_sale_info_form_view +msgid "Sale" +msgstr "Sale" + diff --git a/sale_last_price_info/models/__init__.py b/sale_last_price_info/models/__init__.py index ce5472409480..6d86aa78c9fa 100644 --- a/sale_last_price_info/models/__init__.py +++ b/sale_last_price_info/models/__init__.py @@ -1,6 +1,3 @@ -# -*- encoding: utf-8 -*- -############################################################################## -# For copyright and license notices, see __openerp__.py file in root directory -############################################################################## +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -from . import product +from . import product \ No newline at end of file diff --git a/sale_last_price_info/models/product.py b/sale_last_price_info/models/product.py index b272a17a70c5..ffaf1632d7f8 100644 --- a/sale_last_price_info/models/product.py +++ b/sale_last_price_info/models/product.py @@ -1,29 +1,25 @@ -# -*- encoding: utf-8 -*- -############################################################################## -# For copyright and license notices, see __openerp__.py file in root directory -############################################################################## +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -from openerp import api, fields, models +from odoo import fields, models class ProductProduct(models.Model): _inherit = 'product.product' - @api.one - def _get_last_sale(self): + def _compute_last_sale(self): """ Get last sale price, last sale date and last customer """ lines = self.env['sale.order.line'].search( [('product_id', '=', self.id), - ('state', 'in', ['confirmed', 'done'])]).sorted( + ('state', 'in', ['sale', 'done'])]).sorted( key=lambda l: l.order_id.date_order, reverse=True) self.last_sale_date = lines[:1].order_id.date_order self.last_sale_price = lines[:1].price_unit self.last_customer_id = lines[:1].order_id.partner_id last_sale_price = fields.Float( - string='Last Sale Price', compute='_get_last_sale') + string='Last Sale Price', compute='_compute_last_sale') last_sale_date = fields.Date( - string='Last Sale Date', compute='_get_last_sale') + string='Last Sale Date', compute='_compute_last_sale') last_customer_id = fields.Many2one( comodel_name='res.partner', string='Last Customer', - compute='_get_last_sale') + compute='_compute_last_sale') diff --git a/sale_last_price_info/tests/__init__.py b/sale_last_price_info/tests/__init__.py index fddf0d4ca5fb..1f1f364c5969 100644 --- a/sale_last_price_info/tests/__init__.py +++ b/sale_last_price_info/tests/__init__.py @@ -1,6 +1,3 @@ -# -*- encoding: utf-8 -*- -############################################################################## -# For copyright and license notices, see __openerp__.py file in root directory -############################################################################## +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -from . import test_sale_last_price_info +from . import test_sale_last_price_info \ No newline at end of file diff --git a/sale_last_price_info/tests/test_sale_last_price_info.py b/sale_last_price_info/tests/test_sale_last_price_info.py index 696421d34057..19691534dc0c 100644 --- a/sale_last_price_info/tests/test_sale_last_price_info.py +++ b/sale_last_price_info/tests/test_sale_last_price_info.py @@ -1,10 +1,7 @@ -# -*- encoding: utf-8 -*- -############################################################################## -# For copyright and license notices, see __openerp__.py file in root directory -############################################################################## +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from datetime import datetime -import openerp.tests.common as common +import odoo.tests.common as common class TestSaleLastPriceInfo(common.TransactionCase): @@ -15,14 +12,14 @@ def setUp(self): self.sale_line_model = self.env['sale.order.line'] self.sale_order = self.env.ref('sale.sale_order_4') self.sale_line = self.env.ref('sale.sale_order_line_9') - self.partner = self.env.ref('base.res_partner_15') - self.product = self.env.ref('product.product_product_34') + self.partner = self.env.ref('base.res_partner_3') + self.product = self.env.ref('product.product_delivery_02') self.price_unit = 100.0 def test_sale_last_price_info_demo(self): sale_lines = self.sale_line_model.search( [('product_id', '=', self.product.id), - ('state', 'in', ['confirmed', 'done'])]).sorted( + ('state', 'in', ['sale', 'done'])]).sorted( key=lambda l: l.order_id.date_order, reverse=True) self.assertEqual( datetime.strptime( diff --git a/sale_last_price_info/views/product_view.xml b/sale_last_price_info/views/product_view.xml index e3e82f6f8213..b8ab3e300ddd 100644 --- a/sale_last_price_info/views/product_view.xml +++ b/sale_last_price_info/views/product_view.xml @@ -1,31 +1,19 @@ - - - - product.last.info.page.form - product.product - - - - - - - + product.last.sale.info.form product.product - + - + - + - - +