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

[14.0][IMP] rework res.partner form view #105

Merged
merged 1 commit into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions cooperator/models/cooperative_membership.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ def _search_subscription_request_ids(self, operator, value):
cooperator = fields.Boolean(
string="Cooperator",
help="Check this box if this contact is a cooperator (effective or not).",
readonly=True,
copy=False,
)
member = fields.Boolean(
Expand All @@ -139,6 +140,7 @@ def _search_subscription_request_ids(self, operator, value):
old_member = fields.Boolean(
string="Old cooperator",
help="Check this box if this cooperator is no more an effective member.",
readonly=True,
)
share_ids = fields.One2many(
"share.line",
Expand Down
2 changes: 2 additions & 0 deletions cooperator/models/partner.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ def add_cooperative_membership_field(name, field_type, **kwargs):
fields.Boolean,
string="Cooperator",
help="Check this box if this contact is a cooperator (effective or not).",
readonly=True,
)
add_cooperative_membership_field(
"member",
Expand All @@ -244,6 +245,7 @@ def add_cooperative_membership_field(name, field_type, **kwargs):
fields.Boolean,
string="Old cooperator",
help="Check this box if this cooperator is no more an effective member.",
readonly=True,
)
add_cooperative_membership_field(
"cooperator_register_number",
Expand Down
2 changes: 2 additions & 0 deletions cooperator/readme/newsfragments/105.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fix error when creating a new contact (``res.partner``) as has been done in
version 16.
1 change: 1 addition & 0 deletions cooperator/readme/newsfragments/105.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Rework ``res.partner`` form view as has been done in version 16.
1 change: 1 addition & 0 deletions cooperator/readme/newsfragments/47.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Remove duplicated member field in ``res.partner`` form view.
88 changes: 43 additions & 45 deletions cooperator/views/res_partner_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,72 +23,70 @@

<xpath expr="/form/sheet/group" position='before'>
<group>
<group>
<field name="member" invisible="1" />
<field name="cooperator" invisible="True" />
<group
groups="cooperator.cooperator_group_user"
attrs="{'invisible': [('cooperator', '=', False)]}"
>
<field
name="representative"
attrs="{'invisible':['|',('parent_id','=',False),('is_company','=',True)]}"
name="cooperator_register_number"
attrs="{'invisible': [('member', '=', False)]}"
/>
<field name="coop_candidate" />
<field name="member" />
<field
name="legal_form"
attrs="{'invisible':[('is_company','=',False)]}"
name="cooperator_type"
attrs="{'invisible': [('member', '=', False)]}"
/>
<field
name="cooperator_register_number"
readonly="True"
attrs="{'invisible':[('member','=',False)]}"
name="effective_date"
attrs="{'invisible': [('member', '=', False)]}"
/>
</group>
<group
name="approvals"
groups="cooperator.cooperator_group_user"
attrs="{'invisible': [('cooperator', '=', False)]}"
>
<field
name="company_register_number"
readonly="True"
attrs="{'invisible':[('is_company','=',False)]}"
name="internal_rules_approved"
attrs="{'readonly': [('cooperator', '=', False)]}"
/>
<field
name="coop_candidate"
groups="cooperator.cooperator_group_user"
name="data_policy_approved"
attrs="{'readonly': [('cooperator', '=', False)]}"
/>
<field
name="cooperator"
invisible="True"
groups="cooperator.cooperator_group_manager"
name="financial_risk_approved"
attrs="{'readonly': [('cooperator', '=', False)]}"
/>
<field
name="member"
groups="cooperator.cooperator_group_manager"
name="generic_rules_approved"
attrs="{'readonly': [('cooperator', '=', False)]}"
/>
</group>
<group>
<field
name="cooperator_type"
attrs="{'invisible':[('member','=',False)]}"
name="representative"
attrs="{'invisible': ['|', ('parent_id', '=', False), ('is_company', '=', True)]}"
/>
<field
name="effective_date"
attrs="{'invisible':[('member','=',False)]}"
name="legal_form"
attrs="{'invisible': [('is_company', '=', False)]}"
/>
</group>
<group>
<field
name="gender"
attrs="{'invisible':[('is_company','=',True)]}"
name="company_register_number"
attrs="{'invisible': [('is_company', '=', False)], 'readonly': [('id', '!=', False)]}"
/>
</group>
<group
name="approvals"
attrs="{'invisible':[('cooperator','=',False)]}"
>
<field name="internal_rules_approved" />
<field name="data_policy_approved" />
<field name="financial_risk_approved" />
<field name="generic_rules_approved" />
</group>
</group>
</xpath>

<page name='sales_purchases' position="after">
<field name="member" invisible="1" />
<page name="sales_purchases" position="after">
<page
string="Shares"
name="share"
attrs="{'invisible':[('member','=',False)]}"
attrs="{'invisible': [('member', '=', False)]}"
groups="cooperator.cooperator_group_user"
>
<group>
Expand All @@ -115,7 +113,7 @@
<page
string="Share subscriptions"
name="share_subscription"
attrs="{'invisible':[('cooperator','=',False)]}"
attrs="{'invisible': [('cooperator', '=', False)]}"
groups="cooperator.cooperator_group_user"
>
<field name="subscription_request_ids">
Expand Down Expand Up @@ -203,8 +201,8 @@
<field name="name">Cooperators</field>
<field name="res_model">res.partner</field>
<field name="view_mode">kanban,tree,form</field>
<field name="domain">[('cooperative_membership_ids.member', '=', True)]</field>
<field name="context">{'create':False}</field>
<field name="domain">[("cooperative_membership_ids.member", "=", True)]</field>
<field name="context">{"create": False}</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to add a contact in your address book.
Expand All @@ -223,8 +221,8 @@
<field name="type">ir.actions.act_window</field>
<field name="res_model">res.partner</field>
<field name="view_mode">kanban,tree,form</field>
<field name="domain">[('coop_candidate', '=',True)]</field>
<field name="context">{'create':False}</field>
<field name="domain">[("coop_candidate", "=", True)]</field>
<field name="context">{"create": False}</field>
<field name="filter" eval="True" />
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Expand All @@ -244,7 +242,7 @@
<field name="type">ir.actions.act_window</field>
<field name="res_model">res.partner</field>
<field name="view_mode">kanban,tree,form</field>
<field name="domain">[('representative_of_member_company','=',True)]</field>
<field name="domain">[("representative_of_member_company", "=", True)]</field>
<field name="filter" eval="True" />
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Expand Down
Loading