تخطي للذهاب إلى المحتوى
أودو القائمة
  • تسجيل الدخول
  • جرب مجاناً
  • التطبيقات
    المالية
    • المحاسبة
    • فوترة
    • النفقات
    • جدول البيانات (BI)
    • المستندات
    • توقيع إلكتروني
    المبيعات
    • إدارة علاقات العملاء
    • المبيعات
    • نقطة البيع للمتاجر
    • نقطة البيع للمطاعم
    • الاشتراكات
    • تأجير
    المواقع الإلكترونية
    • أداة بناء المواقع الإلكترونية
    • متاجر إلكترونية
    • مدونة
    • المنتدى
    • دردشة مباشرة
    • التعليم الإلكتروني
    سلسلة التوريد
    • المستودعات
    • التصنيع
    • إدارة دورة حياة المنتج
    • المشتريات
    • الصيانة
    • الجودة
    الموارد البشرية
    • موظفون
    • التوظيف
    • إجازة عمل
    • التقييمات
    • الإحالات
    • تطبيق الأسطول
    التسويق
    • التسويق الإجتماعي
    • التسويق عبر البريد الإلكتروني
    • التسويق عبر الرسائل النصية
    • فعاليات
    • أتمتة التسويق
    • الاستطلاعات
    الخدمات
    • المشاريع
    • الجداول الزمنية
    • الخدمة الميدانية
    • مكتب المساعدة
    • التخطيط
    • مواعيد
    اﻹنتاجية
    • مناقشة
    • الموافقات
    • إنترنت الأشياء "IoT"
    • بروتوكول ربط المحادثات الصوتية عبر الإنترنت
    • المعرفة
    • WhatsApp
    التطبيقات الخارجية ستوديو أودو منصة أودو السحابية
  • قطاعات الأعمال
    البيع بالتجزئة
    • متجر كتب
    • متجر ملابس
    • متجر أثاث
    • متجر بقالة
    • متجر معدات
    • متجر ألعاب
    الطعام والضيافة
    • بار وحانة
    • المطعم
    • مطعم للوجبات السريعة
    • نزل للضيوف
    • موزّع مشروبات
    • فندق
    العقارات
    • وكالة عقارات
    • شركة هندسة معمارية
    • البناء
    • إدارة العقارات
    • العناية بالحدائق
    • اتحاد مُلاّك العقارات
    استشارة
    • مؤسسة محاسبية
    • شريك أودو
    • وكالة تسويقية
    • منشأة قانونية
    • استقطاب المواهب
    • التدقيق والتوثيق
    التصنيع
    • الأقمشة
    • معدني
    • الأثاث
    • الطعام
    • مصنع خمور
    • هدايا الشركات
    الصحة واللياقة البدنية
    • نادي رياضي
    • متجر نظارات
    • مركز لياقة بدنية
    • الممارسون الصحيون
    • صيدلية
    • صالون تصفيف الشعر
    التجارة
    • عامل صيانة
    • الأجهزة والمعدات التقنية ودعمها
    • أنظمة الطاقة الشمسية
    • صانع أحذية
    • خدمات التنظيف
    • خدمات التكييف (HVAC)
    غير ذلك
    • منظمة غير ربحية
    • وكالة بيئية
    • تأجير لوحات إعلانية
    • تصوير
    • تأجير دراجات
    • بائع وسيط للبرمجيات
    تصفح كافة قطاعات الأعمال
  • مجتمع أودو
    تعلم
    • دروس
    • التوثيق
    • شهادات
    • التدريب
    • مدونة
    • بودكاست
    قم بتعزيز التعليم
    • برنامج تعليم
    • Scale UP! لعبة الأعمال
    • قم بزيارة أودو
    احصل على البرنامج
    • تحميل
    • قارنْ الإصدارات
    • إطلاق
    تعاون
    • جيت هاب "Github"
    • المنتدى
    • فعاليات
    • الترجمات
    • كنْ شريكاً
    • خدمات الشركاء
    • سجل مكتب المحاسبة الخاص بك
    احصل على الخدمات
    • اعثر على شريك
    • اعثر على محاسب
    • قابل أحد مرشدي الأعمال
    • خدمات التنفيذ
    • مراجع العملاء
    • الدعم
    • الترقيات
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    الحصول على عرض توضيحي
  • الأسعار
  • المساعدة

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

  • إدارة علاقات العملاء
  • e-Commerce
  • المحاسبة
  • المخزون
  • PoS
  • المشروع
  • MRP
