diff --git a/addons/web/common/openerplib/main.py b/addons/web/common/openerplib/main.py index 5cae9ce4636..773ea020d52 100644 --- a/addons/web/common/openerplib/main.py +++ b/addons/web/common/openerplib/main.py @@ -129,6 +129,18 @@ class XmlRPCConnector(Connector): # TODO should try except and wrap exception into LibException return getattr(service, method)(*args) +class XmlRPCSConnector(XmlRPCConnector): + """ + A type of connector that uses the secured XMLRPC protocol. + """ + PROTOCOL = 'xmlrpcs' + + __logger = _getChildLogger(_logger, 'connector.xmlrpcs') + + def __init__(self, hostname, port=8071): + super(XmlRPCSConnector, self).__init__(hostname, port) + self.url = 'https://%s:%d/xmlrpc' % (self.hostname, self.port) + class NetRPC_Exception(Exception): """ Exception for NetRPC errors. @@ -438,6 +450,7 @@ class Model(object): :return: A list of dictionaries containing all the specified fields. """ record_ids = self.search(domain or [], offset, limit or False, order or False, context or {}) + if not record_ids: return [] records = self.read(record_ids, fields or [], context or {}) return records @@ -450,15 +463,17 @@ def get_connector(hostname=None, protocol="xmlrpc", port="auto"): :param port: The number of the port. Defaults to auto. """ if port == 'auto': - port = 8069 if protocol=="xmlrpc" else 8070 + port = 8069 if protocol=="xmlrpc" else (8070 if protocol == "netrpc" else 8071) if protocol == "xmlrpc": return XmlRPCConnector(hostname, port) + elif protocol == "xmlrpcs": + return XmlRPCSConnector(hostname, port) elif protocol == "netrpc": return NetRPCConnector(hostname, port) elif protocol == "local": return LocalConnector() else: - raise ValueError("You must choose xmlrpc or netrpc or local") + raise ValueError("You must choose xmlrpc(s), netrpc or local") def get_connection(hostname=None, protocol="xmlrpc", port='auto', database=None, login=None, password=None, user_id=None): diff --git a/addons/web/po/ar.po b/addons/web/po/ar.po new file mode 100644 index 00000000000..0802e990ae5 --- /dev/null +++ b/addons/web/po/ar.po @@ -0,0 +1,698 @@ +# Arabic translation for openerp-web +# Copyright (c) 2011 Rosetta Contributors and Canonical Ltd 2011 +# This file is distributed under the same license as the openerp-web package. +# FIRST AUTHOR , 2011. +# +msgid "" +msgstr "" +"Project-Id-Version: openerp-web\n" +"Report-Msgid-Bugs-To: FULL NAME \n" +"POT-Creation-Date: 2011-10-07 10:38+0200\n" +"PO-Revision-Date: 2011-11-04 16:13+0000\n" +"Last-Translator: kifcaliph \n" +"Language-Team: Arabic \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Launchpad-Export-Date: 2011-11-05 06:04+0000\n" +"X-Generator: Launchpad (build 14231)\n" + +#: addons/web/static/src/js/view_form.js:355 +msgid "" +"Warning, the record has been modified, your changes will be discarded." +msgstr "تحذير، تم تحرير السجل، تعديلاتك سيتم تجاهلها" + +#: addons/web/static/src/js/view_form.js:1659 +msgid "   Search More..." +msgstr "    مزيداً من البحث..." + +#: addons/web/static/src/js/view_form.js:1672 +#, python-format +msgid "   Create \"%s\"" +msgstr "   إنشاء \"%s\"" + +#: addons/web/static/src/js/view_form.js:1678 +msgid "   Create and Edit..." +msgstr "   إنشاء و تحرير..." + +#: addons/web/static/src/js/views.js:568 +msgid "You must choose at least one record." +msgstr "عليك إختيار سجل واحد علي الأقل." + +#: addons/web/static/src/js/views.js:569 +msgid "Warning" +msgstr "تحذير" + +#: addons/web/static/src/js/views.js:609 +msgid "Translations" +msgstr "ترجمات" + +#: addons/web/static/src/js/views.js:614 addons/web/static/src/xml/base.xml:0 +msgid "Save" +msgstr "حفظ" + +#: addons/web/static/src/js/views.js:615 +msgid "Close" +msgstr "إغلاق" + +#: addons/web/static/src/xml/base.xml:0 +msgid "x" +msgstr "x" + +#: addons/web/static/src/xml/base.xml:0 +msgid "#{title}" +msgstr "#{لقب}" + +#: addons/web/static/src/xml/base.xml:0 +msgid "#{text}" +msgstr "#{text}" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Powered by" +msgstr "مدعوم من kifcaliph و" + +#: addons/web/static/src/xml/base.xml:0 +msgid "openerp.com" +msgstr "openerp.com" + +#: addons/web/static/src/xml/base.xml:0 +msgid "." +msgstr "." + +#: addons/web/static/src/xml/base.xml:0 +msgid "Loading..." +msgstr "جاري التحميل..." + +#: addons/web/static/src/xml/base.xml:0 +msgid "Create" +msgstr "إنشاء" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Drop" +msgstr "إزالة" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Backup" +msgstr "نسخة إحتياطية" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Restore" +msgstr "استرجاع" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Password" +msgstr "كلمة المرور" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Back to Login" +msgstr "العودة للدخول" + +#: addons/web/static/src/xml/base.xml:0 +msgid "CREATE DATABASE" +msgstr "إنشاء قاعدة بيانات" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Master password:" +msgstr "كلمة المرور الرئيسية:" + +#: addons/web/static/src/xml/base.xml:0 +msgid "New database name:" +msgstr "اسم قاعدة البيانات الجديدة:" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Load Demonstration data:" +msgstr "تحميل البيانات الوهمية:" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Default language:" +msgstr "اللغة الافتراضية:" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Admin password:" +msgstr "كلمة مرور المشرف العام:" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Confirm password:" +msgstr "تأكيد كلمة المرور:" + +#: addons/web/static/src/xml/base.xml:0 +msgid "DROP DATABASE" +msgstr "إسقاط قاعدة البيانات" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Database:" +msgstr "قاعدة البيانات:" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Master Password:" +msgstr "كلمة المرور الرئيسية:" + +#: addons/web/static/src/xml/base.xml:0 +msgid "BACKUP DATABASE" +msgstr "نسخ إحتياطي لقاعدة البيانات" + +#: addons/web/static/src/xml/base.xml:0 +msgid "RESTORE DATABASE" +msgstr "إسترجاع قاعدة بيانات" + +#: addons/web/static/src/xml/base.xml:0 +msgid "File:" +msgstr "ملف:" + +#: addons/web/static/src/xml/base.xml:0 +msgid "CHANGE MASTER PASSWORD" +msgstr "تغيير كلمة المرور الرئيسية" + +#: addons/web/static/src/xml/base.xml:0 +msgid "New master password:" +msgstr "كلمة مرور رئيسية جديدة:" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Confirm new master password:" +msgstr "تأكيد كلمة المرور الرئيسية الجديدة:" + +#: addons/web/static/src/xml/base.xml:0 +msgid "User:" +msgstr "مستخدم:" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Password:" +msgstr "كلمة المرور:" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Database" +msgstr "قاعدة بيانات" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Login" +msgstr "تسجيل الدخول" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Bad username or password" +msgstr "اسم مستخدم او كلمة مرور خاطئة" + +#: addons/web/static/src/xml/base.xml:0 +msgid "" +"We think that daily job activities can be more intuitive, efficient, " +"automated, .. and even fun." +msgstr "نؤمن بأن نشاط العمل اليومي يمكن أن يكون بديهي، فعال، سريع و ممتع" + +#: addons/web/static/src/xml/base.xml:0 +msgid "OpenERP's vision to be:" +msgstr "رؤي برنامج OpenERP هي:" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Full featured" +msgstr "كامل الأوصاف" + +#: addons/web/static/src/xml/base.xml:0 +msgid "" +"Today's enterprise challenges are multiple. We provide one module for each " +"need." +msgstr "" +"تتعدد تحديات المنشآت اليوم، و لذلك نوفر العديد من وحدات الأكواد لكل إحتياج." + +#: addons/web/static/src/xml/base.xml:0 +msgid "Open Source" +msgstr "مفتوح المصدر" + +#: addons/web/static/src/xml/base.xml:0 +msgid "" +"To Build a great product, we rely on the knowledge of thousands of " +"contributors." +msgstr "لبناء منتج قوي، نحن نعتمد علي معرفة ألاف المساهمين." + +#: addons/web/static/src/xml/base.xml:0 +msgid "User Friendly" +msgstr "سهل الإستخدام" + +#: addons/web/static/src/xml/base.xml:0 +msgid "" +"In order to be productive, people need clean and easy to use interface." +msgstr "تتمثل الإنتاجية في حاجة الأفراد إلي إستخدام واجهة سهلة و لائقة." + +#: addons/web/static/src/xml/base.xml:0 +msgid "(" +msgstr "(" + +#: addons/web/static/src/xml/base.xml:0 +msgid ")" +msgstr ")" + +#: addons/web/static/src/xml/base.xml:0 +msgid "LOGOUT" +msgstr "تسجيل الخروج" + +#: addons/web/static/src/xml/base.xml:0 +msgid "«" +msgstr "«" + +#: addons/web/static/src/xml/base.xml:0 +msgid "»" +msgstr "»" + +#: addons/web/static/src/xml/base.xml:0 +msgid "oe_secondary_menu_item" +msgstr "oe_secondary_menu_item" + +#: addons/web/static/src/xml/base.xml:0 +msgid "oe_secondary_submenu_item" +msgstr "oe_secondary_submenu_item" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Hide this tip" +msgstr "إخفاء هذه الملحوظة" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Disable all tips" +msgstr "تعطيل جميع النصائح" + +#: addons/web/static/src/xml/base.xml:0 +msgid "View#" +msgstr "View#" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Fields" +msgstr "حقول" + +#: addons/web/static/src/xml/base.xml:0 +msgid "View labels" +msgstr "عرض التسميات" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Sidebar Relates" +msgstr "روابط الشريط الجانبي" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Field" +msgstr "حقل" + +#: addons/web/static/src/xml/base.xml:0 +msgid ":" +msgstr ":" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Translate view" +msgstr "ترجمة العرض" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Translate sidebar" +msgstr "ترجمة الشريط الجانبي" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Delete" +msgstr "حذف" + +#: addons/web/static/src/xml/base.xml:0 +msgid "First" +msgstr "الأول" + +#: addons/web/static/src/xml/base.xml:0 +msgid "<" +msgstr "<" + +#: addons/web/static/src/xml/base.xml:0 +msgid ">" +msgstr ">" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Last" +msgstr "الأخير" + +#: addons/web/static/src/xml/base.xml:0 +msgid "♻" +msgstr "♻" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Save & Edit" +msgstr "حفظ و تحرير" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Create & Edit" +msgstr "إنشاء و تحرير" + +#: addons/web/static/src/xml/base.xml:0 +msgid "New" +msgstr "جديد" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Duplicate" +msgstr "تكرار" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Readonly/Editable" +msgstr "للقراءة فقط/قابل للتحرير" + +#: addons/web/static/src/xml/base.xml:0 +msgid "<<" +msgstr ">>" + +#: addons/web/static/src/xml/base.xml:0 +msgid "0" +msgstr "0" + +#: addons/web/static/src/xml/base.xml:0 +msgid "/" +msgstr "/" + +#: addons/web/static/src/xml/base.xml:0 +msgid ">>" +msgstr ">>" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Add" +msgstr "اضافة" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Unhandled widget" +msgstr "أداة غير معالجة" + +#: addons/web/static/src/xml/base.xml:0 +msgid "?" +msgstr "؟" + +#: addons/web/static/src/xml/base.xml:0 +msgid "#" +msgstr "#" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Done" +msgstr "تم" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Open..." +msgstr "فتح..." + +#: addons/web/static/src/xml/base.xml:0 +msgid "Create..." +msgstr "إنشاء..." + +#: addons/web/static/src/xml/base.xml:0 +msgid "Search..." +msgstr "بحث..." + +#: addons/web/static/src/xml/base.xml:0 +msgid "..." +msgstr "..." + +#: addons/web/static/src/xml/base.xml:0 +msgid "Uploading ..." +msgstr "جاري التحميل..." + +#: addons/web/static/src/xml/base.xml:0 +msgid "Select" +msgstr "حدّد" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Save As" +msgstr "حفظ كـ" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Clear" +msgstr "إفراغ" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Advanced Filter" +msgstr "مرشحات متقدمة" + +#: addons/web/static/src/xml/base.xml:0 +msgid "-- Filters --" +msgstr "-- مرشحات --" + +#: addons/web/static/src/xml/base.xml:0 +msgid "-- Actions --" +msgstr "-- إجراءات --" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Save Filter" +msgstr "حفظ المرشح" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Manage Filters" +msgstr "إدارة المرشحات" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Filter Name:" +msgstr "اسم المرشح:" + +#: addons/web/static/src/xml/base.xml:0 +msgid "(Any existing filter with the same name will be replaced)" +msgstr "(لاحظ أن أي مرشح بنفس الاسم سيتم إستبداله)" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Any of the following conditions must match" +msgstr "يجب تطابق أي من الشروط التالية" + +#: addons/web/static/src/xml/base.xml:0 +msgid "All the following conditions must match" +msgstr "يجب تطابق كل الشروط التالية" + +#: addons/web/static/src/xml/base.xml:0 +msgid "None of the following conditions must match" +msgstr "لا يجب تطابق أي من الشروط التالية" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Add condition" +msgstr "إضافة شرط" + +#: addons/web/static/src/xml/base.xml:0 +msgid "and" +msgstr "و" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Cancel" +msgstr "إلغاء" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Save & New" +msgstr "حفظ و جديد" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Save & Close" +msgstr "حفظ و إغلاق" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Export" +msgstr "تصدير" + +#: addons/web/static/src/xml/base.xml:0 +msgid "" +"This wizard will export all data that matches the current search criteria to " +"a CSV file.\n" +" You can export all data or only the fields that can be " +"reimported after modification." +msgstr "" +"هذا المعالج سيقوم بتصدير كافة البيانات التي تطابق شروط البحث الحالية لملف " +"CSV.\n" +" يمكنك تصدير كل البيانات أو الحقول التي يمكن إستيرادها بعد " +"التعديل." + +#: addons/web/static/src/xml/base.xml:0 +msgid "Export Type:" +msgstr "نوع التصدير:" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Import Compatible Export" +msgstr "إستيراد بيانات ملائمة للتصدير" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Export all Data" +msgstr "تصدير جميع البيانات" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Export Formats" +msgstr "تنسيقات التصدير" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Available fields" +msgstr "الحقول المتوفرة" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Fields to export" +msgstr "حقول للتصدير" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Save fields list" +msgstr "حفظ قائمة الحقول" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Remove" +msgstr "إزالة" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Remove All" +msgstr "إزالة الكل" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Name" +msgstr "اسم" + +#: addons/web/static/src/xml/base.xml:0 +msgid " " +msgstr " " + +#: addons/web/static/src/xml/base.xml:0 +msgid "Save as:" +msgstr "حفظ باسم:" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Ok" +msgstr "تم" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Saved exports:" +msgstr "مُصدرة محفوظة:" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Old Password:" +msgstr "كلمة المرور القديمة:" + +#: addons/web/static/src/xml/base.xml:0 +msgid "New Password:" +msgstr "كلمة المرور الجديدة:" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Confirm Password:" +msgstr "تأكيد كلمة المرور:" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Import" +msgstr "استيراد" + +#: addons/web/static/src/xml/base.xml:0 +msgid "1. Import a .CSV file" +msgstr "إستيراد ملف .CSV" + +#: addons/web/static/src/xml/base.xml:0 +msgid "" +"Select a .CSV file to import. If you need a sample of file to import,\n" +" you should use the export tool with the \"Import Compatible\" option." +msgstr "" +"اختر ملف .CSV للإستيراد. إذا كنت بحاجة إلى عينة ملف للاستيراد،\n" +" يجب عليك إستخدام أداة تصدير مع الخيار \" Compatible\" option." + +#: addons/web/static/src/xml/base.xml:0 +msgid "CSV File:" +msgstr "ملف CSV :" + +#: addons/web/static/src/xml/base.xml:0 +msgid "2. Check your file format" +msgstr "تأكد من إمتداد الملف" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Import Options" +msgstr "خيارات الاستيراد" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Does your file have titles?" +msgstr "هل لملفك عناوين؟" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Separator:" +msgstr "فاصل :" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Delimiter:" +msgstr "محدد:" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Encoding:" +msgstr "ترميز:" + +#: addons/web/static/src/xml/base.xml:0 +msgid "UTF-8" +msgstr "UTF-8" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Latin 1" +msgstr "Latin 1" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Lines to skip" +msgstr "خطوط للتجاهل" + +#: addons/web/static/src/xml/base.xml:0 +msgid "The import failed due to:" +msgstr "فشلت عملية الإستيراد للأسباب التالية:" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Here is a preview of the file we could not import:" +msgstr "هذه معاينة لملف لم يتمكن من إستيراده:" + +#: addons/web/static/src/xml/base.xml:0 +msgid "OpenERP Web" +msgstr "OpenERP عبر الإنترنت" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Version" +msgstr "الإصدار" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Copyright © 2011-TODAY OpenERP SA. All Rights Reserved." +msgstr "جميع حقوق النشر محفوظة لـ © 2011-TODAY OpenERP SA." + +#: addons/web/static/src/xml/base.xml:0 +msgid "OpenERP is a trademark of the" +msgstr "OpenERP هي علامة تجارية لـ" + +#: addons/web/static/src/xml/base.xml:0 +msgid "OpenERP SA Company" +msgstr "شركة OpenERP SA" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Licenced under the terms of" +msgstr "النظام مرخص بشروط" + +#: addons/web/static/src/xml/base.xml:0 +msgid "GNU Affero General Public License" +msgstr "GNU Affero General Public License" + +#: addons/web/static/src/xml/base.xml:0 +msgid "About OpenERP" +msgstr "عن OpenERP" + +#: addons/web/static/src/xml/base.xml:0 +msgid "OpenERP" +msgstr "OpenERP" + +#: addons/web/static/src/xml/base.xml:0 +msgid "" +"is a free enterprise-scale software system that is designed to boost\n" +" productivity and profit through data integration. It connects, " +"improves and\n" +" manages business processes in areas such as sales, finance, " +"supply chain,\n" +" project management, production, services, CRM, etc..." +msgstr "" +"هو نظام حر يناسب المؤسسات و الشركات و تم تصميمه لتعزيز\n" +" الإنتاجية و الربح من خلال تكامل البيانات. فيمكنك من ربط، و " +"تحسين، و\n" +" إدارة العمليات التجارية في إدارات مثل المبيعات، المحاسبة " +"المالية، المخازن،\n" +" إدارة المشروعات، الإنتاج و العمليات الصناعية، و القطاع الخدمي، , " +"إدارة علاقات العملاء..." + +#: addons/web/static/src/xml/base.xml:0 +msgid "" +"The system is platform-independent, and can be installed on Windows, Mac OS " +"X,\n" +" and various Linux and other Unix-based distributions. Its " +"architecture enables\n" +" new functionality to be rapidly created, modifications to be " +"made to a\n" +" production system and migration to a new version to be " +"straightforward." +msgstr "" +"يعمل البرنامج مع العديد من الأنظمة مثل Windows، و Mac OS X، و\n" +" معظم أنظمة لينكس بالإضافة إلي اليونكس. فلقد تم تصميمه ليتيح " +"إمكانية\n" +" إضافة وظائف أخري له بسهولة، و برمجته و تعديله بسرعه ليلائم " +"الواقع العملي\n" +" كما أنه يتيح سهولة نقل البيانات من إصدار إلي إصدار." + +#: addons/web/static/src/xml/base.xml:0 +msgid "" +"Depending on your needs, OpenERP is available through a web or application " +"client." +msgstr "" +"حسب إحتياجاتك، نظام OpenERP متاح من خلال تطبيق الويب أو البرنامج المحلي." diff --git a/addons/web/po/pl.po b/addons/web/po/pl.po new file mode 100644 index 00000000000..fde2196a73e --- /dev/null +++ b/addons/web/po/pl.po @@ -0,0 +1,687 @@ +# Polish translation for openerp-web +# Copyright (c) 2011 Rosetta Contributors and Canonical Ltd 2011 +# This file is distributed under the same license as the openerp-web package. +# FIRST AUTHOR , 2011. +# +msgid "" +msgstr "" +"Project-Id-Version: openerp-web\n" +"Report-Msgid-Bugs-To: FULL NAME \n" +"POT-Creation-Date: 2011-10-07 10:38+0200\n" +"PO-Revision-Date: 2011-11-04 16:44+0000\n" +"Last-Translator: Grzegorz Grzelak (OpenGLOBE.pl) \n" +"Language-Team: Polish \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Launchpad-Export-Date: 2011-11-05 06:04+0000\n" +"X-Generator: Launchpad (build 14231)\n" + +#: addons/web/static/src/js/view_form.js:355 +msgid "" +"Warning, the record has been modified, your changes will be discarded." +msgstr "Uwaga, rekord został zmodyfikowany, twoje zmiany zostaną odrzucone." + +#: addons/web/static/src/js/view_form.js:1659 +msgid "   Search More..." +msgstr "   Szukaj dalej..." + +#: addons/web/static/src/js/view_form.js:1672 +#, python-format +msgid "   Create \"%s\"" +msgstr "   Utwórz \"%s\"" + +#: addons/web/static/src/js/view_form.js:1678 +msgid "   Create and Edit..." +msgstr "   Utwórz i edytuj..." + +#: addons/web/static/src/js/views.js:568 +msgid "You must choose at least one record." +msgstr "Musisz wybrac co najmniej jeden rekord." + +#: addons/web/static/src/js/views.js:569 +msgid "Warning" +msgstr "Ostrzeżenie" + +#: addons/web/static/src/js/views.js:609 +msgid "Translations" +msgstr "Tłumaczenia" + +#: addons/web/static/src/js/views.js:614 addons/web/static/src/xml/base.xml:0 +msgid "Save" +msgstr "Zapisz" + +#: addons/web/static/src/js/views.js:615 +msgid "Close" +msgstr "Zamknij" + +#: addons/web/static/src/xml/base.xml:0 +msgid "x" +msgstr "" + +#: addons/web/static/src/xml/base.xml:0 +msgid "#{title}" +msgstr "" + +#: addons/web/static/src/xml/base.xml:0 +msgid "#{text}" +msgstr "" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Powered by" +msgstr "" + +#: addons/web/static/src/xml/base.xml:0 +msgid "openerp.com" +msgstr "" + +#: addons/web/static/src/xml/base.xml:0 +msgid "." +msgstr "" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Loading..." +msgstr "Wczytywanie..." + +#: addons/web/static/src/xml/base.xml:0 +msgid "Create" +msgstr "Utwórz" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Drop" +msgstr "Usuń bazę danych" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Backup" +msgstr "Kopia zapasowa bazy danych" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Restore" +msgstr "Odtwórz bazę danych" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Password" +msgstr "Hasło" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Back to Login" +msgstr "Wróć do logowania" + +#: addons/web/static/src/xml/base.xml:0 +msgid "CREATE DATABASE" +msgstr "UTWÓRZ BAZĘ DANYCH" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Master password:" +msgstr "Hasło madrzędne:" + +#: addons/web/static/src/xml/base.xml:0 +msgid "New database name:" +msgstr "Nazwa nowej bazy danych:" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Load Demonstration data:" +msgstr "Wczytaj dane demonstracyjne:" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Default language:" +msgstr "Domyślny język:" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Admin password:" +msgstr "Hasło admina:" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Confirm password:" +msgstr "Potwierdź hasło:" + +#: addons/web/static/src/xml/base.xml:0 +msgid "DROP DATABASE" +msgstr "USUŃ BAZĘ DANYCH" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Database:" +msgstr "Baza danych:" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Master Password:" +msgstr "Hasło nadrzędne:" + +#: addons/web/static/src/xml/base.xml:0 +msgid "BACKUP DATABASE" +msgstr "ZAPISZ BAZĘ" + +#: addons/web/static/src/xml/base.xml:0 +msgid "RESTORE DATABASE" +msgstr "ODTWÓRZ BAZĘ" + +#: addons/web/static/src/xml/base.xml:0 +msgid "File:" +msgstr "Plik:" + +#: addons/web/static/src/xml/base.xml:0 +msgid "CHANGE MASTER PASSWORD" +msgstr "ZMIEŃ HASŁO NADRZĘDNE" + +#: addons/web/static/src/xml/base.xml:0 +msgid "New master password:" +msgstr "Nowe hasło nadrzędne:" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Confirm new master password:" +msgstr "Potwierdź nowe hasło nadrzędne:" + +#: addons/web/static/src/xml/base.xml:0 +msgid "User:" +msgstr "Użytkownik:" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Password:" +msgstr "Hasło:" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Database" +msgstr "Baza danych" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Login" +msgstr "Login" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Bad username or password" +msgstr "Niepoprawna nazwa użytkownika lub hasło" + +#: addons/web/static/src/xml/base.xml:0 +msgid "" +"We think that daily job activities can be more intuitive, efficient, " +"automated, .. and even fun." +msgstr "" +"Sądzimy, że codzienne zadania mogą być bardziej intuicyjne, efektywne, " +"zautomatyzowan, ... a nawet przyjemne." + +#: addons/web/static/src/xml/base.xml:0 +msgid "OpenERP's vision to be:" +msgstr "" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Full featured" +msgstr "" + +#: addons/web/static/src/xml/base.xml:0 +msgid "" +"Today's enterprise challenges are multiple. We provide one module for each " +"need." +msgstr "" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Open Source" +msgstr "" + +#: addons/web/static/src/xml/base.xml:0 +msgid "" +"To Build a great product, we rely on the knowledge of thousands of " +"contributors." +msgstr "" +"Przy budowie wielkiego produktu polegamy na wiedzy tysięcy społeczników." + +#: addons/web/static/src/xml/base.xml:0 +msgid "User Friendly" +msgstr "Przyjazne dla użytkownika" + +#: addons/web/static/src/xml/base.xml:0 +msgid "" +"In order to be productive, people need clean and easy to use interface." +msgstr "" + +#: addons/web/static/src/xml/base.xml:0 +msgid "(" +msgstr "" + +#: addons/web/static/src/xml/base.xml:0 +msgid ")" +msgstr "" + +#: addons/web/static/src/xml/base.xml:0 +msgid "LOGOUT" +msgstr "WYLOGUJ" + +#: addons/web/static/src/xml/base.xml:0 +msgid "«" +msgstr "" + +#: addons/web/static/src/xml/base.xml:0 +msgid "»" +msgstr "" + +#: addons/web/static/src/xml/base.xml:0 +msgid "oe_secondary_menu_item" +msgstr "" + +#: addons/web/static/src/xml/base.xml:0 +msgid "oe_secondary_submenu_item" +msgstr "" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Hide this tip" +msgstr "Ukryj tę wskazówkę" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Disable all tips" +msgstr "Wyłącz wszystkie wskazówki" + +#: addons/web/static/src/xml/base.xml:0 +msgid "View#" +msgstr "" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Fields" +msgstr "Pola" + +#: addons/web/static/src/xml/base.xml:0 +msgid "View labels" +msgstr "Pokaż etykiety" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Sidebar Relates" +msgstr "" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Field" +msgstr "Pole" + +#: addons/web/static/src/xml/base.xml:0 +msgid ":" +msgstr "" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Translate view" +msgstr "Przetłumacz widok" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Translate sidebar" +msgstr "" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Delete" +msgstr "Usuń" + +#: addons/web/static/src/xml/base.xml:0 +msgid "First" +msgstr "Pierwsze" + +#: addons/web/static/src/xml/base.xml:0 +msgid "<" +msgstr "" + +#: addons/web/static/src/xml/base.xml:0 +msgid ">" +msgstr "" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Last" +msgstr "Ostatnie" + +#: addons/web/static/src/xml/base.xml:0 +msgid "♻" +msgstr "" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Save & Edit" +msgstr "Zapisz i edytuj" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Create & Edit" +msgstr "Utwórz i edytuj" + +#: addons/web/static/src/xml/base.xml:0 +msgid "New" +msgstr "Nowy" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Duplicate" +msgstr "Duplikuj" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Readonly/Editable" +msgstr "Tylko odczyt/Edytowalne" + +#: addons/web/static/src/xml/base.xml:0 +msgid "<<" +msgstr "" + +#: addons/web/static/src/xml/base.xml:0 +msgid "0" +msgstr "" + +#: addons/web/static/src/xml/base.xml:0 +msgid "/" +msgstr "" + +#: addons/web/static/src/xml/base.xml:0 +msgid ">>" +msgstr "" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Add" +msgstr "Dodaj" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Unhandled widget" +msgstr "" + +#: addons/web/static/src/xml/base.xml:0 +msgid "?" +msgstr "" + +#: addons/web/static/src/xml/base.xml:0 +msgid "#" +msgstr "" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Done" +msgstr "Wykonano" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Open..." +msgstr "Otwórz..." + +#: addons/web/static/src/xml/base.xml:0 +msgid "Create..." +msgstr "Utwórz..." + +#: addons/web/static/src/xml/base.xml:0 +msgid "Search..." +msgstr "Wyszukaj..." + +#: addons/web/static/src/xml/base.xml:0 +msgid "..." +msgstr "" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Uploading ..." +msgstr "" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Select" +msgstr "Wybierz" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Save As" +msgstr "Zapisz jako" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Clear" +msgstr "Wyczyść" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Advanced Filter" +msgstr "Zaawansowany filtr" + +#: addons/web/static/src/xml/base.xml:0 +msgid "-- Filters --" +msgstr "-- Filtry --" + +#: addons/web/static/src/xml/base.xml:0 +msgid "-- Actions --" +msgstr "-- Akcje --" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Save Filter" +msgstr "Zapisz filtr" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Manage Filters" +msgstr "Zarządzaj filtrami" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Filter Name:" +msgstr "Nazwa filtra:" + +#: addons/web/static/src/xml/base.xml:0 +msgid "(Any existing filter with the same name will be replaced)" +msgstr "(Każdy filtr o tej samej nazwie zostanie zamazany)" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Any of the following conditions must match" +msgstr "Jeden z tych warunków musi być spełniony" + +#: addons/web/static/src/xml/base.xml:0 +msgid "All the following conditions must match" +msgstr "Wszystkie warunki muszą być spełnione" + +#: addons/web/static/src/xml/base.xml:0 +msgid "None of the following conditions must match" +msgstr "Żadeń z tych warunków nie może być spełniony" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Add condition" +msgstr "Dodaj warunek" + +#: addons/web/static/src/xml/base.xml:0 +msgid "and" +msgstr "i" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Cancel" +msgstr "Anuluj" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Save & New" +msgstr "Zapisz i nowy" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Save & Close" +msgstr "Zapisz i zamknij" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Export" +msgstr "Eksportuj" + +#: addons/web/static/src/xml/base.xml:0 +msgid "" +"This wizard will export all data that matches the current search criteria to " +"a CSV file.\n" +" You can export all data or only the fields that can be " +"reimported after modification." +msgstr "" +"Ten kreator wyeksportuje wszystkie dane, które spełniają bieżące kryteria " +"wyszukiwania, do pliku CSV.\n" +" Możesz eksportować wszystkie dane lub tylko pola, które mają być " +"importowane po zmianie." + +#: addons/web/static/src/xml/base.xml:0 +msgid "Export Type:" +msgstr "Typ eksportu:" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Import Compatible Export" +msgstr "Eksport kompatybilny z importem" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Export all Data" +msgstr "Eksportuj wszystkie dane" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Export Formats" +msgstr "Format eksportu" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Available fields" +msgstr "Dostępne pola" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Fields to export" +msgstr "Pola do eksportu" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Save fields list" +msgstr "Zapisz listę pól" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Remove" +msgstr "Usuń" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Remove All" +msgstr "Usuń wszystko" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Name" +msgstr "Nazwa" + +#: addons/web/static/src/xml/base.xml:0 +msgid " " +msgstr "" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Save as:" +msgstr "Zapisz jako:" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Ok" +msgstr "" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Saved exports:" +msgstr "Zapisane eksporty" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Old Password:" +msgstr "Poprzednie hasło:" + +#: addons/web/static/src/xml/base.xml:0 +msgid "New Password:" +msgstr "Nowe hasło:" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Confirm Password:" +msgstr "Potwierdź hasło:" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Import" +msgstr "Importuj" + +#: addons/web/static/src/xml/base.xml:0 +msgid "1. Import a .CSV file" +msgstr "1. Importuj plik .CSV" + +#: addons/web/static/src/xml/base.xml:0 +msgid "" +"Select a .CSV file to import. If you need a sample of file to import,\n" +" you should use the export tool with the \"Import Compatible\" option." +msgstr "" +"Wybierz plik .CSV do importu. Jeśli chcesz zobaczyć przykład pliku do " +"importu,\n" +" powinieneś wyeksportować dane z opcją \"Kompatybilne z importem\"." + +#: addons/web/static/src/xml/base.xml:0 +msgid "CSV File:" +msgstr "Plik CSV:" + +#: addons/web/static/src/xml/base.xml:0 +msgid "2. Check your file format" +msgstr "2. Sprawdź format pliku" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Import Options" +msgstr "Opcje importu" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Does your file have titles?" +msgstr "Czy plik zawiera nazwy pól?" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Separator:" +msgstr "Separator:" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Delimiter:" +msgstr "Znak dziesiętny:" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Encoding:" +msgstr "Kodowanie:" + +#: addons/web/static/src/xml/base.xml:0 +msgid "UTF-8" +msgstr "" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Latin 1" +msgstr "" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Lines to skip" +msgstr "Linie do pominięcia" + +#: addons/web/static/src/xml/base.xml:0 +msgid "The import failed due to:" +msgstr "Import się nie udał z powodu:" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Here is a preview of the file we could not import:" +msgstr "Oto podgląd pliku, którego nie można zaimportować:" + +#: addons/web/static/src/xml/base.xml:0 +msgid "OpenERP Web" +msgstr "" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Version" +msgstr "Wersja" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Copyright © 2011-TODAY OpenERP SA. All Rights Reserved." +msgstr "" + +#: addons/web/static/src/xml/base.xml:0 +msgid "OpenERP is a trademark of the" +msgstr "" + +#: addons/web/static/src/xml/base.xml:0 +msgid "OpenERP SA Company" +msgstr "" + +#: addons/web/static/src/xml/base.xml:0 +msgid "Licenced under the terms of" +msgstr "" + +#: addons/web/static/src/xml/base.xml:0 +msgid "GNU Affero General Public License" +msgstr "" + +#: addons/web/static/src/xml/base.xml:0 +msgid "About OpenERP" +msgstr "" + +#: addons/web/static/src/xml/base.xml:0 +msgid "OpenERP" +msgstr "" + +#: addons/web/static/src/xml/base.xml:0 +msgid "" +"is a free enterprise-scale software system that is designed to boost\n" +" productivity and profit through data integration. It connects, " +"improves and\n" +" manages business processes in areas such as sales, finance, " +"supply chain,\n" +" project management, production, services, CRM, etc..." +msgstr "" + +#: addons/web/static/src/xml/base.xml:0 +msgid "" +"The system is platform-independent, and can be installed on Windows, Mac OS " +"X,\n" +" and various Linux and other Unix-based distributions. Its " +"architecture enables\n" +" new functionality to be rapidly created, modifications to be " +"made to a\n" +" production system and migration to a new version to be " +"straightforward." +msgstr "" + +#: addons/web/static/src/xml/base.xml:0 +msgid "" +"Depending on your needs, OpenERP is available through a web or application " +"client." +msgstr "" diff --git a/addons/web/static/src/js/view_editor.js b/addons/web/static/src/js/view_editor.js index 0224056ee86..ce773972f0c 100644 --- a/addons/web/static/src/js/view_editor.js +++ b/addons/web/static/src/js/view_editor.js @@ -5,7 +5,7 @@ openerp.web.ViewEditor = openerp.web.Widget.extend({ this._super(parent); this.element_id = element_id this.parent = parent - this.dataset = dataset; + this.dataset = new openerp.web.DataSetSearch(this, 'ir.ui.view', null, null); this.model = dataset.model; this.xml_element_id = 0; }, @@ -15,22 +15,22 @@ openerp.web.ViewEditor = openerp.web.Widget.extend({ init_view_editor: function() { var self = this; var action = { - name:'ViewEditor', - context:this.session.user_context, - domain: [["model", "=", this.dataset.model]], - res_model : 'ir.ui.view', - views : [[false, 'list']], + name: _.sprintf("Manage Views (%s)", this.model), + context: this.session.user_context, + domain: [["model", "=", this.model]], + res_model: 'ir.ui.view', + views: [[false, 'list']], type: 'ir.actions.act_window', target: "current", - limit : 80, - auto_search : true, + limit: this.dataset.limit || 80, + auto_search: true, flags: { sidebar: false, deletable: false, views_switcher: false, - action_buttons:false, - search_view:false, - pager:false, + action_buttons: false, + search_view: false, + pager: false, radio: true }, }; @@ -40,23 +40,32 @@ openerp.web.ViewEditor = openerp.web.Widget.extend({ width: 750, height: 500, buttons: { - "Create": function(){ - //to do + "Create": function(){ + //to do + }, + "Edit": function(){ + self.xml_element_id = 0; + self.get_arch(); + }, + "Close": function(){ + self.view_edit_dialog.close(); + } }, - "Edit": function(){ - self.xml_element_id = 0; - self.get_arch(); - }, - "Close": function(){ - $(this).dialog('destroy'); - } - }, }).start().open(); var action_manager = new openerp.web.ActionManager(this); action_manager.appendTo(this.view_edit_dialog); - action_manager.do_action(action); + $.when(action_manager.do_action(action)).then(function() { + var viewmanager = action_manager.inner_viewmanager, + controller = viewmanager.views[viewmanager.active_view].controller; + controller.on_loaded.add_last(function(){ + $(controller.groups).bind({ + 'selected': function(e, ids, records) { + self.main_view_id = ids[0]; + } + }) + }); + }); }, - add_node_name : function(node) { if(node.tagName.toLowerCase() == "button" || node.tagName.toLowerCase() == "field"){ return (node.getAttribute('name'))? @@ -91,8 +100,8 @@ openerp.web.ViewEditor = openerp.web.Widget.extend({ append_child_object: function(main_object, parent_id, child_obj_list) { var self = this; - if(parent_id){ if(main_object.id == parent_id){ + var pare main_object.child_id = child_obj_list; return main_object; }else{ @@ -100,8 +109,6 @@ openerp.web.ViewEditor = openerp.web.Widget.extend({ self.append_child_object(child_object, parent_id, child_obj_list); }); } - } - }, convert_arch_to_obj: function(xml_Node, main_object, parent_id){ @@ -134,31 +141,26 @@ openerp.web.ViewEditor = openerp.web.Widget.extend({ get_arch: function() { var self = this; var view_arch_list = []; - self.main_view_id = - ((this.view_edit_dialog.$element.find("input[name='radiogroup']:checked").parent()).parent()).attr('data-id'); - console.log("i like that",this.view_editor.dataset); - var ve_dataset = new openerp.web.DataSet(this, 'ir.ui.view'); - ve_dataset.read_ids([parseInt(self.main_view_id)], ['arch', 'type'], function (arch) { - var arch_object = self.parse_xml(arch[0].arch,self.main_view_id); + this.dataset.read_ids([parseInt(self.main_view_id)], ['arch', 'type'], function(arch) { + var arch_object = self.parse_xml(arch[0].arch, self.main_view_id); self.main_view_type = arch[0].type - view_arch_list.push({"view_id" : self.main_view_id, "arch" : arch[0].arch}); - dataset = new openerp.web.DataSetSearch(self, 'ir.ui.view', null, null); - dataset.read_slice([], {domain : [['inherit_id','=', parseInt(self.main_view_id)]]}, function (result) { + view_arch_list.push({"view_id": self.main_view_id, "arch": arch[0].arch}); + self.dataset.read_slice([], {domain: [['inherit_id','=', parseInt(self.main_view_id)]]}, function(result) { _.each(result, function(res) { - view_arch_list.push({"view_id":res.id,"arch":res.arch}); - //self.inherit_view(arch_object, res); + view_arch_list.push({"view_id": res.id, "arch": res.arch}); + self.inherit_view(arch_object, res); }); return self.edit_view({"main_object": arch_object, - "parent_child_id": self.parent_child_list(arch_object, []), - "arch": view_arch_list}); + "parent_child_id": self.parent_child_list(arch_object, []), + "arch": view_arch_list}); }); }); }, parent_child_list : function(one_object, parent_list) { var self = this; - _.each(one_object , function(element){ - if(element.child_id.length != 0){ - parent_list.push({"key":element.id,"value":_.pluck(element.child_id, 'id')}); + _.each(one_object , function(element) { + if (element.child_id.length != 0) { + parent_list.push({"key": element.id, "value": _.pluck(element.child_id, 'id')}); self.parent_child_list(element.child_id, parent_list); } }); @@ -167,41 +169,44 @@ openerp.web.ViewEditor = openerp.web.Widget.extend({ inherit_view : function(arch_object, result) { var self = this; - var root = $(result.arch).filter('*'); var xml_list = []; - (root[0].tagName.toLowerCase() == "data")?xml_list = $(root[0]).children() : xml_list.push(root[0]); - _.each(xml_list , function(xml){ + var xml_arch = QWeb.load_xml(result.arch); + (xml_arch.childNodes[0].tagName == "data") + ? xml_list = xml_arch.childNodes[0].children + : xml_list.push(xml_arch.childNodes[0]); + _.each(xml_list, function(xml) { var expr_to_list = []; - var xpath_arch_object = self.parse_xml(xml,result.id); - if (xml.tagName.toLowerCase() == "xpath" ) { - var part_expr = _.without($(xml).attr('expr').split("/"),""); - _.each(part_expr,function(part){ - expr_to_list.push(_.without($.trim(part.replace(/[^a-zA-Z 0-9 _]+/g,'!')).split("!"),"")); + var xpath_arch_object = self.parse_xml(QWeb.tools.xml_node_to_string(xml), result.id); + if(xml.tagName == "xpath"){ + var part_expr = _.without(xml.getAttribute('expr').split("/"), ""); + _.each(part_expr, function(part) { + expr_to_list.push(_.without($.trim(part.replace(/[^a-zA-Z 0-9 _]+/g,'!')).split("!"), "")); }); - } else { - var temp = _.reject(xpath_arch_object[0].child_id[0].att_list, function(list) - { return _.include(list, "position")}); - expr_to_list = [_.flatten(temp)]; + }else{ + var temp = _.reject(xpath_arch_object[0].child_id[0].att_list, function(list) { + return _.include(list, "position") + }); + expr_to_list = [_.flatten(temp)]; } - self.inherit_apply(expr_to_list ,arch_object ,xpath_arch_object); + self.inherit_apply(expr_to_list, arch_object ,xpath_arch_object); }); }, inherit_apply: function(expr_list ,arch_object ,xpath_arch_object) { var self = this; - if(xpath_arch_object.length!=0){ + if (xpath_arch_object.length) { var check = expr_list[0]; var obj; switch (check.length) { case 2: - if(parseInt(check[1])){ + if (parseInt(check[1])) { //for field[3] - var temp_list = _.select(arch_object,function(element){ + var temp_list = _.select(arch_object, function(element) { return _.include(_.flatten(element.att_list), check[0]); }); - obj = arch_object[_.indexOf(arch_object,temp_list[parseInt(check[1])-1])]; + obj = arch_object[_.indexOf(arch_object, temp_list[parseInt(check[1]) - 1])]; } else { //for notebook[last()] - obj = _.detect(arch_object, function(element){ + obj = _.detect(arch_object, function(element) { return _.include(_.flatten(element.att_list), check[0]); }); } @@ -209,34 +214,34 @@ openerp.web.ViewEditor = openerp.web.Widget.extend({ case 3: //for field[@name='type'] obj = _.detect(arch_object, function(element){ - if((_.intersection(_.flatten(element.att_list),_.uniq(check))).length == check.length){ + if ((_.intersection(_.flatten(element.att_list), _.uniq(check))).length == check.length) { return element; } }); break; case 1: //for /form/notebook - var temp_list = _.select(arch_object, function(element){ + var temp_list = _.select(arch_object, function(element) { return _.include(_.flatten(element.att_list), check[0]); }); - if(temp_list.length != 0){ - (expr_list.length == 1)? obj = temp_list[0] : expr_list.shift(); + if (temp_list.length != 0) { + expr_list.length == 1 ? obj = temp_list[0] : expr_list.shift(); } break; } - if(obj) { + if (obj) { expr_list.shift(); - if (expr_list.length !=0){ - self.inherit_apply(expr_list ,obj.child_id ,xpath_arch_object); + if (expr_list.length) { + self.inherit_apply(expr_list, obj.child_id, xpath_arch_object); } else { - self.increase_level(xpath_arch_object[0], obj.level+1); + self.increase_level(xpath_arch_object[0], obj.level + 1); obj.child_id.push(xpath_arch_object[0]); xpath_arch_object.pop(); } } else { - _.each(arch_object,function(element){ - self.inherit_apply(expr_list ,element.child_id ,xpath_arch_object); + _.each(arch_object, function(element) { + self.inherit_apply(expr_list, element.child_id, xpath_arch_object); }); } } @@ -250,28 +255,28 @@ openerp.web.ViewEditor = openerp.web.Widget.extend({ }, edit_view: function(one_object) { var self = this; - this.edit_xml_dialog = new openerp.web.Dialog(this,{ + this.edit_xml_dialog = new openerp.web.Dialog(this, { modal: true, - title: 'View Editor', + title: _.sprintf("View Editor %d - %s", self.main_view_id, self.model), width: 750, height: 500, buttons: { - "Inherited View": function(){ + "Inherited View": function() { //todo }, - "Preview": function(){ + "Preview": function() { var action = { - context:self.session.user_context, - res_model : self.model, - views : [[self.main_view_id, self.main_view_type]], + context: self.session.user_context, + res_model: self.model, + views: [[self.main_view_id, self.main_view_type]], type: 'ir.actions.act_window', target: "new", flags: { sidebar: false, views_switcher: false, - action_buttons:false, - search_view:false, - pager:false, + action_buttons: false, + search_view: false, + pager: false, }, }; var action_manager = new openerp.web.ActionManager(self); @@ -281,12 +286,8 @@ openerp.web.ViewEditor = openerp.web.Widget.extend({ self.edit_xml_dialog.close(); } } - }); - console.log("finallly",one_object['main_object']); - this.edit_xml_dialog.start().open(); - this.edit_xml_dialog.$element.html(QWeb.render('view_editor', { - 'data': one_object['main_object'], - })); + }).start().open(); + this.edit_xml_dialog.$element.html(QWeb.render('view_editor', {'data': one_object['main_object']})); this.edit_xml_dialog.$element.find("tr[id^='viewedit-']").click(function() { self.edit_xml_dialog.$element.find("tr[id^='viewedit-']").removeClass('ui-selected'); $(this).addClass('ui-selected'); @@ -302,23 +303,23 @@ openerp.web.ViewEditor = openerp.web.Widget.extend({ } }); this.edit_xml_dialog.$element.find("img[id^='side-']").click(function() { - var side = $(this).closest("tr[id^='viewedit-']") + var side = $(this).closest("tr[id^='viewedit-']"); var clicked_tr_id = (side.attr('id')).split('-')[1]; - var img = side.find("img[id='parentimg-"+clicked_tr_id+"']").attr('src'); ; + var img = side.find("img[id='parentimg-" + clicked_tr_id + "']").attr('src'); var clicked_tr_level = parseInt(side.attr('level')); var cur_tr = side; var last_tr; var next_tr; - var tr_to_move =[]; + var tr_to_move = []; tr_to_move.push(side); var view_id; var view_xml_id; var view_find = side; - while(1){ + while (1) { view_find = view_find.prev(); - if((self.edit_xml_dialog.$element.find(view_find).find('a').text()).search("view_id") != -1 - && parseInt(view_find.attr('level')) < clicked_tr_level){ - view_id = parseInt(($(view_find).find('a').text()).replace(/[^0-9]+/g,'')); + if((self.edit_xml_dialog.$element.find(view_find).find('a').text()).search("view_id") != -1 + && parseInt(view_find.attr('level')) < clicked_tr_level) { + view_id = parseInt(($(view_find).find('a').text()).replace(/[^0-9]+/g, '')); view_xml_id = (view_find.attr('id')).split('-')[1]; break; } @@ -333,7 +334,7 @@ openerp.web.ViewEditor = openerp.web.Widget.extend({ case "side-up": while (1) { var prev_tr = cur_tr.prev(); - if(clicked_tr_level >= parseInt(prev_tr.attr('level')) || prev_tr.length == 0) { + if (clicked_tr_level >= parseInt(prev_tr.attr('level')) || prev_tr.length == 0) { last_tr = prev_tr; break; } @@ -341,10 +342,10 @@ openerp.web.ViewEditor = openerp.web.Widget.extend({ } if (img) { self.edit_xml_dialog.$element.find("img[id='parentimg-" + clicked_tr_id + "']"). - attr('src', '/web/static/src/img/expand.gif'); + attr('src', '/web/static/src/img/expand.gif'); while (1) { next_tr = side.next(); - if ( parseInt(next_tr.attr('level')) <= clicked_tr_level || next_tr.length == 0) { + if (parseInt(next_tr.attr('level')) <= clicked_tr_level || next_tr.length == 0) { break; } else { next_tr.hide(); @@ -353,8 +354,8 @@ openerp.web.ViewEditor = openerp.web.Widget.extend({ } } } - if (last_tr.length != 0 && parseInt(last_tr.attr('level')) == clicked_tr_level && - (self.edit_xml_dialog.$element.find(last_tr).find('a').text()).search("view_id") == -1) { + if (last_tr.length != 0 && parseInt(last_tr.attr('level')) == clicked_tr_level && + (self.edit_xml_dialog.$element.find(last_tr).find('a').text()).search("view_id") == -1) { _.each(tr_to_move, function(rec) { $(last_tr).before(rec); }); @@ -377,7 +378,7 @@ openerp.web.ViewEditor = openerp.web.Widget.extend({ else { last_tr = cur_tr.next(); } - if((self.edit_xml_dialog.$element.find(last_tr).find('a').text()).search("view_id") != -1){ + if ((self.edit_xml_dialog.$element.find(last_tr).find('a').text()).search("view_id") != -1) { return; } if (last_tr.length != 0 && parseInt(last_tr.attr('level')) == clicked_tr_level) { @@ -403,32 +404,32 @@ openerp.web.ViewEditor = openerp.web.Widget.extend({ } }); }, - save_move_arch: function(one_object, view_id, view_xml_id, clicked_tr_id, level, move_direct){ + save_move_arch: function(one_object, view_id, view_xml_id, clicked_tr_id, level, move_direct) { var self = this; - var arch = _.detect(one_object['arch'],function(element){return element.view_id == view_id;}); + var arch = _.detect(one_object['arch'], function(element) {return element.view_id == view_id;}); var obj = self.get_object_by_id(view_xml_id, one_object['main_object'], []); //for finding xpath tag from inherit view - if(($(arch.arch).filter("data")).length != 0 && view_xml_id != 0){ + if (($(arch.arch).filter("data")).length != 0 && view_xml_id != 0) { var check_list = _.flatten(obj[0].child_id[0].att_list); arch.arch = _.detect($(arch.arch).children(), function(xml_child){ var temp_obj = self.convert_tag_to_obj(xml_child); var main_list = _.flatten(temp_obj.att_list); var insert = _.intersection(main_list,_.uniq(check_list)); - if(insert.length == check_list.length ){return xml_child;} + if (insert.length == check_list.length ) {return xml_child;} }); } return self.save_arch(arch.arch, obj[0].child_id[0], parseInt(clicked_tr_id), [], parseInt(level), parseInt(view_id), arch, move_direct); }, - get_object_by_id: function(view_xml_id, one_object,result){ + get_object_by_id: function(view_xml_id, one_object, result) { var self = this; - if(result.length==0){ - var check = _.detect(one_object , function(obj){ - return view_xml_id==obj.id; + if (result.length == 0 ) { + var check = _.detect(one_object , function(obj) { + return view_xml_id == obj.id; }); - if(check){result.push(check);}; - _.each(one_object, function(obj){ + if (check) {result.push(check);}; + _.each(one_object, function(obj) { self.get_object_by_id(view_xml_id, obj.child_id, result); }); } @@ -442,7 +443,7 @@ openerp.web.ViewEditor = openerp.web.Widget.extend({ if (obj.id == id) { var id; var parent = $(arch1).parents(); - var index = _.indexOf(child_list, obj) + var index = _.indexOf(child_list, obj); var re_insert_obj = child_list.splice(index, 1); if (move_direct == "down") { var next = $(arch1).next(); @@ -453,17 +454,15 @@ openerp.web.ViewEditor = openerp.web.Widget.extend({ $(prev).before(arch1); child_list.splice(index-1, 0, re_insert_obj[0]); } - parent = parent[parent.length-1]; - var convert_to_utf = QWeb.tools.xml_node_to_string(parent); + var convert_to_utf = QWeb.tools.xml_node_to_string(parent[parent.length-1]); convert_to_utf = convert_to_utf.replace('xmlns="http://www.w3.org/1999/xhtml"', ""); convert_to_utf = '' + convert_to_utf; arch.arch = convert_to_utf; - dataset = new openerp.web.DataSet(this, 'ir.ui.view'); - dataset.write(parseInt(view_id),{"arch":convert_to_utf}, function(r) { + this.dataset.write(parseInt(view_id),{"arch":convert_to_utf}, function(r) { }); } - if(obj.level <= level){ - _.each(list_obj_xml, function(child_node){ + if (obj.level <= level) { + _.each(list_obj_xml, function(child_node) { self.save_arch(child_node[0], child_node[1], id, obj.child_id, level, view_id, arch, move_direct); }); } @@ -474,7 +473,7 @@ openerp.web.ViewEditor = openerp.web.Widget.extend({ var cur_tr = $(expand_img).closest("tr[id^='viewedit-']"); while (1) { var nxt_tr = cur_tr.next(); - if (parseInt(nxt_tr.attr('level')) > level){ + if (parseInt(nxt_tr.attr('level')) > level) { cur_tr = nxt_tr; nxt_tr.hide(); } else return nxt_tr; @@ -483,12 +482,12 @@ openerp.web.ViewEditor = openerp.web.Widget.extend({ on_collapse: function(collapse_img, parent_child_id, id, main_object) { var self = this; var id = collapse_img.id.split('-')[1]; - var datas = _.detect(parent_child_id,function(res) { + var datas = _.detect(parent_child_id, function(res) { return res.key == id; }); - _.each(datas.value, function(rec) { - var tr = self.edit_xml_dialog.$element.find("tr[id='viewedit-"+rec+"']"); - tr.find("img[id='parentimg-"+rec+"']").attr('src','/web/static/src/img/expand.gif'); + _.each(datas.value, function (rec) { + var tr = self.edit_xml_dialog.$element.find("tr[id='viewedit-" + rec + "']"); + tr.find("img[id='parentimg-" + rec + "']").attr('src', '/web/static/src/img/expand.gif'); tr.show(); }); } diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 237199d5472..603e2abb008 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -10,6 +10,7 @@ openerp.web.FormView = openerp.web.View.extend( /** @lends openerp.web.FormView# * view should be displayed (if there is one active). */ searchable: false, + readonly : false, form_template: "FormView", identifier_prefix: 'formview-', /** @@ -37,7 +38,7 @@ openerp.web.FormView = openerp.web.View.extend( /** @lends openerp.web.FormView# this.dirty_for_user = false; this.default_focus_field = null; this.default_focus_button = null; - this.registry = openerp.web.form.widgets; + this.registry = this.readonly ? openerp.web.form.readonly : openerp.web.form.widgets; this.has_been_loaded = $.Deferred(); this.$form_header = null; this.translatable_fields = []; @@ -101,10 +102,10 @@ openerp.web.FormView = openerp.web.View.extend( /** @lends openerp.web.FormView# self.on_pager_action(action); }); - this.$form_header.find('button.oe_form_button_save').click(this.do_save); - this.$form_header.find('button.oe_form_button_cancel').click(this.do_cancel); + this.$form_header.find('button.oe_form_button_save').click(this.do_save_then_readonly); this.$form_header.find('button.oe_form_button_new').click(this.on_button_new); this.$form_header.find('button.oe_form_button_duplicate').click(this.on_button_duplicate); + this.$form_header.find('button.oe_form_button_delete').click(this.on_button_delete); this.$form_header.find('button.oe_form_button_toggle').click(this.on_toggle_readonly); if (this.options.sidebar && this.options.sidebar_id) { @@ -123,11 +124,16 @@ openerp.web.FormView = openerp.web.View.extend( /** @lends openerp.web.FormView# self.widgets = {}; self.fields = {}; self.$form_header.find('button').unbind('click'); - self.registry = self.registry === openerp.web.form.widgets - ? openerp.web.form.readonly - : openerp.web.form.widgets; + self.readonly = !self.readonly; + self.registry = self.readonly ? openerp.web.form.readonly : openerp.web.form.widgets; self.on_loaded(self.fields_view); - self.reload(); + return self.reload(); + }, + do_set_readonly: function() { + return this.readonly ? $.Deferred().resolve() : this.on_toggle_readonly(); + }, + do_set_editable: function() { + return !this.readonly ? $.Deferred().resolve() : this.on_toggle_readonly(); }, do_show: function () { var promise; @@ -164,6 +170,8 @@ openerp.web.FormView = openerp.web.View.extend( /** @lends openerp.web.FormView# this.$form_header.find('.oe_form_on_update').show(); this.$form_header.find('button.oe_form_button_new').show(); } + this.$form_header.find('.oe_form_on_readonly').toggle(this.readonly); + this.$form_header.find('.oe_form_on_editable').toggle(!this.readonly); this.dirty_for_user = false; this.datarecord = record; for (var f in this.fields) { @@ -344,14 +352,16 @@ openerp.web.FormView = openerp.web.View.extend( /** @lends openerp.web.FormView# $.when(this.has_been_loaded).then(function() { if (self.can_be_discarded()) { var keys = _.keys(self.fields_view.fields); - if (keys.length) { - self.dataset.default_get(keys).then(self.on_record_loaded).then(function() { + $.when(self.do_set_editable()).then(function() { + if (keys.length) { + self.dataset.default_get(keys).then(self.on_record_loaded).then(function() { + def.resolve(); + }); + } else { + self.on_record_loaded({}); def.resolve(); - }); - } else { - self.on_record_loaded({}); - def.resolve(); - } + } + }); } }); return def.promise(); @@ -363,7 +373,20 @@ openerp.web.FormView = openerp.web.View.extend( /** @lends openerp.web.FormView# if (self.can_be_discarded()) { self.dataset.call('copy', [self.datarecord.id, {}, self.dataset.context]).then(function(new_id) { return self.on_created({ result : new_id }); - }).then(function() { + }).then(self.do_set_editable).then(function() { + def.resolve(); + }); + } + }); + return def.promise(); + }, + on_button_delete: function() { + var self = this; + var def = $.Deferred(); + $.when(this.has_been_loaded).then(function() { + if (self.can_be_discarded() && self.datarecord.id) { + self.dataset.unlink([self.datarecord.id]).then(function() { + self.on_pager_action('next'); def.resolve(); }); } @@ -381,6 +404,9 @@ openerp.web.FormView = openerp.web.View.extend( /** @lends openerp.web.FormView# * @param {Function} success callback on save success * @param {Boolean} [prepend_on_create=false] if ``do_save`` creates a new record, should that record be inserted at the start of the dataset (by default, records are added at the end) */ + do_save_then_readonly: function(success, prepend_on_create) { + return this.do_save(success, prepend_on_create).then(this.do_set_readonly); + }, do_save: function(success, prepend_on_create) { var self = this; var action = function() { @@ -428,10 +454,6 @@ openerp.web.FormView = openerp.web.View.extend( /** @lends openerp.web.FormView# this.mutating_lock = this.mutating_lock.pipe(action, action); return this.mutating_lock; }, - switch_readonly: function() { - }, - switch_editable: function() { - }, on_invalid: function() { var msg = "