From c257e6111f7064fc69f2f20b35f4eb473747caf4 Mon Sep 17 00:00:00 2001 From: Kitti U Date: Wed, 26 Jun 2019 17:39:08 +0700 Subject: [PATCH] [12.0][MIG] stock_request_purchase --- stock_request_purchase/README.rst | 64 ------------------- stock_request_purchase/__manifest__.py | 2 +- stock_request_purchase/models/__init__.py | 2 +- .../models/purchase_order_line.py | 8 +-- .../{procurement_rule.py => stock_rule.py} | 8 +-- .../readme/CONTRIBUTORS.rst | 3 + stock_request_purchase/readme/DESCRIPTION.rst | 2 + stock_request_purchase/readme/ROADMAP.rst | 2 + stock_request_purchase/readme/USAGE.rst | 3 + .../tests/test_stock_request_purchase.py | 6 +- 10 files changed, 23 insertions(+), 77 deletions(-) delete mode 100644 stock_request_purchase/README.rst rename stock_request_purchase/models/{procurement_rule.py => stock_rule.py} (79%) create mode 100644 stock_request_purchase/readme/CONTRIBUTORS.rst create mode 100644 stock_request_purchase/readme/DESCRIPTION.rst create mode 100644 stock_request_purchase/readme/ROADMAP.rst create mode 100644 stock_request_purchase/readme/USAGE.rst diff --git a/stock_request_purchase/README.rst b/stock_request_purchase/README.rst deleted file mode 100644 index a5552942e..000000000 --- a/stock_request_purchase/README.rst +++ /dev/null @@ -1,64 +0,0 @@ -.. image:: https://img.shields.io/badge/licence-LGPL--3-blue.svg - :target: https://www.gnu.org/licenses/lgpl-3.0-standalone.html - :alt: License: LGPL-3 - -====================== -Stock Request Purchase -====================== - -This module allows for users to be able to display purchase orders that have -been created as a consequence of Stock Requests. - - -Usage -===== - -In case that the confirmation of the Stock Request results in an immediate -Purchase Order, the user will be able to display the PO's from the Stock -Request form view. - - -.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas - :alt: Try me on Runbot - :target: https://runbot.odoo-community.org/runbot/153/11.0 - - -Known issues / Roadmap -====================== - -* When a Stock Request is cancelled, it does not cancel the quantity included - in the Purchase Order. - - -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 smash it by providing detailed and welcomed feedback. - - -Credits -======= - -Contributors ------------- - -* Jordi Ballester . -* Enric Tobella - -Maintainer ----------- - -.. image:: https://odoo-community.org/logo.png - :alt: Odoo Community Association - :target: https://odoo-community.org - -This module is maintained by the OCA. - -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. - -To contribute to this module, please visit https://odoo-community.org. diff --git a/stock_request_purchase/__manifest__.py b/stock_request_purchase/__manifest__.py index 97f317d8a..d5e35fff4 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": "11.0.2.0.1", + "version": "12.0.1.0.0", "license": "LGPL-3", "website": "https://github.com/stock-logistics-warehouse", "author": "Eficent, " diff --git a/stock_request_purchase/models/__init__.py b/stock_request_purchase/models/__init__.py index b516de047..c7cdbaa77 100644 --- a/stock_request_purchase/models/__init__.py +++ b/stock_request_purchase/models/__init__.py @@ -1,6 +1,6 @@ from . import purchase_order from . import purchase_order_line -from . import procurement_rule +from . import stock_rule from . import stock_request from . import stock_request_order diff --git a/stock_request_purchase/models/purchase_order_line.py b/stock_request_purchase/models/purchase_order_line.py index d5ab0dca9..6c4193465 100644 --- a/stock_request_purchase/models/purchase_order_line.py +++ b/stock_request_purchase/models/purchase_order_line.py @@ -27,7 +27,7 @@ class PurchaseOrderLine(models.Model): def _check_purchase_company_constrains(self): if any(any(req.company_id != pol.company_id for req in pol.stock_request_ids) for pol in self): - raise ValidationError( - _('You cannot link a purchase order line ' - 'to a stock request that belongs to ' - 'another company.')) + raise ValidationError( + _('You cannot link a purchase order line ' + 'to a stock request that belongs to ' + 'another company.')) diff --git a/stock_request_purchase/models/procurement_rule.py b/stock_request_purchase/models/stock_rule.py similarity index 79% rename from stock_request_purchase/models/procurement_rule.py rename to stock_request_purchase/models/stock_rule.py index 6e85f28eb..182428fd8 100644 --- a/stock_request_purchase/models/procurement_rule.py +++ b/stock_request_purchase/models/stock_rule.py @@ -4,12 +4,12 @@ from odoo import models -class ProcurementRule(models.Model): - _inherit = 'procurement.rule' +class StockRule(models.Model): + _inherit = 'stock.rule' def _prepare_purchase_order_line(self, product_id, product_qty, product_uom, values, po, supplier): - vals = super(ProcurementRule, self)._prepare_purchase_order_line( + vals = super(StockRule, self)._prepare_purchase_order_line( product_id, product_qty, product_uom, values, po, supplier) if 'stock_request_id' in values: vals['stock_request_ids'] = [(4, values['stock_request_id'])] @@ -17,7 +17,7 @@ class ProcurementRule(models.Model): def _update_purchase_order_line(self, product_id, product_qty, product_uom, values, line, partner): - vals = super(ProcurementRule, self)._update_purchase_order_line( + vals = super(StockRule, self)._update_purchase_order_line( product_id, product_qty, product_uom, values, line, partner) if 'stock_request_id' in values: vals['stock_request_ids'] = [(4, values['stock_request_id'])] diff --git a/stock_request_purchase/readme/CONTRIBUTORS.rst b/stock_request_purchase/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..f8eb686a2 --- /dev/null +++ b/stock_request_purchase/readme/CONTRIBUTORS.rst @@ -0,0 +1,3 @@ +* Jordi Ballester . +* Enric Tobella +* Kitti Upariphutthiphong diff --git a/stock_request_purchase/readme/DESCRIPTION.rst b/stock_request_purchase/readme/DESCRIPTION.rst new file mode 100644 index 000000000..19deddba1 --- /dev/null +++ b/stock_request_purchase/readme/DESCRIPTION.rst @@ -0,0 +1,2 @@ +This module allows for users to be able to display purchase orders that have +been created as a consequence of Stock Requests. diff --git a/stock_request_purchase/readme/ROADMAP.rst b/stock_request_purchase/readme/ROADMAP.rst new file mode 100644 index 000000000..24b3106df --- /dev/null +++ b/stock_request_purchase/readme/ROADMAP.rst @@ -0,0 +1,2 @@ +* When a Stock Request is cancelled, it does not cancel the quantity included + in the Purchase Order. diff --git a/stock_request_purchase/readme/USAGE.rst b/stock_request_purchase/readme/USAGE.rst new file mode 100644 index 000000000..290342f5f --- /dev/null +++ b/stock_request_purchase/readme/USAGE.rst @@ -0,0 +1,3 @@ +In case that the confirmation of the Stock Request results in an immediate +Purchase Order, the user will be able to display the PO's from the Stock +Request form view. diff --git a/stock_request_purchase/tests/test_stock_request_purchase.py b/stock_request_purchase/tests/test_stock_request_purchase.py index 809fd0b9d..e79bffbe1 100644 --- a/stock_request_purchase/tests/test_stock_request_purchase.py +++ b/stock_request_purchase/tests/test_stock_request_purchase.py @@ -19,7 +19,7 @@ class TestStockRequestPurchase(common.TransactionCase): self.env.ref('stock_request.group_stock_request_manager') self.main_company = self.env.ref('base.main_company') self.warehouse = self.env.ref('stock.warehouse0') - self.categ_unit = self.env.ref('product.product_uom_categ_unit') + self.categ_unit = self.env.ref('uom.product_uom_categ_unit') # common data self.company_2 = self.env['res.company'].create({ @@ -42,7 +42,7 @@ class TestStockRequestPurchase(common.TransactionCase): }) self.product = self._create_product('SH', 'Shoes', False) - self.uom_dozen = self.env['product.uom'].create({ + self.uom_dozen = self.env['uom.uom'].create({ 'name': 'Test-DozenA', 'category_id': self.categ_unit.id, 'factor_inv': 12, @@ -64,7 +64,7 @@ class TestStockRequestPurchase(common.TransactionCase): return self.env['product.product'].create({ 'name': name, 'default_code': default_code, - 'uom_id': self.env.ref('product.product_uom_unit').id, + 'uom_id': self.env.ref('uom.product_uom_unit').id, 'company_id': company_id, 'type': 'product', 'route_ids': [(6, 0, self.route_buy.ids)],