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

Conversation

BT-nstuder
Copy link
Contributor

@BT-nstuder BT-nstuder commented Jan 9, 2020

Proposed changes

I've migrated the module stock_operating_unit and it's functionalities from Odoo 12.0 to 13.0. I've checked if the all unit tests are still running.

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Migration Update

Checklist

  • I have read the CONTRIBUTING doc
  • I have signed the CLA
  • Lint and unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have updated necessary documentation

Further comments

This module depends on the account_operating_unit module. That means that there should be a migration of it to 13.0. Because there is already a PR for a migration I've added the changes of the PR to my local environment to test my migration.

This PR depends on the current migration PR #229.

I've changed the dependency of the module. Instead of account_operating_unit the module depends now on the module operating_unit

@alan196
Copy link
Contributor

alan196 commented Feb 18, 2020

I had the following error.

Steps to reproduce

  • Create a stock.inventory for a product
  • Create 3 stock.inventory.line each line with different locations of warehouses with different ou each.
  • Validate Inventory
Error:
Odoo Server Error

Traceback (most recent call last):
  File "/home/odoo/instance/odoo/odoo/http.py", line 619, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "/home/odoo/instance/odoo/odoo/http.py", line 309, in _handle_exception
    raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
  File "/home/odoo/instance/odoo/odoo/tools/pycompat.py", line 14, in reraise
    raise value
  File "/home/odoo/instance/odoo/odoo/http.py", line 664, in dispatch
    result = self._call_function(**self.params)
  File "/home/odoo/instance/odoo/odoo/http.py", line 345, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "/home/odoo/instance/odoo/odoo/service/model.py", line 93, in wrapper
    return f(dbname, *args, **kwargs)
  File "/home/odoo/instance/odoo/odoo/http.py", line 338, in checked_call
    result = self.endpoint(*a, **kw)
  File "/home/odoo/instance/odoo/odoo/http.py", line 910, in __call__
    return self.method(*args, **kw)
  File "/home/odoo/instance/odoo/odoo/http.py", line 510, in response_wrap
    response = f(*args, **kw)
  File "/home/odoo/instance/odoo/addons/web/controllers/main.py", line 1320, in call_kw
    return self._call_kw(model, method, args, kwargs)
  File "/home/odoo/instance/odoo/addons/web/controllers/main.py", line 1312, in _call_kw
    return call_kw(request.env[model], method, args, kwargs)
  File "/home/odoo/instance/odoo/odoo/api.py", line 395, in call_kw
    result = _call_kw_multi(method, model, args, kwargs)
  File "/home/odoo/instance/odoo/odoo/api.py", line 382, in _call_kw_multi
    result = method(recs, *args, **kwargs)
  File "/home/odoo/instance/odoo/addons/stock/models/stock_inventory.py", line 107, in action_validate
    self._action_done()
  File "/home/odoo/instance/odoo/addons/stock/models/stock_inventory.py", line 118, in _action_done
    self.post_inventory()
  File "/home/odoo/instance/odoo/addons/stock_account/models/stock_inventory.py", line 43, in post_inventory
    super(StockInventory, other_inventories).post_inventory()
  File "/home/odoo/instance/odoo/addons/stock/models/stock_inventory.py", line 125, in post_inventory
    self.mapped('move_ids').filtered(lambda move: move.state != 'done')._action_done()
  File "/home/odoo/instance/extra_addons/operating-unit/stock_account_operating_unit/model/stock_move.py", line 119, in _action_done
    "stock_move_id": self.id,
  File "/home/odoo/instance/odoo/odoo/fields.py", line 3524, in __get__
    raise ValueError("Expected singleton: %s" % record)
ValueError: Expected singleton: stock.move(5, 6, 7)

@BT-nstuder BT-nstuder force-pushed the 13.0-mig-stock_operating_unit branch from 7d526e5 to ea3051b Compare March 3, 2020 09:57
@BT-nstuder
Copy link
Contributor Author

I had the following error.

Steps to reproduce

* Create a stock.inventory for a product

* Create 3 stock.inventory.line each line with different locations of warehouses with different ou each.

