From 8cdce6a1364972cf7c272f8bf5cf777cc8eb3a28 Mon Sep 17 00:00:00 2001 From: David Vidal Date: Wed, 2 Aug 2017 13:47:33 +0200 Subject: [PATCH] [MIG] partner_stock_risk: Migration to 10.0 --- partner_stock_risk/README.rst | 8 +--- .../{__openerp__.py => __manifest__.py} | 14 +++--- partner_stock_risk/models/stock.py | 6 +-- .../tests/test_partner_stock_risk.py | 45 ++++++++++++++----- 4 files changed, 47 insertions(+), 26 deletions(-) rename partner_stock_risk/{__openerp__.py => __manifest__.py} (50%) diff --git a/partner_stock_risk/README.rst b/partner_stock_risk/README.rst index 23ca8e137..5b6199a24 100644 --- a/partner_stock_risk/README.rst +++ b/partner_stock_risk/README.rst @@ -20,12 +20,9 @@ To use this module, you need to: #. Go to *Inventory > All Operations* #. Try transfer a risk exceed partner picking - - .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas :alt: Try me on Runbot - :target: https://runbot.odoo-community.org/runbot/134/9.0 - + :target: https://runbot.odoo-community.org/runbot/134/10.0 Bug Tracker =========== @@ -35,7 +32,6 @@ Bugs are tracked on `GitHub Issues check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed feedback. - Credits ======= @@ -44,7 +40,7 @@ Contributors * Carlos Dauden * Pedro M. Baeza - +* David Vidal Maintainer ---------- diff --git a/partner_stock_risk/__openerp__.py b/partner_stock_risk/__manifest__.py similarity index 50% rename from partner_stock_risk/__openerp__.py rename to partner_stock_risk/__manifest__.py index 9fffcb539..f66da8196 100644 --- a/partner_stock_risk/__openerp__.py +++ b/partner_stock_risk/__manifest__.py @@ -1,15 +1,19 @@ # -*- coding: utf-8 -*- -# © 2016 Carlos Dauden +# Copyright 2016 Carlos Dauden +# Copyright 2017 David Vidal # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). - { 'name': 'Partner Stock Risk', 'summary': 'Manage partner risk in stock moves', - 'version': '9.0.1.0.0', + 'version': '10.0.1.0.0', 'category': 'Sales Management', 'license': 'AGPL-3', - 'author': 'Tecnativa, Odoo Community Association (OCA)', + 'author': 'Tecnativa,' + 'Odoo Community Association (OCA)', 'website': 'https://www.tecnativa.com', - 'depends': ['stock', 'partner_financial_risk'], + 'depends': [ + 'stock', + 'partner_financial_risk' + ], 'installable': True, } diff --git a/partner_stock_risk/models/stock.py b/partner_stock_risk/models/stock.py index 3ea28811d..36920220a 100644 --- a/partner_stock_risk/models/stock.py +++ b/partner_stock_risk/models/stock.py @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- -# © 2016 Carlos Dauden +# Copyright 2016 Carlos Dauden # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from openerp import _, api, exceptions, models +from odoo import _, api, exceptions, models class StockMove(models.Model): @@ -30,7 +30,7 @@ class StockPicking(models.Model): return self.env['partner.risk.exceeded.wiz'].create({ 'exception_msg': _("Financial risk exceeded \n"), 'partner_id': self.partner_id.id, - 'origin_reference': '%s,%s' % (self._model, self.id), + 'origin_reference': '%s,%s' % (self._name, self.id), 'continue_method': continue_method, }).action_show() diff --git a/partner_stock_risk/tests/test_partner_stock_risk.py b/partner_stock_risk/tests/test_partner_stock_risk.py index 56209b98a..e2651e8ca 100644 --- a/partner_stock_risk/tests/test_partner_stock_risk.py +++ b/partner_stock_risk/tests/test_partner_stock_risk.py @@ -1,12 +1,13 @@ # -*- coding: utf-8 -*- -# © 2016 Carlos Dauden +# Copyright 2016 Carlos Dauden +# Copyright 2017 David Vidal # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from openerp import exceptions -from openerp.tests.common import SavepointCase +from odoo import exceptions +from odoo.tests import common -class TestPartnerStocklRisk(SavepointCase): +class TestPartnerStocklRisk(common.SavepointCase): @classmethod def setUpClass(cls): @@ -15,17 +16,37 @@ class TestPartnerStocklRisk(SavepointCase): 'name': 'Partner test', 'customer': True, }) - cls.product = cls.env.ref('product.product_product_36') + cls.product = cls.env['product.product'].create({ + 'name': 'Test product', + }) + cls.location = cls.env['stock.location'].create({ + 'name': 'Test location', + 'usage': 'internal', + }) + cls.location_customers = cls.env['stock.location'].create({ + 'name': 'Test location customers', + 'usage': 'customer', + }) + cls.sequence = cls.env['ir.sequence'].create({ + 'name': 'test seq', + 'implementation': 'standard', + 'padding': 1, + 'number_increment': 1, + }) + cls.stock_picking_type = cls.env['stock.picking.type'].create({ + 'name': 'Test picking type', + 'code': 'outgoing', + 'sequence_id': cls.sequence.id, + }) cls.quant = cls.env['stock.quant'].create({ 'qty': 100, - 'location_id': cls.env.ref('stock.stock_location_stock').id, + 'location_id': cls.location.id, 'product_id': cls.product.id, }) cls.picking = cls.env['stock.picking'].create({ - 'picking_type_id': cls.env.ref('stock.picking_type_out').id, - 'location_id': cls.env.ref('stock.stock_location_stock').id, - 'location_dest_id': - cls.env.ref('stock.stock_location_customers').id, + 'picking_type_id': cls.stock_picking_type.id, + 'location_id': cls.location.id, + 'location_dest_id': cls.location_customers.id, 'partner_id': cls.partner.id, }) cls.move = cls.env['stock.move'].create({ @@ -33,9 +54,9 @@ class TestPartnerStocklRisk(SavepointCase): 'picking_id': cls.picking.id, 'product_uom_qty': 10, 'product_uom': cls.product.uom_id.id, - 'location_id': cls.env.ref('stock.stock_location_stock').id, + 'location_id': cls.location.id, 'location_dest_id': - cls.env.ref('stock.stock_location_customers').id, + cls.location_customers.id, 'product_id': cls.product.id, }) cls.env.user.lang = 'en_US'