-- Name: stock_wh_resupply_table_supplier_wh_id_supplied_wh_id_idx; Type: INDEX; Schema: public; Owner: odoo
--

CREATE INDEX stock_wh_resupply_table_supplier_wh_id_supplied_wh_id_idx ON public.stock_wh_resupply_table USING btree (supplier_wh_id, supplied_wh_id);


--
-- Name: survey_invite_author_id_index; Type: INDEX; Schema: public; Owner: odoo
--

CREATE INDEX survey_invite_author_id_index ON public.survey_invite USING btree (author_id);


--
-- Name: survey_invite_partner_ids_partner_id_invite_id_idx; Type: INDEX; Schema: public; Owner: odoo
--

CREATE INDEX survey_invite_partner_ids_partner_id_invite_id_idx ON public.survey_invite_partner_ids USING btree (partner_id, invite_id);


--
-- Name: survey_mail_compose_message_ir_atta_attachment_id_wizard_id_idx; Type: INDEX; Schema: public; Owner: odoo
--

CREATE INDEX survey_mail_compose_message_ir_atta_attachment_id_wizard_id_idx ON public.survey_mail_compose_message_ir_attachments_rel USING btree (attachment_id, wizard_id);


--
-- Name: survey_question_survey_user_i_survey_question_id_survey_use_idx; Type: INDEX; Schema: public; Owner: odoo
--

CREATE INDEX survey_question_survey_user_i_survey_question_id_survey_use_idx ON public.survey_question_survey_user_input_rel USING btree (survey_question_id, survey_user_input_id);


--
-- Name: survey_user_input_line_user_input_id_index; Type: INDEX; Schema: public; Owner: odoo
--

CREATE INDEX survey_user_input_line_user_input_id_index ON public.survey_user_input_line USING btree (user_input_id);


--
-- Name: task_dependencies_rel_depends_on_id_task_id_idx; Type: INDEX; Schema: public; Owner: odoo
--

CREATE INDEX task_dependencies_rel_depends_on_id_task_id_idx ON public.task_dependencies_rel USING btree (depends_on_id, task_id);


--
-- Name: team_favorite_user_rel_user_id_team_id_idx; Type: INDEX; Schema: public; Owner: odoo
--

CREATE INDEX team_favorite_user_rel_user_id_team_id_idx ON public.team_favorite_user_rel USING btree (user_id, team_id);


--
-- Name: theme_website_menu_parent_id_index; Type: INDEX; Schema: public; Owner: odoo
--

CREATE INDEX theme_website_menu_parent_id_index ON public.theme_website_menu USING btree (parent_id);


--
-- Name: unique_mail_message_id_res_partner_id_if_set; Type: INDEX; Schema: public; Owner: odoo
--

CREATE UNIQUE INDEX unique_mail_message_id_res_partner_id_if_set ON public.mail_notification USING btree (mail_message_id, res_partner_id) WHERE (res_partner_id IS NOT NULL);


--
-- Name: utm_tag_rel_campaign_id_tag_id_idx; Type: INDEX; Schema: public; Owner: odoo
--

CREATE INDEX utm_tag_rel_campaign_id_tag_id_idx ON public.utm_tag_rel USING btree (campaign_id, tag_id);


--
-- Name: website_lang_rel_lang_id_website_id_idx; Type: INDEX; Schema: public; Owner: odoo
--

CREATE INDEX website_lang_rel_lang_id_website_id_idx ON public.website_lang_rel USING btree (lang_id, website_id);


--
-- Name: website_menu_parent_id_index; Type: INDEX; Schema: public; Owner: odoo
--

CREATE INDEX website_menu_parent_id_index ON public.website_menu USING btree (parent_id);


--
-- Name: website_menu_parent_path_index; Type: INDEX; Schema: public; Owner: odoo
--

CREATE INDEX website_menu_parent_path_index ON public.website_menu USING btree (parent_path);


--
-- Name: website_page_is_published_index; Type: INDEX; Schema: public; Owner: odoo
--

CREATE INDEX website_page_is_published_index ON public.website_page USING btree (is_published);


--
-- Name: website_page_website_id_index; Type: INDEX; Schema: public; Owner: odoo
--

CREATE INDEX website_page_website_id_index ON public.website_page USING btree (website_id);


--
-- Name: website_rewrite_url_from_index; Type: INDEX; Schema: public; Owner: odoo
--

CREATE INDEX website_rewrite_url_from_index ON public.website_rewrite USING btree (url_from);


--
-- Name: website_rewrite_website_id_index; Type: INDEX; Schema: public; Owner: odoo
--

CREATE INDEX website_rewrite_website_id_index ON public.website_rewrite USING btree (website_id);


--
-- Name: website_snippet_filter_is_published_index; Type: INDEX; Schema: public; Owner: odoo
--

CREATE INDEX website_snippet_filter_is_published_index ON public.website_snippet_filter USING btree (is_published);


--
-- Name: website_snippet_filter_website_id_index; Type: INDEX; Schema: public; Owner: odoo
--

CREATE INDEX website_snippet_filter_website_id_index ON public.website_snippet_filter USING btree (website_id);


--
-- Name: website_track_page_id_index; Type: INDEX; Schema: public; Owner: odoo
--

CREATE INDEX website_track_page_id_index ON public.website_track USING btree (page_id);


--
-- Name: website_track_url_index; Type: INDEX; Schema: public; Owner: odoo
--

CREATE INDEX website_track_url_index ON public.website_track USING btree (url);


--
-- Name: website_track_visitor_id_index; Type: INDEX; Schema: public; Owner: odoo
--

CREATE INDEX website_track_visitor_id_index ON public.website_track USING btree (visitor_id);


--
-- Name: website_visitor_livechat_operator_id_index; Type: INDEX; Schema: public; Owner: odoo
--

CREATE INDEX website_visitor_livechat_operator_id_index ON public.website_visitor USING btree (livechat_operator_id) WHERE (livechat_operator_id IS NOT NULL);


--
-- Name: website_visitor_partner_id_index; Type: INDEX; Schema: public; Owner: odoo
--

CREATE INDEX website_visitor_partner_id_index ON public.website_visitor USING btree (partner_id) WHERE (partner_id IS NOT NULL);


--
-- Name: im_livechat_report_channel _RETURN; Type: RULE; Schema: public; Owner: odoo
--

CREATE OR REPLACE VIEW public.im_livechat_report_channel AS
 SELECT c.id,
    c.uuid,
    c.id AS channel_id,
    c.name AS channel_name,
    concat(l.name, ' / ', c.id) AS technical_name,
    c.livechat_channel_id,
    c.create_date AS start_date,
    to_char(date_trunc('hour'::text, c.create_date), 'YYYY-MM-DD HH24:MI:SS'::text) AS start_date_hour,
    to_char(date_trunc('hour'::text, c.create_date), 'HH24'::text) AS start_hour,
    EXTRACT(dow FROM c.create_date) AS day_number,
    EXTRACT(epoch FROM (max(m.create_date) - min(m.create_date))) AS duration,
    EXTRACT(epoch FROM (min(mo.create_date) - min(m.create_date))) AS time_to_answer,
    count(DISTINCT c.livechat_operator_id) AS nbr_speaker,
    count(DISTINCT m.id) AS nbr_message,
        CASE
            WHEN (EXISTS ( SELECT DISTINCT m_1.author_id
               FROM public.mail_message m_1
              WHERE ((m_1.author_id = c.livechat_operator_id) AND (m_1.res_id = c.id) AND ((m_1.model)::text = 'mail.channel'::text) AND (c.livechat_operator_id = m_1.author_id)))) THEN 0
            ELSE 1
        END AS is_without_answer,
    (date_part('day'::text, (date_trunc('day'::text, now()) - (date_trunc('day'::text, c.create_date))::timestamp with time zone)) + (1)::double precision) AS days_of_activity,
        CASE
            WHEN (c.anonymous_name IS NULL) THEN 0
            ELSE 1
        END AS is_anonymous,
    c.country_id,
        CASE
            WHEN (rate.rating = (5)::double precision) THEN 1
            ELSE 0
        END AS is_happy,
    rate.rating,
        CASE
            WHEN (rate.rating = (1)::double precision) THEN 'Unhappy'::text
            WHEN (rate.rating = (5)::double precision) THEN 'Happy'::text
            WHEN (rate.rating = (3)::double precision) THEN 'Neutral'::text
            ELSE NULL::text
        END AS rating_text,
        CASE
            WHEN (rate.rating > (0)::double precision) THEN 0
            ELSE 1
        END AS is_unrated,
    c.livechat_operator_id AS partner_id
   FROM ((((public.mail_channel c
     JOIN public.mail_message m ON (((m.res_id = c.id) AND ((m.model)::text = 'mail.channel'::text))))
     JOIN public.im_livechat_channel l ON ((l.id = c.livechat_channel_id)))
     LEFT JOIN public.mail_message mo ON (((mo.res_id = c.id) AND ((mo.model)::text = 'mail.channel'::text) AND (mo.author_id = c.livechat_operator_id))))
     LEFT JOIN public.rating_rating rate ON (((rate.res_id = c.id) AND ((rate.res_model)::text = 'mail.channel'::text) AND ((rate.parent_res_model)::text = 'im_livechat.channel'::text))))
  WHERE (c.livechat_operator_id IS NOT NULL)
  GROUP BY c.livechat_operator_id, c.id, c.name, c.livechat_channel_id, l.name, c.create_date, c.uuid, rate.rating;


--
-- Name: im_livechat_report_operator _RETURN; Type: RULE; Schema: public; Owner: odoo
--

CREATE OR REPLACE VIEW public.im_livechat_report_operator AS
 SELECT row_number() OVER () AS id,
    c.livechat_operator_id AS partner_id,
    c.livechat_channel_id,
    count(DISTINCT c.id) AS nbr_channel,
    c.id AS channel_id,
    c.create_date AS start_date,
    EXTRACT(epoch FROM (max(m.create_date) - min(m.create_date))) AS duration,
    EXTRACT(epoch FROM (min(mo.create_date) - min(m.create_date))) AS time_to_answer
   FROM ((public.mail_channel c
     JOIN public.mail_message m ON (((m.res_id = c.id) AND ((m.model)::text = 'mail.channel'::text))))
     LEFT JOIN public.mail_message mo ON (((mo.res_id = c.id) AND ((mo.model)::text = 'mail.channel'::text) AND (mo.author_id = c.livechat_operator_id))))
  WHERE (c.livechat_channel_id IS NOT NULL)
  GROUP BY c.id, c.livechat_operator_id;


--
-- Name: vendor_delay_report _RETURN; Type: RULE; Schema: public; Owner: odoo
--

CREATE OR REPLACE VIEW public.vendor_delay_report AS
 SELECT m.id,
    m.date,
    m.purchase_line_id,
    m.product_id,
    min(pc.id) AS category_id,
    min(po.partner_id) AS partner_id,
    min(m.product_qty) AS qty_total,
    sum(
        CASE
            WHEN (((m.state)::text = 'done'::text) AND ((pol.date_planned)::date >= (m.date)::date)) THEN ((ml.qty_done / ml_uom.factor) * pt_uom.factor)
            ELSE (0)::numeric
        END) AS qty_on_time
   FROM ((((((((public.stock_move m
     JOIN public.purchase_order_line pol ON ((pol.id = m.purchase_line_id)))
     JOIN public.purchase_order po ON ((po.id = pol.order_id)))
     JOIN public.product_product p ON ((p.id = m.product_id)))
     JOIN public.product_template pt ON ((pt.id = p.product_tmpl_id)))
     JOIN public.uom_uom pt_uom ON ((pt_uom.id = pt.uom_id)))
     JOIN public.product_category pc ON ((pc.id = pt.categ_id)))
     LEFT JOIN public.stock_move_line ml ON ((ml.move_id = m.id)))
     LEFT JOIN public.uom_uom ml_uom ON ((ml_uom.id = ml.product_uom_id)))
  GROUP BY m.id;


--
-- Name: account_account_account_journal_rel account_account_account_journal_rel_account_account_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_account_account_journal_rel
    ADD CONSTRAINT account_account_account_journal_rel_account_account_id_fkey FOREIGN KEY (account_account_id) REFERENCES public.account_account(id) ON DELETE CASCADE;


--
-- Name: account_account_account_journal_rel account_account_account_journal_rel_account_journal_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_account_account_journal_rel
    ADD CONSTRAINT account_account_account_journal_rel_account_journal_id_fkey FOREIGN KEY (account_journal_id) REFERENCES public.account_journal(id) ON DELETE CASCADE;


--
-- Name: account_account_account_tag account_account_account_tag_account_account_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_account_account_tag
    ADD CONSTRAINT account_account_account_tag_account_account_id_fkey FOREIGN KEY (account_account_id) REFERENCES public.account_account(id) ON DELETE CASCADE;


--
-- Name: account_account_account_tag account_account_account_tag_account_account_tag_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_account_account_tag
    ADD CONSTRAINT account_account_account_tag_account_account_tag_id_fkey FOREIGN KEY (account_account_tag_id) REFERENCES public.account_account_tag(id) ON DELETE RESTRICT;


--
-- Name: account_account account_account_company_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_account
    ADD CONSTRAINT account_account_company_id_fkey FOREIGN KEY (company_id) REFERENCES public.res_company(id) ON DELETE RESTRICT;


--
-- Name: account_account account_account_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_account
    ADD CONSTRAINT account_account_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_account account_account_currency_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_account
    ADD CONSTRAINT account_account_currency_id_fkey FOREIGN KEY (currency_id) REFERENCES public.res_currency(id) ON DELETE SET NULL;


--
-- Name: account_account account_account_group_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_account
    ADD CONSTRAINT account_account_group_id_fkey FOREIGN KEY (group_id) REFERENCES public.account_group(id) ON DELETE SET NULL;


--
-- Name: account_account account_account_message_main_attachment_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_account
    ADD CONSTRAINT account_account_message_main_attachment_id_fkey FOREIGN KEY (message_main_attachment_id) REFERENCES public.ir_attachment(id) ON DELETE SET NULL;


--
-- Name: account_account_tag_account_move_line_rel account_account_tag_account_move_li_account_account_tag_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_account_tag_account_move_line_rel
    ADD CONSTRAINT account_account_tag_account_move_li_account_account_tag_id_fkey FOREIGN KEY (account_account_tag_id) REFERENCES public.account_account_tag(id) ON DELETE RESTRICT;


--
-- Name: account_account_tag_account_move_line_rel account_account_tag_account_move_line_account_move_line_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_account_tag_account_move_line_rel
    ADD CONSTRAINT account_account_tag_account_move_line_account_move_line_id_fkey FOREIGN KEY (account_move_line_id) REFERENCES public.account_move_line(id) ON DELETE CASCADE;


--
-- Name: account_account_tag_account_tax_repartition_line_rel account_account_tag_account_t_account_tax_repartition_line_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_account_tag_account_tax_repartition_line_rel
    ADD CONSTRAINT account_account_tag_account_t_account_tax_repartition_line_fkey FOREIGN KEY (account_tax_repartition_line_id) REFERENCES public.account_tax_repartition_line(id) ON DELETE CASCADE;


--
-- Name: account_account_tag_account_tax_repartition_line_rel account_account_tag_account_tax_rep_account_account_tag_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_account_tag_account_tax_repartition_line_rel
    ADD CONSTRAINT account_account_tag_account_tax_rep_account_account_tag_id_fkey FOREIGN KEY (account_account_tag_id) REFERENCES public.account_account_tag(id) ON DELETE RESTRICT;


--
-- Name: account_account_tag account_account_tag_country_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_account_tag
    ADD CONSTRAINT account_account_tag_country_id_fkey FOREIGN KEY (country_id) REFERENCES public.res_country(id) ON DELETE SET NULL;


--
-- Name: account_account_tag account_account_tag_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_account_tag
    ADD CONSTRAINT account_account_tag_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_account_tag_product_template_rel account_account_tag_product_templat_account_account_tag_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_account_tag_product_template_rel
    ADD CONSTRAINT account_account_tag_product_templat_account_account_tag_id_fkey FOREIGN KEY (account_account_tag_id) REFERENCES public.account_account_tag(id) ON DELETE CASCADE;


--
-- Name: account_account_tag_product_template_rel account_account_tag_product_template_r_product_template_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_account_tag_product_template_rel
    ADD CONSTRAINT account_account_tag_product_template_r_product_template_id_fkey FOREIGN KEY (product_template_id) REFERENCES public.product_template(id) ON DELETE CASCADE;


--
-- Name: account_account_tag account_account_tag_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_account_tag
    ADD CONSTRAINT account_account_tag_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_account_tax_default_rel account_account_tax_default_rel_account_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_account_tax_default_rel
    ADD CONSTRAINT account_account_tax_default_rel_account_id_fkey FOREIGN KEY (account_id) REFERENCES public.account_account(id) ON DELETE CASCADE;


--
-- Name: account_account_tax_default_rel account_account_tax_default_rel_tax_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_account_tax_default_rel
    ADD CONSTRAINT account_account_tax_default_rel_tax_id_fkey FOREIGN KEY (tax_id) REFERENCES public.account_tax(id) ON DELETE CASCADE;


--
-- Name: account_account_template_account_tag account_account_template_accou_account_account_template_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_account_template_account_tag
    ADD CONSTRAINT account_account_template_accou_account_account_template_id_fkey FOREIGN KEY (account_account_template_id) REFERENCES public.account_account_template(id) ON DELETE CASCADE;


--
-- Name: account_account_template_account_tag account_account_template_account_ta_account_account_tag_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_account_template_account_tag
    ADD CONSTRAINT account_account_template_account_ta_account_account_tag_id_fkey FOREIGN KEY (account_account_tag_id) REFERENCES public.account_account_tag(id) ON DELETE CASCADE;


--
-- Name: account_account_template account_account_template_chart_template_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_account_template
    ADD CONSTRAINT account_account_template_chart_template_id_fkey FOREIGN KEY (chart_template_id) REFERENCES public.account_chart_template(id) ON DELETE SET NULL;


--
-- Name: account_account_template account_account_template_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_account_template
    ADD CONSTRAINT account_account_template_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_account_template account_account_template_currency_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_account_template
    ADD CONSTRAINT account_account_template_currency_id_fkey FOREIGN KEY (currency_id) REFERENCES public.res_currency(id) ON DELETE SET NULL;


--
-- Name: account_account_template account_account_template_message_main_attachment_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_account_template
    ADD CONSTRAINT account_account_template_message_main_attachment_id_fkey FOREIGN KEY (message_main_attachment_id) REFERENCES public.ir_attachment(id) ON DELETE SET NULL;


--
-- Name: account_account_template_tax_rel account_account_template_tax_rel_account_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_account_template_tax_rel
    ADD CONSTRAINT account_account_template_tax_rel_account_id_fkey FOREIGN KEY (account_id) REFERENCES public.account_account_template(id) ON DELETE CASCADE;


--
-- Name: account_account_template_tax_rel account_account_template_tax_rel_tax_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_account_template_tax_rel
    ADD CONSTRAINT account_account_template_tax_rel_tax_id_fkey FOREIGN KEY (tax_id) REFERENCES public.account_tax_template(id) ON DELETE CASCADE;


--
-- Name: account_account_template account_account_template_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_account_template
    ADD CONSTRAINT account_account_template_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_account account_account_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_account
    ADD CONSTRAINT account_account_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_accrued_orders_wizard account_accrued_orders_wizard_account_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_accrued_orders_wizard
    ADD CONSTRAINT account_accrued_orders_wizard_account_id_fkey FOREIGN KEY (account_id) REFERENCES public.account_account(id) ON DELETE CASCADE;


--
-- Name: account_accrued_orders_wizard account_accrued_orders_wizard_company_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_accrued_orders_wizard
    ADD CONSTRAINT account_accrued_orders_wizard_company_id_fkey FOREIGN KEY (company_id) REFERENCES public.res_company(id) ON DELETE SET NULL;


--
-- Name: account_accrued_orders_wizard account_accrued_orders_wizard_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_accrued_orders_wizard
    ADD CONSTRAINT account_accrued_orders_wizard_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_accrued_orders_wizard account_accrued_orders_wizard_currency_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_accrued_orders_wizard
    ADD CONSTRAINT account_accrued_orders_wizard_currency_id_fkey FOREIGN KEY (currency_id) REFERENCES public.res_currency(id) ON DELETE SET NULL;


--
-- Name: account_accrued_orders_wizard account_accrued_orders_wizard_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_accrued_orders_wizard
    ADD CONSTRAINT account_accrued_orders_wizard_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_analytic_account account_analytic_account_company_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_analytic_account
    ADD CONSTRAINT account_analytic_account_company_id_fkey FOREIGN KEY (company_id) REFERENCES public.res_company(id) ON DELETE SET NULL;


--
-- Name: account_analytic_account account_analytic_account_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_analytic_account
    ADD CONSTRAINT account_analytic_account_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_analytic_account account_analytic_account_message_main_attachment_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_analytic_account
    ADD CONSTRAINT account_analytic_account_message_main_attachment_id_fkey FOREIGN KEY (message_main_attachment_id) REFERENCES public.ir_attachment(id) ON DELETE SET NULL;


--
-- Name: account_analytic_account account_analytic_account_partner_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_analytic_account
    ADD CONSTRAINT account_analytic_account_partner_id_fkey FOREIGN KEY (partner_id) REFERENCES public.res_partner(id) ON DELETE SET NULL;


--
-- Name: account_analytic_account account_analytic_account_plan_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_analytic_account
    ADD CONSTRAINT account_analytic_account_plan_id_fkey FOREIGN KEY (plan_id) REFERENCES public.account_analytic_plan(id) ON DELETE RESTRICT;


--
-- Name: account_analytic_account account_analytic_account_root_plan_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_analytic_account
    ADD CONSTRAINT account_analytic_account_root_plan_id_fkey FOREIGN KEY (root_plan_id) REFERENCES public.account_analytic_plan(id) ON DELETE SET NULL;


--
-- Name: account_analytic_account account_analytic_account_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_analytic_account
    ADD CONSTRAINT account_analytic_account_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_analytic_applicability account_analytic_applicability_analytic_plan_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_analytic_applicability
    ADD CONSTRAINT account_analytic_applicability_analytic_plan_id_fkey FOREIGN KEY (analytic_plan_id) REFERENCES public.account_analytic_plan(id) ON DELETE SET NULL;


--
-- Name: account_analytic_applicability account_analytic_applicability_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_analytic_applicability
    ADD CONSTRAINT account_analytic_applicability_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_analytic_applicability account_analytic_applicability_product_categ_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_analytic_applicability
    ADD CONSTRAINT account_analytic_applicability_product_categ_id_fkey FOREIGN KEY (product_categ_id) REFERENCES public.product_category(id) ON DELETE SET NULL;


--
-- Name: account_analytic_applicability account_analytic_applicability_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_analytic_applicability
    ADD CONSTRAINT account_analytic_applicability_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_analytic_distribution_model account_analytic_distribution_model_company_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_analytic_distribution_model
    ADD CONSTRAINT account_analytic_distribution_model_company_id_fkey FOREIGN KEY (company_id) REFERENCES public.res_company(id) ON DELETE CASCADE;


