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

How to return a popup when click in validate of account.invoice?

اشتراك

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

لقد تم الإبلاغ عن هذا السؤال
wizardviewpopupreturn
2 الردود
10633 أدوات العرض
الصورة الرمزية
Anabela Damas

Hi,

In order to have a popup when click in Validate button of account.invoice I have made some changes:

In addons/mymodule/account_invoice.py:

class account_invoice(osv.osv):
    _inherit = "account.invoice"
    def verify_vat(self, cr, uid, ids, context=None):
        """ Verify if the client has nif"""

        invoice_obj = self.pool.get('account.invoice')
        this = self.browse(cr, uid, ids)[0]
        for invoice_vi in invoice_obj.browse(cr,uid,ids):

            if invoice_vi.partner_id:
                if not invoice_vi.partner_id.vat:
                    form_res = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'vi_saft_pt', 'warning_vat_form')
                    form_id = form_res and form_res[1] or False
                    #import pdb
                    #pdb.set_trace()
                    print "VERIFY_VAT"
                    return {
                        'name': _('Warning Vat'),
                        'view_type': 'form',
                        'view_mode': 'form',
                        'res_model': 'warning.vat',
                        'view_id':[form_res and form_res[1] or False],
                        'target': 'new',
                        'domain': [],
                        'type': 'ir.actions.act_window',
                        'context': context,
                    }
            else:
                print "VERIFY_VAT 2return"
                return True 
account_invoice()

In addons/mymodule/warning_vat_view.xml:

<record id="warning_vat_form" model="ir.ui.view">
        <field name="name">warning.vat.form</field>
        <field name="model">warning.vat</field>
        <field name="arch" type="xml">
            <form string="Warning Vat" version="7.0">
                <separator string="The following client has no associated nif."/>
                <field name="vat"/>
                <field name="partner_id"/>
                <footer>
                    <button string="Cancel" class="oe_link" special="cancel" />
                </footer>
            </form>
        </field>
    </record>

<record id="action_warning_vat_form" model="ir.actions.act_window">
    <field name="name">Warning Vat</field>
    <field name="type">ir.actions.act_window</field>
    <field name="res_model">warning.vat</field>
    <field name="view_type">form</field>
    <field name="view_mode">form</field>
    <field name="target">new</field>
</record>

<record model="ir.actions.act_window.view" id="action_warning_vat_form_view">
    <field name="name">Warning Vat</field>
    <field name="view_mode">form</field>
    <field name="view_id" ref="warning_vat_form"/>
</record>

In addons/mymodule/account_invoice_workflow.xml :

    <record id="account.act_open" model="workflow.activity">
        <field name="wkf_id" ref="account.wkf"/>
        <field name="name">open</field>
        <field name="action">action_date_assign()

action_move_create() action_number() invoice_validate() verify_vat()</field> <field name="kind">function</field> </record>

This code gives me the following error:

Uncaught TypeError: Cannot read property 'view_type' of undefined
http://localhost:8069/web/webclient/js?db=..

If I change the order in addons/mymodule/account_invoice_workflow.xml like this :

    <record id="account.act_open" model="workflow.activity">
        <field name="wkf_id" ref="account.wkf"/>
        <field name="name">open</field>
        <field name="action">verify_vat()
action_date_assign()
action_move_create()
action_number()
invoice_validate()
</field>
            <field name="kind">function</field>
        </record>

It prints the "VERIFY_VAT" but nothing appears and the invoice is validated.

I had change the code in the return of verify_vat but nothing appears...

Thanks

0
الصورة الرمزية
إهمال
الصورة الرمزية
Anabela Damas
الكاتب أفضل إجابة

If I change the code of verify_vat to :

def verify_vat(self, cr, uid, ids, context=None):
    """ Verify if the client has nif"""

    invoice_obj = self.pool.get('account.invoice')
    this = self.browse(cr, uid, ids)[0]
    for invoice_vi in invoice_obj.browse(cr,uid,ids):

        if invoice_vi.partner_id:
            if not invoice_vi.partner_id.vat:
                form_res = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'vi_saft_pt', 'warning_vat_form')
                form_id = form_res and form_res[1] or False
                wizard_id = self.pool.get("warning.vat").create(cr, uid, {}, context)
                print "VERIFY_VAT"
                return {
                    'type': 'ir.actions.act_window',
                    'name': _('Warning Vat'),
                    'view_type': 'form',
                    'view_mode': 'form',
                    'res_model': 'warning.vat',
                    'view_id': False,
                    'target': 'new',
                    'nodestroy': True, 
                    'domain': [],
                    'views': [(form_id, 'form')],
                    'res_id': wizard_id,
                    'context': context,
                }

And in addons/mymodule/account_invoice_workflow.xml :

   <record id="account.act_open" model="workflow.activity">
        <field name="wkf_id" ref="account.wkf"/>
        <field name="name">open</field>
        <field name="action">action_date_assign()
action_move_create()
action_number()
invoice_validate()
verify_vat()
</field>
            <field name="kind">function</field>
        </record>

It works.

Thanks.

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

Hello Anabela, I need to run a wizard on creation of Invoice, when it is in draft. I've tried your code, adding the function to act_draft activity. The function is executed but wizard doesn't show. When I add it to the act_open activiti it works well. Do you have any idea why its not working in a draft on creation of Invoice?

I've even tried to start a subflow and execute the function there, but still no results.

Anyways thanks for your post it is really helpful. Cheers!

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

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

تسجيل
المنشورات ذات الصلة الردود أدوات العرض النشاط
Before view form show an wizard related!!!
wizard view
الصورة الرمزية
الصورة الرمزية
الصورة الرمزية
2
مارس 15
4464
Is it possible to redirect user an external url & open view at the same function ?
views view return
الصورة الرمزية
0
أبريل 20
4858
Open a View in Pop Up in a one to many relationship
view popup custom_module
الصورة الرمزية
الصورة الرمزية
1
مارس 15
7737
Return tree view from wizard
wizard view v6.0
الصورة الرمزية
0
مارس 15
8314
How to disable wizard call in specific views ?
action wizard view
الصورة الرمزية
0
مارس 15
4788
المجتمع
  • دروس
  • التوثيق
  • المنتدى
مصدر مفتوح
  • تحميل
  • جيت هاب "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