* Validate Inventory

...

Hello @alan196, I finally tried to replicate this error but I couldn't. I haven't installed the module stock_account_operating_unit, because this migration doesn't depend on it. Could you check again or am I missing something?

I did the following in an empty database:

  1. Install module stock_operating_unit
  2. Create 3 independent Operating Units (OU): OU1, OU2, OU3
  3. Enable Storage Locations and Multi-Warehouses in the settings
  4. Create a warehouse for each created OU and assign the correct OU: WH1, WH2, WH3
  5. Create a location for each warehouse with the view location of the warehouse as parent: LOC1, LOC2, LOC3
  6. Create an inventory adjustment (stock.inventory) for a product
  7. Add 3 stock.inventory.line's and each with a different location out of the 3 created before
  8. Validate the inventory

No errors occurred.

@ps-tubtim
Copy link
Member

ps-tubtim commented Mar 30, 2020

@BT-nstuder Please update your pr for fix conflict files.

Copy link
Member

@ps-tubtim ps-tubtim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comments.

stock_operating_unit/__manifest__.py Outdated Show resolved Hide resolved
stock_operating_unit/readme/CONTRIBUTORS.rst Show resolved Hide resolved
@kittiu
Copy link
Member

kittiu commented Mar 31, 2020

@BT-nstuder you need to rebase to fix the conflicting files.

Copy link
Member

@newtratip newtratip left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed.

stock_operating_unit/view/stock.xml Outdated Show resolved Hide resolved
Copy link
Contributor

@AaronHForgeFlow AaronHForgeFlow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested on runbot and it works correctly. Thank you!

Could you include those improcements from v12?
#267
#265

@BT-nstuder
Copy link
Contributor Author

@AaronHForgeFlow done. Should I squash the new commits into d050dfc?

@AaronHForgeFlow
Copy link
Contributor

@BT-nstuder Thanks. No, keep them separately, better for traceability.

Copy link
Contributor

@AaronHForgeFlow AaronHForgeFlow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM Functional test.

Just one thing. The setup folder is created automatically by a bot. I don't think that change regarding setup folder should be here.

@BT-nstuder
Copy link
Contributor Author

@AaronHForgeFlow The setup folder was created automatically when running pre-commit run -a. But I can still remove it if you want.

@AaronHForgeFlow
Copy link
Contributor

@BT-nstuder Yes you are correct, never mind. I was confused thinking about version 12.0. Sorry.

Copy link
Member

@ps-tubtim ps-tubtim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@newtratip
Copy link
Member

@BT-nstuder codecov/project and codecov/patch still be red. I think test script is not cover.

@ps-tubtim
Copy link
Member

Process:

  1. Install stock_operating_unit
  2. Create 2 OU -> OU1, OU2
  3. Create 2 users for each OU -> ou1, ou2
  4. Set OU in warehouses and locations
  5. ou1 create a receipt.
  6. ou2 can't see Stock Moves of other OU but can see Inventory Report, Forecasted Report and Product Moves of other OU.

Stock Moves
2020-04-10_14-52_1

Inventory Report
2020-04-10_14-55

Forecasted Report
2020-04-10_15-14

Product Moves
2020-04-10_14-52

@ALL Should users see reports of other OU?
cc: @kittiu @newtratip

@AaronHForgeFlow
Copy link
Contributor

@ps-tubtim I think not, they should not see that data in the report. We should include access rules for stock.move.line. Also inherit the reports to filter OU information accordingly.

Copy link
Contributor

@alan196 alan196 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Functional Review 👍

Copy link
Contributor

@AaronHForgeFlow AaronHForgeFlow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@AaronHForgeFlow
Copy link
Contributor

/ocabot merge nobump

@OCA-git-bot
Copy link
Contributor

What a great day to merge this nice PR. Let's do it!
Prepared branch 13.0-ocabot-merge-pr-231-by-AaronHForgeFlow-bump-nobump, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit d555cfc into OCA:13.0 Apr 20, 2020
@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at 39ebc92. Thanks a lot for contributing to OCA. ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet