Browse Source

[FIX] Duplicate label

pull/324/head
Maxime Chambreuil 6 years ago
parent
commit
0ea12fcb6b
  1. 28
      agreement_legal/models/agreement.py
  2. 4
      agreement_legal/report/agreement.xml
  3. 8
      agreement_legal/views/agreement.xml

28
agreement_legal/models/agreement.py

@ -65,7 +65,7 @@ class Agreement(models.Model):
help="Date the contract was signed by Company.", help="Date the contract was signed by Company.",
) )
partner_signed_date = fields.Date( partner_signed_date = fields.Date(
string="Signed on",
string="Signed on (Partner)",
track_visibility="onchange", track_visibility="onchange",
help="Date the contract was signed by the Partner.", help="Date the contract was signed by the Partner.",
) )
@ -140,12 +140,6 @@ class Agreement(models.Model):
copy=True, copy=True,
help="The customer or vendor this agreement is related to.", help="The customer or vendor this agreement is related to.",
) )
company_partner_id = fields.Many2one(
"res.partner",
string="Company",
copy=True,
default=lambda self: self.env.user.company_id.partner_id,
)
partner_contact_id = fields.Many2one( partner_contact_id = fields.Many2one(
"res.partner", "res.partner",
string="Partner Contact", string="Partner Contact",
@ -153,10 +147,10 @@ class Agreement(models.Model):
help="The primary partner contact (If Applicable).", help="The primary partner contact (If Applicable).",
) )
partner_contact_phone = fields.Char( partner_contact_phone = fields.Char(
related="partner_contact_id.phone", string="Phone"
related="partner_contact_id.phone", string="Partner Phone"
) )
partner_contact_email = fields.Char( partner_contact_email = fields.Char(
related="partner_contact_id.email", string="Email"
related="partner_contact_id.email", string="Partner Email"
) )
company_contact_id = fields.Many2one( company_contact_id = fields.Many2one(
"res.partner", "res.partner",
@ -178,12 +172,12 @@ class Agreement(models.Model):
deftext = """ deftext = """
<h3>Company Information</h3> <h3>Company Information</h3>
<p> <p>
${object.company_partner_id.name or ''}.<br>
${object.company_partner_id.street or ''} <br>
${object.company_partner_id.state_id.code or ''}
${object.company_partner_id.zip or ''}
${object.company_partner_id.city or ''}<br>
${object.company_partner_id.country_id.name or ''}.<br><br>
${object.company_id.partner_id.name or ''}.<br>
${object.company_id.partner_id.street or ''} <br>
${object.company_id.partner_id.state_id.code or ''}
${object.company_id.partner_id.zip or ''}
${object.company_id.partner_id.city or ''}<br>
${object.company_id.partner_id.country_id.name or ''}.<br><br>
Represented by <b>${object.company_contact_id.name or ''}.</b> Represented by <b>${object.company_contact_id.name or ''}.</b>
</p> </p>
<p></p> <p></p>
@ -241,7 +235,7 @@ class Agreement(models.Model):
) )
partner_signed_user_id = fields.Many2one( partner_signed_user_id = fields.Many2one(
"res.partner", "res.partner",
string="Signed By",
string="Signed By (Partner)",
track_visibility="onchange", track_visibility="onchange",
help="Contact on the account that signed the agreement/contract.", help="Contact on the account that signed the agreement/contract.",
) )
@ -273,7 +267,7 @@ class Agreement(models.Model):
previous_version_agreements_ids = fields.One2many( previous_version_agreements_ids = fields.One2many(
"agreement", "agreement",
"parent_agreement_id", "parent_agreement_id",
string="Child Agreements",
string="Previous Versions",
copy=False, copy=False,
domain=[("active", "=", False)], domain=[("active", "=", False)],
) )

4
agreement_legal/report/agreement.xml

@ -36,7 +36,7 @@
<t t-if="not doc.use_parties_content"> <t t-if="not doc.use_parties_content">
<h3>Company Information</h3> <h3>Company Information</h3>
<div name="company_address"> <div name="company_address">
<address t-field="doc.company_partner_id"
<address t-field="doc.company_id.partner_id"
t-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": True}' /> t-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": True}' />
</div> </div>
<div name="company_contact"> <div name="company_contact">
@ -121,7 +121,7 @@
<p>Date: </p> <p>Date: </p>
</td> </td>
<td> <td>
<p t-field="doc.company_partner_id"/>
<p t-field="doc.company_id.partner_id"/>
<p>By: </p> <p>By: </p>
<p> <p>
Name: <span t-field="doc.company_contact_id.name"/> Name: <span t-field="doc.company_contact_id.name"/>

8
agreement_legal/views/agreement.xml

@ -9,7 +9,7 @@
<tree string="Agreements" default_order='name'> <tree string="Agreements" default_order='name'>
<field name="name"/> <field name="name"/>
<field name="partner_id"/> <field name="partner_id"/>
<field name="company_partner_id"/>
<field name="company_id"/>
<field name="parent_agreement_id"/> <field name="parent_agreement_id"/>
<field name="agreement_type_id"/> <field name="agreement_type_id"/>
<field name="agreement_subtype_id"/> <field name="agreement_subtype_id"/>
@ -110,7 +110,7 @@
<group name="company" <group name="company"
string="Company"> string="Company">
<div class="o_address_format"> <div class="o_address_format">
<field name="company_partner_id"
<field name="company_id"
readonly="1" readonly="1"
context="{'show_address': 1}" context="{'show_address': 1}"
options="{&quot;always_reload&quot;: True}"/> options="{&quot;always_reload&quot;: True}"/>
@ -122,7 +122,7 @@
<field name="partner_contact_email" widget="email" readonly="1" nolabel="1"/> <field name="partner_contact_email" widget="email" readonly="1" nolabel="1"/>
</group> </group>
<group name="contact_right" string="Primary Contact"> <group name="contact_right" string="Primary Contact">
<field name="company_contact_id" domain="[('parent_id', '=', company_partner_id)]" nolabel="1"/>
<field name="company_contact_id" domain="[('parent_id', '=', company_id.partner_id)]" nolabel="1"/>
<field name="company_contact_phone" widget="phone" readonly="1" nolabel="1"/> <field name="company_contact_phone" widget="phone" readonly="1" nolabel="1"/>
<field name="company_contact_email" widget="email" readonly="1" nolabel="1"/> <field name="company_contact_email" widget="email" readonly="1" nolabel="1"/>
</group> </group>
@ -136,7 +136,7 @@
<field name="end_date" attrs="{'required': [('is_template', '=', False)], 'invisible': [('is_template', '=', True)]}"/> <field name="end_date" attrs="{'required': [('is_template', '=', False)], 'invisible': [('is_template', '=', True)]}"/>
<field name="expiration_notice"/> <field name="expiration_notice"/>
<field name="change_notice"/> <field name="change_notice"/>
<field name="notification_address_id" domain="['|', ('parent_id', '=', partner_id), ('parent_id', '=', company_partner_id)]"/>
<field name="notification_address_id" domain="['|', ('parent_id', '=', partner_id), ('parent_id', '=', company_id.partner_id)]"/>
<field name="termination_requested"/> <field name="termination_requested"/>
<field name="termination_date"/> <field name="termination_date"/>
</group> </group>

Loading…
Cancel
Save