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

[16.0] [ADD] foodhub_picking_operations #122

Open
wants to merge 6 commits into
base: 16.0
Choose a base branch
from

Conversation

@victor-champonnois victor-champonnois force-pushed the 16.0-foodhub_picking_order branch from 1d111be to 8e5d42c Compare December 12, 2024 10:51
Comment on lines 10 to 12
_order = "product_category,product_default_code"

product_category = fields.Many2one(related="product_id.categ_id", store=True)
Copy link
Member

Choose a reason for hiding this comment

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

this will sort by the id of the category, not by its name. is it on purpose? otherwise, it should be like this:

Suggested change
_order = "product_category,product_default_code"
product_category = fields.Many2one(related="product_id.categ_id", store=True)
_order = "product_category_name,product_default_code"
product_category_name = fields.Many2one(related="product_id.categ_id.name", store=True)

Copy link
Member Author

@victor-champonnois victor-champonnois Dec 16, 2024

Choose a reason for hiding this comment

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

In theory I agree with you, but in practice it works ! checkout out this delivery, on the picking operations, valdibela is sorted last, while it's id is 3 (lower than the id from tierra y liberdad). Unless the sorting is descending ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Note that I will only keep the sorting for move lines, not moves

Copy link
Member

Choose a reason for hiding this comment

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

my bad: i just checked, and indeed, odoo does it better than i think: if a many2one field is used in _order, it will correctly use the ordering of that model, automatically joining with all needed tables.

Copy link
Member

Choose a reason for hiding this comment

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

in the stock module, the file is called report_stockpicking_operations.xml. i think it can be simply named report_picking.xml, as this is also the name of the report.

Copy link
Member Author

Choose a reason for hiding this comment

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

done

Copy link
Member

Choose a reason for hiding this comment

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

why _operations in the module name? suggestion: foodhub_custom_stock_picking.

Copy link
Member Author

Choose a reason for hiding this comment

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

done, dropped the custom because it's useless I think

Copy link
Member

Choose a reason for hiding this comment

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

then i think foodhub_stock_picking is better, because picking alone is a little strange.

Copy link
Member

Choose a reason for hiding this comment

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

then i think foodhub_stock_picking is better, because picking alone is a little strange.

Comment on lines 10 to 12
_order = "product_category,product_default_code"

product_category = fields.Many2one(related="product_id.categ_id", store=True)
Copy link
Member

Choose a reason for hiding this comment

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

my bad: i just checked, and indeed, odoo does it better than i think: if a many2one field is used in _order, it will correctly use the ordering of that model, automatically joining with all needed tables.

from odoo import fields, models


class StockMove(models.Model):
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
class StockMove(models.Model):
class StockMoveLine(models.Model):

Comment on lines +1 to +3
# Copyright 2020 Coop IT Easy SCRL fs
# Robin Keunen <[email protected]>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
Copy link
Member

Choose a reason for hiding this comment

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

this seems like a copy-pasting: the year, the company name and the contributor are incorrect. as you are changing this, please adopt the reuse syntax:

Suggested change
# Copyright 2020 Coop IT Easy SCRL fs
# Robin Keunen <[email protected]>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
# SPDX-FileCopyrightText: 2024 Coop IT Easy SC
#
# SPDX-License-Identifier: AGPL-3.0-or-later

@@ -0,0 +1,14 @@
{
Copy link
Member

Choose a reason for hiding this comment

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

missing copyright:

Suggested change
{
# SPDX-FileCopyrightText: 2024 Coop IT Easy SC
#
# SPDX-License-Identifier: AGPL-3.0-or-later
{

@@ -0,0 +1 @@
from . import models
Copy link
Member

Choose a reason for hiding this comment

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

missing copyright:

Suggested change
from . import models
# SPDX-FileCopyrightText: 2024 Coop IT Easy SC
#
# SPDX-License-Identifier: AGPL-3.0-or-later
from . import models

@@ -0,0 +1 @@
from . import stock_move_line
Copy link
Member

Choose a reason for hiding this comment

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

missing copyright:

Suggested change
from . import stock_move_line
# SPDX-FileCopyrightText: 2024 Coop IT Easy SC
#
# SPDX-License-Identifier: AGPL-3.0-or-later
from . import stock_move_line

Comment on lines +1 to +2
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
Copy link
Member

Choose a reason for hiding this comment

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

missing copyright:

Suggested change
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<?xml version="1.0" encoding="utf-8" ?>
<!--
SPDX-FileCopyrightText: 2024 Coop IT Easy SC
SPDX-License-Identifier: AGPL-3.0-or-later
-->
<odoo>

Comment on lines +7 to +9
<xpath expr="//div[@name='div_origin']/strong[2]" position="attributes">
<attribute name="class">invisible</attribute>
</xpath>
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
<xpath expr="//div[@name='div_origin']/strong[2]" position="attributes">
<attribute name="class">invisible</attribute>
</xpath>
<xpath expr="//div[@name='div_origin']/strong[2]" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>

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.

3 participants