Browse Source

[PEP8] pep8 code style refactoring

pull/1/head
houssine 6 years ago
parent
commit
abc577ff3f
  1. 4
      easy_my_coop/__openerp__.py
  2. 1
      easy_my_coop/models/__init__.py
  3. 23
      easy_my_coop/models/account_invoice.py
  4. 12
      easy_my_coop/models/belgian_identification_id_generator.py
  5. 15
      easy_my_coop/wizard/cooperative_history_wizard.xml
  6. 2
      easy_my_coop_ch/__openerp__.py
  7. 2
      easy_my_coop_document/__init__.py
  8. 2
      easy_my_coop_fr/__openerp__.py
  9. 6
      easy_my_coop_fr/models/coop.py
  10. 2
      easy_my_coop_recompute_coop_number/__init__.py
  11. 3
      easy_my_coop_recompute_coop_number/__openerp__.py
  12. 2
      easy_my_coop_recompute_coop_number/wizard/__init__.py
  13. 1
      easy_my_coop_recompute_coop_number/wizard/cooperator_number_wizard.xml
  14. 3
      easy_my_coop_taxshelter_report/__openerp__.py
  15. 2
      easy_my_coop_website_document/__init__.py
  16. 2
      easy_my_coop_website_document/controllers/main.py
  17. 2
      easy_my_coop_website_portal/__init__.py
  18. 2
      easy_my_coop_website_taxshelter/__init__.py
  19. 2
      partner_age/__openerp__.py

4
easy_my_coop/__openerp__.py

@ -40,7 +40,8 @@
"website": "www.coopiteasy.be",
"license": "AGPL-3",
"description": """
This module allows to manage the cooperator subscription and all the cooperative business processes.
This module allows to manage the cooperator subscription and all the
cooperative business processes.
""",
'data': [
'security/easy_my_coop_security.xml',
@ -64,7 +65,6 @@
'report/cooperator_subscription_G001.xml',
'report/cooperator_register_G001.xml',
'data/mail_template_data.xml',
#'wizard/cooperative_history_wizard.xml',
],
'installable': True,
'application': True,

1
easy_my_coop/models/__init__.py

@ -6,4 +6,3 @@ from . import account_invoice
from . import company
from . import res_partner_bank
from . import account_journal
#import mail_mail

23
easy_my_coop/models/account_invoice.py

@ -1,17 +1,23 @@
# -*- coding: utf-8 -*-
from datetime import datetime
from openerp import api, fields, models, _
from openerp import api, fields, models
class account_invoice(models.Model):
_inherit = 'account.invoice'
subscription_request = fields.Many2one('subscription.request', string='Subscription request')
release_capital_request = fields.Boolean(string='Release of capital request')
subscription_request = fields.Many2one('subscription.request',
string='Subscription request')
release_capital_request = fields.Boolean(
string='Release of capital request')
@api.model
def _prepare_refund(self, invoice, date_invoice=None, date=None, description=None, journal_id=None):
values = super(account_invoice, self)._prepare_refund(invoice, date_invoice, date, description, journal_id)
def _prepare_refund(self, invoice, date_invoice=None, date=None,
description=None, journal_id=None):
values = super(account_invoice, self)._prepare_refund(
invoice, date_invoice, date,
description, journal_id)
values['release_capital_request'] = self.release_capital_request
return values
@ -23,12 +29,12 @@ class account_invoice(models.Model):
mail_template_name = 'Payment Received Confirmation - Send By Email'
# if not yet cooperator we generate a cooperator number
if self.partner_id.member == False and self.partner_id.old_member == False:
if self.partner_id.member is False and self.partner_id.old_member is False:
sequence_id = obj_sequence.search([('name', '=', 'Subscription Register')])[0]
sub_reg_num = sequence_id.next_by_id()
self.partner_id.write({'member': True, 'old_member': False,
'cooperator_register_number': int(sub_reg_num)})
elif self.partner_id.old_member == True:
elif self.partner_id.old_member:
self.partner_id.write({'member': True, 'old_member': False})
else:
mail_template_name = 'Share Increase - Payment Received Confirmation - Send By Email'
@ -74,7 +80,8 @@ class account_invoice(models.Model):
if invoice.partner_id.cooperator and invoice.release_capital_request \
and invoice.type == 'out_invoice' and not refund:
#take the effective date from the payment. by default the confirmation date is the payment date
# take the effective date from the payment.
# by default the confirmation date is the payment date
effective_date = datetime.now().strftime("%d/%m/%Y")
if invoice.payment_move_line_ids:

12
easy_my_coop/models/belgian_identification_id_generator.py

@ -1,10 +1,12 @@
from random import randrange, randint
from datetime import date, timedelta
def random_date(start, end):
delta = end - start
return start + timedelta(seconds=randrange(delta.total_seconds()))
def generate_identification_id(start_date, end_date):
birthday = random_date(start_date, end_date)
year = str(birthday.year)[2:]
@ -20,12 +22,14 @@ def generate_identification_id(start_date, end_date):
return main_number + control_number
def identification_id_to_gender(identification_id):
if identification_id and len(identification_id) == 11:
gender = identification_id[6:9]
return int(gender) % 2
identification_id = generate_identification_id(date(1920,1,1), date(1995,12,31))
gender = identification_id_to_gender(identification_id)
print 'Rijksregisternummer: ' + identification_id
print 'Geslacht: ' + ('Man' if gender else 'Vrouw')
INDENTITY_ID = generate_identification_id(date(1920, 1, 1), date(1995, 12, 31))
GENDER = identification_id_to_gender(INDENTITY_ID)
print 'Rijksregisternummer: ' + INDENTITY_ID
print 'Geslacht: ' + ('Man' if GENDER else 'Vrouw')

