js code
odoo.define('first_owl.data', function (require) {
"use strict";
var rpc = require('web.rpc');
console.log("Rpc..........")
var core = require('web.core');
var _t = core._t;
$('document').ready(function(){
rpc.query({
model: 'hr.employee',
method: 'action_bd_reminder',
args: [[]],
}).then(function(result){
document.addEventListener("DOMContentLoaded", function(e) {
var eval_table = document.getElementsByClassName('ahmedabad');
console.log("display data",eval_table, eval_table.length);
});
//document.getElementsByClassName('ahmedabad').value = result
console.log("result...........",result)
console.log("document...........",document)
console.log("data.........",document.getElementById('myHeader'))
console.log("data.....lenfgth....",document.getElementsByTagName('header'),document.getElementsByTagName('header').length)
//// console.log("data.....,head....",document.head.innerHTML)
// console.log("data.....body....",document.body)
// console.log("data.....header....",document.getElementsByTagName("header")[0])
console.log("data......1111..",document.getElementsByClassName('ahmedabad'))
console.log("data........",document.getElementsByClassName('ahmedabad').value = result)
});
});
});
python code
from datetime import datetime
from odoo import models
class HrEmployee(models.Model):
_inherit = 'hr.employee'
def action_bd_reminder(self):
today = datetime.now()
today_month_day = '%-' + today.strftime('%m') + '-' + today.strftime('%d')
employees = self.env['hr.employee'].sudo().search([('birthday', 'like', today_month_day)])
birthday = ''
for employee in employees:
birthday += 'Today our employee {} birthday'.format(employee.name)
# print("\n\n\nbirthday,,,,,,,,",birthday)
return birthday
xml code
<t t-extend="Menu">
<t t-jquery=".o_main_navbar" t-operation="before">
<marquee id="marqu" onmouseover="this.stop();" onmouseout="this.start();" class="o_differ p-4">
<header id="myHeader">
<div id="naroda" class="ahmedabad" style="color: white; font-size: 20px;">data</div>
</header>
</marquee>
</t>
</t>
set data from py to front text data
when set the text not found id(null) and length not found.