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][ADD] product_quantity_update_force_inventory #846

Merged

Conversation

HviorForgeFlow
Copy link
Member

@HviorForgeFlow HviorForgeFlow commented Feb 11, 2020

Product Quantity Update Force Inventory

This module forces users to create inventory adjustments instead of updating quantities on product card.

stock_quant_editable_view_block

It could be considered as a work around to manage Stock Accounting properly combining:

CC @ForgeFlow

@HviorForgeFlow HviorForgeFlow force-pushed the 13.0-add-stock_quant_editable_view_block branch from 6d3275e to 719c020 Compare February 11, 2020 12:47
@rousseldenis rousseldenis added this to the 13.0 milestone Feb 11, 2020

def post_load_hook():
@api.model
def _new_get_quants_action(self, domain=None, extend=False):
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not really in favor of such things as you lose all the inheritance mechanism.

Isn't there any other mean doing the same thing ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Create a new action and overwrite on views. What is preferable?

Copy link
Contributor

@rousseldenis rousseldenis Feb 12, 2020

Choose a reason for hiding this comment

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

And in this case, why not overriding original method directly with normal inheritance ???

Copy link
Member Author

Choose a reason for hiding this comment

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

At this point, it is a matter of design, or am I missing anything?

This way it will also work! 😺

# Copyright 2018-20 ForgeFlow <http://www.forgeflow.com>

from odoo import api, models


class StockQuant(models.Model):
    _inherit = 'stock.quant'

    @api.model
    def _get_quants_action(self, domain=None, extend=False):
        action = super()._get_quants_action(domain=domain, extend=extend)
        action['view_id'] = self.env.ref('stock.view_stock_quant_tree').id
        # Enables form view in readonly list
        action.update({
            'view_mode': 'tree,form',
            'views': [
                (action['view_id'], 'list'),
                (self.env.ref('stock.view_stock_quant_form').id, 'form'),
            ],
        })
        return action

Copy link
Member Author

Choose a reason for hiding this comment

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

I changed the override for that code again, it should perform the same, could we move it forward?

@HviorForgeFlow HviorForgeFlow force-pushed the 13.0-add-stock_quant_editable_view_block branch 2 times, most recently from 9a7ba0c to e30a20f Compare March 4, 2020 10:21
@HviorForgeFlow HviorForgeFlow force-pushed the 13.0-add-stock_quant_editable_view_block branch 4 times, most recently from 95d093c to a3eb958 Compare July 30, 2020 09:55
Copy link
Contributor

@AdriaGForgeFlow AdriaGForgeFlow left a comment

Choose a reason for hiding this comment

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

LGTM 👍

Could you clean the commits, I think you have some unwanted commits there

@HviorForgeFlow HviorForgeFlow force-pushed the 13.0-add-stock_quant_editable_view_block branch from a3eb958 to c422d8c Compare July 30, 2020 11:58
@rousseldenis
Copy link
Contributor

This is great! Indeed I would change module name in order to let people understand what this do.

@HviorForgeFlow
Copy link
Member Author

Any suggestion for module name change?

@rousseldenis
Copy link
Contributor

Any suggestion for module name change?

product_quantity_update_force_inventory or something like that. More functional oriented.

@HviorForgeFlow HviorForgeFlow changed the title [13.0][ADD] stock_quant_editable_view_block [13.0][ADD] product_quantity_update_force_inventory Jul 31, 2020
@HviorForgeFlow HviorForgeFlow force-pushed the 13.0-add-stock_quant_editable_view_block branch 3 times, most recently from fd625be to f1568d8 Compare July 31, 2020 10:15
Copy link
Contributor

@LoisRForgeFlow LoisRForgeFlow left a comment

Choose a reason for hiding this comment

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

LGTM 👍

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.

👍 It works as it says

@OCA-git-bot
Copy link
Contributor

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

Copy link

@HaraldPanten HaraldPanten left a comment

Choose a reason for hiding this comment

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

Nice one. Functional review 👍

@HviorForgeFlow HviorForgeFlow force-pushed the 13.0-add-stock_quant_editable_view_block branch from f1568d8 to 00e23a8 Compare September 9, 2020 06:28
@HviorForgeFlow HviorForgeFlow force-pushed the 13.0-add-stock_quant_editable_view_block branch from 00e23a8 to 14ecfe2 Compare September 23, 2020 08:18
@HviorForgeFlow HviorForgeFlow force-pushed the 13.0-add-stock_quant_editable_view_block branch from 14ecfe2 to fe3e246 Compare September 23, 2020 09:24
@LoisRForgeFlow
Copy link
Contributor

/ocabot merge nobump

@OCA-git-bot
Copy link
Contributor

This PR looks fantastic, let's merge it!
Prepared branch 13.0-ocabot-merge-pr-846-by-LoisRForgeFlow-bump-nobump, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit 08156b4 into OCA:13.0 Sep 23, 2020
@OCA-git-bot
Copy link
Contributor

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

@LoisRForgeFlow LoisRForgeFlow deleted the 13.0-add-stock_quant_editable_view_block branch September 23, 2020 10:35
CarlosRoca13 pushed a commit to Tecnativa/stock-logistics-warehouse that referenced this pull request Aug 16, 2021
Signed-off-by LoisRForgeFlow
CarlosRoca13 pushed a commit to Tecnativa/stock-logistics-warehouse that referenced this pull request Aug 16, 2021
Signed-off-by LoisRForgeFlow
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.

9 participants