--
-- Name: account_analytic_distribution_model account_analytic_distribution_model_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_analytic_distribution_model
    ADD CONSTRAINT account_analytic_distribution_model_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_analytic_distribution_model account_analytic_distribution_model_partner_category_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_analytic_distribution_model
    ADD CONSTRAINT account_analytic_distribution_model_partner_category_id_fkey FOREIGN KEY (partner_category_id) REFERENCES public.res_partner_category(id) ON DELETE CASCADE;


--
-- Name: account_analytic_distribution_model account_analytic_distribution_model_partner_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_analytic_distribution_model
    ADD CONSTRAINT account_analytic_distribution_model_partner_id_fkey FOREIGN KEY (partner_id) REFERENCES public.res_partner(id) ON DELETE CASCADE;


--
-- Name: account_analytic_distribution_model account_analytic_distribution_model_product_categ_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_analytic_distribution_model
    ADD CONSTRAINT account_analytic_distribution_model_product_categ_id_fkey FOREIGN KEY (product_categ_id) REFERENCES public.product_category(id) ON DELETE CASCADE;


--
-- Name: account_analytic_distribution_model account_analytic_distribution_model_product_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_analytic_distribution_model
    ADD CONSTRAINT account_analytic_distribution_model_product_id_fkey FOREIGN KEY (product_id) REFERENCES public.product_product(id) ON DELETE CASCADE;


--
-- Name: account_analytic_distribution_model account_analytic_distribution_model_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_analytic_distribution_model
    ADD CONSTRAINT account_analytic_distribution_model_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_analytic_line account_analytic_line_account_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_analytic_line
    ADD CONSTRAINT account_analytic_line_account_id_fkey FOREIGN KEY (account_id) REFERENCES public.account_analytic_account(id) ON DELETE RESTRICT;


--
-- Name: account_analytic_line account_analytic_line_company_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_analytic_line
    ADD CONSTRAINT account_analytic_line_company_id_fkey FOREIGN KEY (company_id) REFERENCES public.res_company(id) ON DELETE RESTRICT;


--
-- Name: account_analytic_line account_analytic_line_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_analytic_line
    ADD CONSTRAINT account_analytic_line_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_analytic_line account_analytic_line_currency_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_analytic_line
    ADD CONSTRAINT account_analytic_line_currency_id_fkey FOREIGN KEY (currency_id) REFERENCES public.res_currency(id) ON DELETE SET NULL;


--
-- Name: account_analytic_line account_analytic_line_general_account_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_analytic_line
    ADD CONSTRAINT account_analytic_line_general_account_id_fkey FOREIGN KEY (general_account_id) REFERENCES public.account_account(id) ON DELETE RESTRICT;


--
-- Name: account_analytic_line account_analytic_line_journal_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_analytic_line
    ADD CONSTRAINT account_analytic_line_journal_id_fkey FOREIGN KEY (journal_id) REFERENCES public.account_journal(id) ON DELETE SET NULL;


--
-- Name: account_analytic_line account_analytic_line_move_line_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_analytic_line
    ADD CONSTRAINT account_analytic_line_move_line_id_fkey FOREIGN KEY (move_line_id) REFERENCES public.account_move_line(id) ON DELETE CASCADE;


--
-- Name: account_analytic_line account_analytic_line_partner_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_analytic_line
    ADD CONSTRAINT account_analytic_line_partner_id_fkey FOREIGN KEY (partner_id) REFERENCES public.res_partner(id) ON DELETE SET NULL;


--
-- Name: account_analytic_line account_analytic_line_plan_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_analytic_line
    ADD CONSTRAINT account_analytic_line_plan_id_fkey FOREIGN KEY (plan_id) REFERENCES public.account_analytic_plan(id) ON DELETE SET NULL;


--
-- Name: account_analytic_line account_analytic_line_product_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_analytic_line
    ADD CONSTRAINT account_analytic_line_product_id_fkey FOREIGN KEY (product_id) REFERENCES public.product_product(id) ON DELETE SET NULL;


--
-- Name: account_analytic_line account_analytic_line_product_uom_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_analytic_line
    ADD CONSTRAINT account_analytic_line_product_uom_id_fkey FOREIGN KEY (product_uom_id) REFERENCES public.uom_uom(id) ON DELETE SET NULL;


--
-- Name: account_analytic_line account_analytic_line_so_line_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_analytic_line
    ADD CONSTRAINT account_analytic_line_so_line_fkey FOREIGN KEY (so_line) REFERENCES public.sale_order_line(id) ON DELETE SET NULL;


--
-- Name: account_analytic_line account_analytic_line_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_analytic_line
    ADD CONSTRAINT account_analytic_line_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_analytic_line account_analytic_line_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_analytic_line
    ADD CONSTRAINT account_analytic_line_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_analytic_plan account_analytic_plan_company_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_analytic_plan
    ADD CONSTRAINT account_analytic_plan_company_id_fkey FOREIGN KEY (company_id) REFERENCES public.res_company(id) ON DELETE SET NULL;


--
-- Name: account_analytic_plan account_analytic_plan_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_analytic_plan
    ADD CONSTRAINT account_analytic_plan_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_analytic_plan account_analytic_plan_parent_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_analytic_plan
    ADD CONSTRAINT account_analytic_plan_parent_id_fkey FOREIGN KEY (parent_id) REFERENCES public.account_analytic_plan(id) ON DELETE CASCADE;


--
-- Name: account_analytic_plan account_analytic_plan_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_analytic_plan
    ADD CONSTRAINT account_analytic_plan_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_automatic_entry_wizard_account_move_line_rel account_automatic_entry_wizar_account_automatic_entry_wiza_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_automatic_entry_wizard_account_move_line_rel
    ADD CONSTRAINT account_automatic_entry_wizar_account_automatic_entry_wiza_fkey FOREIGN KEY (account_automatic_entry_wizard_id) REFERENCES public.account_automatic_entry_wizard(id) ON DELETE CASCADE;


--
-- Name: account_automatic_entry_wizard_account_move_line_rel account_automatic_entry_wizard_accoun_account_move_line_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_automatic_entry_wizard_account_move_line_rel
    ADD CONSTRAINT account_automatic_entry_wizard_accoun_account_move_line_id_fkey FOREIGN KEY (account_move_line_id) REFERENCES public.account_move_line(id) ON DELETE CASCADE;


--
-- Name: account_automatic_entry_wizard account_automatic_entry_wizard_company_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_automatic_entry_wizard
    ADD CONSTRAINT account_automatic_entry_wizard_company_id_fkey FOREIGN KEY (company_id) REFERENCES public.res_company(id) ON DELETE CASCADE;


--
-- Name: account_automatic_entry_wizard account_automatic_entry_wizard_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_automatic_entry_wizard
    ADD CONSTRAINT account_automatic_entry_wizard_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_automatic_entry_wizard account_automatic_entry_wizard_destination_account_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_automatic_entry_wizard
    ADD CONSTRAINT account_automatic_entry_wizard_destination_account_id_fkey FOREIGN KEY (destination_account_id) REFERENCES public.account_account(id) ON DELETE SET NULL;


--
-- Name: account_automatic_entry_wizard account_automatic_entry_wizard_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_automatic_entry_wizard
    ADD CONSTRAINT account_automatic_entry_wizard_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_bank_statement account_bank_statement_company_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_bank_statement
    ADD CONSTRAINT account_bank_statement_company_id_fkey FOREIGN KEY (company_id) REFERENCES public.res_company(id) ON DELETE SET NULL;


--
-- Name: account_bank_statement account_bank_statement_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_bank_statement
    ADD CONSTRAINT account_bank_statement_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_bank_statement_ir_attachment_rel account_bank_statement_ir_attach_account_bank_statement_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_bank_statement_ir_attachment_rel
    ADD CONSTRAINT account_bank_statement_ir_attach_account_bank_statement_id_fkey FOREIGN KEY (account_bank_statement_id) REFERENCES public.account_bank_statement(id) ON DELETE CASCADE;


--
-- Name: account_bank_statement_ir_attachment_rel account_bank_statement_ir_attachment_rel_ir_attachment_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_bank_statement_ir_attachment_rel
    ADD CONSTRAINT account_bank_statement_ir_attachment_rel_ir_attachment_id_fkey FOREIGN KEY (ir_attachment_id) REFERENCES public.ir_attachment(id) ON DELETE CASCADE;


--
-- Name: account_bank_statement account_bank_statement_journal_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_bank_statement
    ADD CONSTRAINT account_bank_statement_journal_id_fkey FOREIGN KEY (journal_id) REFERENCES public.account_journal(id) ON DELETE SET NULL;


--
-- Name: account_bank_statement_line account_bank_statement_line_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_bank_statement_line
    ADD CONSTRAINT account_bank_statement_line_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_bank_statement_line account_bank_statement_line_currency_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_bank_statement_line
    ADD CONSTRAINT account_bank_statement_line_currency_id_fkey FOREIGN KEY (currency_id) REFERENCES public.res_currency(id) ON DELETE SET NULL;


--
-- Name: account_bank_statement_line account_bank_statement_line_foreign_currency_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_bank_statement_line
    ADD CONSTRAINT account_bank_statement_line_foreign_currency_id_fkey FOREIGN KEY (foreign_currency_id) REFERENCES public.res_currency(id) ON DELETE SET NULL;


--
-- Name: account_bank_statement_line account_bank_statement_line_move_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_bank_statement_line
    ADD CONSTRAINT account_bank_statement_line_move_id_fkey FOREIGN KEY (move_id) REFERENCES public.account_move(id) ON DELETE CASCADE;


--
-- Name: account_bank_statement_line account_bank_statement_line_partner_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_bank_statement_line
    ADD CONSTRAINT account_bank_statement_line_partner_id_fkey FOREIGN KEY (partner_id) REFERENCES public.res_partner(id) ON DELETE RESTRICT;


--
-- Name: account_bank_statement_line account_bank_statement_line_statement_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_bank_statement_line
    ADD CONSTRAINT account_bank_statement_line_statement_id_fkey FOREIGN KEY (statement_id) REFERENCES public.account_bank_statement(id) ON DELETE SET NULL;


--
-- Name: account_bank_statement_line account_bank_statement_line_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_bank_statement_line
    ADD CONSTRAINT account_bank_statement_line_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_bank_statement account_bank_statement_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_bank_statement
    ADD CONSTRAINT account_bank_statement_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_cash_rounding account_cash_rounding_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_cash_rounding
    ADD CONSTRAINT account_cash_rounding_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_cash_rounding account_cash_rounding_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_cash_rounding
    ADD CONSTRAINT account_cash_rounding_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_chart_template account_chart_template_account_journal_early_pay_discount__fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_chart_template
    ADD CONSTRAINT account_chart_template_account_journal_early_pay_discount__fkey FOREIGN KEY (account_journal_early_pay_discount_loss_account_id) REFERENCES public.account_account_template(id) ON DELETE SET NULL;


--
-- Name: account_chart_template account_chart_template_account_journal_early_pay_discount_fkey1; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_chart_template
    ADD CONSTRAINT account_chart_template_account_journal_early_pay_discount_fkey1 FOREIGN KEY (account_journal_early_pay_discount_gain_account_id) REFERENCES public.account_account_template(id) ON DELETE SET NULL;


--
-- Name: account_chart_template account_chart_template_account_journal_payment_credit_acco_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_chart_template
    ADD CONSTRAINT account_chart_template_account_journal_payment_credit_acco_fkey FOREIGN KEY (account_journal_payment_credit_account_id) REFERENCES public.account_account_template(id) ON DELETE SET NULL;


--
-- Name: account_chart_template account_chart_template_account_journal_payment_debit_accou_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_chart_template
    ADD CONSTRAINT account_chart_template_account_journal_payment_debit_accou_fkey FOREIGN KEY (account_journal_payment_debit_account_id) REFERENCES public.account_account_template(id) ON DELETE SET NULL;


--
-- Name: account_chart_template account_chart_template_account_journal_suspense_account_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_chart_template
    ADD CONSTRAINT account_chart_template_account_journal_suspense_account_id_fkey FOREIGN KEY (account_journal_suspense_account_id) REFERENCES public.account_account_template(id) ON DELETE SET NULL;


--
-- Name: account_chart_template account_chart_template_country_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_chart_template
    ADD CONSTRAINT account_chart_template_country_id_fkey FOREIGN KEY (country_id) REFERENCES public.res_country(id) ON DELETE SET NULL;


--
-- Name: account_chart_template account_chart_template_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_chart_template
    ADD CONSTRAINT account_chart_template_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_chart_template account_chart_template_currency_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_chart_template
    ADD CONSTRAINT account_chart_template_currency_id_fkey FOREIGN KEY (currency_id) REFERENCES public.res_currency(id) ON DELETE RESTRICT;


--
-- Name: account_chart_template account_chart_template_default_cash_difference_expense_acc_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_chart_template
    ADD CONSTRAINT account_chart_template_default_cash_difference_expense_acc_fkey FOREIGN KEY (default_cash_difference_expense_account_id) REFERENCES public.account_account_template(id) ON DELETE SET NULL;


--
-- Name: account_chart_template account_chart_template_default_cash_difference_income_acco_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_chart_template
    ADD CONSTRAINT account_chart_template_default_cash_difference_income_acco_fkey FOREIGN KEY (default_cash_difference_income_account_id) REFERENCES public.account_account_template(id) ON DELETE SET NULL;


--
-- Name: account_chart_template account_chart_template_default_pos_receivable_account_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_chart_template
    ADD CONSTRAINT account_chart_template_default_pos_receivable_account_id_fkey FOREIGN KEY (default_pos_receivable_account_id) REFERENCES public.account_account_template(id) ON DELETE SET NULL;


--
-- Name: account_chart_template account_chart_template_expense_currency_exchange_account_i_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_chart_template
    ADD CONSTRAINT account_chart_template_expense_currency_exchange_account_i_fkey FOREIGN KEY (expense_currency_exchange_account_id) REFERENCES public.account_account_template(id) ON DELETE SET NULL;


--
-- Name: account_chart_template account_chart_template_income_currency_exchange_account_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_chart_template
    ADD CONSTRAINT account_chart_template_income_currency_exchange_account_id_fkey FOREIGN KEY (income_currency_exchange_account_id) REFERENCES public.account_account_template(id) ON DELETE SET NULL;


--
-- Name: account_chart_template account_chart_template_parent_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_chart_template
    ADD CONSTRAINT account_chart_template_parent_id_fkey FOREIGN KEY (parent_id) REFERENCES public.account_chart_template(id) ON DELETE SET NULL;


--
-- Name: account_chart_template account_chart_template_property_account_expense_categ_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_chart_template
    ADD CONSTRAINT account_chart_template_property_account_expense_categ_id_fkey FOREIGN KEY (property_account_expense_categ_id) REFERENCES public.account_account_template(id) ON DELETE SET NULL;


--
-- Name: account_chart_template account_chart_template_property_account_expense_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_chart_template
    ADD CONSTRAINT account_chart_template_property_account_expense_id_fkey FOREIGN KEY (property_account_expense_id) REFERENCES public.account_account_template(id) ON DELETE SET NULL;


--
-- Name: account_chart_template account_chart_template_property_account_income_categ_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_chart_template
    ADD CONSTRAINT account_chart_template_property_account_income_categ_id_fkey FOREIGN KEY (property_account_income_categ_id) REFERENCES public.account_account_template(id) ON DELETE SET NULL;


--
-- Name: account_chart_template account_chart_template_property_account_income_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_chart_template
    ADD CONSTRAINT account_chart_template_property_account_income_id_fkey FOREIGN KEY (property_account_income_id) REFERENCES public.account_account_template(id) ON DELETE SET NULL;


--
-- Name: account_chart_template account_chart_template_property_account_payable_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_chart_template
    ADD CONSTRAINT account_chart_template_property_account_payable_id_fkey FOREIGN KEY (property_account_payable_id) REFERENCES public.account_account_template(id) ON DELETE SET NULL;


--
-- Name: account_chart_template account_chart_template_property_account_receivable_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_chart_template
    ADD CONSTRAINT account_chart_template_property_account_receivable_id_fkey FOREIGN KEY (property_account_receivable_id) REFERENCES public.account_account_template(id) ON DELETE SET NULL;


--
-- Name: account_chart_template account_chart_template_property_advance_tax_payment_accoun_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_chart_template
    ADD CONSTRAINT account_chart_template_property_advance_tax_payment_accoun_fkey FOREIGN KEY (property_advance_tax_payment_account_id) REFERENCES public.account_account_template(id) ON DELETE SET NULL;


--
-- Name: account_chart_template account_chart_template_property_cash_basis_base_account_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_chart_template
    ADD CONSTRAINT account_chart_template_property_cash_basis_base_account_id_fkey FOREIGN KEY (property_cash_basis_base_account_id) REFERENCES public.account_account_template(id) ON DELETE SET NULL;


--
-- Name: account_chart_template account_chart_template_property_stock_account_input_categ__fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_chart_template
    ADD CONSTRAINT account_chart_template_property_stock_account_input_categ__fkey FOREIGN KEY (property_stock_account_input_categ_id) REFERENCES public.account_account_template(id) ON DELETE SET NULL;


--
-- Name: account_chart_template account_chart_template_property_stock_account_output_categ_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_chart_template
    ADD CONSTRAINT account_chart_template_property_stock_account_output_categ_fkey FOREIGN KEY (property_stock_account_output_categ_id) REFERENCES public.account_account_template(id) ON DELETE SET NULL;


--
-- Name: account_chart_template account_chart_template_property_stock_valuation_account_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_chart_template
    ADD CONSTRAINT account_chart_template_property_stock_valuation_account_id_fkey FOREIGN KEY (property_stock_valuation_account_id) REFERENCES public.account_account_template(id) ON DELETE SET NULL;


--
-- Name: account_chart_template account_chart_template_property_tax_payable_account_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_chart_template
    ADD CONSTRAINT account_chart_template_property_tax_payable_account_id_fkey FOREIGN KEY (property_tax_payable_account_id) REFERENCES public.account_account_template(id) ON DELETE SET NULL;


--
-- Name: account_chart_template account_chart_template_property_tax_receivable_account_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_chart_template
    ADD CONSTRAINT account_chart_template_property_tax_receivable_account_id_fkey FOREIGN KEY (property_tax_receivable_account_id) REFERENCES public.account_account_template(id) ON DELETE SET NULL;


--
-- Name: account_chart_template account_chart_template_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_chart_template
    ADD CONSTRAINT account_chart_template_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_edi_document account_edi_document_attachment_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_edi_document
    ADD CONSTRAINT account_edi_document_attachment_id_fkey FOREIGN KEY (attachment_id) REFERENCES public.ir_attachment(id) ON DELETE SET NULL;


--
-- Name: account_edi_document account_edi_document_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_edi_document
    ADD CONSTRAINT account_edi_document_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_edi_document account_edi_document_edi_format_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_edi_document
    ADD CONSTRAINT account_edi_document_edi_format_id_fkey FOREIGN KEY (edi_format_id) REFERENCES public.account_edi_format(id) ON DELETE RESTRICT;


--
-- Name: account_edi_document account_edi_document_move_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_edi_document
    ADD CONSTRAINT account_edi_document_move_id_fkey FOREIGN KEY (move_id) REFERENCES public.account_move(id) ON DELETE CASCADE;


--
-- Name: account_edi_document account_edi_document_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_edi_document
    ADD CONSTRAINT account_edi_document_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_edi_format_account_journal_rel account_edi_format_account_journal_r_account_edi_format_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_edi_format_account_journal_rel
    ADD CONSTRAINT account_edi_format_account_journal_r_account_edi_format_id_fkey FOREIGN KEY (account_edi_format_id) REFERENCES public.account_edi_format(id) ON DELETE CASCADE;


--
-- Name: account_edi_format_account_journal_rel account_edi_format_account_journal_rel_account_journal_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_edi_format_account_journal_rel
    ADD CONSTRAINT account_edi_format_account_journal_rel_account_journal_id_fkey FOREIGN KEY (account_journal_id) REFERENCES public.account_journal(id) ON DELETE CASCADE;


--
-- Name: account_edi_format account_edi_format_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_edi_format
    ADD CONSTRAINT account_edi_format_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_edi_format account_edi_format_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_edi_format
    ADD CONSTRAINT account_edi_format_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_financial_year_op account_financial_year_op_company_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_financial_year_op
    ADD CONSTRAINT account_financial_year_op_company_id_fkey FOREIGN KEY (company_id) REFERENCES public.res_company(id) ON DELETE CASCADE;


--
-- Name: account_financial_year_op account_financial_year_op_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_financial_year_op
    ADD CONSTRAINT account_financial_year_op_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_financial_year_op account_financial_year_op_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_financial_year_op
    ADD CONSTRAINT account_financial_year_op_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_fiscal_position_account account_fiscal_position_account_account_dest_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_fiscal_position_account
    ADD CONSTRAINT account_fiscal_position_account_account_dest_id_fkey FOREIGN KEY (account_dest_id) REFERENCES public.account_account(id) ON DELETE RESTRICT;


--
-- Name: account_fiscal_position_account account_fiscal_position_account_account_src_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_fiscal_position_account
    ADD CONSTRAINT account_fiscal_position_account_account_src_id_fkey FOREIGN KEY (account_src_id) REFERENCES public.account_account(id) ON DELETE RESTRICT;


--
-- Name: account_fiscal_position_account account_fiscal_position_account_company_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_fiscal_position_account
    ADD CONSTRAINT account_fiscal_position_account_company_id_fkey FOREIGN KEY (company_id) REFERENCES public.res_company(id) ON DELETE SET NULL;


--
-- Name: account_fiscal_position_account account_fiscal_position_account_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_fiscal_position_account
    ADD CONSTRAINT account_fiscal_position_account_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_fiscal_position_account account_fiscal_position_account_position_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_fiscal_position_account
    ADD CONSTRAINT account_fiscal_position_account_position_id_fkey FOREIGN KEY (position_id) REFERENCES public.account_fiscal_position(id) ON DELETE CASCADE;


--
-- Name: account_fiscal_position_account_template account_fiscal_position_account_template_account_dest_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_fiscal_position_account_template
    ADD CONSTRAINT account_fiscal_position_account_template_account_dest_id_fkey FOREIGN KEY (account_dest_id) REFERENCES public.account_account_template(id) ON DELETE RESTRICT;


--
-- Name: account_fiscal_position_account_template account_fiscal_position_account_template_account_src_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_fiscal_position_account_template
    ADD CONSTRAINT account_fiscal_position_account_template_account_src_id_fkey FOREIGN KEY (account_src_id) REFERENCES public.account_account_template(id) ON DELETE RESTRICT;


--
-- Name: account_fiscal_position_account_template account_fiscal_position_account_template_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_fiscal_position_account_template
    ADD CONSTRAINT account_fiscal_position_account_template_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_fiscal_position_account_template account_fiscal_position_account_template_position_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_fiscal_position_account_template
    ADD CONSTRAINT account_fiscal_position_account_template_position_id_fkey FOREIGN KEY (position_id) REFERENCES public.account_fiscal_position_template(id) ON DELETE CASCADE;


