Skip to content

Commit

Permalink
[FIX]:Licencias, pep8 & flake8
Browse files Browse the repository at this point in the history
  • Loading branch information
Joaquin Gutierrez committed Apr 10, 2015
1 parent 51ed128 commit ac4d010
Show file tree
Hide file tree
Showing 88 changed files with 392 additions and 1,224 deletions.
24 changes: 2 additions & 22 deletions odoo_ecommerce_boilerplate/__init__.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,3 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Trey, Kilobytes de Soluciones
# Copyright (C) 2014-Today Trey, Kilobytes de Soluciones
# (<http://www.trey.es>).
#
# 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/>.
#
##############################################################################

# import models
# License, author and contributors information in:
# __openerp__.py file at the root folder of this module.
21 changes: 2 additions & 19 deletions payment_direct_order/__init__.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Trey, Kilobytes de Soluciones
# Copyright (C) 2014-Today Trey, Kilobytes de Soluciones (<http://www.trey.es>).
#
# 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/>.
#
##############################################################################
# License, author and contributors information in:
# __openerp__.py file at the root folder of this module.

import models
import controllers
8 changes: 4 additions & 4 deletions payment_direct_order/__openerp__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# -*- coding: utf-8 -*-
##############################################################################
###############################################################################
#
# Trey, Kilobytes de Soluciones
# Copyright (C) 2014-Today Trey, Kilobytes de Soluciones (<http://www.trey.es>).
# Copyright (C) 2014-Today Trey, Kilobytes de Soluciones <www.trey.es>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
Expand All @@ -15,9 +15,9 @@
# 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/>.
# along with this program. If not, see <http://www.gnu.org/licenses/>
#
##############################################################################
###############################################################################

