mirror of
https://github.com/OCA/stock-logistics-warehouse.git
synced 2025-01-21 14:27:28 +02:00
[12.0][IMP] stock_orderpoint_move_link: View transfers on orderpoint
This commit is contained in:
committed by
Guewen Baconnier
parent
e2761eca43
commit
4c4da239f1
@@ -56,6 +56,7 @@ Contributors
|
||||
|
||||
* Jordi Ballester Alomar <jordi.ballester@eficent.com>
|
||||
* Kitti Upariphutthiphong <kittiu@ecosoft.co.th>
|
||||
* Héctor Villarreal Ortega <hector.villarreal@eficent.com>
|
||||
|
||||
Maintainers
|
||||
~~~~~~~~~~~
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
# Copyright 2017 Eficent Business and IT Consulting Services, S.L.
|
||||
# Copyright 2019 Eficent Business and IT Consulting Services, S.L.
|
||||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
|
||||
from . import models
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Copyright 2017 Eficent Business and IT Consulting Services, S.L.
|
||||
# Copyright 2019 Eficent Business and IT Consulting Services, S.L.
|
||||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
|
||||
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
# Copyright 2017 Eficent Business and IT Consulting Services, S.L.
|
||||
# Copyright 2019 Eficent Business and IT Consulting Services, S.L.
|
||||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
|
||||
from . import stock
|
||||
from . import stock_move
|
||||
from . import stock_warehouse_orderpoint
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Copyright 2017 Eficent Business, IT Consulting Services, S.L., Ecosoft
|
||||
# Copyright 2019 Eficent Business, IT Consulting Services, S.L., Ecosoft
|
||||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
|
||||
from odoo import models
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Copyright 2017 Eficent Business, IT Consulting Services, S.L.
|
||||
# Copyright 2019 Eficent Business, IT Consulting Services, S.L.
|
||||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
# Copyright 2019 Eficent Business and IT Consulting Services S.L.
|
||||
# (http://www.eficent.com)
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from odoo import api, models
|
||||
|
||||
|
||||
class StockWarehouseOrderpoint(models.Model):
|
||||
_inherit = 'stock.warehouse.orderpoint'
|
||||
|
||||
@api.multi
|
||||
def action_view_stock_picking(self):
|
||||
action = self.env.ref('stock.action_picking_tree_all')
|
||||
result = action.read()[0]
|
||||
result['context'] = {}
|
||||
picking_ids = self.env['stock.move'].search(
|
||||
[('orderpoint_ids', 'in', self.id)]).mapped('picking_id')
|
||||
result['domain'] = "[('id','in',%s)]" % picking_ids.ids
|
||||
return result
|
||||
@@ -1,2 +1,3 @@
|
||||
* Jordi Ballester Alomar <jordi.ballester@eficent.com>
|
||||
* Kitti Upariphutthiphong <kittiu@ecosoft.co.th>
|
||||
* Héctor Villarreal Ortega <hector.villarreal@eficent.com>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Copyright 2019 Eficent Business and IT Consulting Services S.L.
|
||||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
import ast
|
||||
from odoo.tests.common import SavepointCase
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ class TestStockOrderpointMoveLink(SavepointCase):
|
||||
cls.route_obj = cls.env['stock.location.route']
|
||||
cls.group_obj = cls.env['procurement.group']
|
||||
cls.move_obj = cls.env['stock.move']
|
||||
cls.picking_obj = cls.env['stock.picking']
|
||||
|
||||
cls.warehouse = cls.env.ref('stock.warehouse0')
|
||||
cls.stock_loc = cls.env.ref('stock.stock_location_stock')
|
||||
@@ -26,7 +27,7 @@ class TestStockOrderpointMoveLink(SavepointCase):
|
||||
'usage': 'internal',
|
||||
'location_id': cls.warehouse.view_location_id.id,
|
||||
})
|
||||
test_route = cls.route_obj.create({
|
||||
cls.test_route = cls.route_obj.create({
|
||||
'name': 'Stock -> Test 1',
|
||||
'product_selectable': True,
|
||||
'rule_ids': [(0, 0, {
|
||||
@@ -45,7 +46,7 @@ class TestStockOrderpointMoveLink(SavepointCase):
|
||||
'usage': 'internal',
|
||||
'location_id': cls.warehouse.view_location_id.id,
|
||||
})
|
||||
test_route_2 = cls.route_obj.create({
|
||||
cls.test_route_2 = cls.route_obj.create({
|
||||
'name': 'Test 1 -> Test 2',
|
||||
'product_selectable': True,
|
||||
'rule_ids': [(0, 0, {
|
||||
@@ -61,7 +62,7 @@ class TestStockOrderpointMoveLink(SavepointCase):
|
||||
})
|
||||
|
||||
# Prepare Products:
|
||||
routes = test_route_2 + test_route
|
||||
routes = cls.test_route_2 + cls.test_route
|
||||
cls.product = cls.product_obj.create({
|
||||
'name': 'Test Product',
|
||||
'route_ids': [(6, 0, routes.ids)],
|
||||
@@ -83,3 +84,12 @@ class TestStockOrderpointMoveLink(SavepointCase):
|
||||
move = self.move_obj.search([
|
||||
('orderpoint_ids', '=', self.orderpoint_need_loc.id)])
|
||||
self.assertTrue(len(move), 2)
|
||||
|
||||
def test_02_stock_orderpoint_move_link_action_view(self):
|
||||
sp_orderpoint = self.move_obj.search(
|
||||
[('orderpoint_ids', 'in', self.orderpoint_need_loc.id)]).mapped(
|
||||
'picking_id')
|
||||
result = self.orderpoint_need_loc.action_view_stock_picking()
|
||||
sp_action = self.picking_obj.search(
|
||||
ast.literal_eval(result['domain']))
|
||||
self.assertEquals(sp_orderpoint, sp_action)
|
||||
|
||||
@@ -25,4 +25,20 @@
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_warehouse_orderpoint_move_form" model="ir.ui.view">
|
||||
<field name="name">stock.warehouse.orderpoint.move.form</field>
|
||||
<field name="model">stock.warehouse.orderpoint</field>
|
||||
<field name="inherit_id" ref="stock.view_warehouse_orderpoint_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<div name="button_box" position="inside">
|
||||
<button type="object"
|
||||
name="action_view_stock_picking"
|
||||
class="oe_stat_button"
|
||||
string="Transfers"
|
||||
icon="fa-arrows-h">
|
||||
</button>
|
||||
</div>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
|
||||
Reference in New Issue
Block a user