Migrate stock_user_default_warehouse_purchase from 10.0
This commit is contained in:
committed by
Daniel Luque
parent
e96c3d72eb
commit
f735f8a34d
5
stock_user_default_warehouse_purchase/__init__.py
Normal file
5
stock_user_default_warehouse_purchase/__init__.py
Normal file
@@ -0,0 +1,5 @@
|
||||
# © 2017 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 . import models
|
||||
24
stock_user_default_warehouse_purchase/__manifest__.py
Normal file
24
stock_user_default_warehouse_purchase/__manifest__.py
Normal file
@@ -0,0 +1,24 @@
|
||||
# © 2017 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 (Purchase)',
|
||||
'version': '12.0.1.0.0',
|
||||
'category': 'Purchases',
|
||||
'license': 'AGPL-3',
|
||||
'summary': "Use the users's default warehouse on purchase orders",
|
||||
'description': """
|
||||
Default Warehouse on User (Purchase)
|
||||
====================================
|
||||
|
||||
The default warehouse configured in the preferences of the user will be used by default for the picking type on purchase orders.
|
||||
|
||||
This module has been written by Alexis de Lattre from Akretion
|
||||
<alexis.delattre@akretion.com>.
|
||||
""",
|
||||
'author': 'Akretion',
|
||||
'website': 'http://www.akretion.com',
|
||||
'depends': ['purchase', 'stock_user_default_warehouse_base'],
|
||||
'installable': True,
|
||||
}
|
||||
5
stock_user_default_warehouse_purchase/models/__init__.py
Normal file
5
stock_user_default_warehouse_purchase/models/__init__.py
Normal file
@@ -0,0 +1,5 @@
|
||||
# © 2017 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 . import purchase
|
||||
16
stock_user_default_warehouse_purchase/models/purchase.py
Normal file
16
stock_user_default_warehouse_purchase/models/purchase.py
Normal file
@@ -0,0 +1,16 @@
|
||||
# © 2017 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 PurchaseOrder(models.Model):
|
||||
_inherit = 'purchase.order'
|
||||
|
||||
@api.model
|
||||
def _default_pref_picking_type(self):
|
||||
in_type = self.env.user.context_default_warehouse_id.in_type_id
|
||||
return in_type.id if in_type else self._default_picking_type()
|
||||
|
||||
picking_type_id = fields.Many2one(default=_default_pref_picking_type)
|
||||
Reference in New Issue
Block a user