Browse Source
Merge branch '12.0-mig-obeesdoo_beesdoo_easy_my_coop' of github.com:beescoop/obeesdoo into 12.0-target
pull/161/head
Merge branch '12.0-mig-obeesdoo_beesdoo_easy_my_coop' of github.com:beescoop/obeesdoo into 12.0-target
pull/161/head
Manuel Claeys Bouuaert
4 years ago
17 changed files with 315 additions and 0 deletions
-
3beesdoo_easy_my_coop/__init__.py
-
34beesdoo_easy_my_coop/__manifest__.py
-
1beesdoo_easy_my_coop/controllers/__init__.py
-
19beesdoo_easy_my_coop/controllers/main.py
-
23beesdoo_easy_my_coop/data/product_share.xml
-
4beesdoo_easy_my_coop/models/__init__.py
-
8beesdoo_easy_my_coop/models/product.py
-
35beesdoo_easy_my_coop/models/res_company.py
-
28beesdoo_easy_my_coop/models/res_partner.py
-
26beesdoo_easy_my_coop/models/subscription_request.py
-
30beesdoo_easy_my_coop/views/partner.xml
-
13beesdoo_easy_my_coop/views/product.xml
-
20beesdoo_easy_my_coop/views/res_company.xml
-
18beesdoo_easy_my_coop/views/subscription_request.xml
-
28beesdoo_easy_my_coop/views/subscription_templates.xml
-
1beesdoo_easy_my_coop/wizards/__init__.py
-
24beesdoo_easy_my_coop/wizards/beesdoo_shift_subscribe.py
@ -0,0 +1,3 @@ |
|||
from . import models |
|||
from . import wizards |
|||
from . import controllers |
@ -0,0 +1,34 @@ |
|||
{ |
|||
'name': "Beescoop link with easy my coop", |
|||
|
|||
'summary': """ |
|||
Module that made the link between beesdoo customization |
|||
and easy_my_coop |
|||
""", |
|||
|
|||
'description': """ |
|||
""", |
|||
|
|||
'author': "Beescoop - Cellule IT", |
|||
'website': "https://github.com/beescoop/Obeesdoo", |
|||
|
|||
'category': 'Cooperative management', |
|||
'version': '12.0.1.0.0', |
|||
|
|||
'depends': ['beesdoo_base', |
|||
'beesdoo_shift', |
|||
'easy_my_coop', |
|||
'easy_my_coop_eater', |
|||
'easy_my_coop_website', |
|||
], |
|||
|
|||
'data': [ |
|||
'data/product_share.xml', |
|||
'views/partner.xml', |
|||
'views/res_company.xml', |
|||
'views/subscription_request.xml', |
|||
'views/subscription_templates.xml', |
|||
'views/product.xml' |
|||
], |
|||
'auto_install': True, |
|||
} |
@ -0,0 +1 @@ |
|||
from . import main |
@ -0,0 +1,19 @@ |
|||
from odoo import http |
|||
from odoo.http import request |
|||
|
|||
from odoo.addons.easy_my_coop_website.controllers.main import WebsiteSubscription as Base |
|||
|
|||
class WebsiteSubscription(Base): |
|||
|
|||
def fill_values(self, values, is_company, logged, load_from_user=False): |
|||
values = super(WebsiteSubscription, self).fill_values(values, |
|||
is_company, |
|||
logged, |
|||
load_from_user) |
|||
cmp = request.env['res.company']._company_default_get() |
|||
values.update({ |
|||
'display_info_session': cmp.display_info_session_confirmation, |
|||
'info_session_required': cmp.info_session_confirmation_required, |
|||
'info_session_text': cmp.info_session_confirmation_text, |
|||
}) |
|||
return values |
@ -0,0 +1,23 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<odoo> |
|||
<data noupdate="1"> |
|||
<record id="share_a" model="product.template" > |
|||
<field name="name">Acquisition de parts A de Beescoop scrl</field> |
|||
<field name="default_code">share_a</field> |
|||
<field name="customer" eval="True" /> |
|||
<field name="is_share" eval="True" /> |
|||
</record> |
|||
<record id="share_b" model="product.template" > |
|||
<field name="name">Acquisition de parts B de Beescoop scrl</field> |
|||
<field name="default_code">share_b</field> |
|||
<field name="customer" eval="True" /> |
|||
<field name="is_share" eval="True" /> |
|||
</record> |
|||
<record id="share_c" model="product.template" > |
|||
<field name="name">Acquisition de parts C de Beescoop scrl</field> |
|||
<field name="default_code">share_c</field> |
|||
<field name="customer" eval="False" /> |
|||
<field name="is_share" eval="True" /> |
|||
</record> |
|||
</data> |
|||
</odoo> |
@ -0,0 +1,4 @@ |
|||
from . import res_partner |
|||
from . import subscription_request |
|||
from . import res_company |
|||
from . import product |
@ -0,0 +1,8 @@ |
|||
from odoo import models, fields |
|||
|
|||
|
|||
class ProductTemplate(models.Model): |
|||
|
|||
_inherit = 'product.template' |
|||
|
|||
can_shop = fields.Boolean(string="Is share?") |
@ -0,0 +1,35 @@ |
|||
# Copyright 2019 Coop IT Easy SCRLfs |
|||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
|||
|
|||
from odoo import api, fields, models, _ |
|||
|
|||
|
|||
class ResCompany(models.Model): |
|||
|
|||
_inherit = 'res.company' |
|||
display_info_session_confirmation = fields.Boolean( |
|||
help="Choose to display a info session checkbox on the cooperator" |
|||
" website form." |
|||
) |
|||
info_session_confirmation_required = fields.Boolean( |
|||
string="Is info session confirmation required?" |
|||
) |
|||
info_session_confirmation_text = fields.Html( |
|||
translate=True, |
|||
help="Text to display aside the checkbox to confirm" |
|||
" participation to an info session." |
|||
) |
|||
|
|||
@api.onchange('info_session_confirmation_required') |
|||
def onchange_info_session_confirmatio_required(self): |
|||
if self.info_session_confirmation_required: |
|||
self.display_info_session_confirmation = True |
|||
|
|||
_sql_constraints = [( |
|||
'info_session_approval_constraint', |
|||
"""CHECK ((info_session_confirmation_required=FALSE |
|||
AND display_info_session_confirmation=FALSE) |
|||
OR display_info_session_confirmation=TRUE) |
|||
""", |
|||
"Approval can't be mandatory and not displayed." |
|||
)] |
@ -0,0 +1,28 @@ |
|||
from odoo import models, fields, api |
|||
|
|||
|
|||
class Partner(models.Model): |
|||
_inherit = 'res.partner' |
|||
|
|||
can_shop = fields.Boolean(compute='_can_shop', store=True) |
|||
info_session_confirmed = fields.Boolean( |
|||
string="Confirmed presence to info session", |
|||
default=False, |
|||
) |
|||
|
|||
@api.depends('cooperator_type', |
|||
'cooperative_status_ids', |
|||
'cooperative_status_ids.can_shop') |
|||
def _can_shop(self): |
|||
product_obj = self.env['product.template'] |
|||
can_shop_shares = product_obj.search([('is_share', '=', True), |
|||
('can_shop', '=', True) |
|||
]).mapped('default_code') |
|||
for rec in self: |
|||
if rec.cooperator_type in can_shop_shares: |
|||
rec.can_shop = True |
|||
elif (rec.cooperative_status_ids |
|||
and rec.cooperative_status_ids[0].can_shop): |
|||
rec.can_shop = True |
|||
else: |
|||
rec.can_shop = False |
@ -0,0 +1,26 @@ |
|||
# Copyright 2019 Coop IT Easy SCRLfs |
|||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
|||
|
|||
from odoo import api, fields, models, _ |
|||
|
|||
|
|||
class SubscriptionRequest(models.Model): |
|||
|
|||
_inherit = 'subscription.request' |
|||
|
|||
info_session_confirmed = fields.Boolean( |
|||
string="Confirmed Info Session", |
|||
default=False, |
|||
) |
|||
|
|||
def get_partner_vals(self): |
|||
partner_vals = super(SubscriptionRequest, self).get_partner_vals() |
|||
partner_vals['info_session_confirmed'] = self.info_session_confirmed |
|||
return partner_vals |
|||
|
|||
def get_required_field(self): |
|||
required_fields = super(SubscriptionRequest, self).get_required_field() |
|||
company = self.env['res.company']._company_default_get() |
|||
if company.info_session_confirmation_required: |
|||
required_fields.append('info_session_confirmed') |
|||
return required_fields |
@ -0,0 +1,30 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<odoo> |
|||
<record model="ir.ui.view" id="beesdoo_partner_form_view_remove_duplicate_cooperator_type"> |
|||
<field name="name">beesdoo.partner.form.view.remove_duplicate_cooperator_type</field> |
|||
<field name="model">res.partner</field> |
|||
<field name="inherit_id" ref="beesdoo_base.beesdoo_partner_form_view" /> |
|||
<field name="arch" type="xml"> |
|||
<field name="cooperator_type" position="replace" /> |
|||
</field> |
|||
</record> |
|||
|
|||
<record model="ir.ui.view" id="beesdoo_partner_form_view_remove_duplicate_header"> |
|||
<field name="name">beesdoo.partner.form.view.remove_duplicate_header</field> |
|||
<field name="model">res.partner</field> |
|||
<field name="inherit_id" ref="beesdoo_shift.super_coop_partner_inherited_view_form" /> |
|||
<field name="arch" type="xml"> |
|||
<xpath expr="header" position="replace" /> |
|||
<xpath expr="//field[@name='state']" position="before"> |
|||
<button string="Create Subscription" name="%(easy_my_coop.action_view_create_subscription)d" |
|||
type="action" context="{'default_active_id': active_id}" groups="easy_my_coop.group_easy_my_coop_manager"/> |
|||
<button string="Update info" name="%(easy_my_coop.action_view_update_partner_info)d" |
|||
type="action" context="{'default_active_id': active_id}" groups="easy_my_coop.group_easy_my_coop_manager"/> |
|||
</xpath> |
|||
<xpath expr="//field[@name='info_session']" position="before"> |
|||
<field name="can_shop" /> |
|||
</xpath> |
|||
</field> |
|||
<field name="priority">99</field> |
|||
</record> |
|||
</odoo> |
@ -0,0 +1,13 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<odoo> |
|||
<record id="product_template_share_form_view_beesdoo_emc" model="ir.ui.view"> |
|||
<field name="name">product.template.share.form</field> |
|||
<field name="model">product.template</field> |
|||
<field name="inherit_id" ref="easy_my_coop.product_template_share_form_view"/> |
|||
<field name="arch" type="xml"> |
|||
<field name="customer" position="after"> |
|||
<field name="can_shop"/> |
|||
</field> |
|||
</field> |
|||
</record> |
|||
</odoo> |
@ -0,0 +1,20 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<!-- Copyright 2019 Coop IT Easy SCRLfs |
|||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). --> |
|||
|
|||
<odoo> |
|||
|
|||
<record model="ir.ui.view" id="res_company_form_view"> |
|||
<field name="name">res.company.form (in beesdoo_easy_my_coop)</field> |
|||
<field name="model">res.company</field> |
|||
<field name="inherit_id" ref="easy_my_coop.view_company_inherit_form2"/> |
|||
<field name="arch" type="xml"> |
|||
<xpath expr="//group[@name='coop_grp']//field[@name='display_data_policy_approval']" position="before"> |
|||
<field name="display_info_session_confirmation"/> |
|||
<field name="info_session_confirmation_required"/> |
|||
<field name="info_session_confirmation_text"/> |
|||
</xpath> |
|||
</field> |
|||
</record> |
|||
|
|||
</odoo> |
@ -0,0 +1,18 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<!-- Copyright 2019 Coop IT Easy SCRLfs |
|||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). --> |
|||
|
|||
<odoo> |
|||
|
|||
<record model="ir.ui.view" id="subscription_request_form_view"> |
|||
<field name="name">subscription.request.form (in beesdoo_easy_my_coop)</field> |
|||
<field name="model">subscription.request</field> |
|||
<field name="inherit_id" ref="easy_my_coop.subscription_request_form"/> |
|||
<field name="arch" type="xml"> |
|||
<field name="data_policy_approved" position="before"> |
|||
<field name="info_session_confirmed"/> |
|||
</field> |
|||
</field> |
|||
</record> |
|||
|
|||
</odoo> |
@ -0,0 +1,28 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<!-- Copyright 2019 Coop IT Easy SCRLfs |
|||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). --> |
|||
|
|||
<odoo> |
|||
|
|||
<template id="beesdoo_easy_my_coop.becomecooperator" |
|||
name="Become Cooperator (in beesdoo_easy_my_coop)" |
|||
inherit_id="easy_my_coop_website.becomecooperator"> |
|||
<xpath expr="//div[@id='data_policy_approved']" position="before"> |
|||
<div id="info_session_confirmed" t-if="display_info_session" t-attf-class="form-group" > |
|||
<label class="col-md-3 col-sm-4 control-label" for="info_session_confirmed">Info Session</label> |
|||
<div class="col-md-9 col-sm-8"> |
|||
<div class="checkbox"> |
|||
<label for="info_session_confirmed"> |
|||
<input type="checkbox" |
|||
name="info_session_confirmed" |
|||
t-att="{'required': 'required'} if info_session_required else {}" |
|||
t-attf-value="#{data_policy_approved or ''}"/> |
|||
<t t-raw="info_session_text"/> |
|||
</label> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</xpath> |
|||
</template> |
|||
|
|||
</odoo> |
@ -0,0 +1 @@ |
|||
from . import beesdoo_shift_subscribe |
@ -0,0 +1,24 @@ |
|||
# Copyright 2019 Coop IT Easy SCRLfs |
|||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
|||
|
|||
from odoo import api, fields, models, _ |
|||
|
|||
|
|||
class Subscribe(models.TransientModel): |
|||
|
|||
_inherit = 'beesdoo.shift.subscribe' |
|||
|
|||
def _get_info_session_followed(self): |
|||
""" |
|||
Check if the user has checked the info_session_confirmed in the |
|||
form to become new cooperator. |
|||
""" |
|||
followed = super(Subscribe, self)._get_info_session_followed() |
|||
if not followed: |
|||
return (self.env['res.partner'] |
|||
.browse(self._context.get('active_id')) |
|||
.info_session_confirmed) |
|||
return followed |
|||
|
|||
info_session = fields.Boolean(default=_get_info_session_followed) |
|||
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue