[12.0][MIG] stock_request_purchase

This commit is contained in:
Kitti U
2019-06-26 17:39:08 +07:00
committed by Joan Sisquella
parent 6df1b3af8e
commit c257e6111f
10 changed files with 23 additions and 77 deletions

View File

@@ -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
<https://github.com/OCA/stock-logistics-warehouse/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 <jordi.ballester@eficent.com>.
* Enric Tobella <etobella@creublanca.es>
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.

View File

@@ -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, "

View File

@@ -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

View File

@@ -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.'))

View File

@@ -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'])]

View File

@@ -0,0 +1,3 @@
* Jordi Ballester <jordi.ballester@eficent.com>.
* Enric Tobella <etobella@creublanca.es>
* Kitti Upariphutthiphong <kittiu@ecosoft.co.th>

View File

@@ -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.

View File

@@ -0,0 +1,2 @@
* When a Stock Request is cancelled, it does not cancel the quantity included
in the Purchase Order.

View File

@@ -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.

View File

@@ -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)],