--
-- Name: account_fiscal_position_account_template account_fiscal_position_account_template_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_fiscal_position_account_template
    ADD CONSTRAINT account_fiscal_position_account_template_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_fiscal_position_account account_fiscal_position_account_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_fiscal_position_account
    ADD CONSTRAINT account_fiscal_position_account_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_fiscal_position account_fiscal_position_company_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_fiscal_position
    ADD CONSTRAINT account_fiscal_position_company_id_fkey FOREIGN KEY (company_id) REFERENCES public.res_company(id) ON DELETE RESTRICT;


--
-- Name: account_fiscal_position account_fiscal_position_country_group_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_fiscal_position
    ADD CONSTRAINT account_fiscal_position_country_group_id_fkey FOREIGN KEY (country_group_id) REFERENCES public.res_country_group(id) ON DELETE SET NULL;


--
-- Name: account_fiscal_position account_fiscal_position_country_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_fiscal_position
    ADD CONSTRAINT account_fiscal_position_country_id_fkey FOREIGN KEY (country_id) REFERENCES public.res_country(id) ON DELETE SET NULL;


--
-- Name: account_fiscal_position account_fiscal_position_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_fiscal_position
    ADD CONSTRAINT account_fiscal_position_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_fiscal_position_res_country_state_rel account_fiscal_position_res_cou_account_fiscal_position_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_fiscal_position_res_country_state_rel
    ADD CONSTRAINT account_fiscal_position_res_cou_account_fiscal_position_id_fkey FOREIGN KEY (account_fiscal_position_id) REFERENCES public.account_fiscal_position(id) ON DELETE CASCADE;


--
-- Name: account_fiscal_position_res_country_state_rel account_fiscal_position_res_country_s_res_country_state_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_fiscal_position_res_country_state_rel
    ADD CONSTRAINT account_fiscal_position_res_country_s_res_country_state_id_fkey FOREIGN KEY (res_country_state_id) REFERENCES public.res_country_state(id) ON DELETE CASCADE;


--
-- Name: account_fiscal_position_tax account_fiscal_position_tax_company_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_fiscal_position_tax
    ADD CONSTRAINT account_fiscal_position_tax_company_id_fkey FOREIGN KEY (company_id) REFERENCES public.res_company(id) ON DELETE SET NULL;


--
-- Name: account_fiscal_position_tax account_fiscal_position_tax_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_fiscal_position_tax
    ADD CONSTRAINT account_fiscal_position_tax_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_fiscal_position_tax account_fiscal_position_tax_position_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_fiscal_position_tax
    ADD CONSTRAINT account_fiscal_position_tax_position_id_fkey FOREIGN KEY (position_id) REFERENCES public.account_fiscal_position(id) ON DELETE CASCADE;


--
-- Name: account_fiscal_position_tax account_fiscal_position_tax_tax_dest_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_fiscal_position_tax
    ADD CONSTRAINT account_fiscal_position_tax_tax_dest_id_fkey FOREIGN KEY (tax_dest_id) REFERENCES public.account_tax(id) ON DELETE SET NULL;


--
-- Name: account_fiscal_position_tax account_fiscal_position_tax_tax_src_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_fiscal_position_tax
    ADD CONSTRAINT account_fiscal_position_tax_tax_src_id_fkey FOREIGN KEY (tax_src_id) REFERENCES public.account_tax(id) ON DELETE RESTRICT;


--
-- Name: account_fiscal_position_tax_template account_fiscal_position_tax_template_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_fiscal_position_tax_template
    ADD CONSTRAINT account_fiscal_position_tax_template_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_fiscal_position_tax_template account_fiscal_position_tax_template_position_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_fiscal_position_tax_template
    ADD CONSTRAINT account_fiscal_position_tax_template_position_id_fkey FOREIGN KEY (position_id) REFERENCES public.account_fiscal_position_template(id) ON DELETE CASCADE;


--
-- Name: account_fiscal_position_tax_template account_fiscal_position_tax_template_tax_dest_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_fiscal_position_tax_template
    ADD CONSTRAINT account_fiscal_position_tax_template_tax_dest_id_fkey FOREIGN KEY (tax_dest_id) REFERENCES public.account_tax_template(id) ON DELETE SET NULL;


--
-- Name: account_fiscal_position_tax_template account_fiscal_position_tax_template_tax_src_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_fiscal_position_tax_template
    ADD CONSTRAINT account_fiscal_position_tax_template_tax_src_id_fkey FOREIGN KEY (tax_src_id) REFERENCES public.account_tax_template(id) ON DELETE RESTRICT;


--
-- Name: account_fiscal_position_tax_template account_fiscal_position_tax_template_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_fiscal_position_tax_template
    ADD CONSTRAINT account_fiscal_position_tax_template_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_fiscal_position_tax account_fiscal_position_tax_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_fiscal_position_tax
    ADD CONSTRAINT account_fiscal_position_tax_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_fiscal_position_template_res_country_state_rel account_fiscal_position_templ_account_fiscal_position_temp_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_fiscal_position_template_res_country_state_rel
    ADD CONSTRAINT account_fiscal_position_templ_account_fiscal_position_temp_fkey FOREIGN KEY (account_fiscal_position_template_id) REFERENCES public.account_fiscal_position_template(id) ON DELETE CASCADE;


--
-- Name: account_fiscal_position_template account_fiscal_position_template_chart_template_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_fiscal_position_template
    ADD CONSTRAINT account_fiscal_position_template_chart_template_id_fkey FOREIGN KEY (chart_template_id) REFERENCES public.account_chart_template(id) ON DELETE RESTRICT;


--
-- Name: account_fiscal_position_template account_fiscal_position_template_country_group_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_fiscal_position_template
    ADD CONSTRAINT account_fiscal_position_template_country_group_id_fkey FOREIGN KEY (country_group_id) REFERENCES public.res_country_group(id) ON DELETE SET NULL;


--
-- Name: account_fiscal_position_template account_fiscal_position_template_country_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_fiscal_position_template
    ADD CONSTRAINT account_fiscal_position_template_country_id_fkey FOREIGN KEY (country_id) REFERENCES public.res_country(id) ON DELETE SET NULL;


--
-- Name: account_fiscal_position_template account_fiscal_position_template_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_fiscal_position_template
    ADD CONSTRAINT account_fiscal_position_template_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_fiscal_position_template_res_country_state_rel account_fiscal_position_template_res__res_country_state_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_fiscal_position_template_res_country_state_rel
    ADD CONSTRAINT account_fiscal_position_template_res__res_country_state_id_fkey FOREIGN KEY (res_country_state_id) REFERENCES public.res_country_state(id) ON DELETE CASCADE;


--
-- Name: account_fiscal_position_template account_fiscal_position_template_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_fiscal_position_template
    ADD CONSTRAINT account_fiscal_position_template_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_fiscal_position account_fiscal_position_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_fiscal_position
    ADD CONSTRAINT account_fiscal_position_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_full_reconcile account_full_reconcile_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_full_reconcile
    ADD CONSTRAINT account_full_reconcile_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_full_reconcile account_full_reconcile_exchange_move_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_full_reconcile
    ADD CONSTRAINT account_full_reconcile_exchange_move_id_fkey FOREIGN KEY (exchange_move_id) REFERENCES public.account_move(id) ON DELETE SET NULL;


--
-- Name: account_full_reconcile account_full_reconcile_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_full_reconcile
    ADD CONSTRAINT account_full_reconcile_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_group account_group_company_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_group
    ADD CONSTRAINT account_group_company_id_fkey FOREIGN KEY (company_id) REFERENCES public.res_company(id) ON DELETE RESTRICT;


--
-- Name: account_group account_group_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_group
    ADD CONSTRAINT account_group_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_group account_group_parent_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_group
    ADD CONSTRAINT account_group_parent_id_fkey FOREIGN KEY (parent_id) REFERENCES public.account_group(id) ON DELETE CASCADE;


--
-- Name: account_group_template account_group_template_chart_template_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_group_template
    ADD CONSTRAINT account_group_template_chart_template_id_fkey FOREIGN KEY (chart_template_id) REFERENCES public.account_chart_template(id) ON DELETE RESTRICT;


--
-- Name: account_group_template account_group_template_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_group_template
    ADD CONSTRAINT account_group_template_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_group_template account_group_template_parent_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_group_template
    ADD CONSTRAINT account_group_template_parent_id_fkey FOREIGN KEY (parent_id) REFERENCES public.account_group_template(id) ON DELETE CASCADE;


--
-- Name: account_group_template account_group_template_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_group_template
    ADD CONSTRAINT account_group_template_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_group account_group_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_group
    ADD CONSTRAINT account_group_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_incoterms account_incoterms_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_incoterms
    ADD CONSTRAINT account_incoterms_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_incoterms account_incoterms_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_incoterms
    ADD CONSTRAINT account_incoterms_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_invoice_send account_invoice_send_composer_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_invoice_send
    ADD CONSTRAINT account_invoice_send_composer_id_fkey FOREIGN KEY (composer_id) REFERENCES public.mail_compose_message(id) ON DELETE CASCADE;


--
-- Name: account_invoice_send account_invoice_send_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_invoice_send
    ADD CONSTRAINT account_invoice_send_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_invoice_send account_invoice_send_template_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_invoice_send
    ADD CONSTRAINT account_invoice_send_template_id_fkey FOREIGN KEY (template_id) REFERENCES public.mail_template(id) ON DELETE SET NULL;


--
-- Name: account_invoice_send account_invoice_send_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_invoice_send
    ADD CONSTRAINT account_invoice_send_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_invoice_transaction_rel account_invoice_transaction_rel_invoice_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_invoice_transaction_rel
    ADD CONSTRAINT account_invoice_transaction_rel_invoice_id_fkey FOREIGN KEY (invoice_id) REFERENCES public.account_move(id) ON DELETE CASCADE;


--
-- Name: account_invoice_transaction_rel account_invoice_transaction_rel_transaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_invoice_transaction_rel
    ADD CONSTRAINT account_invoice_transaction_rel_transaction_id_fkey FOREIGN KEY (transaction_id) REFERENCES public.payment_transaction(id) ON DELETE CASCADE;


--
-- Name: account_journal_account_journal_group_rel account_journal_account_journal_g_account_journal_group_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_journal_account_journal_group_rel
    ADD CONSTRAINT account_journal_account_journal_g_account_journal_group_id_fkey FOREIGN KEY (account_journal_group_id) REFERENCES public.account_journal_group(id) ON DELETE CASCADE;


--
-- Name: account_journal_account_journal_group_rel account_journal_account_journal_group_r_account_journal_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_journal_account_journal_group_rel
    ADD CONSTRAINT account_journal_account_journal_group_r_account_journal_id_fkey FOREIGN KEY (account_journal_id) REFERENCES public.account_journal(id) ON DELETE CASCADE;


--
-- Name: account_journal_account_reconcile_model_template_rel account_journal_account_recon_account_reconcile_model_temp_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_journal_account_reconcile_model_template_rel
    ADD CONSTRAINT account_journal_account_recon_account_reconcile_model_temp_fkey FOREIGN KEY (account_reconcile_model_template_id) REFERENCES public.account_reconcile_model_template(id) ON DELETE CASCADE;


--
-- Name: account_journal_account_reconcile_model_rel account_journal_account_reconci_account_reconcile_model_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_journal_account_reconcile_model_rel
    ADD CONSTRAINT account_journal_account_reconci_account_reconcile_model_id_fkey FOREIGN KEY (account_reconcile_model_id) REFERENCES public.account_reconcile_model(id) ON DELETE CASCADE;


--
-- Name: account_journal_account_reconcile_model_template_rel account_journal_account_reconcile_mode_account_journal_id_fkey1; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_journal_account_reconcile_model_template_rel
    ADD CONSTRAINT account_journal_account_reconcile_mode_account_journal_id_fkey1 FOREIGN KEY (account_journal_id) REFERENCES public.account_journal(id) ON DELETE CASCADE;


--
-- Name: account_journal_account_reconcile_model_rel account_journal_account_reconcile_model_account_journal_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_journal_account_reconcile_model_rel
    ADD CONSTRAINT account_journal_account_reconcile_model_account_journal_id_fkey FOREIGN KEY (account_journal_id) REFERENCES public.account_journal(id) ON DELETE CASCADE;


--
-- Name: account_journal account_journal_alias_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_journal
    ADD CONSTRAINT account_journal_alias_id_fkey FOREIGN KEY (alias_id) REFERENCES public.mail_alias(id) ON DELETE SET NULL;


--
-- Name: account_journal account_journal_bank_account_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_journal
    ADD CONSTRAINT account_journal_bank_account_id_fkey FOREIGN KEY (bank_account_id) REFERENCES public.res_partner_bank(id) ON DELETE RESTRICT;


--
-- Name: account_journal account_journal_company_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_journal
    ADD CONSTRAINT account_journal_company_id_fkey FOREIGN KEY (company_id) REFERENCES public.res_company(id) ON DELETE RESTRICT;


--
-- Name: account_journal account_journal_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_journal
    ADD CONSTRAINT account_journal_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_journal account_journal_currency_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_journal
    ADD CONSTRAINT account_journal_currency_id_fkey FOREIGN KEY (currency_id) REFERENCES public.res_currency(id) ON DELETE SET NULL;


--
-- Name: account_journal account_journal_default_account_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_journal
    ADD CONSTRAINT account_journal_default_account_id_fkey FOREIGN KEY (default_account_id) REFERENCES public.account_account(id) ON DELETE RESTRICT;


--
-- Name: account_journal_group account_journal_group_company_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_journal_group
    ADD CONSTRAINT account_journal_group_company_id_fkey FOREIGN KEY (company_id) REFERENCES public.res_company(id) ON DELETE RESTRICT;


--
-- Name: account_journal_group account_journal_group_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_journal_group
    ADD CONSTRAINT account_journal_group_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_journal_group account_journal_group_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_journal_group
    ADD CONSTRAINT account_journal_group_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_journal account_journal_loss_account_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_journal
    ADD CONSTRAINT account_journal_loss_account_id_fkey FOREIGN KEY (loss_account_id) REFERENCES public.account_account(id) ON DELETE SET NULL;


--
-- Name: account_journal account_journal_message_main_attachment_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_journal
    ADD CONSTRAINT account_journal_message_main_attachment_id_fkey FOREIGN KEY (message_main_attachment_id) REFERENCES public.ir_attachment(id) ON DELETE SET NULL;


--
-- Name: account_journal account_journal_profit_account_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_journal
    ADD CONSTRAINT account_journal_profit_account_id_fkey FOREIGN KEY (profit_account_id) REFERENCES public.account_account(id) ON DELETE SET NULL;


--
-- Name: account_journal account_journal_sale_activity_type_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_journal
    ADD CONSTRAINT account_journal_sale_activity_type_id_fkey FOREIGN KEY (sale_activity_type_id) REFERENCES public.mail_activity_type(id) ON DELETE SET NULL;


--
-- Name: account_journal account_journal_sale_activity_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_journal
    ADD CONSTRAINT account_journal_sale_activity_user_id_fkey FOREIGN KEY (sale_activity_user_id) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_journal account_journal_secure_sequence_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_journal
    ADD CONSTRAINT account_journal_secure_sequence_id_fkey FOREIGN KEY (secure_sequence_id) REFERENCES public.ir_sequence(id) ON DELETE SET NULL;


--
-- Name: account_journal account_journal_suspense_account_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_journal
    ADD CONSTRAINT account_journal_suspense_account_id_fkey FOREIGN KEY (suspense_account_id) REFERENCES public.account_account(id) ON DELETE RESTRICT;


--
-- Name: account_journal account_journal_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_journal
    ADD CONSTRAINT account_journal_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_move_account_invoice_send_rel account_move_account_invoice_send__account_invoice_send_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_move_account_invoice_send_rel
    ADD CONSTRAINT account_move_account_invoice_send__account_invoice_send_id_fkey FOREIGN KEY (account_invoice_send_id) REFERENCES public.account_invoice_send(id) ON DELETE CASCADE;


--
-- Name: account_move_account_invoice_send_rel account_move_account_invoice_send_rel_account_move_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_move_account_invoice_send_rel
    ADD CONSTRAINT account_move_account_invoice_send_rel_account_move_id_fkey FOREIGN KEY (account_move_id) REFERENCES public.account_move(id) ON DELETE CASCADE;


--
-- Name: account_move_account_resequence_wizard_rel account_move_account_resequen_account_resequence_wizard_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_move_account_resequence_wizard_rel
    ADD CONSTRAINT account_move_account_resequen_account_resequence_wizard_id_fkey FOREIGN KEY (account_resequence_wizard_id) REFERENCES public.account_resequence_wizard(id) ON DELETE CASCADE;


--
-- Name: account_move_account_resequence_wizard_rel account_move_account_resequence_wizard_rel_account_move_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_move_account_resequence_wizard_rel
    ADD CONSTRAINT account_move_account_resequence_wizard_rel_account_move_id_fkey FOREIGN KEY (account_move_id) REFERENCES public.account_move(id) ON DELETE CASCADE;


--
-- Name: account_move account_move_auto_post_origin_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_move
    ADD CONSTRAINT account_move_auto_post_origin_id_fkey FOREIGN KEY (auto_post_origin_id) REFERENCES public.account_move(id) ON DELETE SET NULL;


--
-- Name: account_move account_move_campaign_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_move
    ADD CONSTRAINT account_move_campaign_id_fkey FOREIGN KEY (campaign_id) REFERENCES public.utm_campaign(id) ON DELETE SET NULL;


--
-- Name: account_move account_move_commercial_partner_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_move
    ADD CONSTRAINT account_move_commercial_partner_id_fkey FOREIGN KEY (commercial_partner_id) REFERENCES public.res_partner(id) ON DELETE RESTRICT;


--
-- Name: account_move account_move_company_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_move
    ADD CONSTRAINT account_move_company_id_fkey FOREIGN KEY (company_id) REFERENCES public.res_company(id) ON DELETE SET NULL;


--
-- Name: account_move account_move_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_move
    ADD CONSTRAINT account_move_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_move account_move_currency_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_move
    ADD CONSTRAINT account_move_currency_id_fkey FOREIGN KEY (currency_id) REFERENCES public.res_currency(id) ON DELETE RESTRICT;


--
-- Name: account_move account_move_fiscal_position_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_move
    ADD CONSTRAINT account_move_fiscal_position_id_fkey FOREIGN KEY (fiscal_position_id) REFERENCES public.account_fiscal_position(id) ON DELETE RESTRICT;


--
-- Name: account_move account_move_invoice_cash_rounding_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_move
    ADD CONSTRAINT account_move_invoice_cash_rounding_id_fkey FOREIGN KEY (invoice_cash_rounding_id) REFERENCES public.account_cash_rounding(id) ON DELETE SET NULL;


--
-- Name: account_move account_move_invoice_incoterm_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_move
    ADD CONSTRAINT account_move_invoice_incoterm_id_fkey FOREIGN KEY (invoice_incoterm_id) REFERENCES public.account_incoterms(id) ON DELETE SET NULL;


--
-- Name: account_move account_move_invoice_payment_term_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_move
    ADD CONSTRAINT account_move_invoice_payment_term_id_fkey FOREIGN KEY (invoice_payment_term_id) REFERENCES public.account_payment_term(id) ON DELETE SET NULL;


--
-- Name: account_move account_move_invoice_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_move
    ADD CONSTRAINT account_move_invoice_user_id_fkey FOREIGN KEY (invoice_user_id) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_move account_move_journal_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_move
    ADD CONSTRAINT account_move_journal_id_fkey FOREIGN KEY (journal_id) REFERENCES public.account_journal(id) ON DELETE RESTRICT;


--
-- Name: account_move_line account_move_line_account_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_move_line
    ADD CONSTRAINT account_move_line_account_id_fkey FOREIGN KEY (account_id) REFERENCES public.account_account(id) ON DELETE CASCADE;


--
-- Name: account_move_line_account_tax_rel account_move_line_account_tax_rel_account_move_line_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_move_line_account_tax_rel
    ADD CONSTRAINT account_move_line_account_tax_rel_account_move_line_id_fkey FOREIGN KEY (account_move_line_id) REFERENCES public.account_move_line(id) ON DELETE CASCADE;


--
-- Name: account_move_line_account_tax_rel account_move_line_account_tax_rel_account_tax_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_move_line_account_tax_rel
    ADD CONSTRAINT account_move_line_account_tax_rel_account_tax_id_fkey FOREIGN KEY (account_tax_id) REFERENCES public.account_tax(id) ON DELETE CASCADE;


--
-- Name: account_move_line account_move_line_company_currency_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_move_line
    ADD CONSTRAINT account_move_line_company_currency_id_fkey FOREIGN KEY (company_currency_id) REFERENCES public.res_currency(id) ON DELETE SET NULL;


--
-- Name: account_move_line account_move_line_company_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_move_line
    ADD CONSTRAINT account_move_line_company_id_fkey FOREIGN KEY (company_id) REFERENCES public.res_company(id) ON DELETE SET NULL;


--
-- Name: account_move_line account_move_line_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_move_line
    ADD CONSTRAINT account_move_line_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_move_line account_move_line_currency_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_move_line
    ADD CONSTRAINT account_move_line_currency_id_fkey FOREIGN KEY (currency_id) REFERENCES public.res_currency(id) ON DELETE RESTRICT;


--
-- Name: account_move_line account_move_line_expense_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_move_line
    ADD CONSTRAINT account_move_line_expense_id_fkey FOREIGN KEY (expense_id) REFERENCES public.hr_expense(id) ON DELETE SET NULL;


--
-- Name: account_move_line account_move_line_full_reconcile_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_move_line
    ADD CONSTRAINT account_move_line_full_reconcile_id_fkey FOREIGN KEY (full_reconcile_id) REFERENCES public.account_full_reconcile(id) ON DELETE SET NULL;


--
-- Name: account_move_line account_move_line_group_tax_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_move_line
    ADD CONSTRAINT account_move_line_group_tax_id_fkey FOREIGN KEY (group_tax_id) REFERENCES public.account_tax(id) ON DELETE SET NULL;


--
-- Name: account_move_line account_move_line_journal_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_move_line
    ADD CONSTRAINT account_move_line_journal_id_fkey FOREIGN KEY (journal_id) REFERENCES public.account_journal(id) ON DELETE SET NULL;


--
-- Name: account_move_line account_move_line_move_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_move_line
    ADD CONSTRAINT account_move_line_move_id_fkey FOREIGN KEY (move_id) REFERENCES public.account_move(id) ON DELETE CASCADE;


--
-- Name: account_move_line account_move_line_partner_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_move_line
    ADD CONSTRAINT account_move_line_partner_id_fkey FOREIGN KEY (partner_id) REFERENCES public.res_partner(id) ON DELETE RESTRICT;


--
-- Name: account_move_line account_move_line_payment_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_move_line
    ADD CONSTRAINT account_move_line_payment_id_fkey FOREIGN KEY (payment_id) REFERENCES public.account_payment(id) ON DELETE SET NULL;


