Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[lcc_members][lcc_members_portal] Urgent improvements-fix #201

Merged
merged 12 commits into from
May 8, 2022
Merged
2 changes: 2 additions & 0 deletions lcc_members/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@
"views/assets.xml",
"views/profile_portal_templates.xml",
"views/invoice_portal_templates.xml",
"views/res_users_views.xml",
"wizard/membership_invoice_views.xml",
"data/partner_profile_data.xml",
"data/res_partner_data.xml",
],
Expand Down
6 changes: 4 additions & 2 deletions lcc_members/controllers/portal.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,10 @@ def _details_profile_form_validate(self, data, profile_id):
# nickname uniqueness
if (
data.get("nickname")
and request.env["res.partner"].browse([9]).is_public_profile
and request.env["res.partner"].search(
and request.env["res.partner"].sudo().browse([9]).is_public_profile
and request.env["res.partner"]
.sudo()
.search(
[
("name", "=", data.get("nickname")),
("partner_profile.ref", "=", "partner_profile_public"),
Expand Down
437 changes: 233 additions & 204 deletions lcc_members/i18n/fr.po

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions lcc_members/models/res_partner.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

PUBLIC_PROFILE_FIELDS = [
"name",
"company_name",
"lastname",
"firstname",
"function",
Expand All @@ -34,6 +35,7 @@
"opening_time",
"discount",
"is_company",
"lang",
]

POSITION_PROFILE_FIELDS = [
Expand Down Expand Up @@ -195,6 +197,15 @@ class res_partner(models.Model):
domain=[("partner_profile.ref", "=", "partner_profile_position")]
)

website_id = fields.Many2one(compute="_compute_website_id", store=True)

def _compute_website_id(self):
for partner in self:
website = self.env["website"].search(
[("company_id", "=", partner.company_id.id)], limit=1
)
partner.website_id = website.id

@api.depends(
"other_contact_ids",
"other_contact_ids.edit_structure_main_profile",
Expand Down
2 changes: 1 addition & 1 deletion lcc_members/views/profile_portal_templates.xml
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@
<div class="row">
<div t-attf-class="form-group #{error.get('nickname') and 'o_has_error' or ''} col-xl-12">
<label class="col-form-label" for="nickname">Name / Nickname</label>
<input type="text" name="nickname" t-attf-class="form-control #{error.get('nickname') and 'is-invalid' or ''}" t-att-value="nickname or profile.lastname" />
<input type="text" name="nickname" t-attf-class="form-control #{error.get('nickname') and 'is-invalid' or ''}" t-att-value="nickname or profile.name" />
</div>
</div>
<div class="row">
Expand Down
63 changes: 25 additions & 38 deletions lcc_members/views/res_partner_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,11 @@
<field name="inherit_id" ref="base.view_partner_form" />
<field name="sequence">99</field>
<field name="arch" type="xml">
<!-- ################### -->
<!-- ADDITION OF BUTTONS -->
<!-- ################### -->
<button name="toggle_active" position="before">
<button name="act_show_contract" type="object" class="oe_stat_button" icon="fa-book" context="{'default_contract_type': 'sale', 'contract_type': 'sale'}" attrs="{'invisible': [('customer','=',False)]}" help="Show the sale contracts for this partner">
<field name="sale_contract_count" widget="statinfo" string="Sale contacts" />
</button>
<!-- button name="act_show_contract" type="object" class="oe_stat_button" icon="fa-book" context="{'default_contract_type': 'purchase', 'contract_type': 'purchase'}" attrs="{'invisible': [('supplier','=',False)]}" help="Montrer les convenitions de ce professionel">
<field name="purchase_contract_count" widget="statinfo" string="Purchases contracts"/>
</button-->
</button>

<!-- ################### -->
<!-- MAIN DISPLAY UPDATE -->
<!-- ################### -->
<xpath expr="//field[@name='name']" position="replace">
<field name="name" default_focus="1" placeholder="Commercial Name" attrs="{'readonly': [('is_company', '=', False)],'required': [('is_company', '=', True)]}" widget="field_partner_autocomplete" />
<field name="name" default_focus="1" placeholder="Administrative Name" attrs="{'readonly': [('is_company', '=', False)],'required': [('is_company', '=', True)]}" widget="field_partner_autocomplete" />
<p class="oe_read_only" style="font-size:small; font-style:italic" attrs="{'invisible': [('is_main_profile','=',False)]}">Main Profile</p>
<p class="oe_read_only" style="font-size:small; font-style:italic" attrs="{'invisible': [('is_public_profile','=',False)]}">Public Profile</p>
<p class="oe_read_only" style="font-size:small; font-style:italic" attrs="{'invisible': [('is_position_profile','=',False)]}">Position Profile</p>
Expand All @@ -35,7 +23,7 @@
<field name="is_public_profile" readonly="1" invisible="1" />
<field name="is_position_profile" readonly="1" invisible="1" />
<group name="profile_status">
<field name="odoo_user_id" string="Associated User" readonly="1" attrs="{'invisible': ['|',('is_main_profile','=',False),('is_company', '=', True)]}" />
<field name="odoo_user_id" string="Associated User" readonly="1" attrs="{'invisible': [('is_main_profile','=',False)]}" />
<field name="contact_id" widget="res_partner_many2one" string="Main Profile" readonly="1" attrs="{'invisible': [('is_main_profile','=',True)]}" />
<field name="parent_id" widget="res_partner_many2one" placeholder="Company" domain="[('is_company', '=', True)]" context="{'default_is_company': True, 'show_vat': True}" attrs="{'invisible': ['|',('is_company', '=', True),'|',('contact_type','=','standalone'),('is_public_profile','=',True)]}" readonly="1" />
<label for="public_profile_id" attrs="{'invisible': [('is_main_profile','=',False)]}" />
Expand All @@ -50,12 +38,15 @@
</group>
</group>
</xpath>
<xpath expr="//field[@name='type']" position="before">
<field name="company_name" string="Commercial name" placeholder="Commercial Name..." attrs="{'invisible': [('is_company', '=', False)]}" />
</xpath>
<xpath expr="//field[@name='vat']" position="replace">
<field name="membership_state" string="Subscription status" attrs="{'invisible': [('contact_type','=','attached')]}" />
<field name="member_type_id" string="Subscription type" attrs="{'invisible': [('contact_type','=','attached')]}" />
<field name="currency_exchange_office" attrs="{'invisible': [('is_company', '=', False)]}" />
<field name="is_volunteer" attrs="{'invisible': ['|',('is_company','=', True),('is_position_profile','=',True)]}" />
<field name="team_id" string="Local group" required="True" options="{'limit': 16, 'create': false, 'create_edit': false}" attrs="{'invisible': [('contact_type','=','attached')]}" />
<field name="team_id" string="Local group" options="{'limit': 16, 'create': false, 'create_edit': false}" attrs="{'invisible': [('contact_type','=','attached')]}" />
<field name="user_id" string="Referent" attrs="{'invisible': [('contact_type','=','attached')]}" />
<field name="ref" string="Subcription number" attrs="{'invisible': [('contact_type','=','attached')]}" />
<field name="want_newsletter_subscription" readonly="1" />
Expand Down Expand Up @@ -96,25 +87,14 @@
<xpath expr="//field[@name='associate_member']" position="attributes">
<attribute name='invisible'>1</attribute>
</xpath>
<xpath expr="//field[@name='free_member']/../.." position='attributes'>
<attribute name='attrs'>{'invisible': [('contact_id','!=',False)]}</attribute>
</xpath>
<xpath expr="//field[@name='member_lines']" position='attributes'>
<attribute name='attrs'>{'invisible': [('contact_id','!=',False)]}</attribute>
<attribute name='readonly'>0</attribute>
</xpath>
<xpath expr="//field[@name='member_lines']/form/group/group/field[@name='membership_id']" position='attributes'>
<attribute name='readonly'>1</attribute>
</xpath>
<xpath expr="//field[@name='member_lines']/form/group/group/field[@name='member_price']" position='attributes'>
<attribute name='readonly'>1</attribute>
</xpath>
<xpath expr="//field[@name='member_lines']" position='after'>
<p attrs="{'invisible': [('contact_id','=',False)]}">
To see membership information about this contact, please
go to to the this person form:
<field name="contact_id" class="oe_inline" domain="[('contact_type','!=','attached')]" context="{'show_address': 1}" options="{'always_reload': True}" />
</p>
<xpath expr="//field[@name='member_lines']/.." position='attributes'>
<attribute name='attrs'>{'invisible': [('is_main_profile','=',False)]}</attribute>
</xpath>

<!-- page Contacts & Adresses -->
Expand All @@ -141,6 +121,7 @@
<xpath expr="//field[@name='child_ids']/form/sheet//field[@name='firstname']" position="attributes">
<attribute name="attrs">{'invisible': [('type', 'in', ['invoice','delivery','other'])]}</attribute>
</xpath>

<!-- page Other Positions -->
<xpath expr="//page[@name='other_position']" position="attributes">
<attribute name="attrs">{'invisible': ['|', ('contact_id','!=',False), ('is_company','=',True)]}</attribute>
Expand All @@ -159,16 +140,22 @@
<field name="edit_structure_public_profile" attrs="{'invisible': [('is_position_profile','=',False)]}" />
</xpath>

<!-- page Invoicing -->
<xpath expr="//page[@name='accounting']" position='attributes'>
<attribute name='attrs'>{'invisible': [('is_main_profile','=',False)]}</attribute>
</xpath>
<xpath expr="//page[@name='accounting_disabled']" position='attributes'>
<attribute name='invisible'>1</attribute>
</xpath>

<!-- page Sales & Purchases -->
<xpath expr="//page[@name='sales_purchases']/group[@name='container_row_2']" position='attributes'>
<attribute name='attrs'>{'invisible': [('contact_id','!=',False)]}</attribute>
<xpath expr="//page[@name='sales_purchases']" position='attributes'>
<attribute name='attrs'>{'invisible': [('is_main_profile','=',False)]}</attribute>
</xpath>
<xpath expr="//page[@name='sales_purchases']/group[@name='container_row_2']" position='after'>
<p attrs="{'invisible': [('contact_id','=',False)]}">
To see Sales and Purchases an information about this contact, please
go to to the this person form:
<field name="contact_id" class="oe_inline" domain="[('contact_type','!=','attached')]" context="{'show_address': 1}" options="{'always_reload': True}" />
</p>

<!-- page Personnal Information -->
<xpath expr="//page[@name='personal_information_page']" position='attributes'>
<attribute name='attrs'>{'invisible': [('is_main_profile','=',False)]}</attribute>
</xpath>

<!-- ################## -->
Expand Down Expand Up @@ -215,8 +202,8 @@
<!-- TODO v4 : delete this group once all lcc informed -->
<div role="alertdialog" class="alert alert-warning">
<span>
<b>Attention:</b>
Odoo ne compresse pas les images. la somme totale de vos images ne doit pas dépasser 4mo. Pour compresser vos images vous pouvez par exemple utiliser ce site :
<b>Warning:</b>
Odoo doesn't compress pictures. The total sum of your pictures must not exceed 4Mo. To compress your pictures, you can use the following tool:
<a href="https://compressjpeg.com/fr/" target="_blank">https://compressjpeg.com/fr/</a>
</span>
</div>
Expand Down
18 changes: 18 additions & 0 deletions lcc_members/views/res_users_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0"?>
<odoo>
<data>
<!-- In order to manipulate membership Odoo accounts, mlc's teams must be able to generate
portal or internal accounts without developper mode -->
<record id="user_groups_lcc_view" model="ir.ui.view">
<field name="name">res.users.groups</field>
<field name="model">res.users</field>
<field name="inherit_id" ref="base.view_users_form" />
<field name="sequence">99</field>
<field name="arch" type="xml">
<xpath expr="//field[@name='sel_groups_1_9_10']" position="replace">
<field name="sel_groups_1_9_10" widget="radio" />
</xpath>
</field>
</record>
</data>
</odoo>
Loading