[MERGE]: merge with lp:~openerp-dev/openobject-addons/trunk-dev-addons2

bzr revid: atp@tinyerp.co.in-20100630143450-och6sexjey298n73
This commit is contained in:
atp (Open ERP)
2010-06-30 20:04:50 +05:30
6 changed files with 190 additions and 81 deletions
+16 -2
View File
@@ -20,12 +20,12 @@
#
##############################################################################
from crm import crm
from osv import osv, fields
from tools.translate import _
import base64
import time
import tools
from crm import crm
class crm_send_new_email(osv.osv_memory):
""" Sends new email for the case"""
@@ -109,7 +109,17 @@ class crm_send_new_email(osv.osv_memory):
body = case_pool.format_body(body)
email_from = getattr(obj, 'email_from', False)
x_headers = {}
case_pool._history(cr, uid, [case], _('Send'), history=True, \
email=obj.email_to, details=body, \
subject=obj.subject, email_from=email_from, \
message_id=message_id, attach=attach)
x_headers = {
'model': model,
'resource-id': res_id
}
if message_id:
x_headers['References'] = "%s" % (message_id)
@@ -174,7 +184,11 @@ class crm_send_new_email(osv.osv_memory):
if 'email_from' in fields:
res.update({'email_from': user_mail_from})
if 'subject' in fields:
<<<<<<< TREE
res.update({'subject': str(context.get('subject', case.name) or '')})
=======
res.update({'subject': '[%s] %s' % (str(case.id), context.get('subject', case.name) or '')})
>>>>>>> MERGE-SOURCE
if 'email_cc' in fields:
res.update({'email_cc': case.email_cc or ''})
if 'text' in fields:
+48 -47
View File
@@ -7,13 +7,13 @@ msgstr ""
"Project-Id-Version: OpenERP Server 5.0.4\n"
"Report-Msgid-Bugs-To: support@openerp.com\n"
"POT-Creation-Date: 2009-08-28 16:01+0000\n"
"PO-Revision-Date: 2010-06-22 14:24+0000\n"
"Last-Translator: Чистый <klaider@yandex.ru>\n"
"PO-Revision-Date: 2010-04-13 05:32+0000\n"
"Last-Translator: grisha <Unknown>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2010-06-23 03:53+0000\n"
"X-Launchpad-Export-Date: 2010-06-22 04:18+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: document
@@ -36,6 +36,8 @@ msgstr ""
msgid ""
"The Object name must start with x_ and not contain any special character !"
msgstr ""
"Название объекта должно начинаться с x_ и не должно содержать специальных "
"символов !"
#. module: document
#: field:ir.actions.report.xml,model_id:0
@@ -45,17 +47,17 @@ msgstr ""
#. module: document
#: constraint:document.directory:0
msgid "Error! You can not create recursive Directories."
msgstr "Ошибка! Вы не можете созадавать вложенные Директории."
msgstr "Ошибка! Вы не можете созадавать вложенные друг в друга директории."
#. module: document
#: model:ir.ui.menu,name:document.menu_document_configuration
msgid "Document Configuration"
msgstr "Настройки документа"
msgstr ""
#. module: document
#: view:ir.attachment:0
msgid "Preview"
msgstr "Предварительный просмотр"
msgstr "Предпросмотр"
#. module: document
#: field:ir.attachment,store_method:0
@@ -82,7 +84,7 @@ msgstr ""
#. module: document
#: selection:document.directory,type:0
msgid "Other Resources"
msgstr "Другие ресурсы"
msgstr ""
#. module: document
#: field:document.directory,ressource_parent_type_id:0
@@ -102,7 +104,7 @@ msgstr ""
#. module: document
#: constraint:ir.actions.act_window:0
msgid "Invalid model name in the action definition."
msgstr "Недопустимое имя модели в определении действия."
msgstr ""
#. module: document
#: selection:document.directory,type:0
@@ -130,13 +132,13 @@ msgstr ""
#. module: document
#: field:document.directory,type:0
msgid "Type"
msgstr "Тип"
msgstr ""
#. module: document
#: model:ir.actions.act_window,name:document.action_document_directory_tree
#: model:ir.ui.menu,name:document.menu_document_directories_tree
msgid "Directorie's Structure"
msgstr "Структура папок"
msgstr ""
#. module: document
#: field:document.directory,parent_id:0
@@ -146,13 +148,13 @@ msgstr ""
#. module: document
#: view:ir.attachment:0
msgid "File Information"
msgstr "Информация о файле"
msgstr ""
#. module: document
#: field:document.directory,file_ids:0
#: view:ir.attachment:0
msgid "Files"
msgstr "Файлы"
msgstr ""
#. module: document
#: field:ir.attachment,store_fname:0
@@ -163,17 +165,17 @@ msgstr ""
#: field:document.directory,write_uid:0
#: field:ir.attachment,write_uid:0
msgid "Last Modification User"
msgstr "Последние изменения пользователя"
msgstr ""
#. module: document
#: view:document.configuration.wizard:0
msgid "Configure"
msgstr "Настройка"
msgstr ""
#. module: document
#: field:document.directory,ressource_tree:0
msgid "Tree Structure"
msgstr "Древовидная структура"
msgstr ""
#. module: document
#: field:ir.attachment,title:0
@@ -190,7 +192,7 @@ msgstr ""
#. module: document
#: model:ir.model,name:document.model_document_directory_content
msgid "Directory Content"
msgstr "Содержимое папки"
msgstr ""
#. module: document
#: help:document.directory,ressource_parent_type_id:0
@@ -202,28 +204,28 @@ msgstr ""
#. module: document
#: model:ir.ui.menu,name:document.menu_document
msgid "Document Management"
msgstr "Управление документами"
msgstr ""
#. module: document
#: selection:ir.attachment,store_method:0
msgid "Link"
msgstr "Ссылка"
msgstr ""
#. module: document
#: view:document.directory:0
msgid "Directory Type"
msgstr "Тип папки"
msgstr ""
#. module: document
#: field:document.directory,group_ids:0
#: field:ir.attachment,group_ids:0
msgid "Groups"
msgstr "Группы"
msgstr ""
#. module: document
#: field:document.directory.content,report_id:0
msgid "Report"
msgstr "Отчёт"
msgstr ""
#. module: document
#: help:document.configuration.wizard,host:0
@@ -231,7 +233,6 @@ msgid ""
"Put here the server address or IP. Keep localhost if you don't know what to "
"write."
msgstr ""
"Укажите адрес сервера или IP. Укажите localhost если не знаете что писать."
#. module: document
#: view:document.configuration.wizard:0
@@ -259,12 +260,12 @@ msgstr ""
#. module: document
#: view:document.directory:0
msgid "Definition"
msgstr "Описание"
msgstr ""
#. module: document
#: constraint:ir.ui.view:0
msgid "Invalid XML for View Architecture!"
msgstr "Неправильный XML для просмотра структуры!"
msgstr "Неправильный XML для просмотра архитектуры!"
#. module: document
#: model:ir.module.module,description:document.module_meta_information
@@ -278,17 +279,17 @@ msgstr ""
#. module: document
#: field:document.directory,name:0
msgid "Name"
msgstr "Имя"
msgstr ""
#. module: document
#: field:document.directory.content.type,code:0
msgid "Extension"
msgstr "Расширение"
msgstr ""
#. module: document
#: selection:ir.attachment,store_method:0
msgid "Database"
msgstr "База данных"
msgstr ""
#. module: document
#: field:document.directory,content_ids:0
@@ -331,30 +332,30 @@ msgstr ""
#. module: document
#: view:ir.attachment:0
msgid "Attached To"
msgstr "Вложено в"
msgstr ""
#. module: document
#: selection:ir.attachment,store_method:0
msgid "Filesystem"
msgstr "Файловая система"
msgstr ""
#. module: document
#: field:document.directory,file_type:0
#: field:document.directory.content.type,name:0
#: field:ir.attachment,file_type:0
msgid "Content Type"
msgstr "Тип данных"
msgstr ""
#. module: document
#: view:document.directory:0
#: view:ir.attachment:0
msgid "Security"
msgstr "Безопасность"
msgstr ""
#. module: document
#: model:ir.ui.menu,name:document.menu_document_browse
msgid "Browse Files Using FTP"
msgstr "Просмотр файлов используя FTP"
msgstr ""
#. module: document
#: field:document.directory,ressource_type_id:0
@@ -364,7 +365,7 @@ msgstr ""
#. module: document
#: view:ir.attachment:0
msgid "History"
msgstr "История"
msgstr ""
#. module: document
#: help:document.directory,ressource_type_id:0
@@ -376,33 +377,33 @@ msgstr ""
#. module: document
#: view:ir.attachment:0
msgid "Others Info"
msgstr "Дополнительная информация"
msgstr ""
#. module: document
#: field:document.directory,domain:0
msgid "Domain"
msgstr "Домен"
msgstr ""
#. module: document
#: field:document.directory,write_date:0
#: field:ir.attachment,write_date:0
msgid "Date Modified"
msgstr "Дата изменения"
msgstr ""
#. module: document
#: field:document.directory.content,suffix:0
msgid "Suffix"
msgstr "Суффикс"
msgstr ""
#. module: document
#: field:document.configuration.wizard,host:0
msgid "Server Address"
msgstr "Адрес сервера"
msgstr ""
#. module: document
#: model:ir.actions.url,name:document.action_document_browse
msgid "Browse Files"
msgstr "Обзор файлов"
msgstr ""
#. module: document
#: field:document.directory.content,name:0
@@ -418,7 +419,7 @@ msgstr ""
#. module: document
#: field:document.directory,create_uid:0
msgid "Creator"
msgstr "Автор"
msgstr ""
#. module: document
#: view:document.directory:0
@@ -428,22 +429,22 @@ msgstr ""
#. module: document
#: field:document.directory.content,sequence:0
msgid "Sequence"
msgstr "Сортировать"
msgstr ""
#. module: document
#: model:ir.ui.menu,name:document.menu_document_files
msgid "Search a File"
msgstr "Поиск файла"
msgstr ""
#. module: document
#: view:document.configuration.wizard:0
msgid "Auto Configure"
msgstr "Авто настройка"
msgstr ""
#. module: document
#: view:document.configuration.wizard:0
msgid "Cancel"
msgstr "Отмена"
msgstr ""
#. module: document
#: field:ir.attachment,partner_id:0
@@ -453,12 +454,12 @@ msgstr ""
#. module: document
#: view:document.directory:0
msgid "PDF Report"
msgstr "PDF Отчёт"
msgstr ""
#. module: document
#: field:document.directory.content,extension:0
msgid "Document Type"
msgstr "Тип документа"
msgstr ""
#. module: document
#: field:document.directory,child_ids:0
@@ -468,4 +469,4 @@ msgstr ""
#. module: document
#: view:document.directory:0
msgid "Contents"
msgstr "Содержание"
msgstr ""
+96 -26
View File
@@ -18,38 +18,108 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>
#
##############################################################################
import base64
from osv import osv, fields
from osv.orm import except_orm
from tools import config
import urlparse
from document_ftp import ftpserver
import os
class document_configuration(osv.osv_memory):
class document_ftp_configuration(osv.osv_memory):
_name='document.ftp.configuration'
_name='document.configuration'
_description = 'Auto Directory Configuration'
_inherit = 'res.config'
_rec_name = 'host'
_columns = {
'host': fields.char('Address', size=64,
help="Server address or IP and port to which users should connect to for DMS access",
required=True),
}
_inherit = 'res.config'
_defaults = {
'host': config.get('ftp_server_host', 'localhost') + ':' + config.get('ftp_server_port', '8021'),
_columns = {
'sale_order' : fields.boolean('Sale Order', help="Auto directory configuration for Sale Orders and Quotation with report."),
'product' : fields.boolean('Product', help="Auto directory configuration for Products."),
'project': fields.boolean('Project', help="Auto directory configuration for Projects."),
}
def execute(self, cr, uid, ids, context=None):
conf = self.browse(cr, uid, ids[0], context)
conf_id = ids and ids[0] or False
conf = self.browse(cr, uid, conf_id, context)
dir_pool = self.pool.get('document.directory')
data_pool = self.pool.get('ir.model.data')
# Update the action for FTP browse.
aid = data_pool._get_id(cr, uid, 'document_ftp', 'action_document_browse')
aid = data_pool.browse(cr, uid, aid, context=context).res_id
self.pool.get('ir.actions.url').write(cr, uid, [aid], {'url': 'ftp://'+(conf.host or 'localhost:8021')+'/'})
document_ftp_configuration()
data_pool = self.pool.get('ir.model.data')
model_pool = self.pool.get('ir.model')
content_pool = self.pool.get('document.directory.content')
if conf.sale_order and self.pool.get('sale.order'):
# Sale order
dir_data_id = data_pool._get_id(cr, uid, 'document', 'dir_sale_order_all')
if dir_data_id:
sale_dir_id = data_pool.browse(cr, uid, dir_data_id, context=context).res_id
else:
sale_dir_id = data_pool.create(cr, uid, {'name': 'Sale Orders'})
mid = model_pool.search(cr, uid, [('model','=','sale.order')])
dir_pool.write(cr, uid, [sale_dir_id], {
'type':'ressource',
'ressource_type_id': mid[0],
'domain': '[]',
})
# Qutation
dir_data_id = data_pool._get_id(cr, uid, 'document', 'dir_sale_order_quote')
if dir_data_id:
quta_dir_id = data_pool.browse(cr, uid, dir_data_id, context=context).res_id
else:
quta_dir_id = data_pool.create(cr, uid, {'name': 'Sale Quotations'})
dir_pool.write(cr, uid, [quta_dir_id], {
'type':'ressource',
'ressource_type_id': mid[0],
'domain': "[('state','=','draft')]",
})
# Sale Order Report
order_report_data_id = data_pool._get_id(cr, uid, 'sale', 'report_sale_order')
if order_report_data_id:
order_report_id = data_pool.browse(cr, uid, order_report_data_id, context=context).res_id
content_pool.create(cr, uid, {
'name': "Print Order",
'suffix': "_print",
'report_id': order_report_id,
'extension': '.pdf',
'include_name': 1,
'directory_id': sale_dir_id,
})
content_pool.create(cr, uid, {
'name': "Print Qutation",
'suffix': "_print",
'report_id': order_report_id,
'extension': '.pdf',
'include_name': 1,
'directory_id': quta_dir_id,
})
if conf.product and self.pool.get('product.product'):
# Product
dir_data_id = data_pool._get_id(cr, uid, 'document', 'dir_product')
if dir_data_id:
product_dir_id = data_pool.browse(cr, uid, dir_data_id, context=context).res_id
else:
product_dir_id = data_pool.create(cr, uid, {'name': 'Products'})
mid = model_pool.search(cr, uid, [('model','=','product.product')])
dir_pool.write(cr, uid, [product_dir_id], {
'type':'ressource',
'ressource_type_id': mid[0],
})
if conf.project and self.pool.get('account.analytic.account'):
# Project
dir_data_id = data_pool._get_id(cr, uid, 'document', 'dir_project')
if dir_data_id:
project_dir_id = data_pool.browse(cr, uid, dir_data_id, context=context).res_id
else:
project_dir_id = data_pool.create(cr, uid, {'name': 'Projects'})
mid = model_pool.search(cr, uid, [('model','=','account.analytic.account')])
dir_pool.write(cr, uid, [project_dir_id], {
'type':'ressource',
'ressource_type_id': mid[0],
'domain': '[]',
'ressource_tree': 1
})
document_configuration()
+3
View File
@@ -33,6 +33,7 @@ class idea_category(osv.osv):
_name = "idea.category"
_description = "Idea Category"
_log_create=True
_columns = {
'name': fields.char('Category', size=64, required=True),
@@ -52,6 +53,7 @@ class idea_idea(osv.osv):
""" Idea """
_name = 'idea.idea'
_rec_name = 'title'
_log_create=True
def _vote_avg_compute(self, cr, uid, ids, name, arg, context = None):
@@ -302,6 +304,7 @@ class idea_vote(osv.osv):
_name = 'idea.vote'
_description = 'Idea Vote'
_rec_name = 'score'
_log_create = True
_columns = {
'user_id': fields.many2one('res.users', 'User', readonly="True"),
+25 -6
View File
@@ -20,6 +20,7 @@
##############################################################################
from mx import DateTime
from datetime import datetime, timedelta
from osv import fields
from osv import osv
from tools.translate import _
@@ -417,7 +418,6 @@ class mrp_production(osv.osv):
_name = 'mrp.production'
_description = 'Manufacturing Order'
_date_name = 'date_planned'
_log_create = True
def _production_calc(self, cr, uid, ids, prop, unknow_none, context={}):
""" Calculates total hours and total no. of cycles for a production order.
@@ -509,7 +509,18 @@ class mrp_production(osv.osv):
'company_id': lambda self, cr, uid, c: self.pool.get('res.company')._company_default_get(cr, uid, 'mrp.production', context=c),
}
_order = 'date_planned asc, priority desc';
def _check_qty(self, cr, uid, ids):
orders = self.browse(cr, uid, ids)
for order in orders:
if order.product_qty <= 0:
return False
return True
_constraints = [
(_check_qty, 'Order quantity cannot be negative or zero !', ['product_qty']),
]
def unlink(self, cr, uid, ids, context=None):
productions = self.read(cr, uid, ids, ['state'])
unlink_ids = []
@@ -636,15 +647,23 @@ class mrp_production(osv.osv):
""" Changes the production state to Ready and location id of stock move.
@return: True
"""
for (id,name) in self.name_get(cr, uid, ids):
message = _('Manufacturing Order ') + " '" + name + "' "+ _("is ready to produce.")
self.log(cr, uid, id, message)
move_obj = self.pool.get('stock.move')
self.write(cr, uid, ids, {'state': 'ready'})
for production in self.browse(cr, uid, ids):
for (production_id,name) in self.name_get(cr, uid, ids):
production = self.browse(cr, uid, production_id)
if production.move_prod_id:
move_obj.write(cr, uid, [production.move_prod_id.id],
{'location_id': production.location_dest_id.id})
message = ("%s %s %s %s %s %s") % (
_('Manufacturing Order '),
name,
_("scheduled the"),
datetime.strptime(production.date_planned,'%Y-%m-%d %H:%M:%S').strftime('%Y-%m-%d'),
_("for"),
production.product_id.default_code)
self.log(cr, uid, production_id, message)
return True
def action_production_end(self, cr, uid, ids):
+2
View File
@@ -277,6 +277,8 @@ class purchase_order(osv.osv):
todo.append(line.id)
current_name = self.name_get(cr, uid, ids)[0][1]
self.pool.get('purchase.order.line').action_confirm(cr, uid, todo, context)
message = _('confirm Order') + " ' " + po.name
self.log(cr,uid,po,message)
for id in ids:
self.write(cr, uid, [id], {'state' : 'confirmed', 'validator' : uid})
for line in po.order_line: