diff --git a/stock_request_purchase/README.rst b/stock_request_purchase/README.rst index a177c34ad..358f76166 100644 --- a/stock_request_purchase/README.rst +++ b/stock_request_purchase/README.rst @@ -14,13 +14,13 @@ Stock Request Purchase :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/13.0/stock_request_purchase + :target: https://github.com/OCA/stock-logistics-warehouse/tree/14.0/stock_request_purchase :alt: OCA/stock-logistics-warehouse .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/stock-logistics-warehouse-13-0/stock-logistics-warehouse-13-0-stock_request_purchase + :target: https://translation.odoo-community.org/projects/stock-logistics-warehouse-14-0/stock-logistics-warehouse-14-0-stock_request_purchase :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/153/13.0 + :target: https://runbot.odoo-community.org/runbot/153/14.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -52,7 +52,7 @@ Bug Tracker Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -70,6 +70,7 @@ Contributors * Jordi Ballester . * Enric Tobella * Kitti Upariphutthiphong +* Alan Ramos Maintainers ~~~~~~~~~~~ @@ -84,6 +85,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 `_ project on GitHub. +This module is part of the `OCA/stock-logistics-warehouse `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/stock_request_purchase/__manifest__.py b/stock_request_purchase/__manifest__.py index 8617d8bd1..4aba1552d 100644 --- a/stock_request_purchase/__manifest__.py +++ b/stock_request_purchase/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Stock Request Purchase", "summary": "Internal request for stock", - "version": "13.0.1.0.0", + "version": "14.0.1.0.0", "license": "LGPL-3", "website": "https://github.com/OCA/stock-logistics-warehouse", "author": "ForgeFlow, Odoo Community Association (OCA)", diff --git a/stock_request_purchase/models/purchase_order_line.py b/stock_request_purchase/models/purchase_order_line.py index 2acb2a602..fdd5ee575 100644 --- a/stock_request_purchase/models/purchase_order_line.py +++ b/stock_request_purchase/models/purchase_order_line.py @@ -13,7 +13,7 @@ class PurchaseOrderLine(models.Model): ) def _prepare_stock_moves(self, picking): - res = super(PurchaseOrderLine, self)._prepare_stock_moves(picking) + res = super()._prepare_stock_moves(picking) for re in res: re["allocation_ids"] = [ @@ -29,6 +29,17 @@ class PurchaseOrderLine(models.Model): ] return res + @api.model + def _prepare_purchase_order_line_from_procurement( + self, product_id, product_qty, product_uom, company_id, values, po + ): + vals = super()._prepare_purchase_order_line_from_procurement( + product_id, product_qty, product_uom, company_id, values, po + ) + if "stock_request_id" in values: + vals["stock_request_ids"] = [(4, values["stock_request_id"])] + return vals + @api.constrains("stock_request_ids") def _check_purchase_company_constrains(self): if any( diff --git a/stock_request_purchase/models/stock_request.py b/stock_request_purchase/models/stock_request.py index a16eddf92..b3b586bc4 100644 --- a/stock_request_purchase/models/stock_request.py +++ b/stock_request_purchase/models/stock_request.py @@ -14,9 +14,7 @@ class StockRequest(models.Model): string="Purchase Orders", readonly=True, ) - purchase_count = fields.Integer( - string="Purchase count", compute="_compute_purchase_ids", readonly=True - ) + purchase_count = fields.Integer(compute="_compute_purchase_ids", readonly=True) purchase_line_ids = fields.Many2many( "purchase.order.line", string="Purchase Order Lines", readonly=True, copy=False ) @@ -41,7 +39,7 @@ class StockRequest(models.Model): ) def action_view_purchase(self): - action = self.env.ref("purchase.purchase_order_action_generic").read()[0] + action = self.env.ref("purchase.purchase_rfq").read()[0] purchases = self.mapped("purchase_ids") if len(purchases) > 1: diff --git a/stock_request_purchase/models/stock_request_order.py b/stock_request_purchase/models/stock_request_order.py index 45d18c782..f28695782 100644 --- a/stock_request_purchase/models/stock_request_order.py +++ b/stock_request_purchase/models/stock_request_order.py @@ -13,9 +13,7 @@ class StockRequestOrder(models.Model): string="Purchase Orders", readonly=True, ) - purchase_count = fields.Integer( - string="Purchase count", compute="_compute_purchase_ids", readonly=True - ) + purchase_count = fields.Integer(compute="_compute_purchase_ids", readonly=True) purchase_line_ids = fields.Many2many( "purchase.order.line", compute="_compute_purchase_ids", @@ -32,7 +30,7 @@ class StockRequestOrder(models.Model): req.purchase_count = len(req.purchase_ids) def action_view_purchase(self): - action = self.env.ref("purchase.purchase_order_action_generic").read()[0] + action = self.env.ref("purchase.purchase_rfq").read()[0] purchases = self.mapped("purchase_ids") if len(purchases) > 1: action["domain"] = [("id", "in", purchases.ids)] diff --git a/stock_request_purchase/models/stock_rule.py b/stock_request_purchase/models/stock_rule.py index 0fe45a7d9..1597f3fad 100644 --- a/stock_request_purchase/models/stock_rule.py +++ b/stock_request_purchase/models/stock_rule.py @@ -7,20 +7,10 @@ from odoo import models class StockRule(models.Model): _inherit = "stock.rule" - def _prepare_purchase_order_line( - self, product_id, product_qty, product_uom, company_id, values, po - ): - vals = super(StockRule, self)._prepare_purchase_order_line( - product_id, product_qty, product_uom, company_id, values, po - ) - if "stock_request_id" in values: - vals["stock_request_ids"] = [(4, values["stock_request_id"])] - return vals - def _update_purchase_order_line( self, product_id, product_qty, product_uom, company_id, values, line ): - vals = super(StockRule, self)._update_purchase_order_line( + vals = super()._update_purchase_order_line( product_id, product_qty, product_uom, company_id, values, line ) if "stock_request_id" in values: diff --git a/stock_request_purchase/readme/CONTRIBUTORS.rst b/stock_request_purchase/readme/CONTRIBUTORS.rst index ab89ce920..188eb516a 100644 --- a/stock_request_purchase/readme/CONTRIBUTORS.rst +++ b/stock_request_purchase/readme/CONTRIBUTORS.rst @@ -1,3 +1,4 @@ * Jordi Ballester . * Enric Tobella * Kitti Upariphutthiphong +* Alan Ramos diff --git a/stock_request_purchase/static/description/index.html b/stock_request_purchase/static/description/index.html index d4d5bc0cd..6fa858052 100644 --- a/stock_request_purchase/static/description/index.html +++ b/stock_request_purchase/static/description/index.html @@ -367,7 +367,7 @@ ul.auto-toc { !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Beta License: LGPL-3 OCA/stock-logistics-warehouse Translate me on Weblate Try me on Runbot

