• Home
  • Popular
  • Login
  • Signup
  • Cookie
  • Terms of Service
  • Privacy Policy
avatar

Posted by G Bot


09 Jan, 2025

Updated at 16 Jan, 2025

Cloning Parent to Other Parent Table together with cloning Child to Other Child Table

Dear Appsheeters,

I'm making two modules: "Sales Quotation" and "Sales Order".

The Sales Quotation module, consists of three tables: [Sales Quotation], [Sales Quotation Details], and [Sales Quotation Payment Terms]

While the Sales Order module, reflecting similar tables, consists of three tables: [Sales Order], [Sales Order Details], and [Sales Order Payment Terms].

SQ to SO.jpg

I want to create a button (Convert SQ to SO) in the Sales Quotation, which will do several actions:

  1. Create a new record in the [Sales Order] table using data from [Sales Quotation] table. The New Record will have a unique Sales Order No (SO No) generated using our own code in Initial Values.
  2. Create child records in the [Sales Order Details] table using data from [Sales Quotation Details] table.
  3. Create child records in the [Sales Order Payment Terms] table using data from [Sales Quotation Payment Terms] table.

I managed to do action no. 1, since it’s a direct copy between parent tables [Sales Quotation] to [Sales Order]. But I have problems that are confusing me to do a loop for copying data from [Sales Quotation Details] to [Sales Order Details], since doing so will need me to put the newly generated [Sales Order No.] from the [Sales Order] parent table.

The problems also occurred with the Payment Terms.

 

I need your advice.

 

Thank you.