Skip to content

Commit

Permalink
[IMP] add categories in views
Browse files Browse the repository at this point in the history
Add categories in SO an pickings views to make comparison with the printed picking operations easier
  • Loading branch information
victor-champonnois committed Feb 4, 2025
1 parent a50a63d commit f21694c
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 11 deletions.
11 changes: 6 additions & 5 deletions foodhub_picking/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# SPDX-FileCopyrightText: 2024 Coop IT Easy SC
#
# SPDX-License-Identifier: AGPL-3.0-or-later

{
"name": "Foodhub Picking Operations",
"version": "16.0.1.0.0",
Expand All @@ -13,6 +9,11 @@
"category": "Stock",
"depends": [
"stock",
"sale_management"
],
"data": [
"reports/report_picking.xml",
"views/stock_picking_views.xml",
"views/sale_order_line_views.xml"
],
"data": ["reports/report_picking.xml"],
}
6 changes: 2 additions & 4 deletions foodhub_picking/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# SPDX-FileCopyrightText: 2024 Coop IT Easy SC
#
# SPDX-License-Identifier: AGPL-3.0-or-later

from . import stock_move_line
from . import stock_move
from . import sale_order_line
13 changes: 13 additions & 0 deletions foodhub_picking/models/sale_order_line.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# -*- coding: utf-8 -*-
import logging

from odoo import models, fields, api, _
from odoo.exceptions import UserError, ValidationError

_logger = logging.getLogger(__name__)


class SaleOrderLine(models.Model):
_inherit = 'sale.order.line'

product_category_name = fields.Char(related="product_id.categ_id.complete_name", store=True, string="Product Category")
13 changes: 13 additions & 0 deletions foodhub_picking/models/stock_move.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# -*- coding: utf-8 -*-
import logging

from odoo import models, fields, api, _
from odoo.exceptions import UserError, ValidationError

_logger = logging.getLogger(__name__)


class StockMove(models.Model):
_inherit = 'stock.move'

product_category_name = fields.Char(related="product_id.categ_id.complete_name", store=True, string="Product Category")
4 changes: 2 additions & 2 deletions foodhub_picking/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
- Sort picking operations by internal category and internal reference.

Context : Increase the efficiency of picking by sorting products by location and priority. We cannot use "locations" because some products are of type Consumable and should stay this way : these are products that are received and sent on the same date, we don't want to manage stock on these products.
So instead we sort by internal categories and by reference.

- Sort picking operations by internal category and internal reference.
- Put the name of the SO in title, rather than the picking reference. Because this picking will be sent to the client, who only knows the reference of the SO. In principle this document should not be sent to the client, but here it's easier to only rely on one document.
- Add categories in SO an pickings views to make comparison with the printed picking operations easier
15 changes: 15 additions & 0 deletions foodhub_picking/views/sale_order_line_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>

<record id="view_sale_order_line_form" model="ir.ui.view">
<field name="name">view.sale_order_line.form</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form" />
<field name="arch" type="xml">
<xpath expr="//tree/field[@name='product_id']" position="after">
<field name="product_category_name" optional="hide" />
</xpath>
</field>
</record>

</odoo>
16 changes: 16 additions & 0 deletions foodhub_picking/views/stock_picking_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>

<record id="view_stock_picking_form" model="ir.ui.view">
<field name="name">view.stock.picking.form</field>
<field name="model">stock.picking</field>
<field name="inherit_id" ref="stock.view_picking_form"/>
<field name="arch" type="xml">
<field name="display_assign_serial" position="after">
<field name="product_category_name" />
</field>

</field>
</record>

</odoo>

0 comments on commit f21694c

Please sign in to comment.