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.

4

Pycalverter - Python Calendar Converter. Any one know how to implement this tool?

By
Remya
on 4/23/14, 6:27 AM 2,965 views

pyCalverter (Python Calendar Converter) is a tool for python developers that need to use Persian(Jalali) or Hijri(Islamic) Calendar in their programs .

On the other side this tool can convert these calendars (hijri, jalahi, gregorian) together .

Bayazee pycalverter

Launchpad pycalverter

Please check the above two links.

0
Yug Faa
On 4/23/14, 7:22 AM

Hi,

Copy the file calverter.py into your module

In the file __init__.py import the file :

import calverter

In your code re-import calverter using the path of your module and type :

cal = calverter.calverter()
jd = cal.gregorian_to_jd(2014, 04 , 23)
print jd
print cal.jd_to_islamic(jd)

The outopu will be :

2456770.5
(1435, 6, 22)

I implemeted it for my module and it works well.

Thanks for your reply Yug Faa. Shall i ask you a doubt? i created two char fields for both islamic date and gregorian date. When i enter islamic date on islamic date field, it should convert into geogorian & display in gregorian date field. How should i wrote python code for that? Please help me.

Remya
on 4/23/14, 7:58 AM

Firstly fi this help you, please make it resolved, for the next problem the georgian date have to be a date field and for the islamic is char, you can use on_change feature or make the georgian field as function

Yug Faa
on 4/23/14, 8:02 AM

hi Yug Faa .. please check this py file. import calverter

class convertor_convertor(osv.osv): _description = "converting dates" _name = "convertor" { cal = calverter.calverter() jd = cal.gregorian_to_jd(2014, 04 , 23) print jd print cal.jd_to_islamic(jd) }

convertor_convertor()

charlesraj
on 4/23/14, 9:26 AM

please tell me is this is the correct form of our code.

charlesraj
on 4/23/14, 9:27 AM

hi i implement this code syntax error at cal = calverter.calverter() , How to solve this.

charlesraj
on 4/23/14, 10:16 AM

can you paste you code in pastebin.com and post the link here ? but before can you make this question SOLVED !

Yug Faa
on 4/23/14, 10:35 AM

no . I did n't make this here is the link. http://pastebin.com/tcAyKUG9

charlesraj
on 4/23/14, 10:47 AM

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

1 follower(s)

Stats

Asked: 4/23/14, 6:27 AM
Seen: 2965 times
Last updated: 3/16/15, 8:10 AM