Sample Cek Constraint with psql

@api.one @api.constrains('order_line') def _check_tanggal_rencana(self): query = """ SELECT shl.start_time as tgl_rencana_produksi FROM survey_harian_line shl WHERE shl.survey_id = %s ORDER BY shl.start_time DESC """ self.env.cr.execute(query,(self.id,)) survey_harian_line = self.env.cr.dictfetchall() if survey_harian_line: for s in survey_harian_line: tgl_rencana_produksi = s['tgl_rencana_produksi'] self.tgl_rencana_produksi = tgl_rencana_produksi

How to Only Allow Numbers in a Text Box using jQuery

$(document).ready(function () {                      $('.numberonly').keypress(function (e) {                          var charCode = (e.which) ? e.which : event.keyCode                          if (String.fromCharCode(charCode).match(/[^0-9]/g))                              return false;                                          });          }); 

Python Openpyxl

Python Openpyxl Introduction Python provides the Openpyxl module, which is used to deal with Excel files without involving third-party Microsoft application software. By using this module, we can have control over excel without open the application. It is used to perform excel tasks such as read data from excel file, or write data to the excel … Continue reading Python Openpyxl

Get All Datetime Part in Python

from datetime import datetime currentSecond= datetime.now().second currentMinute = datetime.now().minute currentHour = datetime.now().hour currentDay = datetime.now().day currentMonth = datetime.now().month currentYear = datetime.now().year ========================================================================= from datetime import datetime current_month = datetime.now().strftime('%m') // 02 //This is 0 padded current_month_text = datetime.now().strftime('%h') // Feb current_month_text = datetime.now().strftime('%B') // February current_day = datetime.now().strftime('%d') // 23 //This is also padded current_day_text … Continue reading Get All Datetime Part in Python