-
Notifications
You must be signed in to change notification settings - Fork 319
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #508 from Chandresh-SerpentCS/14.0_mig_sale_restrict
[14.0] [MIG] sale_restrict: Module migrated in v14. (Ready to test)
- Loading branch information
Showing
17 changed files
with
221 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,17 @@ | ||
OpenERP, Open Source Management Solution | ||
Copyright (C) 2004-2010 OpenERP SA (<http://www.openerp.com>) | ||
Copyright (C) 2011-Today Serpent Consulting Services Pvt. Ltd. (<http://www.serpentcs.com>). | ||
|
||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Affero General Public License as | ||
published by the Free Software Foundation, either version 3 of the | ||
License, or (at your option) any later version. | ||
|
||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Affero General Public License for more details. | ||
|
||
You should have received a copy of the GNU Affero General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
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,38 @@ | ||
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg | ||
:target: https://www.gnu.org/licenses/agpl | ||
:alt: License: AGPL-3 | ||
|
||
============= | ||
Sale Restrict | ||
============= | ||
|
||
* This module restricts a user from confirming a Sale Order/Quotation | ||
if it contains products having sale price zero. | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Credits | ||
======= | ||
|
||
Contributors | ||
------------ | ||
|
||
* Jay Vora <[email protected]> | ||
* Meet Dholakia <[email protected]> | ||
* Sudhir Arya <[email protected]>. | ||
|
||
Maintainer | ||
---------- | ||
|
||
.. image:: http://odoo-community.org/logo.png | ||
:alt: Odoo Community Association | ||
:target: http://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 http://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 @@ | ||
# See LICENSE file for full copyright and licensing details. | ||
|
||
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,19 @@ | ||
# See LICENSE file for full copyright and licensing details. | ||
|
||
{ | ||
'name': 'SO - Product Price Check', | ||
'version': '14.0.1.0.0', | ||
'category': 'Sales Management', | ||
'author': 'Serpent Consulting Services Pvt. Ltd.', | ||
'summary': 'Restrict sales on 0 value.', | ||
'license': 'AGPL-3', | ||
'maintainer': 'Serpent Consulting Services Pvt. Ltd.', | ||
'website': 'http://www.serpentcs.com', | ||
'depends': [ | ||
'sale_management', | ||
], | ||
'images': [ | ||
'static/description/PriceCheck.png', | ||
], | ||
'installable': True, | ||
} |
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,24 @@ | ||
# French translation for openobject-addons | ||
# Copyright (c) 2014 Rosetta Contributors and Canonical Ltd 2014 | ||
# This file is distributed under the same license as the openobject-addons package. | ||
# FIRST AUTHOR <EMAIL@ADDRESS>, 2014. | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: openobject-addons\n" | ||
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n" | ||
"POT-Creation-Date: 2014-08-14 13:08+0000\n" | ||
"PO-Revision-Date: 2014-08-21 16:10+0000\n" | ||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" | ||
"Language-Team: French <[email protected]>\n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: 8bit\n" | ||
"X-Launchpad-Export-Date: 2014-08-15 06:57+0000\n" | ||
"X-Generator: Launchpad (build 17156)\n" | ||
|
||
#. module: sale_restrict | ||
#: code:addons/sale_restrict/sale_order.py:15 | ||
#, python-format | ||
msgid "Please specify unit price for the following products:" | ||
msgstr "S'il vous plaît indiquer le prix unitaire pour les produits suivants" |
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,22 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * sale_restrict | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 12.0rc1\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2014-08-14 13:08+0000\n" | ||
"PO-Revision-Date: 2014-08-21 13:08+0000\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_restrict | ||
#: code:addons/sale_restrict/sale_order.py:15 | ||
#, python-format | ||
msgid "Please specify unit price for the following products:" | ||
msgstr "S'il vous plaît indiquer le prix unitaire pour les produits suivants" |
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 @@ | ||
# See LICENSE file for full copyright and licensing details. | ||
|
||
from . import sale_order |
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,19 @@ | ||
# See LICENSE file for full copyright and licensing details. | ||
|
||
from odoo import _, models | ||
from odoo.exceptions import UserError | ||
|
||
|
||
class SaleOrder(models.Model): | ||
_inherit = 'sale.order' | ||
|
||
def action_confirm(self): | ||
zero_price = [x.product_id.name | ||
for x in self.order_line if not x.price_unit > 0.0] | ||
|
||
if zero_price: | ||
message = _("Please specify unit price for " | ||
"the following products:") + '\n' | ||
message += '\n'.join(map(str, zero_price)) | ||
raise UserError(message.rstrip()) | ||
return super(SaleOrder, self).action_confirm() |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
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,50 @@ | ||
|
||
<section class="oe_container oe_dark"> | ||
<div class='oe_cover'> | ||
<a href="http://www.serpentcs.com" target="new" ><img src="serpent_logo.png" align="right"></a> | ||
</div> | ||
</section> | ||
|
||
<section class="oe_container "> | ||
<div class="oe_row"> | ||
<div class="oe_row"> | ||
<h2 class="oe_slogan" style="color:#875A7B;">SO- Product price check</h2> | ||
<h3 class="oe_slogan"> | ||
This module restricts a user from confirming a Sale</h3> | ||
<h3 class="oe_slogan">Order/Quotation if it contains products having sale price zero.</h3> | ||
</div> | ||
</div> | ||
</section> | ||
|
||
<section class='oe_container oe_dark'> | ||
<div class='oe_row oe_spaced'> | ||
<div class="oe_span6"> | ||
<div class="oe_demo oe_picture oe_screenshot"> | ||
<img src="sale1.png"> | ||
</div> | ||
</div> | ||
<div style="margin: 16px 8%;"> | ||
<p class='oe_mt32'> | ||
If you select products having sale price zero, | ||
then upon confirming the sale, | ||
</p> | ||
</div> | ||
|
||
</div> | ||
</section> | ||
|
||
<section class='oe_container'> | ||
<div class='oe_row oe_spaced'> | ||
<div class="oe_span6"> | ||
<p class='oe_mt32'> | ||
It will raise a warning to the user insisting him/her to | ||
specify the unit price for the listed products. | ||
</p> | ||
</div> | ||
<div class="oe_span6"> | ||
<div class="oe_demo oe_picture oe_screenshot"> | ||
<img src="sale2.png"> | ||
</div> | ||
</div> | ||
</div> | ||
</section> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
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 @@ | ||
# See LICENSE file for full copyright and licensing details. | ||
|
||
from . import test_sale_restrict |
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,23 @@ | ||
# See LICENSE file for full copyright and licensing details. | ||
|
||
from odoo.tests import common | ||
|
||
|
||
class SaleOrder(common.TransactionCase): | ||
|
||
def setup(self): | ||
super(SaleOrder, self).setup() | ||
|
||
def test_sale_action(self): | ||
self.partner = self.ref('base.res_partner_2') | ||
self.product_1 = self.env.ref('product.product_product_12') | ||
self.sale_order = self.env['sale.order'].create( | ||
{'partner_id': self.partner, | ||
'order_line': [(0, 0, {'name': self.product_1.name, | ||
'product_id': self.product_1.id, | ||
'product_uom_qty': 2, | ||
'product_uom': self.product_1.uom_id.id, | ||
'price_unit': self.product_1.list_price} | ||
)], | ||
}) | ||
self.sale_order.action_confirm() |