[FIX] stock_request: Losing partner_id and origin (#664)

This commit is contained in:
Maxime Chambreuil
2019-07-22 16:48:18 -05:00
committed by Kitti U
parent 0e0be9eb53
commit 3943574bf3
4 changed files with 22 additions and 1 deletions

View File

@@ -4,7 +4,7 @@
{
"name": "Stock Request",
"summary": "Internal request for stock",
"version": "12.0.1.0.1",
"version": "12.0.1.0.2",
"license": "LGPL-3",
"website": "https://github.com/stock-logistics-warehouse",
"author": "Eficent, "

View File

@@ -1,3 +1,4 @@
from . import procurement_group
from . import stock_request_abstract
from . import stock_request
from . import stock_request_allocation

View File

@@ -0,0 +1,19 @@
# Copyright (C) 2019 Open Source Integrators
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
from odoo import api, models
class ProcurementGroup(models.Model):
_inherit = 'procurement.group'
@api.model
def run(self, product_id, product_qty, product_uom, location_id, name,
origin, values):
if 'stock_request_id' in values and values.get('stock_request_id'):
req = self.env['stock.request'].browse(
values.get('stock_request_id'))
if req.order_id:
origin = req.order_id.name
return super().run(product_id, product_qty, product_uom, location_id,
name, origin, values)

View File

@@ -530,6 +530,7 @@ class TestStockRequest(common.TransactionCase):
self.assertEqual(stock_request.qty_in_progress, 5.0)
self.assertEqual(stock_request.qty_done, 0.0)
picking.action_assign()
self.assertEqual(picking.origin, order.name)
packout1 = picking.move_line_ids[0]
packout1.qty_done = 5
picking.action_done()