--
-- Name: account_move_line account_move_line_product_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_move_line
    ADD CONSTRAINT account_move_line_product_id_fkey FOREIGN KEY (product_id) REFERENCES public.product_product(id) ON DELETE RESTRICT;


--
-- Name: account_move_line account_move_line_product_uom_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_move_line
    ADD CONSTRAINT account_move_line_product_uom_id_fkey FOREIGN KEY (product_uom_id) REFERENCES public.uom_uom(id) ON DELETE RESTRICT;


--
-- Name: account_move_line account_move_line_purchase_line_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_move_line
    ADD CONSTRAINT account_move_line_purchase_line_id_fkey FOREIGN KEY (purchase_line_id) REFERENCES public.purchase_order_line(id) ON DELETE SET NULL;


--
-- Name: account_move_line account_move_line_reconcile_model_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_move_line
    ADD CONSTRAINT account_move_line_reconcile_model_id_fkey FOREIGN KEY (reconcile_model_id) REFERENCES public.account_reconcile_model(id) ON DELETE SET NULL;


--
-- Name: account_move_line account_move_line_statement_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_move_line
    ADD CONSTRAINT account_move_line_statement_id_fkey FOREIGN KEY (statement_id) REFERENCES public.account_bank_statement(id) ON DELETE SET NULL;


--
-- Name: account_move_line account_move_line_statement_line_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_move_line
    ADD CONSTRAINT account_move_line_statement_line_id_fkey FOREIGN KEY (statement_line_id) REFERENCES public.account_bank_statement_line(id) ON DELETE SET NULL;


--
-- Name: account_move_line account_move_line_tax_group_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_move_line
    ADD CONSTRAINT account_move_line_tax_group_id_fkey FOREIGN KEY (tax_group_id) REFERENCES public.account_tax_group(id) ON DELETE SET NULL;


--
-- Name: account_move_line account_move_line_tax_line_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_move_line
    ADD CONSTRAINT account_move_line_tax_line_id_fkey FOREIGN KEY (tax_line_id) REFERENCES public.account_tax(id) ON DELETE RESTRICT;


--
-- Name: account_move_line account_move_line_tax_repartition_line_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_move_line
    ADD CONSTRAINT account_move_line_tax_repartition_line_id_fkey FOREIGN KEY (tax_repartition_line_id) REFERENCES public.account_tax_repartition_line(id) ON DELETE RESTRICT;


--
-- Name: account_move_line account_move_line_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_move_line
    ADD CONSTRAINT account_move_line_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_move account_move_medium_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_move
    ADD CONSTRAINT account_move_medium_id_fkey FOREIGN KEY (medium_id) REFERENCES public.utm_medium(id) ON DELETE SET NULL;


--
-- Name: account_move account_move_message_main_attachment_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_move
    ADD CONSTRAINT account_move_message_main_attachment_id_fkey FOREIGN KEY (message_main_attachment_id) REFERENCES public.ir_attachment(id) ON DELETE SET NULL;


--
-- Name: account_move account_move_partner_bank_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_move
    ADD CONSTRAINT account_move_partner_bank_id_fkey FOREIGN KEY (partner_bank_id) REFERENCES public.res_partner_bank(id) ON DELETE SET NULL;


--
-- Name: account_move account_move_partner_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_move
    ADD CONSTRAINT account_move_partner_id_fkey FOREIGN KEY (partner_id) REFERENCES public.res_partner(id) ON DELETE RESTRICT;


--
-- Name: account_move account_move_partner_shipping_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_move
    ADD CONSTRAINT account_move_partner_shipping_id_fkey FOREIGN KEY (partner_shipping_id) REFERENCES public.res_partner(id) ON DELETE SET NULL;


--
-- Name: account_move account_move_payment_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_move
    ADD CONSTRAINT account_move_payment_id_fkey FOREIGN KEY (payment_id) REFERENCES public.account_payment(id) ON DELETE SET NULL;


--
-- Name: account_move_purchase_order_rel account_move_purchase_order_rel_account_move_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_move_purchase_order_rel
    ADD CONSTRAINT account_move_purchase_order_rel_account_move_id_fkey FOREIGN KEY (account_move_id) REFERENCES public.account_move(id) ON DELETE CASCADE;


--
-- Name: account_move_purchase_order_rel account_move_purchase_order_rel_purchase_order_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_move_purchase_order_rel
    ADD CONSTRAINT account_move_purchase_order_rel_purchase_order_id_fkey FOREIGN KEY (purchase_order_id) REFERENCES public.purchase_order(id) ON DELETE CASCADE;


--
-- Name: account_move_reversal account_move_reversal_company_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_move_reversal
    ADD CONSTRAINT account_move_reversal_company_id_fkey FOREIGN KEY (company_id) REFERENCES public.res_company(id) ON DELETE CASCADE;


--
-- Name: account_move_reversal account_move_reversal_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_move_reversal
    ADD CONSTRAINT account_move_reversal_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_move_reversal account_move_reversal_journal_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_move_reversal
    ADD CONSTRAINT account_move_reversal_journal_id_fkey FOREIGN KEY (journal_id) REFERENCES public.account_journal(id) ON DELETE CASCADE;


--
-- Name: account_move_reversal_move account_move_reversal_move_move_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_move_reversal_move
    ADD CONSTRAINT account_move_reversal_move_move_id_fkey FOREIGN KEY (move_id) REFERENCES public.account_move(id) ON DELETE CASCADE;


--
-- Name: account_move_reversal_move account_move_reversal_move_reversal_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_move_reversal_move
    ADD CONSTRAINT account_move_reversal_move_reversal_id_fkey FOREIGN KEY (reversal_id) REFERENCES public.account_move_reversal(id) ON DELETE CASCADE;


--
-- Name: account_move_reversal_new_move account_move_reversal_new_move_new_move_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_move_reversal_new_move
    ADD CONSTRAINT account_move_reversal_new_move_new_move_id_fkey FOREIGN KEY (new_move_id) REFERENCES public.account_move(id) ON DELETE CASCADE;


--
-- Name: account_move_reversal_new_move account_move_reversal_new_move_reversal_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_move_reversal_new_move
    ADD CONSTRAINT account_move_reversal_new_move_reversal_id_fkey FOREIGN KEY (reversal_id) REFERENCES public.account_move_reversal(id) ON DELETE CASCADE;


--
-- Name: account_move_reversal account_move_reversal_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_move_reversal
    ADD CONSTRAINT account_move_reversal_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_move account_move_reversed_entry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_move
    ADD CONSTRAINT account_move_reversed_entry_id_fkey FOREIGN KEY (reversed_entry_id) REFERENCES public.account_move(id) ON DELETE SET NULL;


--
-- Name: account_move account_move_source_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_move
    ADD CONSTRAINT account_move_source_id_fkey FOREIGN KEY (source_id) REFERENCES public.utm_source(id) ON DELETE SET NULL;


--
-- Name: account_move account_move_statement_line_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_move
    ADD CONSTRAINT account_move_statement_line_id_fkey FOREIGN KEY (statement_line_id) REFERENCES public.account_bank_statement_line(id) ON DELETE SET NULL;


--
-- Name: account_move account_move_stock_move_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_move
    ADD CONSTRAINT account_move_stock_move_id_fkey FOREIGN KEY (stock_move_id) REFERENCES public.stock_move(id) ON DELETE SET NULL;


--
-- Name: account_move account_move_tax_cash_basis_origin_move_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_move
    ADD CONSTRAINT account_move_tax_cash_basis_origin_move_id_fkey FOREIGN KEY (tax_cash_basis_origin_move_id) REFERENCES public.account_move(id) ON DELETE SET NULL;


--
-- Name: account_move account_move_tax_cash_basis_rec_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_move
    ADD CONSTRAINT account_move_tax_cash_basis_rec_id_fkey FOREIGN KEY (tax_cash_basis_rec_id) REFERENCES public.account_partial_reconcile(id) ON DELETE SET NULL;


--
-- Name: account_move account_move_team_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_move
    ADD CONSTRAINT account_move_team_id_fkey FOREIGN KEY (team_id) REFERENCES public.crm_team(id) ON DELETE SET NULL;


--
-- Name: account_move account_move_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_move
    ADD CONSTRAINT account_move_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_partial_reconcile account_partial_reconcile_company_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_partial_reconcile
    ADD CONSTRAINT account_partial_reconcile_company_id_fkey FOREIGN KEY (company_id) REFERENCES public.res_company(id) ON DELETE SET NULL;


--
-- Name: account_partial_reconcile account_partial_reconcile_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_partial_reconcile
    ADD CONSTRAINT account_partial_reconcile_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_partial_reconcile account_partial_reconcile_credit_currency_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_partial_reconcile
    ADD CONSTRAINT account_partial_reconcile_credit_currency_id_fkey FOREIGN KEY (credit_currency_id) REFERENCES public.res_currency(id) ON DELETE SET NULL;


--
-- Name: account_partial_reconcile account_partial_reconcile_credit_move_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_partial_reconcile
    ADD CONSTRAINT account_partial_reconcile_credit_move_id_fkey FOREIGN KEY (credit_move_id) REFERENCES public.account_move_line(id) ON DELETE RESTRICT;


--
-- Name: account_partial_reconcile account_partial_reconcile_debit_currency_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_partial_reconcile
    ADD CONSTRAINT account_partial_reconcile_debit_currency_id_fkey FOREIGN KEY (debit_currency_id) REFERENCES public.res_currency(id) ON DELETE SET NULL;


--
-- Name: account_partial_reconcile account_partial_reconcile_debit_move_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_partial_reconcile
    ADD CONSTRAINT account_partial_reconcile_debit_move_id_fkey FOREIGN KEY (debit_move_id) REFERENCES public.account_move_line(id) ON DELETE RESTRICT;


--
-- Name: account_partial_reconcile account_partial_reconcile_exchange_move_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_partial_reconcile
    ADD CONSTRAINT account_partial_reconcile_exchange_move_id_fkey FOREIGN KEY (exchange_move_id) REFERENCES public.account_move(id) ON DELETE SET NULL;


--
-- Name: account_partial_reconcile account_partial_reconcile_full_reconcile_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_partial_reconcile
    ADD CONSTRAINT account_partial_reconcile_full_reconcile_id_fkey FOREIGN KEY (full_reconcile_id) REFERENCES public.account_full_reconcile(id) ON DELETE SET NULL;


--
-- Name: account_partial_reconcile account_partial_reconcile_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_partial_reconcile
    ADD CONSTRAINT account_partial_reconcile_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_payment_account_bank_statement_line_rel account_payment_account_bank__account_bank_statement_line__fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_payment_account_bank_statement_line_rel
    ADD CONSTRAINT account_payment_account_bank__account_bank_statement_line__fkey FOREIGN KEY (account_bank_statement_line_id) REFERENCES public.account_bank_statement_line(id) ON DELETE CASCADE;


--
-- Name: account_payment_account_bank_statement_line_rel account_payment_account_bank_statement__account_payment_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_payment_account_bank_statement_line_rel
    ADD CONSTRAINT account_payment_account_bank_statement__account_payment_id_fkey FOREIGN KEY (account_payment_id) REFERENCES public.account_payment(id) ON DELETE CASCADE;


--
-- Name: account_payment account_payment_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_payment
    ADD CONSTRAINT account_payment_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_payment account_payment_currency_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_payment
    ADD CONSTRAINT account_payment_currency_id_fkey FOREIGN KEY (currency_id) REFERENCES public.res_currency(id) ON DELETE SET NULL;


--
-- Name: account_payment account_payment_destination_account_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_payment
    ADD CONSTRAINT account_payment_destination_account_id_fkey FOREIGN KEY (destination_account_id) REFERENCES public.account_account(id) ON DELETE SET NULL;


--
-- Name: account_payment account_payment_destination_journal_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_payment
    ADD CONSTRAINT account_payment_destination_journal_id_fkey FOREIGN KEY (destination_journal_id) REFERENCES public.account_journal(id) ON DELETE SET NULL;


--
-- Name: account_payment account_payment_message_main_attachment_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_payment
    ADD CONSTRAINT account_payment_message_main_attachment_id_fkey FOREIGN KEY (message_main_attachment_id) REFERENCES public.ir_attachment(id) ON DELETE SET NULL;


--
-- Name: account_payment_method account_payment_method_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_payment_method
    ADD CONSTRAINT account_payment_method_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_payment_method_line account_payment_method_line_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_payment_method_line
    ADD CONSTRAINT account_payment_method_line_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_payment_method_line account_payment_method_line_journal_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_payment_method_line
    ADD CONSTRAINT account_payment_method_line_journal_id_fkey FOREIGN KEY (journal_id) REFERENCES public.account_journal(id) ON DELETE CASCADE;


--
-- Name: account_payment_method_line account_payment_method_line_payment_account_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_payment_method_line
    ADD CONSTRAINT account_payment_method_line_payment_account_id_fkey FOREIGN KEY (payment_account_id) REFERENCES public.account_account(id) ON DELETE RESTRICT;


--
-- Name: account_payment_method_line account_payment_method_line_payment_method_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_payment_method_line
    ADD CONSTRAINT account_payment_method_line_payment_method_id_fkey FOREIGN KEY (payment_method_id) REFERENCES public.account_payment_method(id) ON DELETE CASCADE;


--
-- Name: account_payment_method_line account_payment_method_line_payment_provider_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_payment_method_line
    ADD CONSTRAINT account_payment_method_line_payment_provider_id_fkey FOREIGN KEY (payment_provider_id) REFERENCES public.payment_provider(id) ON DELETE SET NULL;


--
-- Name: account_payment_method_line account_payment_method_line_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_payment_method_line
    ADD CONSTRAINT account_payment_method_line_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_payment_method account_payment_method_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_payment_method
    ADD CONSTRAINT account_payment_method_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_payment account_payment_move_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_payment
    ADD CONSTRAINT account_payment_move_id_fkey FOREIGN KEY (move_id) REFERENCES public.account_move(id) ON DELETE CASCADE;


--
-- Name: account_payment account_payment_outstanding_account_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_payment
    ADD CONSTRAINT account_payment_outstanding_account_id_fkey FOREIGN KEY (outstanding_account_id) REFERENCES public.account_account(id) ON DELETE SET NULL;


--
-- Name: account_payment account_payment_paired_internal_transfer_payment_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_payment
    ADD CONSTRAINT account_payment_paired_internal_transfer_payment_id_fkey FOREIGN KEY (paired_internal_transfer_payment_id) REFERENCES public.account_payment(id) ON DELETE SET NULL;


--
-- Name: account_payment account_payment_partner_bank_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_payment
    ADD CONSTRAINT account_payment_partner_bank_id_fkey FOREIGN KEY (partner_bank_id) REFERENCES public.res_partner_bank(id) ON DELETE SET NULL;


--
-- Name: account_payment account_payment_partner_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_payment
    ADD CONSTRAINT account_payment_partner_id_fkey FOREIGN KEY (partner_id) REFERENCES public.res_partner(id) ON DELETE RESTRICT;


--
-- Name: account_payment account_payment_payment_method_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_payment
    ADD CONSTRAINT account_payment_payment_method_id_fkey FOREIGN KEY (payment_method_id) REFERENCES public.account_payment_method(id) ON DELETE SET NULL;


--
-- Name: account_payment account_payment_payment_method_line_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_payment
    ADD CONSTRAINT account_payment_payment_method_line_id_fkey FOREIGN KEY (payment_method_line_id) REFERENCES public.account_payment_method_line(id) ON DELETE SET NULL;


--
-- Name: account_payment account_payment_payment_token_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_payment
    ADD CONSTRAINT account_payment_payment_token_id_fkey FOREIGN KEY (payment_token_id) REFERENCES public.payment_token(id) ON DELETE SET NULL;


--
-- Name: account_payment account_payment_payment_transaction_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_payment
    ADD CONSTRAINT account_payment_payment_transaction_id_fkey FOREIGN KEY (payment_transaction_id) REFERENCES public.payment_transaction(id) ON DELETE SET NULL;


--
-- Name: account_payment_register account_payment_register_company_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_payment_register
    ADD CONSTRAINT account_payment_register_company_id_fkey FOREIGN KEY (company_id) REFERENCES public.res_company(id) ON DELETE SET NULL;


--
-- Name: account_payment_register account_payment_register_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_payment_register
    ADD CONSTRAINT account_payment_register_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_payment_register account_payment_register_currency_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_payment_register
    ADD CONSTRAINT account_payment_register_currency_id_fkey FOREIGN KEY (currency_id) REFERENCES public.res_currency(id) ON DELETE SET NULL;


--
-- Name: account_payment_register account_payment_register_journal_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_payment_register
    ADD CONSTRAINT account_payment_register_journal_id_fkey FOREIGN KEY (journal_id) REFERENCES public.account_journal(id) ON DELETE SET NULL;


--
-- Name: account_payment_register_move_line_rel account_payment_register_move_line_rel_line_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_payment_register_move_line_rel
    ADD CONSTRAINT account_payment_register_move_line_rel_line_id_fkey FOREIGN KEY (line_id) REFERENCES public.account_move_line(id) ON DELETE CASCADE;


--
-- Name: account_payment_register_move_line_rel account_payment_register_move_line_rel_wizard_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_payment_register_move_line_rel
    ADD CONSTRAINT account_payment_register_move_line_rel_wizard_id_fkey FOREIGN KEY (wizard_id) REFERENCES public.account_payment_register(id) ON DELETE CASCADE;


--
-- Name: account_payment_register account_payment_register_partner_bank_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_payment_register
    ADD CONSTRAINT account_payment_register_partner_bank_id_fkey FOREIGN KEY (partner_bank_id) REFERENCES public.res_partner_bank(id) ON DELETE SET NULL;


--
-- Name: account_payment_register account_payment_register_partner_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_payment_register
    ADD CONSTRAINT account_payment_register_partner_id_fkey FOREIGN KEY (partner_id) REFERENCES public.res_partner(id) ON DELETE RESTRICT;


--
-- Name: account_payment_register account_payment_register_payment_method_line_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_payment_register
    ADD CONSTRAINT account_payment_register_payment_method_line_id_fkey FOREIGN KEY (payment_method_line_id) REFERENCES public.account_payment_method_line(id) ON DELETE SET NULL;


--
-- Name: account_payment_register account_payment_register_payment_token_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_payment_register
    ADD CONSTRAINT account_payment_register_payment_token_id_fkey FOREIGN KEY (payment_token_id) REFERENCES public.payment_token(id) ON DELETE SET NULL;


--
-- Name: account_payment_register account_payment_register_source_currency_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_payment_register
    ADD CONSTRAINT account_payment_register_source_currency_id_fkey FOREIGN KEY (source_currency_id) REFERENCES public.res_currency(id) ON DELETE SET NULL;


--
-- Name: account_payment_register account_payment_register_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_payment_register
    ADD CONSTRAINT account_payment_register_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_payment_register account_payment_register_writeoff_account_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_payment_register
    ADD CONSTRAINT account_payment_register_writeoff_account_id_fkey FOREIGN KEY (writeoff_account_id) REFERENCES public.account_account(id) ON DELETE SET NULL;


--
-- Name: account_payment account_payment_source_payment_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_payment
    ADD CONSTRAINT account_payment_source_payment_id_fkey FOREIGN KEY (source_payment_id) REFERENCES public.account_payment(id) ON DELETE SET NULL;


--
-- Name: account_payment_term account_payment_term_company_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_payment_term
    ADD CONSTRAINT account_payment_term_company_id_fkey FOREIGN KEY (company_id) REFERENCES public.res_company(id) ON DELETE SET NULL;


--
-- Name: account_payment_term account_payment_term_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_payment_term
    ADD CONSTRAINT account_payment_term_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_payment_term_line account_payment_term_line_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_payment_term_line
    ADD CONSTRAINT account_payment_term_line_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_payment_term_line account_payment_term_line_payment_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_payment_term_line
    ADD CONSTRAINT account_payment_term_line_payment_id_fkey FOREIGN KEY (payment_id) REFERENCES public.account_payment_term(id) ON DELETE CASCADE;


--
-- Name: account_payment_term_line account_payment_term_line_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_payment_term_line
    ADD CONSTRAINT account_payment_term_line_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_payment_term account_payment_term_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_payment_term
    ADD CONSTRAINT account_payment_term_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_payment account_payment_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_payment
    ADD CONSTRAINT account_payment_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_reconcile_model account_reconcile_model_company_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_reconcile_model
    ADD CONSTRAINT account_reconcile_model_company_id_fkey FOREIGN KEY (company_id) REFERENCES public.res_company(id) ON DELETE RESTRICT;


--
-- Name: account_reconcile_model account_reconcile_model_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_reconcile_model
    ADD CONSTRAINT account_reconcile_model_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_reconcile_model_line_account_tax_rel account_reconcile_model_line__account_reconcile_model_line_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_reconcile_model_line_account_tax_rel
    ADD CONSTRAINT account_reconcile_model_line__account_reconcile_model_line_fkey FOREIGN KEY (account_reconcile_model_line_id) REFERENCES public.account_reconcile_model_line(id) ON DELETE CASCADE;


--
-- Name: account_reconcile_model_line account_reconcile_model_line_account_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_reconcile_model_line
    ADD CONSTRAINT account_reconcile_model_line_account_id_fkey FOREIGN KEY (account_id) REFERENCES public.account_account(id) ON DELETE CASCADE;


--
-- Name: account_reconcile_model_line_template_account_tax_template_rel account_reconcile_model_line_account_reconcile_model_line_fkey1; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_reconcile_model_line_template_account_tax_template_rel
    ADD CONSTRAINT account_reconcile_model_line_account_reconcile_model_line_fkey1 FOREIGN KEY (account_reconcile_model_line_template_id) REFERENCES public.account_reconcile_model_line_template(id) ON DELETE CASCADE;


--
-- Name: account_reconcile_model_line_account_tax_rel account_reconcile_model_line_account_tax_re_account_tax_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_reconcile_model_line_account_tax_rel
    ADD CONSTRAINT account_reconcile_model_line_account_tax_re_account_tax_id_fkey FOREIGN KEY (account_tax_id) REFERENCES public.account_tax(id) ON DELETE RESTRICT;


--
-- Name: account_reconcile_model_line account_reconcile_model_line_company_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_reconcile_model_line
    ADD CONSTRAINT account_reconcile_model_line_company_id_fkey FOREIGN KEY (company_id) REFERENCES public.res_company(id) ON DELETE SET NULL;


--
-- Name: account_reconcile_model_line account_reconcile_model_line_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_reconcile_model_line
    ADD CONSTRAINT account_reconcile_model_line_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_reconcile_model_line account_reconcile_model_line_journal_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_reconcile_model_line
    ADD CONSTRAINT account_reconcile_model_line_journal_id_fkey FOREIGN KEY (journal_id) REFERENCES public.account_journal(id) ON DELETE CASCADE;


--
-- Name: account_reconcile_model_line account_reconcile_model_line_model_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_reconcile_model_line
    ADD CONSTRAINT account_reconcile_model_line_model_id_fkey FOREIGN KEY (model_id) REFERENCES public.account_reconcile_model(id) ON DELETE CASCADE;


