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

Data from fields get lost after pressin button

اشتراك

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

لقد تم الإبلاغ عن هذا السؤال
fieldsvaluesTransientModelodoo16features
1 الرد
2568 أدوات العرض
الصورة الرمزية
Agustin Cortes

Hello,

i porting/developing a module (working un V8).

It have a wizard , from the wizard we jump to a editable tree view with results and the option to confirm the operation.


I create the model (transient) en when clicking in the button (confirm the action) the data in the form get lost, all the fields cames empty

Here is my code:


the XML:


product.prices_update_wizard_result
product.prices_update_wizard_result











product.prices_update_wizard_result_detail.tree
product.prices_update_wizard_result_detail








and the py file:

class prices_update_wizard_result_detail(models.TransientModel):
_name = 'product.prices_update_wizard_result_detail'
_description = "details results"

result_id = fields.Many2one(
'product.prices_update_wizard_result', 'Result')
product_tmpl_id = fields.Many2one(
'product.template', 'Product Template',
readonly=True)
old_price = fields.Float(
'Old Price',
readonly=True)
new_price = fields.Float(
'New Price',
required=True
)


class prices_update_wizard_result(models.TransientModel):
_name = 'product.prices_update_wizard_result'
_description = "results"

@api.model
def default_get(self, fields_list):
res=super(prices_update_wizard_result,self).default_get(fields_list)
ret = []
price_discount = self._context.get('price_discount', 0.0)
price_surcharge = self._context.get('price_surcharge', 0.0)
price_round = self._context.get('price_round', 0.0)
product_tmpl_ids = self._context.get('product_tmpl_ids', [])
price_type = self._context.get('price_type', False)
for product_tmpl in self.env['product.template'].browse(
product_tmpl_ids):
if price_type == 'list_price':
old_price = product_tmpl.list_price
elif price_type == 'standard_price':
old_price = product_tmpl.standard_price
else:
raise UserError(_('Price type "%s" is not implemented') % (price_type))
vals = {
'product_tmpl_id': product_tmpl.id,
'old_price': old_price,
'new_price': self.env[
'product.prices_update_wizard'].calc_new_price(
old_price, price_discount,
price_surcharge, price_round),
}
ret.append([0,0,vals])
res.update({'detail_ids':ret})
return res


detail_ids = fields.One2many(
'product.prices_update_wizard_result_detail',
'result_id',
string='Products Detail',
store=False,
)

def confirm(self):
products_vals = []
price_type = self._context.get('price_type', False)
for line in self.detail_ids: #self.detail_ids comes empty
vals = {
'product_tmpl': line.product_tmpl_id,
'new_price': line.new_price,
}
products_vals.append(vals)
return self.env['product.prices_update_wizard'].update_prices(
products_vals, price_type)

if i change to models.Model works, but, if i perform a inline editiong, don't get stored in the self.detail_ids

Try with force_save but not solved at all


Any idea of any posible solution?

0
الصورة الرمزية
إهمال
Agustin Cortes
الكاتب

cant post xml code
here it goes

<record id="view_prices_update_wizard_result_form" model="ir.ui.view">
<field name="name">product.prices_update_wizard_result</field>
<field name="model">product.prices_update_wizard_result</field>
<field name="arch" type="xml">
<form string="Products">
<header>
<button name="confirm" string="Confirm" type="object" class="oe_highlight" />
</header>
<field name="detail_ids" force_save = "1"/>
</form>
</field>
</record>

<record id="view_prices_update_wizard_result_detail_tree" model="ir.ui.view">
<field name="name">product.prices_update_wizard_result_detail.tree</field>
<field name="model">product.prices_update_wizard_result_detail</field>
<field name="arch" type="xml">
<tree string="Products" create="false" editable="top">
<field name="product_tmpl_id" force_save = "1"/>
<field name="old_price" force_save = "1"/>
<field name="new_price" force_save = "1"/>
</tree>
</field>
</record>

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

Ok, i solved with a workarraound, not the ideal solution.

Basicaly, i create a temp variable in the first class, and update that value with api.onchage

when you press the button, i use that variable instead of the one from the view.
Not ideal, but working fine

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

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

تسجيل
المنشورات ذات الصلة الردود أدوات العرض النشاط
how to populate a new field in odoo on old records
development fields odoo16features
الصورة الرمزية
الصورة الرمزية
1
أغسطس 25
3729
Put 3 fields with their respective labels on a single line, odoo 16
fields label odoo16features
الصورة الرمزية
الصورة الرمزية
الصورة الرمزية
2
يناير 24
4503
many2one field is not saving
fields many2one odoo16features
الصورة الرمزية
الصورة الرمزية
1
أغسطس 23
3635
fields.Html() can not editable when it on the tree-view.
fields Html odoo16features
الصورة الرمزية
الصورة الرمزية
1
مايو 23
3543
inherit and add fields odoo16
fields res.partner odoo16features
الصورة الرمزية
الصورة الرمزية
الصورة الرمزية
الصورة الرمزية
3
أبريل 23
5926
المجتمع
  • دروس
  • التوثيق
  • المنتدى
مصدر مفتوح
  • تحميل
  • جيت هاب "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