+

Beta License: LGPL-3 OCA/stock-logistics-warehouse Translate me on Weblate Try me on Runbot

This module allows for users to be able to display purchase orders that have been created as a consequence of Stock Requests.

Table of contents

@@ -402,7 +402,7 @@ in the Purchase Order.

Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed -feedback.

+feedback.

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

@@ -419,6 +419,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
  • Jordi Ballester <jordi.ballester@forgeflow.com>.
  • Enric Tobella <etobella@creublanca.es>
  • Kitti Upariphutthiphong <kittiu@ecosoft.co.th>
  • +
  • Alan Ramos <alan.ramos@jarsa.com.mx>
  • @@ -428,7 +429,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome

    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 project on GitHub.

    +

    This module is part of the OCA/stock-logistics-warehouse project on GitHub.

    You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

    diff --git a/stock_request_purchase/tests/test_stock_request_purchase.py b/stock_request_purchase/tests/test_stock_request_purchase.py index db4fe4bef..5d999a7aa 100644 --- a/stock_request_purchase/tests/test_stock_request_purchase.py +++ b/stock_request_purchase/tests/test_stock_request_purchase.py @@ -117,7 +117,6 @@ class TestStockRequestPurchase(common.TransactionCase): self.assertEqual(order.stock_request_ids.state, "open") order.refresh() - self.assertEqual(len(order.sudo().purchase_ids), 1) self.assertEqual(len(order.picking_ids), 0) self.assertEqual(len(order.move_ids), 0) @@ -138,7 +137,7 @@ class TestStockRequestPurchase(common.TransactionCase): picking.action_assign() packout1 = picking.move_line_ids[0] packout1.qty_done = 5 - picking.action_done() + picking.button_validate() self.assertEqual(order.stock_request_ids.qty_in_progress, 0.0) self.assertEqual( @@ -205,7 +204,7 @@ class TestStockRequestPurchase(common.TransactionCase): picking.action_assign() packout1 = picking.move_line_ids[0] packout1.qty_done = 10 - picking.action_done() + picking.button_validate() self.assertEqual(stock_request_1.qty_in_progress, 0.0) self.assertEqual(stock_request_1.qty_done, stock_request_1.product_uom_qty) diff --git a/stock_request_purchase/views/purchase_order_views.xml b/stock_request_purchase/views/purchase_order_views.xml index 6d3cf8702..06acec410 100644 --- a/stock_request_purchase/views/purchase_order_views.xml +++ b/stock_request_purchase/views/purchase_order_views.xml @@ -24,7 +24,7 @@ widget="statinfo" string="Stock Requests" /> - + diff --git a/stock_request_purchase/views/stock_request_order_views.xml b/stock_request_purchase/views/stock_request_order_views.xml index b52301962..add8d196a 100644 --- a/stock_request_purchase/views/stock_request_order_views.xml +++ b/stock_request_purchase/views/stock_request_order_views.xml @@ -9,7 +9,7 @@
    - +