--
-- Name: account_reconcile_model_line_template_account_tax_template_rel account_reconcile_model_line_templ_account_tax_template_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_reconcile_model_line_template_account_tax_template_rel
    ADD CONSTRAINT account_reconcile_model_line_templ_account_tax_template_id_fkey FOREIGN KEY (account_tax_template_id) REFERENCES public.account_tax_template(id) ON DELETE RESTRICT;


--
-- Name: account_reconcile_model_line_template account_reconcile_model_line_template_account_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_reconcile_model_line_template
    ADD CONSTRAINT account_reconcile_model_line_template_account_id_fkey FOREIGN KEY (account_id) REFERENCES public.account_account_template(id) ON DELETE CASCADE;


--
-- Name: account_reconcile_model_line_template account_reconcile_model_line_template_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_reconcile_model_line_template
    ADD CONSTRAINT account_reconcile_model_line_template_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_reconcile_model_line_template account_reconcile_model_line_template_model_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_reconcile_model_line_template
    ADD CONSTRAINT account_reconcile_model_line_template_model_id_fkey FOREIGN KEY (model_id) REFERENCES public.account_reconcile_model_template(id) ON DELETE SET NULL;


--
-- Name: account_reconcile_model_line_template account_reconcile_model_line_template_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_reconcile_model_line_template
    ADD CONSTRAINT account_reconcile_model_line_template_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_reconcile_model_line account_reconcile_model_line_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_reconcile_model_line
    ADD CONSTRAINT account_reconcile_model_line_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_reconcile_model account_reconcile_model_message_main_attachment_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_reconcile_model
    ADD CONSTRAINT account_reconcile_model_message_main_attachment_id_fkey FOREIGN KEY (message_main_attachment_id) REFERENCES public.ir_attachment(id) ON DELETE SET NULL;


--
-- Name: account_reconcile_model_partner_mapping account_reconcile_model_partner_mapping_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_reconcile_model_partner_mapping
    ADD CONSTRAINT account_reconcile_model_partner_mapping_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_reconcile_model_partner_mapping account_reconcile_model_partner_mapping_model_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_reconcile_model_partner_mapping
    ADD CONSTRAINT account_reconcile_model_partner_mapping_model_id_fkey FOREIGN KEY (model_id) REFERENCES public.account_reconcile_model(id) ON DELETE CASCADE;


--
-- Name: account_reconcile_model_partner_mapping account_reconcile_model_partner_mapping_partner_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_reconcile_model_partner_mapping
    ADD CONSTRAINT account_reconcile_model_partner_mapping_partner_id_fkey FOREIGN KEY (partner_id) REFERENCES public.res_partner(id) ON DELETE CASCADE;


--
-- Name: account_reconcile_model_partner_mapping account_reconcile_model_partner_mapping_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_reconcile_model_partner_mapping
    ADD CONSTRAINT account_reconcile_model_partner_mapping_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_reconcile_model_res_partner_category_rel account_reconcile_model_res_pa_account_reconcile_model_id_fkey1; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_reconcile_model_res_partner_category_rel
    ADD CONSTRAINT account_reconcile_model_res_pa_account_reconcile_model_id_fkey1 FOREIGN KEY (account_reconcile_model_id) REFERENCES public.account_reconcile_model(id) ON DELETE CASCADE;


--
-- Name: account_reconcile_model_res_partner_rel account_reconcile_model_res_par_account_reconcile_model_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_reconcile_model_res_partner_rel
    ADD CONSTRAINT account_reconcile_model_res_par_account_reconcile_model_id_fkey FOREIGN KEY (account_reconcile_model_id) REFERENCES public.account_reconcile_model(id) ON DELETE CASCADE;


--
-- Name: account_reconcile_model_res_partner_category_rel account_reconcile_model_res_partne_res_partner_category_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_reconcile_model_res_partner_category_rel
    ADD CONSTRAINT account_reconcile_model_res_partne_res_partner_category_id_fkey FOREIGN KEY (res_partner_category_id) REFERENCES public.res_partner_category(id) ON DELETE CASCADE;


--
-- Name: account_reconcile_model_res_partner_rel account_reconcile_model_res_partner_rel_res_partner_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_reconcile_model_res_partner_rel
    ADD CONSTRAINT account_reconcile_model_res_partner_rel_res_partner_id_fkey FOREIGN KEY (res_partner_id) REFERENCES public.res_partner(id) ON DELETE CASCADE;


--
-- Name: account_reconcile_model_template_res_partner_category_rel account_reconcile_model_temp_account_reconcile_model_temp_fkey1; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_reconcile_model_template_res_partner_category_rel
    ADD CONSTRAINT account_reconcile_model_temp_account_reconcile_model_temp_fkey1 FOREIGN KEY (account_reconcile_model_template_id) REFERENCES public.account_reconcile_model_template(id) ON DELETE CASCADE;


--
-- Name: account_reconcile_model_template_res_partner_rel account_reconcile_model_templ_account_reconcile_model_temp_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_reconcile_model_template_res_partner_rel
    ADD CONSTRAINT account_reconcile_model_templ_account_reconcile_model_temp_fkey FOREIGN KEY (account_reconcile_model_template_id) REFERENCES public.account_reconcile_model_template(id) ON DELETE CASCADE;


--
-- Name: account_reconcile_model_template account_reconcile_model_template_chart_template_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_reconcile_model_template
    ADD CONSTRAINT account_reconcile_model_template_chart_template_id_fkey FOREIGN KEY (chart_template_id) REFERENCES public.account_chart_template(id) ON DELETE RESTRICT;


--
-- Name: account_reconcile_model_template account_reconcile_model_template_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_reconcile_model_template
    ADD CONSTRAINT account_reconcile_model_template_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_reconcile_model_template_res_partner_category_rel account_reconcile_model_template_r_res_partner_category_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_reconcile_model_template_res_partner_category_rel
    ADD CONSTRAINT account_reconcile_model_template_r_res_partner_category_id_fkey FOREIGN KEY (res_partner_category_id) REFERENCES public.res_partner_category(id) ON DELETE CASCADE;


--
-- Name: account_reconcile_model_template_res_partner_rel account_reconcile_model_template_res_partne_res_partner_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_reconcile_model_template_res_partner_rel
    ADD CONSTRAINT account_reconcile_model_template_res_partne_res_partner_id_fkey FOREIGN KEY (res_partner_id) REFERENCES public.res_partner(id) ON DELETE CASCADE;


--
-- Name: account_reconcile_model_template account_reconcile_model_template_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_reconcile_model_template
    ADD CONSTRAINT account_reconcile_model_template_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_reconcile_model account_reconcile_model_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_reconcile_model
    ADD CONSTRAINT account_reconcile_model_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_report account_report_chart_template_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_report
    ADD CONSTRAINT account_report_chart_template_id_fkey FOREIGN KEY (chart_template_id) REFERENCES public.account_chart_template(id) ON DELETE SET NULL;


--
-- Name: account_report_column account_report_column_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_report_column
    ADD CONSTRAINT account_report_column_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_report_column account_report_column_custom_audit_action_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_report_column
    ADD CONSTRAINT account_report_column_custom_audit_action_id_fkey FOREIGN KEY (custom_audit_action_id) REFERENCES public.ir_act_window(id) ON DELETE SET NULL;


--
-- Name: account_report_column account_report_column_report_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_report_column
    ADD CONSTRAINT account_report_column_report_id_fkey FOREIGN KEY (report_id) REFERENCES public.account_report(id) ON DELETE SET NULL;


--
-- Name: account_report_column account_report_column_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_report_column
    ADD CONSTRAINT account_report_column_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_report account_report_country_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_report
    ADD CONSTRAINT account_report_country_id_fkey FOREIGN KEY (country_id) REFERENCES public.res_country(id) ON DELETE SET NULL;


--
-- Name: account_report account_report_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_report
    ADD CONSTRAINT account_report_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_report_expression account_report_expression_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_report_expression
    ADD CONSTRAINT account_report_expression_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_report_expression account_report_expression_report_line_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_report_expression
    ADD CONSTRAINT account_report_expression_report_line_id_fkey FOREIGN KEY (report_line_id) REFERENCES public.account_report_line(id) ON DELETE CASCADE;


--
-- Name: account_report_expression account_report_expression_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_report_expression
    ADD CONSTRAINT account_report_expression_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_report_external_value account_report_external_value_carryover_origin_report_line_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_report_external_value
    ADD CONSTRAINT account_report_external_value_carryover_origin_report_line_fkey FOREIGN KEY (carryover_origin_report_line_id) REFERENCES public.account_report_line(id) ON DELETE SET NULL;


--
-- Name: account_report_external_value account_report_external_value_company_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_report_external_value
    ADD CONSTRAINT account_report_external_value_company_id_fkey FOREIGN KEY (company_id) REFERENCES public.res_company(id) ON DELETE RESTRICT;


--
-- Name: account_report_external_value account_report_external_value_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_report_external_value
    ADD CONSTRAINT account_report_external_value_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_report_external_value account_report_external_value_foreign_vat_fiscal_position__fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_report_external_value
    ADD CONSTRAINT account_report_external_value_foreign_vat_fiscal_position__fkey FOREIGN KEY (foreign_vat_fiscal_position_id) REFERENCES public.account_fiscal_position(id) ON DELETE SET NULL;


--
-- Name: account_report_external_value account_report_external_value_target_report_expression_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_report_external_value
    ADD CONSTRAINT account_report_external_value_target_report_expression_id_fkey FOREIGN KEY (target_report_expression_id) REFERENCES public.account_report_expression(id) ON DELETE CASCADE;


--
-- Name: account_report_external_value account_report_external_value_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_report_external_value
    ADD CONSTRAINT account_report_external_value_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_report_line account_report_line_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_report_line
    ADD CONSTRAINT account_report_line_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_report_line account_report_line_parent_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_report_line
    ADD CONSTRAINT account_report_line_parent_id_fkey FOREIGN KEY (parent_id) REFERENCES public.account_report_line(id) ON DELETE SET NULL;


--
-- Name: account_report_line account_report_line_report_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_report_line
    ADD CONSTRAINT account_report_line_report_id_fkey FOREIGN KEY (report_id) REFERENCES public.account_report(id) ON DELETE CASCADE;


--
-- Name: account_report_line account_report_line_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_report_line
    ADD CONSTRAINT account_report_line_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_report account_report_root_report_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_report
    ADD CONSTRAINT account_report_root_report_id_fkey FOREIGN KEY (root_report_id) REFERENCES public.account_report(id) ON DELETE SET NULL;


--
-- Name: account_report account_report_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_report
    ADD CONSTRAINT account_report_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_resequence_wizard account_resequence_wizard_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_resequence_wizard
    ADD CONSTRAINT account_resequence_wizard_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_resequence_wizard account_resequence_wizard_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_resequence_wizard
    ADD CONSTRAINT account_resequence_wizard_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_setup_bank_manual_config account_setup_bank_manual_config_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_setup_bank_manual_config
    ADD CONSTRAINT account_setup_bank_manual_config_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_setup_bank_manual_config account_setup_bank_manual_config_res_partner_bank_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_setup_bank_manual_config
    ADD CONSTRAINT account_setup_bank_manual_config_res_partner_bank_id_fkey FOREIGN KEY (res_partner_bank_id) REFERENCES public.res_partner_bank(id) ON DELETE CASCADE;


--
-- Name: account_setup_bank_manual_config account_setup_bank_manual_config_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_setup_bank_manual_config
    ADD CONSTRAINT account_setup_bank_manual_config_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_tax account_tax_cash_basis_transition_account_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_tax
    ADD CONSTRAINT account_tax_cash_basis_transition_account_id_fkey FOREIGN KEY (cash_basis_transition_account_id) REFERENCES public.account_account(id) ON DELETE SET NULL;


--
-- Name: account_tax account_tax_company_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_tax
    ADD CONSTRAINT account_tax_company_id_fkey FOREIGN KEY (company_id) REFERENCES public.res_company(id) ON DELETE RESTRICT;


--
-- Name: account_tax account_tax_country_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_tax
    ADD CONSTRAINT account_tax_country_id_fkey FOREIGN KEY (country_id) REFERENCES public.res_country(id) ON DELETE RESTRICT;


--
-- Name: account_tax account_tax_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_tax
    ADD CONSTRAINT account_tax_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_tax_filiation_rel account_tax_filiation_rel_child_tax_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_tax_filiation_rel
    ADD CONSTRAINT account_tax_filiation_rel_child_tax_fkey FOREIGN KEY (child_tax) REFERENCES public.account_tax(id) ON DELETE CASCADE;


--
-- Name: account_tax_filiation_rel account_tax_filiation_rel_parent_tax_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_tax_filiation_rel
    ADD CONSTRAINT account_tax_filiation_rel_parent_tax_fkey FOREIGN KEY (parent_tax) REFERENCES public.account_tax(id) ON DELETE CASCADE;


--
-- Name: account_tax_group account_tax_group_country_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_tax_group
    ADD CONSTRAINT account_tax_group_country_id_fkey FOREIGN KEY (country_id) REFERENCES public.res_country(id) ON DELETE SET NULL;


--
-- Name: account_tax_group account_tax_group_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_tax_group
    ADD CONSTRAINT account_tax_group_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_tax_group account_tax_group_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_tax_group
    ADD CONSTRAINT account_tax_group_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_tax_hr_expense_split_rel account_tax_hr_expense_split_rel_account_tax_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_tax_hr_expense_split_rel
    ADD CONSTRAINT account_tax_hr_expense_split_rel_account_tax_id_fkey FOREIGN KEY (account_tax_id) REFERENCES public.account_tax(id) ON DELETE CASCADE;


--
-- Name: account_tax_hr_expense_split_rel account_tax_hr_expense_split_rel_hr_expense_split_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_tax_hr_expense_split_rel
    ADD CONSTRAINT account_tax_hr_expense_split_rel_hr_expense_split_id_fkey FOREIGN KEY (hr_expense_split_id) REFERENCES public.hr_expense_split(id) ON DELETE CASCADE;


--
-- Name: account_tax_purchase_order_line_rel account_tax_purchase_order_line_rel_account_tax_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_tax_purchase_order_line_rel
    ADD CONSTRAINT account_tax_purchase_order_line_rel_account_tax_id_fkey FOREIGN KEY (account_tax_id) REFERENCES public.account_tax(id) ON DELETE CASCADE;


--
-- Name: account_tax_purchase_order_line_rel account_tax_purchase_order_line_rel_purchase_order_line_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_tax_purchase_order_line_rel
    ADD CONSTRAINT account_tax_purchase_order_line_rel_purchase_order_line_id_fkey FOREIGN KEY (purchase_order_line_id) REFERENCES public.purchase_order_line(id) ON DELETE CASCADE;


--
-- Name: account_tax_rep_template_minus account_tax_rep_template_minu_account_report_expression_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_tax_rep_template_minus
    ADD CONSTRAINT account_tax_rep_template_minu_account_report_expression_id_fkey FOREIGN KEY (account_report_expression_id) REFERENCES public.account_report_expression(id) ON DELETE CASCADE;


--
-- Name: account_tax_rep_template_minus account_tax_rep_template_minu_account_tax_repartition_line_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_tax_rep_template_minus
    ADD CONSTRAINT account_tax_rep_template_minu_account_tax_repartition_line_fkey FOREIGN KEY (account_tax_repartition_line_template_id) REFERENCES public.account_tax_repartition_line_template(id) ON DELETE CASCADE;


--
-- Name: account_tax_rep_template_plus account_tax_rep_template_plus_account_report_expression_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_tax_rep_template_plus
    ADD CONSTRAINT account_tax_rep_template_plus_account_report_expression_id_fkey FOREIGN KEY (account_report_expression_id) REFERENCES public.account_report_expression(id) ON DELETE CASCADE;


--
-- Name: account_tax_rep_template_plus account_tax_rep_template_plus_account_tax_repartition_line_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_tax_rep_template_plus
    ADD CONSTRAINT account_tax_rep_template_plus_account_tax_repartition_line_fkey FOREIGN KEY (account_tax_repartition_line_template_id) REFERENCES public.account_tax_repartition_line_template(id) ON DELETE CASCADE;


--
-- Name: account_tax_repartition_financial_tags account_tax_repartition_finan_account_tax_repartition_line_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_tax_repartition_financial_tags
    ADD CONSTRAINT account_tax_repartition_finan_account_tax_repartition_line_fkey FOREIGN KEY (account_tax_repartition_line_template_id) REFERENCES public.account_tax_repartition_line_template(id) ON DELETE CASCADE;


--
-- Name: account_tax_repartition_financial_tags account_tax_repartition_financial_t_account_account_tag_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_tax_repartition_financial_tags
    ADD CONSTRAINT account_tax_repartition_financial_t_account_account_tag_id_fkey FOREIGN KEY (account_account_tag_id) REFERENCES public.account_account_tag(id) ON DELETE CASCADE;


--
-- Name: account_tax_repartition_line account_tax_repartition_line_account_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_tax_repartition_line
    ADD CONSTRAINT account_tax_repartition_line_account_id_fkey FOREIGN KEY (account_id) REFERENCES public.account_account(id) ON DELETE SET NULL;


--
-- Name: account_tax_repartition_line account_tax_repartition_line_company_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_tax_repartition_line
    ADD CONSTRAINT account_tax_repartition_line_company_id_fkey FOREIGN KEY (company_id) REFERENCES public.res_company(id) ON DELETE SET NULL;


--
-- Name: account_tax_repartition_line account_tax_repartition_line_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_tax_repartition_line
    ADD CONSTRAINT account_tax_repartition_line_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_tax_repartition_line account_tax_repartition_line_invoice_tax_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_tax_repartition_line
    ADD CONSTRAINT account_tax_repartition_line_invoice_tax_id_fkey FOREIGN KEY (invoice_tax_id) REFERENCES public.account_tax(id) ON DELETE CASCADE;


--
-- Name: account_tax_repartition_line account_tax_repartition_line_refund_tax_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_tax_repartition_line
    ADD CONSTRAINT account_tax_repartition_line_refund_tax_id_fkey FOREIGN KEY (refund_tax_id) REFERENCES public.account_tax(id) ON DELETE CASCADE;


--
-- Name: account_tax_repartition_line_template account_tax_repartition_line_template_account_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_tax_repartition_line_template
    ADD CONSTRAINT account_tax_repartition_line_template_account_id_fkey FOREIGN KEY (account_id) REFERENCES public.account_account_template(id) ON DELETE SET NULL;


--
-- Name: account_tax_repartition_line_template account_tax_repartition_line_template_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_tax_repartition_line_template
    ADD CONSTRAINT account_tax_repartition_line_template_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_tax_repartition_line_template account_tax_repartition_line_template_invoice_tax_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_tax_repartition_line_template
    ADD CONSTRAINT account_tax_repartition_line_template_invoice_tax_id_fkey FOREIGN KEY (invoice_tax_id) REFERENCES public.account_tax_template(id) ON DELETE SET NULL;


--
-- Name: account_tax_repartition_line_template account_tax_repartition_line_template_refund_tax_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_tax_repartition_line_template
    ADD CONSTRAINT account_tax_repartition_line_template_refund_tax_id_fkey FOREIGN KEY (refund_tax_id) REFERENCES public.account_tax_template(id) ON DELETE SET NULL;


--
-- Name: account_tax_repartition_line_template account_tax_repartition_line_template_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_tax_repartition_line_template
    ADD CONSTRAINT account_tax_repartition_line_template_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_tax_repartition_line account_tax_repartition_line_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_tax_repartition_line
    ADD CONSTRAINT account_tax_repartition_line_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_tax_sale_advance_payment_inv_rel account_tax_sale_advance_payme_sale_advance_payment_inv_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_tax_sale_advance_payment_inv_rel
    ADD CONSTRAINT account_tax_sale_advance_payme_sale_advance_payment_inv_id_fkey FOREIGN KEY (sale_advance_payment_inv_id) REFERENCES public.sale_advance_payment_inv(id) ON DELETE CASCADE;


--
-- Name: account_tax_sale_advance_payment_inv_rel account_tax_sale_advance_payment_inv_rel_account_tax_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_tax_sale_advance_payment_inv_rel
    ADD CONSTRAINT account_tax_sale_advance_payment_inv_rel_account_tax_id_fkey FOREIGN KEY (account_tax_id) REFERENCES public.account_tax(id) ON DELETE CASCADE;


--
-- Name: account_tax_sale_order_line_rel account_tax_sale_order_line_rel_account_tax_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_tax_sale_order_line_rel
    ADD CONSTRAINT account_tax_sale_order_line_rel_account_tax_id_fkey FOREIGN KEY (account_tax_id) REFERENCES public.account_tax(id) ON DELETE CASCADE;


--
-- Name: account_tax_sale_order_line_rel account_tax_sale_order_line_rel_sale_order_line_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_tax_sale_order_line_rel
    ADD CONSTRAINT account_tax_sale_order_line_rel_sale_order_line_id_fkey FOREIGN KEY (sale_order_line_id) REFERENCES public.sale_order_line(id) ON DELETE CASCADE;


--
-- Name: account_tax account_tax_tax_group_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_tax
    ADD CONSTRAINT account_tax_tax_group_id_fkey FOREIGN KEY (tax_group_id) REFERENCES public.account_tax_group(id) ON DELETE RESTRICT;


--
-- Name: account_tax_template account_tax_template_cash_basis_transition_account_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_tax_template
    ADD CONSTRAINT account_tax_template_cash_basis_transition_account_id_fkey FOREIGN KEY (cash_basis_transition_account_id) REFERENCES public.account_account_template(id) ON DELETE SET NULL;


--
-- Name: account_tax_template account_tax_template_chart_template_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_tax_template
    ADD CONSTRAINT account_tax_template_chart_template_id_fkey FOREIGN KEY (chart_template_id) REFERENCES public.account_chart_template(id) ON DELETE RESTRICT;


--
-- Name: account_tax_template account_tax_template_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_tax_template
    ADD CONSTRAINT account_tax_template_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_tax_template_filiation_rel account_tax_template_filiation_rel_child_tax_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_tax_template_filiation_rel
    ADD CONSTRAINT account_tax_template_filiation_rel_child_tax_fkey FOREIGN KEY (child_tax) REFERENCES public.account_tax_template(id) ON DELETE CASCADE;


--
-- Name: account_tax_template_filiation_rel account_tax_template_filiation_rel_parent_tax_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_tax_template_filiation_rel
    ADD CONSTRAINT account_tax_template_filiation_rel_parent_tax_fkey FOREIGN KEY (parent_tax) REFERENCES public.account_tax_template(id) ON DELETE CASCADE;


--
-- Name: account_tax_template account_tax_template_tax_group_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_tax_template
    ADD CONSTRAINT account_tax_template_tax_group_id_fkey FOREIGN KEY (tax_group_id) REFERENCES public.account_tax_group(id) ON DELETE SET NULL;


