diff --git a/stock_user_default_warehouse_base/README.rst b/stock_user_default_warehouse_base/README.rst new file mode 100644 index 0000000..fd0b536 --- /dev/null +++ b/stock_user_default_warehouse_base/README.rst @@ -0,0 +1,64 @@ +=============================== +Default Stock Warehouse on User +=============================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! 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_base + :alt: akretion/odoo-usability + +|badge1| |badge2| |badge3| + +With this module, you will be able to configure a default warehouse in the preferences of the user. + +This module doesn't do anything by itself. It should be used together with at least one of the following modules: + +* stock_user_default_warehouse_sale +* stock_user_default_warehouse_purchase +* stock_user_default_warehouse_mrp + +**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_base/__init__.py b/stock_user_default_warehouse_base/__init__.py new file mode 100644 index 0000000..18bfb65 --- /dev/null +++ b/stock_user_default_warehouse_base/__init__.py @@ -0,0 +1,6 @@ +# © 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 +from . import wizard diff --git a/stock_user_default_warehouse_base/__manifest__.py b/stock_user_default_warehouse_base/__manifest__.py new file mode 100644 index 0000000..f55cf0d --- /dev/null +++ b/stock_user_default_warehouse_base/__manifest__.py @@ -0,0 +1,18 @@ +# © 2017 Akretion (http://www.akretion.com) +# @author Alexis de Lattre +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + 'name': 'Default Stock Warehouse on User', + 'version': '12.0.1.0.0', + 'category': 'Inventory, Logistics, Warehousing', + 'license': 'AGPL-3', + 'summary': 'Configure a default warehouse on user', + 'author': 'Akretion', + 'website': 'http://www.akretion.com', + 'depends': ['stock'], + 'data': [ + 'views/users_view.xml', + ], + 'installable': True, +} diff --git a/stock_user_default_warehouse_base/i18n/es.po b/stock_user_default_warehouse_base/i18n/es.po new file mode 100644 index 0000000..a4b61a4 --- /dev/null +++ b/stock_user_default_warehouse_base/i18n/es.po @@ -0,0 +1,37 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_user_default_warehouse_base +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2020-05-19 10:02+0000\n" +"PO-Revision-Date: 2020-05-19 10:02+0000\n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: stock_user_default_warehouse_base +#: model:ir.model,name:stock_user_default_warehouse_base.model_stock_change_product_qty +msgid "Change Product Quantity" +msgstr "Cambiar cantidad de producto" + +#. module: stock_user_default_warehouse_base +#: model:ir.model.fields,field_description:stock_user_default_warehouse_base.field_res_users__context_default_warehouse_id +msgid "Default Warehouse" +msgstr "Almacén por defecto" + +#. module: stock_user_default_warehouse_base +#: model:ir.model.fields,help:stock_user_default_warehouse_base.field_res_users__context_default_warehouse_id +msgid "Default warehouse for sale orders (if the module stock_user_default_warehouse_sale is installed), purchase orders (if the module stock_user_default_warehouse_purchase is installed) and production orders (if the module stock_user_default_warehouse_mrp is installed)." +msgstr "Almacén por defecto para los pedidos de venta (si el módulo stock_user_default_warehouse_sale esta instalado), pedidos de compra (si el módulo stock_user_default_warehouse_purchase esta instalado) y pedidos de producción (si el módulo stock_user_default_warehouse_mrp esta instalado)." + +#. module: stock_user_default_warehouse_base +#: model:ir.model,name:stock_user_default_warehouse_base.model_res_users +msgid "Users" +msgstr "Usuarios" + diff --git a/stock_user_default_warehouse_base/models/__init__.py b/stock_user_default_warehouse_base/models/__init__.py new file mode 100644 index 0000000..2dcc87f --- /dev/null +++ b/stock_user_default_warehouse_base/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 res_users diff --git a/stock_user_default_warehouse_base/models/res_users.py b/stock_user_default_warehouse_base/models/res_users.py new file mode 100644 index 0000000..8977f85 --- /dev/null +++ b/stock_user_default_warehouse_base/models/res_users.py @@ -0,0 +1,20 @@ +# © 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 + + +class ResUsers(models.Model): + _inherit = 'res.users' + + context_default_warehouse_id = fields.Many2one( + 'stock.warehouse', + string='Default Warehouse', + company_dependent=True, + help="Default warehouse for sale orders (if the module " + "stock_user_default_warehouse_sale is installed), purchase orders " + "(if the module stock_user_default_warehouse_purchase is installed) " + "and production orders " + "(if the module stock_user_default_warehouse_mrp is installed)." + ) diff --git a/stock_user_default_warehouse_base/readme/CONTRIBUTORS.rst b/stock_user_default_warehouse_base/readme/CONTRIBUTORS.rst new file mode 100644 index 0000000..aa552d7 --- /dev/null +++ b/stock_user_default_warehouse_base/readme/CONTRIBUTORS.rst @@ -0,0 +1,2 @@ +* Alexis de Lattre +* Daniel Luque diff --git a/stock_user_default_warehouse_base/readme/DESCRIPTION.rst b/stock_user_default_warehouse_base/readme/DESCRIPTION.rst new file mode 100644 index 0000000..68ae1d1 --- /dev/null +++ b/stock_user_default_warehouse_base/readme/DESCRIPTION.rst @@ -0,0 +1,7 @@ +With this module, you will be able to configure a default warehouse in the preferences of the user. + +This module doesn't do anything by itself. It should be used together with at least one of the following modules: + +* stock_user_default_warehouse_sale +* stock_user_default_warehouse_purchase +* stock_user_default_warehouse_mrp diff --git a/stock_user_default_warehouse_base/static/description/icon.png b/stock_user_default_warehouse_base/static/description/icon.png new file mode 100644 index 0000000..c91da79 Binary files /dev/null and b/stock_user_default_warehouse_base/static/description/icon.png differ diff --git a/stock_user_default_warehouse_base/static/description/index.html b/stock_user_default_warehouse_base/static/description/index.html new file mode 100644 index 0000000..33ebcdb --- /dev/null +++ b/stock_user_default_warehouse_base/static/description/index.html @@ -0,0 +1,421 @@ + + + + + + +Default Stock Warehouse on User + + + +
+

