[[ get_account(data) or removeParentNode('para') ]] |
[[ get_fiscalyear(data) or '' ]] |
- [[ get_filter(data)=='No Filter' and get_filter(data) or removeParentNode('para') ]]
+ | [[ get_filter(data)=='No Filters' and get_filter(data) or removeParentNode('para') ]]
[[ get_filter(data)=='Date' or removeParentNode('blockTable') ]]
Start Date |
diff --git a/addons/account/report/account_general_ledger.py b/addons/account/report/account_general_ledger.py
index 294c7fa99cf..38f2392f740 100644
--- a/addons/account/report/account_general_ledger.py
+++ b/addons/account/report/account_general_ledger.py
@@ -299,10 +299,10 @@ class general_ledger(report_sxw.rml_parse, common_report_header):
def _get_sortby(self, data):
if self.sortby == 'sort_date':
- return 'Date'
+ return self._translate('Date')
elif self.sortby == 'sort_journal_partner':
- return 'Journal & Partner'
- return 'Date'
+ return self._translate('Journal & Partner')
+ return self._translate('Date')
report_sxw.report_sxw('report.account.general.ledger', 'account.account', 'addons/account/report/account_general_ledger.rml', parser=general_ledger, header='internal')
report_sxw.report_sxw('report.account.general.ledger_landscape', 'account.account', 'addons/account/report/account_general_ledger_landscape.rml', parser=general_ledger, header='internal landscape')
diff --git a/addons/account/report/common_report_header.py b/addons/account/report/common_report_header.py
index c93c3e02ee3..c5719d98b96 100644
--- a/addons/account/report/common_report_header.py
+++ b/addons/account/report/common_report_header.py
@@ -94,10 +94,10 @@ class common_report_header(object):
def _get_filter(self, data):
if data.get('form', False) and data['form'].get('filter', False):
if data['form']['filter'] == 'filter_date':
- return 'Date'
+ return self._translate('Date')
elif data['form']['filter'] == 'filter_period':
- return 'Periods'
- return 'No Filter'
+ return self._translate('Periods')
+ return self._translate('No Filters')
def _sum_debit_period(self, period_id, journal_id=None):
journals = journal_id or self.journal_ids
diff --git a/addons/account/test/account_report.yml b/addons/account/test/account_report.yml
index 64f8ccf838f..7fe3095d47f 100644
--- a/addons/account/test/account_report.yml
+++ b/addons/account/test/account_report.yml
@@ -31,7 +31,6 @@
-
!python {model: account.account}: |
ctx={}
- ctx.update({'model': 'account.account','active_ids':[ref('account.chart0')],'active_id':ref('account.chart0')})
data_dict = {'chart_account_id':ref('account.chart0')}
from tools import test_reports
test_reports.try_report_action(cr, uid, 'action_account_aged_balance_view',wiz_data=data_dict, context=ctx, our_module='account')
@@ -40,7 +39,6 @@
-
!python {model: account.account}: |
ctx={}
- ctx.update({'model': 'account.account','active_ids':[ref('account.chart0')]})
data_dict = {'chart_account_id':ref('account.chart0'), 'account_report_id': ref('account_financial_report_balancesheet0')}
from tools import test_reports
test_reports.try_report_action(cr, uid, 'action_account_report',wiz_data=data_dict, context=ctx, our_module='account')
@@ -49,7 +47,6 @@
-
!python {model: account.account}: |
ctx={}
- ctx.update({'model': 'account.account','active_ids':[ref('account.chart0')]})
data_dict = {'chart_account_id':ref('account.chart0')}
from tools import test_reports
test_reports.try_report_action(cr, uid, 'action_account_balance_menu',wiz_data=data_dict, context=ctx, our_module='account')
@@ -60,7 +57,6 @@
journal_ids = [ref('account.sales_journal'),ref('account.refund_sales_journal'),ref('account.expenses_journal'),ref('account.refund_expenses_journal'),
ref('account.bank_journal'),ref('account.check_journal'),ref('account.cash_journal')]
ctx={}
- ctx.update({'model': 'account.journal.period','active_ids':journal_ids})
data_dict = {'chart_account_id':ref('account.chart0')}
from tools import test_reports
test_reports.try_report_action(cr, uid, 'action_account_central_journal',wiz_data=data_dict, context=ctx, our_module='account')
@@ -71,7 +67,6 @@
journal_ids = [ref('account.sales_journal'),ref('account.refund_sales_journal'),ref('account.expenses_journal'),ref('account.refund_expenses_journal'),
ref('account.bank_journal'),ref('account.check_journal'),ref('account.cash_journal')]
ctx={}
- ctx.update({'model': 'account.journal.period','active_ids':journal_ids})
data_dict = {'chart_account_id':ref('account.chart0')}
from tools import test_reports
test_reports.try_report_action(cr, uid, 'action_account_general_journal',wiz_data=data_dict, context=ctx, our_module='account')
@@ -80,7 +75,6 @@
-
!python {model: account.account}: |
ctx={}
- ctx.update({'model': 'account.account','active_ids':[ref('account.chart0')]})
data_dict = {'chart_account_id':ref('account.chart0'),'landscape':False}
from tools import test_reports
test_reports.try_report_action(cr, uid, 'action_account_general_ledger_menu',wiz_data=data_dict, context=ctx, our_module='account')
@@ -89,7 +83,6 @@
-
!python {model: account.account}: |
ctx={}
- ctx.update({'model': 'account.account','active_ids':[ref('account.chart0')]})
data_dict = {'chart_account_id':ref('account.chart0'),'landscape':True}
from tools import test_reports
test_reports.try_report_action(cr, uid, 'action_account_general_ledger_menu',wiz_data=data_dict, context=ctx, our_module='account')
@@ -99,7 +92,6 @@
!python {model: account.journal.period}: |
journal_ids = [ref('account.sales_journal'),ref('account.refund_sales_journal'),ref('account.expenses_journal'),ref('account.refund_expenses_journal'),ref('account.bank_journal'),ref('account.check_journal'),ref('account.cash_journal')]
ctx={}
- ctx.update({'model': 'account.journal.period','active_ids':journal_ids})
data_dict = {'chart_account_id':ref('account.chart0'), 'period_from':ref('period_1'), 'period_to':ref('period_12')}
from tools import test_reports
test_reports.try_report_action(cr, uid, 'action_account_print_journal',wiz_data=data_dict, context=ctx, our_module='account')
@@ -109,7 +101,6 @@
!python {model: account.account}: |
ctx={}
data_dict = {'chart_account_id':ref('account.chart0')}
- ctx.update({'model': 'account.account','active_ids':[ref('account.chart0')],'active_id':ref('account.chart0')})
from tools import test_reports
test_reports.try_report_action(cr, uid, 'action_account_partner_balance',wiz_data=data_dict, context=ctx, our_module='account')
-
@@ -118,7 +109,6 @@
!python {model: account.account}: |
ctx={}
data_dict = {'chart_account_id':ref('account.chart0'),'page_split': True}
- ctx.update({'model': 'account.account','active_ids':[ref('account.chart0')],'active_id':ref('account.chart0')})
from tools import test_reports
test_reports.try_report_action(cr, uid, 'action_account_partner_ledger',wiz_data=data_dict, context=ctx, our_module='account')
-
@@ -127,7 +117,6 @@
!python {model: res.partner}: |
ctx={}
data_dict = {'chart_account_id':ref('account.chart0'),'page_split': False}
- ctx.update({'model': 'account.account','active_ids':[ref('account.chart0')],'active_id':ref('account.chart0')})
from tools import test_reports
test_reports.try_report_action(cr, uid, 'action_account_partner_ledger',wiz_data=data_dict, context=ctx, our_module='account')
-
@@ -135,7 +124,6 @@
-
!python {model: account.account}: |
ctx={}
- ctx.update({'model': 'account.account','active_ids':[ref('account.chart0')]})
data_dict = {'chart_account_id':ref('account.chart0'), 'target_move': 'all', 'account_report_id': ref('account_financial_report_balancesheet0')}
from tools import test_reports
test_reports.try_report_action(cr, uid, 'action_account_report',wiz_data=data_dict, context=ctx, our_module='account')
diff --git a/addons/account/wizard/account_fiscalyear_close.py b/addons/account/wizard/account_fiscalyear_close.py
index 196c14d3792..dbf815d5218 100644
--- a/addons/account/wizard/account_fiscalyear_close.py
+++ b/addons/account/wizard/account_fiscalyear_close.py
@@ -226,7 +226,7 @@ class account_fiscalyear_close(osv.osv_memory):
for account in obj_acc_account.browse(cr, uid, account_ids, context={'fiscalyear': fy_id}):
balance_in_currency = 0.0
if account.currency_id:
- cr.execute('SELECT sum(amount_currency) as balance_in_currency FROM account_move_line ' \
+ cr.execute('SELECT sum(COALESCE(amount_currency,0.0)) as balance_in_currency FROM account_move_line ' \
'WHERE account_id = %s ' \
'AND ' + query_line + ' ' \
'AND currency_id = %s', (account.id, account.currency_id.id))
diff --git a/addons/account/wizard/account_report_common.py b/addons/account/wizard/account_report_common.py
index 9acc09e9026..4438484aaaf 100644
--- a/addons/account/wizard/account_report_common.py
+++ b/addons/account/wizard/account_report_common.py
@@ -119,7 +119,11 @@ class account_common_report(osv.osv_memory):
def _get_fiscalyear(self, cr, uid, context=None):
now = time.strftime('%Y-%m-%d')
- fiscalyears = self.pool.get('account.fiscalyear').search(cr, uid, [('date_start', '<', now), ('date_stop', '>', now)], limit=1 )
+ company_id = False
+ ids = context.get('active_ids', [])
+ if ids:
+ company_id = self.browse(cr, uid, ids[0], context=context).company_id.id
+ fiscalyears = self.pool.get('account.fiscalyear').search(cr, uid, [('date_start', '<', now), ('date_stop', '>', now), ('company_id', '=', company_id)], limit=1)
return fiscalyears and fiscalyears[0] or False
def _get_all_journal(self, cr, uid, context=None):
diff --git a/addons/account_analytic_plans/account_analytic_plans_view.xml b/addons/account_analytic_plans/account_analytic_plans_view.xml
index 76d6aeed7b8..e5c02c8640e 100644
--- a/addons/account_analytic_plans/account_analytic_plans_view.xml
+++ b/addons/account_analytic_plans/account_analytic_plans_view.xml
@@ -21,17 +21,17 @@
-
+
-
+
-
+
@@ -276,7 +276,7 @@
-
+
account.analytic.default.tree.plans
account.analytic.default
diff --git a/addons/account_anglo_saxon/invoice.py b/addons/account_anglo_saxon/invoice.py
index 693283b870b..26271015b7e 100644
--- a/addons/account_anglo_saxon/invoice.py
+++ b/addons/account_anglo_saxon/invoice.py
@@ -40,7 +40,7 @@ class account_invoice_line(osv.osv):
if inv.type in ('out_invoice','out_refund'):
for i_line in inv.invoice_line:
- if i_line.product_id:
+ if i_line.product_id and i_line.product_id.valuation == 'real_time':
if inv.type == 'out_invoice':
# debit account dacc will be the output account
# first check the product, if empty check the category
@@ -87,7 +87,7 @@ class account_invoice_line(osv.osv):
})
elif inv.type in ('in_invoice','in_refund'):
for i_line in inv.invoice_line:
- if i_line.product_id:
+ if i_line.product_id and i_line.product_id.valuation == 'real_time':
if i_line.product_id.type != 'service':
# get the price difference account at the product
acc = i_line.product_id.property_account_creditor_price_difference and i_line.product_id.property_account_creditor_price_difference.id
diff --git a/addons/account_asset/account_asset.py b/addons/account_asset/account_asset.py
index ac9024fd51d..0dddf441c59 100644
--- a/addons/account_asset/account_asset.py
+++ b/addons/account_asset/account_asset.py
@@ -386,7 +386,7 @@ class account_asset_depreciation_line(osv.osv):
current_currency = line.asset_id.currency_id.id
context.update({'date': depreciation_date})
amount = currency_obj.compute(cr, uid, current_currency, company_currency, line.amount, context=context)
- sign = line.asset_id.category_id.journal_id.type = 'purchase' and 1 or -1
+ sign = (line.asset_id.category_id.journal_id.type == 'purchase' and 1) or -1
asset_name = line.asset_id.name
reference = line.name
move_vals = {
diff --git a/addons/account_budget/account_budget_view.xml b/addons/account_budget/account_budget_view.xml
index cb0466a1c92..d24124e307d 100644
--- a/addons/account_budget/account_budget_view.xml
+++ b/addons/account_budget/account_budget_view.xml
@@ -220,7 +220,18 @@
-
+
+
+ account.budget.line.search
+ crossovered.budget.lines
+ search
+
+
+
+
+
+
+
crossovered.budget.line.tree
crossovered.budget.lines
diff --git a/addons/account_check_writing/i18n/es.po b/addons/account_check_writing/i18n/es.po
index 81932642524..c473e077210 100644
--- a/addons/account_check_writing/i18n/es.po
+++ b/addons/account_check_writing/i18n/es.po
@@ -8,14 +8,14 @@ msgstr ""
"Project-Id-Version: openobject-addons\n"
"Report-Msgid-Bugs-To: FULL NAME \n"
"POT-Creation-Date: 2012-02-08 00:35+0000\n"
-"PO-Revision-Date: 2012-02-09 19:28+0000\n"
-"Last-Translator: FULL NAME \n"
+"PO-Revision-Date: 2012-11-09 12:09+0000\n"
+"Last-Translator: Pedro Manuel Baeza \n"
"Language-Team: Spanish \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2012-10-30 05:36+0000\n"
-"X-Generator: Launchpad (build 16206)\n"
+"X-Launchpad-Export-Date: 2012-11-10 04:59+0000\n"
+"X-Generator: Launchpad (build 16251)\n"
#. module: account_check_writing
#: selection:res.company,check_layout:0
@@ -154,7 +154,7 @@ msgstr "Compañías"
#. module: account_check_writing
#: view:res.company:0
msgid "Default Check Layout"
-msgstr ""
+msgstr "Comprobar formato por defecto"
#. module: account_check_writing
#: constraint:account.journal:0
diff --git a/addons/account_sequence/account_sequence_data.xml b/addons/account_sequence/account_sequence_data.xml
index 1ad362b3979..b2d40412d0d 100644
--- a/addons/account_sequence/account_sequence_data.xml
+++ b/addons/account_sequence/account_sequence_data.xml
@@ -43,6 +43,18 @@
+
+ Account Journal
+ account.journal
+
+
+
+ Account journal sequence
+ account.journal
+ AJ
+
+
+
diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py
index 8bd9a48b1f4..b0c53b72835 100644
--- a/addons/account_voucher/account_voucher.py
+++ b/addons/account_voucher/account_voucher.py
@@ -267,6 +267,7 @@ class account_voucher(osv.osv):
_order = "date desc, id desc"
# _rec_name = 'number'
_columns = {
+ 'active': fields.boolean('Active', help="By default, reconciliation vouchers made on draft bank statements are set as inactive, which allow to hide the customer/supplier payment while the bank statement isn't confirmed."),
'type':fields.selection([
('sale','Sale'),
('purchase','Purchase'),
@@ -328,6 +329,7 @@ class account_voucher(osv.osv):
'is_multi_currency': fields.boolean('Multi Currency Voucher', help='Fields with internal purpose only that depicts if the voucher is a multi currency one or not'),
}
_defaults = {
+ 'active': True,
'period_id': _get_period,
'partner_id': _get_partner,
'journal_id':_get_journal,
@@ -953,6 +955,9 @@ class account_voucher(osv.osv):
if voucher_brw.number:
name = voucher_brw.number
elif voucher_brw.journal_id.sequence_id:
+ if not voucher_brw.journal_id.sequence_id.active:
+ raise osv.except_osv(_('Configuration Error !'),
+ _('Please activate the sequence of selected journal !'))
name = seq_obj.next_by_id(cr, uid, voucher_brw.journal_id.sequence_id.id, context=context)
else:
raise osv.except_osv(_('Error!'),
@@ -1504,6 +1509,15 @@ account_voucher_line()
class account_bank_statement(osv.osv):
_inherit = 'account.bank.statement'
+ def button_confirm_bank(self, cr, uid, ids, context=None):
+ voucher_obj = self.pool.get('account.voucher')
+ voucher_ids = []
+ for statement in self.browse(cr, uid, ids, context=context):
+ voucher_ids += [line.voucher_id.id for line in statement.line_ids if line.voucher_id]
+ if voucher_ids:
+ voucher_obj.write(cr, uid, voucher_ids, {'active': True}, context=context)
+ return super(account_bank_statement, self).button_confirm_bank(cr, uid, ids, context=context)
+
def button_cancel(self, cr, uid, ids, context=None):
voucher_obj = self.pool.get('account.voucher')
for st in self.browse(cr, uid, ids, context=context):
@@ -1539,6 +1553,16 @@ account_bank_statement()
class account_bank_statement_line(osv.osv):
_inherit = 'account.bank.statement.line'
+ def onchange_partner_id(self, cr, uid, ids, partner_id, context=None):
+ res = super(account_bank_statement_line, self).onchange_partner_id(cr, uid, ids, partner_id, context=context)
+ if 'value' not in res:
+ res['value'] = {}
+ res['value'].update({'voucher_id' : False})
+ return res
+
+ def onchange_amount(self, cr, uid, ids, amount, context=None):
+ return {'value' : {'voucher_id' : False}}
+
def _amount_reconciled(self, cursor, user, ids, name, args, context=None):
if not ids:
return {}
@@ -1565,7 +1589,7 @@ class account_bank_statement_line(osv.osv):
_columns = {
'amount_reconciled': fields.function(_amount_reconciled,
string='Amount reconciled', type='float'),
- 'voucher_id': fields.many2one('account.voucher', 'Payment'),
+ 'voucher_id': fields.many2one('account.voucher', 'Reconciliation'),
}
def unlink(self, cr, uid, ids, context=None):
diff --git a/addons/account_voucher/account_voucher_view.xml b/addons/account_voucher/account_voucher_view.xml
index babe60b640e..2cb393f4008 100644
--- a/addons/account_voucher/account_voucher_view.xml
+++ b/addons/account_voucher/account_voucher_view.xml
@@ -200,33 +200,29 @@
-
+
account.bank.statement.voucher.tree.inherit
account.bank.statement
-
+
+
+
+
+
+ onchange_amount(amount)
+
-
- account.bank.statement.voucher.form.inherit
- account.bank.statement
-
-
-
-
-
-
-
account.cash.statement.voucher.tree.inherit
account.bank.statement
diff --git a/addons/account_voucher/voucher_payment_receipt_view.xml b/addons/account_voucher/voucher_payment_receipt_view.xml
index 881a5e38f1c..b6f367601ff 100644
--- a/addons/account_voucher/voucher_payment_receipt_view.xml
+++ b/addons/account_voucher/voucher_payment_receipt_view.xml
@@ -54,6 +54,8 @@
-
+
crm.case.categ.form
@@ -238,7 +237,7 @@
-
+
@@ -297,7 +296,7 @@
+ parent="base.menu_crm_config_lead"/>
Cases by Sales Team
@@ -354,13 +353,13 @@
+ icon="gtk-execute"/>
+ icon="gtk-cancel"/>
+ icon="gtk-go-forward"/>
@@ -412,7 +411,7 @@
tree,form
- Click to define a new customer segmentation.
+ Click to define a new customer segmentation.
Create specific categories which you can assign to your
contacts to better manage your interactions with them. The
@@ -425,7 +424,7 @@
+ parent="base.menu_base_config"/>
@@ -466,11 +465,11 @@
form
tree,form
-
+
+ parent="base.menu_crm_config_lead"/>
diff --git a/addons/crm/i18n/es.po b/addons/crm/i18n/es.po
index fe2f139f682..a72a6ec2305 100644
--- a/addons/crm/i18n/es.po
+++ b/addons/crm/i18n/es.po
@@ -7,14 +7,14 @@ msgstr ""
"Project-Id-Version: OpenERP Server 6.0dev\n"
"Report-Msgid-Bugs-To: support@openerp.com\n"
"POT-Creation-Date: 2012-02-08 01:37+0100\n"
-"PO-Revision-Date: 2012-02-10 17:48+0000\n"
-"Last-Translator: Carlos Ch. \n"
+"PO-Revision-Date: 2012-11-09 12:10+0000\n"
+"Last-Translator: Pedro Manuel Baeza \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: 2012-10-30 04:57+0000\n"
-"X-Generator: Launchpad (build 16206)\n"
+"X-Launchpad-Export-Date: 2012-11-10 04:59+0000\n"
+"X-Generator: Launchpad (build 16251)\n"
#. module: crm
#: view:crm.lead.report:0
@@ -172,7 +172,7 @@ msgstr "Mes esperado de cierre"
#. module: crm
#: view:crm.lead2opportunity.partner.mass:0
msgid "Assigned Opportunities to"
-msgstr ""
+msgstr "Oportunidades asignadas a"
#. module: crm
#: view:crm.lead:0 field:crm.lead,partner_id:0 view:crm.lead.report:0
@@ -598,7 +598,7 @@ msgstr "Fecha de fin"
#. module: crm
#: view:crm.opportunity2phonecall:0 view:crm.phonecall2phonecall:0
msgid "Schedule/Log a Call"
-msgstr ""
+msgstr "Planificar/Registrar una llamada"
#. module: crm
#: constraint:base.action.rule:0
@@ -792,7 +792,7 @@ msgstr "Siguiente"
#. module: crm
#: field:crm.segmentation,som_interval:0
msgid "Days per Period"
-msgstr ""
+msgstr "Días por periodo"
#. module: crm
#: field:crm.meeting,byday:0
@@ -959,7 +959,7 @@ msgstr "Días para abrir"
#. module: crm
#: view:crm.meeting:0
msgid "Show Time as"
-msgstr ""
+msgstr "Mostrar hora como"
#. module: crm
#: view:crm.phonecall2partner:0
@@ -1342,7 +1342,7 @@ msgstr "Fecha escritura"
#. module: crm
#: view:crm.meeting:0
msgid "End of Recurrency"
-msgstr ""
+msgstr "Fin de recurrencia"
#. module: crm
#: view:crm.meeting:0
@@ -1392,6 +1392,12 @@ msgid ""
" \n"
"If the call needs to be done then the state is set to 'Not Held'."
msgstr ""
+"El estado se establece a 'Para hacer' cuando se crea el caso.\n"
+"Si es caso está en marcha, el estado se establece a 'Abierto.\n"
+"Cuando la llamada se termina, el estado se establece en 'Realizada'. "
+" \n"
+"Si la llamada está pendiente de ser realizada, entonces el estado se "
+"establece en 'Pendiente'."
#. module: crm
#: selection:crm.meeting,week_list:0
@@ -1449,7 +1455,7 @@ msgstr "Oportunidades por categorías"
#. module: crm
#: model:crm.case.section,name:crm.section_sales_marketing_department
msgid "Sales Marketing Department"
-msgstr ""
+msgstr "Departamento de ventas y marketing"
#. module: crm
#: view:crm.phonecall.report:0
@@ -1900,7 +1906,7 @@ msgstr "Responder a"
#. module: crm
#: view:crm.case.section:0
msgid "Select Stages for this Sales Team"
-msgstr ""
+msgstr "Seleccione etapas para este equipo de ventas"
#. module: crm
#: view:board.board:0
@@ -2015,7 +2021,7 @@ msgstr "Ubicación"
#. module: crm
#: model:ir.model,name:crm.model_crm_lead2opportunity_partner_mass
msgid "Mass Lead To Opportunity Partner"
-msgstr ""
+msgstr "Transformación masiva de iniciativa a oportunidad"
#. module: crm
#: view:crm.lead:0
@@ -2777,7 +2783,7 @@ msgstr "e-mail del contacto"
#. module: crm
#: field:crm.lead,referred:0
msgid "Referred by"
-msgstr ""
+msgstr "Referido por"
#. module: crm
#: view:crm.lead:0 model:ir.model,name:crm.model_crm_add_note
@@ -3541,7 +3547,7 @@ msgstr "Nuevas oportunidades"
#: code:addons/crm/crm_action_rule.py:61
#, python-format
msgid "No E-Mail Found for your Company address!"
-msgstr ""
+msgstr "No se encontró dirección de e-mail para el contacto de su compañía"
#. module: crm
#: field:crm.lead.report,email:0
@@ -3561,7 +3567,7 @@ msgstr "Oportunidades por usuario y equipo"
#. module: crm
#: view:crm.phonecall:0
msgid "Reset to Todo"
-msgstr ""
+msgstr "Cambiar a 'Para hacer'"
#. module: crm
#: field:crm.case.section,working_hours:0
@@ -3643,6 +3649,10 @@ msgid ""
"partner. From the phone call form, you can trigger a request for another "
"call, a meeting or an opportunity."
msgstr ""
+"Esta herramienta permite registrar sus llamadas entrantes sobre la marcha. "
+"Cada llamada que recibe aparecerá en el formulario de la empresa para trazar "
+"cada contacto que tiene con una empresa. Desde el formulario de llamadas, "
+"puede lanzar una petición para otra llamada, una reunión u oportunidad."
#. module: crm
#: selection:crm.lead.report,creation_month:0
@@ -3673,6 +3683,10 @@ msgid ""
"channels that will be maintained at the creation of a document in the "
"system. Some examples of channels can be: Website, Phone Call, Reseller, etc."
msgstr ""
+"Controle el origen de sus iniciativas y oportunidades de venta mediante la "
+"creación de canales específicos que se usarán en la creación de documentos "
+"en el sistema. Algunos ejemplos de canales son: Sitio web, llamada "
+"telefónica, distribuidores, ..."
#. module: crm
#: selection:crm.lead2opportunity.partner,name:0
@@ -3740,7 +3754,7 @@ msgstr "Año"
#. module: crm
#: constraint:res.partner:0
msgid "Error ! You cannot create recursive associated members."
-msgstr ""
+msgstr "¡Error! No puede crear miembros asociados recursivamente."
#. module: crm
#: model:crm.case.resource.type,name:crm.type_lead8
diff --git a/addons/crm/report/crm_phonecall_report_view.xml b/addons/crm/report/crm_phonecall_report_view.xml
index a2120aef6ab..1f1a4f91046 100644
--- a/addons/crm/report/crm_phonecall_report_view.xml
+++ b/addons/crm/report/crm_phonecall_report_view.xml
@@ -91,7 +91,7 @@
crm.phonecall.report
form
tree,graph
- {"search_default_year":1,"search_default_User":1,"search_default_This Month":1,'group_by_no_leaf':1,'group_by':[]}
+ {"search_default_year":1,"search_default_Salesperson":1,"search_default_This Month":1,'group_by_no_leaf':1,'group_by':[]}
From this report, you can analyse the performance of your sales team, based on their phone calls. You can group or filter the information according to several criteria and drill down the information, by adding more groups in the report.
diff --git a/addons/crm_claim/crm_claim.py b/addons/crm_claim/crm_claim.py
index e4d5f5999cb..8308e5420d0 100644
--- a/addons/crm_claim/crm_claim.py
+++ b/addons/crm_claim/crm_claim.py
@@ -105,7 +105,7 @@ class crm_claim(base_stage, osv.osv):
'email_from': fields.char('Email', size=128, help="Destination email for email gateway."),
'partner_phone': fields.char('Phone', size=32),
'stage_id': fields.many2one ('crm.claim.stage', 'Stage',
- domain="['|', ('section_ids', '=', section_id), ('case_default', '=', True)]"),
+ domain="['&',('fold', '=', False),'|', ('section_ids', '=', section_id), ('case_default', '=', True)]"),
'cause': fields.text('Root Cause'),
'state': fields.related('stage_id', 'state', type="selection", store=True,
selection=crm.AVAILABLE_STATES, string="Status", readonly=True,
diff --git a/addons/crm_claim/crm_claim_data.xml b/addons/crm_claim/crm_claim_data.xml
index 33bd280c364..ed0558f72e9 100644
--- a/addons/crm_claim/crm_claim_data.xml
+++ b/addons/crm_claim/crm_claim_data.xml
@@ -43,38 +43,32 @@
-->
- Draft claim
+ New
draft
26
- Actions Defined
+ In Progress
open
27
- Actions Done
+ Settled
done
28
- Refused
- done
+ Rejected
+ cancel
29
-
- Cancelled
- cancel
- 30
-
-
-
+
diff --git a/addons/crm_claim/crm_claim_menu.xml b/addons/crm_claim/crm_claim_menu.xml
index 3782a3a7c00..4c0eca3d0f7 100644
--- a/addons/crm_claim/crm_claim_menu.xml
+++ b/addons/crm_claim/crm_claim_menu.xml
@@ -52,7 +52,7 @@
-
+
diff --git a/addons/crm_claim/crm_claim_view.xml b/addons/crm_claim/crm_claim_view.xml
index 2b5ca4b1556..aa4243a6838 100644
--- a/addons/crm_claim/crm_claim_view.xml
+++ b/addons/crm_claim/crm_claim_view.xml
@@ -102,16 +102,11 @@
diff --git a/addons/email_template/tests/test_mail.py b/addons/email_template/tests/test_mail.py
index 7af05f38b0e..9a7b71a4e42 100644
--- a/addons/email_template/tests/test_mail.py
+++ b/addons/email_template/tests/test_mail.py
@@ -63,11 +63,16 @@ class test_message_compose(test_mail.TestMailMockups):
# Create template on mail.group, with attachments
group_model_id = self.registry('ir.model').search(cr, uid, [('model', '=', 'mail.group')])[0]
email_template = self.registry('email.template')
- email_template_id = email_template.create(cr, uid, {'model_id': group_model_id,
- 'name': 'Pigs Template', 'subject': '${object.name}',
- 'body_html': '${object.description}', 'user_signature': True,
+ email_template_id = email_template.create(cr, uid, {
+ 'model_id': group_model_id,
+ 'name': 'Pigs Template',
+ 'subject': '${object.name}',
+ 'body_html': '${object.description}',
+ 'user_signature': True,
'attachment_ids': [(0, 0, _attachments[0]), (0, 0, _attachments[1])],
- 'email_to': 'b@b.b c@c.c', 'email_cc': 'd@d.d'})
+ 'email_to': 'b@b.b c@c.c',
+ 'email_cc': 'd@d.d'
+ })
# ----------------------------------------
# CASE1: comment and save as template
@@ -76,9 +81,9 @@ class test_message_compose(test_mail.TestMailMockups):
# 1. Comment on pigs
compose_id = mail_compose.create(cr, uid,
{'subject': 'Forget me subject', 'body': 'Dummy body '},
- {'default_composition_mode': 'comment', 'default_model': 'mail.group',
+ {'default_composition_mode': 'comment',
+ 'default_model': 'mail.group',
'default_res_id': self.group_pigs_id,
- 'default_template_id': email_template_id,
'active_ids': [self.group_pigs_id, self.group_bird_id]})
compose = mail_compose.browse(cr, uid, compose_id)
@@ -97,8 +102,10 @@ class test_message_compose(test_mail.TestMailMockups):
# 1. Comment on pigs
compose_id = mail_compose.create(cr, uid,
{'subject': 'Forget me subject', 'body': 'Dummy body'},
- {'default_composition_mode': 'comment', 'default_model': 'mail.group',
+ {'default_composition_mode': 'comment',
+ 'default_model': 'mail.group',
'default_res_id': self.group_pigs_id,
+ 'default_use_template': False,
'default_template_id': email_template_id,
'active_ids': [self.group_pigs_id, self.group_bird_id]})
compose = mail_compose.browse(cr, uid, compose_id)
@@ -135,8 +142,10 @@ class test_message_compose(test_mail.TestMailMockups):
# 1. Mass_mail on pigs and bird, with a default_partner_ids set to check he is correctly added
compose_id = mail_compose.create(cr, uid,
{'subject': 'Forget me subject', 'body': 'Dummy body'},
- {'default_composition_mode': 'mass_mail', 'default_model': 'mail.group',
+ {'default_composition_mode': 'mass_mail',
+ 'default_model': 'mail.group',
'default_res_id': self.group_pigs_id,
+ 'default_use_template': False,
'default_template_id': email_template_id,
'default_partner_ids': [p_a_id],
'active_ids': [self.group_pigs_id, self.group_bird_id]})
@@ -170,3 +179,26 @@ class test_message_compose(test_mail.TestMailMockups):
partner_ids = self.res_partner.search(cr, uid, [('email', 'in', ['b@b.b', 'c@c.c', 'd@d.d'])])
self.assertEqual(set(message_pigs_pids), set(partner_ids), 'mail.message on pigs incorrect number of notified_partner_ids')
self.assertEqual(set(message_bird_pids), set(partner_ids), 'mail.message on bird notified_partner_ids incorrect')
+
+ # ----------------------------------------
+ # CASE4: test newly introduced email_recipients field
+ # ----------------------------------------
+
+ # get already-created partners back
+ p_b_id = self.res_partner.search(cr, uid, [('email', '=', 'b@b.b')])[0]
+ p_c_id = self.res_partner.search(cr, uid, [('email', '=', 'c@c.c')])[0]
+ p_d_id = self.res_partner.search(cr, uid, [('email', '=', 'd@d.d')])[0]
+ # modify template: use email_recipients, use template and email address in email_to to test all features together
+ user_model_id = self.registry('ir.model').search(cr, uid, [('model', '=', 'res.users')])[0]
+ email_template.write(cr, uid, [email_template_id], {
+ 'model_id': user_model_id,
+ 'body_html': '${object.login}',
+ 'email_to': '${object.email} c@c',
+ 'email_recipients': '%i,%i' % (p_b_id, p_c_id),
+ 'email_cc': 'd@d',
+ })
+ # patner by email + partner by id (no double)
+ send_to = [p_a_id, p_b_id, p_c_id, p_d_id]
+ # Generate messsage with default email and partner on template
+ mail_value = mail_compose.generate_email_for_composer(cr, uid, email_template_id, uid)
+ self.assertEqual(set(mail_value['partner_ids']), set(send_to), 'mail.message partner_ids list created by template is incorrect')
diff --git a/addons/email_template/wizard/email_template_preview_view.xml b/addons/email_template/wizard/email_template_preview_view.xml
index f91535a17a5..8dd4bc92ba7 100644
--- a/addons/email_template/wizard/email_template_preview_view.xml
+++ b/addons/email_template/wizard/email_template_preview_view.xml
@@ -17,6 +17,7 @@
+
diff --git a/addons/email_template/wizard/mail_compose_message.py b/addons/email_template/wizard/mail_compose_message.py
index bc91a19d26f..079ac5e388a 100644
--- a/addons/email_template/wizard/mail_compose_message.py
+++ b/addons/email_template/wizard/mail_compose_message.py
@@ -52,8 +52,9 @@ class mail_compose_message(osv.TransientModel):
context = {}
result = super(mail_compose_message, self).default_get(cr, uid, fields, context=context)
result['template_id'] = context.get('default_template_id', context.get('mail.compose.template_id', False))
+
# pre-render the template if any
- if result.get('use_template'):
+ if result.get('use_template') and result.get('template_id'):
onchange_res = self.onchange_use_template(cr, uid, [], result.get('use_template'), result.get('template_id'),
result.get('composition_mode'), result.get('model'), result.get('res_id'), context=context)
result.update(onchange_res['value'])
@@ -65,6 +66,10 @@ class mail_compose_message(osv.TransientModel):
'template_id': fields.selection(_get_templates, 'Template', size=-1),
}
+ _defaults = {
+ 'use_template': True,
+ }
+
def onchange_template_id(self, cr, uid, ids, use_template, template_id, composition_mode, model, res_id, context=None):
""" - use_template not set: return default_get
- use_template set in mass_mailing: we cannot render, so return the template values
@@ -149,15 +154,23 @@ class mail_compose_message(osv.TransientModel):
mail.compose.message, transform email_cc and email_to into partner_ids """
template_values = self.pool.get('email.template').generate_email(cr, uid, template_id, res_id, context=context)
# filter template values
- fields = ['body', 'body_html', 'subject', 'email_to', 'email_cc', 'attachments']
+ fields = ['body', 'body_html', 'subject', 'email_to', 'email_recipients', 'email_cc', 'attachments']
values = dict((field, template_values[field]) for field in fields if template_values.get(field))
values['body'] = values.pop('body_html', '')
# transform email_to, email_cc into partner_ids
values['partner_ids'] = []
+
mails = tools.email_split(values.pop('email_to', '') + ' ' + values.pop('email_cc', ''))
for mail in mails:
partner_id = self.pool.get('res.partner').find_or_create(cr, uid, mail, context=context)
values['partner_ids'].append(partner_id)
+ email_recipients = values.pop('email_recipients', '')
+ if email_recipients:
+ for partner_id in email_recipients.split(','):
+ values['partner_ids'].append(int(partner_id))
+
+ values['partner_ids'] = list(set(values['partner_ids']))
+
return values
def render_message(self, cr, uid, wizard, res_id, context=None):
diff --git a/addons/email_template/wizard/mail_compose_message_view.xml b/addons/email_template/wizard/mail_compose_message_view.xml
index 05d0e8dffa1..0a530299d4a 100644
--- a/addons/email_template/wizard/mail_compose_message_view.xml
+++ b/addons/email_template/wizard/mail_compose_message_view.xml
@@ -8,23 +8,23 @@
-
-
-
-
-
+
+
-
-
-
+
+
+ Use template
+
+
+ or
+
+
diff --git a/addons/event/static/src/css/event.css b/addons/event/static/src/css/event.css
index f49f5474fa6..ff5bfaba19b 100644
--- a/addons/event/static/src/css/event.css
+++ b/addons/event/static/src/css/event.css
@@ -14,11 +14,13 @@
border-bottom-left-radius:3px;
border-bottom-right-radius:3px;
font-size: 12px;
+ border-collapse: separate;
text-align: center;
font-weight: bold;
color: #8A89BA;
-webkit-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
background-color: #FFFFFF;
+ box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}
.oe_event_month_year{
border-bottom-left-radius:3px;
diff --git a/addons/event_sale/event_sale.py b/addons/event_sale/event_sale.py
index 2dd40a7c285..f4d7fcaa013 100644
--- a/addons/event_sale/event_sale.py
+++ b/addons/event_sale/event_sale.py
@@ -39,7 +39,7 @@ class sale_order_line(osv.osv):
_columns = {
'event_id': fields.many2one('event.event', 'Event', help="Choose an event and it will automatically create a registration for this event."),
#those 2 fields are used for dynamic domains and filled by onchange
- 'event_type_id': fields.related('event_type_id', type='many2one', relation="event.type", string="Event Type"),
+ 'event_type_id': fields.related('product_id','event_type_id', type='many2one', relation="event.type", string="Event Type"),
'event_ok': fields.related('product_id', 'event_ok', string='event_ok', type='boolean'),
}
diff --git a/addons/fleet/fleet.py b/addons/fleet/fleet.py
index d531b00bc43..be0e8b34351 100644
--- a/addons/fleet/fleet.py
+++ b/addons/fleet/fleet.py
@@ -56,7 +56,10 @@ class fleet_vehicle_cost(osv.Model):
def _year_get_fnc(self, cr, uid, ids, name, unknow_none, context=None):
res = {}
for record in self.browse(cr, uid, ids, context=context):
- res[record.id] = str(time.strptime(record.date, tools.DEFAULT_SERVER_DATE_FORMAT).tm_year)
+ if (record.date):
+ res[record.id] = str(time.strptime(record.date, tools.DEFAULT_SERVER_DATE_FORMAT).tm_year)
+ else:
+ res[record.id] = _('Unknown')
return res
def _cost_name_get_fnc(self, cr, uid, ids, name, unknow_none, context=None):
@@ -253,7 +256,6 @@ class fleet_vehicle(osv.Model):
def _search_get_overdue_contract_reminder(self, cr, uid, obj, name, args, context):
res = []
- today = fields.date.today(self, cr, uid, context=context)
for field, operator, value in args:
assert operator in ('=', '!=', '<>') and value in (True, False), 'Operation not supported'
if (operator == '=' and value == True) or (operator in ('<>', '!=') and value == False):
@@ -343,7 +345,7 @@ class fleet_vehicle(osv.Model):
'seats': fields.integer('Seats Number', help='Number of seats of the vehicle'),
'doors': fields.integer('Doors Number', help='Number of doors of the vehicle'),
'tag_ids' :fields.many2many('fleet.vehicle.tag', 'fleet_vehicle_vehicle_tag_rel', 'vehicle_tag_id','tag_id', 'Tags'),
- 'odometer': fields.function(_get_odometer, fnct_inv=_set_odometer, type='float', string='Odometer Value', help='Odometer measure of the vehicle at the moment of this log'),
+ 'odometer': fields.function(_get_odometer, fnct_inv=_set_odometer, type='float', string='Last Odometer', help='Odometer measure of the vehicle at the moment of this log'),
'odometer_unit': fields.selection([('kilometers', 'Kilometers'),('miles','Miles')], 'Odometer Unit', help='Unit of the odometer ',required=True),
'transmission': fields.selection([('manual', 'Manual'), ('automatic', 'Automatic')], 'Transmission', help='Transmission Used by the vehicle'),
'fuel_type': fields.selection([('gasoline', 'Gasoline'), ('diesel', 'Diesel'), ('electric', 'Electric'), ('hybrid', 'Hybrid')], 'Fuel Type', help='Fuel Used by the vehicle'),
@@ -718,7 +720,7 @@ class fleet_vehicle_log_contract(osv.Model):
'start_date': datetime.datetime.strftime(str_to_datetime(element.expiration_date) + datetime.timedelta(days=1), tools.DEFAULT_SERVER_DATE_FORMAT),
'expiration_date': datetime.datetime.strftime(enddate + diffdate, tools.DEFAULT_SERVER_DATE_FORMAT),
}
- newid = super(fleet_vehicle_log_contract, self).copy(cr, uid, [element.id], default, context=context)
+ newid = super(fleet_vehicle_log_contract, self).copy(cr, uid, element.id, default, context=context)
mod, modid = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'fleet', 'fleet_vehicle_log_contract_form')
return {
'name':_("Renew Contract"),
@@ -769,8 +771,8 @@ class fleet_vehicle_log_contract(osv.Model):
'start_date': fields.date('Contract Start Date', help='Date when the coverage of the contract begins'),
'expiration_date': fields.date('Contract Expiration Date', help='Date when the coverage of the contract expirates (by default, one year after begin date)'),
'days_left': fields.function(get_days_left, type='integer', string='Warning Date'),
- 'insurer_id' :fields.many2one('res.partner', 'Supplier', domain="[('supplier','=',True)]"),
- 'purchaser_id': fields.many2one('res.partner', 'Contractor', domain="['|', ('customer','=',True), ('employee','=',True)]",help='Person to which the contract is signed for'),
+ 'insurer_id' :fields.many2one('res.partner', 'Supplier'),
+ 'purchaser_id': fields.many2one('res.partner', 'Contractor', help='Person to which the contract is signed for'),
'ins_ref': fields.char('Contract Reference', size=64),
'state': fields.selection([('open', 'In Progress'), ('toclose','To Close'), ('closed', 'Terminated')], 'Status', readonly=True, help='Choose wheter the contract is still valid or not'),
'notes': fields.text('Terms and Conditions', help='Write here all supplementary informations relative to this contract'),
diff --git a/addons/fleet/fleet_board_view.xml b/addons/fleet/fleet_board_view.xml
index 425d5c5b8eb..760fc1cf583 100644
--- a/addons/fleet/fleet_board_view.xml
+++ b/addons/fleet/fleet_board_view.xml
@@ -43,7 +43,7 @@
form
tree
- ['|',('contract_renewal_due_soon','>',0),('contract_renewal_overdue','>',0)]
+ ['|',('contract_renewal_due_soon','=',True),('contract_renewal_overdue','=',True)]
Here are displayed vehicles for which one or more contracts need to be renewed. If you see this message, then there is no contracts to renew.
diff --git a/addons/fleet/fleet_view.xml b/addons/fleet/fleet_view.xml
index bb15440ba37..8eb1baba760 100644
--- a/addons/fleet/fleet_view.xml
+++ b/addons/fleet/fleet_view.xml
@@ -256,7 +256,7 @@
-
+
@@ -522,7 +522,7 @@
fleet.vehicle.odometer.tree
fleet.vehicle.odometer
-
+
@@ -563,7 +563,7 @@
Vehicles Odometer
fleet.vehicle.odometer
form
- tree,form,graph
+ tree,graph
{"search_default_groupby_vehicle" : True}
diff --git a/addons/hr/hr.py b/addons/hr/hr.py
index d57fcf49ab2..5f3a5653307 100644
--- a/addons/hr/hr.py
+++ b/addons/hr/hr.py
@@ -158,6 +158,8 @@ class hr_employee(osv.osv):
return self.write(cr, uid, [id], {'image': tools.image_resize_image_big(value)}, context=context)
_columns = {
+ #we need a related field in order to be able to sort the employee by name
+ 'name_related': fields.related('resource_id', 'name', type='char', string='Name', readonly=True, store=True),
'country_id': fields.many2one('res.country', 'Nationality'),
'birthday': fields.date("Date of Birth"),
'ssnid': fields.char('SSN No', size=32, help='Social Security Number'),
@@ -207,6 +209,8 @@ class hr_employee(osv.osv):
'last_login': fields.related('user_id', 'date', type='datetime', string='Latest Connection', readonly=1),
}
+ _order='name_related'
+
def create(self, cr, uid, data, context=None):
employee_id = super(hr_employee, self).create(cr, uid, data, context=context)
try:
diff --git a/addons/hr/hr_view.xml b/addons/hr/hr_view.xml
index c4a622d7a4f..8918c5012c3 100644
--- a/addons/hr/hr_view.xml
+++ b/addons/hr/hr_view.xml
@@ -288,7 +288,7 @@
- Categories of Employee
+ Categories of Employees
hr.employee.category
form
tree,form
@@ -342,8 +342,8 @@
-
+
diff --git a/addons/hr/i18n/es_EC.po b/addons/hr/i18n/es_EC.po
index 32e81b6d14d..bfbbb7fa180 100644
--- a/addons/hr/i18n/es_EC.po
+++ b/addons/hr/i18n/es_EC.po
@@ -8,15 +8,14 @@ msgstr ""
"Project-Id-Version: openobject-addons\n"
"Report-Msgid-Bugs-To: FULL NAME \n"
"POT-Creation-Date: 2012-02-08 01:37+0100\n"
-"PO-Revision-Date: 2012-01-03 02:55+0000\n"
-"Last-Translator: Christopher Ormaza - (Ecuadorenlinea.net) "
-"\n"
+"PO-Revision-Date: 2012-11-10 17:20+0000\n"
+"Last-Translator: Cristian Salamea (Gnuthink) \n"
"Language-Team: Spanish (Ecuador) \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2012-10-30 05:17+0000\n"
-"X-Generator: Launchpad (build 16206)\n"
+"X-Launchpad-Export-Date: 2012-11-11 04:57+0000\n"
+"X-Generator: Launchpad (build 16251)\n"
#. module: hr
#: model:process.node,name:hr.process_node_openerpuser0
@@ -199,6 +198,8 @@ msgstr "Mujer"
msgid ""
"Expected number of employees for this job position after new recruitment."
msgstr ""
+"Número de Empleados para este puesto de trabajo después de las nuevas "
+"contrataciones"
#. module: hr
#: model:ir.ui.menu,name:hr.menu_open_view_attendance_reason_new_config
@@ -291,7 +292,7 @@ msgstr "Categorías"
#. module: hr
#: field:hr.job,expected_employees:0
msgid "Total Employees"
-msgstr ""
+msgstr "Total de Empleados"
#. module: hr
#: selection:hr.employee,marital:0
@@ -435,7 +436,7 @@ msgstr "Estado"
#: model:ir.actions.act_window,name:hr.open_view_categ_tree
#: model:ir.ui.menu,name:hr.menu_view_employee_category_tree
msgid "Categories Structure"
-msgstr ""
+msgstr "Estructura de categorías"
#. module: hr
#: field:hr.employee,partner_id:0
@@ -465,7 +466,7 @@ msgstr "¡Error! No se puede crear una jerarquía recursiva de empleados."
#. module: hr
#: model:ir.actions.act_window,name:hr.action2
msgid "Subordinate Hierarchy"
-msgstr ""
+msgstr "Jerarquía subirdinada"
#. module: hr
#: model:ir.actions.act_window,help:hr.view_department_form_installer
@@ -715,12 +716,12 @@ msgstr "Subordinados"
#. module: hr
#: field:hr.job,no_of_employee:0
msgid "Number of employees currently occupying this job position."
-msgstr ""
+msgstr "Número de empleados ocupando actualmente este puesto de trabajo"
#. module: hr
#: field:hr.job,no_of_recruitment:0
msgid "Number of new employees you expect to recruit."
-msgstr ""
+msgstr "Número de empleados que espera contratar"
#~ msgid "Working Time Categories"
#~ msgstr "Categorías de Horarios de Trabajo"
diff --git a/addons/hr/static/src/css/hr.css b/addons/hr/static/src/css/hr.css
index 00ef92c0fd8..f395f9939e5 100644
--- a/addons/hr/static/src/css/hr.css
+++ b/addons/hr/static/src/css/hr.css
@@ -18,10 +18,11 @@
-o-border-radius: 3px;
-ms-border-radius: 3px;
border-radius: 3px;
+ border-collapse: separate;
-moz-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
-webkit-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
-o-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
- -box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
+ box-shadow: 0 1px 4px 3px rgba(0, 0, 0, 0.4);
}
.oe_employee_picture {
diff --git a/addons/hr_attendance/report/attendance_by_month.py b/addons/hr_attendance/report/attendance_by_month.py
index f104b9c287a..6d41869ff23 100644
--- a/addons/hr_attendance/report/attendance_by_month.py
+++ b/addons/hr_attendance/report/attendance_by_month.py
@@ -31,6 +31,7 @@ from report.interface import toxml
from report import report_sxw
from tools import ustr
from tools.translate import _
+from tools import to_xml
one_day = relativedelta(days=1)
month2name = [0, 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
@@ -111,7 +112,7 @@ class report_custom(report_rml):
%s
%s
- ''' % (str(rml_obj.formatLang(time.strftime("%Y-%m-%d"),date=True))+' ' + str(time.strftime("%H:%M")),pooler.get_pool(cr.dbname).get('res.users').browse(cr,uid,uid).company_id.name)
+ ''' % (str(rml_obj.formatLang(time.strftime("%Y-%m-%d"),date=True))+' ' + str(time.strftime("%H:%M")),to_xml(pooler.get_pool(cr.dbname).get('res.users').browse(cr,uid,uid).company_id.name))
first_date = str(month)
som = datetime.strptime(first_date, '%Y-%m-%d %H:%M:%S')
diff --git a/addons/hr_expense/hr_expense.py b/addons/hr_expense/hr_expense.py
index c9961fa8a1d..ccb8af68e21 100644
--- a/addons/hr_expense/hr_expense.py
+++ b/addons/hr_expense/hr_expense.py
@@ -64,22 +64,22 @@ class hr_expense_expense(osv.osv):
_description = "Expense"
_order = "id desc"
_columns = {
- 'name': fields.char('Description', size=128),
+ 'name': fields.char('Description', size=128, required=True, readonly=True, states={'draft':[('readonly',False)], 'confirm':[('readonly',False)]}),
'id': fields.integer('Sheet ID', readonly=True),
- 'date': fields.date('Date', select=True),
+ 'date': fields.date('Date', select=True, readonly=True, states={'draft':[('readonly',False)], 'confirm':[('readonly',False)]}),
'journal_id': fields.many2one('account.journal', 'Force Journal', help = "The journal used when the expense is done."),
- 'employee_id': fields.many2one('hr.employee', "Employee", required=True),
+ 'employee_id': fields.many2one('hr.employee', "Employee", required=True, readonly=True, states={'draft':[('readonly',False)], 'confirm':[('readonly',False)]}),
'user_id': fields.many2one('res.users', 'User', required=True),
'date_confirm': fields.date('Confirmation Date', select=True, help="Date of the confirmation of the sheet expense. It's filled when the button Confirm is pressed."),
'date_valid': fields.date('Validation Date', select=True, help="Date of the acceptation of the sheet expense. It's filled when the button Accept is pressed."),
- 'user_valid': fields.many2one('res.users', 'Validation By'),
+ 'user_valid': fields.many2one('res.users', 'Validation By', readonly=True, states={'draft':[('readonly',False)], 'confirm':[('readonly',False)]}),
'account_move_id': fields.many2one('account.move', 'Ledger Posting'),
'line_ids': fields.one2many('hr.expense.line', 'expense_id', 'Expense Lines', readonly=True, states={'draft':[('readonly',False)]} ),
'note': fields.text('Note'),
'amount': fields.function(_amount, string='Total Amount', digits_compute= dp.get_precision('Account')),
'voucher_id': fields.many2one('account.voucher', "Employee's Receipt"),
- 'currency_id': fields.many2one('res.currency', 'Currency', required=True),
- 'department_id':fields.many2one('hr.department','Department'),
+ 'currency_id': fields.many2one('res.currency', 'Currency', required=True, readonly=True, states={'draft':[('readonly',False)], 'confirm':[('readonly',False)]}),
+ 'department_id':fields.many2one('hr.department','Department', readonly=True, states={'draft':[('readonly',False)], 'confirm':[('readonly',False)]}),
'company_id': fields.many2one('res.company', 'Company', required=True),
'state': fields.selection([
('draft', 'New'),
@@ -100,6 +100,12 @@ class hr_expense_expense(osv.osv):
'currency_id': _get_currency,
}
+ def unlink(self, cr, uid, ids, context=None):
+ for rec in self.browse(cr, uid, ids, context=context):
+ if rec.state != 'draft':
+ raise osv.except_osv(_('Warning!'),_('You can only delete draft expenses!'))
+ return super(hr_expense_expense, self).unlink(cr, uid, ids, context)
+
def onchange_currency_id(self, cr, uid, ids, currency_id=False, company_id=False, context=None):
res = {'value': {'journal_id': False}}
journal_ids = self.pool.get('account.journal').search(cr, uid, [('type','=','purchase'), ('currency','=',currency_id), ('company_id', '=', company_id)], context=context)
@@ -236,16 +242,6 @@ class product_product(osv.osv):
'hr_expense_ok': fields.boolean('Can be Expensed', help="Specify if the product can be selected in an HR expense line."),
}
- def on_change_hr_expense_ok(self, cr, uid, id, hr_expense_ok):
-
- if not hr_expense_ok:
- return {}
- data_obj = self.pool.get('ir.model.data')
- cat_id = data_obj._get_id(cr, uid, 'hr_expense', 'cat_expense')
- categ_id = data_obj.browse(cr, uid, cat_id).res_id
- res = {'value' : {'type':'service','sale_ok' :False,'categ_id':categ_id }}
- return res
-
product_product()
class hr_expense_line(osv.osv):
diff --git a/addons/hr_expense/hr_expense_view.xml b/addons/hr_expense/hr_expense_view.xml
index 74b77009aae..d4b7cbae1ce 100644
--- a/addons/hr_expense/hr_expense_view.xml
+++ b/addons/hr_expense/hr_expense_view.xml
@@ -195,7 +195,7 @@
-
+
diff --git a/addons/hr_holidays/hr_holidays.py b/addons/hr_holidays/hr_holidays.py
index 419b1bb8335..92b1d57ce15 100644
--- a/addons/hr_holidays/hr_holidays.py
+++ b/addons/hr_holidays/hr_holidays.py
@@ -90,6 +90,18 @@ class hr_holidays_status(osv.osv):
'color_name': 'red',
'active': True,
}
+
+ def name_get(self, cr, uid, ids, context=None):
+ if not ids:
+ return []
+ res = []
+ for record in self.browse(cr, uid, ids, context=context):
+ name = record.name
+ if not record.limit:
+ name = name + (' (%d/%d)' % (record.leaves_taken or 0.0, record.max_leaves or 0.0))
+ res.append((record.id, name))
+ return res
+
hr_holidays_status()
class hr_holidays(osv.osv):
diff --git a/addons/hr_holidays/report/holidays_summary_report.py b/addons/hr_holidays/report/holidays_summary_report.py
index 8a782075853..cadd3a22ce6 100644
--- a/addons/hr_holidays/report/holidays_summary_report.py
+++ b/addons/hr_holidays/report/holidays_summary_report.py
@@ -31,6 +31,7 @@ import time
from report import report_sxw
from tools import ustr
from tools.translate import _
+from tools import to_xml
def lengthmonth(year, month):
if month == 2 and ((year % 4 == 0) and ((year % 100 != 0) or (year % 400 == 0))):
@@ -240,7 +241,7 @@ class report_custom(report_rml):
%s
%s
- ''' % (str(rml_obj.formatLang(time.strftime("%Y-%m-%d"),date=True))+' ' + str(time.strftime("%H:%M")),pooler.get_pool(cr.dbname).get('res.users').browse(cr,uid,uid).company_id.name)
+ ''' % (str(rml_obj.formatLang(time.strftime("%Y-%m-%d"),date=True))+' ' + str(time.strftime("%H:%M")),to_xml(pooler.get_pool(cr.dbname).get('res.users').browse(cr,uid,uid).company_id.name))
# Computing the xml
xml='''
diff --git a/addons/hr_payroll/hr_payroll.py b/addons/hr_payroll/hr_payroll.py
index 53c84c65ee6..c0e4bc39321 100644
--- a/addons/hr_payroll/hr_payroll.py
+++ b/addons/hr_payroll/hr_payroll.py
@@ -326,6 +326,7 @@ class hr_payslip(osv.osv):
return self.write(cr, uid, ids, {'paid': True, 'state': 'done'}, context=context)
def hr_verify_sheet(self, cr, uid, ids, context=None):
+ self.compute_sheet(cr, uid, ids, context)
return self.write(cr, uid, ids, {'state': 'verify'}, context=context)
def refund_sheet(self, cr, uid, ids, context=None):
@@ -358,6 +359,12 @@ class hr_payslip(osv.osv):
def check_done(self, cr, uid, ids, context=None):
return True
+ def unlink(self, cr, uid, ids, context=None):
+ for payslip in self.browse(cr, uid, ids, context=context):
+ if payslip.state not in ['draft','cancel']:
+ raise osv.except_osv(_('Warning!'),_('You cannot delete a payslip which is not draft or cancelled!'))
+ return super(hr_payslip, self).unlink(cr, uid, ids, context)
+
#TODO move this function into hr_contract module, on hr.employee object
def get_contract(self, cr, uid, employee, date_from, date_to, context=None):
"""
diff --git a/addons/hr_payroll/hr_payroll_demo.xml b/addons/hr_payroll/hr_payroll_demo.xml
index 836814860c1..a22809b00e3 100644
--- a/addons/hr_payroll/hr_payroll_demo.xml
+++ b/addons/hr_payroll/hr_payroll_demo.xml
@@ -75,7 +75,7 @@
fix
- worked_days.WORK100.number_of_days
+ worked_days.WORK100 and worked_days.WORK100.number_of_days
MA
@@ -89,7 +89,7 @@
Get 1% of sales
- result = (inputs.SALEURO.amount + inputs.SALASIA.amount) * 0.01
+ result = ((inputs.SALEURO and inputs.SALEURO.amount) + (inputs.SALASIA and inputs.SALASIA.amount)) * 0.01
diff --git a/addons/hr_recruitment/hr_recruitment_view.xml b/addons/hr_recruitment/hr_recruitment_view.xml
index 03561da569e..0dd58937306 100644
--- a/addons/hr_recruitment/hr_recruitment_view.xml
+++ b/addons/hr_recruitment/hr_recruitment_view.xml
@@ -106,7 +106,7 @@
@@ -84,7 +89,6 @@
form
tree,form
- {'search_default_to_read_message':True}
diff --git a/addons/mail/mail_thread.py b/addons/mail/mail_thread.py
index f3203336615..ee00b88dbd9 100644
--- a/addons/mail/mail_thread.py
+++ b/addons/mail/mail_thread.py
@@ -74,17 +74,17 @@ class mail_thread(osv.AbstractModel):
- message_unread: has uid unread message for the document
- message_summary: html snippet summarizing the Chatter for kanban views """
res = dict((id, dict(message_unread=False, message_summary='')) for id in ids)
+ user_pid = self.pool.get('res.users').read(cr, uid, uid, ['partner_id'], context=context)['partner_id'][0]
- # search for unread messages, by reading directly mail.notification, as SUPERUSER
- notif_obj = self.pool.get('mail.notification')
- notif_ids = notif_obj.search(cr, SUPERUSER_ID, [
- ('partner_id.user_ids', 'in', [uid]),
- ('message_id.res_id', 'in', ids),
- ('message_id.model', '=', self._name),
- ('read', '=', False)
- ], context=context)
- for notif in notif_obj.browse(cr, SUPERUSER_ID, notif_ids, context=context):
- res[notif.message_id.res_id]['message_unread'] = True
+ # search for unread messages, directly in SQL to improve performances
+ cr.execute(""" SELECT m.res_id FROM mail_message m
+ RIGHT JOIN mail_notification n
+ ON (n.message_id = m.id AND n.partner_id = %s AND n.read = False)
+ WHERE m.model = %s AND m.res_id in %s""",
+ (user_pid, self._name, tuple(ids),))
+ msg_ids = [result[0] for result in cr.fetchall()]
+ for msg_id in msg_ids:
+ res[msg_id]['message_unread'] = True
for thread in self.browse(cr, uid, ids, context=context):
cls = res[thread.id]['message_unread'] and ' class="oe_kanban_mail_new"' or ''
diff --git a/addons/mail/mail_thread_view.xml b/addons/mail/mail_thread_view.xml
index 07b24725b05..cdeade04d84 100644
--- a/addons/mail/mail_thread_view.xml
+++ b/addons/mail/mail_thread_view.xml
@@ -4,48 +4,126 @@
Inbox
mail.wall
-
+ mail.message
+ {
+ 'default_model': 'res.users',
+ 'default_res_id': uid
+ }
+
+
+
+ Good Job! Your inbox is empty.
+
+ Your inbox contains private messages or emails sent to you
+ as well as information related to documents or people you
+ follow.
+
+
To: me
mail.wall
-
+ mail.message
+ {
+ 'default_model': 'res.users',
+ 'default_res_id': uid,
+ 'search_default_message_unread': True
+ }
+
+
+
+ No private message.
+
+ This list contains messages sent to you.
+
+
- Favorites
+ Todo
mail.wall
-
+ mail.message
+ {
+ 'default_model': 'res.users',
+ 'default_res_id': uid,
+ 'search_default_message_unread': True
+ }
+
+
+
+ No todo!
+
+ When you process messages in your inbox, you can mark some
+ as todo. From this menu, you can process all your todo.
+
+
Archives
mail.wall
-
+ {
+ 'default_model': 'res.users',
+ 'default_res_id': uid,
+ 'search_default_message_read': True
+ }
+
+
+
+ No message found.
+
+
Sent
mail.wall
-
+ {
+ 'default_model': 'res.users',
+ 'default_res_id': uid
+ }
+
+
+
+ No message sent yet.
+
+ Click on the top-right icon to compose a message. This
+ message will be sent by email if it's an internal contact.
+
+
-
-
+
@@ -61,7 +139,7 @@
- Favorites
+ Todo
diff --git a/addons/mail/static/src/css/mail.css b/addons/mail/static/src/css/mail.css
index af3cc3ed359..eb668162e30 100644
--- a/addons/mail/static/src/css/mail.css
+++ b/addons/mail/static/src/css/mail.css
@@ -1,7 +1,36 @@
+/* ------------ TOPBAR MAIL BUTTON --------------- */
+
+/* FIXME this css is not very pretty because it uses a
+ * 'button' element wich comes with a lot of inappropriate
+ * styling. Entypo is also a headache to center properly
+ * */
+
+.openerp .oe_topbar_item.oe_topbar_compose_full_email{
+ padding: 0px;
+ width: 32px;
+ height: 32px;
+}
+.openerp .oe_topbar_item.oe_topbar_compose_full_email button{
+ position: relative;
+ top: -3px; /* centering entypo ... urgh */
+ box-sizing: border-box;
+ border: none;
+ box-shadow: none;
+ color: white;
+ background: none;
+ text-shadow: 0px 1px 2px black;
+ width: 32px;
+ height: 32px;
+ padding: 0px;
+ margin: 0px
+ border-radius: 0px;
+}
/* ------------ MAIL WIDGET --------------- */
.openerp .oe_mail, .openerp .oe_mail *{
- box-sizing: border-box;
+ -webkit-box-sizing: border-box;
+ -moz-box-sizing: border-box;
+ box-sizing: border-box;
}
.openerp .oe_mail {
display: block;
@@ -42,9 +71,10 @@
}
.openerp .oe_mail .oe_msg .oe_msg_footer{
padding-left: 4px;
+ padding-top: 3px;
overflow: hidden;
- opacity:0.8;
- -webkit-transition: opacity 0.2s linear;
+ margin-bottom: 4px;
+ font-size: 11px;
}
.openerp .oe_mail .oe_msg .oe_msg_content{
display: block;
@@ -80,18 +110,24 @@
.openerp .oe_mail .oe_msg.oe_msg_indented .oe_msg_content{
padding-top:2px;
}
+.openerp .oe_mail .oe_msg.oe_msg_indented .oe_msg_footer{
+ margin-bottom: 0px;
+}
+
/* b) Votes (likes) */
+
.openerp .oe_mail .oe_mail_vote_count{
display: inline;
position: relative;
- background: #7C7BAD;
- color: white;
+ background: white;
+ box-shadow: 0px 0px 0px 1px rgba(124, 123, 173, 0.36) inset;
+ color: #7c7bad;
text-shadow: none;
border-radius: 3px;
margin: 0px;
padding-left: 3px;
- padding-right: 18px;
- margin-right: 3px;
+ padding-right: 15px;
+ margin-right: 5px;
}
.openerp .oe_mail .oe_mail_vote_count .oe_e{
position: absolute;
@@ -102,12 +138,6 @@
/* c) Message action icons */
-.openerp .oe_mail .oe_msg.oe_msg_unread .oe_unread{
- display:none;
-}
-.openerp .oe_mail .oe_msg.oe_msg_read .oe_read{
- display:none;
-}
.openerp .oe_mail .oe_msg .oe_msg_icons{
float: right;
margin-top: 4px;
@@ -115,6 +145,9 @@
margin-left: 8px;
height: 24px;
-webkit-user-select: none;
+ -moz-user-select: none;
+ -ms-user-select: none;
+ user-select: none;
}
.openerp .oe_mail .oe_msg .oe_msg_icons span{
float:right;
@@ -128,10 +161,16 @@
color: #FFF;
text-shadow: 0px 1px #AAA,0px -1px #AAA, -1px 0px #AAA, 1px 0px #AAA, 0px 3px 3px rgba(0,0,0,0.1);
-webkit-transition: all 0.2s linear;
+ -moz-transition: all 0.2s linear;
+ -o-transition: all 0.2s linear;
+ transition: all 0.2s linear;
}
.openerp .oe_mail .oe_msg:hover .oe_msg_icons a{
opacity: 1;
-webkit-transition: all 0.1s linear;
+ -moz-transition: all 0.1s linear;
+ -o-transition: all 0.1s linear;
+ transition: all 0.1s linear;
}
.openerp .oe_mail .oe_msg .oe_msg_icons .oe_star:hover a{
color: #FFF6C0;
@@ -155,7 +194,7 @@
}
.openerp .oe_mail .oe_msg .oe_msg_content textarea{
width: 100%;
- height: 32px;
+ height: 64px;
margin: 0px;
padding: 0px;
resize: vertical;
@@ -171,6 +210,150 @@
width: 100%;
}
+/* --------------------- ATTACHMENTS --------------------- */
+
+.openerp .oe_mail .oe_msg_attachment_list{
+ display: none;
+ margin-top: 12px;
+ margin-bottom: 12px;
+}
+.openerp .oe_mail .oe_msg_composer .oe_msg_attachment_list{
+ display: block;
+}
+.openerp .oe_mail .oe_attachment{
+ display: inline-block;
+ width: 100px;
+ margin: 2px;
+ min-height: 80px;
+ position: relative;
+ border-radius: 3px;
+ text-align: center;
+ vertical-align: top;
+}
+.openerp .oe_mail .oe_attachment .oe_name{
+ display: inline-block;
+ max-width: 100%;
+ padding: 1px 3px;
+ margin-top: 50px;
+ margin-bottom: 5px;
+ background: rgba(124, 123, 173, 0.13);
+ overflow: hidden;
+ color: #4c4c4c;
+ text-shadow: none;
+ border-radius: 3px;
+}
+
+.openerp .oe_mail .oe_attachment.oe_preview{
+ background: url( data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAJ0lEQVQYV2MsLS39z4AGLCws0IUYGIeCwrVr12J45sSJE5ieGQIKAbuZKf/EMCs7AAAAAElFTkSuQmCC );
+}
+.openerp .oe_mail .oe_attachment .oe_progress_bar{
+ display: none;
+ position: absolute;
+ top: 18px;
+ left: 16px;
+ right: 16px;
+ height: 17px;
+ line-height: 13px;
+ padding: 0px;
+ background: #4BBD00;
+ color: white;
+ text-align: center;
+ border-radius: 3px;
+ border: solid 1px rgba(0,0,0,0.2);
+ box-shadow: 0px 3px 10px rgba(0, 0, 0, 0.34);
+ -webkit-animation: oe_mail_attach_loading_anim 0.75s infinite linear;
+ -moz-animation: oe_mail_attach_loading_anim 0.75s infinite linear;
+ -o-animation: oe_mail_attach_loading_anim 0.75s infinite linear;
+ animation: oe_mail_attach_loading_anim 0.75s infinite linear;
+}
+.openerp .oe_mail .oe_attachment.oe_uploading .oe_progress_bar{
+ display: block;
+}
+@-webkit-keyframes oe_mail_attach_loading_anim{
+ 0% { background: #4BBD00 }
+ 50% { background: #009123 }
+ 100% { background: #4BBD00 }
+}
+@-moz-keyframes oe_mail_attach_loading_anim{
+ 0% { background: #4BBD00 }
+ 50% { background: #009123 }
+ 100% { background: #4BBD00 }
+}
+@-o-keyframes oe_mail_attach_loading_anim{
+ 0% { background: #4BBD00 }
+ 50% { background: #009123 }
+ 100% { background: #4BBD00 }
+}
+@keyframes oe_mail_attach_loading_anim{
+ 0% { background: #4BBD00 }
+ 50% { background: #009123 }
+ 100% { background: #4BBD00 }
+}
+.openerp .oe_mail .oe_attachment.oe_preview .oe_name{
+ position: absolute;
+ bottom: 0px;
+ margin: 0px;
+ left: 0px;
+ right: 0px;
+ max-height: 64px;
+ background: rgba(0,0,0,0.8);
+ color: white;
+ border-top-left-radius: 0px;
+ border-top-right-radius: 0px;
+ opacity: 0;
+ -webkit-transition: opacity 0.2s linear;
+ -moz-transition: opacity 0.2s linear;
+ -o-transition: opacity 0.2s linear;
+ transition: opacity 0.2s linear;
+}
+.openerp .oe_mail .oe_attachment.oe_preview:hover .oe_name{
+ opacity: 1;
+ -webkit-transition: opacity 0.2s linear;
+ -moz-transition: opacity 0.2s linear;
+ -o-transition: opacity 0.2s linear;
+ transition: opacity 0.2s linear;
+}
+.openerp .oe_mail .oe_attachment img{
+ position: absolute;
+ width: 48px;
+ height: 48px;
+ top: 0px;
+ left: 50%;
+ margin-left: -24px;
+}
+.openerp .oe_mail .oe_attachment.oe_preview img{
+ display: block;
+ position: relative;
+ margin:0px;
+ width: 100px;
+ height: 100px;
+ border-radius: 3px;
+ margin-left: -50px;
+}
+.openerp .oe_mail .oe_attachment .oe_delete{
+ display: none;
+}
+.openerp .oe_mail .oe_msg_composer .oe_attachment .oe_delete{
+ display: block;
+ position: absolute;
+ top: -7px;
+ right: 0px;
+ color: black;
+ text-shadow: 1px 0px white, -1px 0px white, 0px 1px white, 0px -1px white;
+ cursor: pointer;
+ opacity: 0;
+ -webkit-transition: opacity 0.2s linear;
+ -moz-transition: opacity 0.2s linear;
+ -o-transition: opacity 0.2s linear;
+ transition: opacity 0.2s linear;
+}
+.openerp .oe_mail .oe_msg_composer .oe_attachment:hover .oe_delete{
+ opacity: 1;
+ -webkit-transition: opacity 0.2s linear;
+ -moz-transition: opacity 0.2s linear;
+ -o-transition: opacity 0.2s linear;
+ transition: opacity 0.2s linear;
+}
/* ---------------- MESSAGE QUICK COMPOSER --------------- */
.openerp .oe_mail .oe_msg_composer .oe_msg_footer{
@@ -178,37 +361,6 @@
padding-top: 2px;
padding-bottom:6px;
}
-.openerp .oe_mail .oe_msg_attachments.oe_hidden,
-.openerp .oe_mail .oe_msg_images.oe_hidden{
- margin:0px;
- border: none;
- display: none;
-}
-.openerp .oe_mail .oe_msg_attachments{
- margin-bottom: 4px;
- margin-right: 0px;
- font-size: 12px;
- border-radius: 2px;
- border: solid 1px rgba(124,123,173,0.14);
-}
-.openerp .oe_mail .oe_msg_attachments .oe_attachment{
- padding: 2px;
- padding-left: 4px;
- padding-right: 4px;
-}
-.openerp .oe_mail .oe_msg_attachments .oe_attachment .oe_e{
- font-size: 23px;
- margin-top: -5px;
-}
-.openerp .oe_mail .oe_msg_attachments .oe_attachment .oe_e:hover{
- text-decoration: none;
-}
-.openerp .oe_mail .oe_msg_attachments .oe_attachment:nth-child(odd){
- background:white;
-}
-.openerp .oe_mail .oe_msg_attachments .oe_attachment:nth-child(even){
- background: #F4F5FA;
-}
.openerp .oe_mail .oe_msg_images {
display: block;
}
@@ -222,11 +374,13 @@
.openerp .oe_mail .oe_msg_footer button.oe_attach{
width: 24px;
overflow: hidden;
+ filter:none;
}
.openerp .oe_mail .oe_msg_footer button.oe_attach .oe_e{
position: relative;
top: -1px;
left: -9px;
+ filter:none;
}
.openerp .oe_mail .oe_hidden_input_file, .openerp .oe_mail .oe_hidden_input_file form{
display:inline;
@@ -235,11 +389,13 @@
width:24px;
overflow:hidden;
float: right;
+ filter:none;
}
.openerp .oe_mail .oe_msg_footer button.oe_full .oe_e{
position: relative;
top: -1px;
left: -9px;
+ filter:none;
}
.openerp .oe_mail button.oe_attach, .openerp .oe_mail button.oe_full{
background: transparent;
@@ -247,6 +403,7 @@
box-shadow: none;
border: none;
text-shadow: none;
+ filter:none;
}
.openerp .oe_mail .oe_attach_label{
color: #7C7BAD;
@@ -258,6 +415,7 @@
height: 28px;
width: 52px;
margin-top: -6px;
+ filter:none;
}
.openerp .oe_mail .oe_mail_list_recipients{
font-size: 12px;
@@ -269,6 +427,7 @@
.openerp .oe_mail .oe_msg_content.oe_msg_more_message{
text-align: right;
+ cursor: pointer;
}
.openerp .oe_mail .oe_msg_content.oe_msg_more_message .oe_separator{
height: 0;
@@ -280,7 +439,7 @@
}
.openerp .oe_mail .oe_msg_more_message .oe_msg_fetch_more {
background: white;
- margin-right: 280px;
+ margin-right: 210px;
padding-left: 8px;
padding-right: 8px;
text-decoration: none;
@@ -298,6 +457,7 @@
padding-top: 5px;
width: 160px;
float: right;
+ margin-right: 16px;
}
/* a) THE FOLLOW BUTTON */
@@ -308,9 +468,23 @@
width:100%;
}
.openerp .oe_followers button.oe_follower.oe_following{
+ color: white;
background-color: #3465A4;
background-image: -webkit-linear-gradient(top, #729FCF, #3465A4);
+ background-image: -moz-linear-gradient(top, #729FCF, #3465A4);
+ background-image: -ms-linear-gradient(top, #729FCF, #3465A4);
+ background-image: -o-linear-gradient(top, #729FCF, #3465A4);
+ background-image: linear-gradient(to bottom, #729FCF, #3465A4);
+}
+.openerp .oe_followers button.oe_follower.oe_following:hover{
color: white;
+ filter:none;
+ background-color: #A21A1A;
+ background-image: -webkit-linear-gradient(top, #DF3F3F, #A21A1A);
+ background-image: -moz-linear-gradient(top, #DF3F3F, #A21A1A);
+ background-image: -ms-linear-gradient(top, #DF3F3F, #A21A1A);
+ background-image: -o-linear-gradient(top, #DF3F3F, #A21A1A);
+ background-image: linear-gradient(to bottom, #DF3F3F, #A21A1A);
}
.openerp .oe_followers button.oe_follower .oe_follow,
@@ -371,12 +545,17 @@
.openerp .oe_record_thread{
display: block;
- margin-right: 180px;
+ margin-left: 16px;
+ margin-right: 212px;
}
/* ----------- INBOX INTEGRATION ----------- */
.openerp .oe_mail_wall .oe_mail{
margin: 16px;
- width: 720px;
+ width: 600px;
+}
+
+.openerp .oe_mail .oe_view_nocontent > p {
+ padding-left: 15px;
}
diff --git a/addons/mail/static/src/css/mail_group.css b/addons/mail/static/src/css/mail_group.css
index b700cb8c80f..467bc53d80f 100644
--- a/addons/mail/static/src/css/mail_group.css
+++ b/addons/mail/static/src/css/mail_group.css
@@ -44,20 +44,23 @@
text-align: center;
overflow: hidden;
-moz-border-radius: 3px;
+ border-collapse: separate;
-webkit-border-radius: 3px;
-o-border-radius: 3px;
-ms-border-radius: 3px;
border-radius: 3px;
+ border-collapse: separate;
-moz-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
-webkit-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
+ box-shadow: 0 1px 4px 3px rgba(0, 0, 0, 0.4);
-o-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
- -box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}
.oe_group_photo {
width: 100px;
height: 100px;
clip: rect(0px, 100px, 100px, 0px);
+ border:none;
}
.oe_group_details {
@@ -68,30 +71,31 @@
min-height: 120px;
}
-.oe_group_details a, .oe_group_details a:hover {
- font-weight: bold;
- color: #4c4c4c;
-}
-
.oe_group_details h4 {
margin: 0;
font-size: 13px;
}
-.oe_group_details h4 a {
- color: #4c4c4c;
-}
-
-.oe_group_details h4 a:hover {
- text-decoration: underline;
-}
-
.oe_group_details ul {
margin: 3px 0 5px;
padding: 0;
list-style: none;
}
-.oe_group_details li {
+.openerp .oe_group_details li {
margin: 2px 0;
}
+
+.openerp .oe_group_button {
+ padding-top: 7px;
+}
+
+.openerp .oe_group_button .oe_group_join {
+ color: white;
+ background-color: #3465A4;
+ background-image: -webkit-linear-gradient(top, #729FCF, #3465A4);
+ background-image: -moz-linear-gradient(top, #729FCF, #3465A4);
+ background-image: -ms-linear-gradient(top, #729FCF, #3465A4);
+ background-image: -o-linear-gradient(top, #729FCF, #3465A4);
+ background-image: linear-gradient(to bottom, #729FCF, #3465A4);
+}
diff --git a/addons/mail/static/src/img/mimetypes/addresses.png b/addons/mail/static/src/img/mimetypes/addresses.png
new file mode 100644
index 00000000000..586f1257196
Binary files /dev/null and b/addons/mail/static/src/img/mimetypes/addresses.png differ
diff --git a/addons/mail/static/src/img/mimetypes/archive.png b/addons/mail/static/src/img/mimetypes/archive.png
new file mode 100644
index 00000000000..704d962d426
Binary files /dev/null and b/addons/mail/static/src/img/mimetypes/archive.png differ
diff --git a/addons/mail/static/src/img/mimetypes/audio.png b/addons/mail/static/src/img/mimetypes/audio.png
new file mode 100644
index 00000000000..6dd4c635fe7
Binary files /dev/null and b/addons/mail/static/src/img/mimetypes/audio.png differ
diff --git a/addons/mail/static/src/img/mimetypes/binary.png b/addons/mail/static/src/img/mimetypes/binary.png
new file mode 100644
index 00000000000..5708c9fc2a5
Binary files /dev/null and b/addons/mail/static/src/img/mimetypes/binary.png differ
diff --git a/addons/mail/static/src/img/mimetypes/calendar.png b/addons/mail/static/src/img/mimetypes/calendar.png
new file mode 100644
index 00000000000..81791af05e0
Binary files /dev/null and b/addons/mail/static/src/img/mimetypes/calendar.png differ
diff --git a/addons/mail/static/src/img/mimetypes/certificate.png b/addons/mail/static/src/img/mimetypes/certificate.png
new file mode 100644
index 00000000000..e48cb1de432
Binary files /dev/null and b/addons/mail/static/src/img/mimetypes/certificate.png differ
diff --git a/addons/mail/static/src/img/mimetypes/disk.png b/addons/mail/static/src/img/mimetypes/disk.png
new file mode 100644
index 00000000000..9c241cdf896
Binary files /dev/null and b/addons/mail/static/src/img/mimetypes/disk.png differ
diff --git a/addons/mail/static/src/img/mimetypes/document.png b/addons/mail/static/src/img/mimetypes/document.png
new file mode 100644
index 00000000000..fee2f1619b6
Binary files /dev/null and b/addons/mail/static/src/img/mimetypes/document.png differ
diff --git a/addons/mail/static/src/img/mimetypes/font.png b/addons/mail/static/src/img/mimetypes/font.png
new file mode 100644
index 00000000000..3b04787b9f9
Binary files /dev/null and b/addons/mail/static/src/img/mimetypes/font.png differ
diff --git a/addons/mail/static/src/img/mimetypes/html.png b/addons/mail/static/src/img/mimetypes/html.png
new file mode 100644
index 00000000000..440c5bc9972
Binary files /dev/null and b/addons/mail/static/src/img/mimetypes/html.png differ
diff --git a/addons/mail/static/src/img/mimetypes/image.png b/addons/mail/static/src/img/mimetypes/image.png
new file mode 100644
index 00000000000..ab2f84a1a54
Binary files /dev/null and b/addons/mail/static/src/img/mimetypes/image.png differ
diff --git a/addons/mail/static/src/img/mimetypes/presentation.png b/addons/mail/static/src/img/mimetypes/presentation.png
new file mode 100644
index 00000000000..8642a8e9298
Binary files /dev/null and b/addons/mail/static/src/img/mimetypes/presentation.png differ
diff --git a/addons/mail/static/src/img/mimetypes/print.png b/addons/mail/static/src/img/mimetypes/print.png
new file mode 100644
index 00000000000..fee2f1619b6
Binary files /dev/null and b/addons/mail/static/src/img/mimetypes/print.png differ
diff --git a/addons/mail/static/src/img/mimetypes/script.png b/addons/mail/static/src/img/mimetypes/script.png
new file mode 100644
index 00000000000..10c58c0bcc3
Binary files /dev/null and b/addons/mail/static/src/img/mimetypes/script.png differ
diff --git a/addons/mail/static/src/img/mimetypes/spreadsheet.png b/addons/mail/static/src/img/mimetypes/spreadsheet.png
new file mode 100644
index 00000000000..77a834697f1
Binary files /dev/null and b/addons/mail/static/src/img/mimetypes/spreadsheet.png differ
diff --git a/addons/mail/static/src/img/mimetypes/text.png b/addons/mail/static/src/img/mimetypes/text.png
new file mode 100644
index 00000000000..e65d2ec5a67
Binary files /dev/null and b/addons/mail/static/src/img/mimetypes/text.png differ
diff --git a/addons/mail/static/src/img/mimetypes/unknown.png b/addons/mail/static/src/img/mimetypes/unknown.png
new file mode 100644
index 00000000000..e65d2ec5a67
Binary files /dev/null and b/addons/mail/static/src/img/mimetypes/unknown.png differ
diff --git a/addons/mail/static/src/img/mimetypes/vector.png b/addons/mail/static/src/img/mimetypes/vector.png
new file mode 100644
index 00000000000..c4595ec1b24
Binary files /dev/null and b/addons/mail/static/src/img/mimetypes/vector.png differ
diff --git a/addons/mail/static/src/img/mimetypes/video.png b/addons/mail/static/src/img/mimetypes/video.png
new file mode 100644
index 00000000000..e3a87b5bde6
Binary files /dev/null and b/addons/mail/static/src/img/mimetypes/video.png differ
diff --git a/addons/mail/static/src/img/mimetypes/webimage.png b/addons/mail/static/src/img/mimetypes/webimage.png
new file mode 100644
index 00000000000..ab2f84a1a54
Binary files /dev/null and b/addons/mail/static/src/img/mimetypes/webimage.png differ
diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js
index 7acebe9b1df..d981420db51 100644
--- a/addons/mail/static/src/js/mail.js
+++ b/addons/mail/static/src/js/mail.js
@@ -26,7 +26,8 @@ openerp.mail = function (session) {
'default_use_template', 'default_partner_ids', 'default_model',
'default_res_id', 'default_content_subtype', , 'default_subject',
'default_body', 'active_id', 'lang', 'bin_raw', 'tz',
- 'active_model', 'edi_web_url_view', 'active_ids']
+ 'active_model', 'edi_web_url_view', 'active_ids',
+ 'default_attachment_ids']
for (var key in action.context) {
if (_.indexOf(context_keys, key) == -1) {
action.context[key] = null;
@@ -54,8 +55,8 @@ openerp.mail = function (session) {
mail.ChatterUtils = {
/* Get an image in /web/binary/image?... */
- get_image: function (session, model, field, id) {
- return session.prefix + '/web/binary/image?session_id=' + session.session_id + '&model=' + model + '&field=' + field + '&id=' + (id || '');
+ get_image: function (session, model, field, id, resize) {
+ return session.prefix + '/web/binary/image?session_id=' + session.session_id + '&model=' + model + '&field=' + field + '&id=' + (id || '') + '&resize=' + (resize ? encodeURIComponent(resize) : '');
},
/* Get the url of an attachment {'id': id} */
@@ -111,10 +112,265 @@ openerp.mail = function (session) {
}
return domain;
- }
+ },
+
+ // inserts zero width space between each letter of a string so that
+ // the word will correctly wrap in html boxes smaller than the text
+ breakword: function(str){
+ var out = '';
+ if (!str) {
+ return str;
+ }
+ for(var i = 0, len = str.length; i < len; i++){
+ out += _.str.escapeHTML(str[i]) + '';
+ }
+ return out;
+ },
+
+ // returns the file type of a file based on its extension
+ // As it only looks at the extension it is quite approximative.
+ filetype: function(url){
+ url = url.filename || url;
+ var tokens = url.split('.');
+ if(tokens.length <= 1){
+ return 'unknown';
+ }
+ var extension = tokens[tokens.length -1];
+ if(extension.length === 0){
+ return 'unknown';
+ }else{
+ extension = extension.toLowerCase();
+ }
+ var filetypes = {
+ 'webimage': ['png','jpg','jpeg','jpe','gif'], // those have browser preview
+ 'image': ['tif','tiff','tga',
+ 'bmp','xcf','psd','ppm','pbm','pgm','pnm','mng',
+ 'xbm','ico','icon','exr','webp','psp','pgf','xcf',
+ 'jp2','jpx','dng','djvu','dds'],
+ 'vector': ['ai','svg','eps','vml','cdr','xar','cgm','odg','sxd'],
+ 'print': ['dvi','pdf','ps'],
+ 'document': ['doc','docx','odm','odt'],
+ 'presentation': ['key','keynote','odp','pps','ppt'],
+ 'font': ['otf','ttf','woff','eot'],
+ 'archive': ['zip','7z','ace','apk','bzip2','cab','deb','dmg','gzip','jar',
+ 'rar','tar','gz','pak','pk3','pk4','lzip','lz','rpm'],
+ 'certificate': ['cer','key','pfx','p12','pem','crl','der','crt','csr'],
+ 'audio': ['aiff','wav','mp3','ogg','flac','wma','mp2','aac',
+ 'm4a','ra','mid','midi'],
+ 'video': ['asf','avi','flv','mkv','m4v','mpeg','mpg','mpe','wmv','mp4','ogm'],
+ 'text': ['txt','rtf','ass'],
+ 'html': ['html','xhtml','xml','htm','css'],
+ 'disk': ['iso','nrg','img','ccd','sub','cdi','cue','mds','mdx'],
+ 'script': ['py','js','c','cc','cpp','cs','h','java','bat','sh',
+ 'd','rb','pl','as','cmd','coffee','m','r','vbs','lisp'],
+ 'spreadsheet': ['123','csv','ods','numbers','sxc','xls','vc','xlsx'],
+ 'binary': ['exe','com','bin','app'],
+ };
+ for(filetype in filetypes){
+ var ext_list = filetypes[filetype];
+ for(var i = 0, len = ext_list.length; i < len; i++){
+ if(extension === ext_list[i]){
+ return filetype;
+ }
+ }
+ }
+ return 'unknown';
+ },
+
};
+ /**
+ * ------------------------------------------------------------
+ * MessageCommon
+ * ------------------------------------------------------------
+ *
+ * Common base for expandables, chatter messages and composer. It manages
+ * the various variables common to those models.
+ */
+
+ mail.MessageCommon = session.web.Widget.extend({
+
+ /**
+ * ------------------------------------------------------------
+ * FIXME: this comment was moved as is from the ThreadMessage Init as
+ * part of a refactoring. Check that it is still correct
+ * ------------------------------------------------------------
+ * This widget handles the display of a messages in a thread.
+ * Displays a record and performs some formatting on the record :
+ * - record.date: formatting according to the user timezone
+ * - record.timerelative: relative time givein by timeago lib
+ * - record.avatar: image url
+ * - record.attachment_ids[].url: url of each attachmentThe
+ * thread view :
+ * - root thread
+ * - - sub message (parent_id = root message)
+ * - - - sub thread
+ * - - - - sub sub message (parent id = sub thread)
+ * - - sub message (parent_id = root message)
+ * - - - sub thread
+ */
+
+ init: function (parent, datasets, options) {
+ this._super(parent, options);
+
+ // record options
+ this.options = datasets.options || options || {};
+ // record domain and context
+ this.domain = datasets.domain || options.domain || [];
+ this.context = _.extend({
+ default_model: false,
+ default_res_id: 0,
+ default_parent_id: false }, options.context || {});
+
+ // data of this message
+ this.id = datasets.id || false,
+ this.last_id = this.id,
+ this.model = datasets.model || this.context.default_model || false,
+ this.res_id = datasets.res_id || this.context.default_res_id || false,
+ this.parent_id = datasets.parent_id || false,
+ this.type = datasets.type || false,
+ this.is_author = datasets.is_author || false,
+ this.is_private = datasets.is_private || false,
+ this.subject = datasets.subject || false,
+ this.name = datasets.name || false,
+ this.record_name = datasets.record_name || false,
+ this.body = datasets.body || false,
+ this.vote_nb = datasets.vote_nb || 0,
+ this.has_voted = datasets.has_voted || false,
+ this.is_favorite = datasets.is_favorite || false,
+ this.thread_level = datasets.thread_level || 0,
+ this.to_read = datasets.to_read || false,
+ this.author_id = datasets.author_id || false,
+ this.attachment_ids = datasets.attachment_ids || [],
+ this.partner_ids = datasets.partner_ids || [];
+ this._date = datasets.date;
+
+ this.format_data();
+
+ // record options and data
+ this.show_record_name = this.record_name && !this.thread_level && this.model != 'res.partner';
+ this.options.show_read = false;
+ this.options.show_unread = false;
+ if (this.options.show_read_unread_button) {
+ if (this.options.read_action == 'read') this.options.show_read = true;
+ else if (this.options.read_action == 'unread') this.options.show_unread = true;
+ else {
+ this.options.show_read = this.to_read;
+ this.options.show_unread = !this.to_read;
+ this.options.rerender = true;
+ this.options.toggle_read = true;
+ }
+ }
+ this.parent_thread = parent.messages != undefined ? parent : this.options.root_thread;
+ this.thread = false;
+ },
+
+ /* Convert date, timerelative and avatar in displayable data. */
+ format_data: function () {
+
+ //formating and add some fields for render
+ if (this._date) {
+ this.date = session.web.format_value(this._date, {type:"datetime"});
+ this.timerelative = $.timeago(this.date);
+ }
+ if (this.type == 'email' && (!this.author_id || !this.author_id[0])) {
+ this.avatar = ('/mail/static/src/img/email_icon.png');
+ } else if (this.author_id && this.template != 'mail.compose_message') {
+ this.avatar = mail.ChatterUtils.get_image(this.session, 'res.partner', 'image_small', this.author_id[0]);
+ } else {
+ this.avatar = mail.ChatterUtils.get_image(this.session, 'res.users', 'image_small', this.session.uid);
+ }
+
+ },
+
+
+ /* upload the file on the server, add in the attachments list and reload display
+ */
+ display_attachments: function () {
+ for (var l in this.attachment_ids) {
+ var attach = this.attachment_ids[l];
+ if (!attach.formating) {
+ attach.url = mail.ChatterUtils.get_attachment_url(this.session, attach);
+ attach.filetype = mail.ChatterUtils.filetype(attach.filename);
+ attach.name = mail.ChatterUtils.breakword(attach.name || attach.filename);
+ attach.formating = true;
+ }
+ }
+ this.$(".oe_msg_attachment_list").html( session.web.qweb.render('mail.thread.message.attachments', {'widget': this}) );
+ },
+
+ /* return the link to resized image
+ */
+ attachments_resize_image: function (id, resize) {
+ return mail.ChatterUtils.get_image(this.session, 'ir.attachment', 'datas', id, resize);
+ },
+
+ /* get all child message id linked.
+ * @return array of id
+ */
+ get_child_ids: function () {
+ return _.map(this.get_childs(), function (val) { return val.id; });
+ },
+
+ /* get all child message linked.
+ * @return array of message object
+ */
+ get_childs: function (nb_thread_level) {
+ var res=[];
+ if (arguments[1] && this.id) res.push(this);
+ if ((isNaN(nb_thread_level) || nb_thread_level>0) && this.thread) {
+ _(this.thread.messages).each(function (val, key) {
+ res = res.concat( val.get_childs((isNaN(nb_thread_level) ? undefined : nb_thread_level-1), true) );
+ });
+ }
+ return res;
+ },
+
+ /**
+ * search a message in all thread and child thread.
+ * This method return an object message.
+ * @param {object}{int} option.id
+ * @param {object}{string} option.model
+ * @param {object}{boolean} option._go_thread_wall
+ * private for check the top thread
+ * @return thread object
+ */
+ browse_message: function (options) {
+ // goto the wall thread for launch browse
+ if (!options._go_thread_wall) {
+ options._go_thread_wall = true;
+ for (var i in this.options.root_thread.messages) {
+ var res=this.options.root_thread.messages[i].browse_message(options);
+ if (res) return res;
+ }
+ }
+
+ if (this.id==options.id)
+ return this;
+
+ for (var i in this.thread.messages) {
+ if (this.thread.messages[i].thread) {
+ var res=this.thread.messages[i].browse_message(options);
+ if (res) return res;
+ }
+ }
+
+ return false;
+ },
+
+ /**
+ * call on_message_delete on his parent thread
+ */
+ destroy: function () {
+
+ this._super();
+ this.parent_thread.on_message_detroy(this);
+
+ }
+
+ });
+
/**
* ------------------------------------------------------------
* ComposeMessage widget
@@ -126,7 +382,7 @@ openerp.mail = function (session) {
* When the user focuses the textarea, the compose message is instantiated.
*/
- mail.ThreadComposeMessage = session.web.Widget.extend({
+ mail.ThreadComposeMessage = mail.MessageCommon.extend({
template: 'mail.compose_message',
/**
@@ -138,45 +394,22 @@ openerp.mail = function (session) {
*/
init: function (parent, datasets, options) {
- var self = this;
- this._super(parent);
- this.context = options.context || {};
- this.options = options.options;
-
+ this._super(parent, datasets, options);
this.show_compact_message = false;
-
- // data of this compose message
- this.attachment_ids = [];
- this.id = datasets.id;
- this.model = datasets.model;
- this.res_model = datasets.res_model;
- this.is_private = datasets.is_private || false;
- this.partner_ids = datasets.partner_ids || [];
- this.avatar = mail.ChatterUtils.get_image(this.session, 'res.users', 'image_small', this.session.uid);
- this.thread_level = datasets.thread_level;
- this.parent_thread= parent.messages!= undefined ? parent : false;
-
- this.ds_attachment = new session.web.DataSetSearch(this, 'ir.attachment');
this.show_delete_attachment = true;
-
- this.fileupload_id = _.uniqueId('oe_fileupload_temp');
- $(window).on(self.fileupload_id, self.on_attachment_loaded);
},
start: function () {
+ this._super.apply(this, arguments);
+
+ this.ds_attachment = new session.web.DataSetSearch(this, 'ir.attachment');
+ this.fileupload_id = _.uniqueId('oe_fileupload_temp');
+ $(window).on(this.fileupload_id, this.on_attachment_loaded);
+
this.display_attachments();
this.bind_events();
},
- /* upload the file on the server, add in the attachments list and reload display
- */
- display_attachments: function () {
- this.$(".oe_msg_attachment_list").html(
- session.web.qweb.render('mail.thread.message.attachments', {'widget': this}) );
- // event: delete an attachment
- this.$(".oe_msg_attachment_list").on('click', '.oe_mail_attachment_delete', this.on_attachment_delete);
- },
-
/* when a user click on the upload button, send file read on_attachment_loaded
*/
on_attachment_change: function (event) {
@@ -263,24 +496,31 @@ openerp.mail = function (session) {
this.$('textarea.oe_compact').on('focus', _.bind( this.on_compose_expandable, this));
// set the function called when attachments are added
- this.$el.on('change', 'input.oe_form_binary_file', _.bind( this.on_attachment_change, this) );
+ this.$('input.oe_form_binary_file').on('change', _.bind( this.on_attachment_change, this) );
- this.$el.on('click', '.oe_cancel', _.bind( this.on_cancel, this) );
- this.$el.on('click', '.oe_post', _.bind( this.on_message_post, this) );
- this.$el.on('click', '.oe_full', _.bind( this.on_compose_fullmail, this, 'reply') );
+ this.$('.oe_cancel').on('click', _.bind( this.on_cancel, this) );
+ this.$('.oe_post').on('click', _.bind( this.on_message_post, this) );
+ this.$('.oe_full').on('click', _.bind( this.on_compose_fullmail, this, this.id ? 'reply' : 'comment') );
/* stack for don't close the compose form if the user click on a button */
- this.$el.on('mousedown', '.oe_msg_footer', _.bind( function () { this.stay_open = true; }, this));
- this.$('textarea:not(.oe_compact):first').on('focus, mouseup, keydown', _.bind( function () { this.stay_open = false; }, this));
- this.$('textarea:not(.oe_compact):first').autosize();
+ this.$('.oe_msg_footer').on('mousedown', _.bind( function () { this.stay_open = true; }, this));
+ var ev_stay = {};
+ ev_stay.mouseup = ev_stay.keydown = ev_stay.focus = function () { self.stay_open = false; };
+ this.$('textarea:not(.oe_compact)').on(ev_stay);
+ this.$('textarea:not(.oe_compact)').autosize();
// auto close
- this.$el.on('blur', 'textarea:not(.oe_compact):first', _.bind( this.on_compose_expandable, this));
+ this.$('textarea:not(.oe_compact)').on('blur', _.bind( this.on_compose_expandable, this));
+
+ // event: delete child attachments off the oe_msg_attachment_list box
+ this.$(".oe_msg_attachment_list").on('click', '.oe_delete', this.on_attachment_delete);
},
on_compose_fullmail: function (default_composition_mode) {
if (default_composition_mode == 'reply') {
var context = {
+ 'default_model': this.context.default_model,
+ 'default_res_id': this.context.default_res_id,
'default_composition_mode': default_composition_mode,
'default_parent_id': this.id,
'default_body': mail.ChatterUtils.get_text2html(this.$el ? (this.$el.find('textarea:not(.oe_compact)').val() || '') : ''),
@@ -359,8 +599,13 @@ openerp.mail = function (session) {
this.parent_thread.context
]).done(function (record) {
var thread = self.parent_thread;
+
+ if (self.options.display_indented_thread < self.thread_level && thread.parent_message) {
+ thread = thread.parent_message.parent_thread;
+ }
// create object and attach to the thread object
- thread.message_fetch(false, false, [record], function (arg, data) {
+ thread.message_fetch([['id', 'child_of', [self.id]]], false, [record], function (arg, data) {
+ data[0].no_sorted = true;
var message = thread.create_message_object( data[0] );
// insert the message on dom
thread.insert_message( message, self.$el );
@@ -419,30 +664,16 @@ openerp.mail = function (session) {
* - - visible message
* - - expandable
*/
- mail.ThreadExpandable = session.web.Widget.extend({
+ mail.ThreadExpandable = mail.MessageCommon.extend({
template: 'mail.thread.expandable',
- init: function (parent, datasets, context) {
- this._super(parent);
- this.domain = datasets.domain || [];
- this.options = datasets.options;
- this.context = _.extend({
- default_model: 'mail.thread',
- default_res_id: 0,
- default_parent_id: false }, context || {});
-
- // data of this expandable message
- this.id = datasets.id || -1,
- this.model = datasets.model || false,
- this.parent_id = datasets.parent_id || false,
- this.nb_messages = datasets.nb_messages || 0,
- this.thread_level = datasets.thread_level || 0,
- this.type = 'expandable',
- this.max_limit = this.id < 0 || false,
- this.flag_used = false,
- this.parent_thread= parent.messages!= undefined ? parent : this.options._parents[0];
+ init: function (parent, datasets, options) {
+ this._super(parent, datasets, options);
+ this.type = 'expandable';
+ this.max_limit = datasets.max_limit;
+ this.nb_messages = datasets.nb_messages;
+ this.flag_used = false;
},
-
start: function () {
this._super.apply(this, arguments);
@@ -460,7 +691,7 @@ openerp.mail = function (session) {
* Bind events in the widget. Each event is slightly described
* in the function. */
bind_events: function () {
- this.$el.on('click', 'a.oe_msg_fetch_more', this.on_expandable);
+ this.$('.oe_msg_more_message').on('click', this.on_expandable);
},
animated_destroy: function (fadeTime) {
@@ -480,154 +711,36 @@ openerp.mail = function (session) {
}
this.flag_used = true;
- this.animated_destroy(200);
- this.parent_thread.message_fetch(this.domain, this.context);
+ var self = this;
+
+ // read messages
+ self.parent_thread.message_fetch(this.domain, this.context, false, function (arg, data) {
+ // insert the message on dom after this message
+ self.id = false;
+ self.parent_thread.switch_new_message( data, self.$el );
+ self.animated_destroy(200);
+ });
+
return false;
},
- /**
- * call on_message_delete on his parent thread
- */
- destroy: function () {
-
- this._super();
- this.parent_thread.on_message_detroy(this);
-
- }
});
- /**
- * ------------------------------------------------------------
- * Thread Message Widget
- * ------------------------------------------------------------
- * This widget handles the display of a messages in a thread.
- * Displays a record and performs some formatting on the record :
- * - record.date: formatting according to the user timezone
- * - record.timerelative: relative time givein by timeago lib
- * - record.avatar: image url
- * - record.attachment_ids[].url: url of each attachmentThe
- * thread view :
- * - root thread
- * - - sub message (parent_id = root message)
- * - - - sub thread
- * - - - - sub sub message (parent id = sub thread)
- * - - sub message (parent_id = root message)
- * - - - sub thread
- */
- mail.ThreadMessage = session.web.Widget.extend({
+ mail.ThreadMessage = mail.MessageCommon.extend({
template: 'mail.thread.message',
- /**
- * @param {Object} parent parent
- * @param {Array} [domain]
- * @param {Object} [context] context of the thread. It should
- contain at least default_model, default_res_id. Please refer to
- the ComposeMessage widget for more information about it.
- * @param {Object} [options]
- * @param {Object} [thread] read obout mail.Thread object
- * @param {Object} [message]
- * @param {Number} [truncate_limit=250] number of character to
- * display before having a "show more" link; note that the text
- * will not be truncated if it does not have 110% of the parameter
- * @param {Boolean} [show_record_name]
- *... @param {int} [show_reply_button] number thread level to display the reply button
- *... @param {int} [show_read_unread_button] number thread level to display the read/unread button
- */
- init: function (parent, datasets, context) {
- this._super(parent);
-
- // record domain and context
- this.domain = datasets.domain || [];
- this.context = _.extend({
- default_model: 'mail.thread',
- default_res_id: 0,
- default_parent_id: false }, context || {});
-
- // record options
- this.options = datasets.options;
-
- // data of this message
- this.id = datasets.id || -1,
- this.model = datasets.model || false,
- this.parent_id = datasets.parent_id || false,
- this.res_id = datasets.res_id || false,
- this.type = datasets.type || false,
- this.is_author = datasets.is_author || false,
- this.is_private = datasets.is_private || false,
- this.subject = datasets.subject || false,
- this.name = datasets.name || false,
- this.record_name = datasets.record_name || false,
- this.body = datasets.body || false,
- this.vote_nb = datasets.vote_nb || 0,
- this.has_voted = datasets.has_voted || false,
- this.is_favorite = datasets.is_favorite || false,
- this.thread_level = datasets.thread_level || 0,
- this.to_read = datasets.to_read || false,
- this.author_id = datasets.author_id || [],
- this.attachment_ids = datasets.attachment_ids || [],
- this._date = datasets.date;
-
-
- this.show_reply_button = this.options.show_compose_message && this.options.show_reply_button > this.thread_level;
- this.show_read_unread_button = this.options.show_read_unread_button > this.thread_level;
-
- // record options and data
- this.parent_thread= parent.messages!= undefined ? parent : this.options._parents[0];
- this.thread = false;
-
- if ( this.id > 0 ) {
- this.formating_data();
- }
-
- this.ds_notification = new session.web.DataSetSearch(this, 'mail.notification');
- this.ds_message = new session.web.DataSetSearch(this, 'mail.message');
- this.ds_follow = new session.web.DataSetSearch(this, 'mail.followers');
- },
-
- /* Convert date, timerelative and avatar in displayable data. */
- formating_data: function () {
-
- //formating and add some fields for render
- this.date = session.web.format_value(this._date, {type:"datetime"});
- this.timerelative = $.timeago(this.date);
- if (this.type == 'email') {
- this.avatar = ('/mail/static/src/img/email_icon.png');
- } else {
- this.avatar = mail.ChatterUtils.get_image(this.session, 'res.partner', 'image_small', this.author_id[0]);
- }
- for (var l in this.attachment_ids) {
- var attach = this.attachment_ids[l];
- attach['url'] = mail.ChatterUtils.get_attachment_url(this.session, attach);
-
- if ((attach.filename || attach.name).match(/[.](jpg|jpg|gif|png|tif|svg)$/i)) {
- attach.is_image = true;
- attach['url'] = mail.ChatterUtils.get_image(this.session, 'ir.attachment', 'datas', attach.id);
- }
- }
- },
start: function () {
this._super.apply(this, arguments);
this.expender();
- this.$el.hide().fadeIn(750, function () {$(this).css('display', '');});
- this.resize_img();
this.bind_events();
if(this.thread_level < this.options.display_indented_thread) {
this.create_thread();
}
this.$('.oe_msg_attachments, .oe_msg_images').addClass("oe_hidden");
- },
- resize_img: function () {
- var resize = function () {
- var h = $(this).height();
- var w = $(this).width();
- if ( h > 100 || w >100 ) {
- var ratio = 100 / (h > w ? h : w);
- $(this).attr("width", parseInt( w*ratio )).attr("height", parseInt( h*ratio ));
- }
- };
- this.$("img").load(resize).each(resize);
+ this.ds_notification = new session.web.DataSetSearch(this, 'mail.notification');
+ this.ds_message = new session.web.DataSetSearch(this, 'mail.message');
},
/**
@@ -635,30 +748,15 @@ openerp.mail = function (session) {
* in the function. */
bind_events: function () {
var self = this;
+ // header icons bindings
+ this.$('.oe_read').on('click', this.on_message_read);
+ this.$('.oe_unread').on('click', this.on_message_unread);
+ this.$('.oe_msg_delete').on('click', this.on_message_delete);
+ this.$('.oe_reply').on('click', this.on_message_reply);
+ this.$('.oe_star').on('click', this.on_star);
+ this.$('.oe_msg_vote').on('click', this.on_vote);
+ this.$('.oe_view_attachments').on('click', this.on_view_attachments);
- // event: click on 'Attachment(s)' in msg
- this.$('.oe_mail_msg_view_attachments').on('click', function (event) {
- var attach = self.$('.oe_msg_attachments:first, .oe_msg_images:first');
- if ( self.$('.oe_msg_attachments:first').hasClass("oe_hidden") ) {
- attach.removeClass("oe_hidden");
- } else {
- attach.addClass("oe_hidden");
- }
- self.resize_img();
- });
- // event: click on icone 'Read' in header
- this.$el.on('click', '.oe_read', this.on_message_read_unread);
- // event: click on icone 'UnRead' in header
- this.$el.on('click', '.oe_unread', this.on_message_read_unread);
- // event: click on 'Delete' in msg side menu
- this.$el.on('click', '.oe_msg_delete', this.on_message_delete);
-
- // event: click on 'Reply' in msg
- this.$el.on('click', '.oe_reply', this.on_message_reply);
- // event: click on 'Vote' button
- this.$el.on('click', '.oe_msg_vote', this.on_vote);
- // event: click on 'starred/favorite' button
- this.$el.on('click', '.oe_star', this.on_star);
},
/* Call the on_compose_message on the thread of this message. */
@@ -673,7 +771,7 @@ openerp.mail = function (session) {
this.$('.oe_msg_body:first').expander({
slicePoint: this.options.truncate_limit,
expandText: 'read more',
- userCollapseText: '[^]',
+ userCollapseText: 'read less',
detailClass: 'oe_msg_tail',
moreClass: 'oe_mail_expand',
lessClass: 'oe_mail_reduce',
@@ -717,6 +815,17 @@ openerp.mail = function (session) {
}
},
+ /* Call the on_compose_message on the thread of this message. */
+ on_view_attachments:function (event) {
+ event.stopPropagation();
+ var self = this;
+ if (!this.toggle_attachment) {
+ self.display_attachments();
+ this.toggle_attachment = true;
+ }
+ this.$('.oe_msg_attachment_list').toggle(200);
+ },
+
/**
* Wait a confirmation for delete the message on the DB.
* Make an animate destroy
@@ -732,81 +841,90 @@ openerp.mail = function (session) {
return false;
},
+ /* Check if the message must be destroy and detroy it or check for re render widget
+ * @param {callback} apply function
+ */
+ check_for_rerender: function () {
+ var self = this;
+
+ var messages = [this].concat(this.get_childs());
+ var message_ids = _.map(messages, function (msg) { return msg.id;});
+ var domain = mail.ChatterUtils.expand_domain( this.options.root_thread.domain )
+ .concat([["id", "in", message_ids ]]);
+
+ return this.parent_thread.ds_message.call('message_read', [undefined, domain, [], !!this.parent_thread.options.display_indented_thread, this.context, this.parent_thread.id])
+ .then( function (records) {
+ // remove message not loaded
+ _.map(messages, function (msg) {
+ if(!_.find(records, function (record) { return record.id == msg.id; })) {
+ msg.animated_destroy(150);
+ } else {
+ msg.renderElement();
+ msg.start()
+ }
+ });
+
+ });
+ },
+
+ on_message_read: function (event) {
+ event.stopPropagation();
+ this.on_message_read_unread(true);
+ return false;
+ },
+
+ on_message_unread: function (event) {
+ event.stopPropagation();
+ this.on_message_read_unread(false);
+ return false;
+ },
+
/*The selected thread and all childs (messages/thread) became read
* @param {object} mouse envent
*/
- on_message_read_unread: function (event) {
- event.stopPropagation();
- var self=this;
+ on_message_read_unread: function (read_value) {
+ var self = this;
+ var messages = [this].concat(this.get_childs());
- if ( (this.to_read && this.options.typeof_thread == 'inbox') ||
- (!this.to_read && this.options.typeof_thread == 'archives')) {
- this.animated_destroy(150);
- }
-
- // if this message is read, all childs message display is read
- this.ds_notification.call('set_message_read', [ [this.id].concat( this.get_child_ids() ) , this.to_read, this.context]).then(function () {
- self.$el.removeClass(self.to_read ? 'oe_msg_unread':'oe_msg_read').addClass(self.to_read ? 'oe_msg_read':'oe_msg_unread');
- self.to_read = !self.to_read;
- });
- return false;
- },
-
- /**
- * search a message in all thread and child thread.
- * This method return an object message.
- * @param {object}{int} option.id
- * @param {object}{string} option.model
- * @param {object}{boolean} option._go_thread_wall
- * private for check the top thread
- * @return thread object
- */
- browse_message: function (options) {
- // goto the wall thread for launch browse
- if (!options._go_thread_wall) {
- options._go_thread_wall = true;
- for (var i in this.options._parents[0].messages) {
- var res=this.options._parents[0].messages[i].browse_message(options);
- if (res) return res;
- }
- }
-
- if (this.id==options.id)
- return this;
-
- for (var i in this.thread.messages) {
- if (this.thread.messages[i].thread) {
- var res=this.thread.messages[i].browse_message(options);
- if (res) return res;
+ // inside the inbox, when the user mark a message as read/done, don't apply this value
+ // for the stared/favorite message
+ if (this.options.view_inbox && read_value) {
+ var messages = _.filter(messages, function (val) { return !val.is_favorite && val.id; });
+ if (!messages.length) {
+ this.check_for_rerender();
+ return false;
}
}
+ var message_ids = _.map(messages, function (val) { return val.id; });
+ this.ds_notification.call('set_message_read', [message_ids, read_value, this.context])
+ .then(function () {
+ // apply modification
+ _.each(messages, function (msg) {
+ msg.to_read = !read_value;
+ if (msg.options.toggle_read) {
+ msg.options.show_read = msg.to_read;
+ msg.options.show_unread = !msg.to_read;
+ }
+ });
+ // check if the message must be display, destroy or rerender
+ self.check_for_rerender();
+ });
return false;
},
- /* get all child message id linked.
- * @return array of id
- */
- get_child_ids: function () {
- var res=[]
- if (arguments[0]) res.push(this.id);
- if (this.thread) {
- res = res.concat( this.thread.get_child_ids(true) );
- }
- return res;
- },
-
/**
* add or remove a vote for a message and display the result
*/
on_vote: function (event) {
event.stopPropagation();
- var self=this;
- return this.ds_message.call('vote_toggle', [[self.id]]).then(function (vote) {
- self.has_voted = vote;
- self.vote_nb += self.has_voted ? 1 : -1;
- self.display_vote();
- });
+ this.ds_message.call('vote_toggle', [[this.id]])
+ .then(
+ _.bind(function (vote) {
+ this.has_voted = vote;
+ this.vote_nb += this.has_voted ? 1 : -1;
+ this.display_vote();
+ }, this));
return false;
},
@@ -814,10 +932,10 @@ openerp.mail = function (session) {
* Display the render of this message's vote
*/
display_vote: function () {
- var self = this;
- var vote_element = session.web.qweb.render('mail.thread.message.vote', {'widget': self});
- self.$(".oe_msg_vote:first").remove();
- self.$(".oe_mail_vote_count:first").replaceWith(vote_element);
+ var vote_element = session.web.qweb.render('mail.thread.message.vote', {'widget': this});
+ this.$(".oe_msg_footer:first .oe_mail_vote_count").remove();
+ this.$(".oe_msg_footer:first .oe_msg_vote").replaceWith(vote_element);
+ this.$('.oe_msg_vote').on('click', this.on_vote);
},
/**
@@ -827,34 +945,29 @@ openerp.mail = function (session) {
event.stopPropagation();
var self=this;
var button = self.$('.oe_star:first');
- return this.ds_message.call('favorite_toggle', [[self.id]]).then(function (star) {
- self.is_favorite=star;
- if (self.is_favorite) {
- button.addClass('oe_starred');
- } else {
- button.removeClass('oe_starred');
- if ( self.options.typeof_thread == 'stared' ) {
- self.animated_destroy(150);
+
+ this.ds_message.call('favorite_toggle', [[self.id]])
+ .then(function (star) {
+ self.is_favorite=star;
+ if (self.is_favorite) {
+ button.addClass('oe_starred');
+ } else {
+ button.removeClass('oe_starred');
}
- }
- });
+
+ if (self.options.view_inbox && self.is_favorite) {
+ self.on_message_read_unread(true);
+ } else {
+ self.check_for_rerender();
+ }
+ });
return false;
},
- /**
- * call on_message_delete on his parent thread
- */
- destroy: function () {
-
- this._super();
- this.parent_thread.on_message_detroy(this);
-
- }
-
});
/**
- * ------------------------------------------------------------
+ * ------------------------------------------------------------
* Thread Widget
* ------------------------------------------------------------
*
@@ -881,14 +994,11 @@ openerp.mail = function (session) {
* @param {Object} [thread]
* @param {int} [display_indented_thread] number thread level to indented threads.
* other are on flat mode
- * @param {Select} [typeof_thread] inbox/archives/stared/sent
- * type of thread and option for user application like animate
- * destroy for read/unread
* @param {Array} [parents] liked with the parents thread
* use with browse, fetch... [O]= top parent
*/
init: function (parent, datasets, options) {
- this._super(parent);
+ this._super(parent, options);
this.domain = options.domain || [];
this.context = _.extend({
default_model: 'mail.thread',
@@ -896,21 +1006,24 @@ openerp.mail = function (session) {
default_parent_id: false }, options.context || {});
this.options = options.options;
- this.options._parents = (options.options._parents != undefined ? options.options._parents : []).concat( [this] );
-
+ this.options.root_thread = (options.options.root_thread != undefined ? options.options.root_thread : this);
+ this.options.show_compose_message = this.options.show_compose_message && (this.options.display_indented_thread >= this.thread_level || !this.thread_level);
+
// record options and data
this.parent_message= parent.thread!= undefined ? parent : false ;
// data of this thread
this.id = datasets.id || false,
- this.model = datasets.model || false,
+ this.last_id = datasets.last_id || false,
this.parent_id = datasets.parent_id || false,
+
this.is_private = datasets.is_private || false,
this.author_id = datasets.author_id || false,
this.thread_level = (datasets.thread_level+1) || 0,
this.partner_ids = _.filter(datasets.partner_ids, function (partner) { return partner[0]!=datasets.author_id[0]; } )
this.messages = [];
- this.show_compose_message = this.options.show_compose_message && (this.options.show_reply_button > this.thread_level || !this.thread_level);
+
+ this.options.flat_mode = !!(this.options.display_indented_thread > this.thread_level ? this.options.display_indented_thread - this.thread_level : 0);
// object compose message
this.compose_message = false;
@@ -934,13 +1047,10 @@ openerp.mail = function (session) {
'context': this.context,
'options': this.options,
});
- if (!this.thread_level) {
- // root view
+ if (!this.thread_level || this.thread_level > this.options.display_indented_thread) {
this.compose_message.insertBefore(this.$el);
- } else if (this.thread_level > this.options.display_indented_thread) {
- this.compose_message.insertAfter(this.$el);
} else {
- this.compose_message.appendTo(this.$el);
+ this.compose_message.prependTo(this.$el);
}
}
},
@@ -948,21 +1058,20 @@ openerp.mail = function (session) {
/* When the expandable object is visible on screen (with scrolling)
* then the on_expandable function is launch
*/
- on_scroll: function (event) {
- if (event)event.stopPropagation();
- this.$('.oe_msg_expandable:last');
-
- var message = this.messages[this.messages.length-1];
- if (message && message.type=="expandable" && message.max_limit) {
- var pos = message.$el.position();
+ on_scroll: function () {
+ var expandables =
+ _.each( _.filter(this.messages, function (val) {return val.max_limit && !val.parent_id;}), function (val) {
+ var pos = val.$el.position();
if (pos.top) {
/* bottom of the screen */
var bottom = $(window).scrollTop()+$(window).height()+200;
if (bottom > pos.top) {
- message.on_expandable();
+ val.on_expandable();
+ // load only one time
+ val.loading = true;
}
}
- }
+ });
},
/**
@@ -970,8 +1079,8 @@ openerp.mail = function (session) {
* in the function. */
bind_events: function () {
var self = this;
- self.$el.on('click', '.oe_mail_list_recipients .oe_more', self.on_show_recipients);
- self.$el.on('click', '.oe_mail_compose_textarea .oe_more_hidden', self.on_hide_recipients);
+ self.$('.oe_mail_list_recipients .oe_more').on('click', self.on_show_recipients);
+ self.$('.oe_mail_compose_textarea .oe_more_hidden').on('click', self.on_hide_recipients);
},
/**
@@ -981,6 +1090,7 @@ openerp.mail = function (session) {
var p=$(this).parent();
p.find('.oe_more_hidden, .oe_hidden').show();
p.find('.oe_more').hide();
+ return false;
},
/**
@@ -990,15 +1100,14 @@ openerp.mail = function (session) {
var p=$(this).parent();
p.find('.oe_more_hidden, .oe_hidden').hide();
p.find('.oe_more').show();
+ return false;
},
/* get all child message/thread id linked.
* @return array of id
*/
get_child_ids: function () {
- var res=[];
- _(this.get_childs()).each(function (val, key) { res.push(val.id); });
- return res;
+ return _.map(this.get_childs(), function (val) { return val.id; });
},
/* get all child message/thread linked.
@@ -1033,17 +1142,17 @@ openerp.mail = function (session) {
// goto the wall thread for launch browse
if (!options._go_thread_wall) {
options._go_thread_wall = true;
- return this.options._parents[0].browse_thread(options);
+ return this.options.root_thread.browse_thread(options);
}
- if (this.id==options.id) {
+ if (this.id == options.id) {
return this;
}
if (options.id) {
for (var i in this.messages) {
if (this.messages[i].thread) {
- var res=this.messages[i].thread.browse_thread({'id':options.id, '_go_thread_wall':true});
+ var res = this.messages[i].thread.browse_thread({'id':options.id, '_go_thread_wall':true});
if (res) return res;
}
}
@@ -1067,8 +1176,8 @@ openerp.mail = function (session) {
* @return message object
*/
browse_message: function (options) {
- if (this.options._parents[0].messages[0])
- return this.options._parents[0].messages[0].browse_message(options);
+ if (this.options.root_thread.messages[0])
+ return this.options.root_thread.messages[0].browse_message(options);
},
/**
@@ -1079,6 +1188,7 @@ openerp.mail = function (session) {
on_compose_message: function () {
this.instantiate_compose_message();
this.compose_message.on_compose_expandable();
+ return false;
},
/**
@@ -1086,8 +1196,8 @@ openerp.mail = function (session) {
*/
no_message: function () {
var no_message = $(session.web.qweb.render('mail.wall_no_message', {}));
- if (this.options.no_message) {
- no_message.html(this.options.no_message);
+ if (this.options.help) {
+ no_message.html(this.options.help);
}
no_message.appendTo(this.$el);
},
@@ -1101,18 +1211,20 @@ openerp.mail = function (session) {
* @param {Array} ids read (if the are some ids, the method don't use the domain)
*/
message_fetch: function (replace_domain, replace_context, ids, callback) {
- var self = this;
-
- // domain and context: options + additional
- fetch_domain = replace_domain ? replace_domain : this.domain;
- fetch_context = replace_context ? replace_context : this.context;
- var message_loaded_ids = this.id ? [this.id].concat( self.get_child_ids() ) : self.get_child_ids();
-
- // CHM note : option for sending in flat mode by server
- var thread_level = this.options.display_indented_thread > this.thread_level ? this.options.display_indented_thread - this.thread_level : 0;
-
- return this.ds_message.call('message_read', [ids, fetch_domain, message_loaded_ids, thread_level, fetch_context, this.context.default_parent_id || undefined])
- .done(callback ? _.bind(callback, this, arguments) : this.proxy('switch_new_message'));
+ return this.ds_message.call('message_read', [
+ // ids force to read
+ ids == false ? undefined : ids,
+ // domain + additional
+ (replace_domain ? replace_domain : this.domain),
+ // ids allready loaded
+ (this.id ? [this.id].concat( this.get_child_ids() ) : this.get_child_ids()),
+ // option for sending in flat mode by server
+ this.options.flat_mode,
+ // context + additional
+ (replace_context ? replace_context : this.context),
+ // parent_id
+ this.context.default_parent_id || undefined
+ ]).done(callback ? _.bind(callback, this, arguments) : this.proxy('switch_new_message'));
},
/**
@@ -1128,22 +1240,23 @@ openerp.mail = function (session) {
data.options = _.extend(self.options, data.options);
if (data.type=='expandable') {
- var message = new mail.ThreadExpandable(self, data, {
+ var message = new mail.ThreadExpandable(self, data, {'context':{
'default_model': data.model || self.context.default_model,
'default_res_id': data.res_id || self.context.default_res_id,
'default_parent_id': self.id,
- });
+ }});
} else {
- var message = new mail.ThreadMessage(self, data, {
+ var message = new mail.ThreadMessage(self, data, {'context':{
'default_model': data.model,
'default_res_id': data.res_id,
'default_parent_id': data.id,
- });
+ }});
}
// check if the message is already create
for (var i in self.messages) {
if (self.messages[i] && self.messages[i].id == message.id) {
+ console.log('Reload message', message.id);
self.messages[i].destroy();
}
}
@@ -1163,74 +1276,18 @@ openerp.mail = function (session) {
*/
insert_message: function (message, dom_insert_after) {
var self=this;
-
- if (this.show_compose_message && this.options.show_compact_message) {
+ if (this.options.show_compact_message > this.thread_level) {
this.instantiate_compose_message();
this.compose_message.do_show_compact();
}
- this.$('.oe_wall_no_message').remove();
+ this.$('.oe_view_nocontent').remove();
if (dom_insert_after) {
message.insertAfter(dom_insert_after);
- return message
- }
-
- // check older and newer message for insertion
- var message_newer = false;
- var message_older = false;
- if (message.id > 0) {
- for (var i in self.messages) {
- if (self.messages[i].id > message.id) {
- if (!message_newer || message_newer.id > self.messages[i].id) {
- message_newer = self.messages[i];
- }
- } else if (self.messages[i].id > 0 && self.messages[i].id < message.id) {
- if (!message_older || message_older.id < self.messages[i].id) {
- message_older = self.messages[i];
- }
- }
- }
- }
-
- var sort = (!!self.thread_level || message.id<0);
-
- if (sort) {
- if (message_older) {
-
- message.insertAfter(message_older.thread ? (message_older.thread.compose_message ? message_older.thread.compose_message.$el : message_older.thread.$el) : message_older.$el);
-
- } else if (message_newer) {
-
- message.insertBefore(message_newer.$el);
-
- } else if (message.id < 0) {
-
- message.appendTo(self.$el);
-
- } else {
-
- message.prependTo(self.$el);
- }
} else {
- if (message_older) {
-
- message.insertBefore(message_older.$el);
-
- } else if (message_newer) {
-
- message.insertAfter(message_newer.thread ? (message_newer.thread.compose_message ? message_newer.thread.compose_message.$el : message_newer.thread.$el) : message_newer.$el );
-
- } else if (message.id < 0) {
-
- message.prependTo(self.$el);
-
- } else {
-
- message.appendTo(self.$el);
-
- }
+ message.appendTo(self.$el);
}
return message
@@ -1241,7 +1298,7 @@ openerp.mail = function (session) {
* Each message is send to his parent object (or parent thread flat mode) for creating the object message.
* @param : {Array} datas from calling RPC to "message_read"
*/
- switch_new_message: function (records) {
+ switch_new_message: function (records, dom_insert_after) {
var self=this;
_(records).each(function (record) {
var thread = self.browse_thread({
@@ -1251,7 +1308,7 @@ openerp.mail = function (session) {
// create object and attach to the thread object
var message = thread.create_message_object( record );
// insert the message on dom
- thread.insert_message( message );
+ thread.insert_message( message, typeof dom_insert_after == 'object' ? dom_insert_after : false);
});
},
@@ -1262,6 +1319,10 @@ openerp.mail = function (session) {
on_message_detroy: function (message) {
this.messages = _.filter(this.messages, function (val) { return !val.isDestroyed(); });
+ if (this.options.root_thread == this && !this.messages.length) {
+ this.no_message();
+ }
+ return false;
},
@@ -1323,7 +1384,6 @@ openerp.mail = function (session) {
} else {
// create a expandable message
var expandable = new mail.ThreadExpandable(this, {
- 'id': message.id,
'model': message.model,
'parent_id': message.parent_id,
'nb_messages': 1,
@@ -1332,9 +1392,11 @@ openerp.mail = function (session) {
'domain': message_dom,
'options': message.options,
}, {
- 'default_model': message.model || this.context.default_model,
- 'default_res_id': message.res_id || this.context.default_res_id,
- 'default_parent_id': this.id,
+ 'context':{
+ 'default_model': message.model || this.context.default_model,
+ 'default_res_id': message.res_id || this.context.default_res_id,
+ 'default_parent_id': this.id,
+ }
});
// add object on array and DOM
@@ -1350,7 +1412,7 @@ openerp.mail = function (session) {
});
/**
- * ------------------------------------------------------------
+ * ------------------------------------------------------------
* mail : root Widget
* ------------------------------------------------------------
*
@@ -1360,7 +1422,7 @@ openerp.mail = function (session) {
*/
session.web.client_actions.add('mail.Widget', 'session.mail.Widget');
mail.Widget = session.web.Widget.extend({
- template: 'mail.Widget',
+ template: 'mail.Root',
/**
* @param {Object} parent parent
@@ -1368,15 +1430,13 @@ openerp.mail = function (session) {
* @param {Object} [context] context of the thread. It should
* contain at least default_model, default_res_id. Please refer to
* the compose_message widget for more information about it.
- * ... @param {Select} [typeof_thread=(mail|stared|archives|send|other)]
- * options for destroy message when the user click on a button
* @param {Object} [options]
*... @param {Number} [truncate_limit=250] number of character to
* display before having a "show more" link; note that the text
* will not be truncated if it does not have 110% of the parameter
*... @param {Boolean} [show_record_name] display the name and link for do action
- *... @param {int} [show_reply_button] number thread level to display the reply button
- *... @param {int} [show_read_unread_button] number thread level to display the read/unread button
+ *... @param {boolean} [show_reply_button] display the reply button
+ *... @param {boolean} [show_read_unread_button] display the read/unread button
*... @param {int} [display_indented_thread] number thread level to indented threads.
* other are on flat mode
*... @param {Boolean} [show_compose_message] allow to display the composer
@@ -1387,35 +1447,25 @@ openerp.mail = function (session) {
* @param {String} [no_message] Message to display when there are no message
*/
init: function (parent, action) {
- var options = action.params || {};
- this._super(parent);
- this.domain = options.domain || [];
- this.context = options.context || {};
- this.search_results = {'domain': [], 'context': {}, 'groupby': {}};
+ this._super(parent, action);
+ var self = this;
+ this.action = _.clone(action);
+ this.domain = this.action.domain || this.action.params.domain || [];
+ this.context = this.action.context || this.action.params.context || {};
- this.options = _.extend({
- 'typeof_thread' : 'inbox',
+ this.action.params = _.extend({
'display_indented_thread' : -1,
- 'show_reply_button' : -1,
- 'show_read_unread_button' : -1,
+ 'show_reply_button' : false,
+ 'show_read_unread_button' : false,
'truncate_limit' : 250,
'show_record_name' : false,
'show_compose_message' : false,
'show_compact_message' : false,
+ 'view_inbox': false,
'message_ids': undefined,
- 'no_message': false
- }, options);
+ }, this.action.params);
- if (this.display_indented_thread === false) {
- this.display_indented_thread = -1;
- }
- if (this.show_reply_button === false) {
- this.show_reply_button = -1;
- }
- if (this.show_read_unread_button === false) {
- this.show_read_unread_button = -1;
- }
-
+ this.action.params.help = this.action.help || false;
},
start: function (options) {
@@ -1423,7 +1473,6 @@ openerp.mail = function (session) {
this.message_render();
this.bind_events();
},
-
/**
*Create the root thread and display this object in the DOM.
@@ -1435,35 +1484,32 @@ openerp.mail = function (session) {
this.thread = new mail.Thread(this, {}, {
'domain' : this.domain,
'context' : this.context,
- 'options': this.options,
+ 'options': this.action.params,
});
this.thread.appendTo( this.$el );
this.thread.no_message();
- this.thread.message_fetch(null, null, this.options.message_ids);
- if (this.options.show_compose_message) {
+ if (this.action.params.show_compose_message) {
this.thread.instantiate_compose_message();
- if (this.options.show_compact_message) {
- this.thread.compose_message.do_show_compact();
- } else {
- this.thread.compose_message.do_hide_compact();
- }
+ this.thread.compose_message.do_show_compact();
}
+
+ this.thread.message_fetch(null, null, this.action.params.message_ids);
+
},
bind_events: function () {
- if (this.context['typeof_thread']!='other') {
- $(document).scroll( this.thread.on_scroll );
- $(window).resize( this.thread.on_scroll );
- window.setTimeout( this.thread.on_scroll, 500 );
- }
+ $(document).scroll( _.bind(this.thread.on_scroll, this.thread) );
+ $(window).resize( _.bind(this.thread.on_scroll, this.thread) );
+ this.$el.resize( _.bind(this.thread.on_scroll, this.thread) );
+ window.setTimeout( _.bind(this.thread.on_scroll, this.thread), 500 );
}
});
/**
- * ------------------------------------------------------------
+ * ------------------------------------------------------------
* mail_thread Widget
* ------------------------------------------------------------
*
@@ -1476,10 +1522,18 @@ openerp.mail = function (session) {
mail.RecordThread = session.web.form.AbstractField.extend({
template: 'mail.record_thread',
- init: function () {
+ init: function (parent, node) {
this._super.apply(this, arguments);
- this.options.domain = this.options.domain || [];
- this.options.context = {'default_model': 'mail.thread', 'default_res_id': false};
+ this.node = _.clone(node);
+
+ this.node.params = _.extend({
+ 'display_indented_thread': -1,
+ 'show_reply_button': false,
+ 'show_read_unread_button': false,
+ 'show_compact_message': 1,
+ }, this.node.params);
+
+ this.domain = this.node.params && this.node.params.domain || [];
},
start: function () {
@@ -1492,42 +1546,32 @@ openerp.mail = function (session) {
_check_visibility: function () {
this.$el.toggle(this.view.get("actual_mode") !== "create");
},
+
render_value: function () {
var self = this;
+
if (! this.view.datarecord.id || session.web.BufferedDataSet.virtual_id_regex.test(this.view.datarecord.id)) {
this.$('oe_mail_thread').hide();
return;
}
- // update context
- _.extend(this.options.context, {
- default_res_id: this.view.datarecord.id,
- default_model: this.view.model,
- default_is_private: false });
- // update domain
- var domain = this.options.domain.concat([['model', '=', this.view.model], ['res_id', '=', this.view.datarecord.id]]);
- var show_compose_message = this.view.is_action_enabled('edit') ||
- (this.getParent().fields.message_is_follower && this.getParent().fields.message_is_follower.get_value());
-
- var message_ids = this.getParent().fields.message_ids && this.getParent().fields.message_ids.get_value();
+ this.node.params = _.extend(this.node.params, {
+ 'message_ids': this.get_value(),
+ 'show_compose_message': this.view.is_action_enabled('edit'),
+ });
+ this.node.context = {
+ 'default_res_id': this.view.datarecord.id || false,
+ 'default_model': this.view.model || false,
+ };
if (this.root) {
+ $('').insertAfter(this.root.$el);
this.root.destroy();
}
// create and render Thread widget
- this.root = new mail.Widget(this, { params: {
- 'domain' : domain,
- 'context' : this.options.context,
- 'typeof_thread': this.options.context['typeof_thread'] || 'other',
- 'display_indented_thread': -1,
- 'show_reply_button': 0,
- 'show_read_unread_button': -1,
- 'show_compose_message': show_compose_message,
- 'message_ids': message_ids,
- 'show_compact_message': true,
- 'no_message': this.node.attrs.help
- }}
- );
+ this.root = new mail.Widget(this, _.extend(this.node, {
+ 'domain' : (this.domain || []).concat([['model', '=', this.view.model], ['res_id', '=', this.view.datarecord.id]]),
+ }));
return this.root.replace(this.$('.oe_mail-placeholder'));
},
@@ -1535,7 +1579,7 @@ openerp.mail = function (session) {
/**
- * ------------------------------------------------------------
+ * ------------------------------------------------------------
* Wall Widget
* ------------------------------------------------------------
*
@@ -1543,6 +1587,7 @@ openerp.mail = function (session) {
* use is to receive a context and a domain, and to delegate the message
* fetching and displaying to the Thread widget.
*/
+
session.web.client_actions.add('mail.wall', 'session.mail.Wall');
mail.Wall = session.web.Widget.extend({
template: 'mail.wall',
@@ -1555,35 +1600,53 @@ openerp.mail = function (session) {
* contain default_model, default_res_id, to give it to the threads.
*/
init: function (parent, action) {
- this._super(parent);
- var options = action.params || {};
- this.options = options;
- this.options.domain = options.domain || [];
- this.options.context = options.context || {};
- this.search_results = {'domain': [], 'context': {}, 'groupby': {}}
- this.ds_msg = new session.web.DataSetSearch(this, 'mail.message');
+ this._super(parent, action);
+
+ this.action = _.clone(action);
+ this.domain = this.action.params.domain || this.action.domain || [];
+ this.context = this.action.params.context || this.action.context || {};
+
+ this.defaults = {};
+ for (var key in this.context) {
+ if (key.match(/^search_default_/)) {
+ this.defaults[key.replace(/^search_default_/, '')] = this.context[key];
+ }
+ }
+
+ this.action.params = _.extend({
+ 'display_indented_thread': 1,
+ 'show_reply_button': true,
+ 'show_read_unread_button': true,
+ 'show_compose_message': true,
+ 'show_compact_message': this.action.params.view_mailbox ? false : 1,
+ 'view_inbox': false,
+ }, this.action.params);
},
start: function () {
- this._super.apply(this, arguments);
- var searchview_ready = this.load_searchview({}, false);
- var thread_displayed = this.message_render();
- this.options.domain = this.options.domain.concat(this.search_results['domain']);
+ this._super.apply(this);
this.bind_events();
- return $.when(searchview_ready, thread_displayed);
+ var searchview_loaded = this.load_searchview(this.defaults);
+ if (! this.searchview.has_defaults) {
+ this.message_render();
+ }
+
},
/**
* Load the mail.message search view
* @param {Object} defaults ??
- * @param {Boolean} hidden some kind of trick we do not care here
*/
- load_searchview: function (defaults, hidden) {
+ load_searchview: function (defaults) {
var self = this;
- this.searchview = new session.web.SearchView(this, this.ds_msg, false, defaults || {}, hidden || false);
- return this.searchview.appendTo(this.$('.oe_view_manager_view_search')).done(function () {
- self.searchview.on('search_data', self, self.do_searchview_search);
- });
+ var ds_msg = new session.web.DataSetSearch(this, 'mail.message');
+ this.searchview = new session.web.SearchView(this, ds_msg, false, defaults || {}, false);
+ this.searchview.appendTo(this.$('.oe_view_manager_view_search'))
+ .then(function () { self.searchview.on('search_data', self, self.do_searchview_search); });
+ if (this.searchview.has_defaults) {
+ this.searchview.ready.then(this.searchview.do_search);
+ }
+ return this.searchview
},
/**
@@ -1599,33 +1662,26 @@ openerp.mail = function (session) {
domains: domains || [],
contexts: contexts || [],
group_by_seq: groupbys || []
- }).done(function (results) {
- self.search_results['context'] = results.context;
- self.search_results['domain'] = results.domain;
- self.root.destroy();
- return self.message_render();
+ }).then(function (results) {
+ if(self.root) {
+ $('').insertAfter(self.root.$el);
+ self.root.destroy();
+ }
+ return self.message_render(results);
});
},
-
/**
- *Create the root thread widget and display this object in the DOM
- */
+ * Create the root thread widget and display this object in the DOM
+ */
message_render: function (search) {
- var domain = this.options.domain.concat(this.search_results['domain']);
- var context = _.extend(this.options.context, search&&search.search_results['context'] ? search.search_results['context'] : {});
- this.root = new mail.Widget(this, { params: {
+ var domain = this.domain.concat(search && search['domain'] ? search['domain'] : []);
+ var context = _.extend(this.context, search && search['context'] ? search['context'] : {});
+
+ this.root = new mail.Widget(this, _.extend(this.action, {
'domain' : domain,
'context' : context,
- 'typeof_thread': context['typeof_thread'] || 'other',
- 'display_indented_thread': 1,
- 'show_reply_button': 10,
- 'show_read_unread_button': 11,
- 'show_compose_message': true,
- 'show_compact_message': false,
- }}
- );
-
+ }));
return this.root.replace(this.$('.oe_mail-placeholder'));
},
@@ -1653,19 +1709,18 @@ openerp.mail = function (session) {
/**
- * ------------------------------------------------------------
+ * ------------------------------------------------------------
* UserMenu
* ------------------------------------------------------------
*
* Add a link on the top user bar for write a full mail
*/
session.web.ComposeMessageTopButton = session.web.Widget.extend({
- template:'mail.compose_message.button_top_bar',
+ template:'mail.ComposeMessageTopButton',
- start: function (parent, params) {
- var self = this;
- this.$el.on('click', 'button', self.on_compose_message );
- this._super(parent, params);
+ start: function () {
+ this.$('button').on('click', this.on_compose_message );
+ this._super();
},
on_compose_message: function (event) {
@@ -1675,26 +1730,22 @@ openerp.mail = function (session) {
res_model: 'mail.compose.message',
view_mode: 'form',
view_type: 'form',
- action_from: 'mail.ThreadComposeMessage',
views: [[false, 'form']],
target: 'new',
- context: {
- 'default_model': '',
- 'default_res_id': false,
- 'default_content_subtype': 'html',
- },
+ context: { 'default_content_subtype': 'html' },
};
session.client.action_manager.do_action(action);
},
-
});
- session.web.UserMenu = session.web.UserMenu.extend({
- start: function (parent, params) {
- var render = new session.web.ComposeMessageTopButton();
- render.insertAfter(this.$el);
- this._super(parent, params);
- }
+ session.web.UserMenu.include({
+ do_update: function(){
+ var self = this;
+ this._super.apply(this, arguments);
+ this.update_promise.then(function() {
+ var mail_button = new session.web.ComposeMessageTopButton();
+ mail_button.appendTo(session.webclient.$el.find('.oe_systray'));
+ });
+ },
});
-
};
diff --git a/addons/mail/static/src/js/mail_followers.js b/addons/mail/static/src/js/mail_followers.js
index a5a97f48d26..7bb019cde4f 100644
--- a/addons/mail/static/src/js/mail_followers.js
+++ b/addons/mail/static/src/js/mail_followers.js
@@ -30,6 +30,8 @@ openerp_mail_followers = function(session, mail) {
this.ds_model = new session.web.DataSetSearch(this, this.view.model);
this.ds_follow = new session.web.DataSetSearch(this, this.field.relation);
this.ds_users = new session.web.DataSetSearch(this, 'res.users');
+
+ this.value = [];
},
start: function() {
@@ -41,6 +43,11 @@ openerp_mail_followers = function(session, mail) {
this._super();
},
+ set_value: function(_value) {
+ this.value = _value;
+ this._super(_value);
+ },
+
_check_visibility: function() {
this.$el.toggle(this.view.get("actual_mode") !== "create");
},
@@ -86,13 +93,14 @@ openerp_mail_followers = function(session, mail) {
read_value: function () {
var self = this;
return this.ds_model.read_ids([this.view.datarecord.id], ['message_follower_ids']).then(function (results) {
- self.set_value(results[0].message_follower_ids);
+ self.value = results[0].message_follower_ids;
+ self.render_value();
});
},
render_value: function () {
this.reinit();
- return this.fetch_followers(this.get("value"));
+ return this.fetch_followers(this.value);
},
fetch_followers: function (value_) {
@@ -111,7 +119,7 @@ openerp_mail_followers = function(session, mail) {
event.preventDefault();
return this.ds_users.call('read', [this.session.uid, ['partner_id']]).then(function (results) {
var pid = results['partner_id'][0];
- self.message_is_follower = (_.indexOf(self.get('value'), pid) != -1);
+ self.message_is_follower = (_.indexOf(self.value, pid) != -1);
}).then(self.proxy('display_generic'));
},
_format_followers: function(count){
@@ -131,7 +139,7 @@ openerp_mail_followers = function(session, mail) {
display_generic: function () {
var self = this;
var node_user_list = this.$('.oe_follower_list').empty();
- this.$('.oe_follower_title').html(this._format_followers(this.get('value').length));
+ this.$('.oe_follower_title').html(this._format_followers(this.value.length));
},
/** Display the followers */
@@ -206,7 +214,8 @@ openerp_mail_followers = function(session, mail) {
$(record).attr('checked',false);
});
var context = new session.web.CompoundContext(this.build_context(), {});
- return this.ds_model.call('message_unsubscribe_users', [[this.view.datarecord.id], [this.session.uid], context]).then(this.proxy('read_value'));
+ return this.ds_model.call('message_unsubscribe_users', [[this.view.datarecord.id], [this.session.uid], context])
+ .then(this.proxy('read_value'));
},
do_update_subscription: function (event) {
@@ -220,7 +229,7 @@ openerp_mail_followers = function(session, mail) {
});
var context = new session.web.CompoundContext(this.build_context(), {});
- return this.ds_model.call('message_subscribe_users', [[this.view.datarecord.id], [this.session.uid], this.message_is_follower ? checklist:undefined, context])
+ return this.ds_model.call('message_subscribe_users', [[this.view.datarecord.id], [this.session.uid], this.message_is_follower ? checklist : undefined, context])
.then(this.proxy('read_value'));
},
});
diff --git a/addons/mail/static/src/xml/mail.xml b/addons/mail/static/src/xml/mail.xml
index bfd0e4cd10f..2ba1733043a 100644
--- a/addons/mail/static/src/xml/mail.xml
+++ b/addons/mail/static/src/xml/mail.xml
@@ -1,8 +1,9 @@
-
-
+
+
@@ -38,7 +39,8 @@
-
+
+
@@ -69,33 +71,28 @@
Template used to display attachments in a mail.message
-->
-
-
-
-
-
- ...Upload in progress...
-
-
-
-
-
-
-
-
-
- [
-
+
+
+
+
+ [
+
+
+ uploading
+
-
-
-
-
-
-
+
+
+
+ [
+
+
+ uploading
+
+
-
+
@@ -112,7 +109,7 @@
To:
- Everyone
+ Followers
and
@@ -140,22 +137,20 @@
- News Feed
- /
-
+ Email box
|
|
-
@@ -168,7 +163,7 @@
display message on the wall when there are no message
-->
- You have no messages
+ No messages.
-
+
@@ -197,10 +192,11 @@
@@ -208,23 +204,26 @@
-
-
-
@@ -234,11 +233,12 @@
-
+
@@ -247,9 +247,9 @@
mail.compose_message.button_top_bar
render of the button on the user bar for open wizard compose message
-->
-
-
-
+
+
+
@@ -257,12 +257,11 @@
Template used to display Like/Unlike in a mail.message
-->
-
8
-
+
like
unlike
diff --git a/addons/mail/tests/test_mail.py b/addons/mail/tests/test_mail.py
index 8e880a611a7..aea67dcdc13 100644
--- a/addons/mail/tests/test_mail.py
+++ b/addons/mail/tests/test_mail.py
@@ -576,7 +576,7 @@ class test_mail(TestMailMockups):
cr, uid, user_admin, group_pigs = self.cr, self.uid, self.user_admin, self.group_pigs
pigs_domain = [('model', '=', 'mail.group'), ('res_id', '=', self.group_pigs_id)]
- # Data: create a discussion in Pigs (2 messages, one with 2 and one with 3 answers)
+ # Data: create a discussion in Pigs (3 threads, with respectively 0, 4 and 4 answers)
msg_id0 = self.group_pigs.message_post(body='0', subtype='mt_comment')
msg_id1 = self.group_pigs.message_post(body='1', subtype='mt_comment')
msg_id2 = self.group_pigs.message_post(body='2', subtype='mt_comment')
@@ -588,7 +588,8 @@ class test_mail(TestMailMockups):
msg_id8 = self.group_pigs.message_post(body='2-1-1', subtype='mt_comment', parent_id=msg_id4)
msg_id9 = self.group_pigs.message_post(body='1-1-1', subtype='mt_comment', parent_id=msg_id3)
msg_id10 = self.group_pigs.message_post(body='2-1-1', subtype='mt_comment', parent_id=msg_id4)
- msg_ids = [msg_id0, msg_id1, msg_id2, msg_id3, msg_id4, msg_id5, msg_id6, msg_id7, msg_id8, msg_id9, msg_id10]
+ msg_ids = [msg_id10, msg_id9, msg_id8, msg_id7, msg_id6, msg_id5, msg_id4, msg_id3, msg_id2, msg_id1, msg_id0]
+ ordered_msg_ids = [msg_id2, msg_id4, msg_id6, msg_id8, msg_id10, msg_id1, msg_id3, msg_id5, msg_id7, msg_id9, msg_id0]
# Test: read some specific ids
read_msg_list = self.mail_message.message_read(cr, uid, ids=msg_ids[2:4], domain=[('body', 'like', 'dummy')])
@@ -601,7 +602,8 @@ class test_mail(TestMailMockups):
self.assertEqual(msg_ids, read_msg_ids, 'message_read flat with domain on Pigs should equal all messages of Pigs')
read_msg_list = self.mail_message.message_read(cr, uid, domain=pigs_domain, limit=200, thread_level=1)
read_msg_ids = [msg.get('id') for msg in read_msg_list]
- self.assertEqual(msg_ids, read_msg_ids, 'message_read threaded with domain on Pigs should equal all messages of Pigs')
+ self.assertEqual(ordered_msg_ids, read_msg_ids,
+ 'message_read threaded with domain on Pigs should equal all messages of Pigs, and sort them with newer thread first, last message last in thread')
# ----------------------------------------
# CASE1: message_read with domain, threaded
@@ -611,6 +613,8 @@ class test_mail(TestMailMockups):
# Do: read last message, threaded
read_msg_list = self.mail_message.message_read(cr, uid, domain=pigs_domain, limit=1, thread_level=1)
read_msg_ids = [msg.get('id') for msg in read_msg_list if msg.get('type') != 'expandable']
+ # TDE TODO: test expandables order
+ type_list = map(lambda item: item.get('type'), read_msg_list)
# Test: structure content, ancestor is added to the read messages, ordered by id, ancestor is set, 2 expandables
self.assertEqual(len(read_msg_list), 4, 'message_read on last Pigs message should return 2 messages and 2 expandables')
self.assertEqual(set([msg_id2, msg_id10]), set(read_msg_ids), 'message_read on the last Pigs message should also get its parent')
@@ -618,7 +622,7 @@ class test_mail(TestMailMockups):
# Data: get expandables
new_threads_exp, new_msg_exp = None, None
for msg in read_msg_list:
- if msg.get('type') == 'expandable' and msg.get('nb_messages') == -1 and msg.get('id') == -1:
+ if msg.get('type') == 'expandable' and msg.get('nb_messages') == -1 and msg.get('max_limit'):
new_threads_exp = msg
elif msg.get('type') == 'expandable':
new_msg_exp = msg
@@ -630,12 +634,20 @@ class test_mail(TestMailMockups):
self.assertIn(('id', 'child_of', msg_id2), domain, 'new messages expandable domain should contain a child_of condition')
self.assertIn(('id', '>=', msg_id4), domain, 'new messages expandable domain should contain an id greater than condition')
self.assertIn(('id', '<=', msg_id8), domain, 'new messages expandable domain should contain an id less than condition')
- self.assertEqual(new_msg_exp.get('parent_id'), msg_id2, 'new messages expandable should have ancestor_id set to the thread header')
- # Do: message_read with domain, thread_level=0, parent_id=msg_id2 (should be imposed by JS)
- read_msg_list = self.mail_message.message_read(cr, uid, domain=domain, limit=200, thread_level=0, parent_id=msg_id2)
+ self.assertEqual(new_msg_exp.get('parent_id'), msg_id2, 'new messages expandable should have parent_id set to the thread header')
+ # Do: message_read with domain, thread_level=0, parent_id=msg_id2 (should be imposed by JS), 2 messages
+ read_msg_list = self.mail_message.message_read(cr, uid, domain=domain, limit=2, thread_level=0, parent_id=msg_id2)
read_msg_ids = [msg.get('id') for msg in read_msg_list if msg.get('type') != 'expandable']
- # Test: other message in thread have been fetch
- self.assertEqual(set([msg_id4, msg_id6, msg_id8]), set(read_msg_ids), 'message_read in Pigs thread should return all the previous messages')
+ new_msg_exp = [msg for msg in read_msg_list if msg.get('type') == 'expandable'][0]
+ # Test: structure content, 2 messages and 1 thread expandable
+ self.assertEqual(len(read_msg_list), 3, 'message_read in Pigs thread should return 2 messages and 1 expandables')
+ self.assertEqual(set([msg_id6, msg_id8]), set(read_msg_ids), 'message_read in Pigs thread should return 2 more previous messages in thread')
+ # Do: read the last message
+ read_msg_list = self.mail_message.message_read(cr, uid, domain=new_msg_exp.get('domain'), limit=2, thread_level=0, parent_id=msg_id2)
+ read_msg_ids = [msg.get('id') for msg in read_msg_list if msg.get('type') != 'expandable']
+ # Test: structure content, 1 message
+ self.assertEqual(len(read_msg_list), 1, 'message_read in Pigs thread should return 1 message')
+ self.assertEqual(set([msg_id4]), set(read_msg_ids), 'message_read in Pigs thread should return the last message in thread')
# Do: fetch a new thread, domain from expandable
self.assertIsNotNone(new_threads_exp, 'message_read on last Pigs message should have returned a new threads expandable')
@@ -643,7 +655,7 @@ class test_mail(TestMailMockups):
# Test: expandable, conditions in domain
for condition in pigs_domain:
self.assertIn(condition, domain, 'new threads expandable domain should contain the message_read domain parameter')
- self.assertFalse(new_threads_exp.get('parent_id'), 'new threads expandable should not have an ancestor_id')
+ self.assertFalse(new_threads_exp.get('parent_id'), 'new threads expandable should not have an parent_id')
# Do: message_read with domain, thread_level=1 (should be imposed by JS)
read_msg_list = self.mail_message.message_read(cr, uid, domain=domain, limit=1, thread_level=1)
read_msg_ids = [msg.get('id') for msg in read_msg_list if msg.get('type') != 'expandable']
@@ -654,7 +666,7 @@ class test_mail(TestMailMockups):
# Data: get expandables
new_threads_exp, new_msg_exp = None, None
for msg in read_msg_list:
- if msg.get('type') == 'expandable' and msg.get('nb_messages') == -1 and msg.get('id') == -1:
+ if msg.get('type') == 'expandable' and msg.get('nb_messages') == -1 and msg.get('max_limit'):
new_threads_exp = msg
elif msg.get('type') == 'expandable':
new_msg_exp = msg
@@ -701,7 +713,7 @@ class test_mail(TestMailMockups):
# Data: get expandables
new_threads_exp, new_msg_exp = None, None
for msg in read_msg_list:
- if msg.get('type') == 'expandable' and msg.get('nb_messages') == -1 and msg.get('id') == -1:
+ if msg.get('type') == 'expandable' and msg.get('nb_messages') == -1 and msg.get('max_limit'):
new_threads_exp = msg
# Do: fetch new messages, domain from expandable
@@ -715,7 +727,7 @@ class test_mail(TestMailMockups):
read_msg_ids = [msg.get('id') for msg in read_msg_list if msg.get('type') != 'expandable']
# Test: structure content, ancestor is added to the read messages, ordered by id, ancestor is set, 2 expandables
self.assertEqual(len(read_msg_list), 9, 'message_read on Pigs should return 9 messages and 0 expandable')
- self.assertEqual([msg_id0, msg_id1, msg_id2, msg_id3, msg_id4, msg_id5, msg_id6, msg_id7, msg_id8], read_msg_ids,
+ self.assertEqual([msg_id8, msg_id7, msg_id6, msg_id5, msg_id4, msg_id3, msg_id2, msg_id1, msg_id0], read_msg_ids,
'message_read, More on flat, should return all remaning messages')
def test_40_needaction(self):
diff --git a/addons/mail/wizard/mail_compose_message.py b/addons/mail/wizard/mail_compose_message.py
index 33712847534..45082b9be4d 100644
--- a/addons/mail/wizard/mail_compose_message.py
+++ b/addons/mail/wizard/mail_compose_message.py
@@ -135,7 +135,12 @@ class mail_compose_message(osv.TransientModel):
related to.
:param int res_id: id of the document record this mail is related to
"""
- return {'model': model, 'res_id': res_id}
+ doc_name_get = self.pool.get(model).name_get(cr, uid, res_id, context=context)
+ if doc_name_get:
+ record_name = doc_name_get[0][1]
+ else:
+ record_name = False
+ return {'model': model, 'res_id': res_id, 'record_name': record_name}
def get_message_data(self, cr, uid, message_id, context=None):
""" Returns a defaults-like dict with initial values for the composition
@@ -161,6 +166,7 @@ class mail_compose_message(osv.TransientModel):
# update the result
result = {
+ 'record_name': message_data.record_name,
'model': message_data.model,
'res_id': message_data.res_id,
'parent_id': message_data.id,
diff --git a/addons/mail/wizard/mail_compose_message_view.xml b/addons/mail/wizard/mail_compose_message_view.xml
index b9c3d237e78..86b1be6562f 100644
--- a/addons/mail/wizard/mail_compose_message_view.xml
+++ b/addons/mail/wizard/mail_compose_message_view.xml
@@ -14,10 +14,19 @@
-
+
+
+ Followers of
+
+ and
+
+
+
+ attrs="{'invisible':[('content_subtype', '=', 'plain')]}"/>
diff --git a/addons/mrp/report/price.py b/addons/mrp/report/price.py
index 527505d8ea5..b1e04749ab2 100644
--- a/addons/mrp/report/price.py
+++ b/addons/mrp/report/price.py
@@ -111,7 +111,7 @@ class report_custom(report_rml):
595.27
841.88
55.00mm,58.00mm,29.00mm,29.00mm,29.00mm
- """ % (user_pool.browse(cr, uid, uid).company_id.name)
+ """ % to_xml(user_pool.browse(cr, uid, uid).company_id.name)
config_stop = """
Generated by OpenERP
diff --git a/addons/mrp_repair/mrp_repair.py b/addons/mrp_repair/mrp_repair.py
index bc9b9413c65..d79620ce93c 100644
--- a/addons/mrp_repair/mrp_repair.py
+++ b/addons/mrp_repair/mrp_repair.py
@@ -690,7 +690,7 @@ class mrp_repair_line(osv.osv, ProductChangeMixin):
'repair_id': fields.many2one('mrp.repair', 'Repair Order Reference',ondelete='cascade', select=True),
'type': fields.selection([('add','Add'),('remove','Remove')],'Type', required=True),
'to_invoice': fields.boolean('To Invoice'),
- 'product_id': fields.many2one('product.product', 'Product', domain=[('sale_ok','=',True)], required=True),
+ 'product_id': fields.many2one('product.product', 'Product', required=True),
'invoiced': fields.boolean('Invoiced',readonly=True),
'price_unit': fields.float('Unit Price', required=True, digits_compute= dp.get_precision('Product Price')),
'price_subtotal': fields.function(_amount_line, string='Subtotal',digits_compute= dp.get_precision('Account')),
diff --git a/addons/note/note_view.xml b/addons/note/note_view.xml
index 18a3ec840a9..5aae6204d86 100644
--- a/addons/note/note_view.xml
+++ b/addons/note/note_view.xml
@@ -120,7 +120,7 @@
-
+
diff --git a/addons/note/static/src/css/note.css b/addons/note/static/src/css/note.css
index 1b7e9315e74..16d71e28aa5 100644
--- a/addons/note/static/src/css/note.css
+++ b/addons/note/static/src/css/note.css
@@ -49,8 +49,8 @@
padding: 8px;
margin-left: 3px;
margin-right: 3px;
- padding-bottom: 16px;
- margin-bottom: 16px;
+ padding-bottom: 8px;
+ margin-bottom: 10px;
-webkit-transform: rotate(-2deg);
-o-transform: rotate(-2deg);
-moz-transform: rotate(-2deg);
diff --git a/addons/note/static/src/css/note.sass b/addons/note/static/src/css/note.sass
index b5bc28a2593..6f0c0883ae7 100644
--- a/addons/note/static/src/css/note.sass
+++ b/addons/note/static/src/css/note.sass
@@ -53,8 +53,8 @@
padding: 8px
margin-left: 3px
margin-right: 3px
- padding-bottom: 16px
- margin-bottom: 16px
+ padding-bottom: 8px
+ margin-bottom: 10px
@include rotate(-2deg)
@include transition(all, 300ms)
.oe_kanban_record:nth-of-type(even)
diff --git a/addons/point_of_sale/report/pos_receipt.py b/addons/point_of_sale/report/pos_receipt.py
index 2ee6b2e3360..58044c28c77 100644
--- a/addons/point_of_sale/report/pos_receipt.py
+++ b/addons/point_of_sale/report/pos_receipt.py
@@ -34,7 +34,7 @@ class order(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(order, self).__init__(cr, uid, name, context=context)
- user = pooler.get_pool(cr.dbname).get('res.users').browse(cr, uid, uid)
+ user = pooler.get_pool(cr.dbname).get('res.users').browse(cr, uid, uid, context=context)
partner = user.company_id.partner_id
self.localcontext.update({
diff --git a/addons/point_of_sale/static/src/js/widgets.js b/addons/point_of_sale/static/src/js/widgets.js
index b555357baec..c7874a4bd5c 100644
--- a/addons/point_of_sale/static/src/js/widgets.js
+++ b/addons/point_of_sale/static/src/js/widgets.js
@@ -1051,7 +1051,8 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa
this.pos.barcode_reader.disconnect();
return new instance.web.Model("ir.model.data").get_func("search_read")([['name', '=', 'action_client_pos_menu']], ['res_id']).pipe(
_.bind(function(res) {
- return this.rpc('/web/action/load', {'action_id': res[0]['res_id']}).pipe(_.bind(function(action) {
+ return this.rpc('/web/action/load', {'action_id': res[0]['res_id']}).pipe(_.bind(function(result) {
+ var action = result;
action.context = _.extend(action.context || {}, {'cancel_action': {type: 'ir.actions.client', tag: 'reload'}});
//self.destroy();
this.do_action(action);
diff --git a/addons/point_of_sale/wizard/pos_payment.py b/addons/point_of_sale/wizard/pos_payment.py
index 9511aed6331..70b88f35e33 100644
--- a/addons/point_of_sale/wizard/pos_payment.py
+++ b/addons/point_of_sale/wizard/pos_payment.py
@@ -75,7 +75,7 @@ class pos_make_payment(osv.osv_memory):
def launch_payment(self, cr, uid, ids, context=None):
return {
- 'name': _('Paiement'),
+ 'name': _('Payment'),
'view_type': 'form',
'view_mode': 'form',
'res_model': 'pos.make.payment',
@@ -83,6 +83,7 @@ class pos_make_payment(osv.osv_memory):
'target': 'new',
'views': False,
'type': 'ir.actions.act_window',
+ 'context': context,
}
def print_report(self, cr, uid, ids, context=None):
diff --git a/addons/portal/wizard/share_wizard.py b/addons/portal/wizard/share_wizard.py
index b1b6e980dec..51e5e59eb0e 100644
--- a/addons/portal/wizard/share_wizard.py
+++ b/addons/portal/wizard/share_wizard.py
@@ -35,8 +35,8 @@ class share_wizard_portal(osv.TransientModel):
def _user_type_selection(self, cr, uid, context=None):
selection = super(share_wizard_portal, self)._user_type_selection(cr, uid, context=context)
- selection.extend([('existing','Users you already shared with'),
- ('groups','Existing Groups (e.g Portal Groups)')])
+ selection.extend([('existing',_('Users you already shared with')),
+ ('groups',_('Existing Groups (e.g Portal Groups)'))])
return selection
_columns = {
diff --git a/addons/product/product.py b/addons/product/product.py
index bf3e9fd04cf..1333c9581a7 100644
--- a/addons/product/product.py
+++ b/addons/product/product.py
@@ -674,9 +674,9 @@ class product_product(osv.osv):
# Performing a quick memory merge of ids in Python will give much better performance
ids = set()
ids.update(self.search(cr, user, args + [('default_code',operator,name)], limit=limit, context=context))
- if len(ids) < limit:
+ if not limit or len(ids) < limit:
# we may underrun the limit because of dupes in the results, that's fine
- ids.update(self.search(cr, user, args + [('name',operator,name)], limit=(limit-len(ids)), context=context))
+ ids.update(self.search(cr, user, args + [('name',operator,name)], limit=(limit and (limit-len(ids)) or False) , context=context))
ids = list(ids)
if not ids:
ptrn = re.compile('(\[(.*?)\])')
diff --git a/addons/product_expiry/product_expiry.py b/addons/product_expiry/product_expiry.py
index c16ccc2b1ee..e4ed28db4e6 100644
--- a/addons/product_expiry/product_expiry.py
+++ b/addons/product_expiry/product_expiry.py
@@ -45,12 +45,13 @@ class stock_production_lot(osv.osv):
_columns = {
'life_date': fields.datetime('End of Life Date',
- help='The date on which the lot may become dangerous and should not be consumed.'),
+ help='This is the date on which the goods with this Serial Number may become dangerous and must not be consumed.'),
'use_date': fields.datetime('Best before Date',
- help='The date on which the lot starts deteriorating without becoming dangerous.'),
+ help='This is the date on which the goods with this Serial Number start deteriorating, without being dangerous yet.'),
'removal_date': fields.datetime('Removal Date',
- help='The date on which the lot should be removed.'),
- 'alert_date': fields.datetime('Alert Date', help="The date on which an alert should be notified about the serial number."),
+ help='This is the date on which the goods with this Serial Number should be removed from the stock.'),
+ 'alert_date': fields.datetime('Alert Date',
+ help="This is the date on which an alert should be notified about the goods with this Serial Number."),
}
# Assign dates according to products data
def create(self, cr, uid, vals, context=None):
@@ -78,12 +79,13 @@ class product_product(osv.osv):
_inherit = 'product.product'
_columns = {
'life_time': fields.integer('Product Life Time',
- help='The number of days before a serial number may become dangerous and should not be consumed.'),
+ help='When a new a Serial Number is issued, this is the number of days before the goods may become dangerous and must not be consumed.'),
'use_time': fields.integer('Product Use Time',
- help='The number of days before a serial number starts deteriorating without becoming dangerous.'),
+ help='When a new a Serial Number is issued, this is the number of days before the goods starts deteriorating, without being dangerous yet.'),
'removal_time': fields.integer('Product Removal Time',
- help='The number of days before a serial number should be removed.'),
- 'alert_time': fields.integer('Product Alert Time', help="The number of days after which an alert should be notified about the serial number."),
+ help='When a new a Serial Number is issued, this is the number of days before the goods should be removed from the stock.'),
+ 'alert_time': fields.integer('Product Alert Time',
+ help='When a new a Serial Number is issued, this is the number of days before an alert should be notified.'),
}
product_product()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/project/project.py b/addons/project/project.py
index 741cae4b91b..9c28fadeab9 100644
--- a/addons/project/project.py
+++ b/addons/project/project.py
@@ -166,17 +166,17 @@ class project(osv.osv):
res[id]['progress_rate'] = 0.0
return res
- def unlink(self, cr, uid, ids, *args, **kwargs):
+ def unlink(self, cr, uid, ids, context=None):
alias_ids = []
mail_alias = self.pool.get('mail.alias')
- for proj in self.browse(cr, uid, ids):
+ for proj in self.browse(cr, uid, ids, context=context):
if proj.tasks:
raise osv.except_osv(_('Invalid Action!'),
_('You cannot delete a project containing tasks. You can either delete all the project\'s tasks and then delete the project or simply deactivate the project.'))
elif proj.alias_id:
alias_ids.append(proj.alias_id.id)
- res = super(project, self).unlink(cr, uid, ids, *args, **kwargs)
- mail_alias.unlink(cr, uid, alias_ids, *args, **kwargs)
+ res = super(project, self).unlink(cr, uid, ids, context=context)
+ mail_alias.unlink(cr, uid, alias_ids, context=context)
return res
def _get_attached_docs(self, cr, uid, ids, field_name, arg, context):
@@ -204,8 +204,8 @@ class project(osv.osv):
def attachment_tree_view(self, cr, uid, ids, context):
task_ids = self.pool.get('project.task').search(cr, uid, [('project_id', 'in', ids)])
domain = [
- ('|',
- '&', 'res_model', '=', 'project.project'), ('res_id', 'in', ids),
+ '|',
+ '&', ('res_model', '=', 'project.project'), ('res_id', 'in', ids),
'&', ('res_model', '=', 'project.task'), ('res_id', 'in', task_ids)
]
res_id = ids and ids[0] or False
@@ -474,7 +474,7 @@ def Project():
resource = %s
""" % (
project.id,
- project.date_start, working_days,
+ project.date_start or time.strftime('%Y-%m-%d'), working_days,
'|'.join(['User_'+str(x) for x in puids])
)
vacation = calendar_id and tuple(resource_pool.compute_vacation(cr, uid, calendar_id, context=context)) or False
diff --git a/addons/project/project_view.xml b/addons/project/project_view.xml
index 58f0ae17962..e7f12ff3797 100644
--- a/addons/project/project_view.xml
+++ b/addons/project/project_view.xml
@@ -164,7 +164,7 @@
project.project
-
+
diff --git a/addons/purchase/edi/purchase_order_action_data.xml b/addons/purchase/edi/purchase_order_action_data.xml
index fa043b72ce9..4190a625fdb 100644
--- a/addons/purchase/edi/purchase_order_action_data.xml
+++ b/addons/purchase/edi/purchase_order_action_data.xml
@@ -21,7 +21,7 @@
Purchase Order - Send by mail
${object.validator.email or ''}
${object.company_id.name} Order (Ref ${object.name or 'n/a' })
- ${object.partner_id.email}
+ ${object.partner_id.id}
diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py
index f2b1e45ad69..ad7563140b2 100644
--- a/addons/purchase/purchase.py
+++ b/addons/purchase/purchase.py
@@ -46,7 +46,7 @@ class purchase_order(osv.osv):
cur = order.pricelist_id.currency_id
for line in order.order_line:
val1 += line.price_subtotal
- for c in self.pool.get('account.tax').compute_all(cr, uid, line.taxes_id, line.price_unit, line.product_qty, line.product_id.id, order.partner_id)['taxes']:
+ for c in self.pool.get('account.tax').compute_all(cr, uid, line.taxes_id, line.price_unit, line.product_qty, line.product_id, order.partner_id)['taxes']:
val += c.get('amount', 0.0)
res[order.id]['amount_tax']=cur_obj.round(cr, uid, cur, val)
res[order.id]['amount_untaxed']=cur_obj.round(cr, uid, cur, val1)
@@ -293,6 +293,27 @@ class purchase_order(osv.osv):
fiscal_position = supplier.property_account_position and supplier.property_account_position.id or False
return {'value':{'pricelist_id': pricelist, 'fiscal_position': fiscal_position}}
+ def invoice_open(self, cr, uid, ids, context=None):
+ mod_obj = self.pool.get('ir.model.data')
+ act_obj = self.pool.get('ir.actions.act_window')
+
+ result = mod_obj.get_object_reference(cr, uid, 'account', 'action_invoice_tree2')
+ id = result and result[1] or False
+ result = act_obj.read(cr, uid, [id], context=context)[0]
+ inv_ids = []
+ for po in self.browse(cr, uid, ids, context=context):
+ inv_ids+= [invoice.id for invoice in po.invoice_ids]
+ if not inv_ids:
+ raise osv.except_osv(_('Error!'), _('Please create Invoices.'))
+ #choose the view_mode accordingly
+ if len(inv_ids)>1:
+ result['domain'] = "[('id','in',["+','.join(map(str, inv_ids))+"])]"
+ else:
+ res = mod_obj.get_object_reference(cr, uid, 'account', 'invoice_supplier_form')
+ result['views'] = [(res and res[1] or False, 'form')]
+ result['res_id'] = inv_ids and inv_ids[0] or False
+ return result
+
def view_invoice(self, cr, uid, ids, context=None):
'''
This function returns an action that display existing invoices of given sale order ids. It can either be a in a list or in a form view, if there is only one invoice to show.
@@ -378,6 +399,7 @@ class purchase_order(osv.osv):
'default_res_id': ids[0],
'default_use_template': bool(template_id),
'default_template_id': template_id,
+ 'default_composition_mode': 'comment',
})
return {
'type': 'ir.actions.act_window',
@@ -550,7 +572,6 @@ class purchase_order(osv.osv):
'invoice_state': '2binvoiced' if order.invoice_method == 'picking' else 'none',
'type': 'in',
'partner_id': order.dest_address_id.id or order.partner_id.id,
- 'invoice_state': '2binvoiced' if order.invoice_method == 'picking' else 'none',
'purchase_id': order.id,
'company_id': order.company_id.id,
'move_lines' : [],
@@ -806,7 +827,7 @@ class purchase_order_line(osv.osv):
cur_obj=self.pool.get('res.currency')
tax_obj = self.pool.get('account.tax')
for line in self.browse(cr, uid, ids, context=context):
- taxes = tax_obj.compute_all(cr, uid, line.taxes_id, line.price_unit, line.product_qty)
+ taxes = tax_obj.compute_all(cr, uid, line.taxes_id, line.price_unit, line.product_qty, line.product_id, line.order_id.partner_id)
cur = line.order_id.pricelist_id.currency_id
res[line.id] = cur_obj.round(cr, uid, cur, taxes['total'])
return res
diff --git a/addons/purchase/purchase_view.xml b/addons/purchase/purchase_view.xml
index cff258e3017..db71a969fbe 100644
--- a/addons/purchase/purchase_view.xml
+++ b/addons/purchase/purchase_view.xml
@@ -282,8 +282,6 @@
-
-
diff --git a/addons/purchase/stock_view.xml b/addons/purchase/stock_view.xml
index 9e5aa2e074e..188baeccd69 100644
--- a/addons/purchase/stock_view.xml
+++ b/addons/purchase/stock_view.xml
@@ -48,6 +48,8 @@
+
diff --git a/addons/sale/edi/sale_order_action_data.xml b/addons/sale/edi/sale_order_action_data.xml
index cfe5277d3ce..f324cede835 100644
--- a/addons/sale/edi/sale_order_action_data.xml
+++ b/addons/sale/edi/sale_order_action_data.xml
@@ -23,7 +23,7 @@
Sale Order - Send by mail
${object.user_id.email or ''}
${object.company_id.name} Order (Ref ${object.name or 'n/a' })
- ${object.partner_invoice_id.email}
+ ${object.partner_invoice_id.id}
diff --git a/addons/sale/sale.py b/addons/sale/sale.py
index 91971097ca8..3c568cc8227 100644
--- a/addons/sale/sale.py
+++ b/addons/sale/sale.py
@@ -264,7 +264,24 @@ class sale_order(osv.osv):
return osv.osv.unlink(self, cr, uid, unlink_ids, context=context)
+ def copy_quotation(self, cr, uid, ids, context=None):
+ id = self.copy(cr, uid, ids[0], context=None)
+ view_ref = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'sale', 'view_order_form')
+ view_id = view_ref and view_ref[1] or False,
+ return {
+ 'type': 'ir.actions.act_window',
+ 'name': _('Sales Order'),
+ 'res_model': 'sale.order',
+ 'res_id': id,
+ 'view_type': 'form',
+ 'view_mode': 'form',
+ 'view_id': view_id,
+ 'target': 'current',
+ 'nodestroy': True,
+ }
+
def onchange_pricelist_id(self, cr, uid, ids, pricelist_id, order_lines, context=None):
+ context = context or {}
if not pricelist_id:
return {}
value = {
@@ -601,6 +618,7 @@ class sale_order(osv.osv):
}
def action_wait(self, cr, uid, ids, context=None):
+ context = context or {}
for o in self.browse(cr, uid, ids):
if not o.order_line:
raise osv.except_osv(_('Error!'),_('You cannot confirm a sale order which has no line.'))
@@ -633,6 +651,7 @@ class sale_order(osv.osv):
'default_res_id': ids[0],
'default_use_template': bool(template_id),
'default_template_id': template_id,
+ 'default_composition_mode': 'comment',
'mark_so_as_sent': True
})
return {
@@ -906,7 +925,7 @@ class sale_order_line(osv.osv):
result = {}
warning_msgs = {}
- product_obj = product_obj.browse(cr, uid, product, context=context)
+ product_obj = product_obj.browse(cr, uid, product, context=context_partner)
uom2 = False
if uom:
diff --git a/addons/sale/sale_view.xml b/addons/sale/sale_view.xml
index 838c63f34a1..da8d1b3b9c2 100644
--- a/addons/sale/sale_view.xml
+++ b/addons/sale/sale_view.xml
@@ -176,6 +176,7 @@
attrs="{'invisible': [('invoice_exists', '=', False)]}" groups="base.group_user"/>
+
diff --git a/addons/sale_crm/wizard/crm_make_sale.py b/addons/sale_crm/wizard/crm_make_sale.py
index 2597c1db56c..10225990229 100644
--- a/addons/sale_crm/wizard/crm_make_sale.py
+++ b/addons/sale_crm/wizard/crm_make_sale.py
@@ -64,7 +64,9 @@ class crm_make_sale(osv.osv_memory):
"""
if context is None:
context = {}
-
+ # update context: if come from phonecall, default state values can make the quote crash lp:1017353
+ context.pop('default_state', False)
+
case_obj = self.pool.get('crm.lead')
sale_obj = self.pool.get('sale.order')
partner_obj = self.pool.get('res.partner')
diff --git a/addons/share/wizard/share_wizard.py b/addons/share/wizard/share_wizard.py
index 360b1eff159..6a1f5681f4f 100644
--- a/addons/share/wizard/share_wizard.py
+++ b/addons/share/wizard/share_wizard.py
@@ -74,7 +74,7 @@ class share_wizard(osv.TransientModel):
def _user_type_selection(self, cr, uid, context=None):
"""Selection values may be easily overridden/extended via inheritance"""
- return [('embedded', 'Direct link or embed code'), ('emails','Emails'), ]
+ return [('embedded', _('Direct link or embed code')), ('emails',_('Emails')), ]
"""Override of create() to auto-compute the action name"""
def create(self, cr, uid, values, context=None):
diff --git a/addons/stock/stock.py b/addons/stock/stock.py
index 606cb9247d5..d18a55ea49a 100644
--- a/addons/stock/stock.py
+++ b/addons/stock/stock.py
@@ -1351,14 +1351,14 @@ class stock_picking(osv.osv):
wf_service.trg_validate(uid, 'stock.picking', new_picking, 'button_confirm', cr)
# Then we finish the good picking
self.write(cr, uid, [pick.id], {'backorder_id': new_picking})
- self.action_move(cr, uid, [new_picking])
+ self.action_move(cr, uid, [new_picking], context=context)
wf_service.trg_validate(uid, 'stock.picking', new_picking, 'button_done', cr)
wf_service.trg_write(uid, 'stock.picking', pick.id, cr)
delivered_pack_id = new_picking
back_order_name = self.browse(cr, uid, delivered_pack_id, context=context).name
self.back_order_send_note(cr, uid, ids, back_order_name, context)
else:
- self.action_move(cr, uid, [pick.id])
+ self.action_move(cr, uid, [pick.id], context=context)
wf_service.trg_validate(uid, 'stock.picking', pick.id, 'button_done', cr)
delivered_pack_id = pick.id
self.ship_done_send_note(cr, uid, ids, context)
@@ -1553,7 +1553,7 @@ class stock_production_lot(osv.osv):
'product_id': lambda x, y, z, c: c.get('product_id', False),
}
_sql_constraints = [
- ('name_ref_uniq', 'unique (name, ref)', 'The combination of serial number and internal reference must be unique !'),
+ ('name_ref_uniq', 'unique (name, ref)', 'The combination of Serial Number and internal reference must be unique !'),
]
def action_traceability(self, cr, uid, ids, context=None):
""" It traces the information of a product
@@ -2123,7 +2123,7 @@ class stock_move(osv.osv):
old_ptype = location_obj.picking_type_get(cr, uid, picking.move_lines[0].location_id, picking.move_lines[0].location_dest_id)
if old_ptype != picking.type:
old_pick_name = seq_obj.get(cr, uid, 'stock.picking.' + old_ptype)
- self.pool.get('stock.picking').write(cr, uid, [picking.id], {'name': old_pick_name}, context=context)
+ self.pool.get('stock.picking').write(cr, uid, [picking.id], {'name': old_pick_name, 'type': old_ptype}, context=context)
else:
pickid = False
for move, (loc, dummy, delay, dummy, company_id, ptype) in todo:
@@ -2433,14 +2433,17 @@ class stock_move(osv.osv):
if move.picking_id:
picking_ids.append(move.picking_id.id)
if move.move_dest_id.id and (move.state != 'done'):
- self.write(cr, uid, [move.id], {'move_history_ids': [(4, move.move_dest_id.id)]})
- #cr.execute('insert into stock_move_history_ids (parent_id,child_id) values (%s,%s)', (move.id, move.move_dest_id.id))
- if move.move_dest_id.state in ('waiting', 'confirmed'):
- self.force_assign(cr, uid, [move.move_dest_id.id], context=context)
- if move.move_dest_id.picking_id:
- wf_service.trg_write(uid, 'stock.picking', move.move_dest_id.picking_id.id, cr)
- if move.move_dest_id.auto_validate:
- self.action_done(cr, uid, [move.move_dest_id.id], context=context)
+ # Downstream move should only be triggered if this move is the last pending upstream move
+ other_upstream_move_ids = self.search(cr, uid, [('id','!=',move.id),('state','not in',['done','cancel']),
+ ('move_dest_id','=',move.move_dest_id.id)], context=context)
+ if not other_upstream_move_ids:
+ self.write(cr, uid, [move.id], {'move_history_ids': [(4, move.move_dest_id.id)]})
+ if move.move_dest_id.state in ('waiting', 'confirmed'):
+ self.force_assign(cr, uid, [move.move_dest_id.id], context=context)
+ if move.move_dest_id.picking_id:
+ wf_service.trg_write(uid, 'stock.picking', move.move_dest_id.picking_id.id, cr)
+ if move.move_dest_id.auto_validate:
+ self.action_done(cr, uid, [move.move_dest_id.id], context=context)
self._create_product_valuation_moves(cr, uid, move, context=context)
if move.state not in ('confirmed','done','assigned'):
diff --git a/addons/stock/stock_sequence.xml b/addons/stock/stock_sequence.xml
index 6c0b3e84cf2..c3569c48c3e 100644
--- a/addons/stock/stock_sequence.xml
+++ b/addons/stock/stock_sequence.xml
@@ -17,7 +17,7 @@
Picking INT
- stock.picking.internal
+ stock.picking
|