--
-- Name: account_tax_template account_tax_template_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_tax_template
    ADD CONSTRAINT account_tax_template_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_tax account_tax_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_tax
    ADD CONSTRAINT account_tax_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_tour_upload_bill account_tour_upload_bill_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_tour_upload_bill
    ADD CONSTRAINT account_tour_upload_bill_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_tour_upload_bill_email_confirm account_tour_upload_bill_email_confirm_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_tour_upload_bill_email_confirm
    ADD CONSTRAINT account_tour_upload_bill_email_confirm_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_tour_upload_bill_email_confirm account_tour_upload_bill_email_confirm_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_tour_upload_bill_email_confirm
    ADD CONSTRAINT account_tour_upload_bill_email_confirm_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_tour_upload_bill_ir_attachments_rel account_tour_upload_bill_ir_at_account_tour_upload_bill_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_tour_upload_bill_ir_attachments_rel
    ADD CONSTRAINT account_tour_upload_bill_ir_at_account_tour_upload_bill_id_fkey FOREIGN KEY (account_tour_upload_bill_id) REFERENCES public.account_tour_upload_bill(id) ON DELETE CASCADE;


--
-- Name: account_tour_upload_bill_ir_attachments_rel account_tour_upload_bill_ir_attachments_r_ir_attachment_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_tour_upload_bill_ir_attachments_rel
    ADD CONSTRAINT account_tour_upload_bill_ir_attachments_r_ir_attachment_id_fkey FOREIGN KEY (ir_attachment_id) REFERENCES public.ir_attachment(id) ON DELETE CASCADE;


--
-- Name: account_tour_upload_bill account_tour_upload_bill_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_tour_upload_bill
    ADD CONSTRAINT account_tour_upload_bill_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_unreconcile account_unreconcile_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_unreconcile
    ADD CONSTRAINT account_unreconcile_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: account_unreconcile account_unreconcile_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.account_unreconcile
    ADD CONSTRAINT account_unreconcile_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: auth_totp_device auth_totp_device_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.auth_totp_device
    ADD CONSTRAINT auth_totp_device_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.res_users(id);


--
-- Name: auth_totp_wizard auth_totp_wizard_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.auth_totp_wizard
    ADD CONSTRAINT auth_totp_wizard_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: auth_totp_wizard auth_totp_wizard_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.auth_totp_wizard
    ADD CONSTRAINT auth_totp_wizard_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.res_users(id) ON DELETE CASCADE;


--
-- Name: auth_totp_wizard auth_totp_wizard_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.auth_totp_wizard
    ADD CONSTRAINT auth_totp_wizard_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: badge_unlocked_definition_rel badge_unlocked_definition_rel_gamification_badge_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.badge_unlocked_definition_rel
    ADD CONSTRAINT badge_unlocked_definition_rel_gamification_badge_id_fkey FOREIGN KEY (gamification_badge_id) REFERENCES public.gamification_badge(id) ON DELETE CASCADE;


--
-- Name: badge_unlocked_definition_rel badge_unlocked_definition_rel_gamification_goal_definition_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.badge_unlocked_definition_rel
    ADD CONSTRAINT badge_unlocked_definition_rel_gamification_goal_definition_fkey FOREIGN KEY (gamification_goal_definition_id) REFERENCES public.gamification_goal_definition(id) ON DELETE CASCADE;


--
-- Name: barcode_nomenclature barcode_nomenclature_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.barcode_nomenclature
    ADD CONSTRAINT barcode_nomenclature_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: barcode_nomenclature barcode_nomenclature_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.barcode_nomenclature
    ADD CONSTRAINT barcode_nomenclature_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: barcode_rule barcode_rule_associated_uom_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.barcode_rule
    ADD CONSTRAINT barcode_rule_associated_uom_id_fkey FOREIGN KEY (associated_uom_id) REFERENCES public.uom_uom(id) ON DELETE SET NULL;


--
-- Name: barcode_rule barcode_rule_barcode_nomenclature_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.barcode_rule
    ADD CONSTRAINT barcode_rule_barcode_nomenclature_id_fkey FOREIGN KEY (barcode_nomenclature_id) REFERENCES public.barcode_nomenclature(id) ON DELETE SET NULL;


--
-- Name: barcode_rule barcode_rule_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.barcode_rule
    ADD CONSTRAINT barcode_rule_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: barcode_rule barcode_rule_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.barcode_rule
    ADD CONSTRAINT barcode_rule_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: base_document_layout base_document_layout_company_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.base_document_layout
    ADD CONSTRAINT base_document_layout_company_id_fkey FOREIGN KEY (company_id) REFERENCES public.res_company(id) ON DELETE CASCADE;


--
-- Name: base_document_layout base_document_layout_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.base_document_layout
    ADD CONSTRAINT base_document_layout_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: base_document_layout base_document_layout_report_layout_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.base_document_layout
    ADD CONSTRAINT base_document_layout_report_layout_id_fkey FOREIGN KEY (report_layout_id) REFERENCES public.report_layout(id) ON DELETE SET NULL;


--
-- Name: base_document_layout base_document_layout_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.base_document_layout
    ADD CONSTRAINT base_document_layout_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: base_enable_profiling_wizard base_enable_profiling_wizard_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.base_enable_profiling_wizard
    ADD CONSTRAINT base_enable_profiling_wizard_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: base_enable_profiling_wizard base_enable_profiling_wizard_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.base_enable_profiling_wizard
    ADD CONSTRAINT base_enable_profiling_wizard_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: base_import_import base_import_import_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.base_import_import
    ADD CONSTRAINT base_import_import_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: base_import_import base_import_import_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.base_import_import
    ADD CONSTRAINT base_import_import_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: base_import_mapping base_import_mapping_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.base_import_mapping
    ADD CONSTRAINT base_import_mapping_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: base_import_mapping base_import_mapping_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.base_import_mapping
    ADD CONSTRAINT base_import_mapping_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: base_import_tests_models_char base_import_tests_models_char_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.base_import_tests_models_char
    ADD CONSTRAINT base_import_tests_models_char_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: base_import_tests_models_char_noreadonly base_import_tests_models_char_noreadonly_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.base_import_tests_models_char_noreadonly
    ADD CONSTRAINT base_import_tests_models_char_noreadonly_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: base_import_tests_models_char_noreadonly base_import_tests_models_char_noreadonly_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.base_import_tests_models_char_noreadonly
    ADD CONSTRAINT base_import_tests_models_char_noreadonly_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: base_import_tests_models_char_readonly base_import_tests_models_char_readonly_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.base_import_tests_models_char_readonly
    ADD CONSTRAINT base_import_tests_models_char_readonly_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: base_import_tests_models_char_readonly base_import_tests_models_char_readonly_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.base_import_tests_models_char_readonly
    ADD CONSTRAINT base_import_tests_models_char_readonly_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: base_import_tests_models_char_required base_import_tests_models_char_required_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.base_import_tests_models_char_required
    ADD CONSTRAINT base_import_tests_models_char_required_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: base_import_tests_models_char_required base_import_tests_models_char_required_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.base_import_tests_models_char_required
    ADD CONSTRAINT base_import_tests_models_char_required_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: base_import_tests_models_char_states base_import_tests_models_char_states_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.base_import_tests_models_char_states
    ADD CONSTRAINT base_import_tests_models_char_states_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: base_import_tests_models_char_states base_import_tests_models_char_states_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.base_import_tests_models_char_states
    ADD CONSTRAINT base_import_tests_models_char_states_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: base_import_tests_models_char_stillreadonly base_import_tests_models_char_stillreadonly_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.base_import_tests_models_char_stillreadonly
    ADD CONSTRAINT base_import_tests_models_char_stillreadonly_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: base_import_tests_models_char_stillreadonly base_import_tests_models_char_stillreadonly_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.base_import_tests_models_char_stillreadonly
    ADD CONSTRAINT base_import_tests_models_char_stillreadonly_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: base_import_tests_models_char base_import_tests_models_char_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.base_import_tests_models_char
    ADD CONSTRAINT base_import_tests_models_char_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: base_import_tests_models_complex base_import_tests_models_complex_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.base_import_tests_models_complex
    ADD CONSTRAINT base_import_tests_models_complex_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: base_import_tests_models_complex base_import_tests_models_complex_currency_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.base_import_tests_models_complex
    ADD CONSTRAINT base_import_tests_models_complex_currency_id_fkey FOREIGN KEY (currency_id) REFERENCES public.res_currency(id) ON DELETE SET NULL;


--
-- Name: base_import_tests_models_complex base_import_tests_models_complex_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.base_import_tests_models_complex
    ADD CONSTRAINT base_import_tests_models_complex_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: base_import_tests_models_float base_import_tests_models_float_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.base_import_tests_models_float
    ADD CONSTRAINT base_import_tests_models_float_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: base_import_tests_models_float base_import_tests_models_float_currency_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.base_import_tests_models_float
    ADD CONSTRAINT base_import_tests_models_float_currency_id_fkey FOREIGN KEY (currency_id) REFERENCES public.res_currency(id) ON DELETE SET NULL;


--
-- Name: base_import_tests_models_float base_import_tests_models_float_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.base_import_tests_models_float
    ADD CONSTRAINT base_import_tests_models_float_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: base_import_tests_models_m2o base_import_tests_models_m2o_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.base_import_tests_models_m2o
    ADD CONSTRAINT base_import_tests_models_m2o_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: base_import_tests_models_m2o_related base_import_tests_models_m2o_related_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.base_import_tests_models_m2o_related
    ADD CONSTRAINT base_import_tests_models_m2o_related_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: base_import_tests_models_m2o_related base_import_tests_models_m2o_related_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.base_import_tests_models_m2o_related
    ADD CONSTRAINT base_import_tests_models_m2o_related_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: base_import_tests_models_m2o_required base_import_tests_models_m2o_required_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.base_import_tests_models_m2o_required
    ADD CONSTRAINT base_import_tests_models_m2o_required_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: base_import_tests_models_m2o_required_related base_import_tests_models_m2o_required_related_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.base_import_tests_models_m2o_required_related
    ADD CONSTRAINT base_import_tests_models_m2o_required_related_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: base_import_tests_models_m2o_required_related base_import_tests_models_m2o_required_related_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.base_import_tests_models_m2o_required_related
    ADD CONSTRAINT base_import_tests_models_m2o_required_related_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: base_import_tests_models_m2o_required base_import_tests_models_m2o_required_value_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.base_import_tests_models_m2o_required
    ADD CONSTRAINT base_import_tests_models_m2o_required_value_fkey FOREIGN KEY (value) REFERENCES public.base_import_tests_models_m2o_required_related(id) ON DELETE RESTRICT;


--
-- Name: base_import_tests_models_m2o_required base_import_tests_models_m2o_required_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.base_import_tests_models_m2o_required
    ADD CONSTRAINT base_import_tests_models_m2o_required_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: base_import_tests_models_m2o base_import_tests_models_m2o_value_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.base_import_tests_models_m2o
    ADD CONSTRAINT base_import_tests_models_m2o_value_fkey FOREIGN KEY (value) REFERENCES public.base_import_tests_models_m2o_related(id) ON DELETE SET NULL;


--
-- Name: base_import_tests_models_m2o base_import_tests_models_m2o_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.base_import_tests_models_m2o
    ADD CONSTRAINT base_import_tests_models_m2o_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: base_import_tests_models_o2m_child base_import_tests_models_o2m_child_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.base_import_tests_models_o2m_child
    ADD CONSTRAINT base_import_tests_models_o2m_child_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: base_import_tests_models_o2m_child base_import_tests_models_o2m_child_parent_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.base_import_tests_models_o2m_child
    ADD CONSTRAINT base_import_tests_models_o2m_child_parent_id_fkey FOREIGN KEY (parent_id) REFERENCES public.base_import_tests_models_o2m(id) ON DELETE SET NULL;


--
-- Name: base_import_tests_models_o2m_child base_import_tests_models_o2m_child_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.base_import_tests_models_o2m_child
    ADD CONSTRAINT base_import_tests_models_o2m_child_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: base_import_tests_models_o2m base_import_tests_models_o2m_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.base_import_tests_models_o2m
    ADD CONSTRAINT base_import_tests_models_o2m_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: base_import_tests_models_o2m base_import_tests_models_o2m_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.base_import_tests_models_o2m
    ADD CONSTRAINT base_import_tests_models_o2m_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: base_import_tests_models_preview base_import_tests_models_preview_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.base_import_tests_models_preview
    ADD CONSTRAINT base_import_tests_models_preview_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: base_import_tests_models_preview base_import_tests_models_preview_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.base_import_tests_models_preview
    ADD CONSTRAINT base_import_tests_models_preview_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: base_language_export base_language_export_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.base_language_export
    ADD CONSTRAINT base_language_export_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: base_language_export base_language_export_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.base_language_export
    ADD CONSTRAINT base_language_export_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: base_language_import base_language_import_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.base_language_import
    ADD CONSTRAINT base_language_import_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: base_language_import base_language_import_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.base_language_import
    ADD CONSTRAINT base_language_import_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: base_language_install base_language_install_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.base_language_install
    ADD CONSTRAINT base_language_install_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: base_language_install_website_rel base_language_install_website_rel_base_language_install_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.base_language_install_website_rel
    ADD CONSTRAINT base_language_install_website_rel_base_language_install_id_fkey FOREIGN KEY (base_language_install_id) REFERENCES public.base_language_install(id) ON DELETE CASCADE;


--
-- Name: base_language_install_website_rel base_language_install_website_rel_website_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.base_language_install_website_rel
    ADD CONSTRAINT base_language_install_website_rel_website_id_fkey FOREIGN KEY (website_id) REFERENCES public.website(id) ON DELETE CASCADE;


--
-- Name: base_language_install base_language_install_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.base_language_install
    ADD CONSTRAINT base_language_install_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: base_module_install_request base_module_install_request_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.base_module_install_request
    ADD CONSTRAINT base_module_install_request_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: base_module_install_request base_module_install_request_module_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.base_module_install_request
    ADD CONSTRAINT base_module_install_request_module_id_fkey FOREIGN KEY (module_id) REFERENCES public.ir_module_module(id) ON DELETE CASCADE;


--
-- Name: base_module_install_request base_module_install_request_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.base_module_install_request
    ADD CONSTRAINT base_module_install_request_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.res_users(id) ON DELETE CASCADE;


--
-- Name: base_module_install_request base_module_install_request_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.base_module_install_request
    ADD CONSTRAINT base_module_install_request_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: base_module_install_review base_module_install_review_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.base_module_install_review
    ADD CONSTRAINT base_module_install_review_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: base_module_install_review base_module_install_review_module_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.base_module_install_review
    ADD CONSTRAINT base_module_install_review_module_id_fkey FOREIGN KEY (module_id) REFERENCES public.ir_module_module(id) ON DELETE CASCADE;


--
-- Name: base_module_install_review base_module_install_review_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.base_module_install_review
    ADD CONSTRAINT base_module_install_review_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: base_module_uninstall base_module_uninstall_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.base_module_uninstall
    ADD CONSTRAINT base_module_uninstall_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: base_module_uninstall base_module_uninstall_module_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.base_module_uninstall
    ADD CONSTRAINT base_module_uninstall_module_id_fkey FOREIGN KEY (module_id) REFERENCES public.ir_module_module(id) ON DELETE CASCADE;


--
-- Name: base_module_uninstall base_module_uninstall_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.base_module_uninstall
    ADD CONSTRAINT base_module_uninstall_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: base_module_update base_module_update_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.base_module_update
    ADD CONSTRAINT base_module_update_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: base_module_update base_module_update_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.base_module_update
    ADD CONSTRAINT base_module_update_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: base_module_upgrade base_module_upgrade_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.base_module_upgrade
    ADD CONSTRAINT base_module_upgrade_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: base_module_upgrade base_module_upgrade_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.base_module_upgrade
    ADD CONSTRAINT base_module_upgrade_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: base_partner_merge_automatic_wizard_res_partner_rel base_partner_merge_automatic__base_partner_merge_automatic_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.base_partner_merge_automatic_wizard_res_partner_rel
    ADD CONSTRAINT base_partner_merge_automatic__base_partner_merge_automatic_fkey FOREIGN KEY (base_partner_merge_automatic_wizard_id) REFERENCES public.base_partner_merge_automatic_wizard(id) ON DELETE CASCADE;


--
-- Name: base_partner_merge_automatic_wizard base_partner_merge_automatic_wizard_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.base_partner_merge_automatic_wizard
    ADD CONSTRAINT base_partner_merge_automatic_wizard_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: base_partner_merge_automatic_wizard base_partner_merge_automatic_wizard_current_line_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.base_partner_merge_automatic_wizard
    ADD CONSTRAINT base_partner_merge_automatic_wizard_current_line_id_fkey FOREIGN KEY (current_line_id) REFERENCES public.base_partner_merge_line(id) ON DELETE SET NULL;


--
-- Name: base_partner_merge_automatic_wizard base_partner_merge_automatic_wizard_dst_partner_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.base_partner_merge_automatic_wizard
    ADD CONSTRAINT base_partner_merge_automatic_wizard_dst_partner_id_fkey FOREIGN KEY (dst_partner_id) REFERENCES public.res_partner(id) ON DELETE SET NULL;


--
-- Name: base_partner_merge_automatic_wizard_res_partner_rel base_partner_merge_automatic_wizard_res_par_res_partner_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.base_partner_merge_automatic_wizard_res_partner_rel
    ADD CONSTRAINT base_partner_merge_automatic_wizard_res_par_res_partner_id_fkey FOREIGN KEY (res_partner_id) REFERENCES public.res_partner(id) ON DELETE CASCADE;


--
-- Name: base_partner_merge_automatic_wizard base_partner_merge_automatic_wizard_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.base_partner_merge_automatic_wizard
    ADD CONSTRAINT base_partner_merge_automatic_wizard_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: base_partner_merge_line base_partner_merge_line_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.base_partner_merge_line
    ADD CONSTRAINT base_partner_merge_line_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: base_partner_merge_line base_partner_merge_line_wizard_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.base_partner_merge_line
    ADD CONSTRAINT base_partner_merge_line_wizard_id_fkey FOREIGN KEY (wizard_id) REFERENCES public.base_partner_merge_automatic_wizard(id) ON DELETE SET NULL;


--
-- Name: base_partner_merge_line base_partner_merge_line_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.base_partner_merge_line
    ADD CONSTRAINT base_partner_merge_line_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: bus_bus bus_bus_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.bus_bus
    ADD CONSTRAINT bus_bus_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: bus_bus bus_bus_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.bus_bus
    ADD CONSTRAINT bus_bus_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: bus_presence bus_presence_guest_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.bus_presence
    ADD CONSTRAINT bus_presence_guest_id_fkey FOREIGN KEY (guest_id) REFERENCES public.mail_guest(id) ON DELETE CASCADE;


--
-- Name: bus_presence bus_presence_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.bus_presence
    ADD CONSTRAINT bus_presence_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.res_users(id) ON DELETE CASCADE;


--
-- Name: calendar_alarm_calendar_event_rel calendar_alarm_calendar_event_rel_calendar_alarm_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.calendar_alarm_calendar_event_rel
    ADD CONSTRAINT calendar_alarm_calendar_event_rel_calendar_alarm_id_fkey FOREIGN KEY (calendar_alarm_id) REFERENCES public.calendar_alarm(id) ON DELETE RESTRICT;


--
-- Name: calendar_alarm_calendar_event_rel calendar_alarm_calendar_event_rel_calendar_event_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.calendar_alarm_calendar_event_rel
    ADD CONSTRAINT calendar_alarm_calendar_event_rel_calendar_event_id_fkey FOREIGN KEY (calendar_event_id) REFERENCES public.calendar_event(id) ON DELETE CASCADE;


--
-- Name: calendar_alarm calendar_alarm_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.calendar_alarm
    ADD CONSTRAINT calendar_alarm_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: calendar_alarm calendar_alarm_mail_template_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.calendar_alarm
    ADD CONSTRAINT calendar_alarm_mail_template_id_fkey FOREIGN KEY (mail_template_id) REFERENCES public.mail_template(id) ON DELETE SET NULL;


--
-- Name: calendar_alarm calendar_alarm_sms_template_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.calendar_alarm
    ADD CONSTRAINT calendar_alarm_sms_template_id_fkey FOREIGN KEY (sms_template_id) REFERENCES public.sms_template(id) ON DELETE SET NULL;


--
-- Name: calendar_alarm calendar_alarm_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.calendar_alarm
    ADD CONSTRAINT calendar_alarm_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: calendar_attendee calendar_attendee_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.calendar_attendee
    ADD CONSTRAINT calendar_attendee_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: calendar_attendee calendar_attendee_event_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.calendar_attendee
    ADD CONSTRAINT calendar_attendee_event_id_fkey FOREIGN KEY (event_id) REFERENCES public.calendar_event(id) ON DELETE CASCADE;


--
-- Name: calendar_attendee calendar_attendee_partner_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.calendar_attendee
    ADD CONSTRAINT calendar_attendee_partner_id_fkey FOREIGN KEY (partner_id) REFERENCES public.res_partner(id) ON DELETE RESTRICT;


--
-- Name: calendar_attendee calendar_attendee_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.calendar_attendee
    ADD CONSTRAINT calendar_attendee_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: calendar_event calendar_event_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.calendar_event
    ADD CONSTRAINT calendar_event_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: calendar_event calendar_event_message_main_attachment_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.calendar_event
    ADD CONSTRAINT calendar_event_message_main_attachment_id_fkey FOREIGN KEY (message_main_attachment_id) REFERENCES public.ir_attachment(id) ON DELETE SET NULL;


--
-- Name: calendar_event calendar_event_opportunity_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.calendar_event
    ADD CONSTRAINT calendar_event_opportunity_id_fkey FOREIGN KEY (opportunity_id) REFERENCES public.crm_lead(id) ON DELETE SET NULL;


--
-- Name: calendar_event calendar_event_recurrence_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.calendar_event
    ADD CONSTRAINT calendar_event_recurrence_id_fkey FOREIGN KEY (recurrence_id) REFERENCES public.calendar_recurrence(id) ON DELETE SET NULL;


--
-- Name: calendar_event calendar_event_res_model_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.calendar_event
    ADD CONSTRAINT calendar_event_res_model_id_fkey FOREIGN KEY (res_model_id) REFERENCES public.ir_model(id) ON DELETE CASCADE;


--
-- Name: calendar_event_res_partner_rel calendar_event_res_partner_rel_calendar_event_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.calendar_event_res_partner_rel
    ADD CONSTRAINT calendar_event_res_partner_rel_calendar_event_id_fkey FOREIGN KEY (calendar_event_id) REFERENCES public.calendar_event(id) ON DELETE CASCADE;


--
-- Name: calendar_event_res_partner_rel calendar_event_res_partner_rel_res_partner_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.calendar_event_res_partner_rel
    ADD CONSTRAINT calendar_event_res_partner_rel_res_partner_id_fkey FOREIGN KEY (res_partner_id) REFERENCES public.res_partner(id) ON DELETE CASCADE;


--
-- Name: calendar_event_type calendar_event_type_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.calendar_event_type
    ADD CONSTRAINT calendar_event_type_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: calendar_event_type calendar_event_type_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.calendar_event_type
    ADD CONSTRAINT calendar_event_type_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: calendar_event calendar_event_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.calendar_event
    ADD CONSTRAINT calendar_event_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: calendar_event calendar_event_videocall_channel_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.calendar_event
    ADD CONSTRAINT calendar_event_videocall_channel_id_fkey FOREIGN KEY (videocall_channel_id) REFERENCES public.mail_channel(id) ON DELETE SET NULL;


