Hello I want to create a button to publish job offers on web site
Error : AttributeError: type object 'recrutement.offre_d_emploi' has no attribute 'open_website_url'
this is ma code :
class Offre_D_emploi(models.Model):
_name = "recrutement.offre_d_emploi"
_rec_name = "reference"
reference = fields.Integer(string="Référence")
titre_poste = fields.Char(String="Titre de poste")
nom_societé = fields.Char(String="Nom de la societé")
localité = fields.Char(String="Localité")
parent_id = fields.Many2one('hr.department', string="Departement")
description_poste = fields.Text(String="Description Poste")
exigences = fields.Char(String="Exigences")
date_debut = fields.Date(string="Date Début")
avantages = fields.Char(string="Avantages")
date_fin_d_offre = fields.Date(string="Date fin d'offre")
website_published = fields.Boolean('Visible on current website', related='is_published', readonly=False)
is_published = fields.Boolean('Is Published', copy=False, default=lambda self: self._default_is_published())
can_publish = fields.Boolean('Can Publish', compute='_compute_can_publish')
website_url = fields.Char('Website URL', compute='_compute_website_url', help='The full URL to access the document through the website.')
def _compute_website_url(self):
for job in self:
job.website_url = "/jobs/detail/%s" % job.id
def set_open(self):
self.write({'website_published': False})
return self.website_url
==================================================================================<record id="offre_form" model="ir.ui.view">
<field name="name">recrutement.offre_d_emploi.form</field>
<field name="model">recrutement.offre_d_emploi</field>
<field name="arch" type="xml">
<form string="Offres d'emploi">
<sheet>
<h1> Publication d'offre d'emploi :
</h1>
<div name="button_box" position="inside">
<field name="is_published" widget="website_redirect_button"/>
</div>
<group>
<field name="reference"/>
<field name="titre_poste"/>
</group>
<group>
<field name="nom_societé"/>
<field name="localité"/>
</group>
<group>
<field name="parent_id"/>
<field name="description_poste"/>
</group>
<group>
<field name="exigences"/>
<field name="date_debut"/>
<field name="avantages"/>
<field name="date_fin_d_offre"/>
</group>
</sheet>
</form>
</field>
</record>