تخطي للذهاب إلى المحتوى
أودو القائمة
  • تسجيل الدخول
  • جرب مجاناً
  • التطبيقات
    المالية
    • المحاسبة
    • فوترة
    • النفقات
    • جدول البيانات (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 create sample sale order and sale order line in odoo?

اشتراك

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

لقد تم الإبلاغ عن هذا السؤال
odooodooV8
2 الردود
23236 أدوات العرض
الصورة الرمزية
bhanukiran

I am trying to create a sample order in sales order.In the sample order form, products are sold to customers as complimentary copy(books in my case) without charging any money so I have created a separate sub-menu in sales menu.Here I take only product and quantity as input. Sample order number will be the next number from the sales order(like SO360).So I am fetching sales order number as parent_id in my inherited module.I am not able to create sale order line(data in order lines tab)

    class SaleOrder(models.Model):

    _inherit = 'sale.order'


    is_sample = fields.Boolean(string="Sample Order", default=False)

    parent_id = fields.Many2one('sale.order', string="Parent Sales Order")

    sample_ids = fields.One2many('sale.order', 'parent_id', string="Sample Orders")


    @api.model

    @api.returns('sale.order')

    def create(self, vals):

        if vals.get('is_sample', False) and vals.get('name', '/') == '/':

            IrSeq = self.env['ir.sequence']

            ref = IrSeq.next_by_code('sale.order.sample.ref') or '/'

            parent = self.search([('id', '=', vals.get('parent_id'))])

            vals['name'] = parent.name + ref

            vals['user_id'] = parent.user_id.id


        return super(SaleOrder, self).create(vals)


class SampleOrderWizard(models.TransientModel):

    _name = 'sale.order.sample.wizard'

    _description = 'Sample Sale Order Wizard'


    def _get_parent(self):

        res = False

        if self.env.context \

                and 'active_id' in list(self.env.context.iterkeys()):

            res = self.env.context['active_id']

            

        return res


    def _get_new_sale_line(self, orig_sale, orig_sale_line):

        """Internal function to get the fields of the sale order line. Modules

        enhancing this one should add their own fields to the return value."""


        res = {

            'order_id': orig_sale.id,

            'product_id': orig_sale_line.product.id,

            'name': orig_sale_line.name,

            'sequence': orig_sale_line.sequence,

            'price_unit': orig_sale_line.price_unit,

            'product_uom': orig_sale_line.product_uom.id,

            'product_uom_qty': orig_sale_line.qty or 1,

            'product_uos_qty': orig_sale_line.qty or 1,

        }

        self.env['sale.order.line'].create(res)


        return res


    def _get_order_lines(self, sale):

        res = []

        line_env = self.env['sale.order.sample.wizard.line']

        res = self._get_new_sale_line(sale, line_env)


        for line in sale.order_line:

            wizard_line = False

            for wzline in self.wizard_lines:

                if wzline.product == line.product_id:

                    wizard_line = wzline

                    break


            if wizard_line:

                res.append(

                    (0, 0, self._get_new_sale_line(sale, line, wizard_line))

                )


        return res


    def _get_wizard_lines(self):

        res = []

        if self._get_parent():

            SaleOrder = self.env['sale.order']

            parent = SaleOrder.search([('id', '=', self._get_parent())])

            for line in parent.order_line:

                res.append((0, 0,

                            {

                                'product': line.product_id,

                                'qty': 1,

                            }))

        return res


   


    @api.one

    def create_order(self):


        sale_vals = {

            'user_id': self.order.user_id.id,

            'partner_id': self.order.partner_id.id,

            'parent_id': self.order.id,

            'date_order': self.order_date,

            'client_order_ref': self.order.client_order_ref,

            'company_id': self.order.company_id.id,

            'is_sample': True,

            'order_line': self._get_order_lines(self.order)

        }

        self.env['sale.order'].create(sale_vals)


        return {'type': 'ir.actions.act_window_close'}


    order = fields.Many2one('sale.order', default=_get_parent, readonly=True)

    wizard_lines = fields.One2many('sale.order.sample.wizard.line', 'wizard', default=_get_wizard_lines)

    order_date = fields.Datetime(default=fields.Datetime.now())



class SampleOrderWizardLine(models.TransientModel):


    _name = 'sale.order.sample.wizard.line'

    _description = 'Sample Order Wizard Line'


    wizard = fields.Many2one('sale.order.sample.wizard')

    product = fields.Many2one('product.product',

                              domain=[('sale_ok', '=', True)])

    qty = fields.Float(string="Quantity", default=1.0, digits_compute=dp.get_precision('Product UoS'))

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

Existing order lines is a One2many relation to model sale.order.line, you can inherit it if you need to alter it
Or if you are trying to show another tree view below it you can add a One2many relation to that model in sale.order and from xml inherit sale order form view and add your one2many field

0
الصورة الرمزية
إهمال
الصورة الرمزية
Synodica Solutions Pvt. Ltd.
أفضل إجابة

\https://apps.odoo.com/apps/modules/13.0/pos_test_orders/

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

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

تسجيل
المنشورات ذات الصلة الردود أدوات العرض النشاط
Add a button to a ValidationError
odoo odooV8
الصورة الرمزية
الصورة الرمزية
1
نوفمبر 22
4220
How to get values of one record of a many2many relation displayed in a tree view when clicking on a button
odoo odooV8
الصورة الرمزية
0
يونيو 21
6788
How to pass string in wizard context
odoo odooV8
الصورة الرمزية
0
مارس 21
3601
How to replace invoice number sequence by invoice id from database
odoo odooV8
الصورة الرمزية
الصورة الرمزية
2
مايو 18
4899
Writing value to One2many Field odoo 8
odoo odooV8
الصورة الرمزية
الصورة الرمزية
3
مايو 18
5913
المجتمع
  • دروس
  • التوثيق
  • المنتدى
مصدر مفتوح
  • تحميل
  • جيت هاب "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