All apps
يجب أن تكون مسجلاً حتى تتفاعل مع المجتمع.
كافة المنشورات الأفراد الشارات
علامات التصنيف (عرض الكل)
odoo accounting v14 pos v15
حول هذا المنتدى
يجب أن تكون مسجلاً حتى تتفاعل مع المجتمع.
كافة المنشورات الأفراد الشارات
علامات التصنيف (عرض الكل)
odoo accounting v14 pos v15
حول هذا المنتدى
المساعدة

AttributeError: 'int' object has no attribute 'id'

اشتراك

تسلم الإشعارات عندما يكون هناك نشاط في هذا المنشور

لقد تم الإبلاغ عن هذا السؤال
3 الردود
16657 أدوات العرض
الصورة الرمزية
Afthab



Traceback (most recent call last): File "/odoo/odoo-server/odoo/http.py", line 640, in _handle_exception return super(JsonRequest, self)._handle_exception(exception) File "/odoo/odoo-server/odoo/http.py", line 677, in dispatch result = self._call_function(**self.params) File "/odoo/odoo-server/odoo/http.py", line 333, in _call_function return checked_call(self.db, *args, **kwargs) File "/odoo/odoo-server/odoo/service/model.py", line 101, in wrapper return f(dbname, *args, **kwargs) File "/odoo/odoo-server/odoo/http.py", line 326, in checked_call result = self.endpoint(*a, **kw) File "/odoo/odoo-server/odoo/http.py", line 935, in __call__ return self.method(*args, **kw) File "/odoo/odoo-server/odoo/http.py", line 506, in response_wrap response = f(*args, **kw) File "/odoo/odoo-server/addons/web/controllers/main.py", line 1154, in load action = request.env[action_type].browse([action_id]).read() File "/odoo/odoo-server/odoo/addons/base/ir/ir_actions.py", line 317, in read result = super(IrActionsActWindow, self).read(fields, load=load) File "/odoo/odoo-server/odoo/models.py", line 3018, in read values[name] = field.convert_to_read(record[name], record, use_name_get) File "/odoo/odoo-server/odoo/models.py", line 5208, in __getitem__ return self._fields[key].__get__(self, type(self)) File "/odoo/odoo-server/odoo/fields.py", line 910, in __get__ self.determine_value(record) File "/odoo/odoo-server/odoo/fields.py", line 1022, in determine_value self.compute_value(recs) File "/odoo/odoo-server/odoo/fields.py", line 976, in compute_value self._compute_value(records) File "/odoo/odoo-server/odoo/fields.py", line 967, in _compute_value getattr(records, self.compute)() File "/odoo/odoo-server/odoo/addons/base/ir/ir_actions.py", line 277, in _compute_search_view fvg = self.env[act.res_model].fields_view_get(act.search_view_id.id, 'search') File "/odoo/odoo-server/addons/hr_uae/models/hr_employee.py", line 52, in fields_view_get expiry_tree_emirates_view_id = get_view_id('view_expiry_emirates_reminder_employee_tree', 'hr.employee.tree').id AttributeError: 'int' object has no attribute 'id'    





my  hr_employee.py file is


# -*- coding: utf-8 -*-

#

# OpenERP, Open Source Management Solution

#

# This program is free software: you can redistribute it and/or modify

# it under the terms of the GNU Affero General Public License as

# published by the Free Software Foundation, either version 3 of the

# License, or (at your option) any later version.

#

# This program is distributed in the hope that it will be useful,

# but WITHOUT ANY WARRANTY; without even the implied warranty of

# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the

# GNU Affero General Public License for more details.

#

# You should have received a copy of the GNU Affero General Public License

# along with this program. If not, see <http://www.gnu.org/licenses/>.

#

from odoo import models, fields, api, _

from datetime import datetime, timedelta

