Browse Source

[PEP8] comply to pep8

pull/1/head
houssine 6 years ago
parent
commit
787361ed35
  1. 1
      easy_my_coop/__openerp__.py
  2. 12
      easy_my_coop/wizard/update_partner_info.py
  3. 17
      easy_my_coop/wizard/validate_subscription_request.py
  4. 39
      easy_my_coop/wizard/validate_subscription_request.xml

1
easy_my_coop/__openerp__.py

@ -48,6 +48,7 @@
'security/ir.model.access.csv',
'wizard/create_subscription_from_partner.xml',
'wizard/update_partner_info.xml',
'wizard/validate_subscription_request.xml',
'view/subscription_request_view.xml',
'view/email_template_view.xml',
'view/res_partner_view.xml',

12
easy_my_coop/wizard/update_partner_info.py

@ -3,6 +3,7 @@
from openerp import api, fields, models, _
from openerp.exceptions import UserError
class PartnerUpdateInfo(models.TransientModel):
_name = "partner.update.info"
_description = "Update Partner Info"
@ -20,11 +21,16 @@ class PartnerUpdateInfo(models.TransientModel):
else:
return partner.national_register_number
register_number = fields.Char(string="Register Number", required=True, default=_get_register_number)
cooperator = fields.Many2one('res.partner', string="Cooperator", default=_get_partner)
register_number = fields.Char(string="Register Number",
required=True,
default=_get_register_number)
cooperator = fields.Many2one('res.partner',
string="Cooperator",
default=_get_partner)
def check_belgian_ident_id(self, register_number):
if self.env['subscription.request'].check_belgian_identification_id(register_number):
if self.env['subscription.request'].check_belgian_identification_id(
register_number):
return True
else:
raise UserError(_("The national register number is not valid."))

17
easy_my_coop/wizard/validate_subscription_request.py

@ -0,0 +1,17 @@
# -*- coding: utf-8 -*-
from openerp import api, fields, models, _
from openerp.exceptions import UserError
class ValidateSubscriptionRequest(models.TransientModel):
_name = "validate.subscription.request"
_description = "Update Partner Info"
@api.multi
def validate(self):
subscription_requests = self.filtered(lambda record: record.state in ['draft', 'waiting'])
for subscription_request in subscription_requests:
subscription_request.validate_subscription_request
return True

39
easy_my_coop/wizard/validate_subscription_request.xml

@ -0,0 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_validate_subscription_request" model="ir.ui.view">
<field name="name">Validate subscription request</field>
<field name="model">validate.subscription.request</field>
<field name="arch" type="xml">
<form string="Validate the subscription request">
<p class="oe_grey">
Validate the subscription request.
</p>
<footer>
<button name="validate" string="Validate" type="object" class="btn-primary"/>
<button string="Cancel" class="btn-default" special="cancel"/>
</footer>
</form>
</field>
</record>
<record id="action_validate_subscription_request" model="ir.actions.act_window">
<field name="name">Update Cooperator Info</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">validate.subscription.request</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
<field name="groups_id" eval="[(4,ref('easy_my_coop.group_energiris_manager'))]"/>
</record>
<record model="ir.values" id="validate_subscription_request">
<field name="model_id" ref="resource.model_subscription_request" />
<field name="name">Subscription Request</field>
<field name="key2">client_action_multi</field>
<field name="value" eval="'ir.actions.act_window,' + str(ref('action_validate_subscription_request'))" />
<field name="key">action</field>
<field name="model">subscription.request</field>
</record>
</data>
</openerp>
Loading…
Cancel
Save