تخطي للذهاب إلى المحتوى
أودو القائمة
  • تسجيل الدخول
  • جرب مجاناً
  • التطبيقات
    المالية
    • المحاسبة
    • فوترة
    • النفقات
    • جدول البيانات (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 generate new draft invoice ( invoice_line ) from new generate module?

اشتراك

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

لقد تم الإبلاغ عن هذا السؤال
Invoice_line
2 الردود
9313 أدوات العرض
الصورة الرمزية
abdul aziz yaakup

Hi all,

I create a new module to calculate water consumption and I want to generate a new invoice from it. This module has similar models like "sale.order" and "sale.order.line". 

I can generate a draft invoice from my module but the problem is, it doesn't include the invoice_lines. This draft invoice only get the value for the customer (partner_id) , journal (journal_id) and account (account_id).  

Can anyone assist me on this?

Thank you.

 

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

Go to sale/wizard/sale_make_invoice.py and sale/wizard/sale_line_invoice.py for reference - you have methods written right there. Look also at sale.py, especially at _prepare_order_line_invoice_line for further answers.

0
الصورة الرمزية
إهمال
الصورة الرمزية
abdul aziz yaakup
الكاتب أفضل إجابة

Hi Mariusz Mizgier, Thanks for your tips. I already create the same methods in order to make it happen but I got the following error.

 

2014-06-02 12:52:21,945 5460 ERROR ccsb2 openerp.sql_db: Programming error: can't adapt type 'browse_record', in query insert into "account_invoice" (id,"origin","comment","check_total","reference","payment_term","journal_id","currency_id","partner_id","fiscal_position","user_id","reference_type","company_id","state","type","internal_number","account_id","reconciled","section_id","date_invoice","name","sent",create_uid,create_date,write_uid,write_date) values (31,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,(now() at time zone 'UTC'),%s,(now() at time zone 'UTC')) 2014-06-02 12:52:21,946 5460 ERROR ccsb2 openerp.osv.osv: Uncaught exception Traceback (most recent call last): File "/opt/openerp/v7/server/openerp/osv/osv.py", line 132, in wrapper return f(self, dbname, *args, **kwargs) File "/opt/openerp/v7/server/openerp/osv/osv.py", line 199, in execute res = self.execute_cr(cr, uid, obj, method, *args, **kw) File "/opt/openerp/v7/addons/audittrail/audittrail.py", line 514, in execute_cr return fct_src(cr, uid, model, method, *args, **kw) File "/opt/openerp/v7/server/openerp/osv/osv.py", line 187, in execute_cr return getattr(object, method)(cr, uid, *args, **kw) File "/opt/openerp/v7/extra_addons/utility_meter/wizard/water_make_invoice_advance.py", line 176, in create_invoices res = utility_meter_obj.action_invoice_create(cr, uid, utility_meter_ids, context) File "/opt/openerp/v7/extra_addons/utility_meter/water_meter.py", line 982, in action_invoice_create res = self._make_invoice(cr, uid, val[0][0], reduce(lambda x, y: x + y, [l for o, l in val], []), context=context) File "/opt/openerp/v7/extra_addons/utility_meter/water_meter.py", line 902, in _make_invoice inv_id = inv_obj.create(cr, uid, inv, context=context) File "/opt/openerp/v7/addons/mail/mail_thread.py", line 241, in create thread_id = super(mail_thread, self).create(cr, uid, values, context=context) File "/opt/openerp/v7/server/openerp/osv/orm.py", line 4511, in create cr.execute('insert into "'+self._table+'" (id'+upd0+") values ("+str(id_new)+upd1+')', tuple(upd2)) File "/opt/openerp/v7/server/openerp/sql_db.py", line 161, in wrapper return f(self, *args, **kwargs) File "/opt/openerp/v7/server/openerp/sql_db.py", line 226, in execute res = self._obj.execute(query, params) ProgrammingError: can't adapt type 'browse_record' 2014-06-02 12:52:21,952 5460 ERROR ccsb2 openerp.netsvc: can't adapt type 'browse_record' Traceback (most recent call last): File "/opt/openerp/v7/server/openerp/netsvc.py", line 296, in dispatch_rpc result = ExportService.getService(service_name).dispatch(method, params) File "/opt/openerp/v7/server/openerp/service/web_services.py", line 626, in dispatch res = fn(db, uid, *params) File "/opt/openerp/v7/server/openerp/osv/osv.py", line 190, in execute_kw return self.execute(db, uid, obj, method, *args, **kw or {}) File "/opt/openerp/v7/server/openerp/osv/osv.py", line 132, in wrapper return f(self, dbname, *args, **kwargs) File "/opt/openerp/v7/server/openerp/osv/osv.py", line 199, in execute res = self.execute_cr(cr, uid, obj, method, *args, **kw) File "/opt/openerp/v7/addons/audittrail/audittrail.py", line 514, in execute_cr return fct_src(cr, uid, model, method, *args, **kw) File "/opt/openerp/v7/server/openerp/osv/osv.py", line 187, in execute_cr return getattr(object, method)(cr, uid, *args, **kw) File "/opt/openerp/v7/extra_addons/utility_meter/wizard/water_make_invoice_advance.py", line 176, in create_invoices res = utility_meter_obj.action_invoice_create(cr, uid, utility_meter_ids, context) File "/opt/openerp/v7/extra_addons/utility_meter/water_meter.py", line 982, in action_invoice_create res = self._make_invoice(cr, uid, val[0][0], reduce(lambda x, y: x + y, [l for o, l in val], []), context=context) File "/opt/openerp/v7/extra_addons/utility_meter/water_meter.py", line 902, in _make_invoice inv_id = inv_obj.create(cr, uid, inv, context=context) File "/opt/openerp/v7/addons/mail/mail_thread.py", line 241, in create thread_id = super(mail_thread, self).create(cr, uid, values, context=context) File "/opt/openerp/v7/server/openerp/osv/orm.py", line 4511, in create cr.execute('insert into "'+self._table+'" (id'+upd0+") values ("+str(id_new)+upd1+')', tuple(upd2)) File "/opt/openerp/v7/server/openerp/sql_db.py", line 161, in wrapper return f(self, *args, **kwargs) File "/opt/openerp/v7/server/openerp/sql_db.py", line 226, in execute res = self._obj.execute(query, params) ProgrammingError: can't adapt type 'browse_record'

 

I hope that you can help me on this because I was stuck at this error. Thanks.

0
الصورة الرمزية
إهمال
Mariusz Mizgier

Please copy your code here, so that I can say anything about it. I would be interested in the way you create a dictionary to pass the values for invoice creation.

abdul aziz yaakup
الكاتب

Here is my code. def _prepare_invoice(self, cr, uid, order, lines, context=None): if context is None: context = {} pa=1 pb=3 # pc=8 import pdb; pdb.set_trace(); invoice_vals = { 'name': order.client_order_ref or '', 'origin': order.name, 'type': 'out_invoice', 'reference':order.client_order_ref or order.name, 'account_id': order.partner_id.property_account_receivable.id, 'partner_id': order.partner_id.id, 'journal_id': order.journal_id, 'invoice_line': [(6, 0, lines)], 'currency_id': order.currency_id, 'comment': order.note, 'payment_term': order.payment_term and order.payment_term.id or False, 'fiscal_position': order.fiscal_position.id or order.partner_id.property_account_position.id, 'date_invoice': context.get('date_invoice', False), 'company_id': pa, 'user_id': order.user_id and order.user_id.id or False } import pdb; pdb.set_trace(); invoice_vals.update(self._inv_get(cr, uid, order, context=context)) return invoice_vals Here is for the _prepare_line.. def _prepare_invoice_line(self, cr, uid, line, account_id=False, context=None): res = {} if not line.invoiced: if not account_id: if line.product_id: account_id = line.product_id.property_account_income.id if not account_id: account_id = line.product_id.categ_id.property_account_income_categ.id if not account_id: raise osv.except_osv(_('Error!'), _('Please define income account for this product: "%s" (id:%d).') % \ (line.product_id.name, line.product_id.id,)) else: prop = self.pool.get('ir.property').get(cr, uid, 'property_account_income_categ', 'product.category', context=context) account_id = prop and prop.id or False uosqty = self._get_line_qty(cr, uid, line, context=context) uos_id = self._get_line_uom(cr, uid, line, context=context) pu = 0.0 import pdb; pdb.set_trace(); if not account_id: raise osv.except_osv(_('Error!'), _('There is no Fiscal Position defined or Income category account defined for default properties of Product categories.')) res = { 'name': line.name, 'sequence': line.sequence, 'origin': line.order_id.name, 'account_id': line.product_id.property_account_income.id, #'account_id': acc, 'price_unit': pu, 'quantity': uosqty, 'discount': line.discount, 'uos_id': uos_id, 'product_id': line.product_id.id or False, 'account_analytic_id': line.order_id.project_id and line.order_id.project_id.id or False, } return res

Mariusz Mizgier

Well, surely there is an error in invoice_vals definition - because the code is not clear to read in such message (best would be py file), i can see anyways that you reference 'journal_id': order.journal_id, whereas you should go for order.journal_id.id, as well as 'currency_id': order.currency_id, where it should be order.currency_id.id - both are many2one relations so you need ids of these (that's why error was about browse_record - you wanted to create an object with value of browse_record,id instead of id - that is how is order.journal_id seen in Python). Feel free to ask any further questions, hopefully I will be able to help you. If you need more simple way to create invoice, refer to https://github.com/odoo/odoo/blob/saas-5/addons/account_analytic_analysis/account_analytic_analysis.py lines 665-733.

هل أعجبك النقاش؟ لا تكن مستمعاً فقط. شاركنا!

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

تسجيل
المنشورات ذات الصلة الردود أدوات العرض النشاط
Importing Invoice Lines ignores field 'Invoice lines / External ID'
import Invoice_line
الصورة الرمزية
الصورة الرمزية
1
يناير 22
2703
i have this code for 12 but i want to use odoo 13 تم الحل
tax_id Invoice_line Odoo13
الصورة الرمزية
الصورة الرمزية
الصورة الرمزية
2
أغسطس 20
3183
[V8] Product description in invoice تم الحل
v8 Invoice_line V8
الصورة الرمزية
1
مايو 16
4544
Auto-completion of invoice lines problem تم الحل
Invoice_line auto-complete billable Invoicing
الصورة الرمزية
الصورة الرمزية
الصورة الرمزية
الصورة الرمزية
3
يوليو 23
4533
How to write multiple orderlines with XML-RPC to remote database? تم الحل
xmlrpc erppeek Invoice_line odoo8
الصورة الرمزية
1
فبراير 23
11211
المجتمع
  • دروس
  • التوثيق
  • المنتدى
مصدر مفتوح
  • تحميل
  • جيت هاب "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