diff --git a/easy_my_coop/models/coop.py b/easy_my_coop/models/coop.py index 23bad29..b5fc87a 100644 --- a/easy_my_coop/models/coop.py +++ b/easy_my_coop/models/coop.py @@ -68,9 +68,7 @@ class SubscriptionRequest(models.Model): if not vals.get("partner_id"): cooperator = False if vals.get("email"): - cooperator = partner_obj.get_cooperator_from_email( - vals.get("email") - ) + cooperator = partner_obj.get_cooperator_from_email(vals.get("email")) if cooperator: # TODO remove the following line once it has # been found a way to avoid double encoding @@ -105,9 +103,7 @@ class SubscriptionRequest(models.Model): vals["already_cooperator"] = True subscr_request = super(SubscriptionRequest, self).create(vals) - confirmation_mail_template = subscr_request.get_mail_template_notif( - True - ) + confirmation_mail_template = subscr_request.get_mail_template_notif(True) confirmation_mail_template.send_mail(subscr_request.id) return subscr_request @@ -131,20 +127,15 @@ class SubscriptionRequest(models.Model): @api.depends("iban", "skip_control_ng") def _compute_validated_lines(self): for sub_request in self: - validated = sub_request.skip_control_ng or self.check_iban( - sub_request.iban - ) + validated = sub_request.skip_control_ng or self.check_iban(sub_request.iban) sub_request.validated = validated @api.multi - @api.depends( - "share_product_id", "share_product_id.list_price", "ordered_parts" - ) + @api.depends("share_product_id", "share_product_id.list_price", "ordered_parts") def _compute_subscription_amount(self): for sub_request in self: sub_request.subscription_amount = ( - sub_request.share_product_id.list_price - * sub_request.ordered_parts + sub_request.share_product_id.list_price * sub_request.ordered_parts ) already_cooperator = fields.Boolean( @@ -426,9 +417,7 @@ class SubscriptionRequest(models.Model): readonly=True, states={"draft": [("readonly", False)]}, ) - data_policy_approved = fields.Boolean( - string="Data Policy Approved", default=False - ) + data_policy_approved = fields.Boolean(string="Data Policy Approved", default=False) internal_rules_approved = fields.Boolean( string="Approved Internal Rules", default=False ) @@ -529,9 +518,7 @@ class SubscriptionRequest(models.Model): if accounts: account = accounts[0] else: - raise UserError( - _("You must set a cooperator account on you company.") - ) + raise UserError(_("You must set a cooperator account on you company.")) return account def get_invoice_vals(self, partner): @@ -699,16 +686,13 @@ class SubscriptionRequest(models.Model): if self.is_company and not partner.has_representative(): contact = False if self.email: - domain = [("email", "=", self.email), - ('company_type', '=', 'person')] + domain = [("email", "=", self.email), ("company_type", "=", "person")] contact = partner_obj.search(domain) if len(contact) < 2: contact.type = "representative" else: raise UserError( - _( - "You have duplicate contact with email %s" % self.email - ) + _("You have duplicate contact with email %s" % self.email) ) if not contact: contact_vals = self.get_representative_vals() @@ -722,7 +706,7 @@ class SubscriptionRequest(models.Model): " proceed to a merge before to continue" ) ) - if contact.parent_id and contact.parent_id.id != partner.id: + if contact.parent_id and contact.parent_id.id != partner.parent_id.id: raise UserError( _( "This contact person is already defined" @@ -731,9 +715,7 @@ class SubscriptionRequest(models.Model): ) ) else: - contact.write( - {"parent_id": partner.id, "representative": True} - ) + contact.write({"representative": True}) invoice = self.create_invoice(partner) self.write({"state": "done"}) @@ -843,9 +825,7 @@ class SubscriptionRegister(models.Model): partner_id_to = fields.Many2one( "res.partner", string="Transfered to", readonly=True ) - date = fields.Date( - string="Subscription Date", required=True, readonly=True - ) + date = fields.Date(string="Subscription Date", required=True, readonly=True) quantity = fields.Integer(string="Number of share", readonly=True) share_unit_price = fields.Monetary( string="Share price",