Thanks for your help my friends but my request still sending in 200 with my values's form but nothing in Database
model.py :
# -*- coding: utf-8 -*-
from odoo import models, fields, api
class MonHelpdeskTicket(models.Model):
"""Champs qui compose le modele d'une offres. Ce sont principalement les champs à compléter dans le formulaire"""
_name = "monmarchepublic"
_inherit = 'res.users'
_inherit = [
'mail.thread',
'ir.needaction_mixin',
]
x_name = fields.Char('Nom et Prenom', readonly=0, website_form_blacklisted=0, Store=True )
x_objet_consultation = fields.Char('Objet de la consultation', readonly=0, website_form_blacklisted=0, Store=True)
x_membre_interne = fields.Char("Membres de l'équipe INTERNE Coopaname", readonly=0, website_form_blacklisted=0, Store=True)
x_membre_externe = fields.Char(" Membres de l'équipe EXTERNE et/ou informations utiles", readonly=0, website_form_blacklisted=0, Store=True)
x_equipeok = fields.Boolean('Equipe complète', readonly=0, website_form_blacklisted=0, Store=True)
x_admin = fields.Char('Administration', readonly=0, website_form_blacklisted=0, Store=True)
x_inputstreet1 = fields.Char('N° et Rue', readonly=0, website_form_blacklisted=0, Store=True)
x_inputcity1 = fields.Char('Ville', readonly=0, website_form_blacklisted=0, Store=True)
x_inputzip1 = fields.Char('Code Postal', readonly=0, website_form_blacklisted=0, Store=True)
x_date_order = fields.Date('Date de publication', readonly=0, website_form_blacklisted=0, Store=True)
x_type_marche = fields.Selection([("offre_ferme", "Appel d'offre Fermé"), ('offre_ouvert', "Appel d'offre Ouvert"), ('concours', 'Concours'), ('consultation', 'Consultation'), ('mapa', 'MAPA')], readonly=0, website_form_blacklisted=0, Store=True)
x_date_limite = fields.Datetime('Date et heure limites de dépot de candidature', readonly=0, website_form_blacklisted=0, Store=True)
x_duree_marche = fields.Char('Durée du marché', readonly=0, website_form_blacklisted=0, Store=True)
x_montant_marche = fields.Char('Montant du marché', readonly=0, website_form_blacklisted=0, Store=True)
x_inputstreet2 = fields.Char('N° et Rue', readonly=0, website_form_blacklisted=0, Store=True)
x_inputcity2 = fields.Char('Ville', readonly=0, website_form_blacklisted=0, Store=True)
x_inputzip2 = fields.Char('Code Postal', readonly=0, website_form_blacklisted=0, Store=True)
x_num_ref = fields.Char('Numéro de référence attribué au marché', readonly=0, website_form_blacklisted=0, Store=True)
x_cat = fields.Selection([("Etudes, Maitrise d oeuvre, Controle", "Etudes, Maîtrise d'oeuvre, Contrôle"), ('Travaux de batiment', 'Travaux de bâtiment'), ('Travaux Publics', 'Travaux Publics'), ('Fournitures', 'Fournitures'), ('Services', 'Services')], readonly=0, website_form_blacklisted=0, Store=True)
x_pj = fields.Char('Pièce Jointe', readonly=0, website_form_blacklisted=0, Store=True)
x_ville_adju = fields.Char('Ville du Pouvoir Adjudicateur', readonly=0, website_form_blacklisted=0, Store=True)
x_mail = fields.Char('Email', readonly=0, website_form_blacklisted=0, Store=True)
x_etape = fields.Selection([('New', 'New'), ('CCTP', 'CCTP'), ('En cours de traitement', 'En cours de traitement'), ('Valide', 'Validé'), ('Refuse', 'Refusé'), ('Archive', 'Archivé')], readonly=0, website_form_blacklisted=0, Store=True)
message_ids = fields.One2many('mail.message', 'res_id', string="Commentaire", Store=True)
partner_ids = fields.Many2many('res.partner', string='Recipients', help="List of partners that will be added as follower of the current document.", readonly=0, website_form_blacklisted=0, Store=True)
message_partner_ids = fields.Many2many(
comodel_name='res.partner', string='Followers Test',
compute='_get_followers', search='_search_follower_partners', readonly=0, website_form_blacklisted=0, Store=True)
follower_ids = fields.One2many('mail.followers', 'res_id', string="follo", readonly=0, website_form_blacklisted=0, Store=True)
and
controller.py :
@http.route('/coopaname_helpdesk/post_form_ticket/<string:model_name>', methods=['POST'], type = 'http', auth='public', website= True )
def website_form(self, model_name, **kwargs):
try:
objet_consultation = kwargs.get('x_objet_consultation')
cat = kwargs.get('x_cat')
membre_interne = kwargs.get('x_membre_interne')
membre_externe = kwargs.get('x_membre_externe')
equipeok = kwargs.get('x_equipeok')
admin = kwargs.get('x_admin')
type_marche = kwargs.get('x_type_marche')
ville_adju = kwargs.get('x_ville_adju')
date_order = kwargs.get('x_date_order')
date_limite = kwargs.get('x_date_limite')
duree_marche = kwargs.get('x_duree_marche')
montant_marche = kwargs.get('x_montant_marche')
num_ref = kwargs.get('x_num_ref')
pj = kwargs.get('x_pj')
name = kwargs.get('x_name')
mail = kwargs.get('x_mail')
inputstreet1 = kwargs.get('x_inputstreet1')
inputcity1 = kwargs.get('x_inputcity1')
inputzip1 = kwargs.get('x_inputzip1')
inputstreet2 = kwargs.get('x_inputstreet2')
inputcity2 = kwargs.get('x_inputcity2')
inputzip2 = kwargs.get('x_inputzip2')
data = {
'x_cat' : cat,
'x_objet_consultation' : objet_consultation,
'x_membre_interne' : membre_interne,
'x_membre_externe' : membre_externe,
'x_equipeok' : equipeok,
'x_admin' : admin,
'x_type_marche' : type_marche,
'x_ville_adju':ville_adju,
'x_date_order': date_order,
'x_date_limite': date_limite,
'x_duree_marche': duree_marche,
'x_montant_marche' : montant_marche,
'x_num_ref' : num_ref,
'x_pj' : pj,
'x_name' : name,
'x_mail' : mail,
'x_inputstreet1' : inputstreet1,
'x_inputcity1' : inputcity1,
'x_inputzip1' : inputzip1,
'x_inputstreet2': inputstreet2,
'x_inputzip2' : inputzip2,
'x_inputcity2' : inputcity2
}
return request.env.cr['monmarchepublic'].create(data)
except:
return json.dumps({'error' : ' tout est casse'})
But the code run into the except because i receive the error in param