Skip to content

Commit

Permalink
Merge branch '14.0' into TA#61968_ANALYSIS
Browse files Browse the repository at this point in the history
  • Loading branch information
majouda authored Dec 2, 2024
2 parents d9975a7 + 53c7922 commit 7aa8969
Show file tree
Hide file tree
Showing 129 changed files with 1,982 additions and 127 deletions.
14 changes: 13 additions & 1 deletion .docker_files/main/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,31 @@
"category": "Other",
"summary": "Install all addons required for testing.",
"depends": [
"purchase", # For testing stock_orderpoint_scheduled_date
"product_category_safe_change",
"product_packaging_dimension_decimal",
"stock_account_visibility",
"stock_auto_assign_disabled",
# "stock_auto_assign_disabled_jit",
"stock_auto_assign_disabled_jit",
"stock_change_qty_reason_enhanced",
"stock_immediate_transfer_disable",
"stock_location_dest_width",
"stock_location_position_alphanum",
"stock_move_location_domain_improved",
"stock_move_origin_link",
"stock_move_valuation_adjustment",
"stock_orderpoint_picking_groupby_date",
"stock_orderpoint_scheduled_date",
"stock_orderpoint_secondary_unit",
"stock_orderpoint_procurement_date",
"stock_picking_barcode",
# "stock_picking_delivery_carrier_required", TA#68633
# in conflict with OCA/OCA/stock-logistics-warehouse module: stock_secondary_unit
# loaded from Numigi/odoo-stock-addons module: stock_quant_secondary_unit
"stock_picking_groupby_parent_affiliate",
"stock_picking_product_supplier",
"stock_picking_responsible_editable",
"stock_picking_correct_reservation",
"stock_picking_secondary_unit_demand",
"stock_picking_show_address",
"stock_picking_split_qty",
Expand Down
13 changes: 10 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,34 @@ RUN mkdir -p "${THIRD_PARTY_ADDONS}" && chown -R odoo "${THIRD_PARTY_ADDONS}"
COPY ./gitoo.yml /gitoo.yml
RUN gitoo install-all --conf_file /gitoo.yml --destination "${THIRD_PARTY_ADDONS}"

USER odoo


COPY product_category_safe_change /mnt/extra-addons/product_category_safe_change
COPY product_packaging_dimension_decimal /mnt/extra-addons/product_packaging_dimension_decimal
COPY stock_account_visibility /mnt/extra-addons/stock_account_visibility
COPY stock_auto_assign_disabled /mnt/extra-addons/stock_auto_assign_disabled
# COPY stock_auto_assign_disabled_jit /mnt/extra-addons/stock_auto_assign_disabled_jit
COPY stock_auto_assign_disabled_jit /mnt/extra-addons/stock_auto_assign_disabled_jit
COPY stock_change_qty_reason_enhanced /mnt/extra-addons/stock_change_qty_reason_enhanced
COPY stock_immediate_transfer_disable /mnt/extra-addons/stock_immediate_transfer_disable
COPY stock_location_dest_width /mnt/extra-addons/stock_location_dest_width
COPY stock_location_position_alphanum /mnt/extra-addons/stock_location_position_alphanum
COPY stock_move_location_domain_improved /mnt/extra-addons/stock_move_location_domain_improved
COPY stock_move_origin_link /mnt/extra-addons/stock_move_origin_link
COPY stock_move_valuation_adjustment /mnt/extra-addons/stock_move_valuation_adjustment
COPY stock_orderpoint_picking_groupby_date /mnt/extra-addons/stock_orderpoint_picking_groupby_date
COPY stock_orderpoint_scheduled_date /mnt/extra-addons/stock_orderpoint_scheduled_date
COPY stock_orderpoint_secondary_unit /mnt/extra-addons/stock_orderpoint_secondary_unit
COPY stock_orderpoint_procurement_date /mnt/extra-addons/stock_orderpoint_procurement_date
COPY stock_picking_barcode /mnt/extra-addons/stock_picking_barcode
COPY stock_picking_delivery_carrier_required /mnt/extra-addons/stock_picking_delivery_carrier_required
COPY stock_picking_groupby_parent_affiliate /mnt/extra-addons/stock_picking_groupby_parent_affiliate
COPY stock_picking_responsible_editable /mnt/extra-addons/stock_picking_responsible_editable
COPY stock_picking_correct_reservation /mnt/extra-addons/stock_picking_correct_reservation
COPY stock_picking_secondary_unit_demand /mnt/extra-addons/stock_picking_secondary_unit_demand
COPY stock_picking_show_address /mnt/extra-addons/stock_picking_show_address
COPY stock_picking_split_qty /mnt/extra-addons/stock_picking_split_qty
COPY stock_picking_tracking_reference /mnt/extra-addons/stock_picking_tracking_reference
COPY stock_product_packaging_dimension /mnt/extra-addons/stock_product_packaging_dimension
COPY stock_picking_product_supplier /mnt/extra-addons/stock_picking_product_supplier
COPY stock_product_packaging_uom /mnt/extra-addons/stock_product_packaging_uom
COPY stock_production_lot_rma /mnt/extra-addons/stock_production_lot_rma
COPY stock_quant_by_category /mnt/extra-addons/stock_quant_by_category
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[![Runboat](https://img.shields.io/badge/runboat-Try%20me-875A7B.png)](https://runboat.numigi.tech/builds?repo=numigi/odoo-stock-addons&target_branch=14.0)

# Stock Addons

This repository contains Odoo addons related to inventory.
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ services:
environment:
- LOG_ODOO=/var/log/odoo
db:
image: postgres:9.6
image: postgres:16.0
environment:
- POSTGRES_PASSWORD=odoo
- POSTGRES_USER=odoo
Expand Down
3 changes: 0 additions & 3 deletions gitoo.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
- url: https://{{GIT_TOKEN}}@github.com/numigi/odoo-enterprise
branch: "14.0"

- url: https://{{GIT_TOKEN}}@github.com/numigi/odoo-base-addons
branch: "14.0"

Expand Down
3 changes: 2 additions & 1 deletion product_category_safe_change/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

{
"name": "Product Category Safe Change",
"version": "14.0.1.0.0",
"version": "14.0.1.0.1",
"author": "Numigi",
"maintainer": "Numigi",
"website": "https://bit.ly/numigi-com",
Expand All @@ -13,4 +13,5 @@
"summary": "Add some restriction to the product category of articles",
"data": [],
"installable": True,
"auto_install": True,
}
14 changes: 8 additions & 6 deletions product_category_safe_change/models/product.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,33 @@ class Product(models.Model):
_inherit = "product.product"

def _check_category_stock_move(self):
existing_move_lines = self.env['stock.move.line'].search([
existing_move_lines = self.env['stock.move.line'].sudo().search([
('product_id', 'in', self.ids)
])
if existing_move_lines:
raise UserError(
_("You cannot modify the category of a Product with Stock Moves."))

def write(self, vals):
if 'categ_id' in vals:
self._check_category_stock_move()
for rec in self:
if rec.type != "service" and "categ_id" in vals:
rec._check_category_stock_move()
return super(Product, self).write(vals)


class ProductTemplate(models.Model):
_inherit = 'product.template'

def _check_category_stock_move(self):
existing_move_lines = self.env['stock.move.line'].search([
existing_move_lines = self.env['stock.move.line'].sudo().search([
('product_id.product_tmpl_id', 'in', self.ids)
])
if existing_move_lines:
raise UserError(
_("You cannot modify the category of a Product with Stock Moves."))

def write(self, vals):
if 'categ_id' in vals:
self._check_category_stock_move()
for rec in self:
if rec.type != "service" and "categ_id" in vals:
rec._check_category_stock_move()
return super(ProductTemplate, self).write(vals)
22 changes: 6 additions & 16 deletions product_category_safe_change/models/product_category.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,13 @@
class ProductCategory(models.Model):
_inherit = "product.category"

def _get_product_name(self, product_id):
return self.env["product.product"].browse(product_id).name

def _multi_company_constraints(self, existing_move_lines):
current_company = self.env.user.company_id.id
if existing_move_lines:
if current_company not in existing_move_lines.sudo().mapped(
"move_id.company_id.id"
):
return False
return True

def _check_category_stock_move(self):
domain = [("product_id.categ_id", "in", self.ids)]
existing_move_lines = self.env["stock.move.line"].search(domain)
not_allowed = self._multi_company_constraints(existing_move_lines)
if len(existing_move_lines) and not_allowed:
domain = [
("product_id.categ_id", "in", self.ids),
("company_id", "=", self.env.company.id)
]
existing_move_lines = self.env["stock.move.line"].sudo().search(domain)
if len(existing_move_lines):
product_lists = existing_move_lines.mapped("product_id.name")
product_lists = (
# select three first products found on move lines
Expand Down
9 changes: 4 additions & 5 deletions product_category_safe_change/tests/test_product_category.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,12 @@ def test_update_product_category_with_stock_move(self):
move = self.process_stock_move(self.company_a, self.stock_location_a)
categ_all = self.env.ref('product.product_category_all')

domain = [("product_id.categ_id", "in", categ_all.ids)]
domain = [
("product_id.categ_id", "in", categ_all.ids),
("company_id", "=", self.env.company.id)
]
existing_move_lines = self.env["stock.move.line"].search(domain)
not_allowed = categ_all._multi_company_constraints(
existing_move_lines)

self.assertGreater(len(existing_move_lines), 0)
self.assertTrue(not_allowed)
self.assertEqual(move.company_id, self.env.user.company_id)

# for property_stock_account_input_categ_id
Expand Down
2 changes: 1 addition & 1 deletion stock_auto_assign_disabled/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{
"name": "Stock Auto Assign Disabled",
"summary": "Disable the automatic stock reservation by the planner",
"version": "1.0.0",
"version": "1.0.1",
"category": "Inventory",
"author": "Numigi",
"license": "AGPL-3",
Expand Down
12 changes: 9 additions & 3 deletions stock_auto_assign_disabled/models/stock_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,23 @@ class StockMove(models.Model):
_inherit = "stock.move"

def _action_assign(self):
mode = self.env["ir.config_parameter"].sudo().get_param(
"stock_auto_assign_disabled.config", "off"
mode = (
self.env["ir.config_parameter"]
.sudo()
.get_param("stock_auto_assign_disabled.config", "off")
)
should_disable = self._context.get("stock_auto_assign_disable")
if mode == "off" or not should_disable:
super()._action_assign()
return super(StockMove, self)._action_assign()
elif mode == "serial_lot":
self_filtered = self.filtered(
lambda x: x._should_process_auto_reservation()
)
super(StockMove, self_filtered)._action_assign()
elif mode == "all":
return True
else:
return super(StockMove, self)._action_assign()

def _should_process_auto_reservation(self):
return self.product_id.tracking not in ["serial", "lot"]
2 changes: 2 additions & 0 deletions stock_auto_assign_disabled/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
# © 2022 - today Numigi (tm) and all its contributors (https://bit.ly/numigiens)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import test_auto_assign
2 changes: 1 addition & 1 deletion stock_auto_assign_disabled/tests/test_auto_assign.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,4 @@ def test_scheduler_no_lot(self):
assert self.stock_move.reserved_availability == 5.0

def _run_scheduler(self, group, user):
group.sudo(user).run_scheduler()
group.with_user(user).run_scheduler()
6 changes: 5 additions & 1 deletion stock_auto_assign_disabled_jit/models/sale.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,8 @@ class SaleOrderLine(models.Model):
_inherit = "sale.order.line"

def _action_launch_stock_rule(self, previous_product_uom_qty=False):
super()._action_launch_stock_rule(previous_product_uom_qty=previous_product_uom_qty)
self_with_context = self.with_context(stock_auto_assign_disable=True)
res = super(SaleOrderLine, self_with_context)._action_launch_stock_rule(
previous_product_uom_qty=previous_product_uom_qty
)
return res
2 changes: 2 additions & 0 deletions stock_auto_assign_disabled_jit/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
# © 2022 - today Numigi (tm) and all its contributors (https://bit.ly/numigiens)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import test_auto_assign
2 changes: 1 addition & 1 deletion stock_auto_assign_disabled_jit/tests/test_auto_assign.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,4 @@ def test_no_reservation(self):
assert self.order_line.move_ids.reserved_availability == 0

def _confirm_sale_order(self):
self.sale_order.sudo(self.user).action_confirm()
self.sale_order.with_user(self.user).action_confirm()
10 changes: 10 additions & 0 deletions stock_location_dest_width/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Stock Location Destination Width
================================
This module adjusts the width of the destination location field in the detailed operation wizard
to its default rendering.

.. image:: static/description/detailed_operation_wizard.png

Contributors
------------
* Numigi (tm) and all its contributors (https://bit.ly/numigiens)
2 changes: 2 additions & 0 deletions stock_location_dest_width/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Copyright 2024 Numigi (tm) and all its contributors (https://bit.ly/numigiens)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
23 changes: 23 additions & 0 deletions stock_location_dest_width/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2024 Numigi (tm) and all its contributors (https://bit.ly/numigiens)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
"name": "Stock Location Destination Width",
"version": "1.0.0",
"author": "Numigi",
"maintainer": "Numigi",
"website": "https://bit.ly/numigi-com",
"license": "AGPL-3",
"category": "Stock",
"depends": [
"stock",
],
"summary": """
Adjusts the width of the destination location field
in the detailed operation wizard.
""",
"data": [
"views/stock_move_views.xml",
],
"installable": True,
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions stock_location_dest_width/views/stock_move_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_move_line_operation_tree_inherit" model="ir.ui.view">
<field name="name">stock.move.line.operations.tree.inherit</field>
<field name="model">stock.move.line</field>
<field name="inherit_id" ref="stock.view_stock_move_line_operation_tree"/>
<field name="arch" type="xml">
<!-- remove width attributes on location_dest_id, set it to default render -->
<xpath expr="//field[@name='location_dest_id']" position="attributes">
<attribute name="width"/>
</xpath>
</field>
</record>

</odoo>
37 changes: 37 additions & 0 deletions stock_orderpoint_picking_groupby_date/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
Stock Orderpoint Picking Groupby Date
=====================================

.. contents:: Table of Contents

Context
-------

This module allows to create a picking grouped by procurement scheduled date.
This module depends of `stock_orderpoint_scheduled_date <https://github.com/Numigi/odoo-stock-addons/tree/14.0/stock_orderpoint_scheduled_date>`_ module that's allow to set manuelly a replanishement date for procurement.

Usage
-----

As a user with access right to ``Inventory > Operations > Replenishment``,
I select at least 2 lines and assign them different expected dates and then order:

.. image:: static/description/replenishement_order.png

I then go to the list of picking and I see that 2 pickings have been created.
- The expected date of the first is 08/30/2024 and the expected date of the second is 09/05/2024.
- Each picking contains the list of products ordered for that date.

.. image:: static/description/picking_date_1.png

.. image:: static/description/picking_date_2.png

If I place a new order on the same date, my new order must be added to the same picking of this date.

.. image:: static/description/replenishement_order_2.png

.. image:: static/description/picking_date_3.png


Contributors
------------
* Numigi (tm) and all its contributors (https://bit.ly/numigiens)
4 changes: 4 additions & 0 deletions stock_orderpoint_picking_groupby_date/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# © 2024 - today Numigi (tm) and all its contributors (https://bit.ly/numigiens)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from . import models
15 changes: 15 additions & 0 deletions stock_orderpoint_picking_groupby_date/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# © 2024 - today Numigi (tm) and all its contributors (https://bit.ly/numigiens)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Stock Orderpoint Picking Groupby Date",
"summary": "Force Scheduled Date in Stock Orderpoint",
"version": "14.0.1.0.0",
"category": "stock",
"website": "https://bit.ly/numigi-com",
"author": "Numigi",
"license": "AGPL-3",
"application": False,
"installable": True,
"depends": ["stock_orderpoint_scheduled_date"],
"data": [],
}
5 changes: 5 additions & 0 deletions stock_orderpoint_picking_groupby_date/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# © 2024 - today Numigi (tm) and all its contributors (https://bit.ly/numigiens)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from . import procurement_group
from . import stock_rule
Loading

0 comments on commit 7aa8969

Please sign in to comment.