Default Stock Warehouse on User

+ + +

Beta License: AGPL-3 akretion/odoo-usability

+

With this module, you will be able to configure a default warehouse in the preferences of the user.

+

This module doesn’t do anything by itself. It should be used together with at least one of the following modules:

+
    +
  • stock_user_default_warehouse_sale
  • +
  • stock_user_default_warehouse_purchase
  • +
  • stock_user_default_warehouse_mrp
  • +
+

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.

+
+
+
+ + diff --git a/stock_user_default_warehouse_base/views/users_view.xml b/stock_user_default_warehouse_base/views/users_view.xml new file mode 100644 index 0000000..f870044 --- /dev/null +++ b/stock_user_default_warehouse_base/views/users_view.xml @@ -0,0 +1,28 @@ + + + + + + default_stock_warehouse.res.users.form + res.users + + + + + + + + + + default_stock_warehouse.preferences.res.users.form + res.users + + + + + + + + + + diff --git a/stock_user_default_warehouse_base/wizard/__init__.py b/stock_user_default_warehouse_base/wizard/__init__.py new file mode 100644 index 0000000..b7e8b27 --- /dev/null +++ b/stock_user_default_warehouse_base/wizard/__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 stock_change_product_qty diff --git a/stock_user_default_warehouse_base/wizard/stock_change_product_qty.py b/stock_user_default_warehouse_base/wizard/stock_change_product_qty.py new file mode 100644 index 0000000..f8e2cdf --- /dev/null +++ b/stock_user_default_warehouse_base/wizard/stock_change_product_qty.py @@ -0,0 +1,17 @@ +# © 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, api + + +class StockChangeProductQty(models.TransientModel): + _inherit = 'stock.change.product.qty' + + @api.model + def default_get(self, fields_list): + res = super().default_get(fields_list) + if self.env.user.context_default_warehouse_id: + res['location_id'] = self.env.user.context_default_warehouse_id.\ + lot_stock_id.id + return res