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

[MIG] stock_average_daily_sale: Backporting to 14.0 from 16.0 #342

Open
wants to merge 34 commits into
base: 14.0
Choose a base branch
from

Conversation

twalter-c2c
Copy link
Contributor

@twalter-c2c twalter-c2c commented Sep 24, 2024

No description provided.

rousseldenis and others added 30 commits September 24, 2024 15:16
…evel + add demo

The configurations are now stored on abc profiles.

Some demo data are loaded in order to show this module features more easily.
By default the priority in odoo is set to '0'. Before this change
the daily sale was never computed for moves done in a normal process.
There is no need to filter out moves based on the priority from
the computation.
Co-authored-by: Jacques-Etienne Baudoux <je@bcim.be>
As tests create a Savepoint, there is a concurrent query when checking the
view existence.
As for x reason, some products appear more than one time in the report,
id generated by the concatenation of product_id and warehouse_id is
irrelevant (as duplicate values possible). Use row_number() instead
Currently translated at 100.0% (58 of 58 strings)

Translation: stock-logistics-reporting-16.0/stock-logistics-reporting-16.0-stock_average_daily_sale
Translate-URL: https://translation.odoo-community.org/projects/stock-logistics-reporting-16-0/stock-logistics-reporting-16-0-stock_average_daily_sale/it/
Remove product_abc_classification dependency.
This module is not essential for the current module to function properly.
Only stock_user can see config and report; stock_manager can create and delete config entries
Set default average_daily_sale_root_location on WH create.
Default stock location of the new WH is used for this purpose
Allow to decide if weekends should be included or excluded
in average daily sale calculation.
Take also production location as dest location for daily usage calculation
…ny_id

stock_average_daily_sale:
- add form view for config
- add company_id to config
- allow editing ABC classification level and make sure
  the level is unique per warehouse
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: stock-logistics-reporting-16.0/stock-logistics-reporting-16.0-stock_average_daily_sale
Translate-URL: https://translation.odoo-community.org/projects/stock-logistics-reporting-16-0/stock-logistics-reporting-16-0-stock_average_daily_sale/
@simahawk simahawk changed the title 14.0 mig stock average daily sale [MIG] stock_average_daily_sale: Backporting to 14.0 from 16.0 Sep 25, 2024
@simahawk
Copy link

@twalter-c2c we have a maturity level conflict
image

See https://github.com/OCA/stock-logistics-warehouse/blob/14.0/stock_location_warehouse/__manifest__.py#L14
It can be raised to Beta if not Stable as is there since ages.

@twalter-c2c twalter-c2c force-pushed the 14.0-mig-stock_average_daily_sale branch from 948400d to 4543eba Compare September 25, 2024 09:37
@twalter-c2c twalter-c2c force-pushed the 14.0-mig-stock_average_daily_sale branch from 4543eba to 6e5145f Compare September 25, 2024 12:12
@simahawk
Copy link

simahawk commented Nov 7, 2024

@rousseldenis would you mind to have a look? 🙏


@classmethod
def _create_inventory(cls):
inventory = cls.env["stock.inventory"].create(
Copy link

Choose a reason for hiding this comment

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

Suggested change
inventory = cls.env["stock.inventory"].create(
inventory = cls.inventory_obj.create(

@@ -50,20 +50,34 @@ def setUpClass(cls):

@classmethod
def _create_inventory(cls):
cls.inventory_obj.create(
inventory = cls.env["stock.inventory"].create(
Copy link

Choose a reason for hiding this comment

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

Not sure why we switched from stock.quant to stock.inventory to put goods in stock, we can also use quant model to do that in v14. E.g:

        cls.env["stock.quant"]._update_available_quantity(
            product,
            location,
            quantity,
            package_id=package,
            lot_id=lot,
            in_date=in_date,
        )

Or if we want to state the current qty in stock (not adding new ones), we can use this helper method:

    @classmethod
    def _update_qty_in_location(
        cls, location, product, quantity, package=None, lot=None, in_date=None
    ):
        quants = cls.env["stock.quant"]._gather(
            product, location, lot_id=lot, package_id=package, strict=True
        )
        # this method adds the quantity to the current quantity, so remove it
        quantity -= sum(quants.mapped("quantity"))
        cls.env["stock.quant"]._update_available_quantity(
            product,
            location,
            quantity,
            package_id=package,
            lot_id=lot,
            in_date=in_date,
        )

But probably not blocking for a backport.

@rousseldenis
Copy link
Contributor

/ocabot migration stock_average_daily_sale

@sebalix
Copy link

sebalix commented Nov 22, 2024

I found an issue, if there is no warehouse_id defined on stock moves (it's not required), the sql request doesn't provide any result. Fix ongoing.

EDIT: fixed

sebalix and others added 2 commits November 22, 2024 16:33
Because of a datetime to date conversion, yesterday was excluded from calculation
while being set as a date_to value. With this commit we include all the stock
moves until up to 23:59:59 of the previous day.
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.

10 participants