Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[13.0][MIG] stock_operating_unit #231

Merged
merged 29 commits into from
Apr 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
cdc9616
stock_operating_unit
JordiBForgeFlow Sep 15, 2016
ed24015
flake8 issues
JordiBForgeFlow Sep 28, 2016
ed65bae
flake 8
JordiBForgeFlow Sep 28, 2016
59bdad6
flake 8
JordiBForgeFlow Sep 28, 2016
6caf128
update contributors
AaronHForgeFlow Sep 30, 2016
8197d36
code style
AaronHForgeFlow Oct 4, 2016
ebc6a0e
constraint that checks the OU in the picking matches the one in the move
AaronHForgeFlow Oct 4, 2016
4bee404
the operating unit in pickings should derive from the picking type
JordiBForgeFlow Oct 5, 2016
a618fe2
travis issues
AaronHForgeFlow Oct 5, 2016
6b318c6
travis issues and test stock picking
AaronHForgeFlow Nov 4, 2016
fdfce92
test stock security according picking 1 in test_stock_picking
AaronHForgeFlow Nov 4, 2016
4245c41
Update operating units of previous locations
AaronHForgeFlow Jan 16, 2017
9e5db29
lint check operating_unit_id readonly in the picking
AaronHForgeFlow Jan 17, 2017
6a59fb1
Correct error message and xml files
guewen Jan 23, 2017
fc3fa36
[MIG] stock_operating_unit to v10.0
AaronHForgeFlow Jan 26, 2017
d87423a
[FIX] stock_operating_unit: correct constrain function, avoid error o…
esthermm Apr 5, 2017
57fb765
[FIX]onchange does not work with readonly fields
AaronHForgeFlow Sep 28, 2017
8a16145
[FIX]stock.move._check_stock_move_operating_unit
AaronHForgeFlow Apr 10, 2018
8f2c894
[FIX]internal locations should consider all locations but customer or…
AaronHForgeFlow Jun 7, 2018
9bfae52
[FIX]field that triggers constraint is not a valid field name
AaronHForgeFlow Jul 26, 2018
ee97cf9
[MIG] stock_operating_unit: Migration to v12
bjeficent Dec 12, 2018
c426efc
[UPD] Update stock_operating_unit.pot
oca-travis Oct 16, 2019
0ea5e84
[UPD] README.rst
OCA-git-bot Oct 16, 2019
8fe06b9
[FIX] Alignments
MiquelRForgeFlow Nov 27, 2019
22af9b9
[IMP] stock_operating_unit: black, isort, prettier
BT-nstuder Jan 6, 2020
d050dfc
[MIG] stock_operating_unit: Migration to 13.0
BT-nstuder Apr 2, 2020
312b555
[IMP] stock_operating_unit: Update record rule
BT-nstuder Apr 6, 2020
d94bb8e
[FIX] stock_operating_unit: Constraint on stock move
BT-nstuder Apr 6, 2020
1b6079c
[IMP]add operating unit rule in stock.move.line
AaronHForgeFlow Apr 20, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions setup/stock_operating_unit/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
102 changes: 102 additions & 0 deletions stock_operating_unit/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
==========================
Stock with Operating Units
==========================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! 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-LGPL--3-blue.png
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Foperating--unit-lightgray.png?logo=github
:target: https://github.com/OCA/operating-unit/tree/13.0/stock_operating_unit
:alt: OCA/operating-unit
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/operating-unit-13-0/operating-unit-13-0-stock_operating_unit
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/213/13.0
:alt: Try me on Runbot

|badge1| |badge2| |badge3| |badge4| |badge5|

This module introduces the following features:

- Adds the operating unit to the Warehouse.
- Adds the operating unit to the Stock Location.
- Adds the requesting operating unit to stock pickings.
- Implements user's security access rules.

**Table of contents**

.. contents::
:local:

Configuration
=============

To configure this module, you need to:

* Assign Operating Unit to Warehouses.
* Assign Operating Unit to Stock Locations.

Usage
=====

This module defines the operating unit entity and the user's security rules.
Other modules extend the standard Odoo apps with the OU.

Known issues / Roadmap
======================

The Manager can see the stock rules of other Operating Units but he can not
edit them. If he tries to access to one of these stock rules, he will receive
a configuration error.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/operating-unit/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 <https://github.com/OCA/operating-unit/issues/new?body=module:%20stock_operating_unit%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

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

Credits
=======

Authors
~~~~~~~

* Eficent
* Serpent Consulting Services Pvt. Ltd.

Contributors
~~~~~~~~~~~~

* Jordi Ballester Alomar <jordi.ballester@eficent.com>
* Aaron Henriquez <aheficent@eficent.com>
* Sudhir Arya <sudhir.arya@serpentcs.com>

