diff --git a/stock_user_default_warehouse_purchase/README.rst b/stock_user_default_warehouse_purchase/README.rst new file mode 100644 index 0000000..c802767 --- /dev/null +++ b/stock_user_default_warehouse_purchase/README.rst @@ -0,0 +1,58 @@ +==================================== +Default Warehouse on User (Purchase) +==================================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-akretion%2Fodoo--usability-lightgray.png?logo=github + :target: https://github.com/akretion/odoo-usability/tree/12.0/stock_user_default_warehouse_purchase + :alt: akretion/odoo-usability + +|badge1| |badge2| |badge3| + +The default warehouse configured in the preferences of the user will be used by default for the picking type on purchase orders. + +**Table of contents** + +.. contents:: + :local: + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please 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 `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Akretion + +Contributors +~~~~~~~~~~~~ + +* Alexis de Lattre +* Daniel Luque + +Maintainers +~~~~~~~~~~~ + +This module is part of the `akretion/odoo-usability `_ project on GitHub. + +You are welcome to contribute. diff --git a/stock_user_default_warehouse_purchase/__init__.py b/stock_user_default_warehouse_purchase/__init__.py new file mode 100644 index 0000000..7848c13 --- /dev/null +++ b/stock_user_default_warehouse_purchase/__init__.py @@ -0,0 +1,5 @@ +# © 2017 Akretion (http://www.akretion.com) +# @author Alexis de Lattre +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import models diff --git a/stock_user_default_warehouse_purchase/__manifest__.py b/stock_user_default_warehouse_purchase/__manifest__.py new file mode 100644 index 0000000..ae0f733 --- /dev/null +++ b/stock_user_default_warehouse_purchase/__manifest__.py @@ -0,0 +1,15 @@ +# © 2017 Akretion (http://www.akretion.com) +# @author Alexis de Lattre +# 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", + 'author': 'Akretion', + 'website': 'http://www.akretion.com', + 'depends': ['purchase', 'stock_user_default_warehouse_base'], + 'installable': True, +} diff --git a/stock_user_default_warehouse_purchase/models/__init__.py b/stock_user_default_warehouse_purchase/models/__init__.py new file mode 100644 index 0000000..1f48537 --- /dev/null +++ b/stock_user_default_warehouse_purchase/models/__init__.py @@ -0,0 +1,5 @@ +# © 2017 Akretion (http://www.akretion.com) +# @author Alexis de Lattre +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import purchase diff --git a/stock_user_default_warehouse_purchase/models/purchase.py b/stock_user_default_warehouse_purchase/models/purchase.py new file mode 100644 index 0000000..0103c58 --- /dev/null +++ b/stock_user_default_warehouse_purchase/models/purchase.py @@ -0,0 +1,16 @@ +# © 2017 Akretion (http://www.akretion.com) +# @author Alexis de Lattre +# 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) diff --git a/stock_user_default_warehouse_purchase/readme/CONTRIBUTORS.rst b/stock_user_default_warehouse_purchase/readme/CONTRIBUTORS.rst new file mode 100644 index 0000000..aa552d7 --- /dev/null +++ b/stock_user_default_warehouse_purchase/readme/CONTRIBUTORS.rst @@ -0,0 +1,2 @@ +* Alexis de Lattre +* Daniel Luque diff --git a/stock_user_default_warehouse_purchase/readme/DESCRIPTION.rst b/stock_user_default_warehouse_purchase/readme/DESCRIPTION.rst new file mode 100644 index 0000000..8bac26c --- /dev/null +++ b/stock_user_default_warehouse_purchase/readme/DESCRIPTION.rst @@ -0,0 +1 @@ +The default warehouse configured in the preferences of the user will be used by default for the picking type on purchase orders. diff --git a/stock_user_default_warehouse_purchase/static/description/icon.png b/stock_user_default_warehouse_purchase/static/description/icon.png new file mode 100644 index 0000000..c91da79 Binary files /dev/null and b/stock_user_default_warehouse_purchase/static/description/icon.png differ diff --git a/stock_user_default_warehouse_purchase/static/description/index.html b/stock_user_default_warehouse_purchase/static/description/index.html new file mode 100644 index 0000000..365b42d --- /dev/null +++ b/stock_user_default_warehouse_purchase/static/description/index.html @@ -0,0 +1,415 @@ + + + + + + +Default Warehouse on User (Purchase) + + + +
+

Default Warehouse on User (Purchase)

+ + +

Beta License: AGPL-3 akretion/odoo-usability

+

The default warehouse configured in the preferences of the user will be used by default for the picking type on purchase orders.

+

Table of contents

+ +
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please 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.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Akretion
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is part of the akretion/odoo-usability project on GitHub.

+

You are welcome to contribute.

+
+
+
+ +