From d32c1d1958817b5dce71a7a21d88d87d12193c61 Mon Sep 17 00:00:00 2001
From: Louis Baudoux <lba@odoo.com>
Date: Tue, 6 Aug 2019 14:55:25 +0000
Subject: [PATCH] [FIX] l10n_generic_coa: missing values for demo data for OCR

The demo invoice for the OCR had incomplete fields to work properly, the
'Send for digitalization' button was missing and there was no attachment
preview.

closes odoo/odoo#35528

Signed-off-by: Florian Daloze (fda) <fda@odoo.com>
---
 .../l10n_generic_coa/data/account_invoice_demo.xml  | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/addons/l10n_generic_coa/data/account_invoice_demo.xml b/addons/l10n_generic_coa/data/account_invoice_demo.xml
index ecb460e1ce42..08498c7229ad 100644
--- a/addons/l10n_generic_coa/data/account_invoice_demo.xml
+++ b/addons/l10n_generic_coa/data/account_invoice_demo.xml
@@ -63,14 +63,21 @@
         </record>
 
         <!-- ==== Invoice Demo 6 - Draft Vendor Bill for OCR ==== -->
+        <record id="ir_attachment_in_invoice_draft" model="ir.attachment">
+            <field name="type">binary</field>
+            <field name="datas" type="base64" file="l10n_generic_coa/static/src/demo/in_invoice_yourcompany_demo.pdf"/>
+            <field name="name">in_invoice_yourcompany_demo.pdf</field>
+            <field name="res_model">account.move</field>
+        </record>
+
         <record id="demo_invoice_extract" model="account.move" context="{'type': 'in_invoice'}">
+            <field name="type">in_invoice</field>
             <field name="invoice_user_id" ref="base.user_demo"/>
+            <field name="message_main_attachment_id" ref="ir_attachment_in_invoice_draft"/>
         </record>
 
         <record id="ir_attachment_in_invoice_draft" model="ir.attachment">
-            <field name="type">binary</field>
-            <field name="datas" type="base64" file="l10n_generic_coa/static/src/demo/in_invoice_yourcompany_demo.pdf"/>
-            <field name="name">in_invoice_yourcompany_demo.pdf</field>
+            <field name="res_id" ref="demo_invoice_extract"/>
         </record>
 
         <record id="mail_message_in_invoice_0" model="mail.message">
-- 
GitLab