Browse Source

[MIG] partner_stock_risk: Migration to 10.0

pull/456/head
David Vidal 8 years ago
committed by David
parent
commit
8cdce6a136
  1. 8
      partner_stock_risk/README.rst
  2. 14
      partner_stock_risk/__manifest__.py
  3. 6
      partner_stock_risk/models/stock.py
  4. 45
      partner_stock_risk/tests/test_partner_stock_risk.py

8
partner_stock_risk/README.rst

@ -20,12 +20,9 @@ To use this module, you need to:
#. Go to *Inventory > All Operations* #. Go to *Inventory > All Operations*
#. Try transfer a risk exceed partner picking #. Try transfer a risk exceed partner picking
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot :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 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, 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. help us smashing it by providing a detailed and welcomed feedback.
Credits Credits
======= =======
@ -44,7 +40,7 @@ Contributors
* Carlos Dauden <carlos.dauden@tecnativa.com> * Carlos Dauden <carlos.dauden@tecnativa.com>
* Pedro M. Baeza <pedro.baeza@tecnativa.com> * Pedro M. Baeza <pedro.baeza@tecnativa.com>
* David Vidal <david.vidal@tecnativa.com>
Maintainer Maintainer
---------- ----------

14
partner_stock_risk/__openerp__.py → partner_stock_risk/__manifest__.py

@ -1,15 +1,19 @@
# -*- coding: utf-8 -*- # -*- 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). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{ {
'name': 'Partner Stock Risk', 'name': 'Partner Stock Risk',
'summary': 'Manage partner risk in stock moves', 'summary': 'Manage partner risk in stock moves',
'version': '9.0.1.0.0',
'version': '10.0.1.0.0',
'category': 'Sales Management', 'category': 'Sales Management',
'license': 'AGPL-3', 'license': 'AGPL-3',
'author': 'Tecnativa, Odoo Community Association (OCA)',
'author': 'Tecnativa,'
'Odoo Community Association (OCA)',
'website': 'https://www.tecnativa.com', 'website': 'https://www.tecnativa.com',
'depends': ['stock', 'partner_financial_risk'],
'depends': [
'stock',
'partner_financial_risk'
],
'installable': True, 'installable': True,
} }

6
partner_stock_risk/models/stock.py

@ -1,8 +1,8 @@
# -*- coding: utf-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). # 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): class StockMove(models.Model):
@ -30,7 +30,7 @@ class StockPicking(models.Model):
return self.env['partner.risk.exceeded.wiz'].create({ return self.env['partner.risk.exceeded.wiz'].create({
'exception_msg': _("Financial risk exceeded \n"), 'exception_msg': _("Financial risk exceeded \n"),
'partner_id': self.partner_id.id, '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, 'continue_method': continue_method,
}).action_show() }).action_show()

45
partner_stock_risk/tests/test_partner_stock_risk.py

@ -1,12 +1,13 @@
# -*- coding: utf-8 -*- # -*- 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). # 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 @classmethod
def setUpClass(cls): def setUpClass(cls):
@ -15,17 +16,37 @@ class TestPartnerStocklRisk(SavepointCase):
'name': 'Partner test', 'name': 'Partner test',
'customer': True, '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({ cls.quant = cls.env['stock.quant'].create({
'qty': 100, 'qty': 100,
'location_id': cls.env.ref('stock.stock_location_stock').id,
'location_id': cls.location.id,
'product_id': cls.product.id, 'product_id': cls.product.id,
}) })
cls.picking = cls.env['stock.picking'].create({ 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, 'partner_id': cls.partner.id,
}) })
cls.move = cls.env['stock.move'].create({ cls.move = cls.env['stock.move'].create({
@ -33,9 +54,9 @@ class TestPartnerStocklRisk(SavepointCase):
'picking_id': cls.picking.id, 'picking_id': cls.picking.id,
'product_uom_qty': 10, 'product_uom_qty': 10,
'product_uom': cls.product.uom_id.id, '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': 'location_dest_id':
cls.env.ref('stock.stock_location_customers').id,
cls.location_customers.id,
'product_id': cls.product.id, 'product_id': cls.product.id,
}) })
cls.env.user.lang = 'en_US' cls.env.user.lang = 'en_US'

Loading…
Cancel
Save