{
'name': 'Direct Order Payment Acquirer',
Expand Down
2 changes: 2 additions & 0 deletions payment_direct_order/controllers/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*-
# License, author and contributors information in:
# __openerp__.py file at the root folder of this module.

import main
9 changes: 7 additions & 2 deletions payment_direct_order/controllers/main.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# -*- coding: utf-8 -*-
# License, author and contributors information in:
# __openerp__.py file at the root folder of this module.

import logging
import pprint
import werkzeug
Expand All @@ -15,6 +18,8 @@ class OgoneController(http.Controller):
@http.route(['/payment/direct_order/feedback'], type='http', auth='none')
def transfer_form_feedback(self, **post):
cr, uid, context = request.cr, SUPERUSER_ID, request.context
_logger.info('Beginning form_feedback with post data %s', pprint.pformat(post)) # debug
request.registry['payment.transaction'].form_feedback(cr, uid, post, 'direct_order', context)
_logger.info(
'Beginning form_feedback with post data %s', pprint.pformat(post))
request.registry['payment.transaction'].form_feedback(
cr, uid, post, 'direct_order', context)
return werkzeug.utils.redirect(post.pop('return_url', '/'))
2 changes: 2 additions & 0 deletions payment_direct_order/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*-
# License, author and contributors information in:
# __openerp__.py file at the root folder of this module.

import payment_acquirer
41 changes: 30 additions & 11 deletions payment_direct_order/models/payment_acquirer.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# -*- coding: utf-'8' "-*-"
# -*- coding: utf-8 -*-
# License, author and contributors information in:
# __openerp__.py file at the root folder of this module.

from openerp.addons.payment.models.payment_acquirer import ValidationError
from openerp.osv import osv
Expand All @@ -15,7 +17,9 @@ class DirectPaymentAcquirer(osv.Model):
_inherit = 'payment.acquirer'

def _get_providers(self, cr, uid, context=None):
providers = super(DirectPaymentAcquirer, self)._get_providers(cr, uid, context=context)
providers = super(DirectPaymentAcquirer, self)._get_providers(
cr, uid, context=context
)
providers.append(['direct_order', 'Direct payment'])
return providers

Expand All @@ -34,19 +38,27 @@ def create(self, cr, uid, values, context=None):
to have access to the name and other creation values. If no post_msg
or a void post_msg is given at creation, generate a default one. """
if values.get('name') == 'direct_order' and not values.get('post_msg'):
values['post_msg'] = self._format_direct_order_data(cr, uid, context=context)
return super(DirectPaymentAcquirer, self).create(cr, uid, values, context=context)
values['post_msg'] = self._format_direct_order_data(
cr, uid, context=context
)
return super(DirectPaymentAcquirer, self).create(
cr, uid, values, context=context
)


class DirectPaymentTransaction(osv.Model):
_inherit = 'payment.transaction'

def _direct_order_form_get_tx_from_data(self, cr, uid, data, context=None):
reference, amount, currency_name = data.get('reference'), data.get('amount'), data.get('currency_name')
tx_ids = self.search(cr, uid, [('reference', '=', reference)], context=context)
reference, amount, currency_name = data.get('reference'), data.get(
'amount'), data.get('currency_name')
tx_ids = self.search(cr, uid, [('reference', '=', reference)],
context=context)

if not tx_ids or len(tx_ids) > 1:
error_msg = 'received data for reference %s' % (pprint.pformat(reference))
error_msg = 'received data for reference %s' % (
pprint.pformat(reference)
)
if not tx_ids:
error_msg += '; no order found'
else:
Expand All @@ -56,16 +68,23 @@ def _direct_order_form_get_tx_from_data(self, cr, uid, data, context=None):

return self.browse(cr, uid, tx_ids[0], context=context)

def _direct_order_form_get_invalid_parameters(self, cr, uid, tx, data, context=None):
def _direct_order_form_get_invalid_parameters(self, cr, uid, tx, data,
context=None):
invalid_parameters = []

if float_compare(float(data.get('amount', '0.0')), tx.amount, 2) != 0:
invalid_parameters.append(('amount', data.get('amount'), '%.2f' % tx.amount))
invalid_parameters.append(
('amount', data.get('amount'), '%.2f' % tx.amount)
)
if data.get('currency') != tx.currency_id.name:
invalid_parameters.append(('currency', data.get('currency'), tx.currency_id.name))
invalid_parameters.append(
('currency', data.get('currency'), tx.currency_id.name)
)

return invalid_parameters

def _direct_order_form_validate(self, cr, uid, tx, data, context=None):
_logger.info('Validated direct order payment for tx %s: set as pending' % (tx.reference))
_logger.info(
'Validated direct order payment for tx %s: set as pending' % (
tx.reference))
return tx.write({'state': 'pending'})
17 changes: 2 additions & 15 deletions website_blog_url_friendly/__init__.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,5 @@
# -*- coding: utf-8 -*-

# Copyright (C) 2015 Benito Roríguez (http://b3ni.es) <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# License, author and contributors information in:
# __openerp__.py file at the root folder of this module.

import models
17 changes: 2 additions & 15 deletions website_blog_url_friendly/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,5 @@
# -*- coding: utf-8 -*-

# Copyright (C) 2015 Benito Roríguez (http://b3ni.es) <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# License, author and contributors information in:
# __openerp__.py file at the root folder of this module.

import ir_http
17 changes: 2 additions & 15 deletions website_blog_url_friendly/models/ir_http.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,6 @@
# -*- coding: utf-8 -*-

# Copyright (C) 2015 Benito Roríguez (http://b3ni.es) <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# License, author and contributors information in:
# __openerp__.py file at the root folder of this module.

from openerp.osv import orm

Expand Down
22 changes: 2 additions & 20 deletions website_cookies_policy/__init__.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,3 @@
# -*- coding: utf-8 -*-
###############################################################################
#
# Trey, Kilobytes de Soluciones
# Copyright (C) 2014-Today Trey, Kilobytes de Soluciones <www.trey.es>.
#
# 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/>.
#
###############################################################################

# License, author and contributors information in:
# __openerp__.py file at the root folder of this module.
11 changes: 6 additions & 5 deletions website_cookies_policy/__openerp__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# -*- coding: utf-8 -*-
##############################################################################
###############################################################################
#
# Trey, Kilobytes de Soluciones
# Copyright (C) 2014-Today Trey, Kilobytes de Soluciones (<http://www.trey.es>).
# Copyright (C) 2014-Today Trey, Kilobytes de Soluciones <www.trey.es>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
Expand All @@ -15,14 +15,15 @@
# 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/>.
# along with this program. If not, see <http://www.gnu.org/licenses/>
#
##############################################################################
###############################################################################

{
'name': 'Política de Cookies',
'category': 'website',
'summary': 'Añade una alerta sobre el uso de cookies en el sitio que se oculta al aceptarlo.',
'summary': 'Añade una alerta sobre el uso de cookies en el sitio que se '
'oculta al aceptarlo.',
'version': '0.1',
'description': """
""",
Expand Down
23 changes: 2 additions & 21 deletions website_crm_privacy_policy/__init__.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,3 @@
# -*- coding: utf-8 -*-
###############################################################################
#
# Trey, Kilobytes de Soluciones
# Copyright (C) 2014-Today Trey, Kilobytes de Soluciones <www.trey.es>.
#
# 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/>.
#
###############################################################################

# import models
# License, author and contributors information in:
# __openerp__.py file at the root folder of this module.
11 changes: 6 additions & 5 deletions website_crm_privacy_policy/__openerp__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# -*- coding: utf-8 -*-
##############################################################################
###############################################################################
#
# Trey, Kilobytes de Soluciones
# Copyright (C) 2014-Today Trey, Kilobytes de Soluciones (<http://www.trey.es>).
# Copyright (C) 2014-Today Trey, Kilobytes de Soluciones <www.trey.es>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
Expand All @@ -15,14 +15,15 @@
# 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/>.
# along with this program. If not, see <http://www.gnu.org/licenses/>
#
##############################################################################
###############################################################################

{
'name': 'Política de Privacidad',
'category': 'website',
'summary': 'Añade un checkbox al formulario de contacto para aceptar la política de privacidad.',
'summary': 'Añade un checkbox al formulario de contacto para aceptar la '
'política de privacidad.',
'version': '0.1',
'description': """
""",
Expand Down
21 changes: 2 additions & 19 deletions website_crm_privacy_policy/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,5 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Trey, Kilobytes de Soluciones
# Copyright (C) 2014-Today Trey, Kilobytes de Soluciones (<http://www.trey.es>).
#
# 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/>.
#
##############################################################################
# License, author and contributors information in:
# __openerp__.py file at the root folder of this module.

import main
Loading

0 comments on commit ac4d010

Please sign in to comment.