--
-- Name: calendar_event calendar_event_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.calendar_event
    ADD CONSTRAINT calendar_event_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: calendar_filters calendar_filters_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.calendar_filters
    ADD CONSTRAINT calendar_filters_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: calendar_filters calendar_filters_partner_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.calendar_filters
    ADD CONSTRAINT calendar_filters_partner_id_fkey FOREIGN KEY (partner_id) REFERENCES public.res_partner(id) ON DELETE RESTRICT;


--
-- Name: calendar_filters calendar_filters_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.calendar_filters
    ADD CONSTRAINT calendar_filters_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.res_users(id) ON DELETE RESTRICT;


--
-- Name: calendar_filters calendar_filters_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.calendar_filters
    ADD CONSTRAINT calendar_filters_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: calendar_provider_config calendar_provider_config_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.calendar_provider_config
    ADD CONSTRAINT calendar_provider_config_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: calendar_provider_config calendar_provider_config_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.calendar_provider_config
    ADD CONSTRAINT calendar_provider_config_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: calendar_recurrence calendar_recurrence_base_event_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.calendar_recurrence
    ADD CONSTRAINT calendar_recurrence_base_event_id_fkey FOREIGN KEY (base_event_id) REFERENCES public.calendar_event(id) ON DELETE SET NULL;


--
-- Name: calendar_recurrence calendar_recurrence_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.calendar_recurrence
    ADD CONSTRAINT calendar_recurrence_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: calendar_recurrence calendar_recurrence_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.calendar_recurrence
    ADD CONSTRAINT calendar_recurrence_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: change_password_own change_password_own_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.change_password_own
    ADD CONSTRAINT change_password_own_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: change_password_own change_password_own_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.change_password_own
    ADD CONSTRAINT change_password_own_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: change_password_user change_password_user_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.change_password_user
    ADD CONSTRAINT change_password_user_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: change_password_user change_password_user_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.change_password_user
    ADD CONSTRAINT change_password_user_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.res_users(id) ON DELETE CASCADE;


--
-- Name: change_password_user change_password_user_wizard_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.change_password_user
    ADD CONSTRAINT change_password_user_wizard_id_fkey FOREIGN KEY (wizard_id) REFERENCES public.change_password_wizard(id) ON DELETE CASCADE;


--
-- Name: change_password_user change_password_user_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.change_password_user
    ADD CONSTRAINT change_password_user_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: change_password_wizard change_password_wizard_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.change_password_wizard
    ADD CONSTRAINT change_password_wizard_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: change_password_wizard change_password_wizard_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.change_password_wizard
    ADD CONSTRAINT change_password_wizard_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: chatbot_message chatbot_message_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.chatbot_message
    ADD CONSTRAINT chatbot_message_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: chatbot_message chatbot_message_mail_channel_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.chatbot_message
    ADD CONSTRAINT chatbot_message_mail_channel_id_fkey FOREIGN KEY (mail_channel_id) REFERENCES public.mail_channel(id) ON DELETE CASCADE;


--
-- Name: chatbot_message chatbot_message_mail_message_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.chatbot_message
    ADD CONSTRAINT chatbot_message_mail_message_id_fkey FOREIGN KEY (mail_message_id) REFERENCES public.mail_message(id) ON DELETE CASCADE;


--
-- Name: chatbot_message chatbot_message_script_step_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.chatbot_message
    ADD CONSTRAINT chatbot_message_script_step_id_fkey FOREIGN KEY (script_step_id) REFERENCES public.chatbot_script_step(id) ON DELETE CASCADE;


--
-- Name: chatbot_message chatbot_message_user_script_answer_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.chatbot_message
    ADD CONSTRAINT chatbot_message_user_script_answer_id_fkey FOREIGN KEY (user_script_answer_id) REFERENCES public.chatbot_script_answer(id) ON DELETE SET NULL;


--
-- Name: chatbot_message chatbot_message_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.chatbot_message
    ADD CONSTRAINT chatbot_message_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: chatbot_script_answer_chatbot_script_step_rel chatbot_script_answer_chatbot_scr_chatbot_script_answer_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.chatbot_script_answer_chatbot_script_step_rel
    ADD CONSTRAINT chatbot_script_answer_chatbot_scr_chatbot_script_answer_id_fkey FOREIGN KEY (chatbot_script_answer_id) REFERENCES public.chatbot_script_answer(id) ON DELETE CASCADE;


--
-- Name: chatbot_script_answer_chatbot_script_step_rel chatbot_script_answer_chatbot_scrip_chatbot_script_step_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.chatbot_script_answer_chatbot_script_step_rel
    ADD CONSTRAINT chatbot_script_answer_chatbot_scrip_chatbot_script_step_id_fkey FOREIGN KEY (chatbot_script_step_id) REFERENCES public.chatbot_script_step(id) ON DELETE CASCADE;


--
-- Name: chatbot_script_answer chatbot_script_answer_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.chatbot_script_answer
    ADD CONSTRAINT chatbot_script_answer_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: chatbot_script_answer chatbot_script_answer_script_step_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.chatbot_script_answer
    ADD CONSTRAINT chatbot_script_answer_script_step_id_fkey FOREIGN KEY (script_step_id) REFERENCES public.chatbot_script_step(id) ON DELETE CASCADE;


--
-- Name: chatbot_script_answer chatbot_script_answer_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.chatbot_script_answer
    ADD CONSTRAINT chatbot_script_answer_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: chatbot_script chatbot_script_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.chatbot_script
    ADD CONSTRAINT chatbot_script_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: chatbot_script chatbot_script_operator_partner_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.chatbot_script
    ADD CONSTRAINT chatbot_script_operator_partner_id_fkey FOREIGN KEY (operator_partner_id) REFERENCES public.res_partner(id) ON DELETE RESTRICT;


--
-- Name: chatbot_script chatbot_script_source_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.chatbot_script
    ADD CONSTRAINT chatbot_script_source_id_fkey FOREIGN KEY (source_id) REFERENCES public.utm_source(id) ON DELETE RESTRICT;


--
-- Name: chatbot_script_step chatbot_script_step_chatbot_script_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.chatbot_script_step
    ADD CONSTRAINT chatbot_script_step_chatbot_script_id_fkey FOREIGN KEY (chatbot_script_id) REFERENCES public.chatbot_script(id) ON DELETE CASCADE;


--
-- Name: chatbot_script_step chatbot_script_step_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.chatbot_script_step
    ADD CONSTRAINT chatbot_script_step_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: chatbot_script_step chatbot_script_step_crm_team_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.chatbot_script_step
    ADD CONSTRAINT chatbot_script_step_crm_team_id_fkey FOREIGN KEY (crm_team_id) REFERENCES public.crm_team(id) ON DELETE SET NULL;


--
-- Name: chatbot_script_step chatbot_script_step_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.chatbot_script_step
    ADD CONSTRAINT chatbot_script_step_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: chatbot_script chatbot_script_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.chatbot_script
    ADD CONSTRAINT chatbot_script_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: confirm_stock_sms confirm_stock_sms_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.confirm_stock_sms
    ADD CONSTRAINT confirm_stock_sms_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: confirm_stock_sms confirm_stock_sms_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.confirm_stock_sms
    ADD CONSTRAINT confirm_stock_sms_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: crm_convert_lead_mass_lead_rel crm_convert_lead_mass_lead_re_crm_lead2opportunity_partner_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_convert_lead_mass_lead_rel
    ADD CONSTRAINT crm_convert_lead_mass_lead_re_crm_lead2opportunity_partner_fkey FOREIGN KEY (crm_lead2opportunity_partner_mass_id) REFERENCES public.crm_lead2opportunity_partner_mass(id) ON DELETE CASCADE;


--
-- Name: crm_convert_lead_mass_lead_rel crm_convert_lead_mass_lead_rel_crm_lead_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_convert_lead_mass_lead_rel
    ADD CONSTRAINT crm_convert_lead_mass_lead_rel_crm_lead_id_fkey FOREIGN KEY (crm_lead_id) REFERENCES public.crm_lead(id) ON DELETE CASCADE;


--
-- Name: crm_iap_lead_helpers crm_iap_lead_helpers_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_iap_lead_helpers
    ADD CONSTRAINT crm_iap_lead_helpers_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: crm_iap_lead_helpers crm_iap_lead_helpers_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_iap_lead_helpers
    ADD CONSTRAINT crm_iap_lead_helpers_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: crm_iap_lead_industry crm_iap_lead_industry_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_iap_lead_industry
    ADD CONSTRAINT crm_iap_lead_industry_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: crm_iap_lead_industry_crm_iap_lead_mining_request_rel crm_iap_lead_industry_crm_iap_crm_iap_lead_mining_request__fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_iap_lead_industry_crm_iap_lead_mining_request_rel
    ADD CONSTRAINT crm_iap_lead_industry_crm_iap_crm_iap_lead_mining_request__fkey FOREIGN KEY (crm_iap_lead_mining_request_id) REFERENCES public.crm_iap_lead_mining_request(id) ON DELETE CASCADE;


--
-- Name: crm_iap_lead_industry_crm_iap_lead_mining_request_rel crm_iap_lead_industry_crm_iap_lea_crm_iap_lead_industry_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_iap_lead_industry_crm_iap_lead_mining_request_rel
    ADD CONSTRAINT crm_iap_lead_industry_crm_iap_lea_crm_iap_lead_industry_id_fkey FOREIGN KEY (crm_iap_lead_industry_id) REFERENCES public.crm_iap_lead_industry(id) ON DELETE CASCADE;


--
-- Name: crm_iap_lead_industry crm_iap_lead_industry_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_iap_lead_industry
    ADD CONSTRAINT crm_iap_lead_industry_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: crm_iap_lead_mining_request_res_country_state_rel crm_iap_lead_mining_request__crm_iap_lead_mining_request__fkey1; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_iap_lead_mining_request_res_country_state_rel
    ADD CONSTRAINT crm_iap_lead_mining_request__crm_iap_lead_mining_request__fkey1 FOREIGN KEY (crm_iap_lead_mining_request_id) REFERENCES public.crm_iap_lead_mining_request(id) ON DELETE CASCADE;


--
-- Name: crm_iap_lead_mining_request_crm_iap_lead_role_rel crm_iap_lead_mining_request__crm_iap_lead_mining_request__fkey2; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_iap_lead_mining_request_crm_iap_lead_role_rel
    ADD CONSTRAINT crm_iap_lead_mining_request__crm_iap_lead_mining_request__fkey2 FOREIGN KEY (crm_iap_lead_mining_request_id) REFERENCES public.crm_iap_lead_mining_request(id) ON DELETE CASCADE;


--
-- Name: crm_iap_lead_mining_request_crm_tag_rel crm_iap_lead_mining_request_c_crm_iap_lead_mining_request__fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_iap_lead_mining_request_crm_tag_rel
    ADD CONSTRAINT crm_iap_lead_mining_request_c_crm_iap_lead_mining_request__fkey FOREIGN KEY (crm_iap_lead_mining_request_id) REFERENCES public.crm_iap_lead_mining_request(id) ON DELETE CASCADE;


--
-- Name: crm_iap_lead_mining_request crm_iap_lead_mining_request_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_iap_lead_mining_request
    ADD CONSTRAINT crm_iap_lead_mining_request_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: crm_iap_lead_mining_request_crm_iap_lead_role_rel crm_iap_lead_mining_request_crm_iap_l_crm_iap_lead_role_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_iap_lead_mining_request_crm_iap_lead_role_rel
    ADD CONSTRAINT crm_iap_lead_mining_request_crm_iap_l_crm_iap_lead_role_id_fkey FOREIGN KEY (crm_iap_lead_role_id) REFERENCES public.crm_iap_lead_role(id) ON DELETE CASCADE;


--
-- Name: crm_iap_lead_mining_request_crm_tag_rel crm_iap_lead_mining_request_crm_tag_rel_crm_tag_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_iap_lead_mining_request_crm_tag_rel
    ADD CONSTRAINT crm_iap_lead_mining_request_crm_tag_rel_crm_tag_id_fkey FOREIGN KEY (crm_tag_id) REFERENCES public.crm_tag(id) ON DELETE CASCADE;


--
-- Name: crm_iap_lead_mining_request crm_iap_lead_mining_request_preferred_role_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_iap_lead_mining_request
    ADD CONSTRAINT crm_iap_lead_mining_request_preferred_role_id_fkey FOREIGN KEY (preferred_role_id) REFERENCES public.crm_iap_lead_role(id) ON DELETE SET NULL;


--
-- Name: crm_iap_lead_mining_request_res_country_rel crm_iap_lead_mining_request_r_crm_iap_lead_mining_request__fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_iap_lead_mining_request_res_country_rel
    ADD CONSTRAINT crm_iap_lead_mining_request_r_crm_iap_lead_mining_request__fkey FOREIGN KEY (crm_iap_lead_mining_request_id) REFERENCES public.crm_iap_lead_mining_request(id) ON DELETE CASCADE;


--
-- Name: crm_iap_lead_mining_request_res_country_state_rel crm_iap_lead_mining_request_res_count_res_country_state_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_iap_lead_mining_request_res_country_state_rel
    ADD CONSTRAINT crm_iap_lead_mining_request_res_count_res_country_state_id_fkey FOREIGN KEY (res_country_state_id) REFERENCES public.res_country_state(id) ON DELETE CASCADE;


--
-- Name: crm_iap_lead_mining_request_res_country_rel crm_iap_lead_mining_request_res_country_rel_res_country_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_iap_lead_mining_request_res_country_rel
    ADD CONSTRAINT crm_iap_lead_mining_request_res_country_rel_res_country_id_fkey FOREIGN KEY (res_country_id) REFERENCES public.res_country(id) ON DELETE CASCADE;


--
-- Name: crm_iap_lead_mining_request crm_iap_lead_mining_request_seniority_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_iap_lead_mining_request
    ADD CONSTRAINT crm_iap_lead_mining_request_seniority_id_fkey FOREIGN KEY (seniority_id) REFERENCES public.crm_iap_lead_seniority(id) ON DELETE SET NULL;


--
-- Name: crm_iap_lead_mining_request crm_iap_lead_mining_request_team_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_iap_lead_mining_request
    ADD CONSTRAINT crm_iap_lead_mining_request_team_id_fkey FOREIGN KEY (team_id) REFERENCES public.crm_team(id) ON DELETE SET NULL;


--
-- Name: crm_iap_lead_mining_request crm_iap_lead_mining_request_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_iap_lead_mining_request
    ADD CONSTRAINT crm_iap_lead_mining_request_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: crm_iap_lead_mining_request crm_iap_lead_mining_request_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_iap_lead_mining_request
    ADD CONSTRAINT crm_iap_lead_mining_request_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: crm_iap_lead_role crm_iap_lead_role_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_iap_lead_role
    ADD CONSTRAINT crm_iap_lead_role_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: crm_iap_lead_role crm_iap_lead_role_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_iap_lead_role
    ADD CONSTRAINT crm_iap_lead_role_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: crm_iap_lead_seniority crm_iap_lead_seniority_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_iap_lead_seniority
    ADD CONSTRAINT crm_iap_lead_seniority_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: crm_iap_lead_seniority crm_iap_lead_seniority_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_iap_lead_seniority
    ADD CONSTRAINT crm_iap_lead_seniority_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: crm_lead2opportunity_partner_mass_res_users_rel crm_lead2opportunity_partner__crm_lead2opportunity_partner_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_lead2opportunity_partner_mass_res_users_rel
    ADD CONSTRAINT crm_lead2opportunity_partner__crm_lead2opportunity_partner_fkey FOREIGN KEY (crm_lead2opportunity_partner_mass_id) REFERENCES public.crm_lead2opportunity_partner_mass(id) ON DELETE CASCADE;


--
-- Name: crm_lead2opportunity_partner crm_lead2opportunity_partner_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_lead2opportunity_partner
    ADD CONSTRAINT crm_lead2opportunity_partner_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: crm_lead2opportunity_partner crm_lead2opportunity_partner_lead_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_lead2opportunity_partner
    ADD CONSTRAINT crm_lead2opportunity_partner_lead_id_fkey FOREIGN KEY (lead_id) REFERENCES public.crm_lead(id) ON DELETE CASCADE;


--
-- Name: crm_lead2opportunity_partner_mass crm_lead2opportunity_partner_mass_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_lead2opportunity_partner_mass
    ADD CONSTRAINT crm_lead2opportunity_partner_mass_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: crm_lead2opportunity_partner_mass crm_lead2opportunity_partner_mass_lead_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_lead2opportunity_partner_mass
    ADD CONSTRAINT crm_lead2opportunity_partner_mass_lead_id_fkey FOREIGN KEY (lead_id) REFERENCES public.crm_lead(id) ON DELETE SET NULL;


--
-- Name: crm_lead2opportunity_partner_mass crm_lead2opportunity_partner_mass_partner_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_lead2opportunity_partner_mass
    ADD CONSTRAINT crm_lead2opportunity_partner_mass_partner_id_fkey FOREIGN KEY (partner_id) REFERENCES public.res_partner(id) ON DELETE SET NULL;


--
-- Name: crm_lead2opportunity_partner_mass_res_users_rel crm_lead2opportunity_partner_mass_res_users_r_res_users_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_lead2opportunity_partner_mass_res_users_rel
    ADD CONSTRAINT crm_lead2opportunity_partner_mass_res_users_r_res_users_id_fkey FOREIGN KEY (res_users_id) REFERENCES public.res_users(id) ON DELETE CASCADE;


--
-- Name: crm_lead2opportunity_partner_mass crm_lead2opportunity_partner_mass_team_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_lead2opportunity_partner_mass
    ADD CONSTRAINT crm_lead2opportunity_partner_mass_team_id_fkey FOREIGN KEY (team_id) REFERENCES public.crm_team(id) ON DELETE SET NULL;


--
-- Name: crm_lead2opportunity_partner_mass crm_lead2opportunity_partner_mass_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_lead2opportunity_partner_mass
    ADD CONSTRAINT crm_lead2opportunity_partner_mass_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: crm_lead2opportunity_partner_mass crm_lead2opportunity_partner_mass_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_lead2opportunity_partner_mass
    ADD CONSTRAINT crm_lead2opportunity_partner_mass_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: crm_lead2opportunity_partner crm_lead2opportunity_partner_partner_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_lead2opportunity_partner
    ADD CONSTRAINT crm_lead2opportunity_partner_partner_id_fkey FOREIGN KEY (partner_id) REFERENCES public.res_partner(id) ON DELETE SET NULL;


--
-- Name: crm_lead2opportunity_partner crm_lead2opportunity_partner_team_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_lead2opportunity_partner
    ADD CONSTRAINT crm_lead2opportunity_partner_team_id_fkey FOREIGN KEY (team_id) REFERENCES public.crm_team(id) ON DELETE SET NULL;


--
-- Name: crm_lead2opportunity_partner crm_lead2opportunity_partner_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_lead2opportunity_partner
    ADD CONSTRAINT crm_lead2opportunity_partner_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: crm_lead2opportunity_partner crm_lead2opportunity_partner_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_lead2opportunity_partner
    ADD CONSTRAINT crm_lead2opportunity_partner_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: crm_lead crm_lead_campaign_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_lead
    ADD CONSTRAINT crm_lead_campaign_id_fkey FOREIGN KEY (campaign_id) REFERENCES public.utm_campaign(id) ON DELETE SET NULL;


--
-- Name: crm_lead crm_lead_company_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_lead
    ADD CONSTRAINT crm_lead_company_id_fkey FOREIGN KEY (company_id) REFERENCES public.res_company(id) ON DELETE SET NULL;


--
-- Name: crm_lead crm_lead_country_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_lead
    ADD CONSTRAINT crm_lead_country_id_fkey FOREIGN KEY (country_id) REFERENCES public.res_country(id) ON DELETE SET NULL;


--
-- Name: crm_lead crm_lead_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_lead
    ADD CONSTRAINT crm_lead_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: crm_lead_crm_lead2opportunity_partner_mass_rel crm_lead_crm_lead2opportunit_crm_lead2opportunity_partner_fkey1; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_lead_crm_lead2opportunity_partner_mass_rel
    ADD CONSTRAINT crm_lead_crm_lead2opportunit_crm_lead2opportunity_partner_fkey1 FOREIGN KEY (crm_lead2opportunity_partner_mass_id) REFERENCES public.crm_lead2opportunity_partner_mass(id) ON DELETE CASCADE;


--
-- Name: crm_lead_crm_lead2opportunity_partner_rel crm_lead_crm_lead2opportunity_crm_lead2opportunity_partner_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_lead_crm_lead2opportunity_partner_rel
    ADD CONSTRAINT crm_lead_crm_lead2opportunity_crm_lead2opportunity_partner_fkey FOREIGN KEY (crm_lead2opportunity_partner_id) REFERENCES public.crm_lead2opportunity_partner(id) ON DELETE CASCADE;


--
-- Name: crm_lead_crm_lead2opportunity_partner_mass_rel crm_lead_crm_lead2opportunity_partner_mass_rel_crm_lead_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_lead_crm_lead2opportunity_partner_mass_rel
    ADD CONSTRAINT crm_lead_crm_lead2opportunity_partner_mass_rel_crm_lead_id_fkey FOREIGN KEY (crm_lead_id) REFERENCES public.crm_lead(id) ON DELETE CASCADE;


--
-- Name: crm_lead_crm_lead2opportunity_partner_rel crm_lead_crm_lead2opportunity_partner_rel_crm_lead_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_lead_crm_lead2opportunity_partner_rel
    ADD CONSTRAINT crm_lead_crm_lead2opportunity_partner_rel_crm_lead_id_fkey FOREIGN KEY (crm_lead_id) REFERENCES public.crm_lead(id) ON DELETE CASCADE;


--
-- Name: crm_lead crm_lead_lang_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_lead
    ADD CONSTRAINT crm_lead_lang_id_fkey FOREIGN KEY (lang_id) REFERENCES public.res_lang(id) ON DELETE SET NULL;


--
-- Name: crm_lead crm_lead_lead_mining_request_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_lead
    ADD CONSTRAINT crm_lead_lead_mining_request_id_fkey FOREIGN KEY (lead_mining_request_id) REFERENCES public.crm_iap_lead_mining_request(id) ON DELETE SET NULL;


--
-- Name: crm_lead_lost crm_lead_lost_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_lead_lost
    ADD CONSTRAINT crm_lead_lost_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: crm_lead_lost crm_lead_lost_lost_reason_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_lead_lost
    ADD CONSTRAINT crm_lead_lost_lost_reason_id_fkey FOREIGN KEY (lost_reason_id) REFERENCES public.crm_lost_reason(id) ON DELETE SET NULL;


--
-- Name: crm_lead crm_lead_lost_reason_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_lead
    ADD CONSTRAINT crm_lead_lost_reason_id_fkey FOREIGN KEY (lost_reason_id) REFERENCES public.crm_lost_reason(id) ON DELETE RESTRICT;


