diff --git a/src-db/database/model/modifiedTables/C_ORDER.xml b/src-db/database/model/modifiedTables/C_ORDER.xml
new file mode 100644
index 0000000..a7ff685
--- /dev/null
+++ b/src-db/database/model/modifiedTables/C_ORDER.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0"?>
+  <database name="MODIFIED TABLE C_ORDER">
+    <table name="C_ORDER" primaryKey="C_ORDER_KEY">
+      <column name="EM_OBLOTC_LOTTERY_CODE" primaryKey="false" required="false" type="VARCHAR" size="60" autoIncrement="false">
+        <default/>
+        <onCreateDefault/>
+      </column>
+    </table>
+  </database>
diff --git a/src-db/database/sourcedata/AD_COLUMN.xml b/src-db/database/sourcedata/AD_COLUMN.xml
new file mode 100644
index 0000000..e847399
--- /dev/null
+++ b/src-db/database/sourcedata/AD_COLUMN.xml
@@ -0,0 +1,40 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<data>
+<!--992A4FA9F23E4A5B9F5D1B07934A9F4C--><AD_COLUMN>
+<!--992A4FA9F23E4A5B9F5D1B07934A9F4C-->  <AD_COLUMN_ID><![CDATA[992A4FA9F23E4A5B9F5D1B07934A9F4C]]></AD_COLUMN_ID>
+<!--992A4FA9F23E4A5B9F5D1B07934A9F4C-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--992A4FA9F23E4A5B9F5D1B07934A9F4C-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--992A4FA9F23E4A5B9F5D1B07934A9F4C-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--992A4FA9F23E4A5B9F5D1B07934A9F4C-->  <NAME><![CDATA[EM_Oblotc_Lottery_Code]]></NAME>
+<!--992A4FA9F23E4A5B9F5D1B07934A9F4C-->  <COLUMNNAME><![CDATA[EM_Oblotc_Lottery_Code]]></COLUMNNAME>
+<!--992A4FA9F23E4A5B9F5D1B07934A9F4C-->  <AD_TABLE_ID><![CDATA[259]]></AD_TABLE_ID>
+<!--992A4FA9F23E4A5B9F5D1B07934A9F4C-->  <AD_REFERENCE_ID><![CDATA[10]]></AD_REFERENCE_ID>
+<!--992A4FA9F23E4A5B9F5D1B07934A9F4C-->  <FIELDLENGTH><![CDATA[60]]></FIELDLENGTH>
+<!--992A4FA9F23E4A5B9F5D1B07934A9F4C-->  <ISKEY><![CDATA[N]]></ISKEY>
+<!--992A4FA9F23E4A5B9F5D1B07934A9F4C-->  <ISPARENT><![CDATA[N]]></ISPARENT>
+<!--992A4FA9F23E4A5B9F5D1B07934A9F4C-->  <ISMANDATORY><![CDATA[N]]></ISMANDATORY>
+<!--992A4FA9F23E4A5B9F5D1B07934A9F4C-->  <ISUPDATEABLE><![CDATA[Y]]></ISUPDATEABLE>
+<!--992A4FA9F23E4A5B9F5D1B07934A9F4C-->  <ISIDENTIFIER><![CDATA[N]]></ISIDENTIFIER>
+<!--992A4FA9F23E4A5B9F5D1B07934A9F4C-->  <SEQNO><![CDATA[1040]]></SEQNO>
+<!--992A4FA9F23E4A5B9F5D1B07934A9F4C-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
+<!--992A4FA9F23E4A5B9F5D1B07934A9F4C-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--992A4FA9F23E4A5B9F5D1B07934A9F4C-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--992A4FA9F23E4A5B9F5D1B07934A9F4C-->  <AD_ELEMENT_ID><![CDATA[F797285E011547BDA709D0CE7718B3DC]]></AD_ELEMENT_ID>
+<!--992A4FA9F23E4A5B9F5D1B07934A9F4C-->  <ISSESSIONATTR><![CDATA[N]]></ISSESSIONATTR>
+<!--992A4FA9F23E4A5B9F5D1B07934A9F4C-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
+<!--992A4FA9F23E4A5B9F5D1B07934A9F4C-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
+<!--992A4FA9F23E4A5B9F5D1B07934A9F4C-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
+<!--992A4FA9F23E4A5B9F5D1B07934A9F4C-->  <AD_MODULE_ID><![CDATA[0556986C442E4A298CCA8329A094C3C8]]></AD_MODULE_ID>
+<!--992A4FA9F23E4A5B9F5D1B07934A9F4C-->  <POSITION><![CDATA[134]]></POSITION>
+<!--992A4FA9F23E4A5B9F5D1B07934A9F4C-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
+<!--992A4FA9F23E4A5B9F5D1B07934A9F4C-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
+<!--992A4FA9F23E4A5B9F5D1B07934A9F4C-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
+<!--992A4FA9F23E4A5B9F5D1B07934A9F4C-->  <IMAGESIZEVALUESACTION><![CDATA[N]]></IMAGESIZEVALUESACTION>
+<!--992A4FA9F23E4A5B9F5D1B07934A9F4C-->  <ISUSEDSEQUENCE><![CDATA[N]]></ISUSEDSEQUENCE>
+<!--992A4FA9F23E4A5B9F5D1B07934A9F4C-->  <ALLOWSORTING><![CDATA[Y]]></ALLOWSORTING>
+<!--992A4FA9F23E4A5B9F5D1B07934A9F4C-->  <ALLOWFILTERING><![CDATA[Y]]></ALLOWFILTERING>
+<!--992A4FA9F23E4A5B9F5D1B07934A9F4C-->  <ALLOWED_CROSS_ORG_LINK><![CDATA[N]]></ALLOWED_CROSS_ORG_LINK>
+<!--992A4FA9F23E4A5B9F5D1B07934A9F4C-->  <IS_CHILD_PROPERTY_IN_PARENT><![CDATA[N]]></IS_CHILD_PROPERTY_IN_PARENT>
+<!--992A4FA9F23E4A5B9F5D1B07934A9F4C--></AD_COLUMN>
+
+</data>
diff --git a/src-db/database/sourcedata/AD_ELEMENT.xml b/src-db/database/sourcedata/AD_ELEMENT.xml
new file mode 100644
index 0000000..f339ac4
--- /dev/null
+++ b/src-db/database/sourcedata/AD_ELEMENT.xml
@@ -0,0 +1,15 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<data>
+<!--F797285E011547BDA709D0CE7718B3DC--><AD_ELEMENT>
+<!--F797285E011547BDA709D0CE7718B3DC-->  <AD_ELEMENT_ID><![CDATA[F797285E011547BDA709D0CE7718B3DC]]></AD_ELEMENT_ID>
+<!--F797285E011547BDA709D0CE7718B3DC-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--F797285E011547BDA709D0CE7718B3DC-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--F797285E011547BDA709D0CE7718B3DC-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--F797285E011547BDA709D0CE7718B3DC-->  <COLUMNNAME><![CDATA[EM_Oblotc_Lottery_Code]]></COLUMNNAME>
+<!--F797285E011547BDA709D0CE7718B3DC-->  <NAME><![CDATA[EM_Oblotc_Lottery_Code]]></NAME>
+<!--F797285E011547BDA709D0CE7718B3DC-->  <PRINTNAME><![CDATA[EM_Oblotc_Lottery_Code]]></PRINTNAME>
+<!--F797285E011547BDA709D0CE7718B3DC-->  <AD_MODULE_ID><![CDATA[0556986C442E4A298CCA8329A094C3C8]]></AD_MODULE_ID>
+<!--F797285E011547BDA709D0CE7718B3DC-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
+<!--F797285E011547BDA709D0CE7718B3DC--></AD_ELEMENT>
+
+</data>
diff --git a/src/org/openbravo/retail/lotterycode/OBLOTCComponentProvider.java b/src/org/openbravo/retail/lotterycode/OBLOTCComponentProvider.java
index 6ffae3d..b7566ce 100644
--- a/src/org/openbravo/retail/lotterycode/OBLOTCComponentProvider.java
+++ b/src/org/openbravo/retail/lotterycode/OBLOTCComponentProvider.java
@@ -1,6 +1,6 @@
 /*
  ************************************************************************************
- * Copyright (C) 2020 Openbravo S.L.U.
+ * Copyright (C) 2020-2021 Openbravo S.L.U.
  * Licensed under the Openbravo Commercial License version 1.0
  * You may obtain a copy of the License at http://www.openbravo.com/legal/obcl.html
  * or in the legal folder of this module distribution.
@@ -41,6 +41,7 @@ public class OBLOTCComponentProvider extends BaseComponentProvider {
         "components/oblotc-modallotterycodeinformation", //
         "hookUtils/oblotc-getlotterycode", //
         "hooks/oblotc-prepaymenthook", //
+        "hooks/oblotc-returnorderhook", //
         "hooks/oblotc-preordersavehook" //
     };
 
diff --git a/src/org/openbravo/retail/lotterycode/PaidReceiptProperties.java b/src/org/openbravo/retail/lotterycode/PaidReceiptProperties.java
new file mode 100644
index 0000000..a3d3e4c
--- /dev/null
+++ b/src/org/openbravo/retail/lotterycode/PaidReceiptProperties.java
@@ -0,0 +1,28 @@
+/*
+ ************************************************************************************
+ * Copyright (C) 2021 Openbravo S.L.U.
+ * Licensed under the Openbravo Commercial License version 1.0
+ * You may obtain a copy of the License at http://www.openbravo.com/legal/obcl.html
+ * or in the legal folder of this module distribution.
+ ************************************************************************************
+ */
+
+package org.openbravo.retail.lotterycode;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.openbravo.client.kernel.ComponentProvider.Qualifier;
+import org.openbravo.mobile.core.model.HQLProperty;
+import org.openbravo.mobile.core.model.ModelExtension;
+import org.openbravo.retail.posterminal.PaidReceipts;
+
+@Qualifier(PaidReceipts.paidReceiptsPropertyExtension)
+public class PaidReceiptProperties extends ModelExtension {
+
+  @Override
+  public List<HQLProperty> getHQLProperties(Object params) {
+    return Arrays.asList(new HQLProperty("ord.oblotcLotteryCode", "oblotcLotteryCode"));
+  }
+
+}
diff --git a/web/org.openbravo.retail.lotterycode/js/components/oblotc-modallotterycodeinformation.js b/web/org.openbravo.retail.lotterycode/js/components/oblotc-modallotterycodeinformation.js
index 4044f3c..7ebee64 100644
--- a/web/org.openbravo.retail.lotterycode/js/components/oblotc-modallotterycodeinformation.js
+++ b/web/org.openbravo.retail.lotterycode/js/components/oblotc-modallotterycodeinformation.js
@@ -1,6 +1,6 @@
 /*
  ************************************************************************************
- * Copyright (C) 2013-2017 Openbravo S.L.U.
+ * Copyright (C) 2013-2021 Openbravo S.L.U.
  * Licensed under the Openbravo Commercial License version 1.0
  * You may obtain a copy of the License at http://www.openbravo.com/legal/obcl.html
  * or in the legal folder of this module distribution.
@@ -13,11 +13,14 @@ enyo.kind({
   name: 'OBLOTC.UI.ModalLotteryCodeInformation',
   kind: 'OB.UI.ModalAction',
   handlers: {
-    onApplyChanges: 'applyChanges'
+    onApplyChanges: 'applyChanges',
+    onValueChange: 'validateValue'
   },
+  i18nHeader: 'OBLOTC_LotteryCode_TitleLbl',
   hideCloseButton: true,
   closeOnEscKey: false,
   autoDismiss: false,
+  //body of the popup
   bodyContent: {
     kind: 'Scroller',
     maxHeight: '257px',
@@ -32,48 +35,54 @@ enyo.kind({
     ]
   },
   bodyButtons: {
+    classes: 'obUiModal-footer-mainButtons',
     components: [
       {
-        kind: 'OBLOTC.UI.LotteryCodeInformationModalApply'
+        kind: 'OBLOTC.UI.LotteryCodeInformationModalApply',
+        isDefaultAction: true,
+        name: 'continueButton'
       },
       {
-        kind: 'OBLOTC.UI.LotteryCodeInformationModalSkip'
+        kind: 'OBLOTC.UI.LotteryCodeInformationModalSkip',
+        isDefaultAction: false,
+        name: 'skipButton'
       }
     ]
   },
+  validateValue: function(inSender, inEvent) {
+    const lotteryCode = this.$.bodyContent.$.lotteryCode.$.inputText.getValue();
+    this.$.bodyButtons.$.continueButton.setDisabled(lotteryCode.length !== 8);
+    return true;
+  },
   applyChanges: function(inSender, inEvent) {
-    const bodyconTent = this.$.bodyContent;
-    if (bodyconTent.$.lotteryCode.$.inputText.getValue() === '') {
+    const lotteryCode = this.$.bodyContent.$.lotteryCode.$.inputText.getValue();
+    if (lotteryCode === '') {
       OB.UTIL.showWarning(OB.I18N.getLabel('OBLOTC_FillLotteryCodeToContinue'));
       return false;
     }
 
-    if (bodyconTent.$.lotteryCode.$.inputText.getValue().length !== 8) {
+    if (lotteryCode.length !== 8) {
       OB.UTIL.showWarning(
         OB.I18N.getLabel('OBLOTC_LotteryCodeOfEightCharacters')
       );
       return false;
     }
 
-    this.args.model.set(
-      'oblotcLotteryCode',
-      bodyconTent.$.lotteryCode.$.inputText.getValue()
-    );
+    this.args.model.set('oblotcLotteryCode', lotteryCode);
     return true;
   },
-  initComponents: function() {
-    this.inherited(arguments);
-    this.$.header.setContent(OB.I18N.getLabel('OBLOTC_LotteryCode_TitleLbl'));
-    this.$.bodyContent.$.lotteryCode.$.labelLine.setContent(
-      OB.I18N.getLabel('OBLOTC_LotteryCode_LotteryCodeLbl')
-    );
-  },
   executeOnShow: function() {
     const receipt = this.args.model;
     this.$.bodyContent.$.lotteryCode.$.inputText.setValue(
       receipt.get('oblotcLotteryCode') || ''
     );
-    this.$.bodyContent.$.lotteryCode.$.inputText.focus();
+    this.validateValue();
+  },
+  initComponents: function() {
+    this.inherited(arguments);
+    this.$.bodyContent.$.lotteryCode.$.labelLine.setContent(
+      OB.I18N.getLabel('OBLOTC_LotteryCode_LotteryCodeLbl')
+    );
   }
 });
 
@@ -133,7 +142,14 @@ enyo.kind({
           components: [
             {
               kind: 'OB.UI.renderTextProperty',
-              name: 'inputText'
+              name: 'inputText',
+              maxLength: 8,
+              handlers: {
+                oninput: 'valueChange'
+              },
+              valueChange: function(inSender, inEvent) {
+                this.bubble('onValueChange');
+              }
             }
           ]
         }
diff --git a/web/org.openbravo.retail.lotterycode/js/hookUtils/oblotc-getlotterycode.js b/web/org.openbravo.retail.lotterycode/js/hookUtils/oblotc-getlotterycode.js
index a6b58a8..cc0cb2c 100644
--- a/web/org.openbravo.retail.lotterycode/js/hookUtils/oblotc-getlotterycode.js
+++ b/web/org.openbravo.retail.lotterycode/js/hookUtils/oblotc-getlotterycode.js
@@ -9,26 +9,14 @@
 
 /* global OB */
 {
-  const hasBlindReturnLines = lines => {
-    const blindReturnLines = lines.models.filter(line => {
-      return !line.get('isVerifiedReturn');
-    });
-    return blindReturnLines && blindReturnLines.length > 0;
-  };
-
-  const isBlindReturn = receipt => {
-    return (
-      receipt.get('isNegative') &&
+  const showLotteryCodePopup = receipt => {
+    return !(
       receipt.get('isEditable') &&
       !receipt.get('isQuotation') &&
-      hasBlindReturnLines(receipt.get('lines'))
+      receipt.get('isNegative')
     );
   };
 
-  const showLotteryCodePopup = receipt => {
-    return isBlindReturn(receipt);
-  };
-
   const getLotteryCode = (arguments, finalHookCallback) => {
     const receipt = arguments.context.get('order');
     OB.MobileApp.view.$.containerWindow.getRoot().doShowPopup({
diff --git a/web/org.openbravo.retail.lotterycode/js/hooks/oblotc-returnorderhook.js b/web/org.openbravo.retail.lotterycode/js/hooks/oblotc-returnorderhook.js
new file mode 100644
index 0000000..034bdb7
--- /dev/null
+++ b/web/org.openbravo.retail.lotterycode/js/hooks/oblotc-returnorderhook.js
@@ -0,0 +1,19 @@
+/*
+ ************************************************************************************
+ * Copyright (C) 2021 Openbravo S.L.U.
+ * Licensed under the Openbravo Commercial License version 1.0
+ * You may obtain a copy of the License at http://www.openbravo.com/legal/obcl.html
+ * or in the legal folder of this module distribution.
+ ************************************************************************************
+ */
+
+OB.UTIL.HookManager.registerHook(
+  'OBRETUR_ReturnFromOrig',
+  (args, callbacks) => {
+    const receipt = args.context.model.get('order');
+    if (args.order.oblotcLotteryCode) {
+      receipt.set('oblotcLotteryCode', args.order.oblotcLotteryCode);
+    }
+    OB.UTIL.HookManager.callbackExecutor(args, callbacks);
+  }
+);
