Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Urgent: Islamic Date Widget issue

By
salman
on 1/21/15, 6:16 AM 2,432 views

Hi,

I want to add hijri calendar  widget to odoo V8 , I spent a lot of time on developing a module for that but I was unsucessful till now .

I used the following jquery plugin: http://keith-wood.name/calendars.html

and my code is :
$('#defaultPopup').calendarsPicker({ calendar: $.calendars.instance('Islamic') });
I get  an error in this plugin jquery.calendars.js line 630

if (this._validateLevel === 0 && this.name !== year.calendar().name) {

 

This is the error:

uncaught typeerror undefined is not a function

if (year.year) {
                if (this._validateLevel === 0 && this.name !== year.calendar().name) {
                    throw ($.calendars.local.differentCalendars || $.calendars.regionalOptions[''].differentCalendars).
                        replace(/\{0\}/, this.local.name).replace(/\{1\}/, year.calendar().local.name);
                }
                return year;

Could you please advice me how to resolve this issue or if there is any implemenation for islamic date ?

I need it urgently.

 

Thanks in advance.

Here is the source code 

defaultPopup.js

openerp.islamic_date_widget= function(openerp){

openerp.web.form.widgets.add('defaultPopup','openerp.islamic_date_widget.Date');

openerp.islamic_date_widget.Date = openerp.web.form.AbstractField.extend({

    template:'defaultPopup',

    set_value: function(value) {
        this.id = value;
        $(document).ready(function() {
            $('#defaultPopup').calendarsPicker({ calendar: $.calendars.instance('ummalqura') });
        });
        
        
},
    init:function(parent,options){
        this._super(parent,options);
    },
    
    
});

}

template.xml:

<?xml version="1.0" encoding="UTF-8"?>
<templates>
    <t t-name="defaultPopup">

          <input id="defaultPopup" type="text" />

    </t>
</templates>

date.xml

<?xml version="1.0" encoding="UTF-8"?>
<openerp>
    <data>
        <template id="assets_backend_islamic_date" name="map assets" inherit_id="web.assets_backend">
            <xpath expr="." position="inside">
                <link rel="stylesheet" type="text/css" href="/islamic_date_widget/static/src/css/jquery.calendars.picker.css" /> 
                <script type="text/javascript" src="/islamic_date_widget/static/src/js/jquery.plugin.js"></script>
                <script src="/islamic_date_widget/static/src/js/jquery.calendars.js"></script>
                <script src="/islamic_date_widget/static/src/js/jquery.calendars.plus.js"></script>
                <script src="/islamic_date_widget/static/src/js/jquery.calendars.picker.js"></script>
                <script src="/islamic_date_widget/static/src/js/jquery.calendars.ummalqura.js"></script>
                <script type="text/javascript" src="/islamic_date_widget/static/src/js/defaultPopup.js"></script> 
            </xpath>
        </template>
    </data>
</openerp>

 

 

Could you add the error itself please?

Yenthe
on 1/21/15, 8:10 AM

This error message tells the whole story. On that line, you are trying to execute a function. However, whatever is being executed is not a function! Instead, it's undefined.

Yenthe
on 1/21/15, 9:15 AM

Yes, you are right. so how to resolve this issue ?

salman
on 1/21/15, 9:27 AM

Hmm well I see your code start from an if and ends with a return so I'd assume there is more code. Can you paste the whole function and the code where you call the function with? One of those values is undefined so look for that.

Yenthe
on 1/21/15, 9:39 AM

Thanks, I will paste the source code today

salman
on 1/21/15, 11:05 AM

Yenthe now you can find all the code ,looking forward to hearing from you.

salman
on 1/21/15, 1:29 PM

Yenthe please let me know if there is any update for islamic date

salman
on 1/22/15, 8:16 AM

I'm sorry Salman but I don't see the fault myself, sadly.. I'm not sure what isn't set. Try to debug all values and see if that brings you any further

Yenthe
on 1/22/15, 8:23 AM
2

Hardikgiri Goswami

--Hardikgiri Goswami--
1123
| 2 1 5
Rajkot, India
--Hardikgiri Goswami--

OpenERP/Odoo Customization/Integration Expert / Python Programmer

Skype ID : hardikgiri.goswami

Hardikgiri Goswami
On 1/21/15, 8:21 AM

I have found some links:

https://www.linkedin.com/pulse/20141103152725-149440674-hijri-calendar-integration-with-openerp

http://pragtechblog.blogspot.in/2014/04/openerp-7-hijri-calendar.html

0

Stephen Mack

--Stephen Mack--
5023
| 8 8 9
Santiago, Chile
--Stephen Mack--

Some people call me a karma whore, I only ask for 10 points if you like my answer and 15 if I happen to get it correct.

Stephen Mack
On 1/21/15, 7:38 AM

I am not a python developer but does triple equals exist "==="?

Hmm Stephen turns out we where both wrong, as Ivan stated. I've deleted my reply since we both had the same anyways.. His code is for JS & jQuery so I guess we where both wrong! :)

Yenthe
on 1/21/15, 8:09 AM

Well I am sticking with my answer. According to what I have read the === and == operators are the same except that no type conversion is done with ===. Maybe he has a mismatch.

Stephen Mack
on 1/21/15, 8:22 AM
0
salman
On 2/24/15, 6:31 AM

Any advice please

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

3 follower(s)

Stats

Asked: 1/21/15, 6:16 AM
Seen: 2432 times
Last updated: 3/16/15, 8:10 AM