--
-- Name: crm_lead_lost crm_lead_lost_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_lead_lost
    ADD CONSTRAINT crm_lead_lost_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: crm_lead crm_lead_medium_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_lead
    ADD CONSTRAINT crm_lead_medium_id_fkey FOREIGN KEY (medium_id) REFERENCES public.utm_medium(id) ON DELETE SET NULL;


--
-- Name: crm_lead crm_lead_message_main_attachment_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_lead
    ADD CONSTRAINT crm_lead_message_main_attachment_id_fkey FOREIGN KEY (message_main_attachment_id) REFERENCES public.ir_attachment(id) ON DELETE SET NULL;


--
-- Name: crm_lead crm_lead_partner_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_lead
    ADD CONSTRAINT crm_lead_partner_id_fkey FOREIGN KEY (partner_id) REFERENCES public.res_partner(id) ON DELETE SET NULL;


--
-- Name: crm_lead_pls_update crm_lead_pls_update_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_lead_pls_update
    ADD CONSTRAINT crm_lead_pls_update_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: crm_lead_pls_update_crm_lead_scoring_frequency_field_rel crm_lead_pls_update_crm_lead__crm_lead_scoring_frequency_f_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_lead_pls_update_crm_lead_scoring_frequency_field_rel
    ADD CONSTRAINT crm_lead_pls_update_crm_lead__crm_lead_scoring_frequency_f_fkey FOREIGN KEY (crm_lead_scoring_frequency_field_id) REFERENCES public.crm_lead_scoring_frequency_field(id) ON DELETE CASCADE;


--
-- Name: crm_lead_pls_update_crm_lead_scoring_frequency_field_rel crm_lead_pls_update_crm_lead_scorin_crm_lead_pls_update_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_lead_pls_update_crm_lead_scoring_frequency_field_rel
    ADD CONSTRAINT crm_lead_pls_update_crm_lead_scorin_crm_lead_pls_update_id_fkey FOREIGN KEY (crm_lead_pls_update_id) REFERENCES public.crm_lead_pls_update(id) ON DELETE CASCADE;


--
-- Name: crm_lead_pls_update crm_lead_pls_update_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_lead_pls_update
    ADD CONSTRAINT crm_lead_pls_update_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: crm_lead crm_lead_recurring_plan_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_lead
    ADD CONSTRAINT crm_lead_recurring_plan_fkey FOREIGN KEY (recurring_plan) REFERENCES public.crm_recurring_plan(id) ON DELETE SET NULL;


--
-- Name: crm_lead_scoring_frequency crm_lead_scoring_frequency_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_lead_scoring_frequency
    ADD CONSTRAINT crm_lead_scoring_frequency_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: crm_lead_scoring_frequency_field crm_lead_scoring_frequency_field_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_lead_scoring_frequency_field
    ADD CONSTRAINT crm_lead_scoring_frequency_field_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: crm_lead_scoring_frequency_field crm_lead_scoring_frequency_field_field_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_lead_scoring_frequency_field
    ADD CONSTRAINT crm_lead_scoring_frequency_field_field_id_fkey FOREIGN KEY (field_id) REFERENCES public.ir_model_fields(id) ON DELETE CASCADE;


--
-- Name: crm_lead_scoring_frequency_field crm_lead_scoring_frequency_field_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_lead_scoring_frequency_field
    ADD CONSTRAINT crm_lead_scoring_frequency_field_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: crm_lead_scoring_frequency crm_lead_scoring_frequency_team_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_lead_scoring_frequency
    ADD CONSTRAINT crm_lead_scoring_frequency_team_id_fkey FOREIGN KEY (team_id) REFERENCES public.crm_team(id) ON DELETE CASCADE;


--
-- Name: crm_lead_scoring_frequency crm_lead_scoring_frequency_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_lead_scoring_frequency
    ADD CONSTRAINT crm_lead_scoring_frequency_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: crm_lead crm_lead_source_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_lead
    ADD CONSTRAINT crm_lead_source_id_fkey FOREIGN KEY (source_id) REFERENCES public.utm_source(id) ON DELETE SET NULL;


--
-- Name: crm_lead crm_lead_stage_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_lead
    ADD CONSTRAINT crm_lead_stage_id_fkey FOREIGN KEY (stage_id) REFERENCES public.crm_stage(id) ON DELETE RESTRICT;


--
-- Name: crm_lead crm_lead_state_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_lead
    ADD CONSTRAINT crm_lead_state_id_fkey FOREIGN KEY (state_id) REFERENCES public.res_country_state(id) ON DELETE SET NULL;


--
-- Name: crm_lead crm_lead_team_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_lead
    ADD CONSTRAINT crm_lead_team_id_fkey FOREIGN KEY (team_id) REFERENCES public.crm_team(id) ON DELETE SET NULL;


--
-- Name: crm_lead crm_lead_title_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_lead
    ADD CONSTRAINT crm_lead_title_fkey FOREIGN KEY (title) REFERENCES public.res_partner_title(id) ON DELETE SET NULL;


--
-- Name: crm_lead crm_lead_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_lead
    ADD CONSTRAINT crm_lead_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: crm_lead_website_visitor_rel crm_lead_website_visitor_rel_crm_lead_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_lead_website_visitor_rel
    ADD CONSTRAINT crm_lead_website_visitor_rel_crm_lead_id_fkey FOREIGN KEY (crm_lead_id) REFERENCES public.crm_lead(id) ON DELETE CASCADE;


--
-- Name: crm_lead_website_visitor_rel crm_lead_website_visitor_rel_website_visitor_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_lead_website_visitor_rel
    ADD CONSTRAINT crm_lead_website_visitor_rel_website_visitor_id_fkey FOREIGN KEY (website_visitor_id) REFERENCES public.website_visitor(id) ON DELETE CASCADE;


--
-- Name: crm_lead crm_lead_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_lead
    ADD CONSTRAINT crm_lead_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: crm_lost_reason crm_lost_reason_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_lost_reason
    ADD CONSTRAINT crm_lost_reason_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: crm_lost_reason crm_lost_reason_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_lost_reason
    ADD CONSTRAINT crm_lost_reason_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: crm_merge_opportunity crm_merge_opportunity_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_merge_opportunity
    ADD CONSTRAINT crm_merge_opportunity_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: crm_merge_opportunity crm_merge_opportunity_team_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_merge_opportunity
    ADD CONSTRAINT crm_merge_opportunity_team_id_fkey FOREIGN KEY (team_id) REFERENCES public.crm_team(id) ON DELETE SET NULL;


--
-- Name: crm_merge_opportunity crm_merge_opportunity_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_merge_opportunity
    ADD CONSTRAINT crm_merge_opportunity_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: crm_merge_opportunity crm_merge_opportunity_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_merge_opportunity
    ADD CONSTRAINT crm_merge_opportunity_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: crm_quotation_partner crm_quotation_partner_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_quotation_partner
    ADD CONSTRAINT crm_quotation_partner_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: crm_quotation_partner crm_quotation_partner_lead_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_quotation_partner
    ADD CONSTRAINT crm_quotation_partner_lead_id_fkey FOREIGN KEY (lead_id) REFERENCES public.crm_lead(id) ON DELETE CASCADE;


--
-- Name: crm_quotation_partner crm_quotation_partner_partner_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_quotation_partner
    ADD CONSTRAINT crm_quotation_partner_partner_id_fkey FOREIGN KEY (partner_id) REFERENCES public.res_partner(id) ON DELETE SET NULL;


--
-- Name: crm_quotation_partner crm_quotation_partner_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_quotation_partner
    ADD CONSTRAINT crm_quotation_partner_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: crm_recurring_plan crm_recurring_plan_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_recurring_plan
    ADD CONSTRAINT crm_recurring_plan_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: crm_recurring_plan crm_recurring_plan_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_recurring_plan
    ADD CONSTRAINT crm_recurring_plan_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: crm_stage crm_stage_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_stage
    ADD CONSTRAINT crm_stage_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: crm_stage crm_stage_team_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_stage
    ADD CONSTRAINT crm_stage_team_id_fkey FOREIGN KEY (team_id) REFERENCES public.crm_team(id) ON DELETE SET NULL;


--
-- Name: crm_stage crm_stage_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_stage
    ADD CONSTRAINT crm_stage_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: crm_tag crm_tag_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_tag
    ADD CONSTRAINT crm_tag_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: crm_tag_rel crm_tag_rel_lead_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_tag_rel
    ADD CONSTRAINT crm_tag_rel_lead_id_fkey FOREIGN KEY (lead_id) REFERENCES public.crm_lead(id) ON DELETE CASCADE;


--
-- Name: crm_tag_rel crm_tag_rel_tag_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_tag_rel
    ADD CONSTRAINT crm_tag_rel_tag_id_fkey FOREIGN KEY (tag_id) REFERENCES public.crm_tag(id) ON DELETE CASCADE;


--
-- Name: crm_tag crm_tag_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_tag
    ADD CONSTRAINT crm_tag_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: crm_team crm_team_alias_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_team
    ADD CONSTRAINT crm_team_alias_id_fkey FOREIGN KEY (alias_id) REFERENCES public.mail_alias(id) ON DELETE RESTRICT;


--
-- Name: crm_team crm_team_company_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_team
    ADD CONSTRAINT crm_team_company_id_fkey FOREIGN KEY (company_id) REFERENCES public.res_company(id) ON DELETE SET NULL;


--
-- Name: crm_team crm_team_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_team
    ADD CONSTRAINT crm_team_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: crm_team_member crm_team_member_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_team_member
    ADD CONSTRAINT crm_team_member_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: crm_team_member crm_team_member_crm_team_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_team_member
    ADD CONSTRAINT crm_team_member_crm_team_id_fkey FOREIGN KEY (crm_team_id) REFERENCES public.crm_team(id) ON DELETE CASCADE;


--
-- Name: crm_team_member crm_team_member_message_main_attachment_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_team_member
    ADD CONSTRAINT crm_team_member_message_main_attachment_id_fkey FOREIGN KEY (message_main_attachment_id) REFERENCES public.ir_attachment(id) ON DELETE SET NULL;


--
-- Name: crm_team_member crm_team_member_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_team_member
    ADD CONSTRAINT crm_team_member_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.res_users(id) ON DELETE CASCADE;


--
-- Name: crm_team_member crm_team_member_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_team_member
    ADD CONSTRAINT crm_team_member_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: crm_team crm_team_message_main_attachment_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_team
    ADD CONSTRAINT crm_team_message_main_attachment_id_fkey FOREIGN KEY (message_main_attachment_id) REFERENCES public.ir_attachment(id) ON DELETE SET NULL;


--
-- Name: crm_team crm_team_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_team
    ADD CONSTRAINT crm_team_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: crm_team crm_team_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.crm_team
    ADD CONSTRAINT crm_team_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: decimal_precision decimal_precision_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.decimal_precision
    ADD CONSTRAINT decimal_precision_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: decimal_precision decimal_precision_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.decimal_precision
    ADD CONSTRAINT decimal_precision_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: digest_digest digest_digest_company_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.digest_digest
    ADD CONSTRAINT digest_digest_company_id_fkey FOREIGN KEY (company_id) REFERENCES public.res_company(id) ON DELETE SET NULL;


--
-- Name: digest_digest digest_digest_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.digest_digest
    ADD CONSTRAINT digest_digest_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: digest_digest_res_users_rel digest_digest_res_users_rel_digest_digest_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.digest_digest_res_users_rel
    ADD CONSTRAINT digest_digest_res_users_rel_digest_digest_id_fkey FOREIGN KEY (digest_digest_id) REFERENCES public.digest_digest(id) ON DELETE CASCADE;


--
-- Name: digest_digest_res_users_rel digest_digest_res_users_rel_res_users_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.digest_digest_res_users_rel
    ADD CONSTRAINT digest_digest_res_users_rel_res_users_id_fkey FOREIGN KEY (res_users_id) REFERENCES public.res_users(id) ON DELETE CASCADE;


--
-- Name: digest_digest digest_digest_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.digest_digest
    ADD CONSTRAINT digest_digest_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: digest_tip digest_tip_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.digest_tip
    ADD CONSTRAINT digest_tip_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: digest_tip digest_tip_group_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.digest_tip
    ADD CONSTRAINT digest_tip_group_id_fkey FOREIGN KEY (group_id) REFERENCES public.res_groups(id) ON DELETE SET NULL;


--
-- Name: digest_tip_res_users_rel digest_tip_res_users_rel_digest_tip_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.digest_tip_res_users_rel
    ADD CONSTRAINT digest_tip_res_users_rel_digest_tip_id_fkey FOREIGN KEY (digest_tip_id) REFERENCES public.digest_tip(id) ON DELETE CASCADE;


--
-- Name: digest_tip_res_users_rel digest_tip_res_users_rel_res_users_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.digest_tip_res_users_rel
    ADD CONSTRAINT digest_tip_res_users_rel_res_users_id_fkey FOREIGN KEY (res_users_id) REFERENCES public.res_users(id) ON DELETE CASCADE;


--
-- Name: digest_tip digest_tip_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.digest_tip
    ADD CONSTRAINT digest_tip_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: email_template_attachment_rel email_template_attachment_rel_attachment_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.email_template_attachment_rel
    ADD CONSTRAINT email_template_attachment_rel_attachment_id_fkey FOREIGN KEY (attachment_id) REFERENCES public.ir_attachment(id) ON DELETE CASCADE;


--
-- Name: email_template_attachment_rel email_template_attachment_rel_email_template_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.email_template_attachment_rel
    ADD CONSTRAINT email_template_attachment_rel_email_template_id_fkey FOREIGN KEY (email_template_id) REFERENCES public.mail_template(id) ON DELETE CASCADE;


--
-- Name: employee_category_rel employee_category_rel_category_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.employee_category_rel
    ADD CONSTRAINT employee_category_rel_category_id_fkey FOREIGN KEY (category_id) REFERENCES public.hr_employee_category(id) ON DELETE CASCADE;


--
-- Name: employee_category_rel employee_category_rel_emp_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.employee_category_rel
    ADD CONSTRAINT employee_category_rel_emp_id_fkey FOREIGN KEY (emp_id) REFERENCES public.hr_employee(id) ON DELETE CASCADE;


--
-- Name: expense_tax expense_tax_expense_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.expense_tax
    ADD CONSTRAINT expense_tax_expense_id_fkey FOREIGN KEY (expense_id) REFERENCES public.hr_expense(id) ON DELETE CASCADE;


--
-- Name: expense_tax expense_tax_tax_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.expense_tax
    ADD CONSTRAINT expense_tax_tax_id_fkey FOREIGN KEY (tax_id) REFERENCES public.account_tax(id) ON DELETE CASCADE;


--
-- Name: fetchmail_server fetchmail_server_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.fetchmail_server
    ADD CONSTRAINT fetchmail_server_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: fetchmail_server fetchmail_server_object_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.fetchmail_server
    ADD CONSTRAINT fetchmail_server_object_id_fkey FOREIGN KEY (object_id) REFERENCES public.ir_model(id) ON DELETE SET NULL;


--
-- Name: fetchmail_server fetchmail_server_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.fetchmail_server
    ADD CONSTRAINT fetchmail_server_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: gamification_badge gamification_badge_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.gamification_badge
    ADD CONSTRAINT gamification_badge_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: gamification_badge gamification_badge_message_main_attachment_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.gamification_badge
    ADD CONSTRAINT gamification_badge_message_main_attachment_id_fkey FOREIGN KEY (message_main_attachment_id) REFERENCES public.ir_attachment(id) ON DELETE SET NULL;


--
-- Name: gamification_badge_rule_badge_rel gamification_badge_rule_badge_rel_badge1_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.gamification_badge_rule_badge_rel
    ADD CONSTRAINT gamification_badge_rule_badge_rel_badge1_id_fkey FOREIGN KEY (badge1_id) REFERENCES public.gamification_badge(id) ON DELETE CASCADE;


--
-- Name: gamification_badge_rule_badge_rel gamification_badge_rule_badge_rel_badge2_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.gamification_badge_rule_badge_rel
    ADD CONSTRAINT gamification_badge_rule_badge_rel_badge2_id_fkey FOREIGN KEY (badge2_id) REFERENCES public.gamification_badge(id) ON DELETE CASCADE;


--
-- Name: gamification_badge gamification_badge_survey_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.gamification_badge
    ADD CONSTRAINT gamification_badge_survey_id_fkey FOREIGN KEY (survey_id) REFERENCES public.survey_survey(id) ON DELETE SET NULL;


--
-- Name: gamification_badge_user gamification_badge_user_badge_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.gamification_badge_user
    ADD CONSTRAINT gamification_badge_user_badge_id_fkey FOREIGN KEY (badge_id) REFERENCES public.gamification_badge(id) ON DELETE CASCADE;


--
-- Name: gamification_badge_user gamification_badge_user_challenge_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.gamification_badge_user
    ADD CONSTRAINT gamification_badge_user_challenge_id_fkey FOREIGN KEY (challenge_id) REFERENCES public.gamification_challenge(id) ON DELETE SET NULL;


--
-- Name: gamification_badge_user gamification_badge_user_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.gamification_badge_user
    ADD CONSTRAINT gamification_badge_user_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: gamification_badge_user gamification_badge_user_employee_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.gamification_badge_user
    ADD CONSTRAINT gamification_badge_user_employee_id_fkey FOREIGN KEY (employee_id) REFERENCES public.hr_employee(id) ON DELETE SET NULL;


--
-- Name: gamification_badge_user gamification_badge_user_sender_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.gamification_badge_user
    ADD CONSTRAINT gamification_badge_user_sender_id_fkey FOREIGN KEY (sender_id) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: gamification_badge_user gamification_badge_user_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.gamification_badge_user
    ADD CONSTRAINT gamification_badge_user_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.res_users(id) ON DELETE CASCADE;


--
-- Name: gamification_badge_user_wizard gamification_badge_user_wizard_badge_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.gamification_badge_user_wizard
    ADD CONSTRAINT gamification_badge_user_wizard_badge_id_fkey FOREIGN KEY (badge_id) REFERENCES public.gamification_badge(id) ON DELETE CASCADE;


--
-- Name: gamification_badge_user_wizard gamification_badge_user_wizard_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.gamification_badge_user_wizard
    ADD CONSTRAINT gamification_badge_user_wizard_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: gamification_badge_user_wizard gamification_badge_user_wizard_employee_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.gamification_badge_user_wizard
    ADD CONSTRAINT gamification_badge_user_wizard_employee_id_fkey FOREIGN KEY (employee_id) REFERENCES public.hr_employee(id) ON DELETE CASCADE;


--
-- Name: gamification_badge_user_wizard gamification_badge_user_wizard_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.gamification_badge_user_wizard
    ADD CONSTRAINT gamification_badge_user_wizard_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.res_users(id) ON DELETE CASCADE;


--
-- Name: gamification_badge_user_wizard gamification_badge_user_wizard_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.gamification_badge_user_wizard
    ADD CONSTRAINT gamification_badge_user_wizard_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: gamification_badge_user gamification_badge_user_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.gamification_badge_user
    ADD CONSTRAINT gamification_badge_user_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: gamification_badge gamification_badge_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.gamification_badge
    ADD CONSTRAINT gamification_badge_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: gamification_challenge gamification_challenge_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.gamification_challenge
    ADD CONSTRAINT gamification_challenge_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: gamification_challenge_line gamification_challenge_line_challenge_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.gamification_challenge_line
    ADD CONSTRAINT gamification_challenge_line_challenge_id_fkey FOREIGN KEY (challenge_id) REFERENCES public.gamification_challenge(id) ON DELETE CASCADE;


--
-- Name: gamification_challenge_line gamification_challenge_line_create_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.gamification_challenge_line
    ADD CONSTRAINT gamification_challenge_line_create_uid_fkey FOREIGN KEY (create_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: gamification_challenge_line gamification_challenge_line_definition_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.gamification_challenge_line
    ADD CONSTRAINT gamification_challenge_line_definition_id_fkey FOREIGN KEY (definition_id) REFERENCES public.gamification_goal_definition(id) ON DELETE CASCADE;


--
-- Name: gamification_challenge_line gamification_challenge_line_write_uid_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.gamification_challenge_line
    ADD CONSTRAINT gamification_challenge_line_write_uid_fkey FOREIGN KEY (write_uid) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: gamification_challenge gamification_challenge_manager_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.gamification_challenge
    ADD CONSTRAINT gamification_challenge_manager_id_fkey FOREIGN KEY (manager_id) REFERENCES public.res_users(id) ON DELETE SET NULL;


--
-- Name: gamification_challenge gamification_challenge_message_main_attachment_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.gamification_challenge
    ADD CONSTRAINT gamification_challenge_message_main_attachment_id_fkey FOREIGN KEY (message_main_attachment_id) REFERENCES public.ir_attachment(id) ON DELETE SET NULL;


--
-- Name: gamification_challenge gamification_challenge_report_message_group_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.gamification_challenge
    ADD CONSTRAINT gamification_challenge_report_message_group_id_fkey FOREIGN KEY (report_message_group_id) REFERENCES public.mail_channel(id) ON DELETE SET NULL;


--
-- Name: gamification_challenge gamification_challenge_report_template_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.gamification_challenge
    ADD CONSTRAINT gamification_challenge_report_template_id_fkey FOREIGN KEY (report_template_id) REFERENCES public.mail_template(id) ON DELETE RESTRICT;


--
-- Name: gamification_challenge gamification_challenge_reward_first_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.gamification_challenge
    ADD CONSTRAINT gamification_challenge_reward_first_id_fkey FOREIGN KEY (reward_first_id) REFERENCES public.gamification_badge(id) ON DELETE SET NULL;


--
-- Name: gamification_challenge gamification_challenge_reward_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.gamification_challenge
    ADD CONSTRAINT gamification_challenge_reward_id_fkey FOREIGN KEY (reward_id) REFERENCES public.gamification_badge(id) ON DELETE SET NULL;


--
-- Name: gamification_challenge gamification_challenge_reward_second_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.gamification_challenge
    ADD CONSTRAINT gamification_challenge_reward_second_id_fkey FOREIGN KEY (reward_second_id) REFERENCES public.gamification_badge(id) ON DELETE SET NULL;


--
-- Name: gamification_challenge gamification_challenge_reward_third_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.gamification_challenge
    ADD CONSTRAINT gamification_challenge_reward_third_id_fkey FOREIGN KEY (reward_third_id) REFERENCES public.gamification_badge(id) ON DELETE SET NULL;


--
-- Name: gamification_challenge_users_rel gamification_challenge_users_rel_gamification_challenge_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.gamification_challenge_users_rel
    ADD CONSTRAINT gamification_challenge_users_rel_gamification_challenge_id_fkey FOREIGN KEY (gamification_challenge_id) REFERENCES public.gamification_challenge(id) ON DELETE CASCADE;


--
-- Name: gamification_challenge_users_rel gamification_challenge_users_rel_res_users_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: odoo
--

ALTER TABLE ONLY public.gamification_challenge_users_rel
    ADD CONSTRAINT gamification_challenge_users_rel_res_users_id_fkey FOREIGN KEY (res_users_id) REFERENCES public.res_users(id) ON DELETE CASCADE;


--
