Skip to content

Commit

Permalink
Merge PR #861 into 12.0
Browse files Browse the repository at this point in the history
Signed-off-by legalsylvain
  • Loading branch information
OCA-git-bot committed Sep 17, 2019
2 parents 644fd41 + 931d11e commit 7d3fdd7
Show file tree
Hide file tree
Showing 9 changed files with 147 additions and 0 deletions.
52 changes: 52 additions & 0 deletions sale_disable_inventory_check/README.rst
@@ -0,0 +1,52 @@
.. image:: https://img.shields.io/badge/license-AGPL--3-blue.png
:target: https://www.gnu.org/licenses/agpl
:alt: License: AGPL-3

============================
Sale Disable Inventory Check
============================

This module disable warning "Not enough inventory" when there isn't enough
product in stock

Bug Tracker
===========

Bugs are tracked on `GitHub Issues
<https://github.com/OCA/sale-workflow/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
=======

Images
------

* Odoo Community Association: `Icon <https://odoo-community.org/logo.png>`_.

Contributors
------------

* Nguyen Tan Phuc <phuc.nt@komit.consulting.com>

* `Guadaltech <https://www.guadaltech.es>`__:

* Ramón Bajona

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

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.
3 changes: 3 additions & 0 deletions sale_disable_inventory_check/__init__.py
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from . import models
18 changes: 18 additions & 0 deletions sale_disable_inventory_check/__manifest__.py
@@ -0,0 +1,18 @@
# Copyright 2017 Komit <http://komit-consulting.com>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Sale Disable Inventory Check",
"summary": "Disable warning 'Not enough inventory' when there isn't enough"
" product stock",
"version": "12.0.1.0.0",
"category": "Sale",
"website": "https://github.com/OCA/sale-workflow",
"author": "Nguyen Tan Phuc (komit-consulting.com), "
"Odoo Community Association (OCA)",
"license": "AGPL-3",
"application": False,
"installable": True,
"depends": [
"sale_stock",
],
}
20 changes: 20 additions & 0 deletions sale_disable_inventory_check/i18n/sale_disable_inventory_check.pot
@@ -0,0 +1,20 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * sale_disable_inventory_check
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: sale_disable_inventory_check
#: model:ir.model,name:sale_disable_inventory_check.model_sale_order_line
msgid "Sales Order Line"
msgstr ""

3 changes: 3 additions & 0 deletions sale_disable_inventory_check/models/__init__.py
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from . import sale_order_line
16 changes: 16 additions & 0 deletions sale_disable_inventory_check/models/sale_order_line.py
@@ -0,0 +1,16 @@
# Copyright Komit <http://komit-consulting.com>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import api, models
from odoo.tools import config


class SaleOrderLine(models.Model):
_inherit = "sale.order.line"

@api.onchange('product_uom_qty', 'product_uom', 'route_id')
def _onchange_product_id_check_availability(self):
if (config['test_enable'] and
not self.env.context.get('test_sale_disable_inventory_check')):
return super()._onchange_product_id_check_availability()
return {}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions sale_disable_inventory_check/tests/__init__.py
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from . import test_disable_inventory_check
32 changes: 32 additions & 0 deletions sale_disable_inventory_check/tests/test_disable_inventory_check.py
@@ -0,0 +1,32 @@
# Copyright 2017 Komit <http://komit-consulting.com>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
import odoo.tests.common as common


class TestDisableInventoryCheck(common.TransactionCase):

def setUp(self):
super(TestDisableInventoryCheck, self).setUp()

# Create stockable product
self.product_1 = self.env['product.product'].create({
'name': 'Product 1',
'type': 'product',
'uom_id': self.ref('uom.product_uom_unit'),
})

def test_disable_inventory_check(self):
# Create an empty sale order
order = self.env['sale.order'].new({
'partner_id': 1,
'warehouse_id': 1,
'state': 'draft',
})
# Sale product_1 with quantity is 15
order_line = self.env['sale.order.line'].new({
'order_id': order.id,
'product_id': self.product_1.id,
'product_uom': self.product_1.uom_id.id,
'product_uom_qty': 15,
})
order_line._onchange_product_id_check_availability()

0 comments on commit 7d3fdd7

Please sign in to comment.