Add module stock_user_default_warehouse_mrp
Fix module stock_user_default_warehouse_purchase
This commit is contained in:
3
stock_user_default_warehouse_mrp/__init__.py
Normal file
3
stock_user_default_warehouse_mrp/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from . import mrp
|
||||||
25
stock_user_default_warehouse_mrp/__manifest__.py
Normal file
25
stock_user_default_warehouse_mrp/__manifest__.py
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Copyright 2018 Akretion (http://www.akretion.com)
|
||||||
|
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
|
{
|
||||||
|
'name': 'Default Warehouse on User (MRP)',
|
||||||
|
'version': '10.0.1.0.0',
|
||||||
|
'category': 'Manufacturing',
|
||||||
|
'license': 'AGPL-3',
|
||||||
|
'summary': "Use the users's default warehouse on manufacturing orders",
|
||||||
|
'description': """
|
||||||
|
Default Warehouse on User (MRP)
|
||||||
|
================================
|
||||||
|
|
||||||
|
The default warehouse configured in the preferences of the user will be used by default on manufacturing orders.
|
||||||
|
|
||||||
|
This module has been written by Alexis de Lattre from Akretion
|
||||||
|
<alexis.delattre@akretion.com>.
|
||||||
|
""",
|
||||||
|
'author': 'Akretion',
|
||||||
|
'website': 'http://www.akretion.com',
|
||||||
|
'depends': ['mrp', 'stock_user_default_warehouse_base'],
|
||||||
|
'installable': True,
|
||||||
|
}
|
||||||
23
stock_user_default_warehouse_mrp/mrp.py
Normal file
23
stock_user_default_warehouse_mrp/mrp.py
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Copyright 2018 Akretion (http://www.akretion.com)
|
||||||
|
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
|
from odoo import models, fields, api
|
||||||
|
|
||||||
|
|
||||||
|
class MrpProduction(models.Model):
|
||||||
|
_inherit = 'mrp.production'
|
||||||
|
|
||||||
|
@api.model
|
||||||
|
def _default_pref_picking_type(self):
|
||||||
|
default_manu_type = self.env.user.context_default_warehouse_id.\
|
||||||
|
manu_type_id
|
||||||
|
if default_manu_type:
|
||||||
|
return default_manu_type.id
|
||||||
|
return self._get_default_picking_type()
|
||||||
|
|
||||||
|
# No need to inherit the default value of location_src_id and
|
||||||
|
# location_dest_id because it is immediately over-ridden
|
||||||
|
# by the onchange of picking_type_id
|
||||||
|
picking_type_id = fields.Many2one(default=_default_pref_picking_type)
|
||||||
@@ -14,6 +14,6 @@ class PurchaseOrder(models.Model):
|
|||||||
default_in_type = self.env.user.context_default_warehouse_id.in_type_id
|
default_in_type = self.env.user.context_default_warehouse_id.in_type_id
|
||||||
if default_in_type:
|
if default_in_type:
|
||||||
return default_in_type.id
|
return default_in_type.id
|
||||||
return self._default_picking_type
|
return self._default_picking_type()
|
||||||
|
|
||||||
picking_type_id = fields.Many2one(default=_default_pref_picking_type)
|
picking_type_id = fields.Many2one(default=_default_pref_picking_type)
|
||||||
|
|||||||
Reference in New Issue
Block a user