[IMP] website_hr compatible with Multi-Website
This commit is contained in:
parent
a8637343a9
commit
1ef704567a
@ -8,6 +8,10 @@ class HrEmployee(models.Model):
|
||||
_inherit = ['hr.employee', 'website.published.mixin']
|
||||
|
||||
public_info = fields.Char(string='Public Info')
|
||||
website_ids = fields.Many2many('website', 'website_hr_emp_pub_rel',
|
||||
'website_id', 'emp_id',
|
||||
string='Websites', copy=False,
|
||||
help='List of websites in which Employee is published.')
|
||||
|
||||
@api.multi
|
||||
def _compute_website_url(self):
|
||||
|
@ -15,6 +15,7 @@
|
||||
<xpath expr="//page[@name='public']/group" position="inside">
|
||||
<group>
|
||||
<field name="public_info"/>
|
||||
<field name="website_ids" widget="many2many_tags"/>
|
||||
</group>
|
||||
</xpath>
|
||||
</field>
|
||||
|
@ -11,7 +11,7 @@
|
||||
<xpath expr="//div[hasclass('oe_structure')]" position="after">
|
||||
<section class="container" id="team">
|
||||
<t t-set="is_publisher" t-value="request.env['res.users'].has_group('website.group_website_publisher')" />
|
||||
<t t-set="employees_domain" t-value="[] if is_publisher else [('website_published', '=', True)]" />
|
||||
<t t-set="employees_domain" t-value="[] if is_publisher else [('website_published', '=', True), '|', ('website_ids', '=', False), ('website_ids', 'in', website)]" />
|
||||
<t t-set="employees" t-value="request.env['hr.employee'].search(employees_domain)" />
|
||||
<div class="col-sm-12 text-center" t-if="len(employees)">
|
||||
<h2>Our Team</h2>
|
||||
@ -22,6 +22,7 @@
|
||||
<t t-set="publish_edit" t-value="True"/>
|
||||
</t>
|
||||
<div class="clearfix"/>
|
||||
<div class="emp" t-attf-data-publish="#{employee.website_published & (not employee.website_ids or website in employee.website_ids) and 'on' or 'off'}">
|
||||
<img t-att-src="website.image_url(employee, 'image_medium')" class="img shadow img-rounded"/>
|
||||
<div class="mt8">
|
||||
<strong t-field="employee.name"></strong>
|
||||
@ -29,6 +30,7 @@
|
||||
<div t-field="employee.job_id"/>
|
||||
<div t-field="employee.public_info" class="text-muted mt16 center-block"/>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</xpath>
|
||||
</template>
|
||||
|
Loading…
Reference in New Issue
Block a user