Skip to content

Commit

Permalink
[MIG] stock_request: Migration to 16.0
Browse files Browse the repository at this point in the history
  • Loading branch information
nicomacr committed Sep 19, 2023
1 parent 5a37f9a commit f5e7e9f
Show file tree
Hide file tree
Showing 76 changed files with 213 additions and 257 deletions.
File renamed without changes.
14 changes: 8 additions & 6 deletions stock_request/README.md → README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

[![Runboat](https://img.shields.io/badge/runboat-Try%20me-875A7B.png)](https://runboat.odoo-community.org/builds?repo=OCA/stock-logistics-request&target_branch=16.0)
[![Pre-commit Status](https://github.com/OCA/stock-logistics-request/actions/workflows/pre-commit.yml/badge.svg?branch=16.0)](https://github.com/OCA/stock-logistics-request/actions/workflows/pre-commit.yml?query=branch%3A16.0)
[![Build Status](https://github.com/OCA/stock-logistics-request/actions/workflows/test.yml/badge.svg?branch=16.0)](https://github.com/OCA/stock-logistics-request/actions/workflows/test.yml?query=branch%3A16.0)
Expand All @@ -9,7 +8,9 @@

# Stock Logistics Request

This repository contains modules to provide another way of creating stock movements. Provided as a dedicated application, users will be able to create their stock needs by product and location.
This repository contains modules to provide another way of creating stock movements.
Provided as a dedicated application, users will be able to create their stock needs by
product and location.

<!-- /!\ do not modify below this line -->

Expand All @@ -27,11 +28,12 @@ This part will be replaced when running the oca-gen-addons-table script from OCA

This repository is licensed under [AGPL-3.0](LICENSE).

However, each module can have a totally different license, as long as they adhere to Odoo Community Association (OCA)
policy. Consult each module's `__manifest__.py` file, which contains a `license` key
that explains its license.
However, each module can have a totally different license, as long as they adhere to
Odoo Community Association (OCA) policy. Consult each module's `__manifest__.py` file,
which contains a `license` key that explains its license.

---

----
OCA, or the [Odoo Community Association](http://odoo-community.org/), is a nonprofit
organization whose mission is to support the collaborative development of Odoo features
and promote its widespread use.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions setup/stock_request/odoo/addons/stock_request
6 changes: 6 additions & 0 deletions setup/stock_request/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ Stock Request
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fstock--logistics--warehouse-lightgray.png?logo=github
:target: https://github.com/OCA/stock-logistics-warehouse/tree/15.0/stock_request
:alt: OCA/stock-logistics-warehouse
:target: https://github.com/OCA/stock-logistics-request/tree/15.0/stock_request
:alt: OCA/stock-logistics-request
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/stock-logistics-warehouse-15-0/stock-logistics-warehouse-15-0-stock_request
:target: https://translation.odoo-community.org/projects/stock-logistics-request-16-0/stock-logistics-request-16-0-stock_request
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/stock-logistics-warehouse&target_branch=15.0
:target: https://runboat.odoo-community.org/builds?repo=OCA/stock-logistics-request&target_branch=16.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|
Expand Down Expand Up @@ -89,10 +89,10 @@ It is also required to manage active field logically from Orders to SRs.
Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/stock-logistics-warehouse/issues>`_.
Bugs are tracked on `GitHub Issues <https://github.com/OCA/stock-logistics-request/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/stock-logistics-warehouse/issues/new?body=module:%20stock_request%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/stock-logistics-request/issues/new?body=module:%20stock_request%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Expand Down Expand Up @@ -136,6 +136,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

This module is part of the `OCA/stock-logistics-warehouse <https://github.com/OCA/stock-logistics-warehouse/tree/15.0/stock_request>`_ project on GitHub.
This module is part of the `OCA/stock-logistics-request <https://github.com/OCA/stock-logistics-request/tree/15.0/stock_request>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
{
"name": "Stock Request",
"summary": "Internal request for stock",
"version": "15.0.1.6.3",
"version": "16.0.1.0.0",
"license": "LGPL-3",
"website": "https://github.com/OCA/stock-logistics-warehouse",
"website": "https://github.com/OCA/stock-logistics-request",
"author": "ForgeFlow, Odoo Community Association (OCA)",
"category": "Warehouse Management",
"depends": ["stock"],
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@


class StockLocationRoute(models.Model):
_inherit = "stock.location.route"
_inherit = "stock.route"

@api.constrains("company_id")
def _check_company_stock_request(self):
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ class StockPicking(models.Model):
"Stock Request #", compute="_compute_stock_request_ids"
)

@api.depends("move_lines")
@api.depends("move_ids")
def _compute_stock_request_ids(self):
for rec in self:
rec.stock_request_ids = rec.move_lines.mapped("stock_request_ids")
rec.stock_request_ids = rec.move_ids.mapped("stock_request_ids")
rec.stock_request_count = len(rec.stock_request_ids)

def action_view_stock_request(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,41 +180,50 @@ def _compute_qty(self):

@api.constrains("order_id", "requested_by")
def check_order_requested_by(self):
if self.order_id and self.order_id.requested_by != self.requested_by:
raise ValidationError(_("Requested by must be equal to the order"))
for rec in self:
if rec.order_id and rec.order_id.requested_by != rec.requested_by:
raise ValidationError(_("Requested by must be equal to the order"))

@api.constrains("order_id", "warehouse_id")
def check_order_warehouse_id(self):
if self.order_id and self.order_id.warehouse_id != self.warehouse_id:
raise ValidationError(_("Warehouse must be equal to the order"))
for rec in self:
if rec.order_id and rec.order_id.warehouse_id != rec.warehouse_id:
raise ValidationError(_("Warehouse must be equal to the order"))

@api.constrains("order_id", "location_id")
def check_order_location(self):
if self.order_id and self.order_id.location_id != self.location_id:
raise ValidationError(_("Location must be equal to the order"))
for rec in self:
if rec.order_id and rec.order_id.location_id != rec.location_id:
raise ValidationError(_("Location must be equal to the order"))

@api.constrains("order_id", "procurement_group_id")
def check_order_procurement_group(self):
if (
self.order_id
and self.order_id.procurement_group_id != self.procurement_group_id
):
raise ValidationError(_("Procurement group must be equal to the order"))
for rec in self:
if (
rec.order_id
and rec.order_id.procurement_group_id != rec.procurement_group_id
):
raise ValidationError(_("Procurement group must be equal to the order"))

@api.constrains("order_id", "company_id")
def check_order_company(self):
if self.order_id and self.order_id.company_id != self.company_id:
raise ValidationError(_("Company must be equal to the order"))
for rec in self:
if rec.order_id and rec.order_id.company_id != rec.company_id:
raise ValidationError(_("Company must be equal to the order"))

@api.constrains("order_id", "expected_date")
def check_order_expected_date(self):
if self.order_id and self.order_id.expected_date != self.expected_date:
raise ValidationError(_("Expected date must be equal to the order"))
for rec in self:
if rec.order_id and rec.order_id.expected_date != rec.expected_date:
raise ValidationError(_("Expected date must be equal to the order"))

@api.constrains("order_id", "picking_policy")
def check_order_picking_policy(self):
if self.order_id and self.order_id.picking_policy != self.picking_policy:
raise ValidationError(_("The picking policy must be equal to the order"))
for rec in self:
if rec.order_id and rec.order_id.picking_policy != rec.picking_policy:
raise ValidationError(
_("The picking policy must be equal to the order")
)

def _action_confirm(self):
self._action_launch_procurement_rule()
Expand Down Expand Up @@ -351,17 +360,20 @@ def action_view_transfer(self):
action["res_id"] = pickings.id
return action

@api.model
def create(self, vals):
upd_vals = vals.copy()
if upd_vals.get("name", "/") == "/":
upd_vals["name"] = self.env["ir.sequence"].next_by_code("stock.request")
if "order_id" in upd_vals:
order_id = self.env["stock.request.order"].browse(upd_vals["order_id"])
upd_vals["expected_date"] = order_id.expected_date
else:
upd_vals["expected_date"] = self._get_expected_date()
return super().create(upd_vals)
@api.model_create_multi
def create(self, vals_list):
vals_list_upd = []
for vals in vals_list:
upd_vals = vals.copy()
if upd_vals.get("name", "/") == "/":
upd_vals["name"] = self.env["ir.sequence"].next_by_code("stock.request")
if "order_id" in upd_vals:
order_id = self.env["stock.request.order"].browse(upd_vals["order_id"])
upd_vals["expected_date"] = order_id.expected_date
else:
upd_vals["expected_date"] = self._get_expected_date()
vals_list_upd.append(upd_vals)
return super().create(vals_list_upd)

def unlink(self):
if self.filtered(lambda r: r.state != "draft"):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,14 @@ def _compute_product_qty(self):
"res.company", "Company", required=True, default=lambda self: self.env.company
)
route_id = fields.Many2one(
"stock.location.route",
"stock.route",
string="Route",
domain="[('id', 'in', route_ids)]",
ondelete="restrict",
)

route_ids = fields.Many2many(
"stock.location.route",
"stock.route",
string="Routes",
compute="_compute_route_ids",
readonly=True,
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
Loading

0 comments on commit f5e7e9f

Please sign in to comment.