15
easy_my_coop/wizard/cooperative_history_wizard.xml

@ -1,7 +1,6 @@
<?xml version="1.0" ?>
<openerp>
<data>
<record id="view_cooperative_history_wizard" model="ir.ui.view">
<field name="name">cooperative.history.wizard.form</field>
<field name="model">cooperative.history.report</field>
@ -14,7 +13,6 @@
<label string="This report allows you to print a pdf of history and number of share for each cooperator"/>
<group>
<field name="display_cooperator"/>
<!--<field name="display_time"/>-->
</group>
<footer>
@ -37,20 +35,7 @@
<field name="multi">True</field>
</record>
<!--
<record model="ir.values" id="action_mission_history_wizard_values">
<field name="model_id" ref="fiducis.model_mission_mission"/>
<field name="object" eval="1"/>
<field name="name">Mission history</field>
<field name="key2">client_print_multi</field>
<field name="value"
eval="'ir.actions.act_window,' +str(ref('action_mission_history_wizard'))"/>
<field name="key">action</field>
<field name="model">mission.mission</field>
</record>
-->
<menuitem id="menu_energiris_reporting" name="Reporting" parent="menu_main_energiris" sequence="20"/>
<menuitem id="menu_coop_history_wizard_report" name="Cooperative history report" parent="menu_energiris_reporting" action="action_cooperative_history_wizard" sequence="10"/>
<!--<menuitem id="menu_optify_rep_history" name="Mission hours history" action="action_mission_history_wizard" parent="menu_optify_reporting" sequence="2"/>-->
</data>
</openerp>

2
easy_my_coop_ch/__openerp__.py

@ -23,7 +23,7 @@
"version": "1.0",
"depends": ["easy_my_coop",
"l10n_ch",
"theme_light",],
"theme_light"],
"author": "Houssine BAKKALI <houssine@coopiteasy.be>",
"category": "Cooperative management",
'webstite': "www.coopiteasy.be",

2
easy_my_coop_document/__init__.py

@ -1,2 +1,2 @@
# -*- coding: utf8 -*-
import models
from . import models

2
easy_my_coop_fr/__openerp__.py

@ -23,7 +23,7 @@
"version": "1.0",
"depends": ["easy_my_coop",
"l10n_fr",
"theme_light",],
"theme_light"],
"author": "Houssine BAKKALI <houssine@coopiteasy.be>",
"category": "Cooperative management",
'webstite': "www.coopiteasy.be",

6
easy_my_coop_fr/models/coop.py

@ -1,12 +1,13 @@
# -*- coding: utf-8 -*-
from openerp import api, fields, models, _
from openerp import fields, models
class subscription_request(models.Model):
_inherit = 'subscription.request'
company_type = fields.Selection([('asso','Association'),
company_type = fields.Selection([
('asso', 'Association'),
('eurl', 'EURL / Entreprise individuelle'),
('sarl', 'SARL'),
('sa', 'SA / SAS')])
@ -18,6 +19,7 @@ class subscription_request(models.Model):
return required_fields
# override function to disable the check
def check_belgian_identification_id(self, nat_register_num):
# deactivate number validation for french localization
return True

2
easy_my_coop_recompute_coop_number/__init__.py

@ -1 +1 @@
import wizard
from . import wizard

3
easy_my_coop_recompute_coop_number/__openerp__.py

@ -26,7 +26,8 @@
"category": "Cooperative management",
'website': "www.coopiteasy.be",
"description": """
This module allows to recompute the cooperator number subscription it has to be used carefully.
This module allows to recompute the cooperator number subscription
it has to be used carefully.
""",
'data': [
'wizard/cooperator_number_wizard.xml',

2
easy_my_coop_recompute_coop_number/wizard/__init__.py

@ -1,2 +1,2 @@
# -*- coding: utf-8 -*-
import cooperator_number_wizard
from . import cooperator_number_wizard

1
easy_my_coop_recompute_coop_number/wizard/cooperator_number_wizard.xml

@ -1,6 +1,5 @@
<openerp>
<data>
<record id="view_register_number_wizard" model="ir.ui.view">
<field name="name">Register number wizard</field>
<field name="model">register.number.wizard</field>

3
easy_my_coop_taxshelter_report/__openerp__.py

@ -27,7 +27,8 @@
'website': "www.coopiteasy.be",
"license": "AGPL-3",
"description": """
This module allows to create a fiscal declaration year and to print tax shelter declaration each cooperator
This module allows to create a fiscal declaration year and to print
tax shelter declaration each cooperator
""",
'data': [
'security/ir.model.access.csv',

2
easy_my_coop_website_document/__init__.py

@ -1,2 +1,2 @@
# -*- coding: utf8 -*-
import controllers
from . import controllers

2
easy_my_coop_website_document/controllers/main.py

@ -33,7 +33,7 @@ class DocumentWebsite(http.Controller):
elif status == 301:
# TODO: test this case not sure if this render the same
# return werkzeug.utils.redirect(content, code=301)
return request.redirec(content, code=301)
return request.redirect(content, code=301)
elif status != 200:
return request.not_found()
content_base64 = base64.b64decode(content)

2
easy_my_coop_website_portal/__init__.py

@ -1,2 +1,2 @@
# -*- coding: utf8 -*-
import controllers
from . import controllers

2
easy_my_coop_website_taxshelter/__init__.py

@ -1,2 +1,2 @@
# -*- coding: utf8 -*-
import controllers
from . import controllers

2
partner_age/__openerp__.py

@ -28,7 +28,7 @@
"category": "Cooperative management",
'website': "www.coopiteasy.be",
"description": """
This module allows to recompute the cooperator number subscription it has to be used carefully.
This module computes the age of the partner.
""",
'data': [
'view/partner_view.xml',

Loading…
Cancel
Save