title: How to add several fields in a module that belong to two tables in the same form or other - Prestashop 1.7
body: <p>I have followed the steps of a tutorial to create a module to edit invoices specifically this:
  <a href="https://blog.floriancourgey.com/2018/04/edit-your-invoices-in-prestashop" rel="nofollow noreferrer">https://blog.floriancourgey.com/2018/04/edit-your-invoices-in-prestashop</a></p>
  <p>But the module only allows updating the information of the fields that appear in a single table.</p>
  <p>The thing is, I need to add a new field that belongs to another table and is saved in both tables.
  The table that stores the module information is ps_order_invoice and the table that I also want to save, a single invoice_number field, is ps_orders.</p>
  <pre><code>  class AdminCustomInvoicesController extends ModuleAdminController {
    public function __construct(){
  parent::__construct();
  $this-&gt;bootstrap = true; // use Bootstrap CSS
  $this-&gt;table = 'order_invoice'; // SQL table name, will be prefixed with _DB_PREFIX_
  $this-&gt;identifier = 'id_order_invoice'; // SQL column to be used as primary key
  $this-&gt;className = 'OrderInvoice'; // PHP class name
  $this-&gt;allow_export = true; // allow export in CSV, XLS..
  $this-&gt;_orderBy = 'date_add'; // default SQL ORDER BY
  $this-&gt;page_header_toolbar_title = 'Invoices'; // toolbar title
  $this-&gt;_select = 'concat(upper(c.lastname), &quot; &quot;, c.firstname) as customer';
  $this-&gt;_join = '
    JOIN '._DB_PREFIX_.'orders o ON (o.id_order = a.id_orderes)
    JOIN '._DB_PREFIX_.'customer c ON (c.id_customer = o.id_customer)
  ';
  
  $this-&gt;fields_list = [
    'id_order_invoice' =&gt; ['title' =&gt; $this-&gt;trans('ID', [], 'Admin.Global'),'class' =&gt; 'fixed-width-xs'],
    'number' =&gt; ['title' =&gt; $this-&gt;trans('Number', [], 'Admin.Global'),'class' =&gt; 'fixed-width-xs'],
   //I want add this new field(invoice_number) in another table ps_orders
    'invoice_number' =&gt; ['title' =&gt; $this-&gt;trans('Invoice Number', [], 'Admin.Global'),'class' =&gt; 'fixed-width-xs'],
    'date_add' =&gt; ['title' =&gt; $this-&gt;trans('Date', [], 'Admin.Global'), 'type'=&gt;'datetime'],
    'customer' =&gt; ['title' =&gt; $this-&gt;trans('Customer', [], 'Admin.Global')],
    'total_products_wt' =&gt; ['title' =&gt; $this-&gt;trans('Total products', [], 'Admin.Global'),
      'align' =&gt; 'text-right',
      'type' =&gt; 'price',
    ],
    'total_shipping_tax_incl' =&gt; ['title' =&gt; $this-&gt;trans('Total shipping', [], 'Admin.Global'),
      'align' =&gt; 'text-right',
      'type' =&gt; 'price',
    ],
    'total_paid_tax_incl' =&gt; ['title' =&gt; $this-&gt;trans('Total paid', [], 'Admin.Global'),
      'align' =&gt; 'text-right',
      'type' =&gt; 'price',
    ],
  ];
  </code></pre>
  <p>I have also added in field_list</p>
  <pre><code>$this-&gt;fields_form = [
    'legend' =&gt; ['title' =&gt; $this-&gt;l('Custom Invoice'),'icon' =&gt; 'icon-list-ul'],
    'input' =&gt; [
      ['name' =&gt; 'date_add','type' =&gt; 'datetime','label' =&gt; 'Date add',],
      ['name'=&gt;'number','type'=&gt;'text','required' =&gt; true,'label' =&gt; 'Number',],
   //Here I add new field from ps_orders
      ['name'=&gt;'invoice_number','type'=&gt;'text','required' =&gt; true,'label' =&gt; 'Invoice number',],
      ['name'=&gt;'note','type'=&gt;'textarea','label' =&gt; 'Note',],
      ['name'=&gt;'delivery_number','type'=&gt;'text','label'=&gt;'Delivery number'],
      ['name'=&gt;'delivery_date','type'=&gt;'datetime','label'=&gt;'Delivery date'],
      ['name'=&gt;'total_discount_tax_excl','type'=&gt;'text','label'=&gt;'Total amount of discounts (no tax)'],
      ['name'=&gt;'total_discount_tax_incl','type'=&gt;'text','label'=&gt;'Total amount of discounts (with tax)'],
      ['name'=&gt;'total_shipping_tax_excl','type'=&gt;'text','label'=&gt;'Total cost of shipping (no tax)'],
      ['name'=&gt;'total_shipping_tax_incl','type'=&gt;'text','label'=&gt;'Total cost of shipping (with tax)'],
      ['name'=&gt;'total_products','type'=&gt;'text','label'=&gt;'Total cost of products (no tax)'],
      ['name'=&gt;'total_products_wt','type'=&gt;'text','label'=&gt;'Total cost of products (with tax)'],
      ['name'=&gt;'total_wrapping_tax_excl','type'=&gt;'text','label'=&gt;'Total cost of wrapping (no tax)'],
      ['name'=&gt;'total_wrapping_tax_incl','type'=&gt;'text','label'=&gt;'Total cost of wrapping (with tax)'],
      ['name'=&gt;'total_paid_tax_excl','type'=&gt;'text','label'=&gt;'Total paid (no tax)'],
      ['name'=&gt;'total_paid_tax_incl','type'=&gt;'text','label'=&gt;'Total paid (with tax)'],
      ['name'=&gt;'shop_address','type'=&gt;'textarea','label'=&gt;'Shop address'],
    ],
    'submit' =&gt; ['title' =&gt; $this-&gt;trans('Save', [], 'Admin.Actions'),]
  ];
  </code></pre>
  <p>How can I add the invoice_number field to this module so that it updates in the table ps_orders when I put the data and at the same time the rest of the things that the module does?</p>