Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by legalsylvain
- Loading branch information
Showing
9 changed files
with
147 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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
20
sale_disable_inventory_check/i18n/sale_disable_inventory_check.pot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 "" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from . import sale_order_line |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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
32
sale_disable_inventory_check/tests/test_disable_inventory_check.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() |