跳至內容
選單
此問題已被標幟
1 回覆
6653 瀏覽次數

I recently needed to execute a function on module installation.

My research has brought up two different ways:

  1. Using the _init() function of a class
  2. Using the data.xml file (noupdate="1") to call a function of a model

Which one is recommended? What are the differences? Is it version dependend?

Thanks!

頭像
捨棄
最佳答案

Hi,

The noupdate parameter is used to indicate if the values in the xml file must be re-imported when a module in updated. noupdate="1", if we delete a data record and update the custom module, the deleted data not will be imported again._init() function is used assign values to the data members of the class when an object of class is created. The better option for your question is _init() function.

Regards

頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
3
12月 24
6531
1
7月 16
3683
1
8月 15
9573
0
3月 15
4573
0
3月 15
4310