تخطي للذهاب إلى المحتوى
أودو القائمة
  • تسجيل الدخول
  • جرب مجاناً
  • التطبيقات
    المالية
    • المحاسبة
    • فوترة
    • النفقات
    • جدول البيانات (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
حول هذا المنتدى
المساعدة

Hide journals, odoo 10 [SOLVED]

اشتراك

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

لقد تم الإبلاغ عن هذا السؤال
journalhide10.0
2 الردود
2811 أدوات العرض
الصورة الرمزية
Learning_Odoo

Hi, I have a boolean field in account.journal , and I have this function in account.payment:

@api.onchange('payment_type')
def _onchange_payment_type(self):
if not self.
invoice_ids:
# Set default partner type for the payment type
​if self.
payment_type == 'inbound':
​ ​self.
partner_type = 'customer'
# Set payment method domain
​res = self._onchange_journal()
​if not
res.get('domain', {}):
​ ​res['domain'] = {}
​res['domain']['journal_id'] = self.payment_type == 'inbound' and ​[('at_least_one_inbound', '=', True)] or []
​res['domain']['journal_id'].append(('type', 'in', ('bank', 'cash')))
​if self.
invoice_ids:
​ ​res['domain']['journal_id'].append(('ap_ar', '=', True))
​return
res


What this function does is that if I activate the boolean that is in account.journal in any of the journals (in this case for banks and cash), those journals will be hidden when registering a payment in customer invoices... but for some reason it is also applied when registering a payment in vendor invoices, when I only want the function to be applied to customer invoices...

What can I do so that the function does not apply to both customers and suppliers and that it only applies to customer invoices?

Odoo 10, thank you.

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

to modify the _onchange_payment_type function in Odoo 10 so that it only applies to customer invoices and not vendor invoices, you can make the following changes:

@api.onchange('payment_type')
def _onchange_payment_type(self):
if not self.invoice_ids:
# Set default partner type for the payment type
if self.payment_type == 'inbound':
self.partner_type = 'customer'
# Set payment method domain
res = self._onchange_journal()
if not res.get('domain', {}):
res['domain'] = {}
res['domain']['journal_id'] = [('type', 'in', ('bank', 'cash'))]
if self.invoice_ids:
res['domain']['journal_id'].append(('ap_ar', '=', True))
else:
# Reset journal domain for outbound payments (vendor invoices)
res = self._onchange_journal()
if not res.get('domain', {}):
res['domain'] = {}
res['domain']['journal_id'] = [('type', 'in', ('bank', 'cash'))]
return res


In the modified code, we introduce an else block after setting the default partner type for inbound payments. Inside the else block, we reset the journal domain by calling _onchange_journal() and assign a new domain that includes only the journals with type "bank" or "cash". This ensures that the journal domain is not modified for outbound payments (vendor invoices).

By making this change, the function will only apply the specific logic for customer invoices when the payment type is set to "inbound". For vendor invoices, the function will perform the default behavior without modifying the journal domain.


1
الصورة الرمزية
إهمال
Learning_Odoo
الكاتب

Hello, thanks for answering, apparently it doesn't work since I put the lines of code that are after the else and even so it continues to take the condition in both customer invoices and supplier invoices, here is my code:
@api.onchange('payment_type')
def _onchange_payment_type(self):
if not self.invoice_ids:
# Set default partner type for the payment type
if self.payment_type == 'inbound':
self.partner_type = 'customer'
# Set payment method domain
res = self._onchange_journal()
if not res.get('domain', {}):
res['domain'] = {}
res['domain']['journal_id'] = [('type', 'in', ('bank', 'cash'))]
if self.invoice_ids:
res['domain']['journal_id'].append(('ap_ar', '=', True))
else:
# Reset journal domain for outbound payments (vendor invoices)
res = self._onchange_journal()
if not res.get('domain', {}):
res['domain'] = {}
res['domain']['journal_id'] = [('type', 'in', ('bank', 'cash'))]
return res
It is supposed that only the journals should be hidden in customer invoices, all the journals should appear in supplier invoices, but it doesn't work.
Thank you!

shubham shiroya

try this way:
@api.onchange('payment_type')
def onchange_payment_type(self):
if not self.invoice_ids:
# Set default partner type for the payment type
if self.payment_type == 'inbound':
self.partner_type = 'customer'
# Set payment method domain
domain = [('type', 'in', ('bank', 'cash'))]
if self.invoice_ids:
domain.append(('ap_ar', '=', True))
return {'domain': {'journal_id': domain}}
return {}

In this code, we directly return the domain in the onchange_payment_type method based on the condition for customer invoices. If the payment type is 'inbound' (customer invoice), we set the domain to only include journals with types 'bank' or 'cash' and optionally with the 'ap_ar' field set to True. If the condition is not met, we return an empty dictionary to indicate no changes to the domain.

By using this approach, the function should apply the specific logic for customer invoices and not modify the journal domain for vendor invoices.

Learning_Odoo
الكاتب

It didn't work either, as it was missing to give the final touch to the if, the only thing I did in the if was to add that the type of payment was 'inbound' so that it could apply the domain, and that's how it already worked.... I don't know if it was OK, I show you my code:

@api.onchange('payment_type')
def _onchange_payment_type(self):
​if not self.invoice_ids:
​# Set default partner type for the payment type
​ ​if self.payment_type == 'inbound':
​ ​ ​self.partner_type = 'customer'
​# Set payment method domain
​domain = [('type', 'in', ('bank', 'cash'))]
​ ​if self.invoice_ids and self.payment_type == 'inbound':
​ ​ ​domain.append(('ap_ar', '=', True))
​ ​return {'domain': {'journal_id': domain}}
​ ​return {}

In this way it does work, since when I activate the boolean in any of the journals, it shows me in the customer invoices only the journals that have the checkbox activated, and in the supplier invoices this filter no longer applies to me, now it only applies to me the filter that shows me all the newspapers that are in the bank and cash.

Thank you!

Learning_Odoo
الكاتب

It's solved, thanks for your help!

الصورة الرمزية
Learning_Odoo
الكاتب أفضل إجابة

It didn't work either, as it was missing to give the final touch to the if, the only thing I did in the if was to add that the type of payment was 'inbound' so that it could apply the domain, and that's how it already worked.... I don't know if it was OK, I show you my code:

@api.onchange('payment_type')
def _onchange_payment_type(self):
​if not self.invoice_ids:
​# Set default partner type for the payment type
​ ​if self.payment_type == 'inbound':
​ ​ ​self.partner_type = 'customer'
​# Set payment method domain
​domain = [('type', 'in', ('bank', 'cash'))]
​ ​if self.invoice_ids and self.payment_type == 'inbound':
​ ​ ​domain.append(('ap_ar', '=', True))
​ ​return {'domain': {'journal_id': domain}}
​ ​return {}

In this way it does work, since when I activate the boolean in any of the journals, it shows me in the customer invoices only the journals that have the checkbox activated, and in the supplier invoices this filter no longer applies to me, now it only applies to me the filter that shows me all the newspapers that are in the bank and cash.

Thank you!

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

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

تسجيل
المنشورات ذات الصلة الردود أدوات العرض النشاط
[Odoo 10] How to create a journal through code (custom module)? تم الحل
journal sale.order 10 10.0
الصورة الرمزية
الصورة الرمزية
1
مايو 17
9613
How can you create journal sequences based on accounting posting dates? تم الحل
journal
الصورة الرمزية
الصورة الرمزية
2
يونيو 22
3663
Can't reconcile bank statement line
10.0
الصورة الرمزية
الصورة الرمزية
الصورة الرمزية
الصورة الرمزية
4
أبريل 20
10176
Can not close POS session in Odoo 10 تم الحل
accounting pos journal 10 10.0
الصورة الرمزية
الصورة الرمزية
3
ديسمبر 19
9986
how to use field from same model تم الحل
10.0
الصورة الرمزية
الصورة الرمزية
1
نوفمبر 19
4759
المجتمع
  • دروس
  • التوثيق
  • المنتدى
مصدر مفتوح
  • تحميل
  • جيت هاب "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