Maintainers
~~~~~~~~~~~

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

This module is part of the `OCA/operating-unit <https://github.com/OCA/operating-unit/tree/13.0/stock_operating_unit>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
4 changes: 4 additions & 0 deletions stock_operating_unit/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).

from . import model
from .hooks import update_operating_unit_location
20 changes: 20 additions & 0 deletions stock_operating_unit/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# © 2019 Eficent Business and IT Consulting Services S.L.
# © 2019 Serpent Consulting Services Pvt. Ltd.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).

{
"name": "Stock with Operating Units",
"summary": "Adds the concept of operating unit (OU) in stock management",
"version": "13.0.1.0.0",
"category": "Generic Modules/Sales & Purchases",
"author": "Eficent, "
"Serpent Consulting Services Pvt. Ltd., "
"Odoo Community Association (OCA)",
"license": "LGPL-3",
"website": "https://github.com/OCA/operating-unit",
"depends": ["stock", "operating_unit"],
"data": ["security/stock_security.xml", "data/stock_data.xml", "view/stock.xml"],
"demo": ["demo/stock_demo.xml"],
"installable": True,
"post_init_hook": "update_operating_unit_location",
}
12 changes: 12 additions & 0 deletions stock_operating_unit/data/stock_data.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2019 Eficent Business and IT Consulting Services S.L.
Copyright 2019 Serpent Consulting Services Pvt. Ltd.
License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl-3.0) -->
<odoo noupdate="1">
<record id="stock.warehouse0" model="stock.warehouse">
<field name="operating_unit_id" ref="operating_unit.main_operating_unit" />
</record>
<record id="stock.stock_location_stock" model="stock.location">
<field name="operating_unit_id" ref="operating_unit.main_operating_unit" />
</record>
</odoo>
49 changes: 49 additions & 0 deletions stock_operating_unit/demo/stock_demo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2019 Eficent Business and IT Consulting Services S.L.
Copyright 2019 Serpent Consulting Services Pvt. Ltd.
License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl-3.0) -->
<odoo noupdate="1">
<!-- Shelf 2 stock location -->
<record id="stock.stock_location_14" model="stock.location">
<field name="operating_unit_id" ref="operating_unit.main_operating_unit" />
</record>
<!-- Shelf 1 stock location -->
<record id="stock.stock_location_components" model="stock.location">
<field name="operating_unit_id" ref="operating_unit.main_operating_unit" />
</record>
<!-- Multi Company -->
<!-- Child Company 1-->
<record id="stock.res_company_1" model="res.company">
<field name="name">Your company child</field>
</record>
<record id="operating_unit_shop0" model="operating.unit">
<field name="name">Chicago</field>
<field name="code">CH</field>
<field name="partner_id" ref="stock.res_partner_company_1" />
<field name="company_id" ref="stock.res_company_1" />
</record>
<!-- Chicago Warehouse -->
<record id="stock.stock_warehouse_shop0" model="stock.warehouse">
<field name="operating_unit_id" ref="operating_unit_shop0" />
</record>
<!-- Your Company, Chicago shop -->
<record id="stock.stock_location_shop0" model="stock.location">
<field name="operating_unit_id" ref="operating_unit_shop0" />
</record>
<!--B2B-->
<record id="stock_warehouse_b2b" model="stock.warehouse">
<field name="name">B2B Warehouse</field>
<field name="code">B2B</field>
<field name="partner_id" ref="base.main_partner" />
<field name="company_id" ref="base.main_company" />
<field name="operating_unit_id" ref="operating_unit.b2b_operating_unit" />
</record>
<!-- B2C -->
<record id="stock_warehouse_b2c" model="stock.warehouse">
<field name="name">B2C Warehouse</field>
<field name="code">B2C</field>
<field name="partner_id" ref="base.main_partner" />
<field name="company_id" ref="base.main_company" />
<field name="operating_unit_id" ref="operating_unit.b2c_operating_unit" />
</record>
</odoo>
23 changes: 23 additions & 0 deletions stock_operating_unit/hooks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# © 2019 Eficent Business and IT Consulting Services S.L.
# © 2019 Serpent Consulting Services Pvt. Ltd.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
from odoo import SUPERUSER_ID
from odoo.api import Environment


def update_operating_unit_location(cr, registry):
env = Environment(cr, SUPERUSER_ID, {})
warehouses = env["stock.warehouse"].search([])
for warehouse in warehouses:
operating_unit = warehouse.operating_unit_id
parent_location = warehouse.view_location_id
locations = env["stock.location"].search(
[("id", "child_of", [parent_location.id]), ("usage", "=", "internal")]
)
if operating_unit:
query = """update stock_location set operating_unit_id = %s where
location_id in %s or id in %s"""
cr.execute(
query, (operating_unit.id, tuple(locations.ids), tuple(locations.ids))
)
return True
123 changes: 123 additions & 0 deletions stock_operating_unit/i18n/stock_operating_unit.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * stock_operating_unit
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 13.0\n"
"Report-Msgid-Bugs-To: \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_operating_unit
#: code:addons/stock_operating_unit/model/stock_warehouse.py:50
#, python-format
msgid "Configuration Error. The Operating Unit of the Warehouse and the Location must be the same. "
msgstr ""

#. module: stock_operating_unit
#: code:addons/stock_operating_unit/model/stock_location.py:51
#, python-format
msgid "Configuration error. The Company in the Stock Location and in the Operating Unit must be the same."
msgstr ""

#. module: stock_operating_unit
#: code:addons/stock_operating_unit/model/stock_picking.py:32
#, python-format
msgid "Configuration error. The Company in the Stock Picking and in the Operating Unit must be the same."
msgstr ""

#. module: stock_operating_unit
#: code:addons/stock_operating_unit/model/stock_warehouse.py:34
#, python-format
msgid "Configuration error. The Company in the Stock Warehouse and in the Operating Unit must be the same."
msgstr ""

#. module: stock_operating_unit
#: code:addons/stock_operating_unit/model/stock_picking.py:44
#, python-format
msgid "Configuration error. The Operating Unit of the picking must be the same as that of the warehouse of the Picking Type."
msgstr ""

#. module: stock_operating_unit
#: code:addons/stock_operating_unit/model/stock_location.py:65
#, python-format
msgid "Configuration error. The Parent Stock Location must belong to the same Operating Unit."
msgstr ""

#. module: stock_operating_unit
#: code:addons/stock_operating_unit/model/stock_move.py:39
#, python-format
msgid "Configuration error. The Stock moves must be related to a location (source or destination) that belongs to the requesting Operating Unit."
msgstr ""

#. module: stock_operating_unit
#: code:addons/stock_operating_unit/model/stock_location.py:35
#: code:addons/stock_operating_unit/model/stock_location.py:40
#, python-format
msgid "Configuration error. The operating unit should be assigned to internal locations only."
msgstr ""

#. module: stock_operating_unit
#: code:addons/stock_operating_unit/model/stock_location.py:24
#, python-format
msgid "Configuration error. This location is assigned to a warehouse that belongs to a different operating unit."
msgstr ""

#. module: stock_operating_unit
#: model:ir.model.fields,field_description:stock_operating_unit.field_stock_move__operating_unit_dest_id
msgid "Dest. Location Operating Unit"
msgstr ""

#. module: stock_operating_unit
#: model:ir.model,name:stock_operating_unit.model_stock_location
msgid "Inventory Locations"
msgstr ""

#. module: stock_operating_unit
#: model:ir.model,name:stock_operating_unit.model_stock_warehouse_orderpoint
msgid "Minimum Inventory Rule"
msgstr ""

#. module: stock_operating_unit
#: model:ir.model.fields,field_description:stock_operating_unit.field_stock_location__operating_unit_id
#: model:ir.model.fields,field_description:stock_operating_unit.field_stock_rule__operating_unit_id
#: model:ir.model.fields,field_description:stock_operating_unit.field_stock_warehouse__operating_unit_id
#: model_terms:ir.ui.view,arch_db:stock_operating_unit.view_picking_internal_search
msgid "Operating Unit"
msgstr ""

#. module: stock_operating_unit
#: model:ir.model.fields,field_description:stock_operating_unit.field_stock_picking__operating_unit_id
msgid "Requesting Operating Unit"
msgstr ""

#. module: stock_operating_unit
#: model:ir.model.fields,field_description:stock_operating_unit.field_stock_move__operating_unit_id
msgid "Source Location Operating Unit"
msgstr ""

#. module: stock_operating_unit
#: model:ir.model,name:stock_operating_unit.model_stock_move
msgid "Stock Move"
msgstr ""

#. module: stock_operating_unit
#: model:ir.model,name:stock_operating_unit.model_stock_rule
msgid "Stock Rule"
msgstr ""

#. module: stock_operating_unit
#: model:ir.model,name:stock_operating_unit.model_stock_picking
msgid "Transfer"
msgstr ""

#. module: stock_operating_unit
#: model:ir.model,name:stock_operating_unit.model_stock_warehouse
msgid "Warehouse"
msgstr ""

7 changes: 7 additions & 0 deletions stock_operating_unit/model/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).

from . import stock_location
from . import stock_move
from . import stock_picking
from . import stock_rule
from . import stock_warehouse
Loading