from odoo.exceptions import except_orm, RedirectWarning

from lxml import etree

class HrEmployee(models.Model):

_inherit = 'hr.employee'

@api.model

def fields_view_get(self, view_id=None, view_type=False, toolbar=False, submenu=False):

res = super(HrEmployee, self).fields_view_get(view_id=view_id, view_type=view_type, toolbar=toolbar,

submenu=submenu)

today = datetime.now().strftime('%Y-%m-%d')

tomorrow = (datetime.now() + timedelta(days=1)).strftime('%Y-%m-%d')

day_b4_30 = (datetime.now() + timedelta(days=30)).strftime('%Y-%m-%d')

day_b4_60 = (datetime.now() + timedelta(days=60)).strftime('%Y-%m-%d')

today_str = "'" + today + "'"

tomorrow_str = "'" + tomorrow + "'"

day_b4_30_str = "'" + day_b4_30 + "'"

day_b4_60_str = "'" + day_b4_60 + "'"

def get_view_id(xid, name):

try:

return self.env.ref('archi_custom.' + xid)

except ValueError:

view = self.env['ir.ui.view'].search([('name', '=', name)], limit=1)

if not view:

return False

return view.id

expiry_tree_emirates_view_id = get_view_id('view_expiry_emirates_reminder_employee_tree', 'hr.employee.tree').id

expiry_tree_passport_view_id = get_view_id('view_expiry_passport_reminder_employee_tree', 'hr.employee.tree').id

expiry_tree_license_view_id = get_view_id('view_expiry_license_reminder_employee_tree', 'hr.employee.tree').id

expiry_tree_health_card_view_id = get_view_id('view_expiry_health_card_reminder_employee_tree', 'hr.employee.tree').id

expiry_tree_visa_view_id = get_view_id('view_expiry_visa_reminder_employee_tree', 'hr.employee.tree').id

expiry_tree_insurance_view_id = get_view_id('view_expiry_insurance_reminder_employee_tree', 'hr.employee.tree').id

expiry_tree_work_permit_view_id = get_view_id('view_expiry_work_permit_reminder_employee_tree', 'hr.employee.tree').id

if expiry_tree_emirates_view_id:

if expiry_tree_emirates_view_id == view_id:

doc = etree.XML(res['arch'])

for node in doc.xpath("//tree"):

color_string = "grey:emirates_expiry_date < " + today_str + " ;" + "red:emirates_expiry_date == " + today_str + " ;" + "orange:emirates_expiry_date >=" + tomorrow_str + "and emirates_expiry_date <=" + day_b4_30_str + " ;"

color_string = color_string + "blue:emirates_expiry_date >" + day_b4_30_str + "and emirates_expiry_date <=" + day_b4_60_str + " ;" + "green:emirates_expiry_date > " + day_b4_60_str + " ;"

node.set('colors', color_string)

res['arch'] = etree.tostring(doc)

if expiry_tree_passport_view_id:

if expiry_tree_passport_view_id == view_id:

doc = etree.XML(res['arch'])

for node in doc.xpath("//tree"):

color_string = "grey:passport_expiry_date < " + today_str + " ;" + "red:passport_expiry_date == " + today_str + " ;" + "orange:passport_expiry_date >=" + tomorrow_str + "and passport_expiry_date <=" + day_b4_30_str + " ;"

color_string = color_string + "blue:passport_expiry_date >" + day_b4_30_str + "and passport_expiry_date <=" + day_b4_60_str + " ;" + "green:passport_expiry_date > " + day_b4_60_str + " ;"

node.set('colors', color_string)

res['arch'] = etree.tostring(doc)

if expiry_tree_license_view_id:

if expiry_tree_license_view_id == view_id:

doc = etree.XML(res['arch'])

for node in doc.xpath("//tree"):

color_string = "grey:license_expiry_date < " + today_str + " ;" + "red:license_expiry_date == " + today_str + " ;" + "orange:license_expiry_date >=" + tomorrow_str + "and license_expiry_date <=" + day_b4_30_str + " ;"

color_string = color_string + "blue:license_expiry_date >" + day_b4_30_str + "and license_expiry_date <=" + day_b4_60_str + " ;" + "green:license_expiry_date > " + day_b4_60_str + " ;"

node.set('colors', color_string)

res['arch'] = etree.tostring(doc)

if expiry_tree_health_card_view_id:

if expiry_tree_health_card_view_id == view_id:

doc = etree.XML(res['arch'])

for node in doc.xpath("//tree"):

color_string = "grey:health_card_expiry_date < " + today_str + " ;" + "red:health_card_expiry_date == " + today_str + " ;" + "orange:health_card_expiry_date >=" + tomorrow_str + "and health_card_expiry_date <=" + day_b4_30_str + " ;"

color_string = color_string + "blue:health_card_expiry_date >" + day_b4_30_str + "and health_card_expiry_date <=" + day_b4_60_str + " ;" + "green:health_card_expiry_date > " + day_b4_60_str + " ;"

node.set('colors', color_string)

res['arch'] = etree.tostring(doc)

if expiry_tree_visa_view_id:

if expiry_tree_visa_view_id == view_id:

doc = etree.XML(res['arch'])

for node in doc.xpath("//tree"):

color_string = "grey:visa_expiry_date < " + today_str + " ;" + "red:visa_expiry_date == " + today_str + " ;" + "orange:visa_expiry_date >=" + tomorrow_str + "and visa_expiry_date <=" + day_b4_30_str + " ;"

color_string = color_string + "blue:visa_expiry_date >" + day_b4_30_str + "and visa_expiry_date <=" + day_b4_60_str + " ;" + "green:visa_expiry_date > " + day_b4_60_str + " ;"

node.set('colors', color_string)

res['arch'] = etree.tostring(doc)

if expiry_tree_insurance_view_id:

if expiry_tree_insurance_view_id == view_id:

doc = etree.XML(res['arch'])

for node in doc.xpath("//tree"):

color_string = "grey:insurance_expiry_date < " + today_str + " ;" + "red:insurance_expiry_date == " + today_str + " ;" + "orange:insurance_expiry_date >=" + tomorrow_str + "and insurance_expiry_date <=" + day_b4_30_str + " ;"

color_string = color_string + "blue:insurance_expiry_date >" + day_b4_30_str + "and insurance_expiry_date <=" + day_b4_60_str + " ;" + "green:insurance_expiry_date > " + day_b4_60_str + " ;"

node.set('colors', color_string)

res['arch'] = etree.tostring(doc)

if expiry_tree_work_permit_view_id:

if expiry_tree_work_permit_view_id == view_id:

doc = etree.XML(res['arch'])

for node in doc.xpath("//tree"):

color_string = "grey:work_permit_expiry_date < " + today_str + " ;" + "red:work_permit_expiry_date == " + today_str + " ;" + "orange:work_permit_expiry_date >=" + tomorrow_str + "and work_permit_expiry_date <=" + day_b4_30_str + " ;"

color_string = color_string + "blue:work_permit_expiry_date >" + day_b4_30_str + "and work_permit_expiry_date <=" + day_b4_60_str + " ;" + "green:work_permit_expiry_date > " + day_b4_60_str + " ;"

node.set('colors', color_string)

res['arch'] = etree.tostring(doc)

return res

health_card_expiry_date = fields.Date('Health Card Expiry Date')

health_card_id = fields.Char('Health Card ID')

camp = fields.Char('Camp')

fleet = fields.Char('Fleet')

emirates_expiry_date = fields.Date('Emirates ID Expiry Date')

emirates_id = fields.Char('Emirates ID')

license_type = fields.Selection([('Private', 'Private'),

('General', 'General'),

('Public', 'Public'),

('MotorCycle', 'MotorCycle')

], 'License Type')

license_expiry_date = fields.Date('License Expiry Date')

sponsor = fields.Char('Sponsor')

visa_expiry_date = fields.Date('Visa Expiry Date')

insurance = fields.Char('Insurance Name')

insurance_type = fields.Char('Insurance Type')

insurance_expiry_date = fields.Date('Insurance Expiry Date')

work_permit_expiry_date = fields.Date('Work Permit Expiry Date')

passport_expiry_date = fields.Date('Passport Expiry Date')

issue_register_ids = fields.One2many('hr.issue.register', 'employee_id', "Issue Register")

salary_increment_ids = fields.One2many('hr.salary.increment', 'employee_id', 'Salary Increments')

vehicle_fine_ids = fields.One2many('vehicle.fine', 'employee_id', 'Vehicle Fine')

class HrIssueRegister(models.Model):

_name = 'hr.issue.register'

item_id = fields.Many2one('issue.item', 'Item', required=True)

issue_date = fields.Date('Issue Date')

employee_id = fields.Many2one('hr.employee', 'Employee', ondelete='cascade')

class IssueItem(models.Model):

_name = 'issue.item'

name = fields.Char('Name')

class HrSalaryIncrement(models.Model):

_name = 'hr.salary.increment'

increment_date = fields.Date('Increment Date')

base_salary = fields.Float('Base Salary')

increment = fields.Float('Increment')

employee_id = fields.Many2one('hr.employee', 'Employee', ondelete='cascade')

class VehicleFine(models.Model):

_name = 'vehicle.fine'

name = fields.Char('Name')

employee_id = fields.Many2one('hr.employee', 'Employee', ondelete='cascade')

fine_date = fields.Date('Date', required=True)

fine_type = fields.Char('Fine Type')

fine_amount = fields.Float('Amount', required=True)

is_paid = fields.Boolean('Is Paid')

0
الصورة الرمزية
إهمال
الصورة الرمزية
Megha Patel
أفضل إجابة

Afthab

the line which is throwing error is giving the id and it is already in integer and you are trying to access its id which is inappropriate

  • firstly browse it and then use id

            expiry_tree_emirates_view_id = get_view_id('view_expiry_emirates_reminder_employee_tree', 'hr.employee.tree')

            view_id = self.env["ir.ui.view"].browse(expiry_tree_emirates_view_id).id


Thank You


0
الصورة الرمزية
إهمال
الصورة الرمزية
Sehrish
أفضل إجابة

You are trying to get column name from integer field. For example you have a int type variable (abc) and you get something using (.) dot notation: abc.getting_something. Instead of int field get some field through object like hr(1).id

0
الصورة الرمزية
إهمال
الصورة الرمزية
Jothimani Rajagopal
أفضل إجابة

Hello Afthab,

The following codes returns only database id that is Integer not recordset. that's why the error is came.

expiry_tree_emirates_view_id = get_view_id('view_expiry_emirates_reminder_employee_tree', 'hr.employee.tree').id 

You can try like this for all occurrences 

expiry_tree_emirates_view_id = get_view_id('view_expiry_emirates_reminder_employee_tree', 'hr.employee.tree')

0
الصورة الرمزية
إهمال
هل أعجبك النقاش؟ لا تكن مستمعاً فقط. شاركنا!

أنشئ حساباً اليوم لتستمتع بالخصائص الحصرية، وتفاعل مع مجتمعنا الرائع!

تسجيل
المجتمع
  • دروس
  • التوثيق
  • المنتدى
مصدر مفتوح
  • تحميل
  • جيت هاب "Github"
  • المشغل الآلي رنبوت
  • الترجمات
خدماتنا
  • استضافة أودو إس إتش
  • الدعم
  • الترقية
  • التطويرات المخصصة
  • التعليم
  • اعثر على محاسب
  • اعثر على شريك
  • كنْ شريكاً
معلومات عنا
  • شركتنا
  • أصول العلامة التجارية
  • اتصلْ بنا
  • الوظائف
  • فعاليات
  • بودكاست
  • مدونة
  • عملاء
  • قانوني • الخصوصية
  • الحماية
الْعَرَبيّة 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

أودو هو عبارة عن مجموعة من تطبيقات الأعمال مفتوحة المصدر التي تغطي جميع احتياجات شركتك، مثل: إدارة علاقات العملاء والتجارة الإلكترونية والمحاسبة والمخزون ونقاط البيع وإدارة المشاريع وما إلى ذلك.

ما يجعل من أودو مميزاً هو هدفه بأن يكون سهل الاستخدام للغاية ومتكاملاً تمامًا في الوقت ذاته.

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