Skip to Content
Odoo Menu
  • Sign in
  • Try it free
  • Apps
    Finance
    • Accounting
    • Invoicing
    • Expenses
    • Spreadsheet (BI)
    • Documents
    • Sign
    Sales
    • CRM
    • Sales
    • POS Shop
    • POS Restaurant
    • Subscriptions
    • Rental
    Websites
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Supply Chain
    • Inventory
    • Manufacturing
    • PLM
    • Purchase
    • Maintenance
    • Quality
    Human Resources
    • Employees
    • Recruitment
    • Time Off
    • Appraisals
    • Referrals
    • Fleet
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Events
    • Marketing Automation
    • Surveys
    Services
    • Project
    • Timesheets
    • Field Service
    • Helpdesk
    • Planning
    • Appointments
    Productivity
    • Discuss
    • Approvals
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industries
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage Distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Estate Management
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Manufacturing
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Community
    Learn
    • Tutorials
    • Documentation
    • Certifications
    • Training
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Download
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Events
    • Translations
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Customer References
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Pricing
  • Help

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Accounting
  • Inventory
  • PoS
  • Project
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
Help

convert islamic datepicker from odoo8 to odoo9

Subscribe

Get notified when there's activity on this post

This question has been flagged
datepickerodoo8.0odoo9.0
2 Replies
3381 Views
Avatar
Mohamed Hamada


I have islamic datepicker work on odoo8 well

how can I convert it to odoo9 ?

please help

0
Avatar
Discard
Avatar
Mohamed Hamada
Author Best Answer

it is donot work on any version except 8 without any errors or warning

but I solved it with another way

I didnot use JavaScript , I used only python and XML

and translated the traditional date from datetime field  to islamic date in Char field with the following code with out generate islamic calender Just convert date from traditional to higri date


import math
import datetime
from odoo import fields,models,api
from datetime import datetime,date
from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT
class Go_And_Inspection(models.Model):
    _name='inspection.report'
   inspection_date=fields.Datetime('Inspection Date ',required=True)
    higri_date=fields.Char('Higri Date ', compute="get_hijri_passport")

   @api.onchange('inspection_date')    
    def get_hijri_passport(self):
       
        if self.inspection_date:
          my_date = datetime.strptime(self.inspection_date, DEFAULT_SERVER_DATETIME_FORMAT)
          
          day = my_date.day
          mth = my_date.month
          yr = my_date.year
          self.higri_date=self.Gregorian2Hijri(yr, mth, day)
          #return self.higri_date
    
    def intPart(self,floatNum):
        if floatNum < -0.0000001: return math.ceil(floatNum - 0.0000001)
        return math.floor(floatNum + 0.0000001)

    def Gregorian2Hijri(self,yr, mth, day):
        if ((yr > 1582) or ((yr == 1582) and (mth > 10)) or ((yr == 1582) and (mth == 10) and (day > 14))):
           jd1 = self.intPart((1461 * (yr + 4800 + self.intPart((mth - 14) / 12.0))) / 4)
           jd2 = self.intPart((367 * (mth - 2 - 12 * (self.intPart((mth - 14) / 12.0)))) / 12)
           jd3 = self.intPart((3 * (self.intPart((yr + 4900 + self.intPart((mth - 14) / 12.0)) / 100))) / 4)
           jd = jd1 + jd2 - jd3 + day - 32075
        else:
           jd1 = self.intPart((7 * (yr + 5001 + self.intPart((mth - 9) / 7.0))) / 4)
           jd2 = self.intPart((275 * mth) / 9.0)
           jd = 367 * yr - jd1 + jd2 + day + 1729777

        l = jd - 1948440 + 10632
        n = self.intPart((l - 1) /10631.0)
        l = l - 10631 * n + 354
        j1 = (self.intPart((10985 - l) / 5316.0)) * (self.intPart((50 * l) / 17719.0))
        j2 = (self.intPart(l / 5670.0)) * (self.intPart((43 * l) / 15238.0))
        j = j1 + j2
        l1 = (self.intPart((30 - j) / 15.0)) * (self.intPart((17719 * j) / 50.0))
        l2 = (self.intPart(j / 16.0)) * (self.intPart((15238 * j) / 43.0))
        l = l - l1 - l2 + 29
        m = int(self.intPart((24 * l) / 709.0))
        d = int(l - self.intPart((709 * m) / 24.0))
        y = int(30 * n + j - 30)
                   
        self.higri_date=str(y) + "-"+ str(m) + "-" + str(d)
        return self.higri_date
    
    def Hijri2Gregorian(self,yr, mth, day):
        jd1 = self.intPart((11 * yr + 3) / 30.0)
        jd2 = self.intPart((mth - 1) / 2.0)
        jd = jd1 + 354 * yr + 30 * mth - jd2 + day + 1948440 - 385
        
        if jd > 2299160:
            l = jd + 68569
            n = self.intPart((4 * l) / 146097.0)
            l = l - self.intPart((146097 * n + 3) / 4.0)
            i = self.intPart((4000 * (l + 1)) / 1461001.0)
            l = l - self.intPart((1461 * i) / 4.0) + 31
            j = self.intPart((80 * l) / 2447.0)
            d = l - self.intPart((2447 * j) / 80.0)
            l = self.intPart(j / 11.0)
            m = j + 2 - 12 * l
            y = 100 * (n - 49) + i + l
                
        else:
            j = jd + 1402
            k = self.intPart((j - 1) / 1461.0)
            l = j - 1461 * k
            n = self.intPart((l - 1) / 365.0) - self.intPart(l / 1461.0)
            i = l - 365 * n + 30
            j = self.intPart((80 * i) / 2447.0)
            d = i - self.intPart((2447 * j) / 80.0)
            i = self.intPart(j / 11.0)
            m = j + 2 - 12 * i
            y = 4 * k + n + i - 4716
        
       return y, m, d
0
Avatar
Discard
Avatar
Cybrosys Techno Solutions Pvt.Ltd
Best Answer

Hi,

Just to try to install it in V9 and check whether it get installed and it is working or not. If you get any errors in that process, just try to fix it and go forward.

Thanks

0
Avatar
Discard
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Sign up
Related Posts Replies Views Activity
Missing moules in server
openerp odoo8.0 odoo9.0
Avatar
0
Jun 16
3614
Migration from Odoo 8 to 9 using OpenUpgrade 9.0
migration odoo8.0 openupgrade odoo9.0
Avatar
Avatar
1
Oct 25
5731
any help to Downgrade js file from v9 to v8
javascript odooV8 odoo8.0 odoo9.0
Avatar
0
Feb 21
5085
Will Odoo continue supporting the forum module? Solved
forum website odoo8.0 odoo9.0
Avatar
Avatar
1
Aug 15
5009
Is there any module for manage test cases in odoo?
odoo9.0
Avatar
Avatar
1
Dec 24
6879
Community
  • Tutorials
  • Documentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Translations
Services
  • Odoo.sh Hosting
  • Support
  • Upgrade
  • Custom Developments
  • Education
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Brand Assets
  • Contact us
  • Jobs
  • Events
  • Podcast
  • Blog
  • Customers
  • Legal • Privacy
  • Security
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now