Skip to content

Commit

Permalink
[MIG] partner_stock_risk: Migration to 10.0
Browse files Browse the repository at this point in the history
  • Loading branch information
chienandalu committed Aug 2, 2017
1 parent 766ea48 commit a8a14ef
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 26 deletions.
8 changes: 2 additions & 6 deletions partner_stock_risk/README.rst
Expand Up @@ -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
===========
Expand All @@ -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
=======

Expand All @@ -44,7 +40,7 @@ Contributors

* Carlos Dauden <carlos.dauden@tecnativa.com>
* Pedro M. Baeza <pedro.baeza@tecnativa.com>

* David Vidal <david.vidal@tecnativa.com>

Maintainer
----------
Expand Down
@@ -1,15 +1,19 @@
# -*- coding: utf-8 -*-
# © 2016 Carlos Dauden <carlos.dauden@tecnativa.com>
# Copyright 2016 Carlos Dauden <carlos.dauden@tecnativa.com>
# Copyright 2017 David Vidal <david.vidal@tecnativa.com>
# 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,
}
6 changes: 3 additions & 3 deletions partner_stock_risk/models/stock.py
@@ -1,8 +1,8 @@
# -*- coding: utf-8 -*-
# © 2016 Carlos Dauden <carlos.dauden@tecnativa.com>
# Copyright 2016 Carlos Dauden <carlos.dauden@tecnativa.com>
# 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):
Expand Down Expand Up @@ -30,7 +30,7 @@ def show_risk_wizard(self, continue_method):
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()

Expand Down
45 changes: 33 additions & 12 deletions partner_stock_risk/tests/test_partner_stock_risk.py
@@ -1,12 +1,13 @@
# -*- coding: utf-8 -*-
# © 2016 Carlos Dauden <carlos.dauden@tecnativa.com>
# Copyright 2016 Carlos Dauden <carlos.dauden@tecnativa.com>
# Copyright 2017 David Vidal <david.vidal@tecnativa.com>
# 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):
Expand All @@ -15,27 +16,47 @@ def setUpClass(cls):
'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({
'name': '/',
'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'
Expand Down

0 comments on commit a8a14ef

Please sign in to comment.