Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[14.0] [MIG] sale_restrict: Module migrated in v14. (Ready to test) #508

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
cbbff3e
Added Sale_restrict module
JayVora-SerpentCS Aug 21, 2015
39555d0
updatd Sale_restrict module
JayVora-SerpentCS Aug 21, 2015
26db980
Improved html page for sale_restrict
JayVora-SerpentCS Aug 25, 2015
83e9950
[ADD]sale_restrict: added sale restrict module.
hpatelserpentcs Dec 22, 2015
44cc418
[REF]
JayVora-SerpentCS Dec 16, 2016
25b254f
PEP8 fixes
JayVora-SerpentCS Dec 28, 2016
ab8fe66
[IMP/ADD]Fixed Travis.
hpatelserpentcs May 6, 2017
a20cc06
[IMP/ADD]Added Test Case.
hpatelserpentcs May 10, 2017
6720d34
[IMP/ADD]Added partner_credit_limit module.
hpatelserpentcs May 11, 2017
bfc2197
[FIX]Travis Fixed.
hpatelserpentcs May 11, 2017
977a58b
added banners
hda May 30, 2017
0c4348f
[ADD] Added Index file for base_module_record, sale_cancel_reason, sa…
shobhapadasalagi Jul 31, 2017
59bc291
[IMP/ADD]Improved City module Index file Images and Created README.rs…
shobhapadasalagi Aug 2, 2017
4d01347
fixed summary
hda Aug 3, 2017
5c8d5bc
[ADD] Migrated sale_restrict module in v11.
sudhir-serpentcs Oct 27, 2017
5205564
Update sale_order.py
JayVora-SerpentCS Oct 27, 2017
e20b2e8
Fixed license param
JayVora-SerpentCS Dec 30, 2017
96b4114
[IMP]made improvements, fix travis errors
Arpit-SerpentCS Jan 25, 2018
70d52b7
[IMP] add solve travis error
Arpit-SerpentCS Jan 25, 2018
6c27548
[IMP]removed encoding utf-8 from py files
Arpit-SerpentCS Jan 29, 2018
a1cacb0
[IMP]remove description key in manifest file and improvements in js file
Arpit-SerpentCS Jan 30, 2018
1168275
[IMP] improvements in manifest file
Arpit-SerpentCS Jan 30, 2018
2e1a3d5
[IMP]Improved License file year.
shobhapadasalagi Feb 20, 2018
b06b316
[12.0][MIG] Migrated sale_restrict module
Chanakya-SerpentCS Nov 16, 2018
3d436ff
[MIG] sale_restrict module mmigrated in v13.
Chandresh-SerpentCS Oct 4, 2019
ce837d7
[MIG] Module migrated in v14.
Chandresh-SerpentCS Oct 19, 2020
c8d629c
Merge branch '14.0' of github.com:JayVora-SerpentCS/SerpentCS_Contrib…
Chandresh-OSI Jul 19, 2021
9c586e4
[FIX] Changed the index file.
darshita20 Jul 20, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions sale_restrict/LICENSE/LICENSE
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/>.

38 changes: 38 additions & 0 deletions sale_restrict/README.rst
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.
3 changes: 3 additions & 0 deletions sale_restrict/__init__.py
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
19 changes: 19 additions & 0 deletions sale_restrict/__manifest__.py
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,
}
24 changes: 24 additions & 0 deletions sale_restrict/i18n/fr.po
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"
22 changes: 22 additions & 0 deletions sale_restrict/i18n/sale_restrict.pot
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"
3 changes: 3 additions & 0 deletions sale_restrict/models/__init__.py
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
19 changes: 19 additions & 0 deletions sale_restrict/models/sale_order.py
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 added sale_restrict/static/description/.png
Binary file not shown.
Binary file added sale_restrict/static/description/PriceCheck.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added sale_restrict/static/description/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
50 changes: 50 additions & 0 deletions sale_restrict/static/description/index.html
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>
Binary file added sale_restrict/static/description/sale1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added sale_restrict/static/description/sale2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added sale_restrict/static/description/serpent_logo.png
Loading
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_restrict/tests/__init__.py
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
23 changes: 23 additions & 0 deletions sale_restrict/tests/test_sale_restrict.py
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()