diff options
| author | bth-openerp <bth@tinyerp.com> | 2013-06-07 18:46:46 +0530 |
|---|---|---|
| committer | bth-openerp <bth@tinyerp.com> | 2013-06-07 18:46:46 +0530 |
| commit | 30aaee9ccbce39f0fedcdab1e82296682de8570e (patch) | |
| tree | 3c51d800213be8d354c45027e26e3279ac2e26d5 | |
| parent | a3830c9ed3d7d0b5479f0c86fe1d250a58328650 (diff) | |
| parent | 8c6ff33bef12cdfed35b15a90c3fd13bdd723b42 (diff) | |
[MERGE]Merge lp:openobject-addons.
bzr revid: bth@tinyerp.com-20130607131646-64gmohqzs6586l57
162 files changed, 6364 insertions, 1069 deletions
diff --git a/addons/account/account.py b/addons/account/account.py index e92bd3a7879..a68c1de0939 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -648,10 +648,10 @@ class account_account(osv.osv): if line_obj.search(cr, uid, [('account_id', 'in', account_ids)]): #Check for 'Closed' type if old_type == 'closed' and new_type !='closed': - raise osv.except_osv(_('Warning !'), _("You cannot change the type of account from 'Closed' to any other type as it contains journal items!")) + raise osv.except_osv(_('Warning!'), _("You cannot change the type of account from 'Closed' to any other type as it contains journal items!")) # Forbid to change an account type for restricted_groups as it contains journal items (or if one of its children does) if (new_type in restricted_groups): - raise osv.except_osv(_('Warning !'), _("You cannot change the type of account to '%s' type as it contains journal items!") % (new_type,)) + raise osv.except_osv(_('Warning!'), _("You cannot change the type of account to '%s' type as it contains journal items!") % (new_type,)) return True @@ -1015,14 +1015,14 @@ class account_period(osv.osv): if not result: result = self.search(cr, uid, args, context=context) if not result: - raise osv.except_osv(_('Error !'), _('There is no period defined for this date: %s.\nPlease create one.')%dt) + raise osv.except_osv(_('Error!'), _('There is no period defined for this date: %s.\nPlease create one.')%dt) return result def action_draft(self, cr, uid, ids, *args): mode = 'draft' for period in self.browse(cr, uid, ids): if period.fiscalyear_id.state == 'done': - raise osv.except_osv(_('Warning !'), _('You can not re-open a period which belongs to closed fiscal year')) + raise osv.except_osv(_('Warning!'), _('You can not re-open a period which belongs to closed fiscal year')) cr.execute('update account_journal_period set state=%s where period_id in %s', (mode, tuple(ids),)) cr.execute('update account_period set state=%s where id in %s', (mode, tuple(ids),)) return True @@ -1034,9 +1034,15 @@ class account_period(osv.osv): context = {} ids = [] if name: - ids = self.search(cr, user, [('code','ilike',name)]+ args, limit=limit) + ids = self.search(cr, user, + [('code', 'ilike', name)] + args, + limit=limit, + context=context) if not ids: - ids = self.search(cr, user, [('name',operator,name)]+ args, limit=limit) + ids = self.search(cr, user, + [('name', operator, name)] + args, + limit=limit, + context=context) return self.name_get(cr, user, ids, context=context) def write(self, cr, uid, ids, vals, context=None): @@ -1059,10 +1065,14 @@ class account_period(osv.osv): raise osv.except_osv(_('Error!'), _('You should choose the periods that belong to the same company.')) if period_date_start > period_date_stop: raise osv.except_osv(_('Error!'), _('Start period should precede then end period.')) + + # /!\ We do not include a criterion on the company_id field below, to allow producing consolidated reports + # on multiple companies. It will only work when start/end periods are selected and no fiscal year is chosen. + #for period from = january, we want to exclude the opening period (but it has same date_from, so we have to check if period_from is special or not to include that clause or not in the search). if period_from.special: - return self.search(cr, uid, [('date_start', '>=', period_date_start), ('date_stop', '<=', period_date_stop), ('company_id', '=', company1_id)]) - return self.search(cr, uid, [('date_start', '>=', period_date_start), ('date_stop', '<=', period_date_stop), ('company_id', '=', company1_id), ('special', '=', False)]) + return self.search(cr, uid, [('date_start', '>=', period_date_start), ('date_stop', '<=', period_date_stop)]) + return self.search(cr, uid, [('date_start', '>=', period_date_start), ('date_stop', '<=', period_date_stop), ('special', '=', False)]) class account_journal_period(osv.osv): @@ -1854,6 +1864,12 @@ class account_tax_code(osv.osv): _order = 'code' +def get_precision_tax(): + def change_digit_tax(cr): + res = openerp.registry(cr.dbname)['decimal.precision'].precision_get(cr, SUPERUSER_ID, 'Account') + return (16, res+3) + return change_digit_tax + class account_tax(osv.osv): """ A tax object. @@ -1874,12 +1890,6 @@ class account_tax(osv.osv): default.update({'name': name + _(' (Copy)')}) return super(account_tax, self).copy_data(cr, uid, id, default=default, context=context) - def get_precision_tax(): - def change_digit_tax(cr): - res = openerp.registry(cr.dbname)['decimal.precision'].precision_get(cr, SUPERUSER_ID, 'Account') - return (16, res+2) - return change_digit_tax - _name = 'account.tax' _description = 'Tax' _columns = { @@ -2307,7 +2317,7 @@ class account_model(osv.osv): try: entry['name'] = model.name%{'year': move_date.strftime('%Y'), 'month': move_date.strftime('%m'), 'date': move_date.strftime('%Y-%m')} except: - raise osv.except_osv(_('Wrong model !'), _('You have a wrong expression "%(...)s" in your model !')) + raise osv.except_osv(_('Wrong Model!'), _('You have a wrong expression "%(...)s" in your model!')) move_id = account_move_obj.create(cr, uid, { 'ref': entry['name'], 'period_id': period_id, @@ -2319,7 +2329,7 @@ class account_model(osv.osv): analytic_account_id = False if line.analytic_account_id: if not model.journal_id.analytic_journal_id: - raise osv.except_osv(_('No Analytic Journal !'),_("You have to define an analytic journal on the '%s' journal!") % (model.journal_id.name,)) + raise osv.except_osv(_('No Analytic Journal!'),_("You have to define an analytic journal on the '%s' journal!") % (model.journal_id.name,)) analytic_account_id = line.analytic_account_id.id val = { 'move_id': move_id, @@ -2795,7 +2805,7 @@ class account_tax_template(osv.osv): 'chart_template_id': fields.many2one('account.chart.template', 'Chart Template', required=True), 'name': fields.char('Tax Name', size=64, required=True), 'sequence': fields.integer('Sequence', required=True, help="The sequence field is used to order the taxes lines from lower sequences to higher ones. The order is important if you have a tax that has several tax children. In this case, the evaluation order is important."), - 'amount': fields.float('Amount', required=True, digits=(14,4), help="For Tax Type percent enter % ratio between 0-1."), + 'amount': fields.float('Amount', required=True, digits_compute=get_precision_tax(), help="For Tax Type percent enter % ratio between 0-1."), 'type': fields.selection( [('percent','Percent'), ('fixed','Fixed'), ('none','None'), ('code','Python Code'), ('balance','Balance')], 'Tax Type', required=True), 'applicable_type': fields.selection( [('true','True'), ('code','Python Code')], 'Applicable Type', required=True, help="If not applicable (computed through a Python code), the tax won't appear on the invoice."), 'domain':fields.char('Domain', size=32, help="This field is only used if you develop your own module allowing developers to create specific taxes in a custom domain."), diff --git a/addons/account/account_bank_statement.py b/addons/account/account_bank_statement.py index 023765d73f0..8a15321b9c6 100644 --- a/addons/account/account_bank_statement.py +++ b/addons/account/account_bank_statement.py @@ -420,7 +420,7 @@ class account_bank_statement(osv.osv): for st_line in st.line_ids: if st_line.analytic_account_id: if not st.journal_id.analytic_journal_id: - raise osv.except_osv(_('No Analytic Journal !'),_("You have to assign an analytic journal on the '%s' journal!") % (st.journal_id.name,)) + raise osv.except_osv(_('No Analytic Journal!'),_("You have to assign an analytic journal on the '%s' journal!") % (st.journal_id.name,)) if not st_line.amount: continue st_line_number = self.get_next_st_line_number(cr, uid, st_number, st_line, context) diff --git a/addons/account/account_cash_statement.py b/addons/account/account_cash_statement.py index 40f0ca80738..8e3e250d41c 100644 --- a/addons/account/account_cash_statement.py +++ b/addons/account/account_cash_statement.py @@ -252,7 +252,7 @@ class account_cash_statement(osv.osv): for statement in statement_pool.browse(cr, uid, ids, context=context): vals = {} if not self._user_allow(cr, uid, statement.id, context=context): - raise osv.except_osv(_('Error!'), (_('You do not have rights to open this %s journal !') % (statement.journal_id.name, ))) + raise osv.except_osv(_('Error!'), (_('You do not have rights to open this %s journal!') % (statement.journal_id.name, ))) if statement.name and statement.name == '/': c = {'fiscalyear_id': statement.period_id.fiscalyear_id.id} diff --git a/addons/account/account_invoice.py b/addons/account/account_invoice.py index ab6ad97b180..01476374cf4 100644 --- a/addons/account/account_invoice.py +++ b/addons/account/account_invoice.py @@ -69,7 +69,7 @@ class account_invoice(osv.osv): tt = type2journal.get(type_inv, 'sale') result = self.pool.get('account.analytic.journal').search(cr, uid, [('type','=',tt)], context=context) if not result: - raise osv.except_osv(_('No Analytic Journal !'),_("You must define an analytic journal of type '%s'!") % (tt,)) + raise osv.except_osv(_('No Analytic Journal!'),_("You must define an analytic journal of type '%s'!") % (tt,)) return result[0] def _get_type(self, cr, uid, context=None): @@ -89,13 +89,43 @@ class account_invoice(osv.osv): return [('none', _('Free Reference'))] def _amount_residual(self, cr, uid, ids, name, args, context=None): + """Function of the field residua. It computes the residual amount (balance) for each invoice""" + if context is None: + context = {} + ctx = context.copy() result = {} + currency_obj = self.pool.get('res.currency') for invoice in self.browse(cr, uid, ids, context=context): + nb_inv_in_partial_rec = max_invoice_id = 0 result[invoice.id] = 0.0 if invoice.move_id: - for m in invoice.move_id.line_id: - if m.account_id.type in ('receivable','payable'): - result[invoice.id] += m.amount_residual_currency + for aml in invoice.move_id.line_id: + if aml.account_id.type in ('receivable','payable'): + if aml.currency_id and aml.currency_id.id == invoice.currency_id.id: + result[invoice.id] += aml.amount_residual_currency + else: + ctx['date'] = aml.date + result[invoice.id] += currency_obj.compute(cr, uid, aml.company_id.currency_id.id, invoice.currency_id.id, aml.amount_residual, context=ctx) + + if aml.reconcile_partial_id.line_partial_ids: + #we check if the invoice is partially reconciled and if there are other invoices + #involved in this partial reconciliation (and we sum these invoices) + for line in aml.reconcile_partial_id.line_partial_ids: + if line.invoice: + nb_inv_in_partial_rec += 1 + #store the max invoice id as for this invoice we will make a balance instead of a simple division + max_invoice_id = max(max_invoice_id, line.invoice.id) + if nb_inv_in_partial_rec: + #if there are several invoices in a partial reconciliation, we split the residual by the number + #of invoice to have a sum of residual amounts that matches the partner balance + new_value = currency_obj.round(cr, uid, invoice.currency_id, result[invoice.id] / nb_inv_in_partial_rec) + if invoice.id == max_invoice_id: + #if it's the last the invoice of the bunch of invoices partially reconciled together, we make a + #balance to avoid rounding errors + result[invoice.id] = result[invoice.id] - ((nb_inv_in_partial_rec - 1) * new_value) + else: + result[invoice.id] = new_value + #prevent the residual amount on the invoice to be less than 0 result[invoice.id] = max(result[invoice.id], 0.0) return result @@ -600,7 +630,7 @@ class account_invoice(osv.osv): obj_l = account_obj.browse(cr, uid, inv_line[2]['account_id']) if obj_l.company_id.id != company_id: raise osv.except_osv(_('Configuration Error!'), - _('Invoice line account\'s company and invoice\'s compnay does not match.')) + _('Invoice line account\'s company and invoice\'s company does not match.')) else: continue if company_id and type: @@ -756,7 +786,7 @@ class account_invoice(osv.osv): else: ref = self._convert_ref(cr, uid, inv.number) if not inv.journal_id.analytic_journal_id: - raise osv.except_osv(_('No Analytic Journal !'),_("You have to define an analytic journal on the '%s' journal!") % (inv.journal_id.name,)) + raise osv.except_osv(_('No Analytic Journal!'),_("You have to define an analytic journal on the '%s' journal!") % (inv.journal_id.name,)) il['analytic_lines'] = [(0,0, { 'name': il['name'], 'date': inv['date_invoice'], @@ -882,7 +912,7 @@ class account_invoice(osv.osv): if not inv.journal_id.sequence_id: raise osv.except_osv(_('Error!'), _('Please define sequence on the journal related to this invoice.')) if not inv.invoice_line: - raise osv.except_osv(_('No Invoice Lines !'), _('Please create some invoice lines.')) + raise osv.except_osv(_('No Invoice Lines!'), _('Please create some invoice lines.')) if inv.move_id: continue @@ -903,7 +933,7 @@ class account_invoice(osv.osv): group_check_total = self.pool.get('res.groups').browse(cr, uid, group_check_total_id, context=context) if group_check_total and uid in [x.id for x in group_check_total.users]: if (inv.type in ('in_invoice', 'in_refund') and abs(inv.check_total - inv.amount_total) >= (inv.currency_id.rounding/2.0)): - raise osv.except_osv(_('Bad total !'), _('Please verify the price of the invoice !\nThe encoded total does not match the computed total.')) + raise osv.except_osv(_('Bad Total!'), _('Please verify the price of the invoice!\nThe encoded total does not match the computed total.')) if inv.payment_term: total_fixed = total_percent = 0 @@ -1445,7 +1475,7 @@ class account_invoice_line(osv.osv): context = dict(context) context.update({'company_id': company_id, 'force_company': company_id}) if not partner_id: - raise osv.except_osv(_('No Partner Defined !'),_("You must first select a partner !") ) + raise osv.except_osv(_('No Partner Defined!'),_("You must first select a partner!") ) if not product: if type in ('in_invoice', 'in_refund'): return {'value': {}, 'domain':{'product_uom':[]}} diff --git a/addons/account/account_invoice_view.xml b/addons/account/account_invoice_view.xml index 7469c38decb..c71b97d5796 100644 --- a/addons/account/account_invoice_view.xml +++ b/addons/account/account_invoice_view.xml @@ -197,7 +197,7 @@ <field name="name"/> <field name="company_id" invisible="1"/> <field name="account_id" groups="account.group_account_user" - domain="[('company_id', '=', parent.company_id), ('journal_id', '=', parent.journal_id), ('type', '!=', 'view')]" + domain="[('company_id', '=', parent.company_id), ('journal_id', '=', parent.journal_id), ('type', '=', 'other')]" on_change="onchange_account_id(product_id, parent.partner_id, parent.type, parent.fiscal_position,account_id)"/> <field name="account_analytic_id" groups="analytic.group_analytic_accounting" domain="[('type','!=','view'), ('company_id', '=', parent.company_id)]"/> @@ -320,7 +320,7 @@ <group> <field string="Customer" name="partner_id" on_change="onchange_partner_id(type,partner_id,date_invoice,payment_term, partner_bank_id,company_id)" - groups="base.group_user" context="{'search_default_customer':1, 'show_address': 1}" + context="{'search_default_customer':1, 'show_address': 1}" options='{"always_reload": True}' domain="[('customer', '=', True)]"/> <field name="fiscal_position" widget="selection" /> @@ -353,7 +353,7 @@ <field name="name"/> <field name="company_id" invisible="1"/> <field name="account_id" groups="account.group_account_user" - domain="[('company_id', '=', parent.company_id), ('journal_id', '=', parent.journal_id), ('type', '!=', 'view')]" + domain="[('company_id', '=', parent.company_id), ('journal_id', '=', parent.journal_id), ('type', '=', 'other')]" on_change="onchange_account_id(product_id, parent.partner_id, parent.type, parent.fiscal_position,account_id)"/> <field name="account_analytic_id" groups="analytic.group_analytic_accounting" domain="[('type','!=','view'), ('company_id', '=', parent.company_id)]"/> diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py index d6c25364784..e604cc6d1a4 100644 --- a/addons/account/account_move_line.py +++ b/addons/account/account_move_line.py @@ -192,7 +192,7 @@ class account_move_line(osv.osv): for obj_line in self.browse(cr, uid, ids, context=context): if obj_line.analytic_account_id: if not obj_line.journal_id.analytic_journal_id: - raise osv.except_osv(_('No Analytic Journal !'),_("You have to define an analytic journal on the '%s' journal!") % (obj_line.journal_id.name, )) + raise osv.except_osv(_('No Analytic Journal!'),_("You have to define an analytic journal on the '%s' journal!") % (obj_line.journal_id.name, )) vals_line = self._prepare_analytic_line(cr, uid, obj_line, context=context) acc_ana_line_obj.create(cr, uid, vals_line) return True @@ -1101,7 +1101,7 @@ class account_move_line(osv.osv): period = period_obj.browse(cr, uid, period_id, context=context) for (state,) in result: if state == 'done': - raise osv.except_osv(_('Error !'), _('You can not add/modify entries in a closed period %s of journal %s.' % (period.name,journal.name))) + raise osv.except_osv(_('Error!'), _('You can not add/modify entries in a closed period %s of journal %s.' % (period.name,journal.name))) if not result: jour_period_obj.create(cr, uid, { 'name': (journal.code or journal.name)+':'+(period.name or ''), @@ -1181,7 +1181,7 @@ class account_move_line(osv.osv): move_id = move_obj.create(cr, uid, v, context) vals['move_id'] = move_id else: - raise osv.except_osv(_('No piece number !'), _('Cannot create an automatic sequence for this piece.\nPut a sequence in the journal definition for automatic numbering or create a sequence manually for this piece.')) + raise osv.except_osv(_('No Piece Number!'), _('Cannot create an automatic sequence for this piece.\nPut a sequence in the journal definition for automatic numbering or create a sequence manually for this piece.')) ok = not (journal.type_control_ids or journal.account_control_ids) if ('account_id' in vals): account = account_obj.browse(cr, uid, vals['account_id'], context=context) diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index 603c4254b19..e921e639642 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -907,9 +907,7 @@ <label for="type"/> <div> <field name="type"/> - <field name="amount" class="oe_inline" - attrs="{'invisible':[('type','in',('none', 'code', 'balance'))]}"/> - <label string="%%" attrs="{'invisible':[('type','<>','percent')]}"/> + <field name="amount" attrs="{'invisible':[('type','in',('none', 'code', 'balance'))]}"/> </div> <field name="python_compute" attrs="{'invisible':[('type','!=','code')],'required':[('type','=','code')]}"/> <field name="python_compute_inv" attrs="{'invisible':[('type','!=','code')],'required':[('type','=','code')]}"/> diff --git a/addons/account/i18n/ru.po b/addons/account/i18n/ru.po index 8f547c224fc..17687d26313 100644 --- a/addons/account/i18n/ru.po +++ b/addons/account/i18n/ru.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-12-21 17:04+0000\n" -"PO-Revision-Date: 2013-05-29 13:04+0000\n" +"PO-Revision-Date: 2013-06-05 13:02+0000\n" "Last-Translator: Chertykov Denis <chertykov@gmail.com>\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: 2013-05-30 05:45+0000\n" -"X-Generator: Launchpad (build 16652)\n" +"X-Launchpad-Export-Date: 2013-06-06 05:21+0000\n" +"X-Generator: Launchpad (build 16667)\n" #. module: account #: model:process.transition,name:account.process_transition_supplierreconcilepaid0 @@ -465,7 +465,7 @@ msgstr "Шаблона плана счетов" #. module: account #: selection:account.invoice.refund,filter_refund:0 msgid "Modify: create refund, reconcile and create a new draft invoice" -msgstr "" +msgstr "Изменить: создать возврат, сверить и создать новый счет" #. module: account #: help:account.config.settings,tax_calculation_rounding_method:0 @@ -704,6 +704,8 @@ msgid "" "Invoice_${(object.number or '').replace('/','_')}_${object.state == 'draft' " "and 'draft' or ''}" msgstr "" +"Invoice_${(object.number or '').replace('/','_')}_${object.state == 'draft' " +"and 'draft' or ''}" #. module: account #: view:account.period:0 @@ -731,6 +733,8 @@ msgstr "Период журнала" msgid "" "You cannot create more than one move per period on a centralized journal." msgstr "" +"Вы не можете создать более одного движения за период в централизованном " +"журнале." #. module: account #: help:account.tax,account_analytic_paid_id:0 @@ -911,6 +915,7 @@ msgid "" "Print Report with the currency column if the currency differs from the " "company currency." msgstr "" +"Печать отчета с колонкой валюты, если валюта отличается от валюты компании." #. module: account #: report:account.analytic.account.quantity_cost_ledger:0 @@ -950,6 +955,10 @@ msgid "" " </p>\n" " " msgstr "" +"<p>\n" +" Элементы журнала не найдены.\n" +" </p>\n" +" " #. module: account #: code:addons/account/account.py:1639 @@ -1039,7 +1048,7 @@ msgstr "Обязательства" #: code:addons/account/account_invoice.py:867 #, python-format msgid "Please define sequence on the journal related to this invoice." -msgstr "" +msgstr "Пожалуйста, определите нумерацию в журнале, связанном с этим счетом." #. module: account #: view:account.entries.report:0 @@ -1517,6 +1526,9 @@ msgid "" "And after getting confirmation from the bank it will be in 'Confirmed' " "status." msgstr "" +"Когда новый отчет создан - статус станет \"Черновик\".\n" +"После получения подтверждения из банка, статус измениться на \" " +"Подтверждено\"." #. module: account #: field:account.invoice.report,state:0 @@ -1560,6 +1572,8 @@ msgid "" "There is no default debit account defined \n" "on journal \"%s\"." msgstr "" +"Дебетовый счет по умолчанию не определен\n" +"в журнале \"%s\"." #. module: account #: view:account.tax:0 @@ -1662,7 +1676,7 @@ msgstr "" #. module: account #: field:account.config.settings,company_footer:0 msgid "Bank accounts footer preview" -msgstr "" +msgstr "Просмотр нижнего колонтитула банковских счетов" #. module: account #: selection:account.account,type:0 diff --git a/addons/account/installer.py b/addons/account/installer.py index 537371d0f64..961b8f9e763 100644 --- a/addons/account/installer.py +++ b/addons/account/installer.py @@ -111,7 +111,7 @@ class account_installer(osv.osv_memory): def check_unconfigured_cmp(self, cr, uid, context=None): """ check if there are still unconfigured companies """ if not self.get_unconfigured_cmp(cr, uid, context=context): - raise osv.except_osv(_('No unconfigured company !'), _("There is currently no company without chart of account. The wizard will therefore not be executed.")) + raise osv.except_osv(_('No Unconfigured Company!'), _("There is currently no company without chart of account. The wizard will therefore not be executed.")) def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): if context is None: context = {} diff --git a/addons/account/partner_view.xml b/addons/account/partner_view.xml index f6c89a92560..3dcc68e315e 100644 --- a/addons/account/partner_view.xml +++ b/addons/account/partner_view.xml @@ -68,7 +68,7 @@ name="%(account.action_invoice_tree)d" context="{'search_default_partner_id': active_id,'default_partner_id': active_id}" groups="account.group_account_invoice"/> <button type="action" string="Journal Items" name="%(account.action_account_moves_all_tree)d" groups="account.group_account_user"/> - <button type="action" string="Contracts/Analytic Accounts" name="%(account.action_open_partner_analytic_accounts)d" + <button type="action" string="Contracts" name="%(account.action_open_partner_analytic_accounts)d" groups="analytic.group_analytic_accounting"/> </xpath> </field> diff --git a/addons/account/product_view.xml b/addons/account/product_view.xml index 44d53839700..2c540cb6ee6 100644 --- a/addons/account/product_view.xml +++ b/addons/account/product_view.xml @@ -11,11 +11,11 @@ <page string="Accounting" groups="account.group_account_invoice"> <group name="properties"> <group> - <field name="property_account_income" domain="[('type','<>','view'),('type','<>','consolidation')]" groups="account.group_account_user"/> + <field name="property_account_income" domain="[('type','=','other')]" groups="account.group_account_user"/> <field name="taxes_id" colspan="2" attrs="{'readonly':[('sale_ok','=',0)]}" widget="many2many_tags"/> </group> <group> - <field name="property_account_expense" domain="[('type','<>','view'),('type','<>','consolidation')]" groups="account.group_account_user"/> + <field name="property_account_expense" domain="[('type','=','other')]" groups="account.group_account_user"/> <field name="supplier_taxes_id" colspan="2" widget="many2many_tags"/> </group> </group> diff --git a/addons/account/project/project_view.xml b/addons/account/project/project_view.xml index 4dbdf41abf0..6ce97b5c868 100644 --- a/addons/account/project/project_view.xml +++ b/addons/account/project/project_view.xml @@ -68,6 +68,7 @@ <field name="parent_id" invisible="1"/> <field name="type"/> <field name="company_id" groups="base.group_multi_company"/> + <field name="template_id" invisible="1"/> </tree> </field> </record> diff --git a/addons/account/report/account_print_invoice.rml b/addons/account/report/account_print_invoice.rml index 9268c94d4c7..3582221df44 100644 --- a/addons/account/report/account_print_invoice.rml +++ b/addons/account/report/account_print_invoice.rml @@ -99,42 +99,39 @@ <initialize> <paraStyle name="all" alignment="justify"/> </initialize> - <paraStyle name="Standard" fontName="Helvetica"/> - <paraStyle name="Text body" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/> - <paraStyle name="List" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/> - <paraStyle name="Table Contents" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/> - <paraStyle name="Table Heading" fontName="Helvetica" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/> - <paraStyle name="Caption" fontName="Helvetica" fontSize="10.0" leading="13" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="Index" fontName="Helvetica"/> - <paraStyle name="Heading" fontName="Helvetica" fontSize="15.0" leading="19" spaceBefore="12.0" spaceAfter="6.0"/> - <paraStyle name="terp_header" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/> - <paraStyle name="terp_default_8" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="Footer" fontName="Helvetica"/> - <paraStyle name="Horizontal Line" fontName="Helvetica" fontSize="6.0" leading="8" spaceBefore="0.0" spaceAfter="14.0"/> - <paraStyle name="Heading 9" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" spaceBefore="12.0" spaceAfter="6.0"/> - <paraStyle name="terp_tblheader_General" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="terp_tblheader_Details" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="terp_default_Bold_8" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_tblheader_General_Centre" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="terp_tblheader_General_Right" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="terp_tblheader_Details_Centre" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="terp_tblheader_Details_Right" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="terp_default_Right_8" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_Centre_8" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_header_Right" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/> - <paraStyle name="terp_header_Centre" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="CENTER" spaceBefore="12.0" spaceAfter="6.0"/> - <paraStyle name="terp_default_address" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_9" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_Bold_9" rightIndent="0.0" leftIndent="-3.0" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_Centre_9" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_Right_9" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_Bold_Right_9" rightIndent="0.0" leftIndent="-3.0" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_2" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="2.0" leading="3" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_White_2" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="2.0" leading="3" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0" textColor="#ffffff"/> - <paraStyle name="terp_default_Note" rightIndent="0.0" leftIndent="9.0" fontName="Helvetica-Oblique" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="Table" fontName="Helvetica" fontSize="10.0" leading="13" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="User Index 10" rightIndent="0.0" leftIndent="127.0" fontName="Helvetica"/> - <paraStyle name="Preformatted Text" fontName="Helvetica" fontSize="10.0" leading="13" spaceBefore="0.0" spaceAfter="0.0"/> + <paraStyle name="Standard"/> + <paraStyle name="Text body" spaceBefore="0.0" spaceAfter="6.0"/> + <paraStyle name="List" spaceBefore="0.0" spaceAfter="6.0"/> + <paraStyle name="Table Contents" spaceBefore="0.0" spaceAfter="6.0"/> + <paraStyle name="Caption" fontSize="10.0" leading="13" spaceBefore="6.0" spaceAfter="6.0"/> + <paraStyle name="Index"/> + + <paraStyle name="terp_header" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/> + <paraStyle name="terp_default_8" rightIndent="0.0" leftIndent="0.0" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> + <paraStyle name="Footer"/> + <paraStyle name="Horizontal Line" fontSize="6.0" leading="8" spaceBefore="0.0" spaceAfter="14.0"/> + + <paraStyle name="terp_tblheader_General" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/> + <paraStyle name="terp_tblheader_Details" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/> + <paraStyle name="terp_tblheader_General_Centre" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/> + <paraStyle name="terp_tblheader_General_Right" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/> + <paraStyle name="terp_tblheader_Details_Centre" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/> + <paraStyle name="terp_tblheader_Details_Right" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/> + + <paraStyle name="terp_default_Right_8" rightIndent="0.0" leftIndent="0.0" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/> + <paraStyle name="terp_default_Centre_8" rightIndent="0.0" leftIndent="0.0" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/> + <paraStyle name="terp_default_address" rightIndent="0.0" leftIndent="0.0" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> + <paraStyle name="terp_default_9" rightIndent="0.0" leftIndent="0.0" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> + <paraStyle name="terp_default_Bold_9" rightIndent="0.0" leftIndent="-3.0" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> + <paraStyle name="terp_default_Centre_9" rightIndent="0.0" leftIndent="0.0" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/> + <paraStyle name="terp_default_Right_9" rightIndent="0.0" leftIndent="0.0" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/> + <paraStyle name="terp_default_Bold_Right_9" rightIndent="0.0" leftIndent="-3.0" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/> + <paraStyle name="terp_default_2" rightIndent="0.0" leftIndent="0.0" fontSize="2.0" leading="3" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> + <paraStyle name="terp_default_White_2" rightIndent="0.0" leftIndent="0.0" fontSize="2.0" leading="3" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0" textColor="#ffffff"/> + + <paraStyle name="Table" fontSize="10.0" leading="13" spaceBefore="6.0" spaceAfter="6.0"/> + <paraStyle name="User Index 10" rightIndent="0.0" leftIndent="127.0"/> + <paraStyle name="Preformatted Text" fontSize="10.0" leading="13" spaceBefore="0.0" spaceAfter="0.0"/> <images/> </stylesheet> <story> @@ -144,12 +141,12 @@ <pto_header><!-- Must be after setLang() --> <blockTable colWidths="202.0,87.0,71.0,57.0,42.0,71.0" style="Table7"> <tr> - <td> <para style="terp_tblheader_Details">Description</para> </td> - <td> <para style="terp_tblheader_Details_Centre">Taxes</para> </td> - <td> <para style="terp_tblheader_Details_Centre">Quantity</para> </td> - <td> <para style="terp_tblheader_Details_Right">Unit Price </para> </td> - <td> <para style="terp_tblheader_Details_Right">Disc.(%)</para> </td> - <td> <para style="terp_tblheader_Details_Right">Price</para> </td> + <td><para style="terp_tblheader_Details"><b>Description</b></para></td> + <td><para style="terp_tblheader_Details_Centre"><b>Taxes</b></para></td> + <td><para style="terp_tblheader_Details_Centre"><b>Quantity</b></para></td> + <td><para style="terp_tblheader_Details_Right"><b>Unit Price</b></para></td> + <td><para style="terp_tblheader_Details_Right"><b>Disc.(%)</b></para></td> + <td><para style="terp_tblheader_Details_Right"><b>Price</b></para></td> </tr> </blockTable> </pto_header> @@ -172,29 +169,29 @@ </td> </tr> </blockTable> - <para style="terp_header">Invoice [[ ((o.type == 'out_invoice' and (o.state == 'open' or o.state == 'paid')) or removeParentNode('para')) and '' ]] [[ o.number ]]</para> - <para style="terp_header">PRO-FORMA [[ ((o.type == 'out_invoice' and o.state == 'proforma2') or removeParentNode('para')) and '' ]]</para> - <para style="terp_header">Draft Invoice [[ ((o.type == 'out_invoice' and o.state == 'draft') or removeParentNode('para')) and '' ]]</para> - <para style="terp_header">Cancelled Invoice [[ ((o.type == 'out_invoice' and o.state == 'cancel') or removeParentNode('para')) and '' ]] [[ o.number ]]</para> - <para style="terp_header">Refund [[ (o.type=='out_refund' or removeParentNode('para')) and '' ]] [[ o.number ]]</para> - <para style="terp_header">Supplier Refund [[ (o.type=='in_refund' or removeParentNode('para')) and '' ]] [[ o.number ]]</para> - <para style="terp_header">Supplier Invoice [[ (o.type=='in_invoice' or removeParentNode('para')) and '' ]] [[ o.number ]]</para> + <para style="terp_header"><b>Invoice [[ ((o.type == 'out_invoice' and (o.state == 'open' or o.state == 'paid')) or removeParentNode('para')) and '' ]] [[ o.number ]]</b></para> + <para style="terp_header"><b>PRO-FORMA [[ ((o.type == 'out_invoice' and o.state == 'proforma2') or removeParentNode('para')) and '' ]]</b></para> + <para style="terp_header"><b>Draft Invoice [[ ((o.type == 'out_invoice' and o.state == 'draft') or removeParentNode('para')) and '' ]]</b></para> + <para style="terp_header"><b>Cancelled Invoice [[ ((o.type == 'out_invoice' and o.state == 'cancel') or removeParentNode('para')) and '' ]] [[ o.number ]]</b></para> + <para style="terp_header"><b>Refund [[ (o.type=='out_refund' or removeParentNode('para')) and '' ]] [[ o.number ]]</b></para> + <para style="terp_header"><b>Supplier Refund [[ (o.type=='in_refund' or removeParentNode('para')) and '' ]] [[ o.number ]]</b></para> + <para style="terp_header"><b>Supplier Invoice [[ (o.type=='in_invoice' or removeParentNode('para')) and '' ]] [[ o.number ]]</b></para> <para style="terp_default_8"> <font color="white"> </font> </para> <blockTable colWidths="132.50,132.50,132.50,132.50" style="Table_Invoice_General_Header"> <tr> <td> - <para style="terp_tblheader_General_Centre">Description</para> + <para style="terp_tblheader_General_Centre"><b>Description</b></para> </td> <td> - <para style="terp_tblheader_General_Centre">Invoice Date</para> + <para style="terp_tblheader_General_Centre"><b>Invoice Date</b></para> </td> - <td> - <para style="terp_tblheader_General_Centre">Source</para> + <td> + <para style="terp_tblheader_General_Centre"><b>Source</b></para> </td> <td> - <para style="terp_tblheader_General_Centre">Customer Code</para> + <para style="terp_tblheader_General_Centre"><b>Customer Code</b></para> </td> </tr> </blockTable> @@ -220,22 +217,22 @@ <blockTable colWidths="185.0,70.0,80.0,60.0,50.0,85.0" style="Table7"> <tr> <td> - <para style="terp_tblheader_General">Description</para> + <para style="terp_tblheader_General"><b>Description</b></para> </td> <td> - <para style="terp_tblheader_General_Centre">Taxes</para> + <para style="terp_tblheader_General_Centre"><b>Taxes</b></para> </td> <td> - <para style="terp_tblheader_General_Right">Quantity</para> + <para style="terp_tblheader_General_Right"><b>Quantity</b></para> </td> <td> - <para style="terp_tblheader_General_Right">Unit Price</para> + <para style="terp_tblheader_General_Right"><b>Unit Price</b></para> </td> <td> - <para style="terp_tblheader_General_Right">Disc.(%)</para> + <para style="terp_tblheader_General_Right"><b>Disc.(%)</b></para> </td> <td> - <para style="terp_tblheader_General_Right">Price</para> + <para style="terp_tblheader_General_Right"><b>Price</b></para> </td> </tr> </blockTable> @@ -298,10 +295,10 @@ </para> </td> <td> - <para style="terp_tblheader_Details">Total:</para> + <para style="terp_tblheader_Details"><b>Total:</b></para> </td> <td> - <para style="terp_default_Bold_Right_9">[[ formatLang(o.amount_total, digits=get_digits(dp='Account'), currency_obj=o.currency_id) ]]</para> + <para style="terp_default_Bold_Right_9"><b>[[ formatLang(o.amount_total, digits=get_digits(dp='Account'), currency_obj=o.currency_id) ]]</b></para> </td> </tr> </blockTable> @@ -311,13 +308,13 @@ <blockTable colWidths="205.0,71.0,71.0,183.0" style="Table9"> <tr> <td> - <para style="terp_tblheader_Details">Tax [[ o.tax_line==[] and removeParentNode('blockTable') ]]</para> + <para style="terp_tblheader_Details"><b>Tax [[ o.tax_line==[] and removeParentNode('blockTable') ]]</b></para> </td> <td> - <para style="terp_tblheader_Details_Right">Base </para> + <para style="terp_tblheader_Details_Right"><b>Base </b></para> </td> <td> - <para style="terp_tblheader_Details_Right">Amount </para> + <para style="terp_tblheader_Details_Right"><b>Amount </b></para> </td> <td> <para style="terp_default_8"> @@ -361,7 +358,7 @@ <blockTable colWidths="120.0,410.0" style="Table1"> <tr> <td> - <para style="terp_default_Bold_9">Fiscal Position Remark : </para> + <para style="terp_default_Bold_9"><b>Fiscal Position Remark : </b></para> </td> <td> <para style="terp_default_9">[[ (o.fiscal_position and o.fiscal_position.note and format(o.fiscal_position.note)) or removeParentNode('blockTable') ]]</para> diff --git a/addons/account/wizard/account_validate_account_move.py b/addons/account/wizard/account_validate_account_move.py index 324248284f1..050191db187 100644 --- a/addons/account/wizard/account_validate_account_move.py +++ b/addons/account/wizard/account_validate_account_move.py @@ -57,7 +57,7 @@ class validate_account_move_lines(osv.osv_memory): move_ids.append(line.move_id.id) move_ids = list(set(move_ids)) if not move_ids: - raise osv.except_osv(_('Warning!'), _('Selected Entry Lines does not have any account move enties in draft state.')) + raise osv.except_osv(_('Warning!'), _('Selected Entry Lines does not have any account move entries in draft state.')) obj_move.button_validate(cr, uid, move_ids, context) return {'type': 'ir.actions.act_window_close'} diff --git a/addons/account/wizard/pos_box.py b/addons/account/wizard/pos_box.py index bd38e6bbed6..4b7e63585d8 100644 --- a/addons/account/wizard/pos_box.py +++ b/addons/account/wizard/pos_box.py @@ -22,7 +22,7 @@ class CashBox(osv.osv_memory): records = self.pool[active_model].browse(cr, uid, active_ids, context=context) - return self._run(cr, uid, ids, records, context=None) + return self._run(cr, uid, ids, records, context=context) def _run(self, cr, uid, ids, records, context=None): for box in self.browse(cr, uid, ids, context=context): diff --git a/addons/account_analytic_analysis/account_analytic_analysis.py b/addons/account_analytic_analysis/account_analytic_analysis.py index e493f364a0e..b3dd2302a2f 100644 --- a/addons/account_analytic_analysis/account_analytic_analysis.py +++ b/addons/account_analytic_analysis/account_analytic_analysis.py @@ -653,7 +653,7 @@ class account_analytic_account(osv.osv): fpos_obj = self.pool.get('account.fiscal.position') if not contract.partner_id: - raise osv.except_osv(_('No Customer Defined !'),_("You must first select a Customer for Contract %s!") % contract.name ) + raise osv.except_osv(_('No Customer Defined!'),_("You must first select a Customer for Contract %s!") % contract.name ) fpos = contract.partner_id.property_account_position.id or False journal_ids = journal_obj.search(cr, uid, [('type', '=','sale'),('company_id', '=', contract.company_id.id or False)], limit=1) diff --git a/addons/account_analytic_plans/account_analytic_plans.py b/addons/account_analytic_plans/account_analytic_plans.py index 54b15ad565b..4cf12098fff 100644 --- a/addons/account_analytic_plans/account_analytic_plans.py +++ b/addons/account_analytic_plans/account_analytic_plans.py @@ -332,7 +332,7 @@ class account_move_line(osv.osv): for line in self.browse(cr, uid, ids, context=context): if line.analytics_id: if not line.journal_id.analytic_journal_id: - raise osv.except_osv(_('No Analytic Journal !'),_("You have to define an analytic journal on the '%s' journal.") % (line.journal_id.name,)) + raise osv.except_osv(_('No Analytic Journal!'),_("You have to define an analytic journal on the '%s' journal.") % (line.journal_id.name,)) toremove = analytic_line_obj.search(cr, uid, [('move_id','=',line.id)], context=context) if toremove: @@ -471,7 +471,7 @@ class account_bank_statement(osv.osv): for st_line in st.line_ids: if st_line.analytics_id: if not st.journal_id.analytic_journal_id: - raise osv.except_osv(_('No Analytic Journal !'),_("You have to define an analytic journal on the '%s' journal.") % (st.journal_id.name,)) + raise osv.except_osv(_('No Analytic Journal!'),_("You have to define an analytic journal on the '%s' journal.") % (st.journal_id.name,)) if not st_line.amount: continue return True diff --git a/addons/account_followup/account_followup_customers.xml b/addons/account_followup/account_followup_customers.xml index 6893abe012e..fba0bce460b 100644 --- a/addons/account_followup/account_followup_customers.xml +++ b/addons/account_followup/account_followup_customers.xml @@ -9,11 +9,12 @@ <field name="model">res.partner</field> <field name="priority" eval="20"/> <field name="arch" type="xml"> - <tree string="Customer Followup"> + <tree string="Customer Followup" create="false" delete="false"> <field name="display_name"/> <field name="payment_next_action_date"/> <field name="payment_next_action"/> <field name="user_id" invisible="1"/> + <field name="country_id" invisible="1"/> <field name="parent_id" invisible="1"/> <field name="payment_responsible_id"/> <field name="payment_earliest_due_date"/> @@ -97,7 +98,7 @@ <button name="action_done" type="object" string="⇾ Mark as Done" help="Click to mark the action as done." class="oe_link" attrs="{'invisible':[('payment_next_action_date','=', False)]}" - groups="base.group_partner_manager"/> + groups="account.group_account_user"/> <field name="payment_next_action" placeholder="Action to be taken e.g. Give a phonecall, Check if it's paid, ..."/> </div> </group> diff --git a/addons/account_followup/report/account_followup_report.xml b/addons/account_followup/report/account_followup_report.xml index 6fee6a77ac1..b7c38e89f5e 100644 --- a/addons/account_followup/report/account_followup_report.xml +++ b/addons/account_followup/report/account_followup_report.xml @@ -6,7 +6,7 @@ <field name="name">account_followup.stat.tree</field> <field name="model">account_followup.stat</field> <field name="arch" type="xml"> - <tree string="Follow-up lines"> + <tree string="Follow-up lines" create="false"> <field name="partner_id"/> <field name="date_move"/> <field name="date_move_last"/> diff --git a/addons/account_payment/wizard/account_payment_order.py b/addons/account_payment/wizard/account_payment_order.py index 08d36c45eff..03e25dfbc45 100644 --- a/addons/account_payment/wizard/account_payment_order.py +++ b/addons/account_payment/wizard/account_payment_order.py @@ -23,6 +23,7 @@ import time from lxml import etree from openerp.osv import fields, osv +from openerp.tools.translate import _ class payment_order_create(osv.osv_memory): """ @@ -108,7 +109,7 @@ class payment_order_create(osv.osv_memory): context.update({'line_ids': line_ids}) model_data_ids = mod_obj.search(cr, uid,[('model', '=', 'ir.ui.view'), ('name', '=', 'view_create_payment_order_lines')], context=context) resource_id = mod_obj.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id'] - return {'name': ('Entrie Lines'), + return {'name': _('Entry Lines'), 'context': context, 'view_type': 'form', 'view_mode': 'form', diff --git a/addons/account_test/i18n/ru.po b/addons/account_test/i18n/ru.po new file mode 100644 index 00000000000..d36d83d2e99 --- /dev/null +++ b/addons/account_test/i18n/ru.po @@ -0,0 +1,241 @@ +# Russian translation for openobject-addons +# Copyright (c) 2013 Rosetta Contributors and Canonical Ltd 2013 +# This file is distributed under the same license as the openobject-addons package. +# FIRST AUTHOR <EMAIL@ADDRESS>, 2013. +# +msgid "" +msgstr "" +"Project-Id-Version: openobject-addons\n" +"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n" +"POT-Creation-Date: 2012-12-21 17:05+0000\n" +"PO-Revision-Date: 2013-06-05 07:09+0000\n" +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" +"Language-Team: Russian <ru@li.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Launchpad-Export-Date: 2013-06-06 05:21+0000\n" +"X-Generator: Launchpad (build 16667)\n" + +#. module: account_test +#: view:accounting.assert.test:0 +msgid "" +"Code should always set a variable named `result` with the result of your " +"test, that can be a list or\n" +"a dictionary. If `result` is an empty list, it means that the test was " +"succesful. Otherwise it will\n" +"try to translate and print what is inside `result`.\n" +"\n" +"If the result of your test is a dictionary, you can set a variable named " +"`column_order` to choose in\n" +"what order you want to print `result`'s content.\n" +"\n" +"Should you need them, you can also use the following variables into your " +"code:\n" +" * cr: cursor to the database\n" +" * uid: ID of the current user\n" +"\n" +"In any ways, the code must be legal python statements with correct " +"indentation (if needed).\n" +"\n" +"Example: \n" +" sql = '''SELECT id, name, ref, date\n" +" FROM account_move_line \n" +" WHERE account_id IN (SELECT id FROM account_account WHERE type " +"= 'view')\n" +" '''\n" +" cr.execute(sql)\n" +" result = cr.dictfetchall()" +msgstr "" + +#. module: account_test +#: model:accounting.assert.test,name:account_test.account_test_02 +msgid "Test 2: Opening a fiscal year" +msgstr "Проверка 2: Открытие фискального года" + +#. module: account_test +#: model:accounting.assert.test,desc:account_test.account_test_05 +msgid "" +"Check that reconciled invoice for Sales/Purchases has reconciled entries for " +"Payable and Receivable Accounts" +msgstr "" + +#. module: account_test +#: model:accounting.assert.test,desc:account_test.account_test_03 +msgid "" +"Check if movement lines are balanced and have the same date and period" +msgstr "" + +#. module: account_test +#: field:accounting.assert.test,name:0 +msgid "Test Name" +msgstr "" + +#. module: account_test +#: report:account.test.assert.print:0 +msgid "Accouting tests on" +msgstr "" + +#. module: account_test +#: model:accounting.assert.test,name:account_test.account_test_01 +msgid "Test 1: General balance" +msgstr "Проверка 1: Общий баланс" + +#. module: account_test +#: model:accounting.assert.test,desc:account_test.account_test_06 +msgid "Check that paid/reconciled invoices are not in 'Open' state" +msgstr "" + +#. module: account_test +#: model:accounting.assert.test,desc:account_test.account_test_05_2 +msgid "" +"Check that reconciled account moves, that define Payable and Receivable " +"accounts, are belonging to reconciled invoices" +msgstr "" + +#. module: account_test +#: view:accounting.assert.test:0 +msgid "Tests" +msgstr "Проверки" + +#. module: account_test +#: field:accounting.assert.test,desc:0 +msgid "Test Description" +msgstr "Описание проверки" + +#. module: account_test +#: view:accounting.assert.test:0 +msgid "Description" +msgstr "Описание" + +#. module: account_test +#: model:accounting.assert.test,desc:account_test.account_test_06_1 +msgid "Check that there's no move for any account with « View » account type" +msgstr "" + +#. module: account_test +#: model:accounting.assert.test,name:account_test.account_test_08 +msgid "Test 9 : Accounts and partners on account moves" +msgstr "" + +#. module: account_test +#: model:ir.actions.act_window,name:account_test.action_accounting_assert +#: model:ir.actions.report.xml,name:account_test.account_assert_test_report +#: model:ir.ui.menu,name:account_test.menu_action_license +msgid "Accounting Tests" +msgstr "" + +#. module: account_test +#: code:addons/account_test/report/account_test_report.py:74 +#, python-format +msgid "The test was passed successfully" +msgstr "Проверка прошла успешно" + +#. module: account_test +#: field:accounting.assert.test,active:0 +msgid "Active" +msgstr "" + +#. module: account_test +#: model:accounting.assert.test,name:account_test.account_test_06 +msgid "Test 6 : Invoices status" +msgstr "" + +#. module: account_test +#: model:ir.model,name:account_test.model_accounting_assert_test +msgid "accounting.assert.test" +msgstr "accounting.assert.test" + +#. module: account_test +#: model:accounting.assert.test,name:account_test.account_test_05 +msgid "" +"Test 5.1 : Payable and Receivable accountant lines of reconciled invoices" +msgstr "" + +#. module: account_test +#: field:accounting.assert.test,code_exec:0 +msgid "Python code" +msgstr "Код на Python" + +#. module: account_test +#: model:accounting.assert.test,desc:account_test.account_test_07 +msgid "" +"Check on bank statement that the Closing Balance = Starting Balance + sum of " +"statement lines" +msgstr "" + +#. module: account_test +#: model:accounting.assert.test,name:account_test.account_test_07 +msgid "Test 8 : Closing balance on bank statements" +msgstr "" + +#. module: account_test +#: model:accounting.assert.test,name:account_test.account_test_03 +msgid "Test 3: Movement lines" +msgstr "" + +#. module: account_test +#: model:accounting.assert.test,name:account_test.account_test_05_2 +msgid "Test 5.2 : Reconcilied invoices and Payable/Receivable accounts" +msgstr "" + +#. module: account_test +#: view:accounting.assert.test:0 +msgid "Expression" +msgstr "" + +#. module: account_test +#: model:accounting.assert.test,name:account_test.account_test_04 +msgid "Test 4: Totally reconciled mouvements" +msgstr "" + +#. module: account_test +#: model:accounting.assert.test,desc:account_test.account_test_04 +msgid "Check if the totally reconciled movements are balanced" +msgstr "" + +#. module: account_test +#: field:accounting.assert.test,sequence:0 +msgid "Sequence" +msgstr "" + +#. module: account_test +#: model:accounting.assert.test,desc:account_test.account_test_02 +msgid "" +"Check if the balance of the new opened fiscal year matches with last year's " +"balance" +msgstr "" + +#. module: account_test +#: view:accounting.assert.test:0 +msgid "Python Code" +msgstr "Код на Python" + +#. module: account_test +#: model:ir.actions.act_window,help:account_test.action_accounting_assert +msgid "" +"<p class=\"oe_view_nocontent_create\">\n" +" Click to create Accounting Test.\n" +" </p>\n" +" " +msgstr "" + +#. module: account_test +#: model:accounting.assert.test,desc:account_test.account_test_01 +msgid "Check the balance: Debit sum = Credit sum" +msgstr "Проверяет баланс: сумма дебита = сумма кредита" + +#. module: account_test +#: model:accounting.assert.test,desc:account_test.account_test_08 +msgid "Check that general accounts and partners on account moves are active" +msgstr "" + +#. module: account_test +#: model:accounting.assert.test,name:account_test.account_test_06_1 +msgid "Test 7: « View » account type" +msgstr "" + +#. module: account_test +#: view:accounting.assert.test:0 +msgid "Code Help" +msgstr "" diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py index 850162ccf84..81eb76ff3a8 100644 --- a/addons/account_voucher/account_voucher.py +++ b/addons/account_voucher/account_voucher.py @@ -1622,7 +1622,7 @@ class account_bank_statement(osv.osv): for bk_st in self.browse(cr, uid, ids, context=context): if vals.get('journal_id') and bk_st.line_ids: if any([x.voucher_id and True or False for x in bk_st.line_ids]): - raise osv.except_osv(_('Unable to change journal !'), _('You can not change the journal as you already reconciled some statement lines!')) + raise osv.except_osv(_('Unable to Change Journal!'), _('You can not change the journal as you already reconciled some statement lines!')) return super(account_bank_statement, self).write(cr, uid, ids, vals, context=context) diff --git a/addons/analytic/analytic.py b/addons/analytic/analytic.py index ac298713b04..ce79c4d5ffb 100644 --- a/addons/analytic/analytic.py +++ b/addons/analytic/analytic.py @@ -157,7 +157,7 @@ class account_analytic_account(osv.osv): for account in self.browse(cr, uid, ids, context=context): if account.company_id: if account.company_id.currency_id.id != value: - raise osv.except_osv(_('Error!'), _("If you set a company, the currency selected has to be the same as it's currency. \nYou can remove the company belonging, and thus change the currency, only on analytic account of type 'view'. This can be really usefull for consolidation purposes of several companies charts with different currencies, for example.")) + raise osv.except_osv(_('Error!'), _("If you set a company, the currency selected has to be the same as it's currency. \nYou can remove the company belonging, and thus change the currency, only on analytic account of type 'view'. This can be really useful for consolidation purposes of several companies charts with different currencies, for example.")) if value: return cr.execute("""update account_analytic_account set currency_id=%s where id=%s""", (value, account.id, )) diff --git a/addons/analytic_user_function/analytic_user_function.py b/addons/analytic_user_function/analytic_user_function.py index 0573292c1f6..1adefb2d59d 100644 --- a/addons/analytic_user_function/analytic_user_function.py +++ b/addons/analytic_user_function/analytic_user_function.py @@ -104,7 +104,7 @@ class hr_analytic_timesheet(osv.osv): a = r.product_id.categ_id.property_account_expense_categ.id if not a: raise osv.except_osv(_('Error!'), - _('There is no expense account define ' \ + _('There is no expense account defined ' \ 'for this product: "%s" (id:%d)') % \ (r.product_id.name, r.product_id.id,)) # Compute based on pricetype @@ -133,7 +133,7 @@ class hr_analytic_timesheet(osv.osv): a = r.product_id.categ_id.property_account_expense_categ.id if not a: raise osv.except_osv(_('Error!'), - _('There is no expense account define ' \ + _('There is no expense account defined ' \ 'for this product: "%s" (id:%d)') % \ (r.product_id.name, r.product_id.id,)) # Compute based on pricetype diff --git a/addons/anonymization/anonymization.py b/addons/anonymization/anonymization.py index 0477efa5b1f..c82afde103f 100644 --- a/addons/anonymization/anonymization.py +++ b/addons/anonymization/anonymization.py @@ -86,11 +86,11 @@ class ir_model_fields_anonymization(osv.osv): if context.get('manual'): global_state = self._get_global_state(cr, uid, context=context) if global_state == 'anonymized': - raise osv.except_osv('Error !', "The database is currently anonymized, you cannot create, modify or delete fields.") + raise osv.except_osv('Error!', "The database is currently anonymized, you cannot create, modify or delete fields.") elif global_state == 'unstable': msg = _("The database anonymization is currently in an unstable state. Some fields are anonymized," + \ " while some fields are not anonymized. You should try to solve this problem before trying to create, write or delete fields.") - raise osv.except_osv('Error !', msg) + raise osv.except_osv('Error!', msg) return True @@ -357,7 +357,7 @@ class ir_model_fields_anonymize_wizard(osv.osv_memory): else: msg = _("The database anonymization is currently in an unstable state. Some fields are anonymized," + \ " while some fields are not anonymized. You should try to solve this problem before trying to do anything else.") - raise osv.except_osv('Error !', msg) + raise osv.except_osv('Error!', msg) res['arch'] = etree.tostring(eview) @@ -521,11 +521,11 @@ class ir_model_fields_anonymize_wizard(osv.osv_memory): # check that all the defined fields are in the 'anonymized' state state = ir_model_fields_anonymization_model._get_global_state(cr, uid, context=context) if state == 'clear': - raise osv.except_osv_('Error !', "The database is not currently anonymized, you cannot reverse the anonymization.") + raise osv.except_osv_('Error!', "The database is not currently anonymized, you cannot reverse the anonymization.") elif state == 'unstable': msg = _("The database anonymization is currently in an unstable state. Some fields are anonymized," + \ " while some fields are not anonymized. You should try to solve this problem before trying to do anything.") - raise osv.except_osv('Error !', msg) + raise osv.except_osv('Error!', msg) wizards = self.browse(cr, uid, ids, context=context) for wizard in wizards: diff --git a/addons/auth_signup/res_users.py b/addons/auth_signup/res_users.py index f4a985280ac..891837f8813 100644 --- a/addons/auth_signup/res_users.py +++ b/addons/auth_signup/res_users.py @@ -23,6 +23,7 @@ import random from urllib import urlencode from urlparse import urljoin +from openerp.addons.base.ir.ir_mail_server import MailDeliveryException from openerp.osv import osv, fields from openerp.tools.misc import DEFAULT_SERVER_DATETIME_FORMAT from openerp.tools.safe_eval import safe_eval @@ -55,19 +56,22 @@ class res_partner(osv.Model): def _get_signup_url_for_action(self, cr, uid, ids, action='login', view_type=None, menu_id=None, res_id=None, model=None, context=None): """ generate a signup url for the given partner ids and action, possibly overriding the url state components (menu_id, id, view_type) """ + if context is None: + context= {} res = dict.fromkeys(ids, False) base_url = self.pool.get('ir.config_parameter').get_param(cr, uid, 'web.base.url') for partner in self.browse(cr, uid, ids, context): # when required, make sure the partner has a valid signup token - if context and context.get('signup_valid') and not partner.user_ids: + if context.get('signup_valid') and not partner.user_ids: self.signup_prepare(cr, uid, [partner.id], context=context) partner.refresh() # the parameters to encode for the query and fragment part of url query = {'db': cr.dbname} - fragment = {'action': action, 'type': partner.signup_type} + signup_type = context.get('signup_force_type_in_url', partner.signup_type or '') + fragment = {'action': action, 'type': signup_type} - if partner.signup_token: + if partner.signup_token and signup_type: fragment['token'] = partner.signup_token elif partner.user_ids: fragment['db'] = cr.dbname @@ -103,6 +107,9 @@ class res_partner(osv.Model): def action_signup_prepare(self, cr, uid, ids, context=None): return self.signup_prepare(cr, uid, ids, context=context) + def signup_cancel(self, cr, uid, ids, context=None): + return self.write(cr, uid, ids, {'signup_token': False, 'signup_type': False, 'signup_expiration': False}, context=context) + def signup_prepare(self, cr, uid, ids, signup_type="signup", expiration=False, context=None): """ generate a new token for the partners with the given validity, if necessary :param expiration: the expiration datetime of the token (string, optional) @@ -202,7 +209,7 @@ class res_users(osv.Model): }) if partner.company_id: values['company_id'] = partner.company_id.id - values['company_ids'] = [(6,0,[partner.company_id.id])] + values['company_ids'] = [(6, 0, [partner.company_id.id])] self._signup_create_user(cr, uid, values, context=context) else: # no token, sign up an external user @@ -259,25 +266,26 @@ class res_users(osv.Model): pass if not bool(template): template = self.pool.get('ir.model.data').get_object(cr, uid, 'auth_signup', 'reset_password_email') - mail_obj = self.pool.get('mail.mail') assert template._name == 'email.template' for user in self.browse(cr, uid, ids, context): if not user.email: raise osv.except_osv(_("Cannot send email: user has no email address."), user.name) - mail_id = self.pool.get('email.template').send_mail(cr, uid, template.id, user.id, True, context=context) - mail_state = mail_obj.read(cr, uid, mail_id, ['state'], context=context) - - if mail_state and mail_state['state'] == 'exception': - raise self.pool.get('res.config.settings').get_config_warning(cr, _("Cannot send email: no outgoing email server configured.\nYou can configure it under %(menu:base_setup.menu_general_configuration)s."), context) - else: - return True + try: + self.pool.get('email.template').send_mail(cr, uid, template.id, user.id, force_send=True, raise_exception=True, context=context) + except Exception: + raise def create(self, cr, uid, values, context=None): + if context is None: + context = {} # overridden to automatically invite user to sign up user_id = super(res_users, self).create(cr, uid, values, context=context) user = self.browse(cr, uid, user_id, context=context) - if context and context.get('reset_password') and user.email: - ctx = dict(context, create_user=True) - self.action_reset_password(cr, uid, [user.id], context=ctx) + if user.email and not context.get('no_reset_password'): + context.update({'create_user': True}) + try: + self.action_reset_password(cr, uid, [user.id], context=context) + except MailDeliveryException: + self.pool.get('res.partner').signup_cancel(cr, uid, [user.partner_id.id], context=context) return user_id diff --git a/addons/auth_signup/res_users_view.xml b/addons/auth_signup/res_users_view.xml index 28f66eb101d..60c419db737 100644 --- a/addons/auth_signup/res_users_view.xml +++ b/addons/auth_signup/res_users_view.xml @@ -31,9 +31,11 @@ <!-- add Reset Password button --> <xpath expr="//div[@class='oe_right oe_button_box']//button" position="replace"> <button string="Send Reset Password Instructions" + class="oe_link" type="object" name="action_reset_password" attrs="{'invisible': [('state', '!=', 'active')]}"/> <button string="Send an Invitation Email" + class="oe_link" type="object" name="action_reset_password" context="{'create_user': 1}" attrs="{'invisible': [('state', '!=', 'new')]}"/> </xpath> diff --git a/addons/auth_signup/static/src/js/auth_signup.js b/addons/auth_signup/static/src/js/auth_signup.js index 545ee6cf60e..b825d683099 100644 --- a/addons/auth_signup/static/src/js/auth_signup.js +++ b/addons/auth_signup/static/src/js/auth_signup.js @@ -7,7 +7,7 @@ openerp.auth_signup = function(instance) { var self = this; this.signup_enabled = false; this.reset_password_enabled = false; - return this._super().then(function() { + return this._super().always(function() { // Switches the login box to the select mode whith mode == [default|signup|reset] self.on('change:login_mode', self, function() { diff --git a/addons/base_action_rule/base_action_rule.py b/addons/base_action_rule/base_action_rule.py index 9d7d4d34ac4..3497255fa76 100644 --- a/addons/base_action_rule/base_action_rule.py +++ b/addons/base_action_rule/base_action_rule.py @@ -50,6 +50,7 @@ class base_action_rule(osv.osv): _name = 'base.action.rule' _description = 'Action Rules' + _order = 'sequence' _columns = { 'name': fields.char('Rule Name', size=64, required=True), @@ -61,7 +62,11 @@ class base_action_rule(osv.osv): help="When unchecked, the rule is hidden and will not be executed."), 'sequence': fields.integer('Sequence', help="Gives the sequence order when displaying a list of rules."), + 'kind': fields.selection( + [('on_create', 'On Creation'), ('on_write', 'On Update'), ('on_time', 'Based on Timed Condition')], + string='When to Run'), 'trg_date_id': fields.many2one('ir.model.fields', string='Trigger Date', + help="When should the condition be triggered. If present, will be checked by the scheduler. If empty, will be checked at creation and update.", domain="[('model_id', '=', model_id), ('ttype', 'in', ('date', 'datetime'))]"), 'trg_date_range': fields.integer('Delay after trigger date', help="Delay after the trigger date." \ @@ -78,10 +83,10 @@ class base_action_rule(osv.osv): ondelete='restrict', domain="[('model_id', '=', model_id.model)]", help="If present, this condition must be satisfied before the update of the record."), - 'filter_id': fields.many2one('ir.filters', string='After Update Filter', + 'filter_id': fields.many2one('ir.filters', string='Filter', ondelete='restrict', domain="[('model_id', '=', model_id.model)]", - help="If present, this condition must be satisfied after the update of the record."), + help="If present, this condition must be satisfied before executing the action rule."), 'last_run': fields.datetime('Last Run', readonly=1), } @@ -90,7 +95,15 @@ class base_action_rule(osv.osv): 'trg_date_range_type': 'day', } - _order = 'sequence' + def onchange_kind(self, cr, uid, ids, kind, context=None): + clear_fields = [] + if kind == 'on_create': + clear_fields = ['filter_pre_id', 'trg_date_id', 'trg_date_range', 'trg_date_range_type'] + elif kind == 'on_write': + clear_fields = ['trg_date_id', 'trg_date_range', 'trg_date_range_type'] + elif kind == 'on_time': + clear_fields = ['filter_pre_id'] + return {'value': dict.fromkeys(clear_fields, False)} def _filter(self, cr, uid, action, action_filter, record_ids, context=None): """ filter the list record_ids that satisfy the action filter """ @@ -105,14 +118,7 @@ class base_action_rule(osv.osv): def _process(self, cr, uid, action, record_ids, context=None): """ process the given action on the records """ - # execute server actions model = self.pool[action.model_id.model] - if action.server_action_ids: - server_action_ids = map(int, action.server_action_ids) - for record in model.browse(cr, uid, record_ids, context): - action_server_obj = self.pool.get('ir.actions.server') - ctx = dict(context, active_model=model._name, active_ids=[record.id], active_id=record.id) - action_server_obj.run(cr, uid, server_action_ids, context=ctx) # modify records values = {} @@ -127,13 +133,21 @@ class base_action_rule(osv.osv): follower_ids = map(int, action.act_followers) model.message_subscribe(cr, uid, record_ids, follower_ids, context=context) + # execute server actions + if action.server_action_ids: + server_action_ids = map(int, action.server_action_ids) + for record in model.browse(cr, uid, record_ids, context): + action_server_obj = self.pool.get('ir.actions.server') + ctx = dict(context, active_model=model._name, active_ids=[record.id], active_id=record.id) + action_server_obj.run(cr, uid, server_action_ids, context=ctx) + return True def _wrap_create(self, old_create, model): """ Return a wrapper around `old_create` calling both `old_create` and `_process`, in that order. """ - def wrapper(cr, uid, vals, context=None): + def create(cr, uid, vals, context=None): # avoid loops or cascading actions if context and context.get('action'): return old_create(cr, uid, vals, context=context) @@ -141,8 +155,8 @@ class base_action_rule(osv.osv): context = dict(context or {}, action=True) new_id = old_create(cr, uid, vals, context=context) - # as it is a new record, we do not consider the actions that have a prefilter - action_dom = [('model', '=', model), ('trg_date_id', '=', False), ('filter_pre_id', '=', False)] + # retrieve the action rules to run on creation + action_dom = [('model', '=', model), ('kind', '=', 'on_create')] action_ids = self.search(cr, uid, action_dom, context=context) # check postconditions, and execute actions on the records that satisfy them @@ -151,13 +165,13 @@ class base_action_rule(osv.osv): self._process(cr, uid, action, [new_id], context=context) return new_id - return wrapper + return create def _wrap_write(self, old_write, model): """ Return a wrapper around `old_write` calling both `old_write` and `_process`, in that order. """ - def wrapper(cr, uid, ids, vals, context=None): + def write(cr, uid, ids, vals, context=None): # avoid loops or cascading actions if context and context.get('action'): return old_write(cr, uid, ids, vals, context=context) @@ -165,8 +179,8 @@ class base_action_rule(osv.osv): context = dict(context or {}, action=True) ids = [ids] if isinstance(ids, (int, long, str)) else ids - # retrieve the action rules to possibly execute - action_dom = [('model', '=', model), ('trg_date_id', '=', False)] + # retrieve the action rules to run on update + action_dom = [('model', '=', model), ('kind', '=', 'on_write')] action_ids = self.search(cr, uid, action_dom, context=context) actions = self.browse(cr, uid, action_ids, context=context) @@ -185,7 +199,7 @@ class base_action_rule(osv.osv): self._process(cr, uid, action, post_ids, context=context) return True - return wrapper + return write def _register_hook(self, cr, ids=None): """ Wrap the methods `create` and `write` of the models specified by @@ -224,8 +238,8 @@ class base_action_rule(osv.osv): def _check(self, cr, uid, automatic=False, use_new_cursor=False, context=None): """ This Function is called by scheduler. """ context = context or {} - # retrieve all the action rules that have a trg_date_id and no precondition - action_dom = [('trg_date_id', '!=', False), ('filter_pre_id', '=', False)] + # retrieve all the action rules to run based on a timed condition + action_dom = [('kind', '=', 'on_time')] action_ids = self.search(cr, uid, action_dom, context=context) for action in self.browse(cr, uid, action_ids, context=context): now = datetime.now() diff --git a/addons/base_action_rule/base_action_rule_view.xml b/addons/base_action_rule/base_action_rule_view.xml index 5eaaf08dad4..c2262adde39 100644 --- a/addons/base_action_rule/base_action_rule_view.xml +++ b/addons/base_action_rule/base_action_rule_view.xml @@ -26,24 +26,32 @@ <notebook> <page string="Conditions"> <group> - <group name="filter" string="Filter Condition"> - <field name="filter_pre_id" domain="[('model_id','=',model)]" context="{'default_model_id': model}"/> - <field name="filter_id" domain="[('model_id','=',model)]" context="{'default_model_id': model}"/> - </group> - <group name="timing" string="Timer"> - <field name="trg_date_id"/> - <label for="trg_date_range" string="Delay After Trigger Date" attrs="{'invisible': [('trg_date_id','=',False)]}"/> - <div attrs="{'invisible': [('trg_date_id','=',False)]}"> - <field name="trg_date_range" class="oe_inline"/> - <field name="trg_date_range_type" class="oe_inline" attrs="{'required': [('trg_date_id','!=',False)]}"/> - </div> - </group> + <field name="kind" required="1" + on_change="onchange_kind(kind)"/> + <field name="filter_pre_id" + domain="[('model_id','=',model), ('user_id', '=', False)]" + context="{'default_model_id': model}" + attrs="{'invisible': [('kind', '!=', 'on_write')]}"/> + <field name="filter_id" + domain="[('model_id','=',model), ('user_id', '=', False)]" + context="{'default_model_id': model}"/> + <field name="trg_date_id" + attrs="{'invisible': [('kind', '!=', 'on_time')], 'required': [('kind', '=', 'on_time')]}"/> + <label for="trg_date_range" string="Delay After Trigger Date" + attrs="{'invisible': [('trg_date_id','=',False)]}"/> + <div attrs="{'invisible': [('trg_date_id','=',False)]}"> + <field name="trg_date_range" class="oe_inline"/> + <field name="trg_date_range_type" class="oe_inline" attrs="{'required': [('trg_date_id','!=',False)]}"/> + </div> </group> - <p class="oe_grey"> - <b>Select a filter or a timer as condition.</b><br/> An action rule is checked when you create or modify the "Related Document Model". The precondition filter is checked right before the modification while the postcondition filter is checked after the modification. A precondition filter will therefore not work during a creation.<br/> - <b>To create a new filter:</b><br/> - - Go to your "Related Document Model" page and set the filter parameters in the "Search" view (Example of filter based on Leads/Opportunities: Creation Date "is equal to" 01/01/2012)<br/> - - In this same "Search" view, select the menu "Save Current Filter", enter the name (Ex: Create the 01/01/2012) and add the option "Share with all users"<br/> + <p> + Select when the action must be run, and add filters and/or timing conditions. + <br/> + In order to create a new filter: + <ul> + <li>Go to your "Related Document Model" page and set the filter parameters in the "Search" view (Example of filter based on Leads/Opportunities: Creation Date "is equal to" 01/01/2012)</li> + <li>In this same "Search" view, select the menu "Save Current Filter", enter the name (Ex: Create the 01/01/2012) and add the option "Share with all users"</li> + </ul> The filter must therefore be available in this page. </p> </page> @@ -76,6 +84,7 @@ <tree string="Action Rule"> <field name="sequence"/> <field name="name"/> + <field name="kind"/> <field name="filter_id"/> </tree> </field> diff --git a/addons/base_action_rule/tests/base_action_rule_test.py b/addons/base_action_rule/tests/base_action_rule_test.py index 36c928a84e3..54c72ba0607 100644 --- a/addons/base_action_rule/tests/base_action_rule_test.py +++ b/addons/base_action_rule/tests/base_action_rule_test.py @@ -19,8 +19,8 @@ class base_action_rule_test(common.TransactionCase): 'name': "Lead is in done state", 'is_default': False, 'model_id': 'base.action.rule.lead.test', - 'domain' : "[('state','=','done')]", - }, context=context) + 'domain': "[('state','=','done')]", + }, context=context) def create_filter_draft(self, cr, uid, context=None): filter_pool = self.registry('ir.filters') @@ -40,16 +40,16 @@ class base_action_rule_test(common.TransactionCase): 'user_id': self.admin, }, context=context) - def create_rule(self, cr, uid, filter_id=False, filter_pre_id=False, context=None): + def create_rule(self, cr, uid, kind, filter_id=False, filter_pre_id=False, context=None): """ The "Rule 1" says that when a lead goes to the 'draft' state, the responsible for that lead changes to user "demo" """ return self.base_action_rule.create(cr,uid,{ - 'name' : "Rule 1", + 'name': "Rule 1", 'model_id': self.registry('ir.model').search(cr, uid, [('model','=','base.action.rule.lead.test')], context=context)[0], - 'active' : 1, - 'filter_pre_id' : filter_pre_id, - 'filter_id' : filter_id, + 'kind': kind, + 'filter_pre_id': filter_pre_id, + 'filter_id': filter_id, 'act_user_id': self.demo, }, context=context) @@ -64,7 +64,7 @@ class base_action_rule_test(common.TransactionCase): """ cr, uid = self.cr, self.uid filter_draft = self.create_filter_draft(cr, uid) - self.create_rule(cr, uid, filter_pre_id=filter_draft) + self.create_rule(cr, uid, 'on_write', filter_pre_id=filter_draft) new_lead_id = self.create_lead_test_1(cr, uid) new_lead = self.model.browse(cr, uid, new_lead_id) self.assertEquals(new_lead.state, 'draft') @@ -73,11 +73,11 @@ class base_action_rule_test(common.TransactionCase): def test_01_check_to_state_draft_post(self): """ - Check that a new record (with state = draft) changes its responsible when there is a postcondition filter which check that the state is draft. + Check that a new record changes its responsible when there is a postcondition filter which check that the state is draft. """ cr, uid = self.cr, self.uid filter_draft = self.create_filter_draft(cr, uid) - self.create_rule(cr, uid, filter_id=filter_draft) + self.create_rule(cr, uid, 'on_create') new_lead_id = self.create_lead_test_1(cr, uid) new_lead = self.model.browse(cr, uid, new_lead_id) self.assertEquals(new_lead.state, 'draft') @@ -95,7 +95,7 @@ class base_action_rule_test(common.TransactionCase): cr, uid = self.cr, self.uid filter_draft = self.create_filter_draft(cr, uid) filter_done = self.create_filter_done(cr, uid) - self.create_rule(cr, uid, filter_pre_id=filter_draft, filter_id=filter_done) + self.create_rule(cr, uid, 'on_write', filter_pre_id=filter_draft, filter_id=filter_done) new_lead_id = self.create_lead_test_1(cr, uid) new_lead = self.model.browse(cr, uid, new_lead_id) self.assertEquals(new_lead.state, 'draft') @@ -133,7 +133,7 @@ class base_action_rule_test(common.TransactionCase): cr, uid = self.cr, self.uid filter_draft = self.create_filter_draft(cr, uid) filter_done = self.create_filter_done(cr, uid) - self.create_rule(cr, uid, filter_pre_id=filter_draft, filter_id=filter_done) + self.create_rule(cr, uid, 'on_write', filter_pre_id=filter_draft, filter_id=filter_done) new_lead_id = self.create_lead_test_1(cr, uid) new_lead = self.model.browse(cr, uid, new_lead_id) self.assertEquals(new_lead.state, 'draft') diff --git a/addons/base_status/base_state.py b/addons/base_status/base_state.py index b856bbd74ad..3fe59ecbd21 100644 --- a/addons/base_status/base_state.py +++ b/addons/base_status/base_state.py @@ -104,7 +104,7 @@ class base_state(object): if parent_id.change_responsible and parent_id.user_id: data['user_id'] = parent_id.user_id.id else: - raise osv.except_osv(_('Error !'), _('You can not escalate, you are already at the top level regarding your sales-team category.')) + raise osv.except_osv(_('Error!'), _('You can not escalate, you are already at the top level regarding your sales-team category.')) self.write(cr, uid, [case.id], data, context=context) case.case_escalate_send_note(parent_id, context=context) return True diff --git a/addons/base_status/i18n/ru.po b/addons/base_status/i18n/ru.po index 546f2772af3..2dab7ceaf31 100644 --- a/addons/base_status/i18n/ru.po +++ b/addons/base_status/i18n/ru.po @@ -8,14 +8,14 @@ msgstr "" "Project-Id-Version: openobject-addons\n" "Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n" "POT-Creation-Date: 2012-12-21 17:05+0000\n" -"PO-Revision-Date: 2012-12-28 10:04+0000\n" +"PO-Revision-Date: 2013-06-05 07:16+0000\n" "Last-Translator: Chertykov Denis <chertykov@gmail.com>\n" "Language-Team: Russian <ru@li.org>\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2013-03-16 05:52+0000\n" -"X-Generator: Launchpad (build 16532)\n" +"X-Launchpad-Export-Date: 2013-06-06 05:21+0000\n" +"X-Generator: Launchpad (build 16667)\n" #. module: base_status #: code:addons/base_status/base_state.py:107 @@ -27,13 +27,13 @@ msgstr "Ошибка !" #: code:addons/base_status/base_state.py:166 #, python-format msgid "%s has been <b>opened</b>." -msgstr "" +msgstr "%s было <b>открыто</b>." #. module: base_status #: code:addons/base_status/base_state.py:199 #, python-format msgid "%s has been <b>renewed</b>." -msgstr "" +msgstr "%s было <b>обновлено</b>." #. module: base_status #: code:addons/base_status/base_stage.py:210 @@ -55,13 +55,13 @@ msgstr "" #: code:addons/base_status/base_state.py:193 #, python-format msgid "%s is now <b>pending</b>." -msgstr "" +msgstr "%s сейчас <b>в ожидании</b>." #. module: base_status #: code:addons/base_status/base_state.py:187 #, python-format msgid "%s has been <b>canceled</b>." -msgstr "" +msgstr "%s было <b>отменено</b>." #. module: base_status #: code:addons/base_status/base_stage.py:210 @@ -70,9 +70,11 @@ msgid "" "You are already at the top level of your sales-team category.\n" "Therefore you cannot escalate furthermore." msgstr "" +"Вы уже на высшем уровне категории вашей команды продаж.\n" +"Поэтому вы не можете обострить." #. module: base_status #: code:addons/base_status/base_state.py:181 #, python-format msgid "%s has been <b>closed</b>." -msgstr "" +msgstr "%s было <b>закрыто</b>." diff --git a/addons/base_vat/base_vat.py b/addons/base_vat/base_vat.py index e7501334997..52db18b7307 100644 --- a/addons/base_vat/base_vat.py +++ b/addons/base_vat/base_vat.py @@ -83,6 +83,8 @@ class res_partner(osv.osv): Check the VAT number depending of the country. http://sima-pc.com/nif.php ''' + if not ustr(country_code).encode('utf-8').isalpha(): + return False check_func_name = 'check_vat_' + country_code check_func = getattr(self, check_func_name, None) or \ getattr(vatnumber, check_func_name, None) diff --git a/addons/claim_from_delivery/i18n/ru.po b/addons/claim_from_delivery/i18n/ru.po index 8d97086c22a..ffcf8fc2781 100644 --- a/addons/claim_from_delivery/i18n/ru.po +++ b/addons/claim_from_delivery/i18n/ru.po @@ -8,19 +8,19 @@ msgstr "" "Project-Id-Version: openobject-addons\n" "Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n" "POT-Creation-Date: 2012-12-21 17:05+0000\n" -"PO-Revision-Date: 2013-05-27 12:19+0000\n" +"PO-Revision-Date: 2013-06-05 07:11+0000\n" "Last-Translator: Chertykov Denis <chertykov@gmail.com>\n" "Language-Team: Russian <ru@li.org>\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2013-05-28 05:17+0000\n" -"X-Generator: Launchpad (build 16640)\n" +"X-Launchpad-Export-Date: 2013-06-06 05:21+0000\n" +"X-Generator: Launchpad (build 16667)\n" #. module: claim_from_delivery #: view:stock.picking.out:0 msgid "Claims" -msgstr "" +msgstr "Рекламации" #. module: claim_from_delivery #: model:res.request.link,name:claim_from_delivery.request_link_claim_from_delivery @@ -30,7 +30,7 @@ msgstr "Заказ доставки" #. module: claim_from_delivery #: model:ir.actions.act_window,name:claim_from_delivery.action_claim_from_delivery msgid "Claim From Delivery" -msgstr "" +msgstr "Рекламация по доставке" #~ msgid "Claim from delivery" #~ msgstr "Претензия из доставки" diff --git a/addons/crm/__openerp__.py b/addons/crm/__openerp__.py index 8e17a882076..e7ab7df27ea 100644 --- a/addons/crm/__openerp__.py +++ b/addons/crm/__openerp__.py @@ -81,8 +81,6 @@ Dashboard for CRM will include: 'crm_lead_view.xml', 'crm_lead_menu.xml', - 'crm_case_section_view.xml', - 'crm_meeting_menu.xml', 'crm_phonecall_view.xml', @@ -98,6 +96,8 @@ Dashboard for CRM will include: 'res_config_view.xml', 'base_partner_merge_view.xml', + + 'crm_case_section_view.xml', ], 'demo': [ 'crm_demo.xml', @@ -121,7 +121,8 @@ Dashboard for CRM will include: 'static/src/css/crm.css' ], 'js': [ - 'static/src/js/crm.js' + 'static/lib/sparkline/jquery.sparkline.js', + 'static/src/js/crm_case_section.js', ], 'installable': True, 'application': True, diff --git a/addons/crm/base_partner_merge.py b/addons/crm/base_partner_merge.py index 0a8e37b14b7..42e1ab7c7ec 100644 --- a/addons/crm/base_partner_merge.py +++ b/addons/crm/base_partner_merge.py @@ -264,7 +264,7 @@ class MergePartnerAutomatic(osv.TransientModel): values = dict() for column, field in columns.iteritems(): - if field._type not in ('many2many', 'one2many', 'function'): + if field._type not in ('many2many', 'one2many') and not isinstance(field, fields.function): for item in itertools.chain(src_partners, [dst_partner]): if item[column]: values[column] = write_serializer(column, item[column]) diff --git a/addons/crm/crm.py b/addons/crm/crm.py index 7b6fe02afa8..4c9a60634a5 100644 --- a/addons/crm/crm.py +++ b/addons/crm/crm.py @@ -19,13 +19,12 @@ # ############################################################################## -import base64 -import time -from lxml import etree +from datetime import date, datetime +from dateutil import relativedelta + +from openerp import tools from openerp.osv import fields from openerp.osv import osv -from openerp import tools -from openerp.tools.translate import _ MAX_LEVEL = 15 AVAILABLE_STATES = [ @@ -106,10 +105,57 @@ class crm_case_section(osv.osv): _inherit = "mail.thread" _description = "Sales Teams" _order = "complete_name" + # number of periods for lead/opportunities/... tracking in salesteam kanban dashboard/kanban view + _period_number = 5 def get_full_name(self, cr, uid, ids, field_name, arg, context=None): return dict(self.name_get(cr, uid, ids, context=context)) + def __get_bar_values(self, cr, uid, obj, domain, read_fields, value_field, groupby_field, context=None): + """ Generic method to generate data for bar chart values using SparklineBarWidget. + This method performs obj.read_group(cr, uid, domain, read_fields, groupby_field). + + :param obj: the target model (i.e. crm_lead) + :param domain: the domain applied to the read_group + :param list read_fields: the list of fields to read in the read_group + :param str value_field: the field used to compute the value of the bar slice + :param str groupby_field: the fields used to group + + :return list section_result: a list of dicts: [ + { 'value': (int) bar_column_value, + 'tootip': (str) bar_column_tooltip, + } + ] + """ + month_begin = date.today().replace(day=1) + section_result = [{ + 'value': 0, + 'tooltip': (month_begin + relativedelta.relativedelta(months=-i)).strftime('%B'), + } for i in range(self._period_number - 1, -1, -1)] + group_obj = obj.read_group(cr, uid, domain, read_fields, groupby_field, context=context) + for group in group_obj: + group_begin_date = datetime.strptime(group['__domain'][0][2], tools.DEFAULT_SERVER_DATE_FORMAT) + month_delta = relativedelta.relativedelta(month_begin, group_begin_date) + section_result[self._period_number - (month_delta.months + 1)] = {'value': group.get(value_field, 0), 'tooltip': group_begin_date.strftime('%B')} + return section_result + + def _get_opportunities_data(self, cr, uid, ids, field_name, arg, context=None): + """ Get opportunities-related data for salesteam kanban view + monthly_open_leads: number of open lead during the last months + monthly_planned_revenue: planned revenu of opportunities during the last months + """ + obj = self.pool.get('crm.lead') + res = dict.fromkeys(ids, False) + month_begin = date.today().replace(day=1) + groupby_begin = (month_begin + relativedelta.relativedelta(months=-4)).strftime(tools.DEFAULT_SERVER_DATE_FORMAT) + for id in ids: + res[id] = dict() + lead_domain = [('type', '=', 'lead'), ('section_id', '=', id), ('create_date', '>=', groupby_begin)] + res[id]['monthly_open_leads'] = self.__get_bar_values(cr, uid, obj, lead_domain, ['create_date'], 'create_date_count', 'create_date', context=context) + opp_domain = [('type', '=', 'opportunity'), ('section_id', '=', id), ('create_date', '>=', groupby_begin)] + res[id]['monthly_planned_revenue'] = self.__get_bar_values(cr, uid, obj, opp_domain, ['planned_revenue', 'create_date'], 'planned_revenue', 'create_date', context=context) + return res + _columns = { 'name': fields.char('Sales Team', size=64, required=True, translate=True), 'complete_name': fields.function(get_full_name, type='char', size=256, readonly=True, store=True), @@ -129,15 +175,16 @@ class crm_case_section(osv.osv): 'alias_id': fields.many2one('mail.alias', 'Alias', ondelete="cascade", required=True, help="The email address associated with this team. New emails received will automatically " "create new leads assigned to the team."), - 'open_lead_ids': fields.one2many('crm.lead', 'section_id', - string='Open Leads', readonly=True, - domain=['&', ('type', '!=', 'opportunity'), ('state', 'not in', ['done', 'cancel'])]), - 'open_opportunity_ids': fields.one2many('crm.lead', 'section_id', - string='Open Opportunities', readonly=True, - domain=['&', '|', ('type', '=', 'opportunity'), ('type', '=', 'both'), ('state', 'not in', ['done', 'cancel'])]), 'color': fields.integer('Color Index'), 'use_leads': fields.boolean('Leads', - help="This enables the management of leads in the sales team. Otherwise the sales team manages only opportunities."), + help="The first contact you get with a potential customer is a lead you qualify before converting it into a real business opportunity. Check this box to manage leads in this sales team."), + + 'monthly_open_leads': fields.function(_get_opportunities_data, + type="string", readonly=True, multi='_get_opportunities_data', + string='Open Leads per Month'), + 'monthly_planned_revenue': fields.function(_get_opportunities_data, + type="string", readonly=True, multi='_get_opportunities_data', + string='Planned Revenue per Month') } def _get_stage_common(self, cr, uid, context): diff --git a/addons/crm/crm_action_rule_demo.xml b/addons/crm/crm_action_rule_demo.xml index bf1f7d4082f..7204f666db5 100644 --- a/addons/crm/crm_action_rule_demo.xml +++ b/addons/crm/crm_action_rule_demo.xml @@ -26,6 +26,7 @@ Description: [[object.description]] <field name="name">Set Auto Reminder on leads which are not open since 5 days.</field> <field name="model_id" ref="model_crm_lead"/> <field name="sequence">1</field> + <field name="kind">on_time</field> <field name="filter_id" ref="filter_draft_lead"/> <field name="trg_date_id" ref="field_crm_lead_create_date"/> <field name="trg_date_range">5</field> @@ -54,12 +55,10 @@ object.write({'section_id': sales_team.id}) <field name="name">Set Auto Followers on leads which are urgent and come from USA.</field> <field name="model_id" ref="model_crm_lead"/> <field name="sequence">2</field> + <field name="kind">on_create</field> <field name="filter_id" ref="filter_usa_lead"/> - <field name="act_followers" eval="[(6,0,[ref('base.res_partner_4'), ref('base.res_partner_5'), ref('base.res_partner_6')])]"/> <field name="act_user_id" ref="base.user_root"/> - <field name="trg_date_id" ref="field_crm_lead_create_date"/> - <field name="trg_date_range">0</field> - <field name="trg_date_range_type">minutes</field> + <field name="act_followers" eval="[(6,0,[ref('base.res_partner_4'), ref('base.res_partner_5'), ref('base.res_partner_6')])]"/> <field name="server_action_ids" eval="[(6,0,[ref('action_set_team_sales_department')])]"/> </record> </data> diff --git a/addons/crm/crm_case_section_view.xml b/addons/crm/crm_case_section_view.xml index 703b4ebb254..be5611c03c4 100644 --- a/addons/crm/crm_case_section_view.xml +++ b/addons/crm/crm_case_section_view.xml @@ -78,12 +78,12 @@ <field name="note"/> <field name="alias_id"/> <field name="color"/> - <field name="open_lead_ids"/> - <field name="open_opportunity_ids"/> + <field name="monthly_open_leads"/> + <field name="monthly_planned_revenue"/> <templates> <t t-name="kanban-box"> - <div t-attf-class="oe_kanban_color_#{kanban_getcolor(record.color.raw_value)} oe_kanban_card oe_kanban_project oe_kanban_global_click oe_kanban_crm_salesteams"> - <div class="oe_dropdown_toggle oe_dropdown_kanban" groups="base.group_user"> + <div t-attf-class="oe_kanban_color_#{kanban_getcolor(record.color.raw_value)} oe_kanban_card oe_kanban_global_click oe_kanban_crm_salesteams"> + <div class="oe_dropdown_toggle oe_dropdown_kanban" groups="base.group_sale_manager"> <span class="oe_e">í</span> <ul class="oe_dropdown_menu"> <li t-if="widget.view.is_action_enabled('edit')"><a type="edit">Sales Teams Settings</a></li> @@ -92,25 +92,19 @@ </ul> </div> <div class="oe_kanban_content"> - <h4><field name="name"/></h4> - <div class="oe_kanban_alias" t-if="record.use_leads.raw_value and record.alias_id.value"> - <span class="oe_e">%%</span><small><field name="alias_id"/></small> + <h4 class="oe_center"><field name="name"/></h4> + <div class="oe_kanban_alias oe_center" t-if="record.use_leads.raw_value and record.alias_id.value"> + <small><span class="oe_e" style="float: none;">%%</span><t t-raw="record.alias_id.raw_value[1]"/></small> </div> <div class="oe_items_list"> - <a t-if="record.use_leads.raw_value" name="%(crm_case_form_view_salesteams_lead)d" type="action"> - <t t-raw="record.open_lead_ids.raw_value.length"/> - <t t-if="record.open_lead_ids.raw_value.length >= 2">Leads</t> - <t t-if="record.open_lead_ids.raw_value.length < 2">Lead</t></a> - <a name="%(crm_case_form_view_salesteams_opportunity)d" type="action"> - <t t-raw="record.open_opportunity_ids.raw_value.length"/> - <t t-if="record.open_opportunity_ids.raw_value.length >= 2">Opportunities</t> - <t t-if="record.open_opportunity_ids.raw_value.length < 2">Opportunity</t></a> - </div> - <div class="oe_avatars"> - <img t-if="record.user_id.raw_value" t-att-src="kanban_image('res.users', 'image_small', record.user_id.raw_value)" t-att-data-member_id="record.user_id.raw_value"/> - <t t-foreach="record.member_ids.raw_value.slice(0,11)" t-as="member"> - <img t-att-src="kanban_image('res.users', 'image_small', member)" t-att-data-member_id="member"/> - </t> + <div class="oe_salesteams_leads" t-if="record.use_leads.raw_value"> + <a name="%(crm_case_form_view_salesteams_lead)d" type="action">Leads</a> + <a name="%(action_report_crm_lead)d" type="action" class="oe_sparkline_bar_link"><field name="monthly_open_leads" widget="sparkline_bar">Open Leads per Month<br/>Click to see a detailed analysis of leads.</field></a> + </div> + <div class="oe_salesteams_opportunities"> + <a name="%(crm_case_form_view_salesteams_opportunity)d" type="action">Opportunities</a> + <a name="%(action_report_crm_opportunity)d" type="action"><field name="monthly_planned_revenue" widget="sparkline_bar">Planned Revenue per Month<br/>Click to see a detailed analysis of opportunities.</field></a> + </div> </div> </div> </div> @@ -120,6 +114,27 @@ </field> </record> + <!-- Case Sections Search view --> + + <record id="crm_case_section_salesteams_search" model="ir.ui.view"> + <field name="name">Case Sections - Search</field> + <field name="model">crm.case.section</field> + <field name="arch" type="xml"> + <search string="Salesteams Search"> + <field name="name"/> + <field name="parent_id"/> + <field name="user_id"/> + <field name="note"/> + <field name="code"/> + <filter name="personal" string="My Salesteams" domain="['|', ('member_ids', '=', uid), ('user_id', '=', uid)]"/> + <group expand="0" string="Group By..."> + <filter string="Team Leader" domain="[]" context="{'group_by':'user_id'}"/> + <filter string="Parent Sales Teams" domain="[]" context="{'group_by':'parent_id'}"/> + </group> + </search> + </field> + </record> + <!-- Case Sections Action --> <record id="crm_case_section_salesteams_act" model="ir.actions.act_window"> @@ -127,6 +142,7 @@ <field name="res_model">crm.case.section</field> <field name="view_type">form</field> <field name="view_mode">kanban,tree,form</field> + <field name="context">{'search_default_personal': True}</field> <field name="view_id" ref="crm_case_section_salesteams_view_kanban"/> <field name="help" type="html"> <p class="oe_view_nocontent_create"> @@ -148,9 +164,9 @@ <form string="Sales Team" version="7.0"> <sheet> <div class="oe_title"> - <label for="name" class="oe_edit_only" string="Project Name"/> + <label for="name" class="oe_edit_only" string="Sales team"/> <h1> - <field name="name" string="Project Name"/> + <field name="name" string="Salesteam"/> </h1> <div name="group_alias" attrs="{'invisible': [('alias_domain', '=', False)]}"> @@ -169,24 +185,17 @@ </div> <group> <group> - <field name="parent_id"/> - <field name="resource_calendar_id"/> - <field name="active"/> - </group> - <group> <field name="user_id"/> <field name="code"/> </group> - <group colspan="4" attrs="{'invisible': [('use_leads', '=', False)]}"> - + <group> + <field name="parent_id"/> + <field name="change_responsible"/> + <field name="active"/> </group> </group> <notebook colspan="4"> - <page string="Sales Team"> - <group> - <field name="change_responsible"/> - </group> - <separator string="Team Members"/> + <page string="Team Members"> <field name="member_ids" widget="many2many_kanban"> <kanban quick_create="false" create="true"> <field name="name"/> diff --git a/addons/crm/crm_data.xml b/addons/crm/crm_data.xml index f24aee13c1d..1f1bd74391a 100644 --- a/addons/crm/crm_data.xml +++ b/addons/crm/crm_data.xml @@ -27,9 +27,10 @@ </record> <record model="crm.case.section" id="section_sales_department"> - <field name="name">Sales</field> - <field name="code">Sales</field> + <field name="name">Direct Sales</field> + <field name="code">DM</field> <field name="use_leads">True</field> + <field name="alias_name">info</field> <field name="member_ids" eval="[(4, ref('base.user_root'))]"/> </record> diff --git a/addons/crm/crm_demo.xml b/addons/crm/crm_demo.xml index 203193dc3bc..2858250e86a 100644 --- a/addons/crm/crm_demo.xml +++ b/addons/crm/crm_demo.xml @@ -7,27 +7,13 @@ </record> <record model="crm.case.section" id="crm_case_section_1"> - <field name="name">Sales Marketing Department</field> - <field name="code">SMD</field> - <field name="parent_id" ref="crm.section_sales_department"/> + <field name="name">Indirect Sales</field> + <field name="code">IM</field> </record> <record model="crm.case.section" id="crm_case_section_2"> - <field name="name">Support Department</field> + <field name="name">Marketing</field> <field name="code">SPD</field> - <field name="parent_id" ref="crm.section_sales_department"/> - </record> - - <record model="crm.case.section" id="crm_case_section_3"> - <field name="name">Direct Marketing</field> - <field name="code">DM</field> - <field name="parent_id" ref="crm.section_sales_department"/> - </record> - - <record model="crm.case.section" id="crm_case_section_4"> - <field name="name">Online Support</field> - <field name="code">OS</field> - <field name="parent_id" ref="crm.crm_case_section_2"/> </record> <record model="crm.segmentation" id="crm_segmentation0"> diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py index 40f71ad5d79..b8673e73927 100644 --- a/addons/crm/crm_lead.py +++ b/addons/crm/crm_lead.py @@ -77,12 +77,12 @@ class crm_lead(base_stage, format_address, osv.osv): _track = { 'state': { - 'crm.mt_lead_create': lambda self, cr, uid, obj, ctx=None: obj['state'] == 'new', + 'crm.mt_lead_create': lambda self, cr, uid, obj, ctx=None: obj['state'] in ['new', 'draft'], 'crm.mt_lead_won': lambda self, cr, uid, obj, ctx=None: obj['state'] == 'done', 'crm.mt_lead_lost': lambda self, cr, uid, obj, ctx=None: obj['state'] == 'cancel', }, 'stage_id': { - 'crm.mt_lead_stage': lambda self, cr, uid, obj, ctx=None: obj['state'] not in ['new', 'cancel', 'done'], + 'crm.mt_lead_stage': lambda self, cr, uid, obj, ctx=None: obj['state'] not in ['new', 'draft', 'cancel', 'done'], }, } @@ -103,7 +103,9 @@ class crm_lead(base_stage, format_address, osv.osv): if vals.get('type'): ctx['default_type'] = vals['type'] vals['stage_id'] = self._get_default_stage_id(cr, uid, context=ctx) - return super(crm_lead, self).create(cr, uid, vals, context=context) + # context: no_log, because subtype already handle this + create_context = dict(context, mail_create_nolog=True) + return super(crm_lead, self).create(cr, uid, vals, context=create_context) def _get_default_section_id(self, cr, uid, context=None): """ Gives default section by checking if present in the context """ @@ -367,8 +369,8 @@ class crm_lead(base_stage, format_address, osv.osv): def on_change_user(self, cr, uid, ids, user_id, context=None): """ When changing the user, also set a section_id or restrict section id to the ones user_id is member of. """ - section_id = False - if user_id: + section_id = self._get_default_section_id(cr, uid, context=context) or False + if user_id and not section_id: section_ids = self.pool.get('crm.case.section').search(cr, uid, ['|', ('user_id', '=', user_id), ('member_ids', '=', user_id)], context=context) if section_ids: section_id = section_ids[0] @@ -678,8 +680,9 @@ class crm_lead(base_stage, format_address, osv.osv): merged_data['stage_id'] = section_stage_ids and section_stage_ids[0] or False # Write merged data into first opportunity self.write(cr, uid, [highest.id], merged_data, context=context) - # Delete tail opportunities - self.unlink(cr, uid, [x.id for x in tail_opportunities], context=context) + # Delete tail opportunities + # We use the SUPERUSER to avoid access rights issues because as the user had the rights to see the records it should be safe to do so + self.unlink(cr, SUPERUSER_ID, [x.id for x in tail_opportunities], context=context) return highest.id diff --git a/addons/crm/crm_lead_demo.xml b/addons/crm/crm_lead_demo.xml index 21d60ad2961..e7e6beae33e 100644 --- a/addons/crm/crm_lead_demo.xml +++ b/addons/crm/crm_lead_demo.xml @@ -20,7 +20,7 @@ <field name="categ_ids" eval="[(6, 0, [categ_oppor6])]"/> <field name="channel_id" ref="crm_case_channel_email"/> <field name="priority">1</field> - <field name="section_id" ref="crm_case_section_4"/> + <field name="section_id" ref="crm_case_section_2"/> <field name="user_id" ref="base.user_root"/> <field name="stage_id" ref="stage_lead1"/> <field name="description">Hello, @@ -44,7 +44,7 @@ Can you send me the details ?</field> <field name="categ_ids" eval="[(6, 0, [categ_oppor2])]"/> <field name="channel_id" ref="crm_case_channel_website"/> <field name="priority">4</field> - <field name="section_id" ref="crm_case_section_3"/> + <field name="section_id" ref="crm_case_section_2"/> <field name="user_id" ref="base.user_root"/> <field name="stage_id" ref="stage_lead1"/> <field eval="1" name="active"/> @@ -63,7 +63,7 @@ Can you send me the details ?</field> <field name="categ_ids" eval="[(6, 0, [categ_oppor4])]"/> <field name="channel_id" ref=""/> <field name="priority">2</field> - <field name="section_id" ref="crm_case_section_2"/> + <field name="section_id" ref="crm_case_section_1"/> <field name="user_id" ref="base.user_demo"/> <field name="stage_id" ref="stage_lead2"/> <field eval="1" name="active"/> @@ -82,7 +82,7 @@ Can you send me the details ?</field> <field name="categ_ids" eval="[(6, 0, [categ_oppor5])]"/> <field name="channel_id" ref=""/> <field name="priority">3</field> - <field name="section_id" ref="crm_case_section_2"/> + <field name="section_id" ref="crm_case_section_1"/> <field name="user_id" ref=""/> <field name="stage_id" ref="stage_lead7"/> <field eval="1" name="active"/> @@ -133,7 +133,7 @@ Contact: +1 813 494 5005</field> <field name="categ_ids" eval="[(6, 0, [categ_oppor3,categ_oppor4])]"/> <field name="channel_id" ref=""/> <field name="priority">3</field> - <field name="section_id" ref="crm_case_section_4"/> + <field name="section_id" ref="crm_case_section_2"/> <field name="user_id" ref="base.user_root"/> <field name="stage_id" ref="stage_lead1"/> <field eval="1" name="active"/> @@ -152,7 +152,7 @@ Contact: +1 813 494 5005</field> <field name="categ_ids" eval="[(6, 0, [categ_oppor4])]"/> <field name="channel_id" ref=""/> <field name="priority">5</field> - <field name="section_id" ref="crm_case_section_4"/> + <field name="section_id" ref="crm_case_section_2"/> <field name="user_id" ref="base.user_demo"/> <field name="stage_id" ref="stage_lead7"/> <field eval="1" name="active"/> @@ -197,6 +197,9 @@ Contact: +1 813 494 5005</field> <field name="stage_id" ref="stage_lead1"/> <field eval="1" name="active"/> </record> + <record id="crm_case_9" model="crm.lead"> + <field name="create_date" eval="(DateTime.today() - relativedelta(months=1)).strftime('%Y-%m-%d %H:%M')"/> + </record> <record id="crm_case_10" model="crm.lead"> <field name="type">lead</field> @@ -211,7 +214,7 @@ Contact: +1 813 494 5005</field> <field name="categ_ids" eval="[(6, 0, [categ_oppor1])]"/> <field name="channel_id" ref="crm_case_channel_email"/> <field name="priority">2</field> - <field name="section_id" ref="crm_case_section_3"/> + <field name="section_id" ref="crm_case_section_2"/> <field name="user_id" ref=""/> <field name="stage_id" ref="stage_lead1"/> <field name="description">Hi, @@ -235,7 +238,7 @@ Andrew</field> <field name="categ_ids" eval="[(6, 0, [categ_oppor7])]"/> <field name="channel_id" ref="crm_case_channel_direct"/> <field name="priority">3</field> - <field name="section_id" ref="crm_case_section_2"/> + <field name="section_id" ref="crm_case_section_1"/> <field name="user_id" ref="base.user_demo"/> <field name="stage_id" ref="stage_lead1"/> <field eval="1" name="active"/> @@ -291,7 +294,7 @@ Andrew</field> <field eval="time.strftime('%Y-%m-25')" name="date_deadline"/> <field eval="time.strftime('%Y-%m-12')" name="date_action"/> <field name="title_action">Meeting for pricing information.</field> - <field name="section_id" ref="crm_case_section_3"/> + <field name="section_id" ref="section_sales_department"/> <field name="user_id" ref="base.user_root"/> <field name="stage_id" ref="crm.stage_lead3"/> <field eval="1" name="active"/> @@ -317,7 +320,7 @@ Andrew</field> <field eval="time.strftime('%Y-%m-23')" name="date_deadline"/> <field eval="time.strftime('%Y-%m-10')" name="date_action"/> <field name="title_action">Send Catalogue by Email</field> - <field name="section_id" ref="crm_case_section_4"/> + <field name="section_id" ref="section_sales_department"/> <field name="user_id" ref="base.user_demo"/> <field name="stage_id" ref="crm.stage_lead3"/> <field eval="1" name="active"/> @@ -326,7 +329,7 @@ Andrew</field> <record id="crm_case_15" model="crm.lead"> <field name="type">opportunity</field> <field name="name">Plan to buy RedHat servers</field> - <field eval="35000" name="planned_revenue"/> + <field eval="25000" name="planned_revenue"/> <field eval="30.0" name="probability"/> <field name="street">69 rue de Chimay</field> <field name="country_id" ref="base.be"/> @@ -339,10 +342,11 @@ Andrew</field> <field eval="time.strftime('%Y-%m-12')" name="date_deadline"/> <field eval="time.strftime('%Y-%m-10')" name="date_action"/> <field name="title_action">Call to ask system requirement</field> - <field name="section_id" ref="crm_case_section_3"/> + <field name="section_id" ref="section_sales_department"/> <field name="user_id" ref="base.user_demo"/> - <field name="stage_id" ref="crm.stage_lead4"/> + <field name="stage_id" ref="crm.stage_lead6"/> <field eval="1" name="active"/> + <field name="date_closed" eval="(DateTime.today() - relativedelta(months=2)).strftime('%Y-%m-%d %H:%M')"/> </record> <record id="crm_case_16" model="crm.lead"> @@ -367,6 +371,7 @@ Andrew</field> <field name="user_id" ref="base.user_demo"/> <field name="stage_id" ref="crm.stage_lead6"/> <field eval="1" name="active"/> + <field name="date_closed" eval="(DateTime.today() - relativedelta(hours=1)).strftime('%Y-%m-%d %H:%M')"/> </record> <record id="crm_case_17" model="crm.lead"> @@ -388,10 +393,11 @@ Andrew</field> <field eval="time.strftime('%Y-%m-8')" name="date_deadline"/> <field eval="time.strftime('%Y-%m-3')" name="date_action"/> <field name="title_action">Send price list regarding our interventions</field> - <field name="section_id" ref="crm_case_section_2"/> + <field name="section_id" ref="crm_case_section_1"/> <field name="user_id" ref="base.user_demo"/> - <field name="stage_id" ref="crm.stage_lead3"/> + <field name="stage_id" ref="crm.stage_lead6"/> <field eval="1" name="active"/> + <field name="date_closed" eval="(DateTime.today() - relativedelta(hours=1)).strftime('%Y-%m-%d %H:%M')"/> </record> <record id="crm_case_18" model="crm.lead"> @@ -412,7 +418,7 @@ Andrew</field> <field eval="time.strftime('%Y-%m-13')" name="date_deadline"/> <field eval="time.strftime('%Y-%m-4')" name="date_action"/> <field name="title_action">Call to define real needs about training</field> - <field name="section_id" ref="crm_case_section_2"/> + <field name="section_id" ref="crm_case_section_1"/> <field name="user_id" ref="base.user_demo"/> <field name="stage_id" ref="crm.stage_lead3"/> <field eval="1" name="active"/> @@ -438,8 +444,9 @@ Andrew</field> <field name="title_action">Ask for the good receprion of the proposition</field> <field name="section_id" ref="crm_case_section_1"/> <field name="user_id" ref="base.user_root"/> - <field name="stage_id" ref="crm.stage_lead4"/> + <field name="stage_id" ref="crm.stage_lead6"/> <field eval="1" name="active"/> + <field name="date_closed" eval="(DateTime.today() - relativedelta(months=3)).strftime('%Y-%m-%d %H:%M')"/> </record> <record id="crm_case_20" model="crm.lead"> @@ -468,10 +475,11 @@ Andrew</field> <field name="categ_ids" eval="[(6, 0, [categ_oppor7])]"/> <field name="channel_id" ref="crm_case_channel_phone"/> <field name="priority">3</field> - <field name="section_id" ref="crm_case_section_4"/> + <field name="section_id" ref="crm_case_section_2"/> <field name="user_id" ref="base.user_root"/> - <field name="stage_id" ref="crm.stage_lead8"/> + <field name="stage_id" ref="crm.stage_lead6"/> <field eval="1" name="active"/> + <field name="date_closed" eval="(DateTime.today() - relativedelta(months=1)).strftime('%Y-%m-%d %H:%M')"/> </record> <record id="crm_case_22" model="crm.lead"> @@ -486,7 +494,7 @@ Andrew</field> <field name="categ_ids" eval="[(6, 0, [categ_oppor3])]"/> <field name="channel_id" ref="crm_case_channel_email"/> <field name="priority">3</field> - <field name="section_id" ref="crm_case_section_4"/> + <field name="section_id" ref="crm_case_section_2"/> <field name="user_id" ref="base.user_root"/> <field name="stage_id" ref="crm.stage_lead8"/> <field eval="1" name="active"/> @@ -504,14 +512,15 @@ Andrew</field> <field name="priority">5</field> <field name="section_id" ref="section_sales_department"/> <field name="user_id" ref="base.user_demo"/> - <field name="stage_id" ref="crm.stage_lead5"/> + <field name="stage_id" ref="crm.stage_lead6"/> <field eval="1" name="active"/> + <field name="date_closed" eval="(DateTime.today() - relativedelta(hours=1)).strftime('%Y-%m-%d %H:%M')"/> </record> <record id="crm_case_24" model="crm.lead"> <field name="type">opportunity</field> <field name="name">Need 20 Days of Consultancy</field> - <field eval="5025" name="planned_revenue"/> + <field eval="6025" name="planned_revenue"/> <field eval="90.0" name="probability"/> <field name="email_from">info@mycompany.net</field> <field name="country_id" ref="base.pe"/> @@ -525,6 +534,7 @@ Andrew</field> <field name="user_id" ref="base.user_root"/> <field name="stage_id" ref="crm.stage_lead6"/> <field eval="1" name="active"/> + <field name="date_closed" eval="(DateTime.today() - relativedelta(month=1)).strftime('%Y-%m-%d %H:%M')"/> </record> <record id="crm_case_25" model="crm.lead"> @@ -544,7 +554,7 @@ Andrew</field> <field name="categ_ids" eval="[(6, 0, [categ_oppor4])]"/> <field name="priority">2</field> <field name="title_action">Conf call with technical service</field> - <field name="section_id" ref="crm_case_section_2"/> + <field name="section_id" ref="crm_case_section_1"/> <field name="user_id" ref="base.user_root"/> <field name="stage_id" ref="crm.stage_lead4"/> <field eval="1" name="active"/> @@ -569,10 +579,11 @@ Andrew</field> <field eval="time.strftime('%Y-%m-23')" name="date_deadline"/> <field eval="time.strftime('%Y-%m-10')" name="date_action"/> <field name="title_action">Send Catalogue by Email</field> - <field name="section_id" ref="crm_case_section_4"/> + <field name="section_id" ref="crm_case_section_2"/> <field name="user_id" ref="base.user_demo"/> - <field name="stage_id" ref="crm.stage_lead3"/> + <field name="stage_id" ref="crm.stage_lead6"/> <field eval="1" name="active"/> + <field name="date_closed" eval="(DateTime.today() - relativedelta(hours=1)).strftime('%Y-%m-%d %H:%M')"/> </record> <!-- Unsubscribe Admin from case15, subscribe Demo --> diff --git a/addons/crm/crm_lead_view.xml b/addons/crm/crm_lead_view.xml index 225b2ffc292..6ddd06c1c90 100644 --- a/addons/crm/crm_lead_view.xml +++ b/addons/crm/crm_lead_view.xml @@ -157,7 +157,8 @@ <label for="section_id" groups="base.group_multi_salesteams"/> <div groups="base.group_multi_salesteams"> <field name="section_id"/> - <button name="case_escalate" string="Escalate" type="object" + <button name="case_escalate" string="Escalate" + type="object" class="oe_link" attrs="{'invisible': ['|', ('section_id','=',False), ('state', 'not in', ['draft','open','pending'])]}"/> </div> <field name="type" invisible="1"/> @@ -343,7 +344,7 @@ help="Leads that are assigned to me"/> <filter string="Assigned to My Team(s)" domain="[('section_id.member_ids', 'in', [uid])]" context="{'invisible_section': False}" - help="Leads that are assigned to any sales teams I am member of"/> + help="Leads that are assigned to any sales teams I am member of" groups="base.group_multi_salesteams"/> <separator /> <filter string="Available for mass mailing" name='not_opt_out' domain="[('opt_out', '=', False)]" @@ -351,7 +352,7 @@ <separator /> <group expand="0" string="Group By..."> <filter string="Salesperson" domain="[]" context="{'group_by':'user_id'}"/> - <filter string="Team" domain="[]" context="{'group_by':'section_id'}"/> + <filter string="Team" domain="[]" context="{'group_by':'section_id'}" groups="base.group_multi_salesteams"/> <filter string="Stage" domain="[]" context="{'group_by':'stage_id'}"/> <filter string="Customer" help="Partner" domain="[]" context="{'group_by':'partner_id'}"/> <filter string="Country" domain="[]" context="{'group_by':'country_id'}"/> @@ -362,7 +363,7 @@ </group> <group string="Display"> <filter string="Show Countries" context="{'invisible_country': False}" help="Show Countries"/> - <filter string="Show Sales Team" context="{'invisible_section': False}" domain="[]" help="Show Sales Team"/> + <filter string="Show Sales Team" context="{'invisible_section': False}" domain="[]" help="Show Sales Team" groups="base.group_multi_salesteams"/> </group> </search> </field> @@ -556,7 +557,7 @@ <filter string="Lost" name="lost" domain="[('state','=','cancel')]"/> <filter string="Unassigned" name="unassigned" domain="[('user_id','=', False)]" help="No salesperson"/> <filter string="Unread Messages" name="message_unread" domain="[('message_unread','=',True)]" help="Unread messages"/> - <filter string="Mine" name="assigned_to_me" + <filter string="My Opportunities" name="assigned_to_me" domain="[('user_id','=',uid)]" context="{'invisible_section': False}" help="Opportunities that are assigned to me"/> <filter string="Assigned to My Team(s)" @@ -577,7 +578,7 @@ <filter string="Creation" domain="[]" context="{'group_by':'create_date'}"/> </group> <group string="Display"> - <filter string="Show Sales Team" context="{'invisible_section': False}" domain="[]" help="Show Sales Team"/> + <filter string="Show Sales Team" context="{'invisible_section': False}" domain="[]" help="Show Sales Team" groups="base.group_multi_salesteams"/> <filter string="Show Countries" context="{'invisible_country': False}" help="Show Countries"/> </group> </search> diff --git a/addons/crm/crm_phonecall_demo.xml b/addons/crm/crm_phonecall_demo.xml index f441c29a7e6..4002e18815e 100644 --- a/addons/crm/crm_phonecall_demo.xml +++ b/addons/crm/crm_phonecall_demo.xml @@ -37,7 +37,7 @@ <field name="name">Ask for convenient time of meeting</field> <field name="state">open</field> <field name="partner_phone">+1 786 525 0724</field> - <field name="section_id" ref="crm.crm_case_section_3"/> + <field name="section_id" ref="crm.crm_case_section_2"/> <field eval="1" name="active"/> <field name="categ_id" ref="crm.categ_phone2"/> <field eval="5.0" name="duration"/> @@ -50,7 +50,7 @@ <field name="state">done</field> <field name="partner_phone">(077) 582-4035</field> <field name="partner_mobile">(077) 341-3591</field> - <field name="section_id" ref="crm.crm_case_section_4"/> + <field name="section_id" ref="crm.crm_case_section_2"/> <field eval="1" name="active"/> <field name="categ_id" ref="crm.categ_phone1"/> <field eval="5.45" name="duration"/> @@ -74,7 +74,7 @@ <field name="name">Proposal for discount offer</field> <field name="state">open</field> <field name="partner_phone">+34 230 953 485</field> - <field name="section_id" ref="crm.crm_case_section_3"/> + <field name="section_id" ref="crm.crm_case_section_2"/> <field eval="time.strftime('%Y-%m-28 14:15:30')" name="date"/> <field name="categ_id" ref="crm.categ_phone2"/> <field eval="8.56" name="duration"/> diff --git a/addons/crm/crm_view.xml b/addons/crm/crm_view.xml index 63385fa3e17..a84ae553b4a 100644 --- a/addons/crm/crm_view.xml +++ b/addons/crm/crm_view.xml @@ -101,7 +101,7 @@ <field name="type"/> <field name="on_change"/> <field name="sequence"/> - <field name="case_default"/> + <field name="case_default" groups="base.group_multi_salesteams"/> <field name="fold"/> </group> <separator string="Requirements"/> diff --git a/addons/crm/i18n/ru.po b/addons/crm/i18n/ru.po index ec2a9f35ee5..0029293866c 100644 --- a/addons/crm/i18n/ru.po +++ b/addons/crm/i18n/ru.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-12-21 17:04+0000\n" -"PO-Revision-Date: 2013-05-30 13:52+0000\n" +"PO-Revision-Date: 2013-06-06 09:56+0000\n" "Last-Translator: Chertykov Denis <chertykov@gmail.com>\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: 2013-05-31 05:38+0000\n" -"X-Generator: Launchpad (build 16660)\n" +"X-Launchpad-Export-Date: 2013-06-07 05:48+0000\n" +"X-Generator: Launchpad (build 16667)\n" #. module: crm #: view:crm.lead.report:0 @@ -56,6 +56,11 @@ msgid "" "Description: [[object.description]]\n" " " msgstr "" +"Внимание, необработанный кандидат создан более 5 дней назад.\n" +"Название: [[object.name ]]\n" +"Идентификатор: [[object.id ]]\n" +"Описание: [[object.description]]\n" +" " #. module: crm #: field:crm.opportunity2phonecall,action:0 @@ -953,7 +958,7 @@ msgstr "Следующее действие" #: code:addons/crm/crm_lead.py:763 #, python-format msgid "<b>Partner</b> set to <em>%s</em>." -msgstr "" +msgstr "<b>Партнер</b> установлен как <em>%s</em>." #. module: crm #: selection:crm.lead.report,state:0 @@ -1894,7 +1899,7 @@ msgstr "Кандидаты" #: code:addons/crm/crm_lead.py:563 #, python-format msgid "Merged leads" -msgstr "" +msgstr "Объединенные кандидаты" #. module: crm #: model:crm.case.categ,name:crm.categ_oppor5 @@ -2721,7 +2726,7 @@ msgstr "Улица (2-я строка)" #. module: crm #: field:sale.config.settings,module_crm_helpdesk:0 msgid "Manage Helpdesk and Support" -msgstr "" +msgstr "Управление поддержкой" #. module: crm #: field:crm.lead.report,delay_open:0 @@ -2830,7 +2835,7 @@ msgstr "Дата создания" #. module: crm #: view:crm.lead:0 msgid "at" -msgstr "" +msgstr "в" #. module: crm #: model:crm.case.stage,name:crm.stage_lead1 diff --git a/addons/crm/report/crm_lead_report_view.xml b/addons/crm/report/crm_lead_report_view.xml index 759063b3c1d..09853c6379e 100644 --- a/addons/crm/report/crm_lead_report_view.xml +++ b/addons/crm/report/crm_lead_report_view.xml @@ -75,7 +75,7 @@ <filter icon="terp-dialog-close" string="Closed" domain="[('state','=','done')]" help="Leads/Opportunities which are in done state"/> <separator/> <filter string="My Sales Team(s)" icon="terp-personal+" context="{'invisible_section': False}" domain="[('section_id.user_id','=',uid)]" - help="Leads/Opportunities that are assigned to one of the sale teams I manage"/> + help="Leads/Opportunities that are assigned to one of the sale teams I manage" groups="base.group_multi_salesteams"/> <separator/> <filter icon="terp-personal" string="My Case(s)" help="Leads/Opportunities that are assigned to me" domain="[('user_id','=',uid)]"/> <field name="section_id" context="{'invisible_section': False}" diff --git a/addons/crm/report/crm_phonecall_report_view.xml b/addons/crm/report/crm_phonecall_report_view.xml index 070d574e0cd..aa2162d163a 100644 --- a/addons/crm/report/crm_phonecall_report_view.xml +++ b/addons/crm/report/crm_phonecall_report_view.xml @@ -57,7 +57,7 @@ help="Phone calls which are in pending state"/> <separator/> <filter string="My Sales Team(s)" icon="terp-personal+" context="{'invisible_section': False}" domain="[('section_id.user_id','=',uid)]" - help="Phone calls that are assigned to one of the sale teams I manage"/> + help="Phone calls that are assigned to one of the sale teams I manage" groups="base.group_multi_salesteams"/> <separator/> <filter icon="terp-personal" string="My Phone Calls" help="Phone Calls that are assigned to me" domain="[('user_id','=',uid)]" /> <field name="section_id" string="Sales Team" context="{'invisible_section': False}" diff --git a/addons/crm/res_config_view.xml b/addons/crm/res_config_view.xml index 547ce1c2ae6..9fd542c9dbd 100644 --- a/addons/crm/res_config_view.xml +++ b/addons/crm/res_config_view.xml @@ -22,9 +22,9 @@ </div> </div> </group> - <separator string="Sales Teams Configuration"/> + <separator string="Sales Teams"/> <group> - <label for="id" string="Use Sales Teams"/> + <label for="id" string="Manage Sales Teams"/> <div> <field name="group_multi_salesteams" class="oe_inline"/> <label for="group_multi_salesteams"/> diff --git a/addons/crm/security/ir.model.access.csv b/addons/crm/security/ir.model.access.csv index b09c201df2b..cadb8c24550 100644 --- a/addons/crm/security/ir.model.access.csv +++ b/addons/crm/security/ir.model.access.csv @@ -12,7 +12,7 @@ access_crm_phonecall_manager,crm.phonecall.manager,model_crm_phonecall,base.grou access_crm_case_categ,crm.case.categ,model_crm_case_categ,base.group_user,1,0,0,0
access_crm_lead,crm.lead,model_crm_lead,base.group_sale_salesman,1,1,1,0
access_crm_phonecall,crm.phonecall,model_crm_phonecall,base.group_sale_salesman,1,1,1,0
-access_crm_case_section_user,crm.case.section.user,model_crm_case_section,base.group_sale_salesman,1,1,1,0
+access_crm_case_section_user,crm.case.section.user,model_crm_case_section,base.group_sale_salesman,1,0,0,0
access_crm_case_section_manager,crm.case.section.manager,model_crm_case_section,base.group_sale_manager,1,1,1,1
access_crm_case_stage,crm.case.stage,model_crm_case_stage,,1,0,0,0
access_crm_case_stage_manager,crm.case.stage,model_crm_case_stage,base.group_sale_manager,1,1,1,1
diff --git a/addons/crm/static/lib/sparkline/jquery.sparkline.js b/addons/crm/static/lib/sparkline/jquery.sparkline.js new file mode 100644 index 00000000000..c003923e03b --- /dev/null +++ b/addons/crm/static/lib/sparkline/jquery.sparkline.js @@ -0,0 +1,3047 @@ +/** +* +* jquery.sparkline.js +* +* v2.1.1 +* (c) Splunk, Inc +* Contact: Gareth Watts (gareth@splunk.com) +* http://omnipotent.net/jquery.sparkline/ +* +* Generates inline sparkline charts from data supplied either to the method +* or inline in HTML +* +* Compatible with Internet Explorer 6.0+ and modern browsers equipped with the canvas tag +* (Firefox 2.0+, Safari, Opera, etc) +* +* License: New BSD License +* +* Copyright (c) 2012, Splunk Inc. +* All rights reserved. +* +* Redistribution and use in source and binary forms, with or without modification, +* are permitted provided that the following conditions are met: +* +* * Redistributions of source code must retain the above copyright notice, +* this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation +* and/or other materials provided with the distribution. +* * Neither the name of Splunk Inc nor the names of its contributors may +* be used to endorse or promote products derived from this software without +* specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY +* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT +* SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT +* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* +* Usage: +* $(selector).sparkline(values, options) +* +* If values is undefined or set to 'html' then the data values are read from the specified tag: +* <p>Sparkline: <span class="sparkline">1,4,6,6,8,5,3,5</span></p> +* $('.sparkline').sparkline(); +* There must be no spaces in the enclosed data set +* +* Otherwise values must be an array of numbers or null values +* <p>Sparkline: <span id="sparkline1">This text replaced if the browser is compatible</span></p> +* $('#sparkline1').sparkline([1,4,6,6,8,5,3,5]) +* $('#sparkline2').sparkline([1,4,6,null,null,5,3,5]) +* +* Values can also be specified in an HTML comment, or as a values attribute: +* <p>Sparkline: <span class="sparkline"><!--1,4,6,6,8,5,3,5 --></span></p> +* <p>Sparkline: <span class="sparkline" values="1,4,6,6,8,5,3,5"></span></p> +* $('.sparkline').sparkline(); +* +* For line charts, x values can also be specified: +* <p>Sparkline: <span class="sparkline">1:1,2.7:4,3.4:6,5:6,6:8,8.7:5,9:3,10:5</span></p> +* $('#sparkline1').sparkline([ [1,1], [2.7,4], [3.4,6], [5,6], [6,8], [8.7,5], [9,3], [10,5] ]) +* +* By default, options should be passed in as teh second argument to the sparkline function: +* $('.sparkline').sparkline([1,2,3,4], {type: 'bar'}) +* +* Options can also be set by passing them on the tag itself. This feature is disabled by default though +* as there's a slight performance overhead: +* $('.sparkline').sparkline([1,2,3,4], {enableTagOptions: true}) +* <p>Sparkline: <span class="sparkline" sparkType="bar" sparkBarColor="red">loading</span></p> +* Prefix all options supplied as tag attribute with "spark" (configurable by setting tagOptionPrefix) +* +* Supported options: +* lineColor - Color of the line used for the chart +* fillColor - Color used to fill in the chart - Set to '' or false for a transparent chart +* width - Width of the chart - Defaults to 3 times the number of values in pixels +* height - Height of the chart - Defaults to the height of the containing element +* chartRangeMin - Specify the minimum value to use for the Y range of the chart - Defaults to the minimum value supplied +* chartRangeMax - Specify the maximum value to use for the Y range of the chart - Defaults to the maximum value supplied +* chartRangeClip - Clip out of range values to the max/min specified by chartRangeMin and chartRangeMax +* chartRangeMinX - Specify the minimum value to use for the X range of the chart - Defaults to the minimum value supplied +* chartRangeMaxX - Specify the maximum value to use for the X range of the chart - Defaults to the maximum value supplied +* composite - If true then don't erase any existing chart attached to the tag, but draw +* another chart over the top - Note that width and height are ignored if an +* existing chart is detected. +* tagValuesAttribute - Name of tag attribute to check for data values - Defaults to 'values' +* enableTagOptions - Whether to check tags for sparkline options +* tagOptionPrefix - Prefix used for options supplied as tag attributes - Defaults to 'spark' +* disableHiddenCheck - If set to true, then the plugin will assume that charts will never be drawn into a +* hidden dom element, avoding a browser reflow +* disableInteraction - If set to true then all mouseover/click interaction behaviour will be disabled, +* making the plugin perform much like it did in 1.x +* disableTooltips - If set to true then tooltips will be disabled - Defaults to false (tooltips enabled) +* disableHighlight - If set to true then highlighting of selected chart elements on mouseover will be disabled +* defaults to false (highlights enabled) +* highlightLighten - Factor to lighten/darken highlighted chart values by - Defaults to 1.4 for a 40% increase +* tooltipContainer - Specify which DOM element the tooltip should be rendered into - defaults to document.body +* tooltipClassname - Optional CSS classname to apply to tooltips - If not specified then a default style will be applied +* tooltipOffsetX - How many pixels away from the mouse pointer to render the tooltip on the X axis +* tooltipOffsetY - How many pixels away from the mouse pointer to render the tooltip on the r axis +* tooltipFormatter - Optional callback that allows you to override the HTML displayed in the tooltip +* callback is given arguments of (sparkline, options, fields) +* tooltipChartTitle - If specified then the tooltip uses the string specified by this setting as a title +* tooltipFormat - A format string or SPFormat object (or an array thereof for multiple entries) +* to control the format of the tooltip +* tooltipPrefix - A string to prepend to each field displayed in a tooltip +* tooltipSuffix - A string to append to each field displayed in a tooltip +* tooltipSkipNull - If true then null values will not have a tooltip displayed (defaults to true) +* tooltipValueLookups - An object or range map to map field values to tooltip strings +* (eg. to map -1 to "Lost", 0 to "Draw", and 1 to "Win") +* numberFormatter - Optional callback for formatting numbers in tooltips +* numberDigitGroupSep - Character to use for group separator in numbers "1,234" - Defaults to "," +* numberDecimalMark - Character to use for the decimal point when formatting numbers - Defaults to "." +* numberDigitGroupCount - Number of digits between group separator - Defaults to 3 +* +* There are 7 types of sparkline, selected by supplying a "type" option of 'line' (default), +* 'bar', 'tristate', 'bullet', 'discrete', 'pie' or 'box' +* line - Line chart. Options: +* spotColor - Set to '' to not end each line in a circular spot +* minSpotColor - If set, color of spot at minimum value +* maxSpotColor - If set, color of spot at maximum value +* spotRadius - Radius in pixels +* lineWidth - Width of line in pixels +* normalRangeMin +* normalRangeMax - If set draws a filled horizontal bar between these two values marking the "normal" +* or expected range of values +* normalRangeColor - Color to use for the above bar +* drawNormalOnTop - Draw the normal range above the chart fill color if true +* defaultPixelsPerValue - Defaults to 3 pixels of width for each value in the chart +* highlightSpotColor - The color to use for drawing a highlight spot on mouseover - Set to null to disable +* highlightLineColor - The color to use for drawing a highlight line on mouseover - Set to null to disable +* valueSpots - Specify which points to draw spots on, and in which color. Accepts a range map +* +* bar - Bar chart. Options: +* barColor - Color of bars for postive values +* negBarColor - Color of bars for negative values +* zeroColor - Color of bars with zero values +* nullColor - Color of bars with null values - Defaults to omitting the bar entirely +* barWidth - Width of bars in pixels +* colorMap - Optional mappnig of values to colors to override the *BarColor values above +* can be an Array of values to control the color of individual bars or a range map +* to specify colors for individual ranges of values +* barSpacing - Gap between bars in pixels +* zeroAxis - Centers the y-axis around zero if true +* +* tristate - Charts values of win (>0), lose (<0) or draw (=0) +* posBarColor - Color of win values +* negBarColor - Color of lose values +* zeroBarColor - Color of draw values +* barWidth - Width of bars in pixels +* barSpacing - Gap between bars in pixels +* colorMap - Optional mappnig of values to colors to override the *BarColor values above +* can be an Array of values to control the color of individual bars or a range map +* to specify colors for individual ranges of values +* +* discrete - Options: +* lineHeight - Height of each line in pixels - Defaults to 30% of the graph height +* thesholdValue - Values less than this value will be drawn using thresholdColor instead of lineColor +* thresholdColor +* +* bullet - Values for bullet graphs msut be in the order: target, performance, range1, range2, range3, ... +* options: +* targetColor - The color of the vertical target marker +* targetWidth - The width of the target marker in pixels +* performanceColor - The color of the performance measure horizontal bar +* rangeColors - Colors to use for each qualitative range background color +* +* pie - Pie chart. Options: +* sliceColors - An array of colors to use for pie slices +* offset - Angle in degrees to offset the first slice - Try -90 or +90 +* borderWidth - Width of border to draw around the pie chart, in pixels - Defaults to 0 (no border) +* borderColor - Color to use for the pie chart border - Defaults to #000 +* +* box - Box plot. Options: +* raw - Set to true to supply pre-computed plot points as values +* values should be: low_outlier, low_whisker, q1, median, q3, high_whisker, high_outlier +* When set to false you can supply any number of values and the box plot will +* be computed for you. Default is false. +* showOutliers - Set to true (default) to display outliers as circles +* outlierIQR - Interquartile range used to determine outliers. Default 1.5 +* boxLineColor - Outline color of the box +* boxFillColor - Fill color for the box +* whiskerColor - Line color used for whiskers +* outlierLineColor - Outline color of outlier circles +* outlierFillColor - Fill color of the outlier circles +* spotRadius - Radius of outlier circles +* medianColor - Line color of the median line +* target - Draw a target cross hair at the supplied value (default undefined) +* +* +* +* Examples: +* $('#sparkline1').sparkline(myvalues, { lineColor: '#f00', fillColor: false }); +* $('.barsparks').sparkline('html', { type:'bar', height:'40px', barWidth:5 }); +* $('#tristate').sparkline([1,1,-1,1,0,0,-1], { type:'tristate' }): +* $('#discrete').sparkline([1,3,4,5,5,3,4,5], { type:'discrete' }); +* $('#bullet').sparkline([10,12,12,9,7], { type:'bullet' }); +* $('#pie').sparkline([1,1,2], { type:'pie' }); +*/ + +/*jslint regexp: true, browser: true, jquery: true, white: true, nomen: false, plusplus: false, maxerr: 500, indent: 4 */ + +(function(factory) { + if(typeof define === 'function' && define.amd) { + define(['jquery'], factory); + } + else { + factory(jQuery); + } +} +(function($) { + 'use strict'; + + var UNSET_OPTION = {}, + getDefaults, createClass, SPFormat, clipval, quartile, normalizeValue, normalizeValues, + remove, isNumber, all, sum, addCSS, ensureArray, formatNumber, RangeMap, + MouseHandler, Tooltip, barHighlightMixin, + line, bar, tristate, discrete, bullet, pie, box, defaultStyles, initStyles, + VShape, VCanvas_base, VCanvas_canvas, VCanvas_vml, pending, shapeCount = 0; + + /** + * Default configuration settings + */ + getDefaults = function () { + return { + // Settings common to most/all chart types + common: { + type: 'line', + lineColor: '#00f', + fillColor: '#cdf', + defaultPixelsPerValue: 3, + width: 'auto', + height: 'auto', + composite: false, + tagValuesAttribute: 'values', + tagOptionsPrefix: 'spark', + enableTagOptions: false, + enableHighlight: true, + highlightLighten: 1.4, + tooltipSkipNull: true, + tooltipPrefix: '', + tooltipSuffix: '', + disableHiddenCheck: false, + numberFormatter: false, + numberDigitGroupCount: 3, + numberDigitGroupSep: ',', + numberDecimalMark: '.', + disableTooltips: false, + disableInteraction: false + }, + // Defaults for line charts + line: { + spotColor: '#f80', + highlightSpotColor: '#5f5', + highlightLineColor: '#f22', + spotRadius: 1.5, + minSpotColor: '#f80', + maxSpotColor: '#f80', + lineWidth: 1, + normalRangeMin: undefined, + normalRangeMax: undefined, + normalRangeColor: '#ccc', + drawNormalOnTop: false, + chartRangeMin: undefined, + chartRangeMax: undefined, + chartRangeMinX: undefined, + chartRangeMaxX: undefined, + tooltipFormat: new SPFormat('<span style="color: {{color}}">●</span> {{prefix}}{{y}}{{suffix}}') + }, + // Defaults for bar charts + bar: { + barColor: '#3366cc', + negBarColor: '#f44', + stackedBarColor: ['#3366cc', '#dc3912', '#ff9900', '#109618', '#66aa00', + '#dd4477', '#0099c6', '#990099'], + zeroColor: undefined, + nullColor: undefined, + zeroAxis: true, + barWidth: 4, + barSpacing: 1, + chartRangeMax: undefined, + chartRangeMin: undefined, + chartRangeClip: false, + colorMap: undefined, + tooltipFormat: new SPFormat('<span style="color: {{color}}">●</span> {{prefix}}{{value}}{{suffix}}') + }, + // Defaults for tristate charts + tristate: { + barWidth: 4, + barSpacing: 1, + posBarColor: '#6f6', + negBarColor: '#f44', + zeroBarColor: '#999', + colorMap: {}, + tooltipFormat: new SPFormat('<span style="color: {{color}}">●</span> {{value:map}}'), + tooltipValueLookups: { map: { '-1': 'Loss', '0': 'Draw', '1': 'Win' } } + }, + // Defaults for discrete charts + discrete: { + lineHeight: 'auto', + thresholdColor: undefined, + thresholdValue: 0, + chartRangeMax: undefined, + chartRangeMin: undefined, + chartRangeClip: false, + tooltipFormat: new SPFormat('{{prefix}}{{value}}{{suffix}}') + }, + // Defaults for bullet charts + bullet: { + targetColor: '#f33', + targetWidth: 3, // width of the target bar in pixels + performanceColor: '#33f', + rangeColors: ['#d3dafe', '#a8b6ff', '#7f94ff'], + base: undefined, // set this to a number to change the base start number + tooltipFormat: new SPFormat('{{fieldkey:fields}} - {{value}}'), + tooltipValueLookups: { fields: {r: 'Range', p: 'Performance', t: 'Target'} } + }, + // Defaults for pie charts + pie: { + offset: 0, + sliceColors: ['#3366cc', '#dc3912', '#ff9900', '#109618', '#66aa00', + '#dd4477', '#0099c6', '#990099'], + borderWidth: 0, + borderColor: '#000', + tooltipFormat: new SPFormat('<span style="color: {{color}}">●</span> {{value}} ({{percent.1}}%)') + }, + // Defaults for box plots + box: { + raw: false, + boxLineColor: '#000', + boxFillColor: '#cdf', + whiskerColor: '#000', + outlierLineColor: '#333', + outlierFillColor: '#fff', + medianColor: '#f00', + showOutliers: true, + outlierIQR: 1.5, + spotRadius: 1.5, + target: undefined, + targetColor: '#4a2', + chartRangeMax: undefined, + chartRangeMin: undefined, + tooltipFormat: new SPFormat('{{field:fields}}: {{value}}'), + tooltipFormatFieldlistKey: 'field', + tooltipValueLookups: { fields: { lq: 'Lower Quartile', med: 'Median', + uq: 'Upper Quartile', lo: 'Left Outlier', ro: 'Right Outlier', + lw: 'Left Whisker', rw: 'Right Whisker'} } + } + }; + }; + + // You can have tooltips use a css class other than jqstooltip by specifying tooltipClassname + defaultStyles = '.jqstooltip { ' + + 'position: absolute;' + + 'left: 0px;' + + 'top: 0px;' + + 'visibility: hidden;' + + 'background: rgb(0, 0, 0) transparent;' + + 'background-color: rgba(0,0,0,0.6);' + + 'filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#99000000, endColorstr=#99000000);' + + '-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#99000000, endColorstr=#99000000)";' + + 'color: white;' + + 'font: 10px arial, san serif;' + + 'text-align: left;' + + 'white-space: nowrap;' + + 'padding: 5px;' + + 'border: 1px solid white;' + + 'z-index: 10000;' + + '}' + + '.jqsfield { ' + + 'color: white;' + + 'font: 10px arial, san serif;' + + 'text-align: left;' + + '}'; + + /** + * Utilities + */ + + createClass = function (/* [baseclass, [mixin, ...]], definition */) { + var Class, args; + Class = function () { + this.init.apply(this, arguments); + }; + if (arguments.length > 1) { + if (arguments[0]) { + Class.prototype = $.extend(new arguments[0](), arguments[arguments.length - 1]); + Class._super = arguments[0].prototype; + } else { + Class.prototype = arguments[arguments.length - 1]; + } + if (arguments.length > 2) { + args = Array.prototype.slice.call(arguments, 1, -1); + args.unshift(Class.prototype); + $.extend.apply($, args); + } + } else { + Class.prototype = arguments[0]; + } + Class.prototype.cls = Class; + return Class; + }; + + /** + * Wraps a format string for tooltips + * {{x}} + * {{x.2} + * {{x:months}} + */ + $.SPFormatClass = SPFormat = createClass({ + fre: /\{\{([\w.]+?)(:(.+?))?\}\}/g, + precre: /(\w+)\.(\d+)/, + + init: function (format, fclass) { + this.format = format; + this.fclass = fclass; + }, + + render: function (fieldset, lookups, options) { + var self = this, + fields = fieldset, + match, token, lookupkey, fieldvalue, prec; + return this.format.replace(this.fre, function () { + var lookup; + token = arguments[1]; + lookupkey = arguments[3]; + match = self.precre.exec(token); + if (match) { + prec = match[2]; + token = match[1]; + } else { + prec = false; + } + fieldvalue = fields[token]; + if (fieldvalue === undefined) { + return ''; + } + if (lookupkey && lookups && lookups[lookupkey]) { + lookup = lookups[lookupkey]; + if (lookup.get) { // RangeMap + return lookups[lookupkey].get(fieldvalue) || fieldvalue; + } else { + return lookups[lookupkey][fieldvalue] || fieldvalue; + } + } + if (isNumber(fieldvalue)) { + if (options.get('numberFormatter')) { + fieldvalue = options.get('numberFormatter')(fieldvalue); + } else { + fieldvalue = formatNumber(fieldvalue, prec, + options.get('numberDigitGroupCount'), + options.get('numberDigitGroupSep'), + options.get('numberDecimalMark')); + } + } + return fieldvalue; + }); + } + }); + + // convience method to avoid needing the new operator + $.spformat = function(format, fclass) { + return new SPFormat(format, fclass); + }; + + clipval = function (val, min, max) { + if (val < min) { + return min; + } + if (val > max) { + return max; + } + return val; + }; + + quartile = function (values, q) { + var vl; + if (q === 2) { + vl = Math.floor(values.length / 2); + return values.length % 2 ? values[vl] : (values[vl-1] + values[vl]) / 2; + } else { + if (values.length % 2 ) { // odd + vl = (values.length * q + q) / 4; + return vl % 1 ? (values[Math.floor(vl)] + values[Math.floor(vl) - 1]) / 2 : values[vl-1]; + } else { //even + vl = (values.length * q + 2) / 4; + return vl % 1 ? (values[Math.floor(vl)] + values[Math.floor(vl) - 1]) / 2 : values[vl-1]; + + } + } + }; + + normalizeValue = function (val) { + var nf; + switch (val) { + case 'undefined': + val = undefined; + break; + case 'null': + val = null; + break; + case 'true': + val = true; + break; + case 'false': + val = false; + break; + default: + nf = parseFloat(val); + if (val == nf) { + val = nf; + } + } + return val; + }; + + normalizeValues = function (vals) { + var i, result = []; + for (i = vals.length; i--;) { + result[i] = normalizeValue(vals[i]); + } + return result; + }; + + remove = function (vals, filter) { + var i, vl, result = []; + for (i = 0, vl = vals.length; i < vl; i++) { + if (vals[i] !== filter) { + result.push(vals[i]); + } + } + return result; + }; + + isNumber = function (num) { + return !isNaN(parseFloat(num)) && isFinite(num); + }; + + formatNumber = function (num, prec, groupsize, groupsep, decsep) { + var p, i; + num = (prec === false ? parseFloat(num).toString() : num.toFixed(prec)).split(''); + p = (p = $.inArray('.', num)) < 0 ? num.length : p; + if (p < num.length) { + num[p] = decsep; + } + for (i = p - groupsize; i > 0; i -= groupsize) { + num.splice(i, 0, groupsep); + } + return num.join(''); + }; + + // determine if all values of an array match a value + // returns true if the array is empty + all = function (val, arr, ignoreNull) { + var i; + for (i = arr.length; i--; ) { + if (ignoreNull && arr[i] === null) continue; + if (arr[i] !== val) { + return false; + } + } + return true; + }; + + // sums the numeric values in an array, ignoring other values + sum = function (vals) { + var total = 0, i; + for (i = vals.length; i--;) { + total += typeof vals[i] === 'number' ? vals[i] : 0; + } + return total; + }; + + ensureArray = function (val) { + return $.isArray(val) ? val : [val]; + }; + + // http://paulirish.com/2008/bookmarklet-inject-new-css-rules/ + addCSS = function(css) { + var tag; + //if ('\v' == 'v') /* ie only */ { + if (document.createStyleSheet) { + document.createStyleSheet().cssText = css; + } else { + tag = document.createElement('style'); + tag.type = 'text/css'; + document.getElementsByTagName('head')[0].appendChild(tag); + tag[(typeof document.body.style.WebkitAppearance == 'string') /* webkit only */ ? 'innerText' : 'innerHTML'] = css; + } + }; + + // Provide a cross-browser interface to a few simple drawing primitives + $.fn.simpledraw = function (width, height, useExisting, interact) { + var target, mhandler; + if (useExisting && (target = this.data('_jqs_vcanvas'))) { + return target; + } + if (width === undefined) { + width = $(this).innerWidth(); + } + if (height === undefined) { + height = $(this).innerHeight(); + } + if ($.fn.sparkline.hasCanvas) { + target = new VCanvas_canvas(width, height, this, interact); + } else if ($.fn.sparkline.hasVML) { + target = new VCanvas_vml(width, height, this); + } else { + return false; + } + mhandler = $(this).data('_jqs_mhandler'); + if (mhandler) { + mhandler.registerCanvas(target); + } + return target; + }; + + $.fn.cleardraw = function () { + var target = this.data('_jqs_vcanvas'); + if (target) { + target.reset(); + } + }; + + $.RangeMapClass = RangeMap = createClass({ + init: function (map) { + var key, range, rangelist = []; + for (key in map) { + if (map.hasOwnProperty(key) && typeof key === 'string' && key.indexOf(':') > -1) { + range = key.split(':'); + range[0] = range[0].length === 0 ? -Infinity : parseFloat(range[0]); + range[1] = range[1].length === 0 ? Infinity : parseFloat(range[1]); + range[2] = map[key]; + rangelist.push(range); + } + } + this.map = map; + this.rangelist = rangelist || false; + }, + + get: function (value) { + var rangelist = this.rangelist, + i, range, result; + if ((result = this.map[value]) !== undefined) { + return result; + } + if (rangelist) { + for (i = rangelist.length; i--;) { + range = rangelist[i]; + if (range[0] <= value && range[1] >= value) { + return range[2]; + } + } + } + return undefined; + } + }); + + // Convenience function + $.range_map = function(map) { + return new RangeMap(map); + }; + + MouseHandler = createClass({ + init: function (el, options) { + var $el = $(el); + this.$el = $el; + this.options = options; + this.currentPageX = 0; + this.currentPageY = 0; + this.el = el; + this.splist = []; + this.tooltip = null; + this.over = false; + this.displayTooltips = !options.get('disableTooltips'); + this.highlightEnabled = !options.get('disableHighlight'); + }, + + registerSparkline: function (sp) { + this.splist.push(sp); + if (this.over) { + this.updateDisplay(); + } + }, + + registerCanvas: function (canvas) { + var $canvas = $(canvas.canvas); + this.canvas = canvas; + this.$canvas = $canvas; + $canvas.mouseenter($.proxy(this.mouseenter, this)); + $canvas.mouseleave($.proxy(this.mouseleave, this)); + $canvas.click($.proxy(this.mouseclick, this)); + }, + + reset: function (removeTooltip) { + this.splist = []; + if (this.tooltip && removeTooltip) { + this.tooltip.remove(); + this.tooltip = undefined; + } + }, + + mouseclick: function (e) { + var clickEvent = $.Event('sparklineClick'); + clickEvent.originalEvent = e; + clickEvent.sparklines = this.splist; + this.$el.trigger(clickEvent); + }, + + mouseenter: function (e) { + $(document.body).unbind('mousemove.jqs'); + $(document.body).bind('mousemove.jqs', $.proxy(this.mousemove, this)); + this.over = true; + this.currentPageX = e.pageX; + this.currentPageY = e.pageY; + this.currentEl = e.target; + if (!this.tooltip && this.displayTooltips) { + this.tooltip = new Tooltip(this.options); + this.tooltip.updatePosition(e.pageX, e.pageY); + } + this.updateDisplay(); + }, + + mouseleave: function () { + $(document.body).unbind('mousemove.jqs'); + var splist = this.splist, + spcount = splist.length, + needsRefresh = false, + sp, i; + this.over = false; + this.currentEl = null; + + if (this.tooltip) { + this.tooltip.remove(); + this.tooltip = null; + } + + for (i = 0; i < spcount; i++) { + sp = splist[i]; + if (sp.clearRegionHighlight()) { + needsRefresh = true; + } + } + + if (needsRefresh) { + this.canvas.render(); + } + }, + + mousemove: function (e) { + this.currentPageX = e.pageX; + this.currentPageY = e.pageY; + this.currentEl = e.target; + if (this.tooltip) { + this.tooltip.updatePosition(e.pageX, e.pageY); + } + this.updateDisplay(); + }, + + updateDisplay: function () { + var splist = this.splist, + spcount = splist.length, + needsRefresh = false, + offset = this.$canvas.offset(), + localX = this.currentPageX - offset.left, + localY = this.currentPageY - offset.top, + tooltiphtml, sp, i, result, changeEvent; + if (!this.over) { + return; + } + for (i = 0; i < spcount; i++) { + sp = splist[i]; + result = sp.setRegionHighlight(this.currentEl, localX, localY); + if (result) { + needsRefresh = true; + } + } + if (needsRefresh) { + changeEvent = $.Event('sparklineRegionChange'); + changeEvent.sparklines = this.splist; + this.$el.trigger(changeEvent); + if (this.tooltip) { + tooltiphtml = ''; + for (i = 0; i < spcount; i++) { + sp = splist[i]; + tooltiphtml += sp.getCurrentRegionTooltip(); + } + this.tooltip.setContent(tooltiphtml); + } + if (!this.disableHighlight) { + this.canvas.render(); + } + } + if (result === null) { + this.mouseleave(); + } + } + }); + + + Tooltip = createClass({ + sizeStyle: 'position: static !important;' + + 'display: block !important;' + + 'visibility: hidden !important;' + + 'float: left !important;', + + init: function (options) { + var tooltipClassname = options.get('tooltipClassname', 'jqstooltip'), + sizetipStyle = this.sizeStyle, + offset; + this.container = options.get('tooltipContainer') || document.body; + this.tooltipOffsetX = options.get('tooltipOffsetX', 10); + this.tooltipOffsetY = options.get('tooltipOffsetY', 12); + // remove any previous lingering tooltip + $('#jqssizetip').remove(); + $('#jqstooltip').remove(); + this.sizetip = $('<div/>', { + id: 'jqssizetip', + style: sizetipStyle, + 'class': tooltipClassname + }); + this.tooltip = $('<div/>', { + id: 'jqstooltip', + 'class': tooltipClassname + }).appendTo(this.container); + // account for the container's location + offset = this.tooltip.offset(); + this.offsetLeft = offset.left; + this.offsetTop = offset.top; + this.hidden = true; + $(window).unbind('resize.jqs scroll.jqs'); + $(window).bind('resize.jqs scroll.jqs', $.proxy(this.updateWindowDims, this)); + this.updateWindowDims(); + }, + + updateWindowDims: function () { + this.scrollTop = $(window).scrollTop(); + this.scrollLeft = $(window).scrollLeft(); + this.scrollRight = this.scrollLeft + $(window).width(); + this.updatePosition(); + }, + + getSize: function (content) { + this.sizetip.html(content).appendTo(this.container); + this.width = this.sizetip.width() + 1; + this.height = this.sizetip.height(); + this.sizetip.remove(); + }, + + setContent: function (content) { + if (!content) { + this.tooltip.css('visibility', 'hidden'); + this.hidden = true; + return; + } + this.getSize(content); + this.tooltip.html(content) + .css({ + 'width': this.width, + 'height': this.height, + 'visibility': 'visible' + }); + if (this.hidden) { + this.hidden = false; + this.updatePosition(); + } + }, + + updatePosition: function (x, y) { + if (x === undefined) { + if (this.mousex === undefined) { + return; + } + x = this.mousex - this.offsetLeft; + y = this.mousey - this.offsetTop; + + } else { + this.mousex = x = x - this.offsetLeft; + this.mousey = y = y - this.offsetTop; + } + if (!this.height || !this.width || this.hidden) { + return; + } + + y -= this.height + this.tooltipOffsetY; + x += this.tooltipOffsetX; + + if (y < this.scrollTop) { + y = this.scrollTop; + } + if (x < this.scrollLeft) { + x = this.scrollLeft; + } else if (x + this.width > this.scrollRight) { + x = this.scrollRight - this.width; + } + + this.tooltip.css({ + 'left': x, + 'top': y + }); + }, + + remove: function () { + this.tooltip.remove(); + this.sizetip.remove(); + this.sizetip = this.tooltip = undefined; + $(window).unbind('resize.jqs scroll.jqs'); + } + }); + + initStyles = function() { + addCSS(defaultStyles); + }; + + $(initStyles); + + pending = []; + $.fn.sparkline = function (userValues, userOptions) { + return this.each(function () { + var options = new $.fn.sparkline.options(this, userOptions), + $this = $(this), + render, i; + render = function () { + var values, width, height, tmp, mhandler, sp, vals; + if (userValues === 'html' || userValues === undefined) { + vals = this.getAttribute(options.get('tagValuesAttribute')); + if (vals === undefined || vals === null) { + vals = $this.html(); + } + values = vals.replace(/(^\s*<!--)|(-->\s*$)|\s+/g, '').split(','); + } else { + values = userValues; + } + + width = options.get('width') === 'auto' ? values.length * options.get('defaultPixelsPerValue') : options.get('width'); + if (options.get('height') === 'auto') { + if (!options.get('composite') || !$.data(this, '_jqs_vcanvas')) { + // must be a better way to get the line height + tmp = document.createElement('span'); + tmp.innerHTML = 'a'; + $this.html(tmp); + height = $(tmp).innerHeight() || $(tmp).height(); + $(tmp).remove(); + tmp = null; + } + } else { + height = options.get('height'); + } + + if (!options.get('disableInteraction')) { + mhandler = $.data(this, '_jqs_mhandler'); + if (!mhandler) { + mhandler = new MouseHandler(this, options); + $.data(this, '_jqs_mhandler', mhandler); + } else if (!options.get('composite')) { + mhandler.reset(); + } + } else { + mhandler = false; + } + + if (options.get('composite') && !$.data(this, '_jqs_vcanvas')) { + if (!$.data(this, '_jqs_errnotify')) { + alert('Attempted to attach a composite sparkline to an element with no existing sparkline'); + $.data(this, '_jqs_errnotify', true); + } + return; + } + + sp = new $.fn.sparkline[options.get('type')](this, values, options, width, height); + + sp.render(); + + if (mhandler) { + mhandler.registerSparkline(sp); + } + }; + // jQuery 1.3.0 completely changed the meaning of :hidden :-/ + if (($(this).html() && !options.get('disableHiddenCheck') && $(this).is(':hidden')) || ($.fn.jquery < '1.3.0' && $(this).parents().is(':hidden')) || !$(this).parents('body').length) { + if (!options.get('composite') && $.data(this, '_jqs_pending')) { + // remove any existing references to the element + for (i = pending.length; i; i--) { + if (pending[i - 1][0] == this) { + pending.splice(i - 1, 1); + } + } + } + pending.push([this, render]); + $.data(this, '_jqs_pending', true); + } else { + render.call(this); + } + }); + }; + + $.fn.sparkline.defaults = getDefaults(); + + + $.sparkline_display_visible = function () { + var el, i, pl; + var done = []; + for (i = 0, pl = pending.length; i < pl; i++) { + el = pending[i][0]; + if ($(el).is(':visible') && !$(el).parents().is(':hidden')) { + pending[i][1].call(el); + $.data(pending[i][0], '_jqs_pending', false); + done.push(i); + } else if (!$(el).closest('html').length && !$.data(el, '_jqs_pending')) { + // element has been inserted and removed from the DOM + // If it was not yet inserted into the dom then the .data request + // will return true. + // removing from the dom causes the data to be removed. + $.data(pending[i][0], '_jqs_pending', false); + done.push(i); + } + } + for (i = done.length; i; i--) { + pending.splice(done[i - 1], 1); + } + }; + + + /** + * User option handler + */ + $.fn.sparkline.options = createClass({ + init: function (tag, userOptions) { + var extendedOptions, defaults, base, tagOptionType; + this.userOptions = userOptions = userOptions || {}; + this.tag = tag; + this.tagValCache = {}; + defaults = $.fn.sparkline.defaults; + base = defaults.common; + this.tagOptionsPrefix = userOptions.enableTagOptions && (userOptions.tagOptionsPrefix || base.tagOptionsPrefix); + + tagOptionType = this.getTagSetting('type'); + if (tagOptionType === UNSET_OPTION) { + extendedOptions = defaults[userOptions.type || base.type]; + } else { + extendedOptions = defaults[tagOptionType]; + } + this.mergedOptions = $.extend({}, base, extendedOptions, userOptions); + }, + + + getTagSetting: function (key) { + var prefix = this.tagOptionsPrefix, + val, i, pairs, keyval; + if (prefix === false || prefix === undefined) { + return UNSET_OPTION; + } + if (this.tagValCache.hasOwnProperty(key)) { + val = this.tagValCache.key; + } else { + val = this.tag.getAttribute(prefix + key); + if (val === undefined || val === null) { + val = UNSET_OPTION; + } else if (val.substr(0, 1) === '[') { + val = val.substr(1, val.length - 2).split(','); + for (i = val.length; i--;) { + val[i] = normalizeValue(val[i].replace(/(^\s*)|(\s*$)/g, '')); + } + } else if (val.substr(0, 1) === '{') { + pairs = val.substr(1, val.length - 2).split(','); + val = {}; + for (i = pairs.length; i--;) { + keyval = pairs[i].split(':', 2); + val[keyval[0].replace(/(^\s*)|(\s*$)/g, '')] = normalizeValue(keyval[1].replace(/(^\s*)|(\s*$)/g, '')); + } + } else { + val = normalizeValue(val); + } + this.tagValCache.key = val; + } + return val; + }, + + get: function (key, defaultval) { + var tagOption = this.getTagSetting(key), + result; + if (tagOption !== UNSET_OPTION) { + return tagOption; + } + return (result = this.mergedOptions[key]) === undefined ? defaultval : result; + } + }); + + + $.fn.sparkline._base = createClass({ + disabled: false, + + init: function (el, values, options, width, height) { + this.el = el; + this.$el = $(el); + this.values = values; + this.options = options; + this.width = width; + this.height = height; + this.currentRegion = undefined; + }, + + /** + * Setup the canvas + */ + initTarget: function () { + var interactive = !this.options.get('disableInteraction'); + if (!(this.target = this.$el.simpledraw(this.width, this.height, this.options.get('composite'), interactive))) { + this.disabled = true; + } else { + this.canvasWidth = this.target.pixelWidth; + this.canvasHeight = this.target.pixelHeight; + } + }, + + /** + * Actually render the chart to the canvas + */ + render: function () { + if (this.disabled) { + this.el.innerHTML = ''; + return false; + } + return true; + }, + + /** + * Return a region id for a given x/y co-ordinate + */ + getRegion: function (x, y) { + }, + + /** + * Highlight an item based on the moused-over x,y co-ordinate + */ + setRegionHighlight: function (el, x, y) { + var currentRegion = this.currentRegion, + highlightEnabled = !this.options.get('disableHighlight'), + newRegion; + if (x > this.canvasWidth || y > this.canvasHeight || x < 0 || y < 0) { + return null; + } + newRegion = this.getRegion(el, x, y); + if (currentRegion !== newRegion) { + if (currentRegion !== undefined && highlightEnabled) { + this.removeHighlight(); + } + this.currentRegion = newRegion; + if (newRegion !== undefined && highlightEnabled) { + this.renderHighlight(); + } + return true; + } + return false; + }, + + /** + * Reset any currently highlighted item + */ + clearRegionHighlight: function () { + if (this.currentRegion !== undefined) { + this.removeHighlight(); + this.currentRegion = undefined; + return true; + } + return false; + }, + + renderHighlight: function () { + this.changeHighlight(true); + }, + + removeHighlight: function () { + this.changeHighlight(false); + }, + + changeHighlight: function (highlight) {}, + + /** + * Fetch the HTML to display as a tooltip + */ + getCurrentRegionTooltip: function () { + var options = this.options, + header = '', + entries = [], + fields, formats, formatlen, fclass, text, i, + showFields, showFieldsKey, newFields, fv, + formatter, format, fieldlen, j; + if (this.currentRegion === undefined) { + return ''; + } + fields = this.getCurrentRegionFields(); + formatter = options.get('tooltipFormatter'); + if (formatter) { + return formatter(this, options, fields); + } + if (options.get('tooltipChartTitle')) { + header += '<div class="jqs jqstitle">' + options.get('tooltipChartTitle') + '</div>\n'; + } + formats = this.options.get('tooltipFormat'); + if (!formats) { + return ''; + } + if (!$.isArray(formats)) { + formats = [formats]; + } + if (!$.isArray(fields)) { + fields = [fields]; + } + showFields = this.options.get('tooltipFormatFieldlist'); + showFieldsKey = this.options.get('tooltipFormatFieldlistKey'); + if (showFields && showFieldsKey) { + // user-selected ordering of fields + newFields = []; + for (i = fields.length; i--;) { + fv = fields[i][showFieldsKey]; + if ((j = $.inArray(fv, showFields)) != -1) { + newFields[j] = fields[i]; + } + } + fields = newFields; + } + formatlen = formats.length; + fieldlen = fields.length; + for (i = 0; i < formatlen; i++) { + format = formats[i]; + if (typeof format === 'string') { + format = new SPFormat(format); + } + fclass = format.fclass || 'jqsfield'; + for (j = 0; j < fieldlen; j++) { + if (!fields[j].isNull || !options.get('tooltipSkipNull')) { + $.extend(fields[j], { + prefix: options.get('tooltipPrefix'), + suffix: options.get('tooltipSuffix') + }); + text = format.render(fields[j], options.get('tooltipValueLookups'), options); + entries.push('<div class="' + fclass + '">' + text + '</div>'); + } + } + } + if (entries.length) { + return header + entries.join('\n'); + } + return ''; + }, + + getCurrentRegionFields: function () {}, + + calcHighlightColor: function (color, options) { + var highlightColor = options.get('highlightColor'), + lighten = options.get('highlightLighten'), + parse, mult, rgbnew, i; + if (highlightColor) { + return highlightColor; + } + if (lighten) { + // extract RGB values + parse = /^#([0-9a-f])([0-9a-f])([0-9a-f])$/i.exec(color) || /^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(color); + if (parse) { + rgbnew = []; + mult = color.length === 4 ? 16 : 1; + for (i = 0; i < 3; i++) { + rgbnew[i] = clipval(Math.round(parseInt(parse[i + 1], 16) * mult * lighten), 0, 255); + } + return 'rgb(' + rgbnew.join(',') + ')'; + } + + } + return color; + } + + }); + + barHighlightMixin = { + changeHighlight: function (highlight) { + var currentRegion = this.currentRegion, + target = this.target, + shapeids = this.regionShapes[currentRegion], + newShapes; + // will be null if the region value was null + if (shapeids) { + newShapes = this.renderRegion(currentRegion, highlight); + if ($.isArray(newShapes) || $.isArray(shapeids)) { + target.replaceWithShapes(shapeids, newShapes); + this.regionShapes[currentRegion] = $.map(newShapes, function (newShape) { + return newShape.id; + }); + } else { + target.replaceWithShape(shapeids, newShapes); + this.regionShapes[currentRegion] = newShapes.id; + } + } + }, + + render: function () { + var values = this.values, + target = this.target, + regionShapes = this.regionShapes, + shapes, ids, i, j; + + if (!this.cls._super.render.call(this)) { + return; + } + for (i = values.length; i--;) { + shapes = this.renderRegion(i); + if (shapes) { + if ($.isArray(shapes)) { + ids = []; + for (j = shapes.length; j--;) { + shapes[j].append(); + ids.push(shapes[j].id); + } + regionShapes[i] = ids; + } else { + shapes.append(); + regionShapes[i] = shapes.id; // store just the shapeid + } + } else { + // null value + regionShapes[i] = null; + } + } + target.render(); + } + }; + + /** + * Line charts + */ + $.fn.sparkline.line = line = createClass($.fn.sparkline._base, { + type: 'line', + + init: function (el, values, options, width, height) { + line._super.init.call(this, el, values, options, width, height); + this.vertices = []; + this.regionMap = []; + this.xvalues = []; + this.yvalues = []; + this.yminmax = []; + this.hightlightSpotId = null; + this.lastShapeId = null; + this.initTarget(); + }, + + getRegion: function (el, x, y) { + var i, + regionMap = this.regionMap; // maps regions to value positions + for (i = regionMap.length; i--;) { + if (regionMap[i] !== null && x >= regionMap[i][0] && x <= regionMap[i][1]) { + return regionMap[i][2]; + } + } + return undefined; + }, + + getCurrentRegionFields: function () { + var currentRegion = this.currentRegion; + return { + isNull: this.yvalues[currentRegion] === null, + x: this.xvalues[currentRegion], + y: this.yvalues[currentRegion], + color: this.options.get('lineColor'), + fillColor: this.options.get('fillColor'), + offset: currentRegion + }; + }, + + renderHighlight: function () { + var currentRegion = this.currentRegion, + target = this.target, + vertex = this.vertices[currentRegion], + options = this.options, + spotRadius = options.get('spotRadius'), + highlightSpotColor = options.get('highlightSpotColor'), + highlightLineColor = options.get('highlightLineColor'), + highlightSpot, highlightLine; + + if (!vertex) { + return; + } + if (spotRadius && highlightSpotColor) { + highlightSpot = target.drawCircle(vertex[0], vertex[1], + spotRadius, undefined, highlightSpotColor); + this.highlightSpotId = highlightSpot.id; + target.insertAfterShape(this.lastShapeId, highlightSpot); + } + if (highlightLineColor) { + highlightLine = target.drawLine(vertex[0], this.canvasTop, vertex[0], + this.canvasTop + this.canvasHeight, highlightLineColor); + this.highlightLineId = highlightLine.id; + target.insertAfterShape(this.lastShapeId, highlightLine); + } + }, + + removeHighlight: function () { + var target = this.target; + if (this.highlightSpotId) { + target.removeShapeId(this.highlightSpotId); + this.highlightSpotId = null; + } + if (this.highlightLineId) { + target.removeShapeId(this.highlightLineId); + this.highlightLineId = null; + } + }, + + scanValues: function () { + var values = this.values, + valcount = values.length, + xvalues = this.xvalues, + yvalues = this.yvalues, + yminmax = this.yminmax, + i, val, isStr, isArray, sp; + for (i = 0; i < valcount; i++) { + val = values[i]; + isStr = typeof(values[i]) === 'string'; + isArray = typeof(values[i]) === 'object' && values[i] instanceof Array; + sp = isStr && values[i].split(':'); + if (isStr && sp.length === 2) { // x:y + xvalues.push(Number(sp[0])); + yvalues.push(Number(sp[1])); + yminmax.push(Number(sp[1])); + } else if (isArray) { + xvalues.push(val[0]); + yvalues.push(val[1]); + yminmax.push(val[1]); + } else { + xvalues.push(i); + if (values[i] === null || values[i] === 'null') { + yvalues.push(null); + } else { + yvalues.push(Number(val)); + yminmax.push(Number(val)); + } + } + } + if (this.options.get('xvalues')) { + xvalues = this.options.get('xvalues'); + } + + this.maxy = this.maxyorg = Math.max.apply(Math, yminmax); + this.miny = this.minyorg = Math.min.apply(Math, yminmax); + + this.maxx = Math.max.apply(Math, xvalues); + this.minx = Math.min.apply(Math, xvalues); + + this.xvalues = xvalues; + this.yvalues = yvalues; + this.yminmax = yminmax; + + }, + + processRangeOptions: function () { + var options = this.options, + normalRangeMin = options.get('normalRangeMin'), + normalRangeMax = options.get('normalRangeMax'); + + if (normalRangeMin !== undefined) { + if (normalRangeMin < this.miny) { + this.miny = normalRangeMin; + } + if (normalRangeMax > this.maxy) { + this.maxy = normalRangeMax; + } + } + if (options.get('chartRangeMin') !== undefined && (options.get('chartRangeClip') || options.get('chartRangeMin') < this.miny)) { + this.miny = options.get('chartRangeMin'); + } + if (options.get('chartRangeMax') !== undefined && (options.get('chartRangeClip') || options.get('chartRangeMax') > this.maxy)) { + this.maxy = options.get('chartRangeMax'); + } + if (options.get('chartRangeMinX') !== undefined && (options.get('chartRangeClipX') || options.get('chartRangeMinX') < this.minx)) { + this.minx = options.get('chartRangeMinX'); + } + if (options.get('chartRangeMaxX') !== undefined && (options.get('chartRangeClipX') || options.get('chartRangeMaxX') > this.maxx)) { + this.maxx = options.get('chartRangeMaxX'); + } + + }, + + drawNormalRange: function (canvasLeft, canvasTop, canvasHeight, canvasWidth, rangey) { + var normalRangeMin = this.options.get('normalRangeMin'), + normalRangeMax = this.options.get('normalRangeMax'), + ytop = canvasTop + Math.round(canvasHeight - (canvasHeight * ((normalRangeMax - this.miny) / rangey))), + height = Math.round((canvasHeight * (normalRangeMax - normalRangeMin)) / rangey); + this.target.drawRect(canvasLeft, ytop, canvasWidth, height, undefined, this.options.get('normalRangeColor')).append(); + }, + + render: function () { + var options = this.options, + target = this.target, + canvasWidth = this.canvasWidth, + canvasHeight = this.canvasHeight, + vertices = this.vertices, + spotRadius = options.get('spotRadius'), + regionMap = this.regionMap, + rangex, rangey, yvallast, + canvasTop, canvasLeft, + vertex, path, paths, x, y, xnext, xpos, xposnext, + last, next, yvalcount, lineShapes, fillShapes, plen, + valueSpots, hlSpotsEnabled, color, xvalues, yvalues, i; + + if (!line._super.render.call(this)) { + return; + } + + this.scanValues(); + this.processRangeOptions(); + + xvalues = this.xvalues; + yvalues = this.yvalues; + + if (!this.yminmax.length || this.yvalues.length < 2) { + // empty or all null valuess + return; + } + + canvasTop = canvasLeft = 0; + + rangex = this.maxx - this.minx === 0 ? 1 : this.maxx - this.minx; + rangey = this.maxy - this.miny === 0 ? 1 : this.maxy - this.miny; + yvallast = this.yvalues.length - 1; + + if (spotRadius && (canvasWidth < (spotRadius * 4) || canvasHeight < (spotRadius * 4))) { + spotRadius = 0; + } + if (spotRadius) { + // adjust the canvas size as required so that spots will fit + hlSpotsEnabled = options.get('highlightSpotColor') && !options.get('disableInteraction'); + if (hlSpotsEnabled || options.get('minSpotColor') || (options.get('spotColor') && yvalues[yvallast] === this.miny)) { + canvasHeight -= Math.ceil(spotRadius); + } + if (hlSpotsEnabled || options.get('maxSpotColor') || (options.get('spotColor') && yvalues[yvallast] === this.maxy)) { + canvasHeight -= Math.ceil(spotRadius); + canvasTop += Math.ceil(spotRadius); + } + if (hlSpotsEnabled || + ((options.get('minSpotColor') || options.get('maxSpotColor')) && (yvalues[0] === this.miny || yvalues[0] === this.maxy))) { + canvasLeft += Math.ceil(spotRadius); + canvasWidth -= Math.ceil(spotRadius); + } + if (hlSpotsEnabled || options.get('spotColor') || + (options.get('minSpotColor') || options.get('maxSpotColor') && + (yvalues[yvallast] === this.miny || yvalues[yvallast] === this.maxy))) { + canvasWidth -= Math.ceil(spotRadius); + } + } + + + canvasHeight--; + + if (options.get('normalRangeMin') !== undefined && !options.get('drawNormalOnTop')) { + this.drawNormalRange(canvasLeft, canvasTop, canvasHeight, canvasWidth, rangey); + } + + path = []; + paths = [path]; + last = next = null; + yvalcount = yvalues.length; + for (i = 0; i < yvalcount; i++) { + x = xvalues[i]; + xnext = xvalues[i + 1]; + y = yvalues[i]; + xpos = canvasLeft + Math.round((x - this.minx) * (canvasWidth / rangex)); + xposnext = i < yvalcount - 1 ? canvasLeft + Math.round((xnext - this.minx) * (canvasWidth / rangex)) : canvasWidth; + next = xpos + ((xposnext - xpos) / 2); + regionMap[i] = [last || 0, next, i]; + last = next; + if (y === null) { + if (i) { + if (yvalues[i - 1] !== null) { + path = []; + paths.push(path); + } + vertices.push(null); + } + } else { + if (y < this.miny) { + y = this.miny; + } + if (y > this.maxy) { + y = this.maxy; + } + if (!path.length) { + // previous value was null + path.push([xpos, canvasTop + canvasHeight]); + } + vertex = [xpos, canvasTop + Math.round(canvasHeight - (canvasHeight * ((y - this.miny) / rangey)))]; + path.push(vertex); + vertices.push(vertex); + } + } + + lineShapes = []; + fillShapes = []; + plen = paths.length; + for (i = 0; i < plen; i++) { + path = paths[i]; + if (path.length) { + if (options.get('fillColor')) { + path.push([path[path.length - 1][0], (canvasTop + canvasHeight)]); + fillShapes.push(path.slice(0)); + path.pop(); + } + // if there's only a single point in this path, then we want to display it + // as a vertical line which means we keep path[0] as is + if (path.length > 2) { + // else we want the first value + path[0] = [path[0][0], path[1][1]]; + } + lineShapes.push(path); + } + } + + // draw the fill first, then optionally the normal range, then the line on top of that + plen = fillShapes.length; + for (i = 0; i < plen; i++) { + target.drawShape(fillShapes[i], + options.get('fillColor'), options.get('fillColor')).append(); + } + + if (options.get('normalRangeMin') !== undefined && options.get('drawNormalOnTop')) { + this.drawNormalRange(canvasLeft, canvasTop, canvasHeight, canvasWidth, rangey); + } + + plen = lineShapes.length; + for (i = 0; i < plen; i++) { + target.drawShape(lineShapes[i], options.get('lineColor'), undefined, + options.get('lineWidth')).append(); + } + + if (spotRadius && options.get('valueSpots')) { + valueSpots = options.get('valueSpots'); + if (valueSpots.get === undefined) { + valueSpots = new RangeMap(valueSpots); + } + for (i = 0; i < yvalcount; i++) { + color = valueSpots.get(yvalues[i]); + if (color) { + target.drawCircle(canvasLeft + Math.round((xvalues[i] - this.minx) * (canvasWidth / rangex)), + canvasTop + Math.round(canvasHeight - (canvasHeight * ((yvalues[i] - this.miny) / rangey))), + spotRadius, undefined, + color).append(); + } + } + + } + if (spotRadius && options.get('spotColor') && yvalues[yvallast] !== null) { + target.drawCircle(canvasLeft + Math.round((xvalues[xvalues.length - 1] - this.minx) * (canvasWidth / rangex)), + canvasTop + Math.round(canvasHeight - (canvasHeight * ((yvalues[yvallast] - this.miny) / rangey))), + spotRadius, undefined, + options.get('spotColor')).append(); + } + if (this.maxy !== this.minyorg) { + if (spotRadius && options.get('minSpotColor')) { + x = xvalues[$.inArray(this.minyorg, yvalues)]; + target.drawCircle(canvasLeft + Math.round((x - this.minx) * (canvasWidth / rangex)), + canvasTop + Math.round(canvasHeight - (canvasHeight * ((this.minyorg - this.miny) / rangey))), + spotRadius, undefined, + options.get('minSpotColor')).append(); + } + if (spotRadius && options.get('maxSpotColor')) { + x = xvalues[$.inArray(this.maxyorg, yvalues)]; + target.drawCircle(canvasLeft + Math.round((x - this.minx) * (canvasWidth / rangex)), + canvasTop + Math.round(canvasHeight - (canvasHeight * ((this.maxyorg - this.miny) / rangey))), + spotRadius, undefined, + options.get('maxSpotColor')).append(); + } + } + + this.lastShapeId = target.getLastShapeId(); + this.canvasTop = canvasTop; + target.render(); + } + }); + + /** + * Bar charts + */ + $.fn.sparkline.bar = bar = createClass($.fn.sparkline._base, barHighlightMixin, { + type: 'bar', + + init: function (el, values, options, width, height) { + var barWidth = parseInt(options.get('barWidth'), 10), + barSpacing = parseInt(options.get('barSpacing'), 10), + chartRangeMin = options.get('chartRangeMin'), + chartRangeMax = options.get('chartRangeMax'), + chartRangeClip = options.get('chartRangeClip'), + stackMin = Infinity, + stackMax = -Infinity, + isStackString, groupMin, groupMax, stackRanges, + numValues, i, vlen, range, zeroAxis, xaxisOffset, min, max, clipMin, clipMax, + stacked, vlist, j, slen, svals, val, yoffset, yMaxCalc, canvasHeightEf; + bar._super.init.call(this, el, values, options, width, height); + + // scan values to determine whether to stack bars + for (i = 0, vlen = values.length; i < vlen; i++) { + val = values[i]; + isStackString = typeof(val) === 'string' && val.indexOf(':') > -1; + if (isStackString || $.isArray(val)) { + stacked = true; + if (isStackString) { + val = values[i] = normalizeValues(val.split(':')); + } + val = remove(val, null); // min/max will treat null as zero + groupMin = Math.min.apply(Math, val); + groupMax = Math.max.apply(Math, val); + if (groupMin < stackMin) { + stackMin = groupMin; + } + if (groupMax > stackMax) { + stackMax = groupMax; + } + } + } + + this.stacked = stacked; + this.regionShapes = {}; + this.barWidth = barWidth; + this.barSpacing = barSpacing; + this.totalBarWidth = barWidth + barSpacing; + this.width = width = (values.length * barWidth) + ((values.length - 1) * barSpacing); + + this.initTarget(); + + if (chartRangeClip) { + clipMin = chartRangeMin === undefined ? -Infinity : chartRangeMin; + clipMax = chartRangeMax === undefined ? Infinity : chartRangeMax; + } + + numValues = []; + stackRanges = stacked ? [] : numValues; + var stackTotals = []; + var stackRangesNeg = []; + for (i = 0, vlen = values.length; i < vlen; i++) { + if (stacked) { + vlist = values[i]; + values[i] = svals = []; + stackTotals[i] = 0; + stackRanges[i] = stackRangesNeg[i] = 0; + for (j = 0, slen = vlist.length; j < slen; j++) { + val = svals[j] = chartRangeClip ? clipval(vlist[j], clipMin, clipMax) : vlist[j]; + if (val !== null) { + if (val > 0) { + stackTotals[i] += val; + } + if (stackMin < 0 && stackMax > 0) { + if (val < 0) { + stackRangesNeg[i] += Math.abs(val); + } else { + stackRanges[i] += val; + } + } else { + stackRanges[i] += Math.abs(val - (val < 0 ? stackMax : stackMin)); + } + numValues.push(val); + } + } + } else { + val = chartRangeClip ? clipval(values[i], clipMin, clipMax) : values[i]; + val = values[i] = normalizeValue(val); + if (val !== null) { + numValues.push(val); + } + } + } + this.max = max = Math.max.apply(Math, numValues); + this.min = min = Math.min.apply(Math, numValues); + this.stackMax = stackMax = stacked ? Math.max.apply(Math, stackTotals) : max; + this.stackMin = stackMin = stacked ? Math.min.apply(Math, numValues) : min; + + if (options.get('chartRangeMin') !== undefined && (options.get('chartRangeClip') || options.get('chartRangeMin') < min)) { + min = options.get('chartRangeMin'); + } + if (options.get('chartRangeMax') !== undefined && (options.get('chartRangeClip') || options.get('chartRangeMax') > max)) { + max = options.get('chartRangeMax'); + } + + this.zeroAxis = zeroAxis = options.get('zeroAxis', true); + if (min <= 0 && max >= 0 && zeroAxis) { + xaxisOffset = 0; + } else if (zeroAxis == false) { + xaxisOffset = min; + } else if (min > 0) { + xaxisOffset = min; + } else { + xaxisOffset = max; + } + this.xaxisOffset = xaxisOffset; + + range = stacked ? (Math.max.apply(Math, stackRanges) + Math.max.apply(Math, stackRangesNeg)) : max - min; + + // as we plot zero/min values a single pixel line, we add a pixel to all other + // values - Reduce the effective canvas size to suit + this.canvasHeightEf = (zeroAxis && min < 0) ? this.canvasHeight - 2 : this.canvasHeight - 1; + + if (min < xaxisOffset) { + yMaxCalc = (stacked && max >= 0) ? stackMax : max; + yoffset = (yMaxCalc - xaxisOffset) / range * this.canvasHeight; + if (yoffset !== Math.ceil(yoffset)) { + this.canvasHeightEf -= 2; + yoffset = Math.ceil(yoffset); + } + } else { + yoffset = this.canvasHeight; + } + this.yoffset = yoffset; + + if ($.isArray(options.get('colorMap'))) { + this.colorMapByIndex = options.get('colorMap'); + this.colorMapByValue = null; + } else { + this.colorMapByIndex = null; + this.colorMapByValue = options.get('colorMap'); + if (this.colorMapByValue && this.colorMapByValue.get === undefined) { + this.colorMapByValue = new RangeMap(this.colorMapByValue); + } + } + + this.range = range; + }, + + getRegion: function (el, x, y) { + var result = Math.floor(x / this.totalBarWidth); + return (result < 0 || result >= this.values.length) ? undefined : result; + }, + + getCurrentRegionFields: function () { + var currentRegion = this.currentRegion, + values = ensureArray(this.values[currentRegion]), + result = [], + value, i; + for (i = values.length; i--;) { + value = values[i]; + result.push({ + isNull: value === null, + value: value, + color: this.calcColor(i, value, currentRegion), + offset: currentRegion + }); + } + return result; + }, + + calcColor: function (stacknum, value, valuenum) { + var colorMapByIndex = this.colorMapByIndex, + colorMapByValue = this.colorMapByValue, + options = this.options, + color, newColor; + if (this.stacked) { + color = options.get('stackedBarColor'); + } else { + color = (value < 0) ? options.get('negBarColor') : options.get('barColor'); + } + if (value === 0 && options.get('zeroColor') !== undefined) { + color = options.get('zeroColor'); + } + if (colorMapByValue && (newColor = colorMapByValue.get(value))) { + color = newColor; + } else if (colorMapByIndex && colorMapByIndex.length > valuenum) { + color = colorMapByIndex[valuenum]; + } + return $.isArray(color) ? color[stacknum % color.length] : color; + }, + + /** + * Render bar(s) for a region + */ + renderRegion: function (valuenum, highlight) { + var vals = this.values[valuenum], + options = this.options, + xaxisOffset = this.xaxisOffset, + result = [], + range = this.range, + stacked = this.stacked, + target = this.target, + x = valuenum * this.totalBarWidth, + canvasHeightEf = this.canvasHeightEf, + yoffset = this.yoffset, + y, height, color, isNull, yoffsetNeg, i, valcount, val, minPlotted, allMin; + + vals = $.isArray(vals) ? vals : [vals]; + valcount = vals.length; + val = vals[0]; + isNull = all(null, vals); + allMin = all(xaxisOffset, vals, true); + + if (isNull) { + if (options.get('nullColor')) { + color = highlight ? options.get('nullColor') : this.calcHighlightColor(options.get('nullColor'), options); + y = (yoffset > 0) ? yoffset - 1 : yoffset; + return target.drawRect(x, y, this.barWidth - 1, 0, color, color); + } else { + return undefined; + } + } + yoffsetNeg = yoffset; + for (i = 0; i < valcount; i++) { + val = vals[i]; + + if (stacked && val === xaxisOffset) { + if (!allMin || minPlotted) { + continue; + } + minPlotted = true; + } + + if (range > 0) { + height = Math.floor(canvasHeightEf * ((Math.abs(val - xaxisOffset) / range))) + 1; + } else { + height = 1; + } + if (val < xaxisOffset || (val === xaxisOffset && yoffset === 0)) { + y = yoffsetNeg; + yoffsetNeg += height; + } else { + y = yoffset - height; + yoffset -= height; + } + color = this.calcColor(i, val, valuenum); + if (highlight) { + color = this.calcHighlightColor(color, options); + } + result.push(target.drawRect(x, y, this.barWidth - 1, height - 1, color, color)); + } + if (result.length === 1) { + return result[0]; + } + return result; + } + }); + + /** + * Tristate charts + */ + $.fn.sparkline.tristate = tristate = createClass($.fn.sparkline._base, barHighlightMixin, { + type: 'tristate', + + init: function (el, values, options, width, height) { + var barWidth = parseInt(options.get('barWidth'), 10), + barSpacing = parseInt(options.get('barSpacing'), 10); + tristate._super.init.call(this, el, values, options, width, height); + + this.regionShapes = {}; + this.barWidth = barWidth; + this.barSpacing = barSpacing; + this.totalBarWidth = barWidth + barSpacing; + this.values = $.map(values, Number); + this.width = width = (values.length * barWidth) + ((values.length - 1) * barSpacing); + + if ($.isArray(options.get('colorMap'))) { + this.colorMapByIndex = options.get('colorMap'); + this.colorMapByValue = null; + } else { + this.colorMapByIndex = null; + this.colorMapByValue = options.get('colorMap'); + if (this.colorMapByValue && this.colorMapByValue.get === undefined) { + this.colorMapByValue = new RangeMap(this.colorMapByValue); + } + } + this.initTarget(); + }, + + getRegion: function (el, x, y) { + return Math.floor(x / this.totalBarWidth); + }, + + getCurrentRegionFields: function () { + var currentRegion = this.currentRegion; + return { + isNull: this.values[currentRegion] === undefined, + value: this.values[currentRegion], + color: this.calcColor(this.values[currentRegion], currentRegion), + offset: currentRegion + }; + }, + + calcColor: function (value, valuenum) { + var values = this.values, + options = this.options, + colorMapByIndex = this.colorMapByIndex, + colorMapByValue = this.colorMapByValue, + color, newColor; + + if (colorMapByValue && (newColor = colorMapByValue.get(value))) { + color = newColor; + } else if (colorMapByIndex && colorMapByIndex.length > valuenum) { + color = colorMapByIndex[valuenum]; + } else if (values[valuenum] < 0) { + color = options.get('negBarColor'); + } else if (values[valuenum] > 0) { + color = options.get('posBarColor'); + } else { + color = options.get('zeroBarColor'); + } + return color; + }, + + renderRegion: function (valuenum, highlight) { + var values = this.values, + options = this.options, + target = this.target, + canvasHeight, height, halfHeight, + x, y, color; + + canvasHeight = target.pixelHeight; + halfHeight = Math.round(canvasHeight / 2); + + x = valuenum * this.totalBarWidth; + if (values[valuenum] < 0) { + y = halfHeight; + height = halfHeight - 1; + } else if (values[valuenum] > 0) { + y = 0; + height = halfHeight - 1; + } else { + y = halfHeight - 1; + height = 2; + } + color = this.calcColor(values[valuenum], valuenum); + if (color === null) { + return; + } + if (highlight) { + color = this.calcHighlightColor(color, options); + } + return target.drawRect(x, y, this.barWidth - 1, height - 1, color, color); + } + }); + + /** + * Discrete charts + */ + $.fn.sparkline.discrete = discrete = createClass($.fn.sparkline._base, barHighlightMixin, { + type: 'discrete', + + init: function (el, values, options, width, height) { + discrete._super.init.call(this, el, values, options, width, height); + + this.regionShapes = {}; + this.values = values = $.map(values, Number); + this.min = Math.min.apply(Math, values); + this.max = Math.max.apply(Math, values); + this.range = this.max - this.min; + this.width = width = options.get('width') === 'auto' ? values.length * 2 : this.width; + this.interval = Math.floor(width / values.length); + this.itemWidth = width / values.length; + if (options.get('chartRangeMin') !== undefined && (options.get('chartRangeClip') || options.get('chartRangeMin') < this.min)) { + this.min = options.get('chartRangeMin'); + } + if (options.get('chartRangeMax') !== undefined && (options.get('chartRangeClip') || options.get('chartRangeMax') > this.max)) { + this.max = options.get('chartRangeMax'); + } + this.initTarget(); + if (this.target) { + this.lineHeight = options.get('lineHeight') === 'auto' ? Math.round(this.canvasHeight * 0.3) : options.get('lineHeight'); + } + }, + + getRegion: function (el, x, y) { + return Math.floor(x / this.itemWidth); + }, + + getCurrentRegionFields: function () { + var currentRegion = this.currentRegion; + return { + isNull: this.values[currentRegion] === undefined, + value: this.values[currentRegion], + offset: currentRegion + }; + }, + + renderRegion: function (valuenum, highlight) { + var values = this.values, + options = this.options, + min = this.min, + max = this.max, + range = this.range, + interval = this.interval, + target = this.target, + canvasHeight = this.canvasHeight, + lineHeight = this.lineHeight, + pheight = canvasHeight - lineHeight, + ytop, val, color, x; + + val = clipval(values[valuenum], min, max); + x = valuenum * interval; + ytop = Math.round(pheight - pheight * ((val - min) / range)); + color = (options.get('thresholdColor') && val < options.get('thresholdValue')) ? options.get('thresholdColor') : options.get('lineColor'); + if (highlight) { + color = this.calcHighlightColor(color, options); + } + return target.drawLine(x, ytop, x, ytop + lineHeight, color); + } + }); + + /** + * Bullet charts + */ + $.fn.sparkline.bullet = bullet = createClass($.fn.sparkline._base, { + type: 'bullet', + + init: function (el, values, options, width, height) { + var min, max, vals; + bullet._super.init.call(this, el, values, options, width, height); + + // values: target, performance, range1, range2, range3 + this.values = values = normalizeValues(values); + // target or performance could be null + vals = values.slice(); + vals[0] = vals[0] === null ? vals[2] : vals[0]; + vals[1] = values[1] === null ? vals[2] : vals[1]; + min = Math.min.apply(Math, values); + max = Math.max.apply(Math, values); + if (options.get('base') === undefined) { + min = min < 0 ? min : 0; + } else { + min = options.get('base'); + } + this.min = min; + this.max = max; + this.range = max - min; + this.shapes = {}; + this.valueShapes = {}; + this.regiondata = {}; + this.width = width = options.get('width') === 'auto' ? '4.0em' : width; + this.target = this.$el.simpledraw(width, height, options.get('composite')); + if (!values.length) { + this.disabled = true; + } + this.initTarget(); + }, + + getRegion: function (el, x, y) { + var shapeid = this.target.getShapeAt(el, x, y); + return (shapeid !== undefined && this.shapes[shapeid] !== undefined) ? this.shapes[shapeid] : undefined; + }, + + getCurrentRegionFields: function () { + var currentRegion = this.currentRegion; + return { + fieldkey: currentRegion.substr(0, 1), + value: this.values[currentRegion.substr(1)], + region: currentRegion + }; + }, + + changeHighlight: function (highlight) { + var currentRegion = this.currentRegion, + shapeid = this.valueShapes[currentRegion], + shape; + delete this.shapes[shapeid]; + switch (currentRegion.substr(0, 1)) { + case 'r': + shape = this.renderRange(currentRegion.substr(1), highlight); + break; + case 'p': + shape = this.renderPerformance(highlight); + break; + case 't': + shape = this.renderTarget(highlight); + break; + } + this.valueShapes[currentRegion] = shape.id; + this.shapes[shape.id] = currentRegion; + this.target.replaceWithShape(shapeid, shape); + }, + + renderRange: function (rn, highlight) { + var rangeval = this.values[rn], + rangewidth = Math.round(this.canvasWidth * ((rangeval - this.min) / this.range)), + color = this.options.get('rangeColors')[rn - 2]; + if (highlight) { + color = this.calcHighlightColor(color, this.options); + } + return this.target.drawRect(0, 0, rangewidth - 1, this.canvasHeight - 1, color, color); + }, + + renderPerformance: function (highlight) { + var perfval = this.values[1], + perfwidth = Math.round(this.canvasWidth * ((perfval - this.min) / this.range)), + color = this.options.get('performanceColor'); + if (highlight) { + color = this.calcHighlightColor(color, this.options); + } + return this.target.drawRect(0, Math.round(this.canvasHeight * 0.3), perfwidth - 1, + Math.round(this.canvasHeight * 0.4) - 1, color, color); + }, + + renderTarget: function (highlight) { + var targetval = this.values[0], + x = Math.round(this.canvasWidth * ((targetval - this.min) / this.range) - (this.options.get('targetWidth') / 2)), + targettop = Math.round(this.canvasHeight * 0.10), + targetheight = this.canvasHeight - (targettop * 2), + color = this.options.get('targetColor'); + if (highlight) { + color = this.calcHighlightColor(color, this.options); + } + return this.target.drawRect(x, targettop, this.options.get('targetWidth') - 1, targetheight - 1, color, color); + }, + + render: function () { + var vlen = this.values.length, + target = this.target, + i, shape; + if (!bullet._super.render.call(this)) { + return; + } + for (i = 2; i < vlen; i++) { + shape = this.renderRange(i).append(); + this.shapes[shape.id] = 'r' + i; + this.valueShapes['r' + i] = shape.id; + } + if (this.values[1] !== null) { + shape = this.renderPerformance().append(); + this.shapes[shape.id] = 'p1'; + this.valueShapes.p1 = shape.id; + } + if (this.values[0] !== null) { + shape = this.renderTarget().append(); + this.shapes[shape.id] = 't0'; + this.valueShapes.t0 = shape.id; + } + target.render(); + } + }); + + /** + * Pie charts + */ + $.fn.sparkline.pie = pie = createClass($.fn.sparkline._base, { + type: 'pie', + + init: function (el, values, options, width, height) { + var total = 0, i; + + pie._super.init.call(this, el, values, options, width, height); + + this.shapes = {}; // map shape ids to value offsets + this.valueShapes = {}; // maps value offsets to shape ids + this.values = values = $.map(values, Number); + + if (options.get('width') === 'auto') { + this.width = this.height; + } + + if (values.length > 0) { + for (i = values.length; i--;) { + total += values[i]; + } + } + this.total = total; + this.initTarget(); + this.radius = Math.floor(Math.min(this.canvasWidth, this.canvasHeight) / 2); + }, + + getRegion: function (el, x, y) { + var shapeid = this.target.getShapeAt(el, x, y); + return (shapeid !== undefined && this.shapes[shapeid] !== undefined) ? this.shapes[shapeid] : undefined; + }, + + getCurrentRegionFields: function () { + var currentRegion = this.currentRegion; + return { + isNull: this.values[currentRegion] === undefined, + value: this.values[currentRegion], + percent: this.values[currentRegion] / this.total * 100, + color: this.options.get('sliceColors')[currentRegion % this.options.get('sliceColors').length], + offset: currentRegion + }; + }, + + changeHighlight: function (highlight) { + var currentRegion = this.currentRegion, + newslice = this.renderSlice(currentRegion, highlight), + shapeid = this.valueShapes[currentRegion]; + delete this.shapes[shapeid]; + this.target.replaceWithShape(shapeid, newslice); + this.valueShapes[currentRegion] = newslice.id; + this.shapes[newslice.id] = currentRegion; + }, + + renderSlice: function (valuenum, highlight) { + var target = this.target, + options = this.options, + radius = this.radius, + borderWidth = options.get('borderWidth'), + offset = options.get('offset'), + circle = 2 * Math.PI, + values = this.values, + total = this.total, + next = offset ? (2*Math.PI)*(offset/360) : 0, + start, end, i, vlen, color; + + vlen = values.length; + for (i = 0; i < vlen; i++) { + start = next; + end = next; + if (total > 0) { // avoid divide by zero + end = next + (circle * (values[i] / total)); + } + if (valuenum === i) { + color = options.get('sliceColors')[i % options.get('sliceColors').length]; + if (highlight) { + color = this.calcHighlightColor(color, options); + } + + return target.drawPieSlice(radius, radius, radius - borderWidth, start, end, undefined, color); + } + next = end; + } + }, + + render: function () { + var target = this.target, + values = this.values, + options = this.options, + radius = this.radius, + borderWidth = options.get('borderWidth'), + shape, i; + + if (!pie._super.render.call(this)) { + return; + } + if (borderWidth) { + target.drawCircle(radius, radius, Math.floor(radius - (borderWidth / 2)), + options.get('borderColor'), undefined, borderWidth).append(); + } + for (i = values.length; i--;) { + if (values[i]) { // don't render zero values + shape = this.renderSlice(i).append(); + this.valueShapes[i] = shape.id; // store just the shapeid + this.shapes[shape.id] = i; + } + } + target.render(); + } + }); + + /** + * Box plots + */ + $.fn.sparkline.box = box = createClass($.fn.sparkline._base, { + type: 'box', + + init: function (el, values, options, width, height) { + box._super.init.call(this, el, values, options, width, height); + this.values = $.map(values, Number); + this.width = options.get('width') === 'auto' ? '4.0em' : width; + this.initTarget(); + if (!this.values.length) { + this.disabled = 1; + } + }, + + /** + * Simulate a single region + */ + getRegion: function () { + return 1; + }, + + getCurrentRegionFields: function () { + var result = [ + { field: 'lq', value: this.quartiles[0] }, + { field: 'med', value: this.quartiles[1] }, + { field: 'uq', value: this.quartiles[2] } + ]; + if (this.loutlier !== undefined) { + result.push({ field: 'lo', value: this.loutlier}); + } + if (this.routlier !== undefined) { + result.push({ field: 'ro', value: this.routlier}); + } + if (this.lwhisker !== undefined) { + result.push({ field: 'lw', value: this.lwhisker}); + } + if (this.rwhisker !== undefined) { + result.push({ field: 'rw', value: this.rwhisker}); + } + return result; + }, + + render: function () { + var target = this.target, + values = this.values, + vlen = values.length, + options = this.options, + canvasWidth = this.canvasWidth, + canvasHeight = this.canvasHeight, + minValue = options.get('chartRangeMin') === undefined ? Math.min.apply(Math, values) : options.get('chartRangeMin'), + maxValue = options.get('chartRangeMax') === undefined ? Math.max.apply(Math, values) : options.get('chartRangeMax'), + canvasLeft = 0, + lwhisker, loutlier, iqr, q1, q2, q3, rwhisker, routlier, i, + size, unitSize; + + if (!box._super.render.call(this)) { + return; + } + + if (options.get('raw')) { + if (options.get('showOutliers') && values.length > 5) { + loutlier = values[0]; + lwhisker = values[1]; + q1 = values[2]; + q2 = values[3]; + q3 = values[4]; + rwhisker = values[5]; + routlier = values[6]; + } else { + lwhisker = values[0]; + q1 = values[1]; + q2 = values[2]; + q3 = values[3]; + rwhisker = values[4]; + } + } else { + values.sort(function (a, b) { return a - b; }); + q1 = quartile(values, 1); + q2 = quartile(values, 2); + q3 = quartile(values, 3); + iqr = q3 - q1; + if (options.get('showOutliers')) { + lwhisker = rwhisker = undefined; + for (i = 0; i < vlen; i++) { + if (lwhisker === undefined && values[i] > q1 - (iqr * options.get('outlierIQR'))) { + lwhisker = values[i]; + } + if (values[i] < q3 + (iqr * options.get('outlierIQR'))) { + rwhisker = values[i]; + } + } + loutlier = values[0]; + routlier = values[vlen - 1]; + } else { + lwhisker = values[0]; + rwhisker = values[vlen - 1]; + } + } + this.quartiles = [q1, q2, q3]; + this.lwhisker = lwhisker; + this.rwhisker = rwhisker; + this.loutlier = loutlier; + this.routlier = routlier; + + unitSize = canvasWidth / (maxValue - minValue + 1); + if (options.get('showOutliers')) { + canvasLeft = Math.ceil(options.get('spotRadius')); + canvasWidth -= 2 * Math.ceil(options.get('spotRadius')); + unitSize = canvasWidth / (maxValue - minValue + 1); + if (loutlier < lwhisker) { + target.drawCircle((loutlier - minValue) * unitSize + canvasLeft, + canvasHeight / 2, + options.get('spotRadius'), + options.get('outlierLineColor'), + options.get('outlierFillColor')).append(); + } + if (routlier > rwhisker) { + target.drawCircle((routlier - minValue) * unitSize + canvasLeft, + canvasHeight / 2, + options.get('spotRadius'), + options.get('outlierLineColor'), + options.get('outlierFillColor')).append(); + } + } + + // box + target.drawRect( + Math.round((q1 - minValue) * unitSize + canvasLeft), + Math.round(canvasHeight * 0.1), + Math.round((q3 - q1) * unitSize), + Math.round(canvasHeight * 0.8), + options.get('boxLineColor'), + options.get('boxFillColor')).append(); + // left whisker + target.drawLine( + Math.round((lwhisker - minValue) * unitSize + canvasLeft), + Math.round(canvasHeight / 2), + Math.round((q1 - minValue) * unitSize + canvasLeft), + Math.round(canvasHeight / 2), + options.get('lineColor')).append(); + target.drawLine( + Math.round((lwhisker - minValue) * unitSize + canvasLeft), + Math.round(canvasHeight / 4), + Math.round((lwhisker - minValue) * unitSize + canvasLeft), + Math.round(canvasHeight - canvasHeight / 4), + options.get('whiskerColor')).append(); + // right whisker + target.drawLine(Math.round((rwhisker - minValue) * unitSize + canvasLeft), + Math.round(canvasHeight / 2), + Math.round((q3 - minValue) * unitSize + canvasLeft), + Math.round(canvasHeight / 2), + options.get('lineColor')).append(); + target.drawLine( + Math.round((rwhisker - minValue) * unitSize + canvasLeft), + Math.round(canvasHeight / 4), + Math.round((rwhisker - minValue) * unitSize + canvasLeft), + Math.round(canvasHeight - canvasHeight / 4), + options.get('whiskerColor')).append(); + // median line + target.drawLine( + Math.round((q2 - minValue) * unitSize + canvasLeft), + Math.round(canvasHeight * 0.1), + Math.round((q2 - minValue) * unitSize + canvasLeft), + Math.round(canvasHeight * 0.9), + options.get('medianColor')).append(); + if (options.get('target')) { + size = Math.ceil(options.get('spotRadius')); + target.drawLine( + Math.round((options.get('target') - minValue) * unitSize + canvasLeft), + Math.round((canvasHeight / 2) - size), + Math.round((options.get('target') - minValue) * unitSize + canvasLeft), + Math.round((canvasHeight / 2) + size), + options.get('targetColor')).append(); + target.drawLine( + Math.round((options.get('target') - minValue) * unitSize + canvasLeft - size), + Math.round(canvasHeight / 2), + Math.round((options.get('target') - minValue) * unitSize + canvasLeft + size), + Math.round(canvasHeight / 2), + options.get('targetColor')).append(); + } + target.render(); + } + }); + + // Setup a very simple "virtual canvas" to make drawing the few shapes we need easier + // This is accessible as $(foo).simpledraw() + + // Detect browser renderer support + (function() { + if (document.namespaces && !document.namespaces.v) { + $.fn.sparkline.hasVML = true; + document.namespaces.add('v', 'urn:schemas-microsoft-com:vml', '#default#VML'); + } else { + $.fn.sparkline.hasVML = false; + } + + var el = document.createElement('canvas'); + $.fn.sparkline.hasCanvas = !!(el.getContext && el.getContext('2d')); + + })() + + VShape = createClass({ + init: function (target, id, type, args) { + this.target = target; + this.id = id; + this.type = type; + this.args = args; + }, + append: function () { + this.target.appendShape(this); + return this; + } + }); + + VCanvas_base = createClass({ + _pxregex: /(\d+)(px)?\s*$/i, + + init: function (width, height, target) { + if (!width) { + return; + } + this.width = width; + this.height = height; + this.target = target; + this.lastShapeId = null; + if (target[0]) { + target = target[0]; + } + $.data(target, '_jqs_vcanvas', this); + }, + + drawLine: function (x1, y1, x2, y2, lineColor, lineWidth) { + return this.drawShape([[x1, y1], [x2, y2]], lineColor, lineWidth); + }, + + drawShape: function (path, lineColor, fillColor, lineWidth) { + return this._genShape('Shape', [path, lineColor, fillColor, lineWidth]); + }, + + drawCircle: function (x, y, radius, lineColor, fillColor, lineWidth) { + return this._genShape('Circle', [x, y, radius, lineColor, fillColor, lineWidth]); + }, + + drawPieSlice: function (x, y, radius, startAngle, endAngle, lineColor, fillColor) { + return this._genShape('PieSlice', [x, y, radius, startAngle, endAngle, lineColor, fillColor]); + }, + + drawRect: function (x, y, width, height, lineColor, fillColor) { + return this._genShape('Rect', [x, y, width, height, lineColor, fillColor]); + }, + + getElement: function () { + return this.canvas; + }, + + /** + * Return the most recently inserted shape id + */ + getLastShapeId: function () { + return this.lastShapeId; + }, + + /** + * Clear and reset the canvas + */ + reset: function () { + alert('reset not implemented'); + }, + + _insert: function (el, target) { + $(target).html(el); + }, + + /** + * Calculate the pixel dimensions of the canvas + */ + _calculatePixelDims: function (width, height, canvas) { + // XXX This should probably be a configurable option + var match; + match = this._pxregex.exec(height); + if (match) { + this.pixelHeight = match[1]; + } else { + this.pixelHeight = $(canvas).height(); + } + match = this._pxregex.exec(width); + if (match) { + this.pixelWidth = match[1]; + } else { + this.pixelWidth = $(canvas).width(); + } + }, + + /** + * Generate a shape object and id for later rendering + */ + _genShape: function (shapetype, shapeargs) { + var id = shapeCount++; + shapeargs.unshift(id); + return new VShape(this, id, shapetype, shapeargs); + }, + + /** + * Add a shape to the end of the render queue + */ + appendShape: function (shape) { + alert('appendShape not implemented'); + }, + + /** + * Replace one shape with another + */ + replaceWithShape: function (shapeid, shape) { + alert('replaceWithShape not implemented'); + }, + + /** + * Insert one shape after another in the render queue + */ + insertAfterShape: function (shapeid, shape) { + alert('insertAfterShape not implemented'); + }, + + /** + * Remove a shape from the queue + */ + removeShapeId: function (shapeid) { + alert('removeShapeId not implemented'); + }, + + /** + * Find a shape at the specified x/y co-ordinates + */ + getShapeAt: function (el, x, y) { + alert('getShapeAt not implemented'); + }, + + /** + * Render all queued shapes onto the canvas + */ + render: function () { + alert('render not implemented'); + } + }); + + VCanvas_canvas = createClass(VCanvas_base, { + init: function (width, height, target, interact) { + VCanvas_canvas._super.init.call(this, width, height, target); + this.canvas = document.createElement('canvas'); + if (target[0]) { + target = target[0]; + } + $.data(target, '_jqs_vcanvas', this); + $(this.canvas).css({ display: 'inline-block', width: width, height: height, verticalAlign: 'top' }); + this._insert(this.canvas, target); + this._calculatePixelDims(width, height, this.canvas); + this.canvas.width = this.pixelWidth; + this.canvas.height = this.pixelHeight; + this.interact = interact; + this.shapes = {}; + this.shapeseq = []; + this.currentTargetShapeId = undefined; + $(this.canvas).css({width: this.pixelWidth, height: this.pixelHeight}); + }, + + _getContext: function (lineColor, fillColor, lineWidth) { + var context = this.canvas.getContext('2d'); + if (lineColor !== undefined) { + context.strokeStyle = lineColor; + } + context.lineWidth = lineWidth === undefined ? 1 : lineWidth; + if (fillColor !== undefined) { + context.fillStyle = fillColor; + } + return context; + }, + + reset: function () { + var context = this._getContext(); + context.clearRect(0, 0, this.pixelWidth, this.pixelHeight); + this.shapes = {}; + this.shapeseq = []; + this.currentTargetShapeId = undefined; + }, + + _drawShape: function (shapeid, path, lineColor, fillColor, lineWidth) { + var context = this._getContext(lineColor, fillColor, lineWidth), + i, plen; + context.beginPath(); + context.moveTo(path[0][0] + 0.5, path[0][1] + 0.5); + for (i = 1, plen = path.length; i < plen; i++) { + context.lineTo(path[i][0] + 0.5, path[i][1] + 0.5); // the 0.5 offset gives us crisp pixel-width lines + } + if (lineColor !== undefined) { + context.stroke(); + } + if (fillColor !== undefined) { + context.fill(); + } + if (this.targetX !== undefined && this.targetY !== undefined && + context.isPointInPath(this.targetX, this.targetY)) { + this.currentTargetShapeId = shapeid; + } + }, + + _drawCircle: function (shapeid, x, y, radius, lineColor, fillColor, lineWidth) { + var context = this._getContext(lineColor, fillColor, lineWidth); + context.beginPath(); + context.arc(x, y, radius, 0, 2 * Math.PI, false); + if (this.targetX !== undefined && this.targetY !== undefined && + context.isPointInPath(this.targetX, this.targetY)) { + this.currentTargetShapeId = shapeid; + } + if (lineColor !== undefined) { + context.stroke(); + } + if (fillColor !== undefined) { + context.fill(); + } + }, + + _drawPieSlice: function (shapeid, x, y, radius, startAngle, endAngle, lineColor, fillColor) { + var context = this._getContext(lineColor, fillColor); + context.beginPath(); + context.moveTo(x, y); + context.arc(x, y, radius, startAngle, endAngle, false); + context.lineTo(x, y); + context.closePath(); + if (lineColor !== undefined) { + context.stroke(); + } + if (fillColor) { + context.fill(); + } + if (this.targetX !== undefined && this.targetY !== undefined && + context.isPointInPath(this.targetX, this.targetY)) { + this.currentTargetShapeId = shapeid; + } + }, + + _drawRect: function (shapeid, x, y, width, height, lineColor, fillColor) { + return this._drawShape(shapeid, [[x, y], [x + width, y], [x + width, y + height], [x, y + height], [x, y]], lineColor, fillColor); + }, + + appendShape: function (shape) { + this.shapes[shape.id] = shape; + this.shapeseq.push(shape.id); + this.lastShapeId = shape.id; + return shape.id; + }, + + replaceWithShape: function (shapeid, shape) { + var shapeseq = this.shapeseq, + i; + this.shapes[shape.id] = shape; + for (i = shapeseq.length; i--;) { + if (shapeseq[i] == shapeid) { + shapeseq[i] = shape.id; + } + } + delete this.shapes[shapeid]; + }, + + replaceWithShapes: function (shapeids, shapes) { + var shapeseq = this.shapeseq, + shapemap = {}, + sid, i, first; + + for (i = shapeids.length; i--;) { + shapemap[shapeids[i]] = true; + } + for (i = shapeseq.length; i--;) { + sid = shapeseq[i]; + if (shapemap[sid]) { + shapeseq.splice(i, 1); + delete this.shapes[sid]; + first = i; + } + } + for (i = shapes.length; i--;) { + shapeseq.splice(first, 0, shapes[i].id); + this.shapes[shapes[i].id] = shapes[i]; + } + + }, + + insertAfterShape: function (shapeid, shape) { + var shapeseq = this.shapeseq, + i; + for (i = shapeseq.length; i--;) { + if (shapeseq[i] === shapeid) { + shapeseq.splice(i + 1, 0, shape.id); + this.shapes[shape.id] = shape; + return; + } + } + }, + + removeShapeId: function (shapeid) { + var shapeseq = this.shapeseq, + i; + for (i = shapeseq.length; i--;) { + if (shapeseq[i] === shapeid) { + shapeseq.splice(i, 1); + break; + } + } + delete this.shapes[shapeid]; + }, + + getShapeAt: function (el, x, y) { + this.targetX = x; + this.targetY = y; + this.render(); + return this.currentTargetShapeId; + }, + + render: function () { + var shapeseq = this.shapeseq, + shapes = this.shapes, + shapeCount = shapeseq.length, + context = this._getContext(), + shapeid, shape, i; + context.clearRect(0, 0, this.pixelWidth, this.pixelHeight); + for (i = 0; i < shapeCount; i++) { + shapeid = shapeseq[i]; + shape = shapes[shapeid]; + this['_draw' + shape.type].apply(this, shape.args); + } + if (!this.interact) { + // not interactive so no need to keep the shapes array + this.shapes = {}; + this.shapeseq = []; + } + } + + }); + + VCanvas_vml = createClass(VCanvas_base, { + init: function (width, height, target) { + var groupel; + VCanvas_vml._super.init.call(this, width, height, target); + if (target[0]) { + target = target[0]; + } + $.data(target, '_jqs_vcanvas', this); + this.canvas = document.createElement('span'); + $(this.canvas).css({ display: 'inline-block', position: 'relative', overflow: 'hidden', width: width, height: height, margin: '0px', padding: '0px', verticalAlign: 'top'}); + this._insert(this.canvas, target); + this._calculatePixelDims(width, height, this.canvas); + this.canvas.width = this.pixelWidth; + this.canvas.height = this.pixelHeight; + groupel = '<v:group coordorigin="0 0" coordsize="' + this.pixelWidth + ' ' + this.pixelHeight + '"' + + ' style="position:absolute;top:0;left:0;width:' + this.pixelWidth + 'px;height=' + this.pixelHeight + 'px;"></v:group>'; + this.canvas.insertAdjacentHTML('beforeEnd', groupel); + this.group = $(this.canvas).children()[0]; + this.rendered = false; + this.prerender = ''; + }, + + _drawShape: function (shapeid, path, lineColor, fillColor, lineWidth) { + var vpath = [], + initial, stroke, fill, closed, vel, plen, i; + for (i = 0, plen = path.length; i < plen; i++) { + vpath[i] = '' + (path[i][0]) + ',' + (path[i][1]); + } + initial = vpath.splice(0, 1); + lineWidth = lineWidth === undefined ? 1 : lineWidth; + stroke = lineColor === undefined ? ' stroked="false" ' : ' strokeWeight="' + lineWidth + 'px" strokeColor="' + lineColor + '" '; + fill = fillColor === undefined ? ' filled="false"' : ' fillColor="' + fillColor + '" filled="true" '; + closed = vpath[0] === vpath[vpath.length - 1] ? 'x ' : ''; + vel = '<v:shape coordorigin="0 0" coordsize="' + this.pixelWidth + ' ' + this.pixelHeight + '" ' + + ' id="jqsshape' + shapeid + '" ' + + stroke + + fill + + ' style="position:absolute;left:0px;top:0px;height:' + this.pixelHeight + 'px;width:' + this.pixelWidth + 'px;padding:0px;margin:0px;" ' + + ' path="m ' + initial + ' l ' + vpath.join(', ') + ' ' + closed + 'e">' + + ' </v:shape>'; + return vel; + }, + + _drawCircle: function (shapeid, x, y, radius, lineColor, fillColor, lineWidth) { + var stroke, fill, vel; + x -= radius; + y -= radius; + stroke = lineColor === undefined ? ' stroked="false" ' : ' strokeWeight="' + lineWidth + 'px" strokeColor="' + lineColor + '" '; + fill = fillColor === undefined ? ' filled="false"' : ' fillColor="' + fillColor + '" filled="true" '; + vel = '<v:oval ' + + ' id="jqsshape' + shapeid + '" ' + + stroke + + fill + + ' style="position:absolute;top:' + y + 'px; left:' + x + 'px; width:' + (radius * 2) + 'px; height:' + (radius * 2) + 'px"></v:oval>'; + return vel; + + }, + + _drawPieSlice: function (shapeid, x, y, radius, startAngle, endAngle, lineColor, fillColor) { + var vpath, startx, starty, endx, endy, stroke, fill, vel; + if (startAngle === endAngle) { + return ''; // VML seems to have problem when start angle equals end angle. + } + if ((endAngle - startAngle) === (2 * Math.PI)) { + startAngle = 0.0; // VML seems to have a problem when drawing a full circle that doesn't start 0 + endAngle = (2 * Math.PI); + } + + startx = x + Math.round(Math.cos(startAngle) * radius); + starty = y + Math.round(Math.sin(startAngle) * radius); + endx = x + Math.round(Math.cos(endAngle) * radius); + endy = y + Math.round(Math.sin(endAngle) * radius); + + if (startx === endx && starty === endy) { + if ((endAngle - startAngle) < Math.PI) { + // Prevent very small slices from being mistaken as a whole pie + return ''; + } + // essentially going to be the entire circle, so ignore startAngle + startx = endx = x + radius; + starty = endy = y; + } + + if (startx === endx && starty === endy && (endAngle - startAngle) < Math.PI) { + return ''; + } + + vpath = [x - radius, y - radius, x + radius, y + radius, startx, starty, endx, endy]; + stroke = lineColor === undefined ? ' stroked="false" ' : ' strokeWeight="1px" strokeColor="' + lineColor + '" '; + fill = fillColor === undefined ? ' filled="false"' : ' fillColor="' + fillColor + '" filled="true" '; + vel = '<v:shape coordorigin="0 0" coordsize="' + this.pixelWidth + ' ' + this.pixelHeight + '" ' + + ' id="jqsshape' + shapeid + '" ' + + stroke + + fill + + ' style="position:absolute;left:0px;top:0px;height:' + this.pixelHeight + 'px;width:' + this.pixelWidth + 'px;padding:0px;margin:0px;" ' + + ' path="m ' + x + ',' + y + ' wa ' + vpath.join(', ') + ' x e">' + + ' </v:shape>'; + return vel; + }, + + _drawRect: function (shapeid, x, y, width, height, lineColor, fillColor) { + return this._drawShape(shapeid, [[x, y], [x, y + height], [x + width, y + height], [x + width, y], [x, y]], lineColor, fillColor); + }, + + reset: function () { + this.group.innerHTML = ''; + }, + + appendShape: function (shape) { + var vel = this['_draw' + shape.type].apply(this, shape.args); + if (this.rendered) { + this.group.insertAdjacentHTML('beforeEnd', vel); + } else { + this.prerender += vel; + } + this.lastShapeId = shape.id; + return shape.id; + }, + + replaceWithShape: function (shapeid, shape) { + var existing = $('#jqsshape' + shapeid), + vel = this['_draw' + shape.type].apply(this, shape.args); + existing[0].outerHTML = vel; + }, + + replaceWithShapes: function (shapeids, shapes) { + // replace the first shapeid with all the new shapes then toast the remaining old shapes + var existing = $('#jqsshape' + shapeids[0]), + replace = '', + slen = shapes.length, + i; + for (i = 0; i < slen; i++) { + replace += this['_draw' + shapes[i].type].apply(this, shapes[i].args); + } + existing[0].outerHTML = replace; + for (i = 1; i < shapeids.length; i++) { + $('#jqsshape' + shapeids[i]).remove(); + } + }, + + insertAfterShape: function (shapeid, shape) { + var existing = $('#jqsshape' + shapeid), + vel = this['_draw' + shape.type].apply(this, shape.args); + existing[0].insertAdjacentHTML('afterEnd', vel); + }, + + removeShapeId: function (shapeid) { + var existing = $('#jqsshape' + shapeid); + this.group.removeChild(existing[0]); + }, + + getShapeAt: function (el, x, y) { + var shapeid = el.id.substr(8); + return shapeid; + }, + + render: function () { + if (!this.rendered) { + // batch the intial render into a single repaint + this.group.innerHTML = this.prerender; + this.rendered = true; + } + } + }); + +})); diff --git a/addons/crm/static/src/css/crm.css b/addons/crm/static/src/css/crm.css index 3ad3840a4e1..ba4473edc26 100644 --- a/addons/crm/static/src/css/crm.css +++ b/addons/crm/static/src/css/crm.css @@ -20,15 +20,27 @@ } .openerp .oe_kanban_view .oe_kanban_crm_salesteams .oe_items_list { - margin: 10px 0; + position: relative; + margin: 10px; } -.openerp .oe_kanban_view .oe_kanban_crm_salesteams .oe_items_list a { - width: 110px; +.openerp .oe_kanban_view .oe_kanban_crm_salesteams .oe_items_list div { + width: 160px; + height: 22px; + margin: 0 !important; + position: relative; display: inline-block; } .openerp .oe_kanban_view .oe_kanban_crm_salesteams .oe_items_list a:hover { text-decoration: underline !important; } +.openerp .oe_kanban_view .oe_kanban_crm_salesteams .oe_items_list div a:nth-child(2n) { + position: absolute; + left: 90px; + top: 0; +} +.openerp .oe_kanban_view .oe_kanban_crm_salesteams .oe_items_list div:nth-child(2n) a:nth-child(2n) { + left: 110px; +} .openerp .oe_kanban_view .oe_kanban_crm_salesteams .oe_center { text-align: center; margin: 3px 0; @@ -40,3 +52,13 @@ .openerp .oe_kanban_view .oe_kanban_crm_salesteams .oe_center .oe_subsum { font-size: 10px; } + +.openerp .oe_kanban_view .oe_justgage { + color: black; + display: inline-block; +} + +.openerp .oe_kanban_view .oe_sparkline_bar { + height: 20px; + width: 36px; +}
\ No newline at end of file diff --git a/addons/crm/static/src/js/crm.js b/addons/crm/static/src/js/crm.js deleted file mode 100644 index e027313d6dc..00000000000 --- a/addons/crm/static/src/js/crm.js +++ /dev/null @@ -1,11 +0,0 @@ -openerp.crm = function(openerp) { - openerp.web_kanban.KanbanRecord.include({ - on_card_clicked: function() { - if (this.view.dataset.model === 'crm.case.section') { - this.$('.oe_kanban_crm_salesteams_list a').first().click(); - } else { - this._super.apply(this, arguments); - } - }, - }); -}; diff --git a/addons/crm/static/src/js/crm_case_section.js b/addons/crm/static/src/js/crm_case_section.js new file mode 100644 index 00000000000..2b4ca741d75 --- /dev/null +++ b/addons/crm/static/src/js/crm_case_section.js @@ -0,0 +1,34 @@ +openerp.crm = function(openerp) { + openerp.web_kanban.KanbanRecord.include({ + on_card_clicked: function() { + if (this.view.dataset.model === 'crm.case.section') { + this.$('.oe_kanban_crm_salesteams_list a').first().click(); + } else { + this._super.apply(this, arguments); + } + }, + }); + + openerp.crm.SparklineBarWidget = openerp.web_kanban.AbstractField.extend({ + className: "oe_sparkline_bar", + start: function() { + var self = this; + var title = this.$node.html(); + setTimeout(function () { + var value = _.pluck(self.field.value, 'value'); + var tooltips = _.pluck(self.field.value, 'tooltip'); + self.$el.sparkline(value, { + type: 'bar', + barWidth: 5, + tooltipFormat: '{{offset:offset}} {{value}}', + tooltipValueLookups: { + 'offset': tooltips + }, + }); + self.$el.tipsy({'delayIn': 0, 'html': true, 'title': function(){return title}, 'gravity': 'n'}); + }, 0); + }, + }); + openerp.web_kanban.fields_registry.add("sparkline_bar", "openerp.crm.SparklineBarWidget"); + +}; diff --git a/addons/crm/test/crm_lead_cancel.yml b/addons/crm/test/crm_lead_cancel.yml index edaf844952a..8749675bf23 100644 --- a/addons/crm/test/crm_lead_cancel.yml +++ b/addons/crm/test/crm_lead_cancel.yml @@ -1,7 +1,9 @@ - - I cancel unqualified lead. + I set a new sale team (with Marketing at parent) and I cancel unqualified lead . - !python {model: crm.lead}: | + section_id = self.pool.get('crm.case.section').create(cr, uid, {'name': "Phone Marketing", 'parent_id': ref("crm.crm_case_section_2")}) + self.write(cr, uid, [ref("crm_case_1")], {'section_id': section_id}) self.case_cancel(cr, uid, [ref("crm_case_1")]) - I check cancelled lead. @@ -42,4 +44,4 @@ I check the lead is correctly escalated to the parent team. - !assert {model: crm.lead, id: crm.crm_case_1, string: Escalate lead to parent team}: - - section_id.name == "Support Department" + - section_id.name == "Marketing" diff --git a/addons/crm/wizard/crm_lead_to_opportunity.py b/addons/crm/wizard/crm_lead_to_opportunity.py index e67b7c0c7be..3c847ade42a 100644 --- a/addons/crm/wizard/crm_lead_to_opportunity.py +++ b/addons/crm/wizard/crm_lead_to_opportunity.py @@ -86,7 +86,7 @@ class crm_lead2opportunity_partner(osv.osv_memory): lead_obj = self.pool.get('crm.lead') for lead in lead_obj.browse(cr, uid, context.get('active_ids', []), context=context): if lead.state in ['done', 'cancel']: - raise osv.except_osv(_("Warning !"), _("Closed/Cancelled leads cannot be converted into opportunities.")) + raise osv.except_osv(_("Warning!"), _("Closed/Cancelled leads cannot be converted into opportunities.")) return False def _convert_opportunity(self, cr, uid, ids, vals, context=None): diff --git a/addons/crm_claim/report/crm_claim_report_view.xml b/addons/crm_claim/report/crm_claim_report_view.xml index 530eb6061a3..bae02ef8c0c 100644 --- a/addons/crm_claim/report/crm_claim_report_view.xml +++ b/addons/crm_claim/report/crm_claim_report_view.xml @@ -55,7 +55,7 @@ <filter icon="terp-camera_test" string="Open" domain="[('state','=','open')]"/> <filter icon="terp-gtk-media-pause" string="Pending" domain="[('state','=','pending')]"/> <separator/> - <filter string="My Sales Team(s)" icon="terp-personal+" context="{'invisible_section': False}" domain="[('section_id.user_id','=',uid)]" help="My Sales Team(s)" /> + <filter string="My Sales Team(s)" icon="terp-personal+" context="{'invisible_section': False}" domain="[('section_id.user_id','=',uid)]" help="My Sales Team(s)" groups="base.group_multi_salesteams"/> <separator/> <filter string="My Company" icon="terp-go-home" context="{'invisible_section': False}" domain="[('section_id.user_id.company_id','=',uid)]" help="My company"/> <separator/> @@ -78,7 +78,7 @@ </group> <group expand="1" string="Group By..."> <filter string="Salesperson" name="Salesperson" icon="terp-personal" domain="[]" context="{'group_by':'user_id'}" /> - <filter string="Sales Team" icon="terp-personal+" domain="[]" context="{'group_by':'section_id'}" /> + <filter string="Sales Team" icon="terp-personal+" domain="[]" context="{'group_by':'section_id'}" groups="base.group_multi_salesteams"/> <filter string="Partner" name="partner" icon="terp-partner" domain="[]" context="{'group_by':'partner_id'}" /> <filter string="Stage" icon="terp-stage" domain="[]" context="{'group_by':'stage_id'}" /> <filter string="Priority" icon="terp-rating-rated" domain="[]" context="{'group_by':'priority'}" /> diff --git a/addons/crm_helpdesk/crm_helpdesk_view.xml b/addons/crm_helpdesk/crm_helpdesk_view.xml index 6e3521be6f2..f97fe654166 100644 --- a/addons/crm_helpdesk/crm_helpdesk_view.xml +++ b/addons/crm_helpdesk/crm_helpdesk_view.xml @@ -151,14 +151,14 @@ <filter icon="terp-gtk-media-pause" string="Pending" domain="[('state','=','pending')]" help="All pending Helpdesk Request" /> <separator/> <filter string="Assigned to Me or My Sales Team(s)" icon="terp-personal+" domain="['|', ('section_id.user_id','=',uid), ('section_id.member_ids', 'in', [uid])]" - help="Helpdesk requests that are assigned to me or to one of the sale teams I manage" /> + help="Helpdesk requests that are assigned to me or to one of the sale teams I manage" groups="base.group_multi_salesteams"/> <field name="partner_id" filter_domain="[('partner_id','child_of',self)]"/> <field name="user_id"/> <field name="section_id" string="Sales Team" groups="base.group_multi_salesteams"/> <group expand="0" string="Group By..."> <filter string="Partner" icon="terp-partner" domain="[]" help="Partner" context="{'group_by':'partner_id'}" /> <filter string="Responsible" icon="terp-personal" domain="[]" help="Responsible User" context="{'group_by':'user_id'}" /> - <filter string="Sales Team" icon="terp-personal+" domain="[]" help="Sales Team" context="{'group_by':'section_id'}" /> + <filter string="Sales Team" icon="terp-personal+" domain="[]" help="Sales Team" context="{'group_by':'section_id'}" groups="base.group_multi_salesteams"/> <filter string="Priority" icon="terp-rating-rated" domain="[]" context="{'group_by':'priority'}" /> <filter string="Status" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}" /> <filter string="Date" icon="terp-go-month" domain="[]" help="Request Date" context="{'group_by':'date'}" /> diff --git a/addons/crm_helpdesk/i18n/zh_CN.po b/addons/crm_helpdesk/i18n/zh_CN.po index 4a80e7f9385..7c8275f606a 100644 --- a/addons/crm_helpdesk/i18n/zh_CN.po +++ b/addons/crm_helpdesk/i18n/zh_CN.po @@ -8,14 +8,14 @@ msgstr "" "Project-Id-Version: openobject-addons\n" "Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n" "POT-Creation-Date: 2012-12-21 17:05+0000\n" -"PO-Revision-Date: 2012-12-14 13:33+0000\n" -"Last-Translator: 盈通 ccdos <ccdos@163.com>\n" +"PO-Revision-Date: 2013-06-07 05:02+0000\n" +"Last-Translator: PeterGao <306739889@qq.com>\n" "Language-Team: Chinese (Simplified) <zh_CN@li.org>\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2013-03-16 05:46+0000\n" -"X-Generator: Launchpad (build 16532)\n" +"X-Launchpad-Export-Date: 2013-06-07 05:48+0000\n" +"X-Generator: Launchpad (build 16667)\n" #. module: crm_helpdesk #: field:crm.helpdesk.report,delay_close:0 @@ -656,6 +656,12 @@ msgid "" " \n" "If the case needs to be reviewed then the status is set to 'Pending'." msgstr "" +"当一个“case(事件)\"被新创建后,这个“case(事件)\"的状态为“草稿”状态。 " +" \n" +"若这个“case(事件)\"正在处理中,这个“case(事件)\"的状态为“开启”状态。\n" +"若这个“case(事件)\"已处理完结,这个“case(事件)\"的状态为“结单”状态。 " +" \n" +"若这个“case(事件)\"需暂停再议,这个“case(事件)\"的状态为“挂起”状态。" #. module: crm_helpdesk #: help:crm.helpdesk,message_ids:0 diff --git a/addons/crm_helpdesk/report/crm_helpdesk_report_view.xml b/addons/crm_helpdesk/report/crm_helpdesk_report_view.xml index 6ce2c60093f..c1ffc00303d 100644 --- a/addons/crm_helpdesk/report/crm_helpdesk_report_view.xml +++ b/addons/crm_helpdesk/report/crm_helpdesk_report_view.xml @@ -56,7 +56,7 @@ <separator/> <filter icon="terp-personal" string="My Case(s)" help="My Case(s)" domain="[('user_id','=',uid)]" /> <separator/> - <filter string="My Sales Team(s)" icon="terp-personal+" context="{'invisible_section': False}" domain="[('section_id.user_id','=',uid)]" help="My Sales Team(s)" /> + <filter string="My Sales Team(s)" icon="terp-personal+" context="{'invisible_section': False}" domain="[('section_id.user_id','=',uid)]" help="My Sales Team(s)" groups="base.group_multi_salesteams"/> <separator/> <filter string="My Company" icon="terp-go-home" context="{'invisible_section': False}" domain="[('section_id.user_id.company_id','=',uid)]" help="My company"/> <field name="user_id" string="Salesperson"/> @@ -71,7 +71,7 @@ </group> <group expand="1" string="Group By..."> <filter string="Salesperson" icon="terp-personal" domain="[]" context="{'group_by':'user_id'}"/> - <filter string="Sales Team" icon="terp-personal+" domain="[]" context="{'group_by':'section_id'}" /> + <filter string="Sales Team" icon="terp-personal+" domain="[]" context="{'group_by':'section_id'}" groups="base.group_multi_salesteams"/> <filter string="Partner" icon="terp-partner" domain="[]" context="{'group_by':'partner_id'}" /> <filter string="Channel" icon="terp-call-start" domain="[]" context="{'group_by':'channel_id'}" /> <filter string="Status" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}" /> diff --git a/addons/crm_helpdesk/test/customer_question.eml b/addons/crm_helpdesk/test/customer_question.eml index 38a4c95fb0c..9bc7c91cb41 100644 --- a/addons/crm_helpdesk/test/customer_question.eml +++ b/addons/crm_helpdesk/test/customer_question.eml @@ -3,7 +3,7 @@ Date: Tue, 25 Oct 2011 13:41:17 +0530 From: Mr. John Right <info@customer.com>
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.14) Gecko/20110223 Lightning/1.0b2 Thunderbird/3.1.8
MIME-Version: 1.0
-To: info@my.com
+To: _helpdesk@my.com
Subject: Where is download link of user manual of your product ?
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit
diff --git a/addons/crm_partner_assign/i18n/ru.po b/addons/crm_partner_assign/i18n/ru.po index 53a2929be4e..fa995c8e7a1 100644 --- a/addons/crm_partner_assign/i18n/ru.po +++ b/addons/crm_partner_assign/i18n/ru.po @@ -8,14 +8,14 @@ msgstr "" "Project-Id-Version: openobject-addons\n" "Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n" "POT-Creation-Date: 2012-12-21 17:05+0000\n" -"PO-Revision-Date: 2013-05-30 14:10+0000\n" +"PO-Revision-Date: 2013-06-06 10:24+0000\n" "Last-Translator: Chertykov Denis <chertykov@gmail.com>\n" "Language-Team: Russian <ru@li.org>\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2013-05-31 05:38+0000\n" -"X-Generator: Launchpad (build 16660)\n" +"X-Launchpad-Export-Date: 2013-06-07 05:48+0000\n" +"X-Generator: Launchpad (build 16667)\n" #. module: crm_partner_assign #: field:crm.lead.report.assign,delay_close:0 @@ -670,7 +670,7 @@ msgstr "" #. module: crm_partner_assign #: field:crm.partner.report.assign,period_id:0 msgid "Invoice Period" -msgstr "" +msgstr "Период счета" #. module: crm_partner_assign #: model:ir.model,name:crm_partner_assign.model_res_partner_grade @@ -706,6 +706,8 @@ msgid "" "Cannot contact geolocation servers. Please make sure that your internet " "connection is up and running (%s)." msgstr "" +"Не удается связаться с сервером геолокации. Пожалуйста, убедитесь, что ваше " +"подключение к интернету работает (%s)." #. module: crm_partner_assign #: selection:crm.lead.report.assign,month:0 diff --git a/addons/crm_partner_assign/wizard/crm_forward_to_partner.py b/addons/crm_partner_assign/wizard/crm_forward_to_partner.py index 924f96180cc..724102a84b1 100644 --- a/addons/crm_partner_assign/wizard/crm_forward_to_partner.py +++ b/addons/crm_partner_assign/wizard/crm_forward_to_partner.py @@ -124,6 +124,7 @@ class crm_lead_forward_to_partner(osv.TransientModel): lead_ids = context and context.get('active_ids', []) or [] value = self.default_get(cr, uid, ['body', 'email_to', 'email_cc', 'subject', 'history_mode'], context=context) value.pop('composition_mode') + self.pool.get('crm.lead').message_subscribe(cr, uid, lead_ids, [partner.id for partner in wizard.partner_ids], context=context) self.write(cr, uid, ids, value, context=context) return self.send_mail(cr, uid, ids, context=context) diff --git a/addons/delivery/sale.py b/addons/delivery/sale.py index 86a518ebca9..1b797290632 100644 --- a/addons/delivery/sale.py +++ b/addons/delivery/sale.py @@ -51,10 +51,10 @@ class sale_order(osv.osv): for order in self.browse(cr, uid, ids, context=context): grid_id = carrier_obj.grid_get(cr, uid, [order.carrier_id.id], order.partner_shipping_id.id) if not grid_id: - raise osv.except_osv(_('No grid available !'), _('No grid matching for this carrier !')) + raise osv.except_osv(_('No Grid Available!'), _('No grid matching for this carrier!')) if not order.state in ('draft'): - raise osv.except_osv(_('Order not in draft state !'), _('The order state have to be draft to add delivery lines.')) + raise osv.except_osv(_('Order not in Draft State!'), _('The order state have to be draft to add delivery lines.')) grid = grid_obj.browse(cr, uid, grid_id, context=context) diff --git a/addons/document_page/document_page_view.xml b/addons/document_page/document_page_view.xml index 08c77647d17..4d0b5596e75 100644 --- a/addons/document_page/document_page_view.xml +++ b/addons/document_page/document_page_view.xml @@ -26,6 +26,7 @@ <tree string="Document Page"> <field name="name"/> <field name="parent_id"/> + <field name="create_uid" invisible="1"/> <field name="write_uid"/> <field name="write_date"/> </tree> diff --git a/addons/edi/models/edi.py b/addons/edi/models/edi.py index bfd59dae15a..1b9e0c4df08 100644 --- a/addons/edi/models/edi.py +++ b/addons/edi/models/edi.py @@ -126,7 +126,7 @@ class edi(osv.AbstractModel): module = edi_document.get('__import_module') or edi_document.get('__module') assert module, 'a `__module` or `__import_module` attribute is required in each EDI document.' if module != 'base' and not ir_module.search(cr, uid, [('name','=',module),('state','=','installed')]): - raise osv.except_osv(_('Missing application.'), + raise osv.except_osv(_('Missing Application.'), _("The document you are trying to import requires the OpenERP `%s` application. " "You can install it by connecting as the administrator and opening the configuration assistant.")%(module,)) model = edi_document.get('__import_model') or edi_document.get('__model') diff --git a/addons/email_template/email_template.py b/addons/email_template/email_template.py index 4a767457321..2a7990e301b 100644 --- a/addons/email_template/email_template.py +++ b/addons/email_template/email_template.py @@ -358,7 +358,7 @@ class email_template(osv.osv): values['attachment_ids'] = attachment_ids return values - def send_mail(self, cr, uid, template_id, res_id, force_send=False, context=None): + def send_mail(self, cr, uid, template_id, res_id, force_send=False, raise_exception=False, context=None): """Generates a new mail message for the given template and record, and schedules it for delivery through the ``mail`` module's scheduler. @@ -400,7 +400,7 @@ class email_template(osv.osv): mail_mail.write(cr, uid, msg_id, {'attachment_ids': [(6, 0, attachment_ids)]}, context=context) if force_send: - mail_mail.send(cr, uid, [msg_id], context=context) + mail_mail.send(cr, uid, [msg_id], raise_exception=raise_exception, context=context) return msg_id # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/email_template/i18n/ru.po b/addons/email_template/i18n/ru.po index 2e592ecea35..b16433fddd5 100644 --- a/addons/email_template/i18n/ru.po +++ b/addons/email_template/i18n/ru.po @@ -8,14 +8,14 @@ msgstr "" "Project-Id-Version: openobject-addons\n" "Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n" "POT-Creation-Date: 2012-12-21 17:05+0000\n" -"PO-Revision-Date: 2013-05-30 13:33+0000\n" +"PO-Revision-Date: 2013-06-05 07:10+0000\n" "Last-Translator: Chertykov Denis <chertykov@gmail.com>\n" "Language-Team: Russian <ru@li.org>\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2013-05-31 05:38+0000\n" -"X-Generator: Launchpad (build 16660)\n" +"X-Launchpad-Export-Date: 2013-06-06 05:21+0000\n" +"X-Generator: Launchpad (build 16667)\n" #. module: email_template #: field:email.template,email_from:0 @@ -254,7 +254,7 @@ msgstr "Просмотр" #. module: email_template #: view:email_template.preview:0 msgid "Using sample document" -msgstr "" +msgstr "Используя образец документа" #. module: email_template #: view:email.template:0 diff --git a/addons/fetchmail/security/ir.model.access.csv b/addons/fetchmail/security/ir.model.access.csv index 7deea6eb9f4..c006546659f 100644 --- a/addons/fetchmail/security/ir.model.access.csv +++ b/addons/fetchmail/security/ir.model.access.csv @@ -1,3 +1,2 @@ id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
-access_fetchmail_server,fetchmail.server,model_fetchmail_server,,1,0,0,0
access_fetchmail_server,fetchmail.server,model_fetchmail_server,base.group_system,1,1,1,1
diff --git a/addons/google_docs/i18n/ln.po b/addons/google_docs/i18n/ln.po new file mode 100644 index 00000000000..24c26b98920 --- /dev/null +++ b/addons/google_docs/i18n/ln.po @@ -0,0 +1,188 @@ +# Lingala translation for openobject-addons +# Copyright (c) 2013 Rosetta Contributors and Canonical Ltd 2013 +# This file is distributed under the same license as the openobject-addons package. +# FIRST AUTHOR <EMAIL@ADDRESS>, 2013. +# +msgid "" +msgstr "" +"Project-Id-Version: openobject-addons\n" +"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n" +"POT-Creation-Date: 2012-12-21 17:05+0000\n" +"PO-Revision-Date: 2013-06-05 13:00+0000\n" +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" +"Language-Team: Lingala <ln@li.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Launchpad-Export-Date: 2013-06-06 05:21+0000\n" +"X-Generator: Launchpad (build 16667)\n" + +#. module: google_docs +#: code:addons/google_docs/google_docs.py:167 +#, python-format +msgid "Key Error!" +msgstr "" + +#. module: google_docs +#: view:google.docs.config:0 +msgid "" +"for a presentation (slide show) document with url like " +"`https://docs.google.com/a/openerp.com/presentation/d/123456789/edit#slide=id" +".p`, the ID is `presentation:123456789`" +msgstr "" + +#. module: google_docs +#: view:google.docs.config:0 +msgid "" +"for a text document with url like " +"`https://docs.google.com/a/openerp.com/document/d/123456789/edit`, the ID is " +"`document:123456789`" +msgstr "" + +#. module: google_docs +#: field:google.docs.config,gdocs_resource_id:0 +msgid "Google Resource ID to Use as Template" +msgstr "" + +#. module: google_docs +#: view:google.docs.config:0 +msgid "" +"for a drawing document with url like " +"`https://docs.google.com/a/openerp.com/drawings/d/123456789/edit`, the ID is " +"`drawings:123456789`" +msgstr "" + +#. module: google_docs +#. openerp-web +#: code:addons/google_docs/static/src/xml/gdocs.xml:6 +#, python-format +msgid "Add Google Doc..." +msgstr "" + +#. module: google_docs +#: view:google.docs.config:0 +msgid "" +"This is the id of the template document, on google side. You can find it " +"thanks to its URL:" +msgstr "" + +#. module: google_docs +#: model:ir.model,name:google_docs.model_google_docs_config +msgid "Google Docs templates config" +msgstr "" + +#. module: google_docs +#. openerp-web +#: code:addons/google_docs/static/src/js/gdocs.js:25 +#, python-format +msgid "" +"The user google credentials are not set yet. Contact your administrator for " +"help." +msgstr "" + +#. module: google_docs +#: view:google.docs.config:0 +msgid "" +"for a spreadsheet document with url like " +"`https://docs.google.com/a/openerp.com/spreadsheet/ccc?key=123456789#gid=0`, " +"the ID is `spreadsheet:123456789`" +msgstr "" + +#. module: google_docs +#: code:addons/google_docs/google_docs.py:129 +#, python-format +msgid "" +"Your resource id is not correct. You can find the id in the google docs URL." +msgstr "" + +#. module: google_docs +#: code:addons/google_docs/google_docs.py:153 +#, python-format +msgid "Creating google docs may only be done by one at a time." +msgstr "" + +#. module: google_docs +#: code:addons/google_docs/google_docs.py:83 +#: code:addons/google_docs/google_docs.py:129 +#: code:addons/google_docs/google_docs.py:153 +#, python-format +msgid "Google Docs Error!" +msgstr "" + +#. module: google_docs +#: code:addons/google_docs/google_docs.py:83 +#, python-format +msgid "Check your google configuration in Users/Users/Synchronization tab." +msgstr "" + +#. module: google_docs +#: model:ir.ui.menu,name:google_docs.menu_gdocs_config +msgid "Google Docs configuration" +msgstr "" + +#. module: google_docs +#: model:ir.actions.act_window,name:google_docs.action_google_docs_users_config +#: model:ir.ui.menu,name:google_docs.menu_gdocs_model_config +msgid "Models configuration" +msgstr "" + +#. module: google_docs +#: field:google.docs.config,model_id:0 +msgid "Model" +msgstr "" + +#. module: google_docs +#. openerp-web +#: code:addons/google_docs/static/src/js/gdocs.js:28 +#, python-format +msgid "User Google credentials are not yet set." +msgstr "" + +#. module: google_docs +#: code:addons/google_docs/google_docs.py:167 +#, python-format +msgid "Your Google Doc Name Pattern's key does not found in object." +msgstr "" + +#. module: google_docs +#: help:google.docs.config,name_template:0 +msgid "" +"Choose how the new google docs will be named, on google side. Eg. " +"gdoc_%(field_name)s" +msgstr "" + +#. module: google_docs +#: view:google.docs.config:0 +msgid "Google Docs Configuration" +msgstr "" + +#. module: google_docs +#: help:google.docs.config,gdocs_resource_id:0 +msgid "" +"\n" +"This is the id of the template document, on google side. You can find it " +"thanks to its URL: \n" +"*for a text document with url like " +"`https://docs.google.com/a/openerp.com/document/d/123456789/edit`, the ID is " +"`document:123456789`\n" +"*for a spreadsheet document with url like " +"`https://docs.google.com/a/openerp.com/spreadsheet/ccc?key=123456789#gid=0`, " +"the ID is `spreadsheet:123456789`\n" +"*for a presentation (slide show) document with url like " +"`https://docs.google.com/a/openerp.com/presentation/d/123456789/edit#slide=id" +".p`, the ID is `presentation:123456789`\n" +"*for a drawing document with url like " +"`https://docs.google.com/a/openerp.com/drawings/d/123456789/edit`, the ID is " +"`drawings:123456789`\n" +"...\n" +msgstr "" + +#. module: google_docs +#: model:ir.model,name:google_docs.model_ir_attachment +msgid "ir.attachment" +msgstr "" + +#. module: google_docs +#: field:google.docs.config,name_template:0 +msgid "Google Doc Name Pattern" +msgstr "" diff --git a/addons/hr_attendance/wizard/hr_attendance_error.py b/addons/hr_attendance/wizard/hr_attendance_error.py index 137bac30215..82d75149428 100644 --- a/addons/hr_attendance/wizard/hr_attendance_error.py +++ b/addons/hr_attendance/wizard/hr_attendance_error.py @@ -46,7 +46,7 @@ class hr_attendance_error(osv.osv_memory): cr.execute("SELECT id FROM hr_attendance WHERE employee_id IN %s AND to_char(name,'YYYY-mm-dd')<=%s AND to_char(name,'YYYY-mm-dd')>=%s AND action IN %s ORDER BY name" ,(tuple(context['active_ids']), date_to, date_from, tuple(['sign_in','sign_out']))) attendance_ids = [x[0] for x in cr.fetchall()] if not attendance_ids: - raise osv.except_osv(_('No Data Available !'), _('No records are found for your selection!')) + raise osv.except_osv(_('No Data Available!'), _('No records are found for your selection!')) attendance_records = self.pool.get('hr.attendance').browse(cr, uid, attendance_ids, context=context) for rec in attendance_records: diff --git a/addons/hr_expense/hr_expense.py b/addons/hr_expense/hr_expense.py index 73daa64f841..8d707baa50e 100644 --- a/addons/hr_expense/hr_expense.py +++ b/addons/hr_expense/hr_expense.py @@ -57,10 +57,7 @@ class hr_expense_expense(osv.osv): def _get_currency(self, cr, uid, context=None): user = self.pool.get('res.users').browse(cr, uid, [uid], context=context)[0] - if user.company_id: - return user.company_id.currency_id.id - else: - return self.pool.get('res.currency').search(cr, uid, [('rate','=',1.0)], context=context)[0] + return user.company_id.currency_id.id _name = "hr.expense.expense" _inherit = ['mail.thread'] @@ -99,11 +96,13 @@ class hr_expense_expense(osv.osv): ('cancelled', 'Refused'), ('confirm', 'Waiting Approval'), ('accepted', 'Approved'), - ('done', 'Done'), + ('done', 'Waiting Payment'), + ('paid', 'Paid'), ], 'Status', readonly=True, track_visibility='onchange', help='When the expense request is created the status is \'Draft\'.\n It is confirmed by the user and request is sent to admin, the status is \'Waiting Confirmation\'.\ - \nIf the admin accepts it, the status is \'Accepted\'.\n If a receipt is made for the expense request, the status is \'Done\'.'), + \nIf the admin accepts it, the status is \'Accepted\'.\n If the accounting entries are made for the expense request, the status is \'Waiting Payment\'.'), + } _defaults = { 'company_id': lambda s, cr, uid, c: s.pool.get('res.company')._company_default_get(cr, uid, 'hr.employee', context=c), @@ -114,6 +113,12 @@ class hr_expense_expense(osv.osv): 'currency_id': _get_currency, } + def copy(self, cr, uid, id, default=None, context=None): + if default is None: + default = {} + default.update(account_move_id=False) + return super(hr_expense_expense, self).copy(cr, uid, id, default=default, context=context) + def unlink(self, cr, uid, ids, context=None): for rec in self.browse(cr, uid, ids, context=context): if rec.state != 'draft': @@ -282,7 +287,6 @@ class hr_expense_expense(osv.osv): tax_code_found= False #Calculate tax according to default tax on product - taxes = [] #Taken from product_id_onchange in account.invoice if line.product_id: @@ -319,8 +323,11 @@ class hr_expense_expense(osv.osv): tax_code_found = True res[-1]['tax_code_id'] = tax_code_id res[-1]['tax_amount'] = cur_obj.compute(cr, uid, exp.currency_id.id, company_currency, tax_amount, context={'date': exp.date_confirm}) - - #Will create the tax here as we don't have the access + ## + is_price_include = tax_obj.read(cr,uid,tax['id'],['price_include'],context)['price_include'] + if is_price_include: + ## We need to deduce the price for the tax + res[-1]['price'] = res[-1]['price'] - (tax['amount'] * tax['base_sign'] or 0.0) assoc_tax = { 'type':'tax', 'name':tax['name'], @@ -449,4 +456,26 @@ class hr_expense_line(osv.osv): return res +class account_move_line(osv.osv): + _inherit = "account.move.line" + + def reconcile(self, cr, uid, ids, type='auto', writeoff_acc_id=False, writeoff_period_id=False, writeoff_journal_id=False, context=None): + res = super(account_move_line, self).reconcile(cr, uid, ids, type=type, writeoff_acc_id=writeoff_acc_id, writeoff_period_id=writeoff_period_id, writeoff_journal_id=writeoff_journal_id, context=context) + #when making a full reconciliation of account move lines 'ids', we may need to recompute the state of some hr.expense + account_move_ids = [aml.move_id.id for aml in self.browse(cr, uid, ids, context=context)] + expense_obj = self.pool.get('hr.expense.expense') + currency_obj = self.pool.get('res.currency') + if account_move_ids: + expense_ids = expense_obj.search(cr, uid, [('account_move_id', 'in', account_move_ids)], context=context) + for expense in expense_obj.browse(cr, uid, expense_ids, context=context): + if expense.state == 'done': + #making the postulate it has to be set paid, then trying to invalidate it + new_status_is_paid = True + for aml in expense.account_move_id.line_id: + if aml.account_id.type == 'payable' and not currency_obj.is_zero(cr, uid, expense.company_id.currency_id, aml.amount_residual): + new_status_is_paid = False + if new_status_is_paid: + expense_obj.write(cr, uid, [expense.id], {'state': 'paid'}, context=context) + return res + # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/hr_expense/hr_expense_view.xml b/addons/hr_expense/hr_expense_view.xml index 10abe95d892..ca882406d63 100644 --- a/addons/hr_expense/hr_expense_view.xml +++ b/addons/hr_expense/hr_expense_view.xml @@ -68,7 +68,7 @@ <button name="draft" states="confirm,cancelled" string="Set to Draft" type="workflow" groups="base.group_hr_user" /> <button name="done" states="accepted" string="Generate Accounting Entries" type="workflow" groups="account.group_account_invoice" class="oe_highlight"/> <button name="action_view_move" states="done" string="Open Accounting Entries" type="object" groups="account.group_account_invoice"/> - <field name="state" widget="statusbar" statusbar_visible="draft,confirm,accepted,done" statusbar_colors='{"confirm":"blue","cancelled":"red"}'/> + <field name="state" widget="statusbar" statusbar_visible="draft,confirm,accepted,done,paid" statusbar_colors='{"confirm":"blue","cancelled":"red"}'/> </header> <sheet> <group> diff --git a/addons/hr_holidays/hr_holidays_view.xml b/addons/hr_holidays/hr_holidays_view.xml index 5828790c152..5ffbff10040 100644 --- a/addons/hr_holidays/hr_holidays_view.xml +++ b/addons/hr_holidays/hr_holidays_view.xml @@ -40,8 +40,8 @@ <field name="name">Leave Request</field> <field name="model">hr.holidays</field> <field name="arch" type="xml"> - <calendar string="Leave Request" color="user_id" date_start="date_from" date_stop="date_to"> - <field name="user_id"/> + <calendar string="Leave Request" color="employee_id" date_start="date_from" date_stop="date_to"> + <field name="employee_id"/> <field name="holiday_status_id"/> </calendar> </field> diff --git a/addons/hr_payroll/wizard/hr_payroll_payslips_by_employees.py b/addons/hr_payroll/wizard/hr_payroll_payslips_by_employees.py index 5837472be5f..3bf8b339300 100644 --- a/addons/hr_payroll/wizard/hr_payroll_payslips_by_employees.py +++ b/addons/hr_payroll/wizard/hr_payroll_payslips_by_employees.py @@ -49,7 +49,7 @@ class hr_payslip_employees(osv.osv_memory): to_date = run_data.get('date_end', False) credit_note = run_data.get('credit_note', False) if not data['employee_ids']: - raise osv.except_osv(_("Warning !"), _("You must select employee(s) to generate payslip(s).")) + raise osv.except_osv(_("Warning!"), _("You must select employee(s) to generate payslip(s).")) for emp in emp_pool.browse(cr, uid, data['employee_ids'], context=context): slip_data = slip_pool.onchange_employee_id(cr, uid, [], from_date, to_date, emp.id, contract_id=False, context=context) res = { diff --git a/addons/hr_timesheet_invoice/hr_timesheet_invoice.py b/addons/hr_timesheet_invoice/hr_timesheet_invoice.py index f8c27bded5e..6c4f6022c39 100644 --- a/addons/hr_timesheet_invoice/hr_timesheet_invoice.py +++ b/addons/hr_timesheet_invoice/hr_timesheet_invoice.py @@ -181,7 +181,7 @@ class account_analytic_line(osv.osv): for account in analytic_account_obj.browse(cr, uid, list(account_ids), context=context): partner = account.partner_id if (not partner) or not (account.pricelist_id): - raise osv.except_osv(_('Analytic Account incomplete !'), + raise osv.except_osv(_('Analytic Account Incomplete!'), _('Contract incomplete. Please fill in the Customer and Pricelist fields.')) date_due = False diff --git a/addons/hr_timesheet_sheet/static/src/js/timesheet.js b/addons/hr_timesheet_sheet/static/src/js/timesheet.js index fe7d0c82767..e7d13c425b6 100644 --- a/addons/hr_timesheet_sheet/static/src/js/timesheet.js +++ b/addons/hr_timesheet_sheet/static/src/js/timesheet.js @@ -163,24 +163,42 @@ openerp.hr_timesheet_sheet = function(instance) { this.dfm = undefined; } }, + is_valid_value:function(value){ + var split_value = value.split(":"); + var valid_value = true; + if (split_value.length > 2) + return false; + _.detect(split_value,function(num){ + if(isNaN(num)){ + valid_value = false; + } + }); + return valid_value; + }, display_data: function() { var self = this; self.$el.html(QWeb.render("hr_timesheet_sheet.WeeklyTimesheet", {widget: self})); _.each(self.accounts, function(account) { _.each(_.range(account.days.length), function(day_count) { if (!self.get('effective_readonly')) { - self.get_box(account, day_count).val(self.sum_box(account, day_count)).change(function() { - var num = Number($(this).val()); + self.get_box(account, day_count).val(self.sum_box(account, day_count, true)).change(function() { + var num = $(this).val(); + if (self.is_valid_value(num)){ + num = (num == 0)?0:Number(self.parse_client(num)); + } if (isNaN(num)) { - $(this).val(self.sum_box(account, day_count)); + $(this).val(self.sum_box(account, day_count, true)); } else { account.days[day_count].lines[0].unit_amount += num - self.sum_box(account, day_count); self.display_totals(); self.sync(); + if(!isNaN($(this).val())){ + $(this).val(self.sum_box(account, day_count, true)); + } } }); } else { - self.get_box(account, day_count).html(self.sum_box(account, day_count)); + self.get_box(account, day_count).html(self.sum_box(account, day_count, true)); } }); }); @@ -247,12 +265,12 @@ openerp.hr_timesheet_sheet = function(instance) { get_super_total: function() { return this.$('.oe_timesheet_weekly_supertotal'); }, - sum_box: function(account, day_count) { + sum_box: function(account, day_count, show_value_in_hour) { var line_total = 0; _.each(account.days[day_count].lines, function(line) { line_total += line.unit_amount; }); - return line_total; + return (show_value_in_hour && line_total != 0)?this.format_client(line_total):line_total; }, display_totals: function() { var self = this; @@ -266,12 +284,12 @@ openerp.hr_timesheet_sheet = function(instance) { day_tots[day_count] += sum; super_tot += sum; }); - self.get_total(account).html(acc_tot); + self.get_total(account).html(self.format_client(acc_tot)); }); _.each(_.range(self.dates.length), function(day_count) { - self.get_day_total(day_count).html(day_tots[day_count]); + self.get_day_total(day_count).html(self.format_client(day_tots[day_count])); }); - self.get_super_total().html(super_tot); + self.get_super_total().html(self.format_client(super_tot)); }, sync: function() { var self = this; @@ -279,6 +297,14 @@ openerp.hr_timesheet_sheet = function(instance) { self.set({sheets: this.generate_o2m_value()}); self.setting = false; }, + //converts hour value to float + parse_client: function(value) { + return instance.web.parse_value(value, { type:"float_time" }); + }, + //converts float value to hour + format_client:function(value){ + return instance.web.format_value(value, { type:"float_time" }); + }, generate_o2m_value: function() { var self = this; var ops = []; diff --git a/addons/im/im.py b/addons/im/im.py index 0de9ea8c79b..cee1705ec35 100644 --- a/addons/im/im.py +++ b/addons/im/im.py @@ -90,79 +90,6 @@ POLL_TIMER = 30 DISCONNECTION_TIMER = POLL_TIMER + 5 WATCHER_ERROR_DELAY = 10 -if openerp.evented: - import gevent - import gevent.event - - class ImWatcher(object): - watchers = {} - - @staticmethod - def get_watcher(db_name): - if not ImWatcher.watchers.get(db_name): - ImWatcher(db_name) - return ImWatcher.watchers[db_name] - - def __init__(self, db_name): - self.db_name = db_name - ImWatcher.watchers[db_name] = self - self.waiting = 0 - self.wait_id = 0 - self.users = {} - self.users_watch = {} - gevent.spawn(self.loop) - - def loop(self): - _logger.info("Begin watching on channel im_channel for database " + self.db_name) - stop = False - while not stop: - try: - registry = openerp.modules.registry.RegistryManager.get(self.db_name) - with registry.cursor() as cr: - listen_channel(cr, "im_channel", self.handle_message, self.check_stop) - stop = True - except: - # if something crash, we wait some time then try again - _logger.exception("Exception during watcher activity") - time.sleep(WATCHER_ERROR_DELAY) - _logger.info("End watching on channel im_channel for database " + self.db_name) - del ImWatcher.watchers[self.db_name] - - def handle_message(self, message): - if message["type"] == "message": - for waiter in self.users.get(message["receiver"], {}).values(): - waiter.set() - else: #type status - for waiter in self.users_watch.get(message["user"], {}).values(): - waiter.set() - - def check_stop(self): - return self.waiting == 0 - - def _get_wait_id(self): - self.wait_id += 1 - return self.wait_id - - def stop(self, user_id, watch_users, timeout=None): - wait_id = self._get_wait_id() - event = gevent.event.Event() - self.waiting += 1 - self.users.setdefault(user_id, {})[wait_id] = event - for watch in watch_users: - self.users_watch.setdefault(watch, {})[wait_id] = event - try: - event.wait(timeout) - finally: - for watch in watch_users: - del self.users_watch[watch][wait_id] - if len(self.users_watch[watch]) == 0: - del self.users_watch[watch] - del self.users[user_id][wait_id] - if len(self.users[user_id]) == 0: - del self.users[user_id] - self.waiting -= 1 - - class LongPollingController(openerp.addons.web.http.Controller): _cp_path = '/longpolling/im' @@ -171,6 +98,7 @@ class LongPollingController(openerp.addons.web.http.Controller): assert_uuid(uuid) if not openerp.evented: raise Exception("Not usable in a server not running gevent") + from openerp.addons.im.watcher import ImWatcher if db is not None: req.session._db = db req.session._uid = uid diff --git a/addons/im/security/ir.model.access.csv b/addons/im/security/ir.model.access.csv index ed639353e21..db3fe77f690 100644 --- a/addons/im/security/ir.model.access.csv +++ b/addons/im/security/ir.model.access.csv @@ -1,3 +1,3 @@ id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink access_im_message,im.message,model_im_message,base.group_user,1,0,1,0 -access_im_user,im.user,model_im_user,base.group_user,1,1,1,0
\ No newline at end of file +access_im_user,im.user,model_im_user,,1,1,1,0
\ No newline at end of file diff --git a/addons/im/static/src/audio/Ting.mp3 b/addons/im/static/src/audio/Ting.mp3 Binary files differindex 6fd090a89ce..ffbb77144b2 100644 --- a/addons/im/static/src/audio/Ting.mp3 +++ b/addons/im/static/src/audio/Ting.mp3 diff --git a/addons/im/static/src/audio/Ting.ogg b/addons/im/static/src/audio/Ting.ogg Binary files differindex 8d17ea85bd3..74ee13a4e5a 100644 --- a/addons/im/static/src/audio/Ting.ogg +++ b/addons/im/static/src/audio/Ting.ogg diff --git a/addons/im/static/src/js/im.js b/addons/im/static/src/js/im.js index b21a339cb84..a271c9eccf0 100644 --- a/addons/im/static/src/js/im.js +++ b/addons/im/static/src/js/im.js @@ -284,6 +284,10 @@ openerp.im = function(instance) { return this.activated; }, create_ting: function() { + if (typeof(Audio) === "undefined") { + this.ting = {play: function() {}}; + return; + } var kitten = jQuery.param !== undefined && jQuery.deparam(jQuery.param.querystring()).kitten !== undefined; this.ting = new Audio(instance.webclient.session.origin + "/im/static/src/audio/" + (kitten ? "purr" : "Ting") + (new Audio().canPlayType("audio/ogg; codecs=vorbis") ? ".ogg" : ".mp3")); @@ -408,6 +412,9 @@ openerp.im = function(instance) { return; } var mes = this.$("input").val(); + if (! mes.trim()) { + return; + } this.$("input").val(""); var send_it = _.bind(function() { var model = new instance.web.Model("im.message"); diff --git a/addons/im/watcher.py b/addons/im/watcher.py new file mode 100644 index 00000000000..b8cb74df5ba --- /dev/null +++ b/addons/im/watcher.py @@ -0,0 +1,84 @@ + +import openerp +import openerp.tools.config +import openerp.modules.registry +from openerp.tools.misc import DEFAULT_SERVER_DATETIME_FORMAT +import datetime +from openerp.osv import osv, fields +import time +import logging +import json +import select +import gevent +import gevent.event +from openerp.addons.im.im import * + +_logger = logging.getLogger(__name__) + +class ImWatcher(object): + watchers = {} + + @staticmethod + def get_watcher(db_name): + if not ImWatcher.watchers.get(db_name): + ImWatcher(db_name) + return ImWatcher.watchers[db_name] + + def __init__(self, db_name): + self.db_name = db_name + ImWatcher.watchers[db_name] = self + self.waiting = 0 + self.wait_id = 0 + self.users = {} + self.users_watch = {} + gevent.spawn(self.loop) + + def loop(self): + _logger.info("Begin watching on channel im_channel for database " + self.db_name) + stop = False + while not stop: + try: + registry = openerp.modules.registry.RegistryManager.get(self.db_name) + with registry.cursor() as cr: + listen_channel(cr, "im_channel", self.handle_message, self.check_stop) + stop = True + except: + # if something crash, we wait some time then try again + _logger.exception("Exception during watcher activity") + time.sleep(WATCHER_ERROR_DELAY) + _logger.info("End watching on channel im_channel for database " + self.db_name) + del ImWatcher.watchers[self.db_name] + + def handle_message(self, message): + if message["type"] == "message": + for waiter in self.users.get(message["receiver"], {}).values(): + waiter.set() + else: #type status + for waiter in self.users_watch.get(message["user"], {}).values(): + waiter.set() + + def check_stop(self): + return self.waiting == 0 + + def _get_wait_id(self): + self.wait_id += 1 + return self.wait_id + + def stop(self, user_id, watch_users, timeout=None): + wait_id = self._get_wait_id() + event = gevent.event.Event() + self.waiting += 1 + self.users.setdefault(user_id, {})[wait_id] = event + for watch in watch_users: + self.users_watch.setdefault(watch, {})[wait_id] = event + try: + event.wait(timeout) + finally: + for watch in watch_users: + del self.users_watch[watch][wait_id] + if len(self.users_watch[watch]) == 0: + del self.users_watch[watch] + del self.users[user_id][wait_id] + if len(self.users[user_id]) == 0: + del self.users[user_id] + self.waiting -= 1 diff --git a/addons/im_livechat/security/ir.model.access.csv b/addons/im_livechat/security/ir.model.access.csv index 6e17c1a127f..0dcf0bdee6f 100644 --- a/addons/im_livechat/security/ir.model.access.csv +++ b/addons/im_livechat/security/ir.model.access.csv @@ -2,5 +2,7 @@ id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink access_ls_chann1,im_livechat.channel,model_im_livechat_channel,,1,0,0,0 access_ls_chann2,im_livechat.channel,model_im_livechat_channel,group_im_livechat,1,1,1,0 access_ls_chann3,im_livechat.channel,model_im_livechat_channel,group_im_livechat_manager,1,1,1,1 +access_ls_message_portal,im_livechat.im.message.portal,im.model_im_message,portal.group_portal,0,0,0,0 +access_im_user_portal,im_livechat.im.user.portal,im.model_im_user,portal.group_portal,1,0,0,0 access_ls_message,im_livechat.im.message,im.model_im_message,portal.group_anonymous,0,0,0,0 access_im_user,im_livechat.im.user,im.model_im_user,portal.group_anonymous,1,0,0,0
\ No newline at end of file diff --git a/addons/im_livechat/static/ext/static/audio/Ting.mp3 b/addons/im_livechat/static/ext/static/audio/Ting.mp3 Binary files differindex 6fd090a89ce..ffbb77144b2 100644 --- a/addons/im_livechat/static/ext/static/audio/Ting.mp3 +++ b/addons/im_livechat/static/ext/static/audio/Ting.mp3 diff --git a/addons/im_livechat/static/ext/static/audio/Ting.ogg b/addons/im_livechat/static/ext/static/audio/Ting.ogg Binary files differindex 8d17ea85bd3..74ee13a4e5a 100644 --- a/addons/im_livechat/static/ext/static/audio/Ting.ogg +++ b/addons/im_livechat/static/ext/static/audio/Ting.ogg diff --git a/addons/im_livechat/static/ext/static/js/livesupport.js b/addons/im_livechat/static/ext/static/js/livesupport.js index 0b9e52d2c07..c45e9588c83 100644 --- a/addons/im_livechat/static/ext/static/js/livesupport.js +++ b/addons/im_livechat/static/ext/static/js/livesupport.js @@ -268,6 +268,10 @@ define(["nova", "underscore", "oeclient", "require", "jquery", return this.activated; }, create_ting: function() { + if (typeof(Audio) === "undefined") { + this.ting = {play: function() {}}; + return; + } this.ting = new Audio(new Audio().canPlayType("audio/ogg; codecs=vorbis") ? require.toUrl("../audio/Ting.ogg") : require.toUrl("../audio/Ting.mp3") @@ -395,6 +399,9 @@ define(["nova", "underscore", "oeclient", "require", "jquery", return; } var mes = this.$("input").val(); + if (! mes.trim()) { + return; + } this.$("input").val(""); var send_it = _.bind(function() { var model = connection.getModel("im.message"); diff --git a/addons/l10n_be/wizard/l10n_be_account_vat_declaration.py b/addons/l10n_be/wizard/l10n_be_account_vat_declaration.py index b74cfa21b8a..0576e1d5f8f 100644 --- a/addons/l10n_be/wizard/l10n_be_account_vat_declaration.py +++ b/addons/l10n_be/wizard/l10n_be_account_vat_declaration.py @@ -84,7 +84,7 @@ class l10n_be_vat_declaration(osv.osv_memory): obj_company = obj_user.browse(cr, uid, uid, context=context).company_id vat_no = obj_company.partner_id.vat if not vat_no: - raise osv.except_osv(_('insufficient data!'), _('No VAT number associated with your company.')) + raise osv.except_osv(_('Insufficient Data!'), _('No VAT number associated with your company.')) vat_no = vat_no.replace(' ','').upper() vat = vat_no[2:] diff --git a/addons/l10n_be/wizard/l10n_be_partner_vat_listing.py b/addons/l10n_be/wizard/l10n_be_partner_vat_listing.py index 29a1a1508a4..0ffa0c16a24 100644 --- a/addons/l10n_be/wizard/l10n_be_partner_vat_listing.py +++ b/addons/l10n_be/wizard/l10n_be_partner_vat_listing.py @@ -60,12 +60,12 @@ class partner_vat(osv.osv_memory): company_id = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.id period_ids = obj_period.search(cr, uid, [('date_start' ,'>=', date_start), ('date_stop','<=',date_stop), ('company_id','=',company_id)]) if not period_ids: - raise osv.except_osv(_('insufficient data!'), _('No data for the selected year.')) + raise osv.except_osv(_('Insufficient Data!'), _('No data for the selected year.')) partners = [] partner_ids = obj_partner.search(cr, uid, [('vat_subjected', '!=', False), ('vat','ilike','BE%')], context=context) if not partner_ids: - raise osv.except_osv(_('Error'),_('No belgian contact with a VAT number in your database.')) + raise osv.except_osv(_('Error'),_('No belgium contact with a VAT number in your database.')) cr.execute("""SELECT sub1.partner_id, sub1.name, sub1.vat, sub1.turnover, sub2.vat_amount FROM (SELECT l.partner_id, p.name, p.vat, SUM(CASE WHEN c.code ='49' THEN -l.tax_amount ELSE l.tax_amount END) as turnover FROM account_move_line l @@ -90,7 +90,7 @@ class partner_vat(osv.osv_memory): partners.append(id_client) if not partners: - raise osv.except_osv(_('insufficient data!'), _('No data found for the selected year.')) + raise osv.except_osv(_('Insufficient Data!'), _('No data found for the selected year.')) context.update({'partner_ids': partners, 'year': data['year'], 'limit_amount': data['limit_amount']}) model_data_ids = obj_model_data.search(cr, uid, [('model','=','ir.ui.view'), ('name','=','view_vat_listing')]) resource_id = obj_model_data.read(cr, uid, model_data_ids, fields=['res_id'])[0]['res_id'] diff --git a/addons/l10n_be/wizard/l10n_be_vat_intra.py b/addons/l10n_be/wizard/l10n_be_vat_intra.py index 703ab9db59b..a572c3b83b4 100644 --- a/addons/l10n_be/wizard/l10n_be_vat_intra.py +++ b/addons/l10n_be/wizard/l10n_be_vat_intra.py @@ -108,7 +108,7 @@ class partner_vat_intra(osv.osv_memory): # Get Company vat company_vat = data_company.partner_id.vat if not company_vat: - raise osv.except_osv(_('insufficient data!'),_('No VAT number associated with your company.')) + raise osv.except_osv(_('Insufficient Data!'),_('No VAT number associated with your company.')) company_vat = company_vat.replace(' ','').upper() issued_by = company_vat[:2] @@ -120,7 +120,7 @@ class partner_vat_intra(osv.osv_memory): p_id_list = obj_partner.search(cr, uid, [('vat','!=',False)], context=context) if not p_id_list: - raise osv.except_osv(_('Insufficient Data!'),_('No partner has a VAT number asociated with him.')) + raise osv.except_osv(_('Insufficient Data!'),_('No partner has a VAT number associated with him.')) seq_declarantnum = obj_sequence.get(cr, uid, 'declarantnum') dnum = company_vat[2:] + seq_declarantnum[-4:] diff --git a/addons/l10n_ca/__openerp__.py b/addons/l10n_ca/__openerp__.py index 05279b6ef8e..945327a06bc 100644 --- a/addons/l10n_ca/__openerp__.py +++ b/addons/l10n_ca/__openerp__.py @@ -20,7 +20,7 @@ ############################################################################## { 'name': 'Canada - Accounting', - 'version': '1.0', + 'version': '1.1', 'author': 'Savoir-faire Linux', 'website': 'http://www.savoirfairelinux.com', 'category': 'Localization/Account Charts', @@ -49,7 +49,7 @@ Canadian accounting charts and localizations. 'account_chart_template_fr.xml', 'account_tax_fr.xml', 'fiscal_templates_fr.xml', - 'l10n_ca_wizard.xml', + 'l10n_ca_wizard.xml' ], 'demo': [], 'installable': True, diff --git a/addons/l10n_ca/account_tax_en.xml b/addons/l10n_ca/account_tax_en.xml index 1ff884ac361..afe505f27f5 100644 --- a/addons/l10n_ca/account_tax_en.xml +++ b/addons/l10n_ca/account_tax_en.xml @@ -12,7 +12,6 @@ <field name="description">GSTPST_MB_SALE</field> <field name="type_tax_use">sale</field> <field name="amount">1</field> - <field name="child_depend">1</field> <field name="type">percent</field> </record> @@ -39,7 +38,7 @@ <field name="name">PST for sales - 7%</field> <field name="description">PST</field> <field name="type_tax_use">sale</field> - <field name="amount">0.700000</field> + <field name="amount">0.070000</field> <field name="type">percent</field> <field name="sequence">2</field> <field name="account_collected_id" ref="chart2132_en"/> @@ -106,7 +105,6 @@ <field name="description">GSTTVQ_SALE</field> <field name="type_tax_use">sale</field> <field name="amount">1</field> - <field name="child_depend">1</field> <field name="type">percent</field> </record> @@ -152,7 +150,6 @@ <field name="description">GSTPST_SK_SALE</field> <field name="type_tax_use">sale</field> <field name="amount">1</field> - <field name="child_depend">1</field> <field name="type">percent</field> </record> @@ -281,7 +278,6 @@ <field name="description">GSTPST_MB_PURC</field> <field name="type_tax_use">purchase</field> <field name="amount">1</field> - <field name="child_depend">1</field> <field name="type">percent</field> </record> @@ -308,7 +304,7 @@ <field name="name">PST for purchases - 7%</field> <field name="description">PST</field> <field name="type_tax_use">purchase</field> - <field name="amount">0.700000</field> + <field name="amount">0.070000</field> <field name="type">percent</field> <field name="sequence">2</field> <field name="account_collected_id" ref="chart1182_en"/> @@ -375,7 +371,6 @@ <field name="description">GSTTVQ_PURC</field> <field name="type_tax_use">purchase</field> <field name="amount">1</field> - <field name="child_depend">1</field> <field name="type">percent</field> </record> @@ -421,7 +416,6 @@ <field name="description">GSTPST_SK_PURC</field> <field name="type_tax_use">purchase</field> <field name="amount">1</field> - <field name="child_depend">1</field> <field name="type">percent</field> </record> diff --git a/addons/l10n_ca/account_tax_fr.xml b/addons/l10n_ca/account_tax_fr.xml index b344feeec83..c34f329be3a 100644 --- a/addons/l10n_ca/account_tax_fr.xml +++ b/addons/l10n_ca/account_tax_fr.xml @@ -12,7 +12,6 @@ <field name="description">TPSTVP_MB_SALE</field> <field name="type_tax_use">sale</field> <field name="amount">1</field> - <field name="child_depend">1</field> <field name="type">percent</field> </record> @@ -39,7 +38,7 @@ <field name="name">TVP sur les ventes - 7%</field> <field name="description">TVP</field> <field name="type_tax_use">sale</field> - <field name="amount">0.700000</field> + <field name="amount">0.070000</field> <field name="type">percent</field> <field name="sequence">2</field> <field name="account_collected_id" ref="chart2132_fr"/> @@ -106,7 +105,6 @@ <field name="description">TPSTVQ_SALE</field> <field name="type_tax_use">sale</field> <field name="amount">1</field> - <field name="child_depend">1</field> <field name="type">percent</field> </record> @@ -152,7 +150,6 @@ <field name="description">TPSTVP_SK_SALE</field> <field name="type_tax_use">sale</field> <field name="amount">1</field> - <field name="child_depend">1</field> <field name="type">percent</field> </record> @@ -281,7 +278,6 @@ <field name="description">TPSTVP_MB_PURC</field> <field name="type_tax_use">purchase</field> <field name="amount">1</field> - <field name="child_depend">1</field> <field name="type">percent</field> </record> @@ -308,7 +304,7 @@ <field name="name">TVP sur les achats - 7%</field> <field name="description">TVP</field> <field name="type_tax_use">purchase</field> - <field name="amount">0.700000</field> + <field name="amount">0.070000</field> <field name="type">percent</field> <field name="sequence">2</field> <field name="account_collected_id" ref="chart1182_fr"/> @@ -375,7 +371,6 @@ <field name="description">TPSTVQ_PURC</field> <field name="type_tax_use">purchase</field> <field name="amount">1</field> - <field name="child_depend">1</field> <field name="type">percent</field> </record> @@ -421,7 +416,6 @@ <field name="description">TPSTVP_SK_PURC</field> <field name="type_tax_use">purchase</field> <field name="amount">1</field> - <field name="child_depend">1</field> <field name="type">percent</field> </record> diff --git a/addons/l10n_ca/fiscal_templates_en.xml b/addons/l10n_ca/fiscal_templates_en.xml index 68e881c3541..a3bab5b89dd 100644 --- a/addons/l10n_ca/fiscal_templates_en.xml +++ b/addons/l10n_ca/fiscal_templates_en.xml @@ -5,17 +5,17 @@ <!-- Fiscal Position Templates --> <record id="fiscal_position_template_1_en" model="account.fiscal.position.template"> - <field name="name">Provincial Regime</field> + <field name="name">Provincial Regime (PROV)</field> <field name="chart_template_id" ref="ca_en_chart_template_en"/> </record> <record id="fiscal_position_template_21_en" model="account.fiscal.position.template"> - <field name="name">Harmonized Provinces Regime (12%)</field> + <field name="name">Harmonized Provinces Regime (12%) (BC)</field> <field name="chart_template_id" ref="ca_en_chart_template_en"/> </record> <record id="fiscal_position_template_22_en" model="account.fiscal.position.template"> - <field name="name">Harmonized Provinces Regime (13%)</field> + <field name="name">Harmonized Provinces Regime (13%) (ON, NB, NL)</field> <field name="chart_template_id" ref="ca_en_chart_template_en"/> </record> @@ -25,17 +25,17 @@ </record> <record id="fiscal_position_template_24_en" model="account.fiscal.position.template"> - <field name="name">Harmonized Provinces Regime (15%)</field> + <field name="name">Harmonized Provinces Regime (15%) (NS)</field> <field name="chart_template_id" ref="ca_en_chart_template_en"/> </record> <record id="fiscal_position_template_3_en" model="account.fiscal.position.template"> - <field name="name">Non-Harmonized Provinces Regime</field> + <field name="name">Non-Harmonized Provinces Regime (AB, MB, SK, PE, NT, NU, YT)</field> <field name="chart_template_id" ref="ca_en_chart_template_en"/> </record> <record id="fiscal_position_template_4_en" model="account.fiscal.position.template"> - <field name="name">International Regime</field> + <field name="name">International Regime (INTL)</field> <field name="chart_template_id" ref="ca_en_chart_template_en"/> </record> diff --git a/addons/l10n_ca/fiscal_templates_fr.xml b/addons/l10n_ca/fiscal_templates_fr.xml index 3ba13d6642e..b01ab0985ea 100644 --- a/addons/l10n_ca/fiscal_templates_fr.xml +++ b/addons/l10n_ca/fiscal_templates_fr.xml @@ -5,7 +5,7 @@ <!-- Fiscal Position Templates --> <record id="fiscal_position_template_1_fr" model="account.fiscal.position.template"> - <field name="name">Régime Provincial</field> + <field name="name">Régime Provincial (PROV)</field> <field name="chart_template_id" ref="ca_fr_chart_template_fr"/> </record> @@ -30,12 +30,12 @@ </record> <record id="fiscal_position_template_3_fr" model="account.fiscal.position.template"> - <field name="name">Régime Provinces Non-Harmonisées</field> + <field name="name">Régime Provinces Non-Harmonisées (AB, MB, SK, PE, NT, NU, YT)</field> <field name="chart_template_id" ref="ca_fr_chart_template_fr"/> </record> <record id="fiscal_position_template_4_fr" model="account.fiscal.position.template"> - <field name="name">Régime International</field> + <field name="name">Régime International (INTL)</field> <field name="chart_template_id" ref="ca_fr_chart_template_fr"/> </record> diff --git a/addons/l10n_in_hr_payroll/l10n_in_hr_payroll.py b/addons/l10n_in_hr_payroll/l10n_in_hr_payroll.py index 348bb71c95e..fc715ece5b8 100644 --- a/addons/l10n_in_hr_payroll/l10n_in_hr_payroll.py +++ b/addons/l10n_in_hr_payroll/l10n_in_hr_payroll.py @@ -103,7 +103,7 @@ class payroll_advice(osv.osv): slip_ids = payslip_pool.search(cr, uid, [('date_from', '<=', advice.date), ('date_to', '>=', advice.date), ('state', '=', 'done')], context=context) for slip in payslip_pool.browse(cr, uid, slip_ids, context=context): if not slip.employee_id.bank_account_id and not slip.employee_id.bank_account_id.acc_number: - raise osv.except_osv(_('Error !'), _('Please define bank account for the %s employee') % (slip.employee_id.name)) + raise osv.except_osv(_('Error!'), _('Please define bank account for the %s employee') % (slip.employee_id.name)) line_ids = payslip_line_pool.search(cr, uid, [ ('slip_id', '=', slip.id), ('code', '=', 'NET')], context=context) if line_ids: line = payslip_line_pool.browse(cr, uid, line_ids, context=context)[0] @@ -129,7 +129,7 @@ class payroll_advice(osv.osv): seq_obj = self.pool.get('ir.sequence') for advice in self.browse(cr, uid, ids, context=context): if not advice.line_ids: - raise osv.except_osv(_('Error !'), _('You can not confirm Payment advice without advice lines.')) + raise osv.except_osv(_('Error!'), _('You can not confirm Payment advice without advice lines.')) advice_date = datetime.strptime(advice.date, DATETIME_FORMAT) advice_year = advice_date.strftime('%m') + '-' + advice_date.strftime('%Y') number = seq_obj.get(cr, uid, 'payment.advice') @@ -183,7 +183,7 @@ class hr_payslip_run(osv.osv): users = self.pool.get('res.users').browse(cr, uid, [uid], context=context) for run in self.browse(cr, uid, ids, context=context): if run.available_advice: - raise osv.except_osv(_('Error !'), _("Payment advice already exists for %s, 'Set to Draft' to create a new advice.") %(run.name)) + raise osv.except_osv(_('Error!'), _("Payment advice already exists for %s, 'Set to Draft' to create a new advice.") %(run.name)) advice_data = { 'batch_id': run.id, 'company_id': users[0].company_id.id, @@ -201,7 +201,7 @@ class hr_payslip_run(osv.osv): for slip in payslip_pool.browse(cr, uid, slip_ids, context=context): if not slip.employee_id.bank_account_id or not slip.employee_id.bank_account_id.acc_number: - raise osv.except_osv(_('Error !'), _('Please define bank account for the %s employee') % (slip.employee_id.name)) + raise osv.except_osv(_('Error!'), _('Please define bank account for the %s employee') % (slip.employee_id.name)) line_ids = payslip_line_pool.search(cr, uid, [('slip_id', '=', slip.id), ('code', '=', 'NET')], context=context) if line_ids: line = payslip_line_pool.browse(cr, uid, line_ids, context=context)[0] diff --git a/addons/l10n_it/__openerp__.py b/addons/l10n_it/__openerp__.py index 00ba19e9c42..686fb5ff0d4 100644 --- a/addons/l10n_it/__openerp__.py +++ b/addons/l10n_it/__openerp__.py @@ -29,7 +29,7 @@ { 'name': 'Italy - Accounting', - 'version': '0.1', + 'version': '0.2', 'depends': ['base_vat','account_chart','base_iban'], 'author': 'OpenERP Italian Community', 'description': """ diff --git a/addons/l10n_it/data/account.tax.code.template.csv b/addons/l10n_it/data/account.tax.code.template.csv index d6d6667f43b..e5435945556 100644 --- a/addons/l10n_it/data/account.tax.code.template.csv +++ b/addons/l10n_it/data/account.tax.code.template.csv @@ -1,28 +1,37 @@ code,id,name,parent_id:id ,vat_code_chart_root,Tassazione, IVC,template_ivacode_pagata,IVA a credito,vat_code_chart_root -IVC0,template_ivacode_pagata_0,Esente IVA (credito),template_ivacode_pagata +IVCN,template_ivacode_pagata_ind,IVA a credito indetraibile,vat_code_chart_root +IVC0,template_ivacode_pagata_0,Fuori Campo IVA (credito),template_ivacode_pagata IVCI,template_impcode_pagata,IVA a credito (imponibile),vat_code_chart_root -IVC0I,template_impcode_pagata_0,Esente IVA a credito (imponibile),template_impcode_pagata +IVC0I,template_impcode_pagata_0,Fuori Campo IVA (credito) (imponibile),template_impcode_pagata +IVCart15,template_ivacode_pagata_art15,Escluso Art.15 (credito),template_ivacode_pagata +IVCart15I,template_impcode_pagata_art15,Escluso Art.15. (credito) (imponibile),template_impcode_pagata IVC10,template_ivacode_pagata_10,IVA a credito 10%,template_ivacode_pagata IVC10I,template_impcode_pagata_10,IVA a credito 10% (imponibile),template_impcode_pagata -IVC10ind,template_ivacode_pagata_10ind,IVA a credito 10% indetraibile,template_ivacode_pagata +IVC10ind,template_ivacode_pagata_10ind,IVA a credito 10% indetraibile,template_ivacode_pagata_ind IVC10Iind,template_impcode_pagata_10ind,IVA a credito 10% indetraibile (imponibile),template_impcode_pagata -IVC20ind,template_ivacode_pagata_20ind,IVA a credito 20% indetraibile,template_ivacode_pagata +IVC20ind,template_ivacode_pagata_20ind,IVA a credito 20% indetraibile,template_ivacode_pagata_ind IVC20Iind,template_impcode_pagata_20ind,IVA a credito 20% indetraibile (imponibile),template_impcode_pagata -IVC4ind,template_ivacode_pagata_4ind,IVA a credito 4% indetraibile,template_ivacode_pagata +IVC4ind,template_ivacode_pagata_4ind,IVA a credito 4% indetraibile,template_ivacode_pagata_ind IVC4Iind,template_impcode_pagata_4ind,IVA a credito 4% indetraibile (imponibile),template_impcode_pagata IVC20det10,template_ivacode_pagata_20det10,IVA a credito 20% detraibile 10%,template_ivacode_pagata +IVC20Ndet10,template_ivacode_pagata_20det10ind,IVA a credito 20% detraibile 10% (indetraibile),template_ivacode_pagata_ind IVC20Idet10,template_impcode_pagata_20det10,IVA a credito 20% detraibile 10% (imponibile),template_impcode_pagata IVC20det15,template_ivacode_pagata_20det15,IVA a credito 20% detraibile 15%,template_ivacode_pagata +IVC20Ndet15,template_ivacode_pagata_20det15ind,IVA a credito 20% detraibile 15% (indetraibile),template_ivacode_pagata_ind IVC20Idet15,template_impcode_pagata_20det15,IVA a credito 20% detraibile 15% (imponibile),template_impcode_pagata IVC20det40,template_ivacode_pagata_20det40,IVA a credito 20% detraibile 40%,template_ivacode_pagata +IVC20Ndet40,template_ivacode_pagata_20det40ind,IVA a credito 20% detraibile 40% (indetraibile),template_ivacode_pagata_ind IVC20Idet40,template_impcode_pagata_20det40,IVA a credito 20% detraibile 40% (imponibile),template_impcode_pagata IVC20det50,template_ivacode_pagata_20det50,IVA a credito 20% detraibile 50%,template_ivacode_pagata +IVC20Ndet50,template_ivacode_pagata_20det50ind,IVA a credito 20% detraibile 50% (indetraibile),template_ivacode_pagata_ind IVC20Idet50,template_impcode_pagata_20det50,IVA a credito 20% detraibile 50% (imponibile),template_impcode_pagata IVC10det50,template_ivacode_pagata_10det50,IVA a credito 10% detraibile 50%,template_ivacode_pagata +IVC10Ndet50,template_ivacode_pagata_10det50ind,IVA a credito 10% detraibile 50% (indetraibile),template_ivacode_pagata_ind IVC10Idet50,template_impcode_pagata_10det50,IVA a credito 10% detraibile 50% (imponibile),template_impcode_pagata IVC4det50,template_ivacode_pagata_4det50,IVA a credito 4% detraibile 50%,template_ivacode_pagata +IVC4Ndet50,template_ivacode_pagata_4det50ind,IVA a credito 4% detraibile 50% (indetraibile),template_ivacode_pagata_ind IVC4Idet50,template_impcode_pagata_4det50,IVA a credito 4% detraibile 50% (imponibile),template_impcode_pagata IVC20,template_ivacode_pagata_20,IVA a credito 20%,template_ivacode_pagata IVC20I,template_impcode_pagata_20,IVA a credito 20% (imponibile),template_impcode_pagata @@ -35,9 +44,11 @@ IVC12I,template_impcode_pagata_12,IVA a credito 12% (imponibile),template_impco IVC2,template_ivacode_pagata_2,IVA a credito 2%,template_ivacode_pagata IVC2I,template_impcode_pagata_2,IVA a credito 2% (imponibile),template_impcode_pagata IVD,template_ivacode_riscossa,IVA a debito,vat_code_chart_root -IVD0,template_ivacode_riscossa_0,Esente IVA (debito),template_ivacode_riscossa +IVD0,template_ivacode_riscossa_0,Fuori Campo IVA (debito),template_ivacode_riscossa IVDI,template_impcode_riscossa,IVA a debito (imponibile),vat_code_chart_root -IVD0I,template_impcode_riscossa_0,Esente IVA a debito (imponibile),template_impcode_riscossa +IVD0I,template_impcode_riscossa_0,Fuori Campo IVA (debito) (imponibile),template_impcode_riscossa +IVDart15,template_ivacode_riscossa_art15,Escluso Art.15 (debito),template_ivacode_riscossa +IVDart15I,template_impcode_riscossa_art15,Escluso Art.15 (debito) (imponibile),template_impcode_riscossa IVD10,template_ivacode_riscossa_10,IVA a debito 10%,template_ivacode_riscossa IVD10I,template_impcode_riscossa_10,IVA a debito 10% (imponibile),template_impcode_riscossa IVD20,template_ivacode_riscossa_20,IVA a debito 20%,template_ivacode_riscossa @@ -50,13 +61,17 @@ IVD12,template_ivacode_riscossa_12,IVA a debito 12%,template_ivacode_riscossa IVD12I,template_impcode_riscossa_12,IVA a debito 12% (imponibile),template_impcode_riscossa IVD2,template_ivacode_riscossa_2,IVA a debito 2%,template_ivacode_riscossa IVD2I,template_impcode_riscossa_2,IVA a debito 2% (imponibile),template_impcode_riscossa -IVC21ind,template_ivacode_pagata_21ind,IVA a credito 21% indetraibile,template_ivacode_pagata +IVC21ind,template_ivacode_pagata_21ind,IVA a credito 21% indetraibile,template_ivacode_pagata_ind IVC21Iind,template_impcode_pagata_21ind,IVA a credito 21% indetraibile (imponibile),template_impcode_pagata IVC21det10,template_ivacode_pagata_21det10,IVA a credito 21% detraibile 10%,template_ivacode_pagata +IVC21Ndet10,template_ivacode_pagata_21det10ind,IVA a credito 21% detraibile 10% (indetraibile),template_ivacode_pagata_ind IVC21Idet10,template_impcode_pagata_21det10,IVA a credito 21% detraibile 10% (imponibile),template_impcode_pagata IVC21det15,template_ivacode_pagata_21det15,IVA a credito 21% detraibile 15%,template_ivacode_pagata +IVC21Ndet15,template_ivacode_pagata_21det15ind,IVA a credito 21% detraibile 15% (indetraibile),template_ivacode_pagata_ind IVC21Idet15,template_impcode_pagata_21det15,IVA a credito 21% detraibile 15% (imponibile),template_impcode_pagata IVC21det40,template_ivacode_pagata_21det40,IVA a credito 21% detraibile 40%,template_ivacode_pagata +IVC21Ndet40,template_ivacode_pagata_21det40ind,IVA a credito 21% detraibile 40% (indetraibile),template_ivacode_pagata_ind IVC21Idet40,template_impcode_pagata_21det40,IVA a credito 21% detraibile 40% (imponibile),template_impcode_pagata IVC21det50,template_ivacode_pagata_21det50,IVA a credito 21% detraibile 50%,template_ivacode_pagata +IVC21Ndet50,template_ivacode_pagata_21det50ind,IVA a credito 21% detraibile 50% (indetraibile),template_ivacode_pagata_ind IVC21Idet50,template_impcode_pagata_21det50,IVA a credito 21% detraibile 50% (imponibile),template_impcode_pagata diff --git a/addons/l10n_it/data/account.tax.template.csv b/addons/l10n_it/data/account.tax.template.csv index e003afd1a23..5654b32e5e9 100644 --- a/addons/l10n_it/data/account.tax.template.csv +++ b/addons/l10n_it/data/account.tax.template.csv @@ -1,71 +1,66 @@ id,description,chart_template_id:id,name,sequence,amount,parent_id:id,child_depend,type,account_collected_id:id,account_paid_id:id,type_tax_use,base_code_id:id,tax_code_id:id,ref_base_code_id:id,ref_tax_code_id:id,ref_base_sign,ref_tax_sign,price_include,base_sign,tax_sign -21a,21a,l10n_it_chart_template_generic,Iva al 21% (debito),,0.21,,False,percent,2601,2601,sale,template_impcode_riscossa_21,template_ivacode_riscossa_21,template_impcode_riscossa_21,template_ivacode_riscossa_21,-1,-1,False,, -21b,21b,l10n_it_chart_template_generic,Iva al 21% (credito),,0.21,,False,percent,1601,1601,purchase,template_impcode_pagata_21,template_ivacode_pagata_21,template_impcode_pagata_21,template_ivacode_pagata_21,,,False,-1,-1 -20a,20a,l10n_it_chart_template_generic,Iva al 20% (debito),,0.2,,False,percent,2601,2601,sale,template_impcode_riscossa_20,template_ivacode_riscossa_20,template_impcode_riscossa_20,template_ivacode_riscossa_20,-1,-1,False,, -20b,20b,l10n_it_chart_template_generic,Iva al 20% (credito),,0.2,,False,percent,1601,1601,purchase,template_impcode_pagata_20,template_ivacode_pagata_20,template_impcode_pagata_20,template_ivacode_pagata_20,,,False,-1,-1 -10a,10a,l10n_it_chart_template_generic,Iva al 10% (debito),,0.1,,False,percent,2601,2601,sale,template_impcode_riscossa_10,template_ivacode_riscossa_10,template_impcode_riscossa_10,template_ivacode_riscossa_10,-1,-1,False,, -10b,10b,l10n_it_chart_template_generic,Iva al 10% (credito),,0.1,,False,percent,1601,1601,purchase,template_impcode_pagata_10,template_ivacode_pagata_10,template_impcode_pagata_10,template_ivacode_pagata_10,,,False,-1,-1 -10AO,10AO,l10n_it_chart_template_generic,Iva al 10% indetraibile,,0.1,,True,percent,,,purchase,template_impcode_pagata_10ind,,template_impcode_pagata_10ind,,,,False,-1,-1 -10AOa,10AOa,l10n_it_chart_template_generic,Iva al 10% indetraibile (D),2,0,10AO,False,balance,1601,1601,purchase,,template_ivacode_pagata_10ind,,template_ivacode_pagata_10ind,,,False,, -10AOb,10AOb,l10n_it_chart_template_generic,Iva al 10% indetraibile (I),1,1,10AO,False,percent,,,purchase,,,,,,,False,, -12a,12a,l10n_it_chart_template_generic,Iva 12% (debito),,0.12,,False,percent,2601,2601,sale,template_impcode_riscossa_12,template_ivacode_riscossa_12,template_impcode_riscossa_12,template_ivacode_riscossa_12,-1,-1,False,, -12b,12b,l10n_it_chart_template_generic,Iva 12% (credito),,0.12,,False,percent,1601,1601,purchase,template_impcode_pagata_12,template_ivacode_pagata_12,template_impcode_pagata_12,template_ivacode_pagata_12,,,False,-1,-1 -2010,2010,l10n_it_chart_template_generic,Iva al 20% detraibile 10%,,0.2,,True,percent,,,purchase,template_impcode_pagata_20det10,,template_impcode_pagata_20det10,,,,False,-1,-1 -2010a,2010a,l10n_it_chart_template_generic,Iva al 20% detraibile 10% (D),2,0,2010,False,balance,1601,1601,purchase,,template_ivacode_pagata_20det10,,template_ivacode_pagata_20det10,,,False,, -2010b,2010b,l10n_it_chart_template_generic,Iva al 20% detraibile 10% (I),1,0.9,2010,False,percent,,,purchase,,,,,,,False,, -2015,2015,l10n_it_chart_template_generic,Iva al 20% detraibile 15%,,0.2,,True,percent,,,purchase,template_impcode_pagata_20det15,,template_impcode_pagata_20det15,,,,False,-1,-1 -2015a,2015a,l10n_it_chart_template_generic,Iva al 20% detraibile 15% (D),2,0,2015,False,balance,1601,1601,purchase,,template_ivacode_pagata_20det15,,template_ivacode_pagata_20det15,,,False,, -2015b,2015b,l10n_it_chart_template_generic,Iva al 20% detraibile 15% (I),1,0.85,2015,False,percent,,,purchase,,,,,,,False,, -2040,2040,l10n_it_chart_template_generic,Iva al 20% detraibile 40%,,0.2,,True,percent,,,purchase,template_impcode_pagata_20det40,,template_impcode_pagata_20det40,,,,False,-1,-1 -2040a,2040a,l10n_it_chart_template_generic,Iva al 20% detraibile 40% (D),2,0,2040,False,balance,1601,1601,purchase,,template_ivacode_pagata_20det40,,template_ivacode_pagata_20det40,,,False,, -2040b,2040b,l10n_it_chart_template_generic,Iva al 20% detraibile 40% (I),1,0.6,2040,False,percent,,,purchase,,,,,,,False,, -20AO,20AO,l10n_it_chart_template_generic,Iva al 20% indetraibile,,0.2,,True,percent,,,purchase,template_impcode_pagata_20ind,,template_impcode_pagata_20ind,,,,False,-1,-1 -20AOa,20AOa,l10n_it_chart_template_generic,Iva al 20% indetraibile (D),2,0,20AO,False,balance,1601,1601,purchase,,template_ivacode_pagata_20ind,,template_ivacode_pagata_20ind,,,False,, -20AOb,20AOb,l10n_it_chart_template_generic,Iva al 20% indetraibile (I),1,1,20AO,False,percent,,,purchase,,,,,,,False,, -20I5,20I5,l10n_it_chart_template_generic,IVA al 20% detraibile al 50%,,0.2,,True,percent,,,purchase,template_impcode_pagata_20det50,,template_impcode_pagata_20det50,,,,False,-1,-1 -20I5b,20I5b,l10n_it_chart_template_generic,IVA al 20% detraibile al 50% (I),1,0.5,20I5,False,percent,,,purchase,,,,,,,False,, -20I5a,20I5a,l10n_it_chart_template_generic,IVA al 20% detraibile al 50% (D),2,0,20I5,False,balance,1601,1601,purchase,,template_ivacode_pagata_20det50,,template_ivacode_pagata_20det50,,,False,, -22a,22a,l10n_it_chart_template_generic,Iva 2% (debito),,0.02,,False,percent,2601,2601,sale,template_impcode_riscossa_2,template_ivacode_riscossa_2,template_impcode_riscossa_2,template_ivacode_riscossa_2,-1,-1,False,, -22b,22b,l10n_it_chart_template_generic,Iva 2% (credito),,0.02,,False,percent,1601,1601,purchase,template_impcode_pagata_2,template_ivacode_pagata_2,template_impcode_pagata_2,template_ivacode_pagata_2,,,False,-1,-1 -4a,4a,l10n_it_chart_template_generic,Iva 4% (debito),,0.04,,False,percent,2601,2601,sale,template_impcode_riscossa_4,template_ivacode_riscossa_4,template_impcode_riscossa_4,template_ivacode_riscossa_4,-1,-1,False,, -4b,4b,l10n_it_chart_template_generic,Iva 4% (credito),,0.04,,False,percent,1601,1601,purchase,template_impcode_pagata_4,template_ivacode_pagata_4,template_impcode_pagata_4,template_ivacode_pagata_4,,,False,-1,-1 -4AO,4AO,l10n_it_chart_template_generic,Iva al 4% indetraibile,,0.04,,True,percent,,,purchase,template_impcode_pagata_4ind,,template_impcode_pagata_4ind,,,,False,-1,-1 -4AOa,4AOa,l10n_it_chart_template_generic,Iva al 4% indetraibile (D),2,0,4AO,False,balance,1601,1601,purchase,,template_ivacode_pagata_4ind,,template_ivacode_pagata_4ind,,,False,, -4AOb,4AOb,l10n_it_chart_template_generic,Iva al 4% indetraibile (I),1,1,4AO,False,percent,,,purchase,,,,,,,False,, -10I5,10I5,l10n_it_chart_template_generic,IVA al 10% detraibile al 50%,,0.1,,True,percent,,,purchase,template_impcode_pagata_10det50,,template_impcode_pagata_10det50,,,,False,-1,-1 -10I5a,10I5a,l10n_it_chart_template_generic,IVA al 10% detraibile al 50% (D),2,0,10I5,False,balance,1601,1601,purchase,,template_ivacode_pagata_10det50,,template_ivacode_pagata_10det50,,,False,, -10I5b,10I5b,l10n_it_chart_template_generic,IVA al 10% detraibile al 50% (I),1,0.5,10I5,False,percent,,,purchase,,,,,,,False,, -4I5,4I5,l10n_it_chart_template_generic,IVA al 4% detraibile al 50%,,0.04,,True,percent,,,purchase,template_impcode_pagata_4det50,,template_impcode_pagata_4det50,,,,False,-1,-1 -4I5a,4I5a,l10n_it_chart_template_generic,IVA al 4% detraibile al 50% (D),2,0,4I5,False,balance,1601,1601,purchase,,template_ivacode_pagata_4det50,,template_ivacode_pagata_4det50,,,False,, -4I5b,4I5b,l10n_it_chart_template_generic,IVA al 4% detraibile al 50% (I),1,0.5,4I5,False,percent,,,purchase,,,,,,,False,, -00a,00a,l10n_it_chart_template_generic,Esente IVA (debito),,0,,False,percent,2601,2601,sale,template_impcode_riscossa_0,template_ivacode_riscossa_0,template_impcode_riscossa_0,template_ivacode_riscossa_0,-1,-1,False,, -00b,00b,l10n_it_chart_template_generic,Esente IVA (credito),,0,,False,percent,1601,1601,purchase,template_impcode_pagata_0,template_ivacode_pagata_0,template_impcode_pagata_0,template_ivacode_pagata_0,,,False,-1,-1 -21a INC,21a INC,l10n_it_chart_template_generic,Iva al 21% (debito) INC,,0.21,,False,percent,l10n_it.2601,l10n_it.2601,sale,l10n_it.template_impcode_riscossa_21,l10n_it.template_ivacode_riscossa_21,l10n_it.template_impcode_riscossa_21,l10n_it.template_ivacode_riscossa_21,-1,-1,True,, -21b INC,21b INC,l10n_it_chart_template_generic,Iva al 21% (credito) INC,,0.21,,False,percent,1601,1601,purchase,template_impcode_pagata_21,template_ivacode_pagata_21,template_impcode_pagata_21,template_ivacode_pagata_21,,,True,-1,-1 -20a INC,20a INC,l10n_it_chart_template_generic,Iva al 20% (debito) INC,,0.2,,False,percent,l10n_it.2601,l10n_it.2601,sale,l10n_it.template_impcode_riscossa_20,l10n_it.template_ivacode_riscossa_20,l10n_it.template_impcode_riscossa_20,l10n_it.template_ivacode_riscossa_20,-1,-1,True,, -20b INC,20b INC,l10n_it_chart_template_generic,Iva al 20% (credito) INC,,0.2,,False,percent,1601,1601,purchase,template_impcode_pagata_20,template_ivacode_pagata_20,template_impcode_pagata_20,template_ivacode_pagata_20,,,True,-1,-1 -10a INC,10a INC,l10n_it_chart_template_generic,Iva al 10% (debito) INC,,0.1,,False,percent,l10n_it.2601,l10n_it.2601,sale,l10n_it.template_impcode_riscossa_10,l10n_it.template_ivacode_riscossa_10,l10n_it.template_impcode_riscossa_10,l10n_it.template_ivacode_riscossa_10,-1,-1,True,, -10b INC,10b INC,l10n_it_chart_template_generic,Iva al 10% (credito) INC,,0.1,,False,percent,1601,1601,purchase,template_impcode_pagata_10,template_ivacode_pagata_10,template_impcode_pagata_10,template_ivacode_pagata_10,,,True,-1,-1 -12a INC,12a INC,l10n_it_chart_template_generic,Iva 12% (debito) INC,,0.12,,False,percent,l10n_it.2601,l10n_it.2601,sale,l10n_it.template_impcode_riscossa_12,l10n_it.template_ivacode_riscossa_12,l10n_it.template_impcode_riscossa_12,l10n_it.template_ivacode_riscossa_12,-1,-1,True,, -12b INC,12b INC,l10n_it_chart_template_generic,Iva 12% (credito) INC,,0.12,,False,percent,1601,1601,purchase,template_impcode_pagata_12,template_ivacode_pagata_12,template_impcode_pagata_12,template_ivacode_pagata_12,,,True,-1,-1 -22a INC,22a INC,l10n_it_chart_template_generic,Iva 2% (debito) INC,,0.02,,False,percent,l10n_it.2601,l10n_it.2601,sale,l10n_it.template_impcode_riscossa_2,l10n_it.template_ivacode_riscossa_2,l10n_it.template_impcode_riscossa_2,l10n_it.template_ivacode_riscossa_2,-1,-1,True,, -22b INC,22b INC,l10n_it_chart_template_generic,Iva 2% (credito) INC,,0.02,,False,percent,1601,1601,purchase,template_impcode_pagata_2,template_ivacode_pagata_2,template_impcode_pagata_2,template_ivacode_pagata_2,,,True,-1,-1 -4a INC,4a INC,l10n_it_chart_template_generic,Iva 4% (debito) INC,,0.04,,False,percent,l10n_it.2601,l10n_it.2601,sale,l10n_it.template_impcode_riscossa_4,l10n_it.template_ivacode_riscossa_4,l10n_it.template_impcode_riscossa_4,l10n_it.template_ivacode_riscossa_4,-1,-1,True,, -4b INC,4b INC,l10n_it_chart_template_generic,Iva 4% (credito) INC,,0.04,,False,percent,1601,1601,purchase,template_impcode_pagata_4,template_ivacode_pagata_4,template_impcode_pagata_4,template_ivacode_pagata_4,,,True,-1,-1 -00a INC,00a INC,l10n_it_chart_template_generic,Esente IVA (debito) INC,,0,,False,percent,l10n_it.2601,l10n_it.2601,sale,l10n_it.template_impcode_riscossa_0,l10n_it.template_ivacode_riscossa_0,l10n_it.template_impcode_riscossa_0,l10n_it.template_ivacode_riscossa_0,-1,-1,True,, -2110,2110,l10n_it_chart_template_generic,Iva al 21% detraibile 10%,,0.21,,True,percent,,,purchase,template_impcode_pagata_21det10,,template_impcode_pagata_21det10,,,,False,-1,-1 -2110a,2110a,l10n_it_chart_template_generic,Iva al 21% detraibile 10% (D),2,0,2110,False,balance,1601,1601,purchase,,template_ivacode_pagata_21det10,,template_ivacode_pagata_21det10,,,False,, -2110b,2110b,l10n_it_chart_template_generic,Iva al 21% detraibile 10% (I),1,0.9,2110,False,percent,,,purchase,,,,,,,False,, -2115,2115,l10n_it_chart_template_generic,Iva al 21% detraibile 15%,,0.21,,True,percent,,,purchase,template_impcode_pagata_21det15,,template_impcode_pagata_21det15,,,,False,-1,-1 -2115a,2115a,l10n_it_chart_template_generic,Iva al 21% detraibile 15% (D),2,0,2115,False,balance,1601,1601,purchase,,template_ivacode_pagata_21det15,,template_ivacode_pagata_21det15,,,False,, -2115b,2115b,l10n_it_chart_template_generic,Iva al 21% detraibile 15% (I),1,0.85,2115,False,percent,,,purchase,,,,,,,False,, -2140,2140,l10n_it_chart_template_generic,Iva al 21% detraibile 40%,,0.21,,True,percent,,,purchase,template_impcode_pagata_21det40,,template_impcode_pagata_21det40,,,,False,-1,-1 -2140a,2140a,l10n_it_chart_template_generic,Iva al 21% detraibile 40% (D),2,0,2140,False,balance,1601,1601,purchase,,template_ivacode_pagata_21det40,,template_ivacode_pagata_21det40,,,False,, -2140b,2140b,l10n_it_chart_template_generic,Iva al 21% detraibile 40% (I),1,0.6,2140,False,percent,,,purchase,,,,,,,False,, -21AO,21AO,l10n_it_chart_template_generic,Iva al 21% indetraibile,,0.21,,True,percent,,,purchase,template_impcode_pagata_21ind,,template_impcode_pagata_21ind,,,,False,-1,-1 -21AOa,21AOa,l10n_it_chart_template_generic,Iva al 21% indetraibile (D),2,0,21AO,False,balance,1601,1601,purchase,,template_ivacode_pagata_21ind,,template_ivacode_pagata_21ind,,,False,, -21AOb,21AOb,l10n_it_chart_template_generic,Iva al 21% indetraibile (I),1,1,21AO,False,percent,,,purchase,,,,,,,False,, -21I5,21I5,l10n_it_chart_template_generic,IVA al 21% detraibile al 50%,,0.21,,True,percent,,,purchase,template_impcode_pagata_21det50,,template_impcode_pagata_21det50,,,,False,-1,-1 -21I5b,21I5b,l10n_it_chart_template_generic,IVA al 21% detraibile al 50% (I),1,0.5,21I5,False,percent,,,purchase,,,,,,,False,, -21I5a,21I5a,l10n_it_chart_template_generic,IVA al 21% detraibile al 50% (D),2,0,21I5,False,balance,1601,1601,purchase,,template_ivacode_pagata_21det50,,template_ivacode_pagata_21det50,,,False,, - +21v,21v,l10n_it_chart_template_generic,Iva al 21% (debito),1,0.21,,False,percent,2601,2601,sale,template_impcode_riscossa_21,template_ivacode_riscossa_21,template_impcode_riscossa_21,template_ivacode_riscossa_21,-1,-1,False,1,1 +21a,21a,l10n_it_chart_template_generic,Iva al 21% (credito),2,0.21,,False,percent,1601,1601,purchase,template_impcode_pagata_21,template_ivacode_pagata_21,template_impcode_pagata_21,template_ivacode_pagata_21,1,1,False,-1,-1 +20v,20v,l10n_it_chart_template_generic,Iva al 20% (debito),3,0.2,,False,percent,2601,2601,sale,template_impcode_riscossa_20,template_ivacode_riscossa_20,template_impcode_riscossa_20,template_ivacode_riscossa_20,-1,-1,False,1,1 +20a,20a,l10n_it_chart_template_generic,Iva al 20% (credito),4,0.2,,False,percent,1601,1601,purchase,template_impcode_pagata_20,template_ivacode_pagata_20,template_impcode_pagata_20,template_ivacode_pagata_20,1,1,False,-1,-1 +10v,10v,l10n_it_chart_template_generic,Iva al 10% (debito),5,0.1,,False,percent,2601,2601,sale,template_impcode_riscossa_10,template_ivacode_riscossa_10,template_impcode_riscossa_10,template_ivacode_riscossa_10,-1,-1,False,1,1 +10a,10a,l10n_it_chart_template_generic,Iva al 10% (credito),6,0.1,,False,percent,1601,1601,purchase,template_impcode_pagata_10,template_ivacode_pagata_10,template_impcode_pagata_10,template_ivacode_pagata_10,1,1,False,-1,-1 +10AO,10AO,l10n_it_chart_template_generic,Iva al 10% indetraibile,7,0.1,,True,percent,,,purchase,template_impcode_pagata_10ind,,template_impcode_pagata_10ind,,1,1,False,-1,-1 +10AOb,10AOb,l10n_it_chart_template_generic,Iva al 10% indetraibile (D),200,0,10AO,False,balance,1601,1601,purchase,,template_ivacode_pagata_10,,template_ivacode_pagata_10,1,1,False,-1,-1 +10AOa,10AOa,l10n_it_chart_template_generic,Iva al 10% indetraibile (I),100,1,10AO,False,percent,,,purchase,,template_ivacode_pagata_10ind,,template_ivacode_pagata_10ind,1,1,False,-1,-1 +12v,12v,l10n_it_chart_template_generic,Iva 12% (debito),8,0.12,,False,percent,2601,2601,sale,template_impcode_riscossa_12,template_ivacode_riscossa_12,template_impcode_riscossa_12,template_ivacode_riscossa_12,-1,-1,False,1,1 +12a,12a,l10n_it_chart_template_generic,Iva 12% (credito),9,0.12,,False,percent,1601,1601,purchase,template_impcode_pagata_12,template_ivacode_pagata_12,template_impcode_pagata_12,template_ivacode_pagata_12,1,1,False,-1,-1 +2010,2010,l10n_it_chart_template_generic,Iva al 20% detraibile 10%,10,0.2,,True,percent,,,purchase,template_impcode_pagata_20det10,,template_impcode_pagata_20det10,,1,1,False,-1,-1 +2010b,2010b,l10n_it_chart_template_generic,Iva al 20% detraibile 10% (D),200,0,2010,False,balance,1601,1601,purchase,,template_ivacode_pagata_20det10,,template_ivacode_pagata_20det10,1,1,False,-1,-1 +2010a,2010a,l10n_it_chart_template_generic,Iva al 20% detraibile 10% (I),100,0.9,2010,False,percent,,,purchase,,template_ivacode_pagata_20det10ind,,template_ivacode_pagata_20det10ind,1,1,False,-1,-1 +2015,2015,l10n_it_chart_template_generic,Iva al 20% detraibile 15%,11,0.2,,True,percent,,,purchase,template_impcode_pagata_20det15,,template_impcode_pagata_20det15,,1,1,False,-1,-1 +2015b,2015b,l10n_it_chart_template_generic,Iva al 20% detraibile 15% (D),200,0,2015,False,balance,1601,1601,purchase,,template_ivacode_pagata_20det15,,template_ivacode_pagata_20det15,1,1,False,-1,-1 +2015a,2015a,l10n_it_chart_template_generic,Iva al 20% detraibile 15% (I),100,0.85,2015,False,percent,,,purchase,,template_ivacode_pagata_20det15ind,,template_ivacode_pagata_20det15ind,1,1,False,-1,-1 +2040,2040,l10n_it_chart_template_generic,Iva al 20% detraibile 40%,12,0.2,,True,percent,,,purchase,template_impcode_pagata_20det40,,template_impcode_pagata_20det40,,1,1,False,-1,-1 +2040b,2040b,l10n_it_chart_template_generic,Iva al 20% detraibile 40% (D),200,0,2040,False,balance,1601,1601,purchase,,template_ivacode_pagata_20det40,,template_ivacode_pagata_20det40,1,1,False,-1,-1 +2040a,2040a,l10n_it_chart_template_generic,Iva al 20% detraibile 40% (I),100,0.6,2040,False,percent,,,purchase,,template_ivacode_pagata_20det40ind,,template_ivacode_pagata_20det40ind,1,1,False,-1,-1 +20AO,20AO,l10n_it_chart_template_generic,Iva al 20% indetraibile,13,0.2,,True,percent,,,purchase,template_impcode_pagata_20ind,,template_impcode_pagata_20ind,,1,1,False,-1,-1 +20AOb,20AOb,l10n_it_chart_template_generic,Iva al 20% indetraibile (D),200,0,20AO,False,balance,1601,1601,purchase,,template_ivacode_pagata_20ind,,template_ivacode_pagata_20ind,1,1,False,-1,-1 +20AOa,20AOa,l10n_it_chart_template_generic,Iva al 20% indetraibile (I),100,1,20AO,False,percent,,,purchase,,template_ivacode_pagata_20ind,,template_ivacode_pagata_20ind,1,1,False,-1,-1 +20I5,20I5,l10n_it_chart_template_generic,IVA al 20% detraibile al 50%,14,0.2,,True,percent,,,purchase,template_impcode_pagata_20det50,,template_impcode_pagata_20det50,,1,1,False,-1,-1 +20I5b,20I5b,l10n_it_chart_template_generic,IVA al 20% detraibile al 50% (D),200,0,20I5,False,balance,1601,1601,purchase,,template_ivacode_pagata_20det50,,template_ivacode_pagata_20det50,1,1,False,-1,-1 +20I5a,20I5a,l10n_it_chart_template_generic,IVA al 20% detraibile al 50% (I),100,0.5,20I5,False,percent,,,purchase,,template_ivacode_pagata_20det50ind,,template_ivacode_pagata_20det50ind,1,1,False,-1,-1 +22v,22v,l10n_it_chart_template_generic,Iva 2% (debito),15,0.02,,False,percent,2601,2601,sale,template_impcode_riscossa_2,template_ivacode_riscossa_2,template_impcode_riscossa_2,template_ivacode_riscossa_2,-1,-1,False,1,1 +22a,22a,l10n_it_chart_template_generic,Iva 2% (credito),16,0.02,,False,percent,1601,1601,purchase,template_impcode_pagata_2,template_ivacode_pagata_2,template_impcode_pagata_2,template_ivacode_pagata_2,1,1,False,-1,-1 +4v,4v,l10n_it_chart_template_generic,Iva 4% (debito),17,0.04,,False,percent,2601,2601,sale,template_impcode_riscossa_4,template_ivacode_riscossa_4,template_impcode_riscossa_4,template_ivacode_riscossa_4,-1,-1,False,1,1 +4a,4a,l10n_it_chart_template_generic,Iva 4% (credito),18,0.04,,False,percent,1601,1601,purchase,template_impcode_pagata_4,template_ivacode_pagata_4,template_impcode_pagata_4,template_ivacode_pagata_4,1,1,False,-1,-1 +4AO,4AO,l10n_it_chart_template_generic,Iva al 4% indetraibile,19,0.04,,True,percent,,,purchase,template_impcode_pagata_4ind,,template_impcode_pagata_4ind,,1,1,False,-1,-1 +4AOb,4AOb,l10n_it_chart_template_generic,Iva al 4% indetraibile (D),200,0,4AO,False,balance,1601,1601,purchase,,template_ivacode_pagata_4ind,,template_ivacode_pagata_4ind,1,1,False,-1,-1 +4AOa,4AOa,l10n_it_chart_template_generic,Iva al 4% indetraibile (I),100,1,4AO,False,percent,,,purchase,,template_ivacode_pagata_4ind,,template_ivacode_pagata_4ind,1,1,False,-1,-1 +10I5,10I5,l10n_it_chart_template_generic,IVA al 10% detraibile al 50%,20,0.1,,True,percent,,,purchase,template_impcode_pagata_10det50,,template_impcode_pagata_10det50,,1,1,False,-1,-1 +10I5b,10I5b,l10n_it_chart_template_generic,IVA al 10% detraibile al 50% (D),200,0,10I5,False,balance,1601,1601,purchase,,template_ivacode_pagata_10det50,,template_ivacode_pagata_10det50,1,1,False,-1,-1 +10I5a,10I5a,l10n_it_chart_template_generic,IVA al 10% detraibile al 50% (I),100,0.5,10I5,False,percent,,,purchase,,template_ivacode_pagata_10det50ind,,template_ivacode_pagata_10det50ind,1,1,False,-1,-1 +4I5,4I5,l10n_it_chart_template_generic,IVA al 4% detraibile al 50%,21,0.04,,True,percent,,,purchase,template_impcode_pagata_4det50,,template_impcode_pagata_4det50,,1,1,False,-1,-1 +4I5b,4I5b,l10n_it_chart_template_generic,IVA al 4% detraibile al 50% (D),200,0,4I5,False,balance,1601,1601,purchase,,template_ivacode_pagata_4det50,,template_ivacode_pagata_4det50,1,1,False,-1,-1 +4I5a,4I5a,l10n_it_chart_template_generic,IVA al 4% detraibile al 50% (I),100,0.5,4I5,False,percent,,,purchase,,template_ivacode_pagata_4det50ind,,template_ivacode_pagata_4det50ind,1,1,False,-1,-1 +00v,00v,l10n_it_chart_template_generic,Fuori Campo IVA (debito),22,0,,False,percent,2601,2601,sale,template_impcode_riscossa_0,template_ivacode_riscossa_0,template_impcode_riscossa_0,template_ivacode_riscossa_0,-1,-1,False,1,1 +00a,00a,l10n_it_chart_template_generic,Fuori Campo IVA (credito),23,0,,False,percent,1601,1601,purchase,template_impcode_pagata_0,template_ivacode_pagata_0,template_impcode_pagata_0,template_ivacode_pagata_0,1,1,False,-1,-1 +00art15v,00art15v,l10n_it_chart_template_generic,Imponibile Escluso Art.15 (debito),22,0,,False,percent,2601,2601,sale,template_impcode_riscossa_art15,template_ivacode_riscossa_art15,template_impcode_riscossa_art15,template_ivacode_riscossa_art15,-1,-1,False,1,1 +00art15a,00art15a,l10n_it_chart_template_generic,Imponibile Escluso Art.15 (credito),23,0,,False,percent,1601,1601,purchase,template_impcode_pagata_art15,template_ivacode_pagata_art15,template_impcode_pagata_art15,template_ivacode_pagata_art15,1,1,False,-1,-1 +21v INC,21v INC,l10n_it_chart_template_generic,Iva al 21% (debito) INC,24,0.21,,False,percent,l10n_it.2601,l10n_it.2601,sale,l10n_it.template_impcode_riscossa_21,l10n_it.template_ivacode_riscossa_21,l10n_it.template_impcode_riscossa_21,l10n_it.template_ivacode_riscossa_21,-1,-1,True,1,1 +20v INC,20v INC,l10n_it_chart_template_generic,Iva al 20% (debito) INC,25,0.2,,False,percent,l10n_it.2601,l10n_it.2601,sale,l10n_it.template_impcode_riscossa_20,l10n_it.template_ivacode_riscossa_20,l10n_it.template_impcode_riscossa_20,l10n_it.template_ivacode_riscossa_20,-1,-1,True,1,1 +10v INC,10v INC,l10n_it_chart_template_generic,Iva al 10% (debito) INC,26,0.1,,False,percent,l10n_it.2601,l10n_it.2601,sale,l10n_it.template_impcode_riscossa_10,l10n_it.template_ivacode_riscossa_10,l10n_it.template_impcode_riscossa_10,l10n_it.template_ivacode_riscossa_10,-1,-1,True,1,1 +12v INC,12v INC,l10n_it_chart_template_generic,Iva 12% (debito) INC,27,0.12,,False,percent,l10n_it.2601,l10n_it.2601,sale,l10n_it.template_impcode_riscossa_12,l10n_it.template_ivacode_riscossa_12,l10n_it.template_impcode_riscossa_12,l10n_it.template_ivacode_riscossa_12,-1,-1,True,1,1 +22v INC,22v INC,l10n_it_chart_template_generic,Iva 2% (debito) INC,28,0.02,,False,percent,l10n_it.2601,l10n_it.2601,sale,l10n_it.template_impcode_riscossa_2,l10n_it.template_ivacode_riscossa_2,l10n_it.template_impcode_riscossa_2,l10n_it.template_ivacode_riscossa_2,-1,-1,True,1,1 +4v INC,4v INC,l10n_it_chart_template_generic,Iva 4% (debito) INC,29,0.04,,False,percent,l10n_it.2601,l10n_it.2601,sale,l10n_it.template_impcode_riscossa_4,l10n_it.template_ivacode_riscossa_4,l10n_it.template_impcode_riscossa_4,l10n_it.template_ivacode_riscossa_4,-1,-1,True,1,1 +00v INC,00v INC,l10n_it_chart_template_generic,Fuori Campo IVA (debito) INC,30,0,,False,percent,l10n_it.2601,l10n_it.2601,sale,l10n_it.template_impcode_riscossa_0,l10n_it.template_ivacode_riscossa_0,l10n_it.template_impcode_riscossa_0,l10n_it.template_ivacode_riscossa_0,-1,-1,True,1,1 +2110,2110,l10n_it_chart_template_generic,Iva al 21% detraibile 10%,31,0.21,,True,percent,,,purchase,template_impcode_pagata_21det10,,template_impcode_pagata_21det10,,1,1,False,-1,-1 +2110b,2110b,l10n_it_chart_template_generic,Iva al 21% detraibile 10% (D),200,0,2110,False,balance,1601,1601,purchase,,template_ivacode_pagata_21det10,,template_ivacode_pagata_21det10,1,1,False,-1,-1 +2110a,2110a,l10n_it_chart_template_generic,Iva al 21% detraibile 10% (I),100,0.9,2110,False,percent,,,purchase,,template_ivacode_pagata_21det10ind,,template_ivacode_pagata_21det10ind,1,1,False,-1,-1 +2115,2115,l10n_it_chart_template_generic,Iva al 21% detraibile 15%,32,0.21,,True,percent,,,purchase,template_impcode_pagata_21det15,,template_impcode_pagata_21det15,,1,1,False,-1,-1 +2115b,2115b,l10n_it_chart_template_generic,Iva al 21% detraibile 15% (D),200,0,2115,False,balance,1601,1601,purchase,,template_ivacode_pagata_21det15,,template_ivacode_pagata_21det15,1,1,False,-1,-1 +2115a,2115a,l10n_it_chart_template_generic,Iva al 21% detraibile 15% (I),100,0.85,2115,False,percent,,,purchase,,template_ivacode_pagata_21det15ind,,template_ivacode_pagata_21det15ind,1,1,False,-1,-1 +2140,2140,l10n_it_chart_template_generic,Iva al 21% detraibile 40%,33,0.21,,True,percent,,,purchase,template_impcode_pagata_21det40,,template_impcode_pagata_21det40,,1,1,False,-1,-1 +2140b,2140b,l10n_it_chart_template_generic,Iva al 21% detraibile 40% (D),200,0,2140,False,balance,1601,1601,purchase,,template_ivacode_pagata_21det40,,template_ivacode_pagata_21det40,1,1,False,-1,-1 +2140a,2140a,l10n_it_chart_template_generic,Iva al 21% detraibile 40% (I),100,0.6,2140,False,percent,,,purchase,,template_ivacode_pagata_21det40ind,,template_ivacode_pagata_21det40ind,1,1,False,-1,-1 +21AO,21AO,l10n_it_chart_template_generic,Iva al 21% indetraibile,34,0.21,,True,percent,,,purchase,template_impcode_pagata_21ind,,template_impcode_pagata_21ind,,1,1,False,-1,-1 +21AOb,21AOb,l10n_it_chart_template_generic,Iva al 21% indetraibile (D),200,0,21AO,False,balance,1601,1601,purchase,,template_ivacode_pagata_21ind,,template_ivacode_pagata_21ind,1,1,False,-1,-1 +21AOa,21AOa,l10n_it_chart_template_generic,Iva al 21% indetraibile (I),100,1,21AO,False,percent,,,purchase,,template_ivacode_pagata_21ind,,template_ivacode_pagata_21ind,1,1,False,-1,-1 +21I5,21I5,l10n_it_chart_template_generic,IVA al 21% detraibile al 50%,35,0.21,,True,percent,,,purchase,template_impcode_pagata_21det50,,template_impcode_pagata_21det50,,1,1,False,-1,-1 +21I5b,21I5b,l10n_it_chart_template_generic,IVA al 21% detraibile al 50% (D),200,0,21I5,False,balance,1601,1601,purchase,,template_ivacode_pagata_21det50,,template_ivacode_pagata_21det50,1,1,False,-1,-1 +21I5a,21I5a,l10n_it_chart_template_generic,IVA al 21% detraibile al 50% (I),100,0.5,21I5,False,percent,,,purchase,,template_ivacode_pagata_21det50ind,,template_ivacode_pagata_21det50ind,1,1,False,-1,-1 diff --git a/addons/l10n_lu/account_financial_report.xml b/addons/l10n_lu/account_financial_report.xml index b39b0ceb15f..62a7a8c8d7e 100644 --- a/addons/l10n_lu/account_financial_report.xml +++ b/addons/l10n_lu/account_financial_report.xml @@ -84,7 +84,7 @@ </record> <record model="account.financial.report" id="account_financial_report_23"> - <field name="name">2. Concessions, brevets, licences, marques, ainsi que droits et valeurs similaires s’ils ont été</field> + <field name="name">2. Concessions, brevets, licences, marques, ainsi que droits et valeurs similaires s’ils ont été</field> <field name="sequence">115</field> <field name="sign" eval="1"/> <field name="display_detail">detail_flat</field> @@ -256,7 +256,7 @@ </record> <record model="account.financial.report" id="account_financial_report_42"> - <field name="name">I. Stocks </field> + <field name="name">I. Stocks</field> <field name="sequence">153</field> <field name="sign" eval="1"/> <field name="display_detail">detail_flat</field> @@ -292,7 +292,7 @@ </record> <record model="account.financial.report" id="account_financial_report_46"> - <field name="name">4. Acomptes versés </field> + <field name="name">4. Acomptes versés</field> <field name="sequence">161</field> <field name="sign" eval="1"/> <field name="display_detail">no_detail</field> @@ -301,7 +301,7 @@ </record> <record model="account.financial.report" id="account_financial_report_47"> - <field name="name">II. Créances </field> + <field name="name">II. Créances</field> <field name="sequence">163</field> <field name="sign" eval="1"/> <field name="display_detail">detail_flat</field> @@ -364,7 +364,7 @@ </record> <record model="account.financial.report" id="account_financial_report_54"> - <field name="name">3. Créances sur des entreprises avec lesquelles la société a un</field> + <field name="name">3. Créances sur des entreprises avec lesquelles la société a un lien de participation</field> <field name="sequence">177</field> <field name="sign" eval="1"/> <field name="display_detail">detail_flat</field> @@ -436,7 +436,7 @@ </record> <record model="account.financial.report" id="account_financial_report_62"> - <field name="name">2. Actions propres ou parts propres </field> + <field name="name">2. Actions propres ou parts propres</field> <field name="sequence">193</field> <field name="sign" eval="1"/> <field name="display_detail">no_detail</field> @@ -445,7 +445,7 @@ </record> <record model="account.financial.report" id="account_financial_report_63"> - <field name="name">3. Autres valeurs mobilières </field> + <field name="name">3. Autres valeurs mobilières</field> <field name="sequence">195</field> <field name="sign" eval="1"/> <field name="display_detail">no_detail</field> @@ -963,7 +963,7 @@ </record> <record model="account.financial.report" id="account_financial_report_119"> - <field name="name">CHARGES</field> + <field name="name">A. CHARGES</field> <field name="sequence">641</field> <field name="sign" eval="1"/> <field name="display_detail">detail_flat</field> @@ -972,7 +972,7 @@ </record> <record model="account.financial.report" id="account_financial_report_120"> - <field name="name">1. Consommation de marchandises et de matières premières et consommables</field> + <field name="name">1. Consommation de marchandises et de matières premières et consommables</field> <field name="sequence">601</field> <field name="sign" eval="1"/> <field name="display_detail">no_detail</field> @@ -1044,7 +1044,7 @@ </record> <record model="account.financial.report" id="account_financial_report_128"> - <field name="name">a) sur frais d'établissement et sur immobilisations corporelles</field> + <field name="name">a) sur frais d'établissement et sur immobilisations corporelles et incorporelles</field> <field name="sequence">617</field> <field name="sign" eval="1"/> <field name="display_detail">no_detail</field> @@ -1071,7 +1071,7 @@ </record> <record model="account.financial.report" id="account_financial_report_131"> - <field name="name">6. Corrections de valeur sur immobilisations financières et aj</field> + <field name="name">6. Corrections de valeur sur immobilisations financières et ajustement de juste valeur sur immobilisations financières</field> <field name="sequence">623</field> <field name="sign" eval="1"/> <field name="display_detail">no_detail</field> @@ -1080,7 +1080,7 @@ </record> <record model="account.financial.report" id="account_financial_report_132"> - <field name="name">7. Corrections de valeur et ajustement de juste valeur sur élém</field> + <field name="name">7. Corrections de valeur et ajustement de juste valeur sur éléments financiers de l'actif circulant. Moins-values de cessions des valeurs mobilières</field> <field name="sequence">625</field> <field name="sign" eval="1"/> <field name="display_detail">no_detail</field> @@ -1143,7 +1143,7 @@ </record> <record model="account.financial.report" id="account_financial_report_140"> - <field name="name">PRODUITS</field> + <field name="name">B. PRODUITS</field> <field name="sequence">737</field> <field name="sign" eval="-1"/> <field name="display_detail">detail_flat</field> @@ -1161,7 +1161,7 @@ </record> <record model="account.financial.report" id="account_financial_report_142"> - <field name="name">2. Variation des stocks de produits finis, et de produits et de commandes en cours</field> + <field name="name">2. Variation des stocks de produits finis, et de produits et de commandes en cours</field> <field name="sequence">703</field> <field name="sign" eval="-1"/> <field name="display_detail">no_detail</field> @@ -1188,7 +1188,7 @@ </record> <record model="account.financial.report" id="account_financial_report_145"> - <field name="name">a) sur frais d'établissement et sur immobilisations corporelles</field> + <field name="name">a) sur frais d'établissement et sur immobilisations corporelles et incorporelles</field> <field name="sequence">709</field> <field name="sign" eval="-1"/> <field name="display_detail">no_detail</field> diff --git a/addons/l10n_lu/wizard/print_vat.py b/addons/l10n_lu/wizard/print_vat.py index bfa058720d3..04d4fe9a3b7 100644 --- a/addons/l10n_lu/wizard/print_vat.py +++ b/addons/l10n_lu/wizard/print_vat.py @@ -64,7 +64,7 @@ class report_custom(report_int): self.obj.render() return (self.obj.pdf, 'pdf') except Exception: - raise osv.except_osv(_('pdf not created !'), _('Please check if package pdftk is installed!')) + raise osv.except_osv(_('PDF Not Created!'), _('Please check if package pdftk is installed!')) report_custom('report.l10n_lu.tax.report.print') diff --git a/addons/mail/mail_mail.py b/addons/mail/mail_mail.py index 7b2eff5e743..bd2b9c3f18a 100644 --- a/addons/mail/mail_mail.py +++ b/addons/mail/mail_mail.py @@ -27,6 +27,7 @@ from urlparse import urljoin from openerp import tools from openerp import SUPERUSER_ID +from openerp.addons.base.ir.ir_mail_server import MailDeliveryException from openerp.osv import fields, osv from openerp.tools.translate import _ @@ -59,9 +60,6 @@ class mail_mail(osv.Model): 'recipient_ids': fields.many2many('res.partner', string='To (Partners)'), 'email_cc': fields.char('Cc', help='Carbon copy message recipients'), 'body_html': fields.text('Rich-text Contents', help="Rich-text/HTML message"), - # If not set in create values, auto-detected based on create values (res_id, model, email_from) - 'reply_to': fields.char('Reply-To', - help='Preferred response address for the message'), # Auto-detected based on create() - if 'mail_message_id' was passed then this mail is a notification # and during unlink() we will not cascade delete the parent and its attachments 'notification': fields.boolean('Is Notification', @@ -292,7 +290,7 @@ class mail_mail(osv.Model): 'email_to': email_to, } - def send(self, cr, uid, ids, auto_commit=False, context=None): + def send(self, cr, uid, ids, auto_commit=False, raise_exception=False, context=None): """ Sends the selected emails immediately, ignoring their current state (mails that have already been sent should not be passed unless they should actually be re-sent). @@ -303,6 +301,8 @@ class mail_mail(osv.Model): :param bool auto_commit: whether to force a commit of the mail status after sending each mail (meant only for scheduler processing); should never be True during normal transactions (default: False) + :param bool raise_exception: whether to raise an exception if the + email sending process has failed :return: True """ ir_mail_server = self.pool.get('ir.mail_server') @@ -348,9 +348,16 @@ class mail_mail(osv.Model): # see revid:odo@openerp.com-20120622152536-42b2s28lvdv3odyr in 6.1 if mail_sent: self._postprocess_sent_message(cr, uid, mail, context=context) - except Exception: + except Exception as e: _logger.exception('failed sending mail.mail %s', mail.id) mail.write({'state': 'exception'}) + if raise_exception: + if isinstance(e, AssertionError): + # get the args of the original error, wrap into a value and throw a MailDeliveryException + # that is an except_orm, with name and value as arguments + value = '. '.join(e.args) + raise MailDeliveryException(_("Mail Delivery Failed"), value) + raise if auto_commit == True: cr.commit() diff --git a/addons/mail/mail_message.py b/addons/mail/mail_message.py index c30d00f5af7..252179614c6 100644 --- a/addons/mail/mail_message.py +++ b/addons/mail/mail_message.py @@ -158,6 +158,7 @@ class mail_message(osv.Model): 'author_id': fields.many2one('res.partner', 'Author', select=1, ondelete='set null', help="Author of the message. If not set, email_from may hold an email address that did not match any partner."), + 'author_avatar': fields.related('author_id', 'image_small', type="binary", string="Author's Avatar"), 'partner_ids': fields.many2many('res.partner', string='Recipients'), 'notified_partner_ids': fields.many2many('res.partner', 'mail_notification', 'message_id', 'partner_id', 'Notified partners', @@ -291,7 +292,7 @@ class mail_message(osv.Model): } if starred: values['read'] = False - + notif_ids = notification_obj.search(cr, uid, domain, context=context) # all message have notifications: already set them as (un)starred @@ -398,6 +399,7 @@ class mail_message(osv.Model): 'parent_id': parent_id, 'is_private': is_private, 'author_id': False, + 'author_avatar': message.author_avatar, 'is_author': False, 'partner_ids': [], 'vote_nb': vote_nb, @@ -528,7 +530,6 @@ class mail_message(osv.Model): message_unload_ids = message_unload_ids if message_unload_ids is not None else [] if message_unload_ids: domain += [('id', 'not in', message_unload_ids)] - notification_obj = self.pool.get('mail.notification') limit = limit or self._message_read_limit message_tree = {} message_list = [] @@ -738,12 +739,10 @@ class mail_message(osv.Model): for model, doc_dict in model_record_ids.items(): model_obj = self.pool[model] mids = model_obj.exists(cr, uid, doc_dict.keys()) - if operation in ['create', 'write', 'unlink']: - model_obj.check_access_rights(cr, uid, 'write') - model_obj.check_access_rule(cr, uid, mids, 'write', context=context) + if hasattr(model_obj, 'check_mail_message_access'): + model_obj.check_mail_message_access(cr, uid, mids, operation, context=context) else: - model_obj.check_access_rights(cr, uid, operation) - model_obj.check_access_rule(cr, uid, mids, operation, context=context) + self.pool['mail.thread'].check_mail_message_access(cr, uid, mids, operation, model_obj=model_obj, context=context) document_related_ids += [mid for mid, message in message_values.iteritems() if message.get('model') == model and message.get('res_id') in mids] diff --git a/addons/mail/mail_thread.py b/addons/mail/mail_thread.py index 80df8ad6e99..a46f416f44b 100644 --- a/addons/mail/mail_thread.py +++ b/addons/mail/mail_thread.py @@ -101,12 +101,16 @@ class mail_thread(osv.AbstractModel): if catchall_domain and model and res_id: # specific res_id -> find its alias (i.e. section_id specified) object_id = self.pool.get(model).browse(cr, uid, res_id, context=context) - alias = object_id.alias_id + # check that the alias effectively creates new records + if object_id.alias_id and object_id.alias_id.alias_model_id and \ + object_id.alias_id.alias_model_id.model == self._name and \ + object_id.alias_id.alias_force_thread_id == 0: + alias = object_id.alias_id elif catchall_domain and model: # no specific res_id given -> generic help message, take an example alias (i.e. alias of some section_id) model_id = self.pool.get('ir.model').search(cr, uid, [("model", "=", self._name)], context=context)[0] alias_obj = self.pool.get('mail.alias') - alias_ids = alias_obj.search(cr, uid, [("alias_model_id", "=", model_id)], context=context, limit=1, order='id ASC') - if alias_ids: + alias_ids = alias_obj.search(cr, uid, [("alias_model_id", "=", model_id), ('alias_force_thread_id', '=', 0)], context=context, order='id ASC') + if alias_ids and len(alias_ids) == 1: # if several aliases -> incoherent to propose one guessed from nowhere, therefore avoid if several aliases alias = alias_obj.browse(cr, uid, alias_ids[0], context=context) if alias: @@ -281,14 +285,21 @@ class mail_thread(osv.AbstractModel): context = {} thread_id = super(mail_thread, self).create(cr, uid, values, context=context) + # automatic logging unless asked not to (mainly for various testing purpose) + if not context.get('mail_create_nolog'): + self.message_post(cr, uid, thread_id, body=_('%s created') % (self._description), context=context) + # subscribe uid unless asked not to if not context.get('mail_create_nosubscribe'): self.message_subscribe_users(cr, uid, [thread_id], [uid], context=context) self.message_auto_subscribe(cr, uid, [thread_id], values.keys(), context=context) - # automatic logging unless asked not to (mainly for various testing purpose) - if not context.get('mail_create_nolog'): - self.message_post(cr, uid, thread_id, body=_('%s created') % (self._description), context=context) + # track values + tracked_fields = self._get_tracked_fields(cr, uid, values.keys(), context=context) + if tracked_fields: + initial_values = {thread_id: dict((item, False) for item in tracked_fields)} + self.message_track(cr, uid, [thread_id], tracked_fields, initial_values, context=context) + return thread_id def write(self, cr, uid, ids, values, context=None): @@ -449,6 +460,20 @@ class mail_thread(osv.AbstractModel): ir_attachment_obj.unlink(cr, uid, attach_ids, context=context) return True + def check_mail_message_access(self, cr, uid, mids, operation, model_obj=None, context=None): + """ mail.message check permission rules for related document. This method is + meant to be inherited in order to implement addons-specific behavior. + A common behavior would be to allow creating messages when having read + access rule on the document, for portal document such as issues. """ + if not model_obj: + model_obj = self + if operation in ['create', 'write', 'unlink']: + model_obj.check_access_rights(cr, uid, 'write') + model_obj.check_access_rule(cr, uid, mids, 'write', context=context) + else: + model_obj.check_access_rights(cr, uid, operation) + model_obj.check_access_rule(cr, uid, mids, operation, context=context) + def _get_formview_action(self, cr, uid, id, model=None, context=None): """ Return an action to open the document. This method is meant to be overridden in addons that want to give specific view ids for example. diff --git a/addons/mail/res_users_view.xml b/addons/mail/res_users_view.xml index f49ff72194a..1cacadfc898 100644 --- a/addons/mail/res_users_view.xml +++ b/addons/mail/res_users_view.xml @@ -26,7 +26,7 @@ <field name="signature" position="before"> <field name="notification_email_send"/> </field> - <field name="email" position="after"> + <field name="signature" position="before"> <field name="alias_domain" invisible="1"/> <field name="alias_id" readonly="1" required="0" attrs="{'invisible': [('alias_domain', '=', False)]}"/> </field> diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js index 8631bc70baa..7df6cdbef0d 100644 --- a/addons/mail/static/src/js/mail.js +++ b/addons/mail/static/src/js/mail.js @@ -219,6 +219,7 @@ openerp.mail = function (session) { this.type = datasets.type || false, this.subtype = datasets.subtype || false, this.is_author = datasets.is_author || false, + this.author_avatar = datasets.author_avatar || false, this.is_private = datasets.is_private || false, this.subject = datasets.subject || false, this.name = datasets.name || false, @@ -260,8 +261,10 @@ openerp.mail = function (session) { this.date = this.date ? session.web.str_to_datetime(this.date) : false; if (this.date && new Date().getTime()-this.date.getTime() < 7*24*60*60*1000) { this.timerelative = $.timeago(this.date); - } - if (this.type == 'email' && (!this.author_id || !this.author_id[0])) { + } + if (this.author_avatar) { + this.avatar = "data:image/png;base64," + this.author_avatar; + } else 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]); @@ -850,9 +853,9 @@ openerp.mail = function (session) { on_checked_recipient: function (event) { var $input = $(event.target); - var email = $input.attr("data"); + var full_name = $input.attr("data"); _.each(this.recipients, function (recipient) { - if (recipient.email_address == email) { + if (recipient.full_name == full_name) { recipient.checked = $input.is(":checked"); } }); diff --git a/addons/mail/static/src/xml/mail.xml b/addons/mail/static/src/xml/mail.xml index ab82d650f30..f5004941a8d 100644 --- a/addons/mail/static/src/xml/mail.xml +++ b/addons/mail/static/src/xml/mail.xml @@ -143,7 +143,7 @@ <div class="oe_recipients" t-if="!widget.is_log"> <t t-foreach='widget.recipients' t-as='recipient'> <label t-attf-title="Add as recipient and follower (reason: #{recipient.reason})"> - <input type="checkbox" t-att-checked="recipient.checked ? 'checked' : undefined" t-att-data="recipient.email_address"/> + <input type="checkbox" t-att-checked="recipient.checked ? 'checked' : undefined" t-att-data="recipient.full_name"/> <t t-raw="recipient.name"/> <t t-if="recipient.email_address">(<t t-raw="recipient.email_address"/>)</t> <t t-if="!recipient.email_address">(no email address)</t> diff --git a/addons/mail/tests/test_mail_gateway.py b/addons/mail/tests/test_mail_gateway.py index ee166b82dde..5615e22b2c2 100644 --- a/addons/mail/tests/test_mail_gateway.py +++ b/addons/mail/tests/test_mail_gateway.py @@ -147,6 +147,8 @@ class TestMailgateway(TestMailBase): self.assertEqual(mail.reply_to, 'other@example.com', 'mail_mail: reply_to should be equal to the one coming from creation values') # Do: create a mail_mail with the previous mail_message + self.mail_message.write(cr, uid, [msg_id], {'reply_to': 'custom@example.com'}) + msg.refresh() mail_id = self.mail_mail.create(cr, uid, {'mail_message_id': msg_id, 'state': 'cancel'}) mail = self.mail_mail.browse(cr, uid, mail_id) # Test: mail_mail content @@ -177,12 +179,15 @@ class TestMailgateway(TestMailBase): mail = self.mail_mail.browse(cr, uid, mail_id) # Test: mail_mail content self.assertEqual(mail.reply_to, msg.email_from, - 'mail_mail: reply_to should equal to mail_message.email_from when having no document or default alias') + 'mail_mail: reply_to should be equal to mail_message.email_from when having no document or default alias') # Data: set catchall domain self.registry('ir.config_parameter').set_param(cr, uid, 'mail.catchall.domain', 'schlouby.fr') self.registry('ir.config_parameter').unlink(cr, uid, self.registry('ir.config_parameter').search(cr, uid, [('key', '=', 'mail.catchall.alias')])) + # Update message + self.mail_message.write(cr, uid, [msg_id], {'email_from': False, 'reply_to': False}) + msg.refresh() # Do: create a mail_mail based on the previous mail_message mail_id = self.mail_mail.create(cr, uid, {'mail_message_id': msg_id, 'state': 'cancel'}) mail = self.mail_mail.browse(cr, uid, mail_id) @@ -191,7 +196,7 @@ class TestMailgateway(TestMailBase): 'mail_mail: reply_to should equal the mail.group alias') # Update message - self.mail_message.write(cr, uid, [msg_id], {'res_id': False, 'email_from': 'someone@schlouby.fr'}) + self.mail_message.write(cr, uid, [msg_id], {'res_id': False, 'email_from': 'someone@schlouby.fr', 'reply_to': False}) msg.refresh() # Do: create a mail_mail based on the previous mail_message mail_id = self.mail_mail.create(cr, uid, {'mail_message_id': msg_id, 'state': 'cancel'}) @@ -203,6 +208,9 @@ class TestMailgateway(TestMailBase): # Data: set catchall alias self.registry('ir.config_parameter').set_param(self.cr, self.uid, 'mail.catchall.alias', 'gateway') + # Update message + self.mail_message.write(cr, uid, [msg_id], {'email_from': False, 'reply_to': False}) + msg.refresh() # Do: create a mail_mail based on the previous mail_message mail_id = self.mail_mail.create(cr, uid, {'mail_message_id': msg_id, 'state': 'cancel'}) mail = self.mail_mail.browse(cr, uid, mail_id) diff --git a/addons/mail/wizard/mail_compose_message.py b/addons/mail/wizard/mail_compose_message.py index dfda3038de8..7bf4d47d1ff 100644 --- a/addons/mail/wizard/mail_compose_message.py +++ b/addons/mail/wizard/mail_compose_message.py @@ -270,6 +270,7 @@ class mail_compose_message(osv.TransientModel): context.pop('default_partner_ids', None) # post the message if mass_mail_mode and not wizard.post: + post_values['body_html'] = post_values.get('body', '') post_values['recipient_ids'] = [(4, id) for id in post_values.pop('partner_ids', [])] self.pool.get('mail.mail').create(cr, uid, post_values, context=context) else: diff --git a/addons/mrp/i18n/mn.po b/addons/mrp/i18n/mn.po index 39cc3d602cf..53f793c1804 100644 --- a/addons/mrp/i18n/mn.po +++ b/addons/mrp/i18n/mn.po @@ -14,7 +14,7 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2013-06-04 05:20+0000\n" +"X-Launchpad-Export-Date: 2013-06-05 05:32+0000\n" "X-Generator: Launchpad (build 16660)\n" #. module: mrp diff --git a/addons/mrp/procurement.py b/addons/mrp/procurement.py index 3ad7155dad6..6347e22d576 100644 --- a/addons/mrp/procurement.py +++ b/addons/mrp/procurement.py @@ -33,6 +33,11 @@ class procurement_order(osv.osv): 'production_id': fields.many2one('mrp.production', 'Manufacturing Order'), } + def _prepare_order_line_procurement(self, cr, uid, order, line, move_id, date_planned, context=None): + result = super(procurement_order, self)._prepare_order_line_procurement(cr, uid, order, line, move_id, date_planned, context) + result['property_ids'] = [(6, 0, [x.id for x in line.property_ids])] + return result + def check_produce_product(self, cr, uid, procurement, context=None): ''' Depict the capacity of the procurement workflow to produce products (not services)''' return True diff --git a/addons/mrp/report/order.rml b/addons/mrp/report/order.rml index 8833d08e596..f413a6cfc70 100644 --- a/addons/mrp/report/order.rml +++ b/addons/mrp/report/order.rml @@ -139,37 +139,18 @@ <initialize> <paraStyle name="all" alignment="justify"/> </initialize> - <paraStyle name="Standard" fontName="Helvetica"/> - <paraStyle name="Text body" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/> - <paraStyle name="Heading" fontName="Helvetica" fontSize="14.0" leading="17" spaceBefore="12.0" spaceAfter="6.0"/> - <paraStyle name="List" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/> - <paraStyle name="Table Contents" fontName="Helvetica"/> - <paraStyle name="Table Heading" fontName="Helvetica" alignment="CENTER"/> - <paraStyle name="Caption" fontName="Helvetica" fontSize="12.0" leading="15" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="Index" fontName="Helvetica"/> - <paraStyle name="Footer" fontName="Helvetica"/> - <paraStyle name="Horizontal Line" fontName="Helvetica" fontSize="6.0" leading="8" spaceBefore="0.0" spaceAfter="14.0"/> - <paraStyle name="terp_header" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/> - <paraStyle name="Heading 9" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" spaceBefore="12.0" spaceAfter="6.0"/> - <paraStyle name="terp_tblheader_General" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="terp_tblheader_Details" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="terp_default_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_Bold_8" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_tblheader_General_Centre" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="terp_tblheader_General_Right" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="terp_tblheader_Details_Centre" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="terp_tblheader_Details_Right" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="terp_default_Right_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_Centre_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_header_Right" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/> - <paraStyle name="terp_header_Centre" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="CENTER" spaceBefore="12.0" spaceAfter="6.0"/> - <paraStyle name="terp_default_address" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_Bold_9" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_Centre_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_Right_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_2" fontName="Helvetica" fontSize="2.0" leading="3" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_space" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="6.0" spaceAfter="0.0"/> + <paraStyle name="terp_header" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/> + <paraStyle name="terp_tblheader_Details" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/> + <paraStyle name="terp_default_8" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> + <paraStyle name="terp_default_Bold_8" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> + <paraStyle name="terp_tblheader_General_Centre" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/> + <paraStyle name="terp_tblheader_Details_Centre" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/> + <paraStyle name="terp_default_Centre_8" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/> + <paraStyle name="terp_default_9" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> + <paraStyle name="terp_default_Bold_9" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> + <paraStyle name="terp_default_Centre_9" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/> + <paraStyle name="terp_default_Right_9" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/> + <paraStyle name="terp_default_2" fontSize="2.0" leading="3" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> <images/> </stylesheet> <story> @@ -178,16 +159,16 @@ <blockTable colWidths="256.0,61.0,107.0,104.0" style="Table8"> <tr> <td> - <para style="terp_tblheader_Details">Product </para> + <para style="terp_tblheader_Details"><b>Product </b></para> </td> <td> - <para style="terp_tblheader_Details_Centre">Quantity</para> + <para style="terp_tblheader_Details_Centre"><b>Quantity</b></para> </td> <td> - <para style="terp_tblheader_Details_Centre">Source Location</para> + <para style="terp_tblheader_Details_Centre"><b>Source Location</b></para> </td> <td> - <para style="terp_tblheader_Details_Centre">Destination Location</para> + <para style="terp_tblheader_Details_Centre"><b>Destination Location</b></para> </td> </tr> </blockTable> @@ -196,20 +177,20 @@ <para style="terp_default_8"> <font color="white"> </font> </para> - <para style="terp_header">Production Order N° : [[ o.name ]]</para> + <para style="terp_header"><b>Production Order N° : [[ o.name ]]</b></para> <para style="terp_default_8"> <font color="white"> </font> </para> <blockTable colWidths="193.0,206.0,129.0" style="Table3"> <tr> <td> - <para style="terp_tblheader_General_Centre">Source Document</para> + <para style="terp_tblheader_General_Centre"><b>Source Document</b></para> </td> <td> - <para style="terp_tblheader_General_Centre">Product </para> + <para style="terp_tblheader_General_Centre"><b>Product </b></para> </td> <td> - <para style="terp_tblheader_General_Centre">Quantity</para> + <para style="terp_tblheader_General_Centre"><b>Quantity</b></para> </td> </tr> </blockTable> @@ -232,16 +213,16 @@ <blockTable colWidths="193.0,92.0,114.0,129.0" repeatRows="1" style="Table1"> <tr> <td> - <para style="terp_tblheader_General_Centre">Scheduled Date</para> + <para style="terp_tblheader_General_Centre"><b>Scheduled Date</b></para> </td> <td> - <para style="terp_tblheader_General_Centre">Printing date</para> + <para style="terp_tblheader_General_Centre"><b>Printing date</b></para> </td> <td> - <para style="terp_tblheader_General_Centre">Partner Ref</para> + <para style="terp_tblheader_General_Centre"><b>Partner Ref</b></para> </td> <td> - <para style="terp_tblheader_General_Centre">SO Number</para> + <para style="terp_tblheader_General_Centre"><b>SO Number</b></para> </td> </tr> </blockTable> @@ -266,26 +247,26 @@ <para style="terp_default_8"> <font color="white"> </font> </para> - <para style="terp_default_Bold_8">Work Orders [[ o.workcenter_lines ==[] and removeParentNode('para')]]</para> + <para style="terp_default_Bold_8"><b>Work Orders [[ o.workcenter_lines ==[] and removeParentNode('para')]]</b></para> <para style="terp_default_8"> <font color="white"> </font> </para> <blockTable colWidths="74.0,212.0,112.0,66.0,64.0" style="Table6"> <tr> <td> - <para style="terp_tblheader_General_Centre">Sequence</para> + <para style="terp_tblheader_General_Centre"><b>Sequence</b></para> </td> <td> - <para style="terp_tblheader_Details_Centre">Name [[ o.workcenter_lines ==[] and removeParentNode('blockTable')]]</para> + <para style="terp_tblheader_Details_Centre"><b>Name [[ o.workcenter_lines ==[] and removeParentNode('blockTable')]]</b></para> </td> <td> - <para style="terp_tblheader_General_Centre">WorkCenter</para> + <para style="terp_tblheader_General_Centre"><b>WorkCenter</b></para> </td> <td> - <para style="terp_tblheader_General_Centre">No. Of Cycles</para> + <para style="terp_tblheader_General_Centre"><b>No. Of Cycles</b></para> </td> <td> - <para style="terp_tblheader_General_Centre">No. Of Hours</para> + <para style="terp_tblheader_General_Centre"><b>No. Of Hours</b></para> </td> </tr> </blockTable> @@ -317,28 +298,28 @@ <para style="terp_default_8"> <font color="white"> </font> </para> - <para style="terp_default_Bold_9">Bill Of Material </para> + <para style="terp_default_Bold_9"><b>Bill Of Material </b></para> <para style="terp_default_8"> <font color="white"> </font> </para> <blockTable colWidths="256.0,61.0,107.0,104.0" style="Table8"> <tr> <td> - <para style="terp_tblheader_Details">Product </para> + <para style="terp_tblheader_Details"><b>Product </b></para> </td> <td> - <para style="terp_tblheader_Details_Centre">Quantity</para> + <para style="terp_tblheader_Details_Centre"><b>Quantity</b></para> </td> <td> - <para style="terp_tblheader_Details_Centre">Source Location</para> + <para style="terp_tblheader_Details_Centre"><b>Source Location</b></para> </td> <td> - <para style="terp_tblheader_Details_Centre">Destination Location</para> + <para style="terp_tblheader_Details_Centre"><b>Destination Location</b></para> </td> </tr> </blockTable> <section> - <para style="terp_default_Bold_9">Products to Consume [[ o.move_lines ==[] and removeParentNode('section')]]</para> + <para style="terp_default_Bold_9"><b>Products to Consume [[ o.move_lines ==[] and removeParentNode('section')]]</b></para> <section> <para style="terp_default_2">[[ repeatIn(o.move_lines,'line') ]]</para> <blockTable colWidths="250.0,65.0,108.0,104.0" style="Table9"> @@ -363,7 +344,7 @@ <para style="terp_default_Bold_9"> <font color="white"> </font> </para> - <para style="terp_default_Bold_9">Consumed Products [[ o.move_lines2 ==[] and removeParentNode('section')]]</para> + <para style="terp_default_Bold_9"><b>Consumed Products [[ o.move_lines2 ==[] and removeParentNode('section')]]</b></para> <section> <para style="terp_default_2">[[ repeatIn(o.move_lines2,'line2') ]]</para> <blockTable colWidths="251.0,66.0,106.0,104.0" style="Table10"> diff --git a/addons/mrp_operations/mrp_operations.py b/addons/mrp_operations/mrp_operations.py index d6f026530dc..87861ba8fc6 100644 --- a/addons/mrp_operations/mrp_operations.py +++ b/addons/mrp_operations/mrp_operations.py @@ -128,7 +128,7 @@ class mrp_production_workcenter_line(osv.osv): elif prod_obj.state =='in_production': return else: - raise osv.except_osv(_('Error!'),_('Manufacturing order cannot start in state "%s"!') % (prod_obj.state,)) + raise osv.except_osv(_('Error!'),_('Manufacturing order cannot be started in state "%s"!') % (prod_obj.state,)) else: oper_ids = self.search(cr,uid,[('production_id','=',prod_obj.id)]) obj = self.browse(cr,uid,oper_ids) @@ -443,7 +443,7 @@ class mrp_operations_operation(osv.osv): if not oper_objs: if code.start_stop!='start': - raise osv.except_osv(_('Sorry!'),_('Operation is not started yet !')) + raise osv.except_osv(_('Sorry!'),_('Operation is not started yet!')) return False else: for oper in oper_objs: diff --git a/addons/mrp_repair/mrp_repair.py b/addons/mrp_repair/mrp_repair.py index 43ee34b0c05..f7b082db74b 100644 --- a/addons/mrp_repair/mrp_repair.py +++ b/addons/mrp_repair/mrp_repair.py @@ -365,7 +365,7 @@ class mrp_repair(osv.osv): if repair.state in ('draft','cancel') or repair.invoice_id: continue if not (repair.partner_id.id and repair.partner_invoice_id.id): - raise osv.except_osv(_('No partner !'),_('You have to select a Partner Invoice Address in the repair form !')) + raise osv.except_osv(_('No partner!'),_('You have to select a Partner Invoice Address in the repair form!')) comment = repair.quotation_notes if (repair.invoice_method != 'none'): if group and repair.partner_invoice_id.id in invoices_group: @@ -582,7 +582,7 @@ class ProductChangeMixin(object): result['product_uom'] = product_obj.uom_id and product_obj.uom_id.id or False if not pricelist: warning = { - 'title':'No Pricelist !', + 'title':'No Pricelist!', 'message': 'You have to select a pricelist in the Repair form !\n' 'Please set one before choosing a product.' diff --git a/addons/multi_company/i18n/ru.po b/addons/multi_company/i18n/ru.po index 3dea680c371..e1665d9c838 100644 --- a/addons/multi_company/i18n/ru.po +++ b/addons/multi_company/i18n/ru.po @@ -8,14 +8,14 @@ msgstr "" "Project-Id-Version: openobject-addons\n" "Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n" "POT-Creation-Date: 2012-12-21 17:05+0000\n" -"PO-Revision-Date: 2012-08-17 11:09+0000\n" +"PO-Revision-Date: 2013-06-06 10:25+0000\n" "Last-Translator: Chertykov Denis <chertykov@gmail.com>\n" "Language-Team: Russian <ru@li.org>\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2013-03-16 05:36+0000\n" -"X-Generator: Launchpad (build 16532)\n" +"X-Launchpad-Export-Date: 2013-06-07 05:48+0000\n" +"X-Generator: Launchpad (build 16667)\n" #. module: multi_company #: model:ir.ui.menu,name:multi_company.menu_custom_multicompany @@ -45,6 +45,16 @@ msgid "" "Thank you in advance for your cooperation.\n" "Best Regards," msgstr "" +"Уважаемые господа,\n" +"\n" +"Наши записи зафиксировали что некоторые платежи остаются неоплаченными. " +"Пожалуйста ознакомьтесь с подробностями ниже.\n" +"Если сумма уже была оплачена, пожалуйста проигнорируйте это оповещение. В " +"ином случае, пожалуйста перечислите нам всю сумму отображенную ниже.\n" +"Если у вас есть какие-либо замечания, пожалуйста свяжитесь с нами.\n" +"\n" +"Заранее благодарим за сотрудничество.\n" +"С наилучшими пожеланиями," #. module: multi_company #: view:multi_company.default:0 diff --git a/addons/note/i18n/ru.po b/addons/note/i18n/ru.po new file mode 100644 index 00000000000..ef2cd6be0c1 --- /dev/null +++ b/addons/note/i18n/ru.po @@ -0,0 +1,286 @@ +# Russian translation for openobject-addons +# Copyright (c) 2013 Rosetta Contributors and Canonical Ltd 2013 +# This file is distributed under the same license as the openobject-addons package. +# FIRST AUTHOR <EMAIL@ADDRESS>, 2013. +# +msgid "" +msgstr "" +"Project-Id-Version: openobject-addons\n" +"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n" +"POT-Creation-Date: 2012-12-21 17:04+0000\n" +"PO-Revision-Date: 2013-06-06 10:35+0000\n" +"Last-Translator: Chertykov Denis <chertykov@gmail.com>\n" +"Language-Team: Russian <ru@li.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Launchpad-Export-Date: 2013-06-07 05:48+0000\n" +"X-Generator: Launchpad (build 16667)\n" + +#. module: note +#: field:note.note,memo:0 +msgid "Note Content" +msgstr "Содержание заметки" + +#. module: note +#: view:note.stage:0 +msgid "Stages of Notes" +msgstr "Этапы заметок" + +#. module: note +#: model:note.stage,name:note.demo_note_stage_04 +#: model:note.stage,name:note.note_stage_02 +msgid "This Week" +msgstr "Эта неделя" + +#. module: note +#: model:ir.model,name:note.model_base_config_settings +msgid "base.config.settings" +msgstr "base.config.settings" + +#. module: note +#: model:ir.model,name:note.model_note_tag +msgid "Note Tag" +msgstr "Тег заметки" + +#. module: note +#: model:res.groups,name:note.group_note_fancy +msgid "Notes / Fancy mode" +msgstr "" + +#. module: note +#: model:ir.model,name:note.model_note_note +#: view:note.note:0 +msgid "Note" +msgstr "Заметка" + +#. module: note +#: view:note.note:0 +msgid "Group By..." +msgstr "Группировать по ..." + +#. module: note +#: field:note.note,message_follower_ids:0 +msgid "Followers" +msgstr "Подписчики" + +#. module: note +#: model:ir.actions.act_window,help:note.action_note_note +msgid "" +"<p class=\"oe_view_nocontent_create\">\n" +" Click to add a personal note.\n" +" </p><p>\n" +" Use notes to organize personal tasks or notes. All\n" +" notes are private; no one else will be able to see them. " +"However\n" +" you can share some notes with other people by inviting " +"followers\n" +" on the note. (Useful for meeting minutes, especially if\n" +" you activate the pad feature for collaborative writings).\n" +" </p><p>\n" +" You can customize how you process your notes/tasks by adding,\n" +" removing or modifying columns.\n" +" </p>\n" +" " +msgstr "" + +#. module: note +#: model:note.stage,name:note.demo_note_stage_01 +#: model:note.stage,name:note.note_stage_01 +msgid "Today" +msgstr "Сегодня" + +#. module: note +#: model:ir.model,name:note.model_res_users +msgid "Users" +msgstr "Пользователи" + +#. module: note +#: view:note.note:0 +msgid "í" +msgstr "" + +#. module: note +#: view:note.stage:0 +msgid "Stage of Notes" +msgstr "Этап заметок" + +#. module: note +#: field:note.note,message_unread:0 +msgid "Unread Messages" +msgstr "Непрочитанные" + +#. module: note +#: field:note.note,current_partner_id:0 +msgid "unknown" +msgstr "неизвестно" + +#. module: note +#: view:note.note:0 +msgid "By sticky note Category" +msgstr "" + +#. module: note +#: help:note.note,message_unread:0 +msgid "If checked new messages require your attention." +msgstr "Если отмечено, новые сообщения требуют вашего внимания." + +#. module: note +#: field:note.stage,name:0 +msgid "Stage Name" +msgstr "Название этапа" + +#. module: note +#: field:note.note,message_is_follower:0 +msgid "Is a Follower" +msgstr "Подписан" + +#. module: note +#: model:note.stage,name:note.demo_note_stage_02 +msgid "Tomorrow" +msgstr "Завтра" + +#. module: note +#: view:note.note:0 +#: field:note.note,open:0 +msgid "Active" +msgstr "Активно" + +#. module: note +#: help:note.stage,user_id:0 +msgid "Owner of the note stage." +msgstr "Владелец этапа заметки" + +#. module: note +#: model:ir.ui.menu,name:note.menu_notes_stage +msgid "Categories" +msgstr "Категории" + +#. module: note +#: view:note.note:0 +#: field:note.note,stage_id:0 +msgid "Stage" +msgstr "Этап" + +#. module: note +#: field:note.tag,name:0 +msgid "Tag Name" +msgstr "Название тега" + +#. module: note +#: field:note.note,message_ids:0 +msgid "Messages" +msgstr "Сообщения" + +#. module: note +#: view:base.config.settings:0 +#: model:ir.actions.act_window,name:note.action_note_note +#: model:ir.ui.menu,name:note.menu_note_notes +#: view:note.note:0 +#: model:note.stage,name:note.note_stage_04 +msgid "Notes" +msgstr "Заметки" + +#. module: note +#: model:note.stage,name:note.demo_note_stage_03 +#: model:note.stage,name:note.note_stage_03 +msgid "Later" +msgstr "Позже" + +#. module: note +#: model:ir.model,name:note.model_note_stage +msgid "Note Stage" +msgstr "Этап заметки" + +#. module: note +#: field:note.note,message_summary:0 +msgid "Summary" +msgstr "Итог" + +#. module: note +#: field:note.note,stage_ids:0 +msgid "Stages of Users" +msgstr "Этапы пользователей" + +#. module: note +#: field:note.note,name:0 +msgid "Note Summary" +msgstr "Заметка - кратко" + +#. module: note +#: model:ir.actions.act_window,name:note.action_note_stage +#: view:note.note:0 +msgid "Stages" +msgstr "Этапы" + +#. module: note +#: help:note.note,message_ids:0 +msgid "Messages and communication history" +msgstr "Сообщения и история общения" + +#. module: note +#: view:note.note:0 +msgid "Delete" +msgstr "Удалить" + +#. module: note +#: field:note.note,color:0 +msgid "Color Index" +msgstr "Цветовая палитра" + +#. module: note +#: field:note.note,sequence:0 +#: field:note.stage,sequence:0 +msgid "Sequence" +msgstr "Нумерация" + +#. module: note +#: view:note.note:0 +#: field:note.note,tag_ids:0 +msgid "Tags" +msgstr "Теги" + +#. module: note +#: view:note.note:0 +msgid "Archive" +msgstr "Архив" + +#. module: note +#: field:base.config.settings,module_note_pad:0 +msgid "Use collaborative pads (etherpad)" +msgstr "Используйте совместный планшет (etherpad)" + +#. module: note +#: help:note.note,message_summary:0 +msgid "" +"Holds the Chatter summary (number of messages, ...). This summary is " +"directly in html format in order to be inserted in kanban views." +msgstr "" +"Содержит сводку по Чаттеру (количество сообщений,...). Эта сводка в формате " +"html для возможности использования в канбан виде" + +#. module: note +#: field:base.config.settings,group_note_fancy:0 +msgid "Use fancy layouts for notes" +msgstr "" + +#. module: note +#: field:note.note,current_partner_id:0 +#: field:note.stage,user_id:0 +msgid "Owner" +msgstr "Владелец" + +#. module: note +#: help:note.stage,sequence:0 +msgid "Used to order the note stages" +msgstr "Используется для сортировки этапов заметок" + +#. module: note +#: field:note.note,date_done:0 +msgid "Date done" +msgstr "Дата выполнения" + +#. module: note +#: field:note.stage,fold:0 +msgid "Folded by Default" +msgstr "Свернуто по умолчанию" diff --git a/addons/point_of_sale/point_of_sale.py b/addons/point_of_sale/point_of_sale.py index 349ad8b4f81..089c577e940 100644 --- a/addons/point_of_sale/point_of_sale.py +++ b/addons/point_of_sale/point_of_sale.py @@ -407,7 +407,7 @@ class pos_session(osv.osv): # The pos manager can close statements with maximums. if not self.pool.get('ir.model.access').check_groups(cr, uid, "point_of_sale.group_pos_manager"): raise osv.except_osv( _('Error!'), - _("Your ending balance is too different from the theorical cash closing (%.2f), the maximum allowed is: %.2f. You can contact your manager to force it.") % (st.difference, st.journal_id.amount_authorized_diff)) + _("Your ending balance is too different from the theoretical cash closing (%.2f), the maximum allowed is: %.2f. You can contact your manager to force it.") % (st.difference, st.journal_id.amount_authorized_diff)) if (st.journal_id.type not in ['bank', 'cash']): raise osv.except_osv(_('Error!'), _("The type of the journal for your payment method should be bank or cash ")) @@ -545,7 +545,7 @@ class pos_order(osv.osv): def unlink(self, cr, uid, ids, context=None): for rec in self.browse(cr, uid, ids, context=context): if rec.state not in ('draft','cancel'): - raise osv.except_osv(_('Unable to Delete !'), _('In order to delete a sale, it must be new or cancelled.')) + raise osv.except_osv(_('Unable to Delete!'), _('In order to delete a sale, it must be new or cancelled.')) return super(pos_order, self).unlink(cr, uid, ids, context=context) def onchange_partner_id(self, cr, uid, ids, part=False, context=None): @@ -1163,7 +1163,7 @@ class pos_order_line(osv.osv): if not product_id: return {} if not pricelist: - raise osv.except_osv(_('No Pricelist !'), + raise osv.except_osv(_('No Pricelist!'), _('You have to select a pricelist in the sale form !\n' \ 'Please set one before choosing a product.')) diff --git a/addons/point_of_sale/wizard/pos_open_statement.py b/addons/point_of_sale/wizard/pos_open_statement.py index 97ffad805b7..30e407d2ad0 100644 --- a/addons/point_of_sale/wizard/pos_open_statement.py +++ b/addons/point_of_sale/wizard/pos_open_statement.py @@ -46,7 +46,7 @@ class pos_open_statement(osv.osv_memory): st_ids = [] j_ids = journal_obj.search(cr, uid, [('journal_user','=',1)], context=context) if not j_ids: - raise osv.except_osv(_('No Cash Register Defined !'), _('You have to define which payment method must be available in the point of sale by reusing existing bank and cash through "Accounting / Configuration / Journals / Journals". Select a journal and check the field "PoS Payment Method" from the "Point of Sale" tab. You can also create new payment methods directly from menu "PoS Backend / Configuration / Payment Methods".')) + raise osv.except_osv(_('No Cash Register Defined!'), _('You have to define which payment method must be available in the point of sale by reusing existing bank and cash through "Accounting / Configuration / Journals / Journals". Select a journal and check the field "PoS Payment Method" from the "Point of Sale" tab. You can also create new payment methods directly from menu "PoS Backend / Configuration / Payment Methods".')) for journal in journal_obj.browse(cr, uid, j_ids, context=context): ids = statement_obj.search(cr, uid, [('state', '!=', 'confirm'), ('user_id', '=', uid), ('journal_id', '=', journal.id)], context=context) diff --git a/addons/portal/security/portal_security.xml b/addons/portal/security/portal_security.xml index b2a76800023..02080bdc0ab 100644 --- a/addons/portal/security/portal_security.xml +++ b/addons/portal/security/portal_security.xml @@ -5,7 +5,7 @@ <record id="portal_read_own_res_partner" model="ir.rule"> <field name="name">res_partner: read access on my partner</field> <field name="model_id" ref="base.model_res_partner"/> - <field name="domain_force">[('user_ids', 'in', user.id)]</field> + <field name="domain_force">[('id', 'child_of', user.commercial_partner_id.id)]</field> <field name="groups" eval="[(4, ref('group_portal')), (4, ref('group_anonymous'))]"/> <field name="perm_create" eval="False"/> <field name="perm_unlink" eval="False"/> diff --git a/addons/portal/wizard/portal_wizard.py b/addons/portal/wizard/portal_wizard.py index e3047cd5edb..3ec2850b4aa 100644 --- a/addons/portal/wizard/portal_wizard.py +++ b/addons/portal/wizard/portal_wizard.py @@ -20,7 +20,6 @@ ############################################################################## import logging -import random from openerp.osv import fields, osv from openerp.tools.translate import _ @@ -34,14 +33,15 @@ _logger = logging.getLogger(__name__) WELCOME_EMAIL_SUBJECT = _("Your OpenERP account at %(company)s") WELCOME_EMAIL_BODY = _("""Dear %(name)s, -You have been given access to %(portal)s. +You have been given access to %(company)s's %(portal)s. Your login account data is: -Database: %(db)s -Username: %(login)s + Username: %(login)s + Portal: %(portal_url)s + Database: %(db)s -In order to complete the signin process, click on the following url: -%(url)s +You can set or change your password via the following url: + %(signup_url)s %(welcome_message)s @@ -116,24 +116,57 @@ class wizard_user(osv.osv_memory): _description = 'Portal User Config' _columns = { - 'wizard_id': fields.many2one('portal.wizard', string='Wizard', required=True), + 'wizard_id': fields.many2one('portal.wizard', string='Wizard', required=True, ondelete='cascade'), 'partner_id': fields.many2one('res.partner', string='Contact', required=True, readonly=True), 'email': fields.char(size=240, string='Email'), 'in_portal': fields.boolean('In Portal'), } - def create(self, cr, uid, values, context=None): - """ overridden to update the partner's email (if necessary) """ - id = super(wizard_user, self).create(cr, uid, values, context) - wuser = self.browse(cr, uid, id, context) - if wuser.partner_id.email != wuser.email: - wuser.partner_id.write({'email': wuser.email}) - return id + def get_error_messages(self, cr, uid, ids, context=None): + res_users = self.pool.get('res.users') + emails = [] + error_empty = [] + error_emails = [] + error_user = [] + ctx = dict(context or {}, active_test=False) + for wizard_user in self.browse(cr, SUPERUSER_ID, ids, context): + if wizard_user.in_portal and not self._retrieve_user(cr, SUPERUSER_ID, wizard_user, context): + email = extract_email(wizard_user.email) + if not email: + error_empty.append(wizard_user.partner_id) + elif email in emails and email not in error_emails: + error_emails.append(wizard_user.partner_id) + user = res_users.search(cr, SUPERUSER_ID, [('login', '=', email)], context=ctx) + if user: + error_user.append(wizard_user.partner_id) + emails.append(email) + + error_msg = [] + if error_empty: + error_msg.append("%s\n- %s" % (_("Some contacts don't have a valid email: "), + '\n- '.join(['%s' % (p.display_name,) for p in error_empty]))) + if error_emails: + error_msg.append("%s\n- %s" % (_("Several contacts have the same email: "), + '\n- '.join([p.email for p in error_emails]))) + if error_user: + error_msg.append("%s\n- %s" % (_("Some contacts have the same email as an existing portal user:"), + '\n- '.join(['%s <%s>' % (p.display_name, p.email) for p in error_user]))) + if error_msg: + error_msg.append(_("To resolve this error, you can: \n" + "- Correct the emails of the relevant contacts\n" + "- Grant access only to contacts with unique emails")) + return error_msg def action_apply(self, cr, uid, ids, context=None): + error_msg = self.get_error_messages(cr, uid, ids, context=context) + if error_msg: + raise osv.except_osv(_('Contacts Error'), "\n\n".join(error_msg)) + for wizard_user in self.browse(cr, SUPERUSER_ID, ids, context): portal = wizard_user.wizard_id.portal_id user = self._retrieve_user(cr, SUPERUSER_ID, wizard_user, context) + if wizard_user.partner_id.email != wizard_user.email: + wizard_user.partner_id.write({'email': wizard_user.email}) if wizard_user.in_portal: # create a user if necessary, and make sure it is in the portal group if not user: @@ -142,8 +175,8 @@ class wizard_user(osv.osv_memory): user.write({'active': True, 'groups_id': [(4, portal.id)]}) # prepare for the signup process user.partner_id.signup_prepare() - wizard_user = self.browse(cr, SUPERUSER_ID, wizard_user.id, context) - self._send_email(cr, uid, wizard_user, context) + wizard_user.refresh() + self._send_email(cr, uid, wizard_user, context) else: # remove the user (if it exists) from the portal group if user and (portal in user.groups_id): @@ -158,13 +191,11 @@ class wizard_user(osv.osv_memory): @param wizard_user: browse record of model portal.wizard.user @return: browse record of model res.users """ - if wizard_user.partner_id.user_ids: - return wizard_user.partner_id.user_ids[0] - # the user may be inactive, search for it + context = dict(context or {}, active_test=False) res_users = self.pool.get('res.users') - domain = [('partner_id', '=', wizard_user.partner_id.id), ('active', '=', False)] - user_ids = res_users.search(cr, uid, domain) - return user_ids and res_users.browse(cr, uid, user_ids[0], context) or False + domain = [('partner_id', '=', wizard_user.partner_id.id)] + user_ids = res_users.search(cr, uid, domain, context=context) + return user_ids and res_users.browse(cr, uid, user_ids[0], context=context) or False def _create_user(self, cr, uid, wizard_user, context=None): """ create a new user for wizard_user.partner_id @@ -172,8 +203,9 @@ class wizard_user(osv.osv_memory): @return: browse record of model res.users """ res_users = self.pool.get('res.users') - create_context = dict(context or {}, noshortcut=True) # to prevent shortcut creation + create_context = dict(context or {}, noshortcut=True, no_reset_password=True) # to prevent shortcut creation values = { + 'email': extract_email(wizard_user.email), 'login': extract_email(wizard_user.email), 'partner_id': wizard_user.partner_id.id, 'groups_id': [(6, 0, [])], @@ -187,15 +219,22 @@ class wizard_user(osv.osv_memory): @param wizard_user: browse record of model portal.wizard.user @return: the id of the created mail.mail record """ + res_partner = self.pool['res.partner'] this_context = context this_user = self.pool.get('res.users').browse(cr, SUPERUSER_ID, uid, context) if not this_user.email: - raise osv.except_osv(_('Email required'), + raise osv.except_osv(_('Email Required'), _('You must have an email address in your User Preferences to send emails.')) # determine subject and body in the portal user's language user = self._retrieve_user(cr, SUPERUSER_ID, wizard_user, context) context = dict(this_context or {}, lang=user.lang) + ctx_portal_url = dict(context, signup_force_type_in_url='') + portal_url = res_partner._get_signup_url_for_action(cr, uid, + [user.partner_id.id], + context=ctx_portal_url)[user.partner_id.id] + res_partner.signup_prepare(cr, uid, [user.partner_id.id], context=context) + data = { 'company': this_user.company_id.name, 'portal': wizard_user.wizard_id.portal_id.name, @@ -203,7 +242,8 @@ class wizard_user(osv.osv_memory): 'db': cr.dbname, 'name': user.name, 'login': user.login, - 'url': user.signup_url, + 'signup_url': user.signup_url, + 'portal_url': portal_url, } mail_mail = self.pool.get('mail.mail') mail_values = { diff --git a/addons/portal_hr_employees/hr_employee_view.xml b/addons/portal_hr_employees/hr_employee_view.xml index ace0daaff87..eca13258ff9 100644 --- a/addons/portal_hr_employees/hr_employee_view.xml +++ b/addons/portal_hr_employees/hr_employee_view.xml @@ -33,8 +33,9 @@ </record> <record model="ir.ui.view" id="portal_hr_kanban_view_employees"> - <field name="name">HR - Employess Kanban</field> + <field name="name">HR - Employees Kanban</field> <field name="model">hr.employee</field> + <field name="inherit_id" eval="False"/> <field name="arch" type="xml"> <kanban> <field name="last_login"/> diff --git a/addons/procurement/procurement.py b/addons/procurement/procurement.py index 672859db909..93b9417bded 100644 --- a/addons/procurement/procurement.py +++ b/addons/procurement/procurement.py @@ -307,7 +307,7 @@ class procurement_order(osv.osv): move_obj = self.pool.get('stock.move') for procurement in self.browse(cr, uid, ids, context=context): if procurement.product_qty <= 0.00: - raise osv.except_osv(_('Data Insufficient !'), + raise osv.except_osv(_('Data Insufficient!'), _('Please check the quantity in procurement order(s) for the product "%s", it should not be 0 or less!' % procurement.product_id.name)) if procurement.product_id.type in ('product', 'consu'): if not procurement.move_id: diff --git a/addons/procurement/procurement_view.xml b/addons/procurement/procurement_view.xml index 7f0a28d94dc..76432157555 100644 --- a/addons/procurement/procurement_view.xml +++ b/addons/procurement/procurement_view.xml @@ -18,6 +18,7 @@ <field name="product_uom" string="Unit of Measure"/> <field name="procure_method"/> <field name="state"/> + <field name="name" invisible="1"/> <field name="message"/> </tree> </field> diff --git a/addons/project/project.py b/addons/project/project.py index 5d5abce3066..28e4bd6e5d2 100644 --- a/addons/project/project.py +++ b/addons/project/project.py @@ -85,7 +85,7 @@ class project(osv.osv): if context and context.get('user_preference'): cr.execute("""SELECT project.id FROM project_project project LEFT JOIN account_analytic_account account ON account.id = project.analytic_account_id - LEFT JOIN project_user_rel rel ON rel.project_id = project.analytic_account_id + LEFT JOIN project_user_rel rel ON rel.project_id = project.id WHERE (account.user_id = %s or rel.uid = %s)"""%(user, user)) return [(r[0]) for r in cr.fetchall()] return super(project, self).search(cr, user, args, offset=offset, limit=limit, order=order, @@ -450,7 +450,7 @@ class project(osv.osv): for project in projects: if (not project.members) and force_members: - raise osv.except_osv(_('Warning!'),_("You must assign members on the project '%s' !") % (project.name,)) + raise osv.except_osv(_('Warning!'),_("You must assign members on the project '%s'!") % (project.name,)) resource_pool = self.pool.get('resource.resource') @@ -581,12 +581,12 @@ class task(base_stage, osv.osv): _track = { 'state': { - 'project.mt_task_new': lambda self, cr, uid, obj, ctx=None: obj['state'] == 'new', + 'project.mt_task_new': lambda self, cr, uid, obj, ctx=None: obj['state'] in ['new', 'draft'], 'project.mt_task_started': lambda self, cr, uid, obj, ctx=None: obj['state'] == 'open', 'project.mt_task_closed': lambda self, cr, uid, obj, ctx=None: obj['state'] == 'done', }, 'stage_id': { - 'project.mt_task_stage': lambda self, cr, uid, obj, ctx=None: obj['state'] not in ['new', 'done', 'open'], + 'project.mt_task_stage': lambda self, cr, uid, obj, ctx=None: obj['state'] not in ['new', 'draft', 'done', 'open'], }, 'kanban_state': { # kanban state: tracked, but only block subtype 'project.mt_task_blocked': lambda self, cr, uid, obj, ctx=None: obj['kanban_state'] == 'blocked', @@ -956,7 +956,7 @@ class task(base_stage, osv.osv): if task.child_ids: for child in task.child_ids: if child.state in ['draft', 'open', 'pending']: - raise osv.except_osv(_("Warning !"), _("Child task still open.\nPlease cancel or complete child task first.")) + raise osv.except_osv(_("Warning!"), _("Child task still open.\nPlease cancel or complete child task first.")) return True def action_close(self, cr, uid, ids, context=None): @@ -1120,10 +1120,12 @@ class task(base_stage, osv.osv): context = {} if not vals.get('stage_id'): ctx = context.copy() - if vals.get('project_id'): + if vals.get('project_id'): ctx['default_project_id'] = vals['project_id'] vals['stage_id'] = self._get_default_stage_id(cr, uid, context=ctx) - task_id = super(task, self).create(cr, uid, vals, context=context) + # context: no_log, because subtype already handle this + create_context = dict(context, mail_create_nolog=True) + task_id = super(task, self).create(cr, uid, vals, context=create_context) self._store_history(cr, uid, [task_id], context=context) return task_id @@ -1197,6 +1199,17 @@ class task(base_stage, osv.osv): return [task.project_id.message_get_reply_to()[0] if task.project_id else False for task in self.browse(cr, uid, ids, context=context)] + def check_mail_message_access(self, cr, uid, mids, operation, model_obj=None, context=None): + """ mail.message document permission rule: can post a new message if can read + because of portal document. """ + if not model_obj: + model_obj = self + if operation == 'create': + model_obj.check_access_rights(cr, uid, 'read') + model_obj.check_access_rule(cr, uid, mids, 'read', context=context) + else: + return super(task, self).check_mail_message_access(cr, uid, mids, operation, model_obj=model_obj, context=context) + def message_new(self, cr, uid, msg, custom_values=None, context=None): """ Override to updates the document according to the email. """ if custom_values is None: custom_values = {} @@ -1205,7 +1218,7 @@ class task(base_stage, osv.osv): 'planned_hours': 0.0, } defaults.update(custom_values) - return super(task,self).message_new(cr, uid, msg, custom_values=defaults, context=context) + return super(task, self).message_new(cr, uid, msg, custom_values=defaults, context=context) def message_update(self, cr, uid, ids, msg, update_vals=None, context=None): """ Override to update the task according to the email. """ diff --git a/addons/project/report/project_cumulative.xml b/addons/project/report/project_cumulative.xml index c30c91fe6c0..17e059c8de7 100644 --- a/addons/project/report/project_cumulative.xml +++ b/addons/project/report/project_cumulative.xml @@ -6,7 +6,7 @@ <field name="name">project.task.history.cumulative.tree</field> <field name="model">project.task.history.cumulative</field> <field name="arch" type="xml"> - <tree string="Tasks's Cumulative Flow"> + <tree string="Tasks's Cumulative Flow" create="false"> <field name="date"/> <field name="project_id"/> <field name="task_id"/> diff --git a/addons/project_gtd/wizard/project_gtd_empty.py b/addons/project_gtd/wizard/project_gtd_empty.py index 36c64cbc224..3233e2534af 100644 --- a/addons/project_gtd/wizard/project_gtd_empty.py +++ b/addons/project_gtd/wizard/project_gtd_empty.py @@ -49,7 +49,7 @@ class project_timebox_empty(osv.osv_memory): ids = obj_tb.search(cr, uid, [], context=context) if not len(ids): - raise osv.except_osv(_('Error!'), _('No timebox child of this one !')) + raise osv.except_osv(_('Error!'), _('No timebox child of this one!')) tids = obj_task.search(cr, uid, [('timebox_id', '=', context['active_id'])]) for task in obj_task.browse(cr, uid, tids, context): if (task.state in ('cancel','done')) or (task.user_id.id <> uid): diff --git a/addons/project_issue/project_issue.py b/addons/project_issue/project_issue.py index a008c670138..8bcac4581c3 100644 --- a/addons/project_issue/project_issue.py +++ b/addons/project_issue/project_issue.py @@ -19,11 +19,12 @@ # ############################################################################## +from openerp import SUPERUSER_ID from openerp.addons.base_status.base_stage import base_stage from openerp.addons.project.project import _TASK_STATE from openerp.addons.crm import crm from datetime import datetime -from openerp.osv import fields,osv +from openerp.osv import fields, osv, orm from openerp.tools.translate import _ import binascii import time @@ -49,12 +50,12 @@ class project_issue(base_stage, osv.osv): _track = { 'state': { - 'project_issue.mt_issue_new': lambda self, cr, uid, obj, ctx=None: obj['state'] == 'new', + 'project_issue.mt_issue_new': lambda self, cr, uid, obj, ctx=None: obj['state'] in ['new', 'draft'], 'project_issue.mt_issue_closed': lambda self, cr, uid, obj, ctx=None: obj['state'] == 'done', 'project_issue.mt_issue_started': lambda self, cr, uid, obj, ctx=None: obj['state'] == 'open', }, 'stage_id': { - 'project_issue.mt_issue_stage': lambda self, cr, uid, obj, ctx=None: obj['state'] not in ['new', 'done', 'open'], + 'project_issue.mt_issue_stage': lambda self, cr, uid, obj, ctx=None: obj['state'] not in ['new', 'draft', 'done', 'open'], }, 'kanban_state': { 'project_issue.mt_issue_blocked': lambda self, cr, uid, obj, ctx=None: obj['kanban_state'] == 'blocked', @@ -69,7 +70,9 @@ class project_issue(base_stage, osv.osv): if vals.get('project_id'): ctx['default_project_id'] = vals['project_id'] vals['stage_id'] = self._get_default_stage_id(cr, uid, context=ctx) - return super(project_issue, self).create(cr, uid, vals, context=context) + # context: no_log, because subtype already handle this + create_context = dict(context, mail_create_nolog=True) + return super(project_issue, self).create(cr, uid, vals, context=create_context) def _get_default_project_id(self, cr, uid, context=None): """ Gives default project by checking if present in the context """ @@ -492,13 +495,27 @@ class project_issue(base_stage, osv.osv): return [issue.project_id.message_get_reply_to()[0] if issue.project_id else False for issue in self.browse(cr, uid, ids, context=context)] + def check_mail_message_access(self, cr, uid, mids, operation, model_obj=None, context=None): + """ mail.message document permission rule: can post a new message if can read + because of portal document. """ + if not model_obj: + model_obj = self + if operation == 'create': + model_obj.check_access_rights(cr, uid, 'read') + model_obj.check_access_rule(cr, uid, mids, 'read', context=context) + else: + return super(project_issue, self).check_mail_message_access(cr, uid, mids, operation, model_obj=model_obj, context=context) + def message_get_suggested_recipients(self, cr, uid, ids, context=None): recipients = super(project_issue, self).message_get_suggested_recipients(cr, uid, ids, context=context) - for issue in self.browse(cr, uid, ids, context=context): - if issue.email_from: - self._message_add_suggested_recipient(cr, uid, recipients, issue, email=issue.email_from, reason=_('Customer Email')) - elif issue.partner_id: - self._message_add_suggested_recipient(cr, uid, recipients, issue, partner=issue.partner_id, reason=_('Customer')) + try: + for issue in self.browse(cr, uid, ids, context=context): + if issue.partner_id: + self._message_add_suggested_recipient(cr, uid, recipients, issue, partner=issue.partner_id, reason=_('Customer')) + elif issue.email_from: + self._message_add_suggested_recipient(cr, uid, recipients, issue, email=issue.email_from, reason=_('Customer Email')) + except (osv.except_osv, orm.except_orm): # no read access rights -> just ignore suggested recipients because this imply modifying followers + pass return recipients def message_new(self, cr, uid, msg, custom_values=None, context=None): @@ -560,13 +577,10 @@ class project_issue(base_stage, osv.osv): """ if context is None: context = {} - res = super(project_issue, self).message_post(cr, uid, thread_id, body=body, subject=subject, type=type, subtype=subtype, parent_id=parent_id, attachments=attachments, context=context, content_subtype=content_subtype, **kwargs) - if thread_id: - self.write(cr, uid, thread_id, {'date_action_last': time.strftime(tools.DEFAULT_SERVER_DATETIME_FORMAT)}, context=context) - - return res + self.write(cr, SUPERUSER_ID, thread_id, {'date_action_last': time.strftime(tools.DEFAULT_SERVER_DATETIME_FORMAT)}, context=context) + return res class project(osv.Model): diff --git a/addons/project_issue/project_issue_view.xml b/addons/project_issue/project_issue_view.xml index f15355e9cc8..46caba0021e 100644 --- a/addons/project_issue/project_issue_view.xml +++ b/addons/project_issue/project_issue_view.xml @@ -68,15 +68,16 @@ <label for="categ_ids" class="oe_edit_only"/> <field name="categ_ids" widget="many2many_tags"/> <group> - <group groups="base.group_user"> + <group> <field name="user_id" context="{'default_groups_ref': ['base.group_user', 'project.group_project_user']}"/> <field name="partner_id" on_change="onchange_partner_id(partner_id, email_from)"/> <field name="email_from"/> - <label for="project_id" groups="base.group_user"/> - <div groups="base.group_user"> + <label for="project_id"/> + <div> <field name="project_id" on_change="on_change_project(project_id)" class="oe_inline" context="{'default_use_issues':1}"/> - <button name="case_escalate" string="⇒ Escalate" type="object" states="draft,open,pending" class="oe_link"/> + <button name="case_escalate" string="⇒ Escalate" type="object" states="draft,open,pending" class="oe_link" + groups="base.group_user"/> </div> </group> <group> @@ -150,8 +151,8 @@ <field name="id"/> <filter icon="terp-mail-message-new" string="Unread Messages" name="message_unread" domain="[('message_unread','=',True)]"/> <separator/> - <filter string="New" icon="terp-document-new" domain="[('state','=','draft')]" help="New Issues"/> - <filter string="To Do" domain="[('state','=','open')]" help="To Do Issues" icon="terp-check"/> + <filter name="filter_new" string="New" icon="terp-document-new" domain="[('state','=','draft')]" help="New Issues"/> + <filter name="filter_open" string="To Do" domain="[('state','=','open')]" help="To Do Issues" icon="terp-check"/> <separator/> <filter string="Unassigned Issues" domain="[('user_id','=',False)]" help="Unassigned Issues" icon="terp-personal-"/> <separator/> @@ -160,13 +161,13 @@ <field name="categ_ids"/> <field name="partner_id" filter_domain="[('partner_id', 'child_of', self)]"/> <group expand="0" string="Group By..." > - <filter string="Responsible" icon="terp-personal" domain="[]" context="{'group_by':'user_id'}"/> - <filter string="Contact" icon="terp-partner" domain="[]" context="{'group_by':'partner_id'}"/> - <filter string="Project" icon="terp-folder-violet" domain="[]" context="{'group_by':'project_id'}"/> - <filter string="Version" icon="terp-gtk-jump-to-rtl" domain="[]" context="{'group_by':'version_id'}"/> - <filter string="Priority" icon="terp-rating-rated" domain="[]" context="{'group_by':'priority'}"/> - <filter string="Stage" icon="terp-stage" domain="[]" context="{'group_by':'stage_id'}"/> - <filter string="Month" icon="terp-go-month" domain="[]" context="{'group_by':'create_date'}" help="Creation Month"/> + <filter string="Responsible" name="group_user_id" icon="terp-personal" domain="[]" context="{'group_by':'user_id'}"/> + <filter string="Contact" name="group_partner_id" icon="terp-partner" domain="[]" context="{'group_by':'partner_id'}"/> + <filter string="Project" name="group_project_id" icon="terp-folder-violet" domain="[]" context="{'group_by':'project_id'}"/> + <filter string="Version" name="group_version" icon="terp-gtk-jump-to-rtl" domain="[]" context="{'group_by':'version_id'}"/> + <filter string="Priority" name="group_priority" icon="terp-rating-rated" domain="[]" context="{'group_by':'priority'}"/> + <filter string="Stage" name="group_stage_id" icon="terp-stage" domain="[]" context="{'group_by':'stage_id'}"/> + <filter string="Month" name="group_create_date" icon="terp-go-month" domain="[]" context="{'group_by':'create_date'}" help="Creation Month"/> </group> </search> </field> diff --git a/addons/project_issue_sheet/project_issue_sheet_view.xml b/addons/project_issue_sheet/project_issue_sheet_view.xml index fb245a0510a..4911cac8f25 100644 --- a/addons/project_issue_sheet/project_issue_sheet_view.xml +++ b/addons/project_issue_sheet/project_issue_sheet_view.xml @@ -19,7 +19,8 @@ </field> <xpath expr="//notebook/page[@string='Extra Info']" position="before"> <page string="Worklogs"> - <field name="timesheet_ids" colspan="4" nolabel="1" context="{'default_user_id' : user_id, 'default_account_id' : analytic_account_id}"> + <field name="timesheet_ids" colspan="4" nolabel="1" context="{'default_user_id' : user_id, 'default_account_id' : analytic_account_id}" + groups="base.group_user"> <tree editable="top" string="Timesheets"> <field name="name"/> <field name="unit_amount" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id)" widget="float_time"/> diff --git a/addons/project_long_term/project_long_term_view.xml b/addons/project_long_term/project_long_term_view.xml index 4066b6133c1..e61af0c6c32 100644 --- a/addons/project_long_term/project_long_term_view.xml +++ b/addons/project_long_term/project_long_term_view.xml @@ -120,7 +120,8 @@ </field> <xpath expr="//div[contains(@class, 'oe_kanban_project_list')]" position="inside"> <a t-if="record.use_phases.raw_value" - name="%(act_project_phases)d" type="action"> + name="%(act_project_phases)d" type="action" + groups="base.group_user"> <span t-if="record.phase_count.raw_value gt 1"><field name="phase_count"/> Phases</span> <span t-if="record.phase_count.raw_value lt 2"><field name="phase_count"/> Phase</span> </a> @@ -322,7 +323,7 @@ <field name="inherit_id" ref="project.view_task_search_form"/> <field name="arch" type="xml"> <field name="user_id" position="before"> - <field name="phase_id"/> + <field name="phase_id" domain="[]"/> </field> </field> </record> diff --git a/addons/project_timesheet/__openerp__.py b/addons/project_timesheet/__openerp__.py index 0651d7b9ce4..4dff3695c5c 100644 --- a/addons/project_timesheet/__openerp__.py +++ b/addons/project_timesheet/__openerp__.py @@ -34,7 +34,7 @@ with the effect of creating, editing and deleting either ways. 'author': 'OpenERP SA', 'website': 'http://www.openerp.com', 'images': ['images/invoice_task_work.jpeg', 'images/my_timesheet.jpeg', 'images/working_hour.jpeg'], - 'depends': ['project', 'hr_timesheet_sheet', 'hr_timesheet_invoice', 'account_analytic_analysis'], + 'depends': ['resource', 'project', 'hr_timesheet_sheet', 'hr_timesheet_invoice', 'account_analytic_analysis'], 'data': [ 'security/ir.model.access.csv', 'security/project_timesheet_security.xml', diff --git a/addons/project_timesheet/project_timesheet.py b/addons/project_timesheet/project_timesheet.py index ffee600f5a7..767cb4893b5 100644 --- a/addons/project_timesheet/project_timesheet.py +++ b/addons/project_timesheet/project_timesheet.py @@ -79,22 +79,22 @@ class project_work(osv.osv): emp_id = emp_obj.search(cr, uid, [('user_id', '=', user_id)]) if not emp_id: user_name = self.pool.get('res.users').read(cr, uid, [user_id], ['name'])[0]['name'] - raise osv.except_osv(_('Bad Configuration !'), + raise osv.except_osv(_('Bad Configuration!'), _('Please define employee for user "%s". You must create one.')% (user_name,)) emp = emp_obj.browse(cr, uid, emp_id[0]) if not emp.product_id: - raise osv.except_osv(_('Bad Configuration !'), + raise osv.except_osv(_('Bad Configuration!'), _('Please define product and product category property account on the related employee.\nFill in the HR Settings tab of the employee form.')) if not emp.journal_id: - raise osv.except_osv(_('Bad Configuration !'), + raise osv.except_osv(_('Bad Configuration!'), _('Please define journal on the related employee.\nFill in the timesheet tab of the employee form.')) acc_id = emp.product_id.property_account_expense.id if not acc_id: acc_id = emp.product_id.categ_id.property_account_expense_categ.id if not acc_id: - raise osv.except_osv(_('Bad Configuration !'), + raise osv.except_osv(_('Bad Configuration!'), _('Please define product and product category property account on the related employee.\nFill in the timesheet tab of the employee form.')) res['product_id'] = emp.product_id.id @@ -286,7 +286,7 @@ class account_analytic_line(osv.osv): st = acc.to_invoice.id res['value']['to_invoice'] = st or False if acc.state == 'close' or acc.state == 'cancelled': - raise osv.except_osv(_('Invalid Analytic Account !'), _('You cannot select a Analytic Account which is in Close or Cancelled state.')) + raise osv.except_osv(_('Invalid Analytic Account!'), _('You cannot select a Analytic Account which is in Close or Cancelled state.')) return res diff --git a/addons/purchase/report/order.rml b/addons/purchase/report/order.rml index 1794bea19c4..6eb1b2167ee 100644 --- a/addons/purchase/report/order.rml +++ b/addons/purchase/report/order.rml @@ -94,38 +94,16 @@ <initialize> <paraStyle name="all" alignment="justify"/> </initialize> - <paraStyle name="Standard" fontName="Helvetica"/> - <paraStyle name="Text body" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/> - <paraStyle name="Heading" fontName="Helvetica" fontSize="14.0" leading="17" spaceBefore="12.0" spaceAfter="6.0"/> - <paraStyle name="List" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/> - <paraStyle name="Table Contents" fontName="Helvetica"/> - <paraStyle name="Table Heading" fontName="Helvetica" alignment="CENTER"/> - <paraStyle name="Caption" fontName="Helvetica" fontSize="12.0" leading="15" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="Index" fontName="Helvetica"/> - <paraStyle name="Footer" fontName="Helvetica"/> - <paraStyle name="Horizontal Line" fontName="Helvetica" fontSize="6.0" leading="8" spaceBefore="0.0" spaceAfter="14.0"/> - <paraStyle name="terp_header" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/> - <paraStyle name="Heading 9" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" spaceBefore="12.0" spaceAfter="6.0"/> - <paraStyle name="terp_tblheader_General" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="terp_tblheader_Details" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="terp_default_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_Bold_8" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_tblheader_General_Centre" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="terp_tblheader_General_Right" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="terp_tblheader_Details_Centre" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="terp_tblheader_Details_Right" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="terp_default_Right_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_Centre_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_header_Right" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/> - <paraStyle name="terp_header_Centre" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="CENTER" spaceBefore="12.0" spaceAfter="6.0"/> - <paraStyle name="terp_default_address" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_Bold_9" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_Centre_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_Right_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_Bold_9_Right" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_8_Italic" fontName="Helvetica-Oblique" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_2" fontName="Helvetica" fontSize="2.0" leading="3" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> + <paraStyle name="terp_header" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/> + <paraStyle name="terp_tblheader_General" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/> + <paraStyle name="terp_default_8" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> + <paraStyle name="terp_tblheader_General_Centre" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/> + <paraStyle name="terp_tblheader_General_Right" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/> + <paraStyle name="terp_default_Centre_8" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/> + <paraStyle name="terp_default_9" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> + <paraStyle name="terp_default_Bold_9" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> + <paraStyle name="terp_default_Right_9" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/> + <paraStyle name="terp_default_Bold_9_Right" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/> <images/> </stylesheet> <story> @@ -136,22 +114,22 @@ <blockTable colWidths="180.0,70.0,60.0,80.0,60.0,85.0" repeatRows="1" style="Table_Header_Pur_ord_Line"> <tr> <td> - <para style="terp_tblheader_General">Description</para> + <para style="terp_tblheader_General"><b>Description</b></para> </td> <td> - <para style="terp_tblheader_General">Taxes</para> + <para style="terp_tblheader_General"><b>Taxes</b></para> </td> <td> - <para style="terp_tblheader_General">Date Req.</para> + <para style="terp_tblheader_General"><b>Date Req.</b></para> </td> <td> - <para style="terp_tblheader_General_Right">Qty</para> + <para style="terp_tblheader_General_Right"><b>Qty</b></para> </td> <td> - <para style="terp_tblheader_General_Right">Unit Price</para> + <para style="terp_tblheader_General_Right"><b>Unit Price</b></para> </td> <td> - <para style="terp_tblheader_General_Right">Net Price</para> + <para style="terp_tblheader_General_Right"><b>Net Price</b></para> </td> </tr> </blockTable> @@ -165,7 +143,7 @@ <blockTable colWidths="253.0" style="Tableau2"> <tr> <td> - <para style="terp_default_Bold_9">Shipping address :</para> + <para style="terp_default_Bold_9"><b>Shipping address :</b></para> <para style="terp_default_9">[[ (o.dest_address_id and o.dest_address_id.name) or (o.warehouse_id and o.warehouse_id.name) or '']]</para> <para style="terp_default_9">[[ (o.dest_address_id and display_address(o.dest_address_id)) or (o.warehouse_id and display_address(o.warehouse_id.partner_id)) or '']]</para> </td> @@ -195,24 +173,24 @@ <para style="terp_default_9"> <font color="white"> </font> </para> - <para style="terp_header">[[ o.state=='draft' and removeParentNode('para') ]] Purchase Order Confirmation N° [[ o.name ]]</para> - <para style="terp_header">[[ o.state<>'draft' and removeParentNode('para') ]] Request for Quotation N° [[ o.name ]]</para> + <para style="terp_header"><b>[[ o.state=='draft' and removeParentNode('para') ]] Purchase Order Confirmation N° [[ o.name ]]</b></para> + <para style="terp_header"><b>[[ o.state<>'draft' and removeParentNode('para') ]] Request for Quotation N° [[ o.name ]]</b></para> <para style="terp_default_8"> <font color="white"> </font> </para> <blockTable colWidths="136.0,132.0,133.0,133.0" style="Header_Order_Reference_Tbl"> <tr> <td> - <para style="terp_tblheader_General_Centre">Our Order Reference</para> + <para style="terp_tblheader_General_Centre"><b>Our Order Reference</b></para> </td> <td> - <para style="terp_tblheader_General_Centre">Your Order Reference</para> + <para style="terp_tblheader_General_Centre"><b>Your Order Reference</b></para> </td> <td> - <para style="terp_tblheader_General_Centre">Order Date</para> + <para style="terp_tblheader_General_Centre"><b>Order Date</b></para> </td> <td> - <para style="terp_tblheader_General_Centre">Validated By</para> + <para style="terp_tblheader_General_Centre"><b>Validated By</b></para> </td> </tr> </blockTable> @@ -238,22 +216,22 @@ <blockTable colWidths="180.0,70.0,60.0,80.0,60.0,85.0" repeatRows="1" style="Table_Header_Pur_ord_Line"> <tr> <td> - <para style="terp_tblheader_General">Description</para> + <para style="terp_tblheader_General"><b>Description</b></para> </td> <td> - <para style="terp_tblheader_General">Taxes</para> + <para style="terp_tblheader_General"><b>Taxes</b></para> </td> <td> - <para style="terp_tblheader_General">Date Req.</para> + <para style="terp_tblheader_General"><b>Date Req.</b></para> </td> <td> - <para style="terp_tblheader_General_Right">Qty</para> + <para style="terp_tblheader_General_Right"><b>Qty</b></para> </td> <td> - <para style="terp_tblheader_General_Right">Unit Price</para> + <para style="terp_tblheader_General_Right"><b>Unit Price</b></para> </td> <td> - <para style="terp_tblheader_General_Right">Net Price</para> + <para style="terp_tblheader_General_Right"><b>Net Price</b></para> </td> </tr> </blockTable> @@ -316,10 +294,10 @@ </para> </td> <td> - <para style="terp_default_Bold_9">Total :</para> + <para style="terp_default_Bold_9"><b>Total :</b></para> </td> <td> - <para style="terp_default_Bold_9_Right">[[ formatLang(o.amount_total, digits=get_digits(dp='Account') , currency_obj=o.pricelist_id.currency_id) ]]</para> + <para style="terp_default_Bold_9_Right"><b>[[ formatLang(o.amount_total, digits=get_digits(dp='Account') , currency_obj=o.pricelist_id.currency_id) ]]</b></para> </td> </tr> </blockTable> diff --git a/addons/purchase/report/request_quotation.rml b/addons/purchase/report/request_quotation.rml index 8e5e73ee588..b7b4776d635 100644 --- a/addons/purchase/report/request_quotation.rml +++ b/addons/purchase/report/request_quotation.rml @@ -36,40 +36,17 @@ <initialize> <paraStyle name="all" alignment="justify"/> </initialize> - <paraStyle name="P1" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="Standard" fontName="Helvetica"/> - <paraStyle name="Text body" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/> - <paraStyle name="Heading" fontName="Helvetica" fontSize="14.0" leading="17" spaceBefore="12.0" spaceAfter="6.0"/> - <paraStyle name="List" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/> - <paraStyle name="Table Contents" fontName="Helvetica"/> - <paraStyle name="Table Heading" fontName="Helvetica" alignment="CENTER"/> - <paraStyle name="Caption" fontName="Helvetica" fontSize="12.0" leading="15" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="Index" fontName="Helvetica"/> - <paraStyle name="Footer" fontName="Helvetica"/> - <paraStyle name="Horizontal Line" fontName="Helvetica" fontSize="6.0" leading="8" spaceBefore="0.0" spaceAfter="14.0"/> - <paraStyle name="terp_header" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/> - <paraStyle name="Heading 9" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" spaceBefore="12.0" spaceAfter="6.0"/> - <paraStyle name="terp_tblheader_General" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="terp_tblheader_Details" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="terp_default_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_Bold_8" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_tblheader_General_Centre" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="terp_tblheader_General_Right" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="terp_tblheader_Details_Centre" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="terp_tblheader_Details_Right" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="terp_default_Right_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_Centre_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_header_Right" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/> - <paraStyle name="terp_header_Centre" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="CENTER" spaceBefore="12.0" spaceAfter="6.0"/> - <paraStyle name="terp_default_address" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_Bold_9" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_Centre_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_Right_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_2" fontName="Helvetica" fontSize="2.0" leading="3" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_8_italic" rightIndent="0.0" leftIndent="20.0" fontName="Helvetica-Oblique" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_Note" rightIndent="0.0" leftIndent="9.0" fontName="Helvetica-Oblique" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="Space bet user and signature" fontName="Helvetica" fontSize="4.0" leading="5" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> + <paraStyle name="P1" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> + <paraStyle name="Standard"/> + <paraStyle name="terp_header" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/> + <paraStyle name="terp_tblheader_Details" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/> + <paraStyle name="terp_default_8" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> + <paraStyle name="terp_tblheader_Details_Centre" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/> + <paraStyle name="terp_default_9" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> + <paraStyle name="terp_default_Bold_9" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> + <paraStyle name="terp_default_Centre_9" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/> + <paraStyle name="terp_default_Right_9" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/> + <paraStyle name="Space bet user and signature" fontSize="4.0" leading="5" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> <images/> </stylesheet> <story> @@ -84,7 +61,7 @@ <blockTable colWidths="250.0" style="Tableau2"> <tr> <td> - <para style="terp_default_Bold_9">Expected Delivery address:</para> + <para style="terp_default_Bold_9"><b>Expected Delivery address:</b></para> <para style="terp_default_9">[[ (order.dest_address_id and order.dest_address_id.name) or (order.warehouse_id and order.warehouse_id.name) or '']]</para> <para style="P1">[[ order.dest_address_id and display_address(order.dest_address_id) ]]</para> </td> @@ -114,20 +91,20 @@ <para style="Standard"> <font color="white"> </font> </para> - <para style="terp_header">Request for Quotation : [[order.name]]</para> + <para style="terp_header"><b>Request for Quotation : [[order.name]]</b></para> <para style="terp_default_8"> <font color="white"> </font> </para> <blockTable colWidths="371.0,98.0,61.0" repeatRows="1" style="Table_Product_Header_Title"> <tr> <td> - <para style="terp_tblheader_Details">Description</para> + <para style="terp_tblheader_Details"><b>Description</b></para> </td> <td> - <para style="terp_tblheader_Details_Centre">Expected Date</para> + <para style="terp_tblheader_Details_Centre"><b>Expected Date</b></para> </td> <td> - <para style="terp_tblheader_Details_Centre">Qty</para> + <para style="terp_tblheader_Details_Centre"><b>Qty</b></para> </td> </tr> </blockTable> diff --git a/addons/report_webkit/webkit_report.py b/addons/report_webkit/webkit_report.py index 82061daa758..5e65afaae25 100644 --- a/addons/report_webkit/webkit_report.py +++ b/addons/report_webkit/webkit_report.py @@ -280,7 +280,7 @@ class WebKitParser(report_sxw): template = False if report_xml.report_file : - path = get_module_resource(*report_xml.report_file.split(os.path.sep)) + path = get_module_resource(*report_xml.report_file.split('/')) if path and os.path.exists(path) : template = file(path).read() if not template and report_xml.report_webkit_data : diff --git a/addons/sale/i18n/ru.po b/addons/sale/i18n/ru.po index 8449bd83224..7ca635be446 100644 --- a/addons/sale/i18n/ru.po +++ b/addons/sale/i18n/ru.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-12-21 17:04+0000\n" -"PO-Revision-Date: 2013-06-03 07:54+0000\n" +"PO-Revision-Date: 2013-06-06 11:38+0000\n" "Last-Translator: Chertykov Denis <chertykov@gmail.com>\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: 2013-06-04 05:20+0000\n" -"X-Generator: Launchpad (build 16660)\n" +"X-Launchpad-Export-Date: 2013-06-07 05:48+0000\n" +"X-Generator: Launchpad (build 16667)\n" #. module: sale #: model:res.groups,name:sale.group_analytic_accounting @@ -191,7 +191,7 @@ msgstr "Счет аналитики" #: field:sale.config.settings,module_sale_journal:0 msgid "Allow batch invoicing of delivery orders through journals" msgstr "" -"Разрешить групповое выставление счета из заказов на доставку через журналы" +"Разрешить групповое выставление счетов из заказов доставки через журналы" #. module: sale #: field:sale.order.line,price_subtotal:0 @@ -223,7 +223,7 @@ msgstr "Особенности склада" #. module: sale #: field:sale.config.settings,time_unit:0 msgid "The default working time unit for services is" -msgstr "" +msgstr "Единица измерения времени для услуг" #. module: sale #: field:sale.order.line,product_uom:0 diff --git a/addons/sale/report/sale_order.rml b/addons/sale/report/sale_order.rml index 130220535f9..3bddf81ade8 100644 --- a/addons/sale/report/sale_order.rml +++ b/addons/sale/report/sale_order.rml @@ -89,40 +89,19 @@ <initialize> <paraStyle name="all" alignment="justify"/> </initialize> - <paraStyle name="Standard" fontName="Helvetica"/> - <paraStyle name="Text body" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/> - <paraStyle name="Heading" fontName="Helvetica" fontSize="8.0" leading="10" spaceBefore="12.0" spaceAfter="6.0"/> - <paraStyle name="List" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/> - <paraStyle name="Table Contents" fontName="Helvetica"/> - <paraStyle name="Table Heading" fontName="Helvetica" alignment="CENTER"/> - <paraStyle name="Caption" fontName="Helvetica" fontSize="12.0" leading="15" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="Index" fontName="Helvetica"/> - <paraStyle name="terp_header" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/> - <paraStyle name="terp_default_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_Bold_8" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_Bold_9" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_tblheader_General" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="terp_tblheader_General_Centre" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="terp_default_Centre_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_tblheader_Details" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="Footer" fontName="Helvetica"/> - <paraStyle name="Horizontal Line" fontName="Helvetica" fontSize="6.0" leading="8" spaceBefore="0.0" spaceAfter="14.0"/> - <paraStyle name="Heading 9" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" spaceBefore="12.0" spaceAfter="6.0"/> - <paraStyle name="terp_tblheader_General_Right" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="terp_tblheader_Details_Centre" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="terp_tblheader_Details_Right" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="terp_default_Right_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_header_Right" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/> - <paraStyle name="terp_header_Centre" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="CENTER" spaceBefore="12.0" spaceAfter="6.0"/> - <paraStyle name="terp_default_address" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_Centre_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_Right_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_1" fontName="Helvetica" fontSize="2.0" leading="3" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_Right_9_Bold" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_Italic" rightIndent="0.0" leftIndent="20.0" fontName="Helvetica-Oblique" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="Preformatted Text" fontName="Helvetica" fontSize="10.0" leading="13" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_Centre_9_Bold" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/> + <paraStyle name="terp_header" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/> + <paraStyle name="terp_default_8" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> + <paraStyle name="terp_default_Bold_9" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> + <paraStyle name="terp_default_9" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> + <paraStyle name="terp_tblheader_General_Centre" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/> + <paraStyle name="terp_default_Centre_8" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/> + <paraStyle name="terp_tblheader_Details" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/> + <paraStyle name="terp_tblheader_Details_Centre" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/> + <paraStyle name="terp_tblheader_Details_Right" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/> + <paraStyle name="terp_default_Centre_9" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/> + <paraStyle name="terp_default_Right_9" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/> + <paraStyle name="terp_default_1" fontSize="2.0" leading="3" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> + <paraStyle name="terp_default_Right_9_Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/> <images/> </stylesheet> <story> @@ -133,22 +112,22 @@ <blockTable colWidths="181.0,70.0,80.0,70.0,50.0,85.0" repeatRows="1" style="Table4"> <tr> <td> - <para style="terp_tblheader_Details">Description</para> + <para style="terp_tblheader_Details"><b>Description</b></para> </td> <td> - <para style="terp_tblheader_Details_Centre">Tax</para> + <para style="terp_tblheader_Details_Centre"><b>Tax</b></para> </td> <td> - <para style="terp_tblheader_Details_Right">Quantity</para> + <para style="terp_tblheader_Details_Right"><b>Quantity</b></para> </td> <td> - <para style="terp_tblheader_Details_Right">Unit Price</para> + <para style="terp_tblheader_Details_Right"><b>Unit Price</b></para> </td> <td> - <para style="terp_tblheader_Details_Centre">Disc.(%)</para> + <para style="terp_tblheader_Details_Centre"><b>Disc.(%)</b></para> </td> <td> - <para style="terp_tblheader_Details_Right">Price</para> + <para style="terp_tblheader_Details_Right"><b>Price</b></para> </td> </tr> </blockTable> @@ -162,13 +141,13 @@ <blockTable colWidths="265.0,51.0,225.0" style="Table1"> <tr> <td> - <para style="terp_default_Bold_9">Shipping address :</para> + <para style="terp_default_Bold_9"><b>Shipping address :</b></para> <para style="terp_default_9">[[ (o.partner_shipping_id and o.partner_id.title and o.partner_shipping_id.title.name) or '' ]] [[ (o.partner_shipping_id and o.partner_shipping_id.name) or '' ]]</para> <para style="terp_default_9">[[ o.partner_shipping_id and display_address(o.partner_shipping_id) ]]</para> <para style="terp_default_9"> <font color="white"> </font> </para> - <para style="terp_default_Bold_9">Invoice address :</para> + <para style="terp_default_Bold_9"><b>Invoice address :</b></para> <para style="terp_default_9">[[ (o.partner_invoice_id and o.partner_invoice_id.title and o.partner_invoice_id.title.name) or '' ]] [[ (o.partner_invoice_id and o.partner_invoice_id.name) or '' ]]</para> <para style="terp_default_9">[[ o.partner_invoice_id and display_address(o.partner_invoice_id) ]] </para> </td> @@ -195,25 +174,25 @@ <para style="terp_default_8"> <font color="white"> </font> </para> - <para style="terp_header">[[ o.state not in ['draft','sent'] and removeParentNode('para') ]] Quotation N° [[ o.name ]]</para> - <para style="terp_header">[[ o.state in ['draft','sent'] and removeParentNode('para') ]] Order N° [[ o.name ]]</para> + <para style="terp_header"><b>[[ o.state not in ['draft','sent'] and removeParentNode('para') ]] Quotation N° [[ o.name ]]</b></para> + <para style="terp_header"><b>[[ o.state in ['draft','sent'] and removeParentNode('para') ]] Order N° [[ o.name ]]</b></para> <para style="terp_default_8"> <font color="white"> </font> </para> <blockTable colWidths="132.0,134.0,135.0,135.0" style="Table2"> <tr> <td> - <para style="terp_tblheader_General_Centre">Your Reference </para> + <para style="terp_tblheader_General_Centre"><b>Your Reference </b></para> </td> <td> - <para style="terp_tblheader_General_Centre">[[ o.state in ['draft','sent'] and removeParentNode('para') ]] Date Ordered</para> - <para style="terp_tblheader_General_Centre">[[ o.state not in ['draft','sent'] and removeParentNode('para') ]] Quotation Date</para> + <para style="terp_tblheader_General_Centre"><b>[[ o.state in ['draft','sent'] and removeParentNode('para') ]] Date Ordered</b></para> + <para style="terp_tblheader_General_Centre"><b>[[ o.state not in ['draft','sent'] and removeParentNode('para') ]] Quotation Date</b></para> </td> <td> - <para style="terp_tblheader_General_Centre">Salesperson</para> + <para style="terp_tblheader_General_Centre"><b>Salesperson</b></para> </td> <td> - <para style="terp_tblheader_General_Centre">Payment Term</para> + <para style="terp_tblheader_General_Centre"><b>Payment Term</b></para> </td> </tr> </blockTable> @@ -239,22 +218,22 @@ <blockTable colWidths="181.0,70.0,80.0,70.0,50.0,85.0" repeatRows="1" style="Table4"> <tr> <td> - <para style="terp_tblheader_Details">Description</para> + <para style="terp_tblheader_Details"><b>Description</b></para> </td> <td> - <para style="terp_tblheader_Details_Centre">Tax</para> + <para style="terp_tblheader_Details_Centre"><b>Tax</b></para> </td> <td> - <para style="terp_tblheader_Details_Right">Quantity</para> + <para style="terp_tblheader_Details_Right"><b>Quantity</b></para> </td> <td> - <para style="terp_tblheader_Details_Right">Unit Price</para> + <para style="terp_tblheader_Details_Right"><b>Unit Price</b></para> </td> <td> - <para style="terp_tblheader_Details_Centre">[[not show_discount(user.id) and removeParentNode('para') ]]Disc.(%)</para> + <para style="terp_tblheader_Details_Centre"><b>[[not show_discount(user.id) and removeParentNode('para') ]]Disc.(%)</b></para> </td> <td> - <para style="terp_tblheader_Details_Right">Price</para> + <para style="terp_tblheader_Details_Right"><b>Price</b></para> </td> </tr> </blockTable> @@ -317,10 +296,10 @@ </para> </td> <td> - <para style="terp_default_Bold_9">Total :</para> + <para style="terp_default_Bold_9"><b>Total :</b></para> </td> <td> - <para style="terp_default_Right_9_Bold">[[ formatLang(o.amount_total, dp='Account', currency_obj=o.pricelist_id.currency_id) ]]</para> + <para style="terp_default_Right_9_Bold"><b>[[ formatLang(o.amount_total, dp='Account', currency_obj=o.pricelist_id.currency_id) ]]</b></para> </td> </tr> </blockTable> diff --git a/addons/sale/res_partner.py b/addons/sale/res_partner.py index 1b37b609179..8201e147e34 100644 --- a/addons/sale/res_partner.py +++ b/addons/sale/res_partner.py @@ -41,7 +41,7 @@ class res_partner(osv.osv): default.update({'sale_order_ids': []}) - super(res_partner, self).copy(cr, uid, record_id, default, context) + return super(res_partner, self).copy(cr, uid, record_id, default, context) _columns = { 'sale_order_count': fields.function(_sale_order_count, string='# of Sales Order', type='integer'), diff --git a/addons/sale/sale.py b/addons/sale/sale.py index 210e4dd3be6..f34137f8231 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -273,7 +273,7 @@ class sale_order(osv.osv): if s['state'] in ['draft', 'cancel']: unlink_ids.append(s['id']) else: - raise osv.except_osv(_('Invalid Action!'), _('In order to delete a confirmed sales order, you must cancel it before !')) + raise osv.except_osv(_('Invalid Action!'), _('In order to delete a confirmed sales order, you must cancel it before!')) return osv.osv.unlink(self, cr, uid, unlink_ids, context=context) @@ -695,7 +695,7 @@ class sale_order_line(osv.osv): _description = 'Sales Order Line' _columns = { 'order_id': fields.many2one('sale.order', 'Order Reference', required=True, ondelete='cascade', select=True, readonly=True, states={'draft':[('readonly',False)]}), - 'name': fields.text('Description', required=True, select=True, readonly=True, states={'draft': [('readonly', False)]}), + 'name': fields.text('Description', required=True, readonly=True, states={'draft': [('readonly', False)]}), 'sequence': fields.integer('Sequence', help="Gives the sequence order when displaying a list of sales order lines."), 'product_id': fields.many2one('product.product', 'Product', domain=[('sale_ok', '=', True)], change_default=True), 'invoice_lines': fields.many2many('account.invoice.line', 'sale_order_line_invoice_rel', 'order_line_id', 'invoice_id', 'Invoice Lines', readonly=True), @@ -870,7 +870,7 @@ class sale_order_line(osv.osv): context = context or {} lang = lang or context.get('lang',False) if not partner_id: - raise osv.except_osv(_('No Customer Defined !'), _('Before choosing a product,\n select a customer in the sales form.')) + raise osv.except_osv(_('No Customer Defined!'), _('Before choosing a product,\n select a customer in the sales form.')) warning = {} product_uom_obj = self.pool.get('product.uom') partner_obj = self.pool.get('res.partner') diff --git a/addons/sale/sale_demo.xml b/addons/sale/sale_demo.xml index 428b586ffa8..eb937199aba 100644 --- a/addons/sale/sale_demo.xml +++ b/addons/sale/sale_demo.xml @@ -288,6 +288,8 @@ </record> <!-- Confirm some Sale Orders--> + <workflow action="order_confirm" model="sale.order" ref="sale_order_4"/> + <workflow action="order_confirm" model="sale.order" ref="sale_order_7"/> <record id="message_sale_1" model="mail.message"> diff --git a/addons/sale/sale_view.xml b/addons/sale/sale_view.xml index e24a6e45fe0..d8d038eb002 100644 --- a/addons/sale/sale_view.xml +++ b/addons/sale/sale_view.xml @@ -307,7 +307,7 @@ <filter icon="terp-dolar_ok!" string="To Invoice" domain="[('state','=','manual')]" help="Sales Order ready to be invoiced"/> <filter icon="terp-dolar_ok!" string="Done" domain="[('state','=','done')]" help="Sales Order done"/> <separator/> - <filter string="My Sales Orders" domain="[('user_id','=',uid)]" help="My Sales Orders" icon="terp-personal" name="my_sale_orders_filter"/> + <filter string="My" domain="[('user_id','=',uid)]" help="My Sales Orders" icon="terp-personal" name="my_sale_orders_filter"/> <field name="partner_id" filter_domain="[('partner_id', 'child_of', self)]"/> <field name="user_id"/> <field name="project_id"/> diff --git a/addons/sale_crm/__openerp__.py b/addons/sale_crm/__openerp__.py index 6591589342e..7db1aa1eff0 100644 --- a/addons/sale_crm/__openerp__.py +++ b/addons/sale_crm/__openerp__.py @@ -47,7 +47,11 @@ modules. 'security/ir.model.access.csv', 'report/sale_crm_account_invoice_report_view.xml', ], - 'demo': [], + 'js': [ + 'static/lib/justgage.js', + 'static/src/js/sale_crm.js', + ], + 'demo': ['sale_crm_demo.xml'], 'test': ['test/sale_crm.yml'], 'installable': True, 'auto_install': True, diff --git a/addons/sale_crm/sale_crm.py b/addons/sale_crm/sale_crm.py index 3172999c545..97c5f4579e0 100644 --- a/addons/sale_crm/sale_crm.py +++ b/addons/sale_crm/sale_crm.py @@ -19,7 +19,10 @@ # ############################################################################## -from datetime import datetime +from datetime import date +from dateutil import relativedelta + +from openerp import tools from openerp.osv import osv, fields @@ -41,31 +44,51 @@ class sale_order(osv.osv): class crm_case_section(osv.osv): _inherit = 'crm.case.section' - def _get_sum_month_invoice(self, cr, uid, ids, field_name, arg, context=None): - res = dict.fromkeys(ids, 0) + def _get_sale_orders_data(self, cr, uid, ids, field_name, arg, context=None): + obj = self.pool.get('sale.order') + res = dict.fromkeys(ids, False) + month_begin = date.today().replace(day=1) + groupby_begin = (month_begin + relativedelta.relativedelta(months=-4)).strftime(tools.DEFAULT_SERVER_DATE_FORMAT) + for id in ids: + res[id] = dict() + created_domain = [('section_id', '=', id), ('state', 'in', ['draft', 'sent']), ('date_order', '>=', groupby_begin)] + res[id]['monthly_quoted'] = self.__get_bar_values(cr, uid, obj, created_domain, ['amount_total', 'date_order'], 'amount_total', 'date_order', context=context) + validated_domain = [('section_id', '=', id), ('state', 'not in', ['draft', 'sent']), ('date_confirm', '>=', groupby_begin)] + res[id]['monthly_confirmed'] = self.__get_bar_values(cr, uid, obj, validated_domain, ['amount_total', 'date_confirm'], 'amount_total', 'date_confirm', context=context) + return res + + def _get_invoices_data(self, cr, uid, ids, field_name, arg, context=None): obj = self.pool.get('account.invoice.report') - when = datetime.today() - for section_id in ids: - invoice_ids = obj.search(cr, uid, [("section_id", "=", section_id), ('state', 'not in', ['draft', 'cancel']), ('year', '=', when.year), ('month', '=', when.month > 9 and when.month or "0%s" % when.month)], context=context) - for invoice in obj.browse(cr, uid, invoice_ids, context=context): - res[section_id] += invoice.price_total + res = dict.fromkeys(ids, False) + month_begin = date.today().replace(day=1) + groupby_begin = (month_begin + relativedelta.relativedelta(months=-4)).strftime(tools.DEFAULT_SERVER_DATE_FORMAT) + for id in ids: + created_domain = [('section_id', '=', id), ('state', 'not in', ['draft', 'cancel']), ('date', '>=', groupby_begin)] + res[id] = self.__get_bar_values(cr, uid, obj, created_domain, ['price_total', 'date'], 'price_total', 'date', context=context) return res _columns = { - 'quotation_ids': fields.one2many('sale.order', 'section_id', - string='Quotations', readonly=True, - domain=[('state', 'in', ['draft', 'sent', 'cancel'])]), - 'sale_order_ids': fields.one2many('sale.order', 'section_id', - string='Sale Orders', readonly=True, - domain=[('state', 'not in', ['draft', 'sent', 'cancel'])]), - 'invoice_ids': fields.one2many('account.invoice', 'section_id', - string='Invoices', readonly=True, - domain=[('state', 'not in', ['draft', 'cancel'])]), - 'sum_month_invoice': fields.function(_get_sum_month_invoice, - string='Total invoiced this month', - type='integer', readonly=True), + 'invoiced_forecast': fields.integer(string='Invoice Forecast', + help="Forecast of the invoice revenue for the current month. This is the amount the sales \n" + "team should invoice this month. It is used to compute the progression ratio \n" + " of the current and forecast revenue on the kanban view."), + 'invoiced_target': fields.integer(string='Invoice Target', + help="Target of invoice revenue for the current month. This is the amount the sales \n" + "team estimates to be able to invoice this month."), + 'monthly_quoted': fields.function(_get_sale_orders_data, + type='string', readonly=True, multi='_get_sale_orders_data', + string='Rate of created quotation per duration'), + 'monthly_confirmed': fields.function(_get_sale_orders_data, + type='string', readonly=True, multi='_get_sale_orders_data', + string='Rate of validate sales orders per duration'), + 'monthly_invoiced': fields.function(_get_invoices_data, + type='string', readonly=True, + string='Rate of sent invoices per duration'), } + def action_forecast(self, cr, uid, id, value, context=None): + return self.write(cr, uid, [id], {'invoiced_forecast': value}, context=context) + class res_users(osv.Model): _inherit = 'res.users' diff --git a/addons/sale_crm/sale_crm_demo.xml b/addons/sale_crm/sale_crm_demo.xml new file mode 100644 index 00000000000..0c2822719dd --- /dev/null +++ b/addons/sale_crm/sale_crm_demo.xml @@ -0,0 +1,130 @@ +<?xml version="1.0" encoding="utf-8"?> +<openerp> + <data> + + <record model="crm.case.section" id="crm.section_sales_department"> + <field name="invoiced_forecast">52700</field> + <field name="invoiced_target">60000</field> + </record> + + <record model="crm.case.section" id="crm.crm_case_section_1"> + <field name="name">Indirect Sales</field> + <field name="code">IM</field> + <field name="invoiced_forecast">36000</field> + <field name="invoiced_target">40000</field> + </record> + + <!-- Invoice for Direct Marketing --> + + <record id="test_crm_sale_invoice_1" model="account.invoice"> + <field name="currency_id" ref="base.EUR"/> + <field name="company_id" ref="base.main_company"/> + <field name="partner_id" ref="base.res_partner_1"/> + <field name="journal_id" ref="account.sales_journal"/> + <field name="section_id" ref="crm.section_sales_department"/> + <field name="state">draft</field> + <field name="type">out_invoice</field> + <field name="account_id" ref="account.a_recv"/> + <field name="name">Test invoice 1</field> + </record> + <record id="test_crm_sale_invoice_1_line_1" model="account.invoice.line"> + <field name="name">Basic computer with Dvorak keyboard and left-handed mouse</field> + <field name="invoice_id" ref="test_crm_sale_invoice_1"/> + <field name="price_unit">250</field> + <field name="quantity">1</field> + <field name="account_id" ref="account.a_sale"/> + </record> + <record id="test_crm_sale_invoice_1_line_2" model="account.invoice.line"> + <field name="name">Little server with raid 1 and 512ECC ram</field> + <field name="invoice_id" ref="test_crm_sale_invoice_1"/> + <field name="price_unit">800</field> + <field name="quantity">2</field> + <field name="account_id" ref="account.a_sale"/> + </record> + <record id="test_crm_sale_invoice_1_line_2" model="account.invoice.line"> + <field name="name">Server with raid 10 and 2048ECC ram</field> + <field name="invoice_id" ref="test_crm_sale_invoice_1"/> + <field name="price_unit">4800</field> + <field name="quantity">4</field> + <field name="account_id" ref="account.a_sale"/> + </record> + <workflow action="invoice_open" model="account.invoice" ref="test_crm_sale_invoice_1"/> + <function model="account.invoice" name="pay_and_reconcile"> + <!-- ids = --> <value eval="[ref('test_crm_sale_invoice_1')]"/> + <!-- pay_amount = --> <value eval="1850"/> + <!-- pay_account_id = --> <value eval="ref('account.cash')"/> + <!-- period_id = --> <value eval="ref('account.period_' + str(int(time.strftime('%m'))))"/> + <!-- pay_journal_id = --> <value eval="ref('account.bank_journal')"/> + <!-- writeoff_acc_id = --> <value eval="ref('account.cash')"/> + <!-- writeoff_period_id = --> <value eval="ref('account.period_' + str(int(time.strftime('%m'))))"/> + <!-- writeoff_journal_id = --> <value eval="ref('account.bank_journal')"/> + <!-- context = --> <value eval="{}"/> + <!-- name = --> <value eval="str('Payment from ASUStek')"/> + </function> + + <!-- Invoice for Indirect Marketing --> + + <record id="test_crm_sale_invoice_2" model="account.invoice"> + <field name="currency_id" ref="base.EUR"/> + <field name="company_id" ref="base.main_company"/> + <field name="partner_id" ref="base.res_partner_1"/> + <field name="journal_id" ref="account.sales_journal"/> + <field name="section_id" ref="crm.crm_case_section_1"/> + <field name="state">draft</field> + <field name="type">out_invoice</field> + <field name="account_id" ref="account.a_recv"/> + <field name="name">Test invoice 1</field> + </record> + <record id="test_crm_sale_invoice_2_line_1" model="account.invoice.line"> + <field name="name">Basic formation with Dvorak</field> + <field name="invoice_id" ref="test_crm_sale_invoice_2"/> + <field name="price_unit">500</field> + <field name="quantity">1</field> + <field name="account_id" ref="account.a_sale"/> + </record> + <workflow action="invoice_open" model="account.invoice" ref="test_crm_sale_invoice_2"/> + <function model="account.invoice" name="pay_and_reconcile"> + <!-- ids = --> <value eval="[ref('test_crm_sale_invoice_2')]"/> + <!-- pay_amount = --> <value eval="500"/> + <!-- pay_account_id = --> <value eval="ref('account.cash')"/> + <!-- period_id = --> <value eval="ref('account.period_' + str(int(time.strftime('%m'))))"/> + <!-- pay_journal_id = --> <value eval="ref('account.bank_journal')"/> + <!-- writeoff_acc_id = --> <value eval="ref('account.cash')"/> + <!-- writeoff_period_id = --> <value eval="ref('account.period_' + str(int(time.strftime('%m'))))"/> + <!-- writeoff_journal_id = --> <value eval="ref('account.bank_journal')"/> + <!-- context = --> <value eval="{}"/> + <!-- name = --> <value eval="str('Payment from ASUStek')"/> + </function> + + + <record id="sale.sale_order_1" model="sale.order"> + <field name="section_id" ref="crm.section_sales_department"/> + <field name="date_order" eval="(DateTime.today() - relativedelta(months=1)).strftime('%Y-%m-%d %H:%M')"/> + </record> + <record id="sale.sale_order_2" model="sale.order"> + <field name="section_id" ref="crm.section_sales_department"/> + <field name="date_order" eval="(DateTime.today() - relativedelta(months=1)).strftime('%Y-%m-%d %H:%M')"/> + </record> + <record id="sale.sale_order_3" model="sale.order"> + <field name="section_id" ref="crm.section_sales_department"/> + </record> + <record id="sale.sale_order_4" model="sale.order"> + <field name="section_id" ref="crm.section_sales_department"/> + </record> + <record id="sale.sale_order_5" model="sale.order"> + <field name="section_id" ref="crm.crm_case_section_1"/> + <field name="date_order" eval="(DateTime.today() - relativedelta(months=1)).strftime('%Y-%m-%d %H:%M')"/> + </record> + <record id="sale.sale_order_6" model="sale.order"> + <field name="section_id" ref="crm.crm_case_section_1"/> + </record> + <record id="sale.sale_order_7" model="sale.order"> + <field name="section_id" ref="crm.section_sales_department"/> + <field name="date_confirm" eval="(DateTime.today() - relativedelta(months=1)).strftime('%Y-%m-%d %H:%M')"/> + </record> + <record id="sale.sale_order_8" model="sale.order"> + <field name="section_id" ref="crm.crm_case_section_1"/> + </record> + + </data> +</openerp> diff --git a/addons/sale_crm/sale_crm_view.xml b/addons/sale_crm/sale_crm_view.xml index 31c0317969a..ae21934ce61 100644 --- a/addons/sale_crm/sale_crm_view.xml +++ b/addons/sale_crm/sale_crm_view.xml @@ -43,7 +43,7 @@ <filter string="My Sales Team(s)" icon="terp-personal+" domain="[('section_id.user_id','=',uid)]" - help="My Sales Team(s)"/> + help="My Sales Team(s)" groups="base.group_multi_salesteams"/> </xpath> <xpath expr="//field[@name='user_id']" position="after"> <field name="section_id" string="Sales Team" groups="base.group_multi_salesteams"/> @@ -75,7 +75,7 @@ <field name="section_id"/> </xpath> <xpath expr="//group/filter[@string='Due Date']" position="after"> - <filter string="Sales Team" domain="[]" context="{'group_by':'section_id'}"/> + <filter string="Sales Team" domain="[]" context="{'group_by':'section_id'}" groups="base.group_multi_salesteams"/> </xpath> </field> </record> @@ -101,7 +101,7 @@ <field name="inherit_id" ref="base.view_users_form"/> <field name="arch" type="xml"> <data> - <xpath expr="//field[@name='email']" position="after"> + <xpath expr="//field[@name='tz']" position="after"> <field name="default_section_id"/> </xpath> </data> @@ -135,7 +135,6 @@ <field name="context">{ 'search_default_section_id': [active_id], 'default_section_id': active_id, - 'search_default_my_sale_orders_filter': 1, } </field> <field name="help" type="html"> @@ -158,8 +157,8 @@ <field name="view_mode">tree,form,calendar,graph</field> <field name="context">{ 'search_default_section_id': [active_id], - 'default_section_id': active_id, 'show_address': 1, - 'search_default_my_sale_orders_filter': 1 + 'default_section_id': active_id, + 'show_address': 1, } </field> <field name="domain">[('state','in',('draft','sent','cancel'))]</field> @@ -190,7 +189,7 @@ ('type', '=', 'out_invoice')]</field> <field name="context">{ 'search_default_section_id': [active_id], - 'default_section_id': active_id}, + 'default_section_id': active_id, 'default_type':'out_invoice', 'type':'out_invoice', 'journal_type': 'sale', @@ -212,38 +211,68 @@ <field name="act_window_id" ref="sale_crm.action_invoice_salesteams"/> </record> + <record id="crm_case_section_salesteams_view_form" model="ir.ui.view"> + <field name="name">crm.case.section.form</field> + <field name="model">crm.case.section</field> + <field name="inherit_id" ref="crm.crm_case_section_view_form"/> + <field name="arch" type="xml"> + <data> + <xpath expr="//field[@name='code']" position="after"> + <field name="invoiced_target"/> + <field name="invoiced_forecast"/> + </xpath> + </data> + </field> + </record> + <record id="crm_case_section_salesteams_view_kanban" model="ir.ui.view"> <field name="name">crm.case.section.kanban</field> <field name="model">crm.case.section</field> <field name="inherit_id" ref="crm.crm_case_section_salesteams_view_kanban"/> <field name="arch" type="xml"> <data> - <xpath expr="//field[@name='open_opportunity_ids']" position="after"> - <field name="quotation_ids"/> - <field name="sale_order_ids"/> - <field name="invoice_ids"/> + <xpath expr="//field[@name='name']" position="after"> + <field name="monthly_quoted"/> + <field name="monthly_confirmed"/> + <field name="monthly_invoiced"/> + <field name="invoiced_forecast"/> + <field name="invoiced_target"/> </xpath> - <xpath expr="//div[@class='oe_items_list']" position="inside"> - <a name="%(action_quotations_salesteams)d" type="action"> - <t t-raw="record.quotation_ids.raw_value.length"/> - <t t-if="record.quotation_ids.raw_value.length >= 2">Quotations</t> - <t t-if="record.quotation_ids.raw_value.length < 2">Quotation</t> - </a> - <a name="%(action_orders_salesteams)d" type="action"> - <t t-raw="record.sale_order_ids.raw_value.length"/> - <t t-if="record.sale_order_ids.raw_value.length >= 2">Sales Orders</t> - <t t-if="record.sale_order_ids.raw_value.length < 2">Sales Order</t> - </a> - <a name="%(action_invoice_salesteams)d" type="action" groups="account.group_account_invoice"> - <t t-raw="record.invoice_ids.raw_value.length"/> - <t t-if="record.invoice_ids.raw_value.length >= 2">Invoices</t> - <t t-if="record.invoice_ids.raw_value.length < 2">Invoice</t> - </a> + <xpath expr="//div[@class='oe_salesteams_leads']" position="after"> + <div class="oe_salesteams_orders"> + <a name="%(action_orders_salesteams)d" type="action">Sales Orders</a> + <a name="%(sale.action_order_report_all)d" type="action" class="oe_sparkline_bar_link"> + <field name="monthly_confirmed" widget="sparkline_bar"> + Revenue of confirmed sales orders per month.<br/>Click the acces to Sales Analysis + </field> + </a> + </div> + </xpath> + <xpath expr="//div[@class='oe_salesteams_opportunities']" position="after"> + <div class="oe_salesteams_invoices"> + <a name="%(action_invoice_salesteams)d" type="action" groups="account.group_account_invoice">Invoices</a> + <a name="%(account.action_account_invoice_report_all)d" type="action" class="oe_sparkline_bar_link"> + <field name="monthly_invoiced" widget="sparkline_bar"> + Revenue of sent invoices per month.<br/>Click to see a detailed analysis of invoices. + </field> + </a> + </div> + <div class="oe_salesteams_quotations"> + <a name="%(action_quotations_salesteams)d" type="action" class="oe_sparkline_bar_link">Quotations</a> + <a name="%(sale.action_order_report_all)d" type="action" class="oe_sparkline_bar_link"> + <field name="monthly_quoted" widget="sparkline_bar"> + Revenue of created quotation per month.<br/>Click to see a detailed analysis of sales. + </field> + </a> + </div> </xpath> <xpath expr="//div[@class='oe_items_list']" position="after"> - <div class="oe_center"> - <div class="oe_sum"><field name="sum_month_invoice"/></div> - <div class="oe_subsum">Invoiced this month</div> + <div class="oe_center" t-if="record.invoiced_target.raw_value"> + <field name="monthly_invoiced" widget="gage" style="width:160px; height: 120px;" options="{'max_field': 'invoiced_target'}">Invoiced</field> + <field name="invoiced_forecast" widget="gage" style="width:160px; height: 120px;" options="{'max_field': 'invoiced_target', 'action_change': 'action_forecast'}">Forecast</field> + </div> + <div class="oe_center" style="color:#bbbbbb;" t-if="!record.invoiced_target.raw_value"> + <br/>Define an invoicing target in the sales team settings to see the period's achievement and forecast at a glance. </div> </xpath> </data> diff --git a/addons/sale_crm/static/lib/justgage.js b/addons/sale_crm/static/lib/justgage.js new file mode 100644 index 00000000000..52b5c6ea0c3 --- /dev/null +++ b/addons/sale_crm/static/lib/justgage.js @@ -0,0 +1,883 @@ +/** + * JustGage - this is work-in-progress, unreleased, unofficial code, so it might not work top-notch :) + * Check http://www.justgage.com for official releases + * Licensed under MIT. + * @author Bojan Djuricic (@Toorshia) + * + * LATEST UPDATES + + * ----------------------------- + * April 01, 2013. + * ----------------------------- + * fix - https://github.com/toorshia/justgage/issues/46 + + * ----------------------------- + * March 26, 2013. + * ----------------------------- + * customSectors - define specific color for value range (0-10 : red, 10-30 : blue etc.) + + * ----------------------------- + * March 23, 2013. + * ----------------------------- + * counter - option to animate value in counting fashion + * fix - https://github.com/toorshia/justgage/issues/45 + + * ----------------------------- + * March 13, 2013. + * ----------------------------- + * refresh method - added optional 'max' parameter to use when you need to update max value + + * ----------------------------- + * February 26, 2013. + * ----------------------------- + * decimals - option to define/limit number of decimals when not using humanFriendly or customRenderer to display value + * fixed a missing parameters bug when calling generateShadow() for IE < 9 + + * ----------------------------- + * December 31, 2012. + * ----------------------------- + * fixed text y-position for hidden divs - workaround for Raphael <tspan> 'dy' bug - https://github.com/DmitryBaranovskiy/raphael/issues/491 + * 'show' parameters, like showMinMax are now 'hide' because I am lame developer - please update these in your setups + * Min and Max labels are now auto-off when in donut mode + * Start angle in donut mode is now 90 + * donutStartAngle - option to define start angle for donut + + * ----------------------------- + * November 25, 2012. + * ----------------------------- + * Option to define custom rendering function for displayed value + + * ----------------------------- + * November 19, 2012. + * ----------------------------- + * Config.value is now updated after gauge refresh + + * ----------------------------- + * November 13, 2012. + * ----------------------------- + * Donut display mode added + * Option to hide value label + * Option to enable responsive gauge size + * Removed default title attribute + * Option to accept min and max defined as string values + * Option to configure value symbol + * Fixed bad aspect ratio calculations + * Option to configure minimum font size for all texts + * Option to show shorthand big numbers (human friendly) + */ + + JustGage = function(config) { + + if (!config.id) {alert("Missing id parameter for gauge!"); return false;} + if (!config.node) { + if (!document.getElementById(config.id)) {alert("No element with id: \""+config.id+"\" found!"); return false;} + config.node = document.getElementById(config.id); + } + + var obj = this; + + // configurable parameters + obj.config = + { + // id : string + // this is container element id + id : config.id, + + // node : string + // the node to use instead of DOM + node : config.node, + + // title : string + // gauge title + title : (config.title) ? config.title : "", + + // titleFontColor : string + // color of gauge title + titleFontColor : (config.titleFontColor) ? config.titleFontColor : "#999999", + + // value : int + // value gauge is showing + value : (config.value) ? config.value : 0, + + + // valueFontColor : string + // color of label showing current value + valueFontColor : (config.valueFontColor) ? config.valueFontColor : "#010101", + + // symbol : string + // special symbol to show next to value + symbol : (config.symbol) ? config.symbol : "", + + // min : int + // min value + min : (config.min) ? parseFloat(config.min) : 0, + + // max : int + // max value + max : (config.max) ? parseFloat(config.max) : 100, + + // humanFriendlyDecimal : int + // number of decimal places for our human friendly number to contain + humanFriendlyDecimal : (config.humanFriendlyDecimal) ? config.humanFriendlyDecimal : 0, + + // textRenderer: func + // function applied before rendering text + textRenderer : (config.textRenderer) ? config.textRenderer : null, + + // gaugeWidthScale : float + // width of the gauge element + gaugeWidthScale : (config.gaugeWidthScale) ? config.gaugeWidthScale : 1.0, + + // gaugeColor : string + // background color of gauge element + gaugeColor : (config.gaugeColor) ? config.gaugeColor : "#edebeb", + + // label : string + // text to show below value + label : (config.label) ? config.label : "", + + // labelFontColor : string + // color of label showing label under value + labelFontColor : (config.labelFontColor) ? config.labelFontColor : "#b3b3b3", + + // shadowOpacity : int + // 0 ~ 1 + shadowOpacity : (config.shadowOpacity) ? config.shadowOpacity : 0.2, + + // shadowSize: int + // inner shadow size + shadowSize : (config.shadowSize) ? config.shadowSize : 5, + + // shadowVerticalOffset : int + // how much shadow is offset from top + shadowVerticalOffset : (config.shadowVerticalOffset) ? config.shadowVerticalOffset : 3, + + // levelColors : string[] + // colors of indicator, from lower to upper, in RGB format + levelColors : (config.levelColors) ? config.levelColors : [ + "#a9d70b", + "#f9c802", + "#ff0000" + ], + + // startAnimationTime : int + // length of initial animation + startAnimationTime : (config.startAnimationTime) ? config.startAnimationTime : 700, + + // startAnimationType : string + // type of initial animation (linear, >, <, <>, bounce) + startAnimationType : (config.startAnimationType) ? config.startAnimationType : ">", + + // refreshAnimationTime : int + // length of refresh animation + refreshAnimationTime : (config.refreshAnimationTime) ? config.refreshAnimationTime : 700, + + // refreshAnimationType : string + // type of refresh animation (linear, >, <, <>, bounce) + refreshAnimationType : (config.refreshAnimationType) ? config.refreshAnimationType : ">", + + // donutStartAngle : int + // angle to start from when in donut mode + donutStartAngle : (config.donutStartAngle) ? config.donutStartAngle : 90, + + // valueMinFontSize : int + // absolute minimum font size for the value + valueMinFontSize : config.valueMinFontSize || 16, + + // titleMinFontSize + // absolute minimum font size for the title + titleMinFontSize : config.titleMinFontSize || 10, + + // labelMinFontSize + // absolute minimum font size for the label + labelMinFontSize : config.labelMinFontSize || 10, + + // minLabelMinFontSize + // absolute minimum font size for the minimum label + minLabelMinFontSize : config.minLabelMinFontSize || 10, + + // maxLabelMinFontSize + // absolute minimum font size for the maximum label + maxLabelMinFontSize : config.maxLabelMinFontSize || 10, + + // hideValue : bool + // hide value text + hideValue : (config.hideValue) ? config.hideValue : false, + + // hideMinMax : bool + // hide min and max values + hideMinMax : (config.hideMinMax) ? config.hideMinMax : false, + + // hideInnerShadow : bool + // hide inner shadow + hideInnerShadow : (config.hideInnerShadow) ? config.hideInnerShadow : false, + + // humanFriendly : bool + // convert large numbers for min, max, value to human friendly (e.g. 1234567 -> 1.23M) + humanFriendly : (config.humanFriendly) ? config.humanFriendly : false, + + // noGradient : bool + // whether to use gradual color change for value, or sector-based + noGradient : (config.noGradient) ? config.noGradient : false, + + // donut : bool + // show full donut gauge + donut : (config.donut) ? config.donut : false, + + // relativeGaugeSize : bool + // whether gauge size should follow changes in container element size + relativeGaugeSize : (config.relativeGaugeSize) ? config.relativeGaugeSize : false, + + // counter : bool + // animate level number change + counter : (config.counter) ? config.counter : false, + + // decimals : int + // number of digits after floating point + decimals : (config.decimals) ? config.decimals : 0, + + // customSectors : [] of objects + // number of digits after floating point + customSectors : (config.customSectors) ? config.customSectors : [] + }; + + // variables + var + canvasW, + canvasH, + widgetW, + widgetH, + aspect, + dx, + dy, + titleFontSize, + titleX, + titleY, + valueFontSize, + valueX, + valueY, + labelFontSize, + labelX, + labelY, + minFontSize, + minX, + minY, + maxFontSize, + maxX, + maxY; + + // overflow values + if (this.config.value > this.config.max) this.config.value = this.config.max; + if (this.config.value < this.config.min) this.config.value = this.config.min; + this.originalValue = config.value; + + // canvas + this.canvas = Raphael(this.config.node, "100%", "100%"); + if (this.config.relativeGaugeSize === true) { + this.canvas.setViewBox(0, 0, 200, 150, true); + } + + // canvas dimensions + if (this.config.relativeGaugeSize === true) { + canvasW = 200; + canvasH = 150; + } else { + canvasW = getStyle(this.config.node, "width").slice(0, -2) * 1; + canvasH = getStyle(this.config.node, "height").slice(0, -2) * 1; + } + + // widget dimensions + if (this.config.donut === true) { + + // DONUT ******************************* + + // width more than height + if(canvasW > canvasH) { + widgetH = canvasH; + widgetW = widgetH; + // width less than height + } else if (canvasW < canvasH) { + widgetW = canvasW; + widgetH = widgetW; + // if height don't fit, rescale both + if(widgetH > canvasH) { + aspect = widgetH / canvasH; + widgetH = widgetH / aspect; + widgetW = widgetH / aspect; + } + // equal + } else { + widgetW = canvasW; + widgetH = widgetW; + } + + // delta + dx = (canvasW - widgetW)/2; + dy = (canvasH - widgetH)/2; + + // title + titleFontSize = ((widgetH / 8) > 10) ? (widgetH / 10) : 10; + titleX = dx + widgetW / 2; + titleY = dy + widgetH / 11; + + // value + valueFontSize = ((widgetH / 6.4) > 16) ? (widgetH / 5.4) : 18; + valueX = dx + widgetW / 2; + if(this.config.label !== '') { + valueY = dy + widgetH / 1.85; + } else { + valueY = dy + widgetH / 1.7; + } + + // label + labelFontSize = ((widgetH / 16) > 10) ? (widgetH / 16) : 10; + labelX = dx + widgetW / 2; + labelY = valueY + labelFontSize; + + // min + minFontSize = ((widgetH / 16) > 10) ? (widgetH / 16) : 10; + minX = dx + (widgetW / 10) + (widgetW / 6.666666666666667 * this.config.gaugeWidthScale) / 2 ; + minY = labelY; + + // max + maxFontSize = ((widgetH / 16) > 10) ? (widgetH / 16) : 10; + maxX = dx + widgetW - (widgetW / 10) - (widgetW / 6.666666666666667 * this.config.gaugeWidthScale) / 2 ; + maxY = labelY; + + } else { + // HALF ******************************* + + // width more than height + if(canvasW > canvasH) { + widgetH = canvasH; + widgetW = widgetH * 1.25; + //if width doesn't fit, rescale both + if(widgetW > canvasW) { + aspect = widgetW / canvasW; + widgetW = widgetW / aspect; + widgetH = widgetH / aspect; + } + // width less than height + } else if (canvasW < canvasH) { + widgetW = canvasW; + widgetH = widgetW / 1.25; + // if height don't fit, rescale both + if(widgetH > canvasH) { + aspect = widgetH / canvasH; + widgetH = widgetH / aspect; + widgetW = widgetH / aspect; + } + // equal + } else { + widgetW = canvasW; + widgetH = widgetW * 0.75; + } + + // delta + dx = (canvasW - widgetW)/2; + dy = (canvasH - widgetH)/2; + + // title + titleFontSize = ((widgetH / 8) > this.config.titleMinFontSize) ? (widgetH / 10) : this.config.titleMinFontSize; + titleX = dx + widgetW / 2; + titleY = dy + widgetH / 6.4; + + // value + valueFontSize = ((widgetH / 6.5) > this.config.valueMinFontSize) ? (widgetH / 6.5) : this.config.valueMinFontSize; + valueX = dx + widgetW / 2; + valueY = dy + widgetH / 1.275; + + // label + labelFontSize = ((widgetH / 16) > this.config.labelMinFontSize) ? (widgetH / 16) : this.config.labelMinFontSize; + labelX = dx + widgetW / 2; + labelY = valueY + valueFontSize / 2 + 5; + + // min + minFontSize = ((widgetH / 16) > this.config.minLabelMinFontSize) ? (widgetH / 16) : this.config.minLabelMinFontSize; + minX = dx + (widgetW / 10) + (widgetW / 6.666666666666667 * this.config.gaugeWidthScale) / 2 ; + minY = labelY; + + // max + maxFontSize = ((widgetH / 16) > this.config.maxLabelMinFontSize) ? (widgetH / 16) : this.config.maxLabelMinFontSize; + maxX = dx + widgetW - (widgetW / 10) - (widgetW / 6.666666666666667 * this.config.gaugeWidthScale) / 2 ; + maxY = labelY; + } + + // parameters + this.params = { + canvasW : canvasW, + canvasH : canvasH, + widgetW : widgetW, + widgetH : widgetH, + dx : dx, + dy : dy, + titleFontSize : titleFontSize, + titleX : titleX, + titleY : titleY, + valueFontSize : valueFontSize, + valueX : valueX, + valueY : valueY, + labelFontSize : labelFontSize, + labelX : labelX, + labelY : labelY, + minFontSize : minFontSize, + minX : minX, + minY : minY, + maxFontSize : maxFontSize, + maxX : maxX, + maxY : maxY + }; + + // var clear + canvasW, canvasH, widgetW, widgetH, aspect, dx, dy, titleFontSize, titleX, titleY, valueFontSize, valueX, valueY, labelFontSize, labelX, labelY, minFontSize, minX, minY, maxFontSize, maxX, maxY = null + + // pki - custom attribute for generating gauge paths + this.canvas.customAttributes.pki = function (value, min, max, w, h, dx, dy, gws, donut) { + + var alpha, Ro, Ri, Cx, Cy, Xo, Yo, Xi, Yi, path; + + if (donut) { + alpha = (1 - 2 * (value - min) / (max - min)) * Math.PI; + Ro = w / 2 - w / 7; + Ri = Ro - w / 6.666666666666667 * gws; + + Cx = w / 2 + dx; + Cy = h / 1.95 + dy; + + Xo = w / 2 + dx + Ro * Math.cos(alpha); + Yo = h - (h - Cy) + 0 - Ro * Math.sin(alpha); + Xi = w / 2 + dx + Ri * Math.cos(alpha); + Yi = h - (h - Cy) + 0 - Ri * Math.sin(alpha); + + path += "M" + (Cx - Ri) + "," + Cy + " "; + path += "L" + (Cx - Ro) + "," + Cy + " "; + if (value > ((max - min) / 2)) { + path += "A" + Ro + "," + Ro + " 0 0 1 " + (Cx + Ro) + "," + Cy + " "; + } + path += "A" + Ro + "," + Ro + " 0 0 1 " + Xo + "," + Yo + " "; + path += "L" + Xi + "," + Yi + " "; + if (value > ((max - min) / 2)) { + path += "A" + Ri + "," + Ri + " 0 0 0 " + (Cx + Ri) + "," + Cy + " "; + } + path += "A" + Ri + "," + Ri + " 0 0 0 " + (Cx - Ri) + "," + Cy + " "; + path += "Z "; + + return { path: path }; + + } else { + alpha = (1 - (value - min) / (max - min)) * Math.PI; + Ro = w / 2 - w / 10; + Ri = Ro - w / 6.666666666666667 * gws; + + Cx = w / 2 + dx; + Cy = h / 1.25 + dy; + + Xo = w / 2 + dx + Ro * Math.cos(alpha); + Yo = h - (h - Cy) + 0 - Ro * Math.sin(alpha); + Xi = w / 2 + dx + Ri * Math.cos(alpha); + Yi = h - (h - Cy) + 0 - Ri * Math.sin(alpha); + + path += "M" + (Cx - Ri) + "," + Cy + " "; + path += "L" + (Cx - Ro) + "," + Cy + " "; + path += "A" + Ro + "," + Ro + " 0 0 1 " + Xo + "," + Yo + " "; + path += "L" + Xi + "," + Yi + " "; + path += "A" + Ri + "," + Ri + " 0 0 0 " + (Cx - Ri) + "," + Cy + " "; + path += "Z "; + + return { path: path }; + } + + // var clear + alpha, Ro, Ri, Cx, Cy, Xo, Yo, Xi, Yi, path = null; + }; + + // gauge + this.gauge = this.canvas.path().attr({ + "stroke": "none", + "fill": this.config.gaugeColor, + pki: [this.config.max, this.config.min, this.config.max, this.params.widgetW, this.params.widgetH, this.params.dx, this.params.dy, this.config.gaugeWidthScale, this.config.donut] + }); + this.gauge.id = this.config.id+"-gauge"; + + // level + this.level = this.canvas.path().attr({ + "stroke": "none", + "fill": getColor(this.config.value, (this.config.value - this.config.min) / (this.config.max - this.config.min), this.config.levelColors, this.config.noGradient, this.config.customSectors), + pki: [this.config.min, this.config.min, this.config.max, this.params.widgetW, this.params.widgetH, this.params.dx, this.params.dy, this.config.gaugeWidthScale, this.config.donut] + }); + if(this.config.donut) { + this.level.transform("r" + this.config.donutStartAngle + ", " + (this.params.widgetW/2 + this.params.dx) + ", " + (this.params.widgetH/1.95 + this.params.dy)); + } + this.level.id = this.config.id+"-level"; + + // title + this.txtTitle = this.canvas.text(this.params.titleX, this.params.titleY, this.config.title); + this.txtTitle.attr({ + "font-size":this.params.titleFontSize, + "font-weight":"bold", + "font-family":"Arial", + "fill":this.config.titleFontColor, + "fill-opacity":"1" + }); + setDy(this.txtTitle, this.params.titleFontSize, this.params.titleY); + this.txtTitle.id = this.config.id+"-txttitle"; + + // value + this.txtValue = this.canvas.text(this.params.valueX, this.params.valueY, 0); + this.txtValue.attr({ + "font-size":this.params.valueFontSize, + "font-weight":"bold", + "font-family":"Arial", + "fill":this.config.valueFontColor, + "fill-opacity":"0" + }); + setDy(this.txtValue, this.params.valueFontSize, this.params.valueY); + this.txtValue.id = this.config.id+"-txtvalue"; + + // label + this.txtLabel = this.canvas.text(this.params.labelX, this.params.labelY, this.config.label); + this.txtLabel.attr({ + "font-size":this.params.labelFontSize, + "font-weight":"normal", + "font-family":"Arial", + "fill":this.config.labelFontColor, + "fill-opacity":"0" + }); + setDy(this.txtLabel, this.params.labelFontSize, this.params.labelY); + this.txtLabel.id = this.config.id+"-txtlabel"; + + // min + this.txtMinimum = this.config.min; + if( this.config.humanFriendly ) this.txtMinimum = humanFriendlyNumber( this.config.min, this.config.humanFriendlyDecimal ); + this.txtMin = this.canvas.text(this.params.minX, this.params.minY, this.txtMinimum); + this.txtMin.attr({ + "font-size":this.params.minFontSize, + "font-weight":"normal", + "font-family":"Arial", + "fill":this.config.labelFontColor, + "fill-opacity": (this.config.hideMinMax || this.config.donut)? "0" : "1" + }); + setDy(this.txtMin, this.params.minFontSize, this.params.minY); + this.txtMin.id = this.config.id+"-txtmin"; + + // max + this.txtMaximum = this.config.max; + if( this.config.humanFriendly ) this.txtMaximum = humanFriendlyNumber( this.config.max, this.config.humanFriendlyDecimal ); + this.txtMax = this.canvas.text(this.params.maxX, this.params.maxY, this.txtMaximum); + this.txtMax.attr({ + "font-size":this.params.maxFontSize, + "font-weight":"normal", + "font-family":"Arial", + "fill":this.config.labelFontColor, + "fill-opacity": (this.config.hideMinMax || this.config.donut)? "0" : "1" + }); + setDy(this.txtMax, this.params.maxFontSize, this.params.maxY); + this.txtMax.id = this.config.id+"-txtmax"; + + var defs = this.canvas.canvas.childNodes[1]; + var svg = "http://www.w3.org/2000/svg"; + + if (ie < 9) { + onCreateElementNsReady(function() { + this.generateShadow(svg, defs); + }); + } else { + this.generateShadow(svg, defs); + } + + // var clear + defs, svg = null; + + // execute on each animation frame + function onAnimate() { + if (obj.config.counter) { + var currentValue = obj.level.attr("pki"); + + if(obj.config.textRenderer) { + // this.originalValue = this.config.textRenderer(this.originalValue); + obj.txtValue.attr("text", obj.config.textRenderer(Math.floor(currentValue[0]))); + } else if(obj.config.humanFriendly) { + // this.originalValue = humanFriendlyNumber( this.originalValue, this.config.humanFriendlyDecimal ) + this.config.symbol; + obj.txtValue.attr("text", humanFriendlyNumber( Math.floor(currentValue[0]), obj.config.humanFriendlyDecimal ) + obj.config.symbol); + } else { + // this.originalValue += this.config.symbol; + obj.txtValue.attr("text", (currentValue[0] * 1).toFixed(obj.config.decimals) + obj.config.symbol); + } + + setDy(obj.txtValue, obj.params.valueFontSize, obj.params.valueY); + currentValue = null; + } + } + + if(!obj.config.counter) { + if(obj.config.textRenderer) { + obj.originalValue = obj.config.textRenderer(obj.originalValue); + } else if(obj.config.humanFriendly) { + obj.originalValue = humanFriendlyNumber( obj.originalValue, obj.config.humanFriendlyDecimal ) + obj.config.symbol; + } else { + obj.originalValue = (obj.originalValue * 1).toFixed(obj.config.decimals) + obj.config.symbol; + } + + obj.txtValue.attr("text", obj.originalValue); + setDy(obj.txtValue, obj.params.valueFontSize, obj.params.valueY); + } + + //event fired on each animation frame + eve.on("raphael.anim.frame.*", onAnimate); + + // animate gauge level + this.level.animate({pki: [this.config.value, this.config.min, this.config.max, this.params.widgetW, this.params.widgetH, this.params.dx, this.params.dy, this.config.gaugeWidthScale, this.config.donut]}, this.config.startAnimationTime, this.config.startAnimationType); + + // animate value + this.txtValue.animate({"fill-opacity":"1"}, this.config.startAnimationTime, this.config.startAnimationType); + + // animate label + this.txtLabel.animate({"fill-opacity":"1"}, this.config.startAnimationTime, this.config.startAnimationType); +}; + +/** Refresh gauge level */ +JustGage.prototype.refresh = function(val, max) { + + var originalVal, displayVal, color, max = max || null; + + // set new max + if(max !== null) { + this.config.max = max; + + this.txtMaximum = this.config.max; + if( this.config.humanFriendly ) this.txtMaximum = humanFriendlyNumber( this.config.max, this.config.humanFriendlyDecimal ); + this.txtMax.attr({"text" : this.config.max}); + setDy(this.txtMax, this.params.maxFontSize, this.params.maxY); + } + + // overflow values + originalVal = val; + displayVal = val; + if ((val * 1) > (this.config.max * 1)) {val = (this.config.max * 1);} + if ((val * 1) < (this.config.min * 1)) {val = (this.config.min * 1);} + + color = getColor(val, (val - this.config.min) / (this.config.max - this.config.min), this.config.levelColors, this.config.noGradient, this.config.customSectors); + + if(this.config.textRenderer) { + displayVal = this.config.textRenderer(displayVal); + } else if( this.config.humanFriendly ) { + displayVal = humanFriendlyNumber( displayVal, this.config.humanFriendlyDecimal ) + this.config.symbol; + } else { + displayVal = (displayVal * 1).toFixed(this.config.decimals) + this.config.symbol; + } + + if(!this.config.counter) { + this.canvas.getById(this.config.id+"-txtvalue").attr({"text":displayVal}); + setDy(this.canvas.getById(this.config.id+"-txtvalue"), this.params.valueFontSize, this.params.valueY); + } + + this.canvas.getById(this.config.id+"-level").animate({pki: [val, this.config.min, this.config.max, this.params.widgetW, this.params.widgetH, this.params.dx, this.params.dy, this.config.gaugeWidthScale, this.config.donut], "fill":color}, this.config.refreshAnimationTime, this.config.refreshAnimationType); + this.config.value = val * 1; + + // var clear + originalVal, displayVal, color, max = null; +}; + +/** Generate shadow */ +JustGage.prototype.generateShadow = function(svg, defs) { + + var gaussFilter, feOffset, feGaussianBlur, feComposite1, feFlood, feComposite2, feComposite3; + + // FILTER + gaussFilter=document.createElementNS(svg,"filter"); + gaussFilter.setAttribute("id", this.config.id + "-inner-shadow"); + defs.appendChild(gaussFilter); + + // offset + feOffset = document.createElementNS(svg,"feOffset"); + feOffset.setAttribute("dx", 0); + feOffset.setAttribute("dy", this.config.shadowVerticalOffset); + gaussFilter.appendChild(feOffset); + + // blur + feGaussianBlur = document.createElementNS(svg,"feGaussianBlur"); + feGaussianBlur.setAttribute("result","offset-blur"); + feGaussianBlur.setAttribute("stdDeviation", this.config.shadowSize); + gaussFilter.appendChild(feGaussianBlur); + + // composite 1 + feComposite1 = document.createElementNS(svg,"feComposite"); + feComposite1.setAttribute("operator","out"); + feComposite1.setAttribute("in", "SourceGraphic"); + feComposite1.setAttribute("in2","offset-blur"); + feComposite1.setAttribute("result","inverse"); + gaussFilter.appendChild(feComposite1); + + // flood + feFlood = document.createElementNS(svg,"feFlood"); + feFlood.setAttribute("flood-color","black"); + feFlood.setAttribute("flood-opacity", this.config.shadowOpacity); + feFlood.setAttribute("result","color"); + gaussFilter.appendChild(feFlood); + + // composite 2 + feComposite2 = document.createElementNS(svg,"feComposite"); + feComposite2.setAttribute("operator","in"); + feComposite2.setAttribute("in", "color"); + feComposite2.setAttribute("in2","inverse"); + feComposite2.setAttribute("result","shadow"); + gaussFilter.appendChild(feComposite2); + + // composite 3 + feComposite3 = document.createElementNS(svg,"feComposite"); + feComposite3.setAttribute("operator","over"); + feComposite3.setAttribute("in", "shadow"); + feComposite3.setAttribute("in2","SourceGraphic"); + gaussFilter.appendChild(feComposite3); + + // set shadow + if (!this.config.hideInnerShadow) { + this.canvas.canvas.childNodes[2].setAttribute("filter", "url(#" + this.config.id + "-inner-shadow)"); + this.canvas.canvas.childNodes[3].setAttribute("filter", "url(#" + this.config.id + "-inner-shadow)"); + } + + // var clear + gaussFilter, feOffset, feGaussianBlur, feComposite1, feFlood, feComposite2, feComposite3 = null; + +}; + +/** Get color for value */ +function getColor(val, pct, col, noGradient, custSec) { + + var no, inc, colors, percentage, rval, gval, bval, lower, upper, range, rangePct, pctLower, pctUpper, color; + var noGradient = noGradient || custSec.length > 0; + + if(custSec.length > 0) { + for(var i = 0; i < custSec.length; i++) { + if(val > custSec[i].lo && val <= custSec[i].hi) { + return custSec[i].color; + } + } + } + + no = col.length; + if (no === 1) return col[0]; + inc = (noGradient) ? (1 / no) : (1 / (no - 1)); + colors = []; + for (var i = 0; i < col.length; i++) { + percentage = (noGradient) ? (inc * (i + 1)) : (inc * i); + rval = parseInt((cutHex(col[i])).substring(0,2),16); + gval = parseInt((cutHex(col[i])).substring(2,4),16); + bval = parseInt((cutHex(col[i])).substring(4,6),16); + colors[i] = { pct: percentage, color: { r: rval, g: gval, b: bval } }; + } + + if(pct === 0) { + return 'rgb(' + [colors[0].color.r, colors[0].color.g, colors[0].color.b].join(',') + ')'; + } + + for (var j = 0; j < colors.length; j++) { + if (pct <= colors[j].pct) { + if (noGradient) { + return 'rgb(' + [colors[j].color.r, colors[j].color.g, colors[j].color.b].join(',') + ')'; + } else { + lower = colors[j - 1]; + upper = colors[j]; + range = upper.pct - lower.pct; + rangePct = (pct - lower.pct) / range; + pctLower = 1 - rangePct; + pctUpper = rangePct; + color = { + r: Math.floor(lower.color.r * pctLower + upper.color.r * pctUpper), + g: Math.floor(lower.color.g * pctLower + upper.color.g * pctUpper), + b: Math.floor(lower.color.b * pctLower + upper.color.b * pctUpper) + }; + return 'rgb(' + [color.r, color.g, color.b].join(',') + ')'; + } + } + } + +} + +/** Fix Raphael display:none tspan dy attribute bug */ +function setDy(elem, fontSize, txtYpos) { + if ((!ie || ie > 9) && (elem.node.firstChild.attributes.dy)) { + elem.node.firstChild.attributes.dy.value = 0; + } +} + +/** Random integer */ +function getRandomInt (min, max) { + return Math.floor(Math.random() * (max - min + 1)) + min; +} + +/** Cut hex */ +function cutHex(str) { + return (str.charAt(0)=="#") ? str.substring(1,7):str; +} + +/** Human friendly number suffix - From: http://stackoverflow.com/questions/2692323/code-golf-friendly-number-abbreviator */ +function humanFriendlyNumber( n, d ) { + var p, d2, i, s; + + p = Math.pow; + d2 = p(10, d); + i = 7; + while( i ) { + s = p(10,i--*3); + if( s <= n ) { + n = Math.round(n*d2/s)/d2+"KMGTPE"[i]; + } + } + return n; +} + +/** Get style */ +function getStyle(oElm, strCssRule){ + var strValue = ""; + if(document.defaultView && document.defaultView.getComputedStyle){ + strValue = document.defaultView.getComputedStyle(oElm).getPropertyValue(strCssRule); + } + else if(oElm.currentStyle){ + strCssRule = strCssRule.replace(/\-(\w)/g, function (strMatch, p1){ + return p1.toUpperCase(); + }); + strValue = oElm.currentStyle[strCssRule]; + } + return strValue; +} + +/** Create Element NS Ready */ +function onCreateElementNsReady(func) { + if (document.createElementNS !== undefined) { + func(); + } else { + setTimeout(function() { onCreateElementNsReady(func); }, 100); + } +} + +/** Get IE version */ +// ---------------------------------------------------------- +// A short snippet for detecting versions of IE in JavaScript +// without resorting to user-agent sniffing +// ---------------------------------------------------------- +// If you're not in IE (or IE version is less than 5) then: +// ie === undefined +// If you're in IE (>=5) then you can determine which version: +// ie === 7; // IE7 +// Thus, to detect IE: +// if (ie) {} +// And to detect the version: +// ie === 6 // IE6 +// ie > 7 // IE8, IE9 ... +// ie < 9 // Anything less than IE9 +// ---------------------------------------------------------- +// UPDATE: Now using Live NodeList idea from @jdalton +var ie = (function(){ + + var undef, + v = 3, + div = document.createElement('div'), + all = div.getElementsByTagName('i'); + + while ( + div.innerHTML = '<!--[if gt IE ' + (++v) + ']><i></i><![endif]-->', + all[0] + ); + return v > 4 ? v : undef; +}());
\ No newline at end of file diff --git a/addons/sale_crm/static/src/js/sale_crm.js b/addons/sale_crm/static/src/js/sale_crm.js new file mode 100644 index 00000000000..207ac959af3 --- /dev/null +++ b/addons/sale_crm/static/src/js/sale_crm.js @@ -0,0 +1,108 @@ +openerp.sale_crm = function(openerp) { +var _t = openerp.web._t; + +openerp.sale_crm.GaugeWidget = openerp.web_kanban.AbstractField.extend({ + className: "oe_gage", + start: function() { + var self = this; + + var parent = this.getParent(); + var max = this.options.max_field ? parent.record[this.options.max_field].raw_value : 100; + var label = this.options.label_field ? parent.record[this.options.label_field].raw_value : ""; + var title = this.$node.html(); + var val = this.field.value; + var value = _.isArray(val) && val.length ? val[val.length-1]['value'] : val; + var unique_id = _.uniqueId("JustGage"); + + this.$el.empty() + .attr('style', this.$node.attr('style') + ';position:relative; display:inline-block;') + .attr('id', unique_id); + this.gage = new JustGage({ + id: unique_id, + node: this.$el[0], + title: title, + value: value, + min: 0, + max: max, + relativeGaugeSize: true, + humanFriendly: true, + titleFontColor: '#333333', + valueFontColor: '#333333', + labelFontColor: '#000', + label: label, + levelColors: [ + "#ff0000", + "#f9c802", + "#a9d70b" + ], + }); + + var flag_open = false; + if (self.options.action_change) { + var $svg = self.$el.find('svg'); + var css = { + 'text-align': 'center', + 'position': 'absolute', + 'width': self.$el.outerWidth() + 'px', + 'top': (self.$el.outerHeight()/2-5) + 'px' + }; + + self.$el.click(function (event) { + event.stopPropagation(); + flag_open = false; + if (!parent.view.is_action_enabled('edit')) { + return; + } + if (!self.$el.find(".oe_justgage_edit").size()) { + $div = $('<div class="oe_justgage_edit" style="z-index:1"/>'); + $div.css(css); + $input = $('<input/>').val(value); + $input.css({ + 'text-align': 'center', + 'margin': 'auto', + 'width': ($svg.outerWidth()-40) + 'px' + }); + $div.append($input); + self.$el.prepend($div) + $input.focus() + .keydown(function (event) { + event.stopPropagation(); + if (event.keyCode == 13 || event.keyCode == 9) { + if ($input.val() != value) { + parent.view.dataset.call(self.options.action_change, [parent.id, $input.val()]).then(function () { + parent.do_reload(); + }); + } else { + $div.remove(); + } + } + }) + .click(function (event) { + event.stopPropagation(); + flag_open = false; + }) + .blur(function (event) { + if(!flag_open) { + self.$el.find(".oe_justgage_edit").remove(); + } else { + flag_open = false; + setTimeout(function () {$input.focus();}, 0); + } + }); + } + }).mousedown(function () { + flag_open = true; + }); + + if (!+value) { + $svg.fadeTo(0, 0.3); + $div = $('<div/>').text(_t("Click to change value")); + $div.css(css); + self.$el.append($div); + } + } + }, +}); +openerp.web_kanban.fields_registry.add("gage", "openerp.sale_crm.GaugeWidget"); + +}; diff --git a/addons/sale_crm/wizard/crm_make_sale.py b/addons/sale_crm/wizard/crm_make_sale.py index 6bea6286456..da770af6d82 100644 --- a/addons/sale_crm/wizard/crm_make_sale.py +++ b/addons/sale_crm/wizard/crm_make_sale.py @@ -87,7 +87,7 @@ class crm_make_sale(osv.osv_memory): ['default', 'invoice', 'delivery', 'contact']) pricelist = partner.property_product_pricelist.id if False in partner_addr.values(): - raise osv.except_osv(_('Insufficient Data!'), _('No addresse(s) defined for this customer.')) + raise osv.except_osv(_('Insufficient Data!'), _('No address(es) defined for this customer.')) vals = { 'origin': _('Opportunity: %s') % str(case.id), diff --git a/addons/sale_journal/i18n/ru.po b/addons/sale_journal/i18n/ru.po index b4830dcfcd7..9a4370f5d61 100644 --- a/addons/sale_journal/i18n/ru.po +++ b/addons/sale_journal/i18n/ru.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-12-21 17:06+0000\n" -"PO-Revision-Date: 2011-01-20 08:56+0000\n" +"PO-Revision-Date: 2013-06-05 11:29+0000\n" "Last-Translator: Chertykov Denis <chertykov@gmail.com>\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: 2013-03-16 05:27+0000\n" -"X-Generator: Launchpad (build 16532)\n" +"X-Launchpad-Export-Date: 2013-06-06 05:21+0000\n" +"X-Generator: Launchpad (build 16667)\n" #. module: sale_journal #: field:sale_journal.invoice.type,note:0 @@ -31,6 +31,8 @@ msgstr "Способ выставления счета" msgid "" "This invoicing type will be used, by default, to invoice the current partner." msgstr "" +"Этот тип счета будет использоваться по умолчанию для выставления текущего " +"счета партнера." #. module: sale_journal #: view:res.partner:0 @@ -45,7 +47,7 @@ msgstr "Выставление счета" #. module: sale_journal #: model:ir.model,name:sale_journal.model_stock_picking_in msgid "Incoming Shipments" -msgstr "" +msgstr "Поступающие ТМЦ" #. module: sale_journal #: help:sale_journal.invoice.type,active:0 @@ -103,7 +105,7 @@ msgstr "" #. module: sale_journal #: help:sale.order,invoice_type_id:0 msgid "Generate invoice based on the selected option." -msgstr "" +msgstr "Генерировать счет на основе выбранного варианта." #. module: sale_journal #: view:sale.order:0 @@ -137,7 +139,7 @@ msgstr "Заказ продаж" #. module: sale_journal #: model:ir.model,name:sale_journal.model_stock_picking_out msgid "Delivery Orders" -msgstr "" +msgstr "Заказы доставки" #~ msgid "Monthly sales" #~ msgstr "Продажи в месяце" diff --git a/addons/sale_margin/i18n/ru.po b/addons/sale_margin/i18n/ru.po index 7c764c89223..cac4fe13548 100644 --- a/addons/sale_margin/i18n/ru.po +++ b/addons/sale_margin/i18n/ru.po @@ -8,14 +8,14 @@ msgstr "" "Project-Id-Version: openobject-addons\n" "Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n" "POT-Creation-Date: 2012-12-21 17:06+0000\n" -"PO-Revision-Date: 2011-01-20 08:51+0000\n" +"PO-Revision-Date: 2013-06-04 13:50+0000\n" "Last-Translator: Chertykov Denis <chertykov@gmail.com>\n" "Language-Team: Russian <ru@li.org>\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2013-03-16 05:40+0000\n" -"X-Generator: Launchpad (build 16532)\n" +"X-Launchpad-Export-Date: 2013-06-05 05:32+0000\n" +"X-Generator: Launchpad (build 16660)\n" #. module: sale_margin #: field:sale.order.line,purchase_price:0 @@ -44,6 +44,7 @@ msgid "" "It gives profitability by calculating the difference between the Unit Price " "and the cost price." msgstr "" +"Дает прибыльность как разницу между стоимостью единицы и себестоимостью." #~ msgid "Customer Invoice" #~ msgstr "Счета клиентам" diff --git a/addons/sale_margin/sale_margin_view.xml b/addons/sale_margin/sale_margin_view.xml index 88647ea3c46..be16429526a 100644 --- a/addons/sale_margin/sale_margin_view.xml +++ b/addons/sale_margin/sale_margin_view.xml @@ -9,7 +9,7 @@ <field name="arch" type="xml"> <xpath expr="//group[@name='sale_total']" position="after"> <group name="sale_margin_grp"> - <field name="margin" widget='monetary' options="{'currency_field': 'currency_id'}"/> + <field name="margin" widget='monetary' options="{'currency_field': 'currency_id'}" groups="base.group_user"/> </group> </xpath> </field> diff --git a/addons/sale_stock/i18n/ru.po b/addons/sale_stock/i18n/ru.po index f5c54417077..28f156fb871 100644 --- a/addons/sale_stock/i18n/ru.po +++ b/addons/sale_stock/i18n/ru.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-12-21 17:06+0000\n" -"PO-Revision-Date: 2013-01-04 16:04+0000\n" +"PO-Revision-Date: 2013-06-06 11:30+0000\n" "Last-Translator: Chertykov Denis <chertykov@gmail.com>\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: 2013-03-16 05:51+0000\n" -"X-Generator: Launchpad (build 16532)\n" +"X-Launchpad-Export-Date: 2013-06-07 05:48+0000\n" +"X-Generator: Launchpad (build 16667)\n" #. module: sale_stock #: help:sale.config.settings,group_invoice_deli_orders:0 @@ -22,11 +22,13 @@ msgid "" "To allow your salesman to make invoices for Delivery Orders using the menu " "'Deliveries to Invoice'." msgstr "" +"Позволяет вашему продавцу создавать счета для заказов доставки используя " +"меню \"Доставки в счета\"." #. module: sale_stock #: model:process.node,name:sale_stock.process_node_deliveryorder0 msgid "Delivery Order" -msgstr "Заказ на доставку" +msgstr "Заказ доставки" #. module: sale_stock #: model:ir.actions.act_window,name:sale_stock.outgoing_picking_list_to_invoice @@ -86,12 +88,12 @@ msgstr "" #. module: sale_stock #: model:process.transition,name:sale_stock.process_transition_saleprocurement0 msgid "Create Procurement Order" -msgstr "Создать заказ на снабжение" +msgstr "Создать заказ снабжения" #. module: sale_stock #: field:stock.picking.out,sale_id:0 msgid "Sale Order" -msgstr "Заказ" +msgstr "Заказ продажи" #. module: sale_stock #: model:process.transition,note:sale_stock.process_transition_saleorderprocurement0 @@ -99,8 +101,8 @@ msgid "" "For every sales order line, a procurement order is created to supply the " "sold product." msgstr "" -"Для каждой позиции заказа на продажу создается заказ на снабжение для " -"поставки проданных ТМЦ." +"Для каждой позиции заказа продаж создается заказ снабжения для поставки " +"проданных ТМЦ." #. module: sale_stock #: code:addons/sale_stock/sale_stock.py:615 @@ -129,8 +131,7 @@ msgstr "Магазин" #. module: sale_stock #: model:process.node,note:sale_stock.process_node_saleorderprocurement0 msgid "Drives procurement orders for every sales order line." -msgstr "" -"Управление заказами на снабжение для каждой позиции заказа на продажу." +msgstr "Управление заказами снабжения для каждой позиции заказа продаж." #. module: sale_stock #: model:ir.model,name:sale_stock.model_stock_move @@ -151,7 +152,7 @@ msgstr "Табель проекта" #. module: sale_stock #: field:sale.config.settings,group_sale_delivery_address:0 msgid "Allow a different address for delivery and invoicing " -msgstr "" +msgstr "Разрешить различные адреса для доставки и выставления счета " #. module: sale_stock #: code:addons/sale_stock/sale_stock.py:546 @@ -163,18 +164,18 @@ msgstr "Ошибка конфигурации!" #. module: sale_stock #: model:process.node,name:sale_stock.process_node_saleprocurement0 msgid "Procurement Order" -msgstr "Заказ на закупку" +msgstr "Заказ снабжения" #. module: sale_stock #: selection:sale.config.settings,default_order_policy:0 msgid "Invoice based on deliveries" -msgstr "Счет основанный на отгрузке" +msgstr "Счет основанный на доставках" #. module: sale_stock #: model:ir.model,name:sale_stock.model_sale_order #: field:stock.picking,sale_id:0 msgid "Sales Order" -msgstr "Заказ на продажу" +msgstr "Заказ продаж" #. module: sale_stock #: model:ir.model,name:sale_stock.model_stock_picking_out @@ -185,7 +186,7 @@ msgstr "Заказы доставки" #: model:ir.model,name:sale_stock.model_sale_order_line #: field:stock.move,sale_line_id:0 msgid "Sales Order Line" -msgstr "Позиция заказа на продажу" +msgstr "Позиция заказа продаж" #. module: sale_stock #: model:process.transition,note:sale_stock.process_transition_packing0 @@ -195,11 +196,11 @@ msgid "" "parts to the sales order. There is 1 pick list by sales order line which " "evolves with the availability of parts." msgstr "" -"Форма комплектовочного листа создастся как только заказ на продажу будет " -"подтвержден, в одно время с заказом на снабжение. Он представляет собой " -"определение комплектующих для заказа на продажу. Один комплектовочный лист " -"на позицию заказа на продажу, который будет меняться в соответствии с " -"наличием комплектующих." +"Форма комплектовочного листа создастся как только заказ продаж будет " +"подтвержден, в одно время с заказом снабжения. Он представляет собой " +"определение комплектующих для заказа продаж. Один комплектовочный лист на " +"позицию заказа продаж, который будет меняться в соответствии с наличием " +"комплектующих." #. module: sale_stock #: help:res.company,security_lead:0 @@ -240,7 +241,7 @@ msgstr "Документ перемещения к заказчику." #. module: sale_stock #: view:sale.order:0 msgid "View Delivery Order" -msgstr "" +msgstr "Вид заказа доставки" #. module: sale_stock #: field:sale.order.line,move_ids:0 @@ -276,7 +277,7 @@ msgstr "Снабжение" #: field:sale.report,shipped:0 #: field:sale.report,shipped_qty_1:0 msgid "Shipped" -msgstr "Доставлено" +msgstr "Отправлено" #. module: sale_stock #: code:addons/sale_stock/sale_stock.py:240 @@ -292,24 +293,24 @@ msgid "" "production of products regarding to the rules and to the sales order's " "parameters. " msgstr "" -"Заказ на снабжение создастся автоматически как только заказ на продажу будет " +"Заказ снабжения создастся автоматически как только заказ продаж будет " "подтвержден или счет будет оплачен. Он определяет закупку и производство ТМЦ " -"по правилам и параметрам заказа на продажу. " +"по правилам и параметрам заказа продаж. " #. module: sale_stock #: help:sale.config.settings,group_mrp_properties:0 msgid "Allows you to tag sales order lines with properties." -msgstr "" +msgstr "Позволяет отмечать тегами позиции заказа продажи со свойствами" #. module: sale_stock #: field:sale.config.settings,group_invoice_deli_orders:0 msgid "Generate invoices after and based on delivery orders" -msgstr "" +msgstr "Генерировать счета после и из заказов доставки" #. module: sale_stock #: field:sale.config.settings,module_delivery:0 msgid "Allow adding shipping costs" -msgstr "" +msgstr "Позволяет добавлять стоимость доставки" #. module: sale_stock #: view:sale.order:0 @@ -327,6 +328,8 @@ msgid "" "International Commercial Terms are a series of predefined commercial terms " "used in international transactions." msgstr "" +"Международные правила по толкованию наиболее широко используемых торговых " +"терминов в области внешней торговли." #. module: sale_stock #: help:sale.config.settings,module_delivery:0 @@ -345,7 +348,7 @@ msgstr "Доставка всего сразу, если все готово." #. module: sale_stock #: model:res.groups,name:sale_stock.group_invoice_deli_orders msgid "Enable Invoicing Delivery orders" -msgstr "" +msgstr "Разрешить выставлять счета на заказы доставки" #. module: sale_stock #: field:res.company,security_lead:0 @@ -362,6 +365,8 @@ msgstr "Закупка проданного материала" msgid "" "Pick 'Deliver each product when available' if you allow partial delivery." msgstr "" +"Выбрать \"Доставить каждый товар по готовности\" если вы разрешили частичную " +"доставки" #. module: sale_stock #: code:addons/sale_stock/sale_stock.py:206 @@ -380,7 +385,7 @@ msgid "" "It indicates that the sales order has been delivered. This field is updated " "only after the scheduler(s) have been launched." msgstr "" -"Показывает, что заказ на продажу был доставлен. Это поле обновляется только " +"Показывает, что заказ продаж был доставлен. Это поле обновляется только " "после запуска планировщика." #. module: sale_stock @@ -398,12 +403,12 @@ msgstr "Свойства изделия в позиции заказа" msgid "" "You can generate invoices based on sales orders or based on shippings." msgstr "" -"Вы можете создать счет на основе заказов на продажу или на основе доставок." +"Вы можете создать счет на основе заказов продаж или на основе доставок." #. module: sale_stock #: model:ir.model,name:sale_stock.model_sale_report msgid "Sales Orders Statistics" -msgstr "Статистика заказов на продажу" +msgstr "Статистика заказов продаж" #. module: sale_stock #: model:ir.model,name:sale_stock.model_res_company @@ -428,6 +433,8 @@ msgid "" "Allows you to specify different delivery and invoice addresses on a sales " "order." msgstr "" +"Позволяет задавать разные адреса для доставки и выставления счета в заказе " +"продажи." #. module: sale_stock #: model:process.node,note:sale_stock.process_node_saleprocurement0 @@ -435,7 +442,7 @@ msgid "" "One Procurement order for each sales order line and for each of the " "components." msgstr "" -"Один заказ на снабжение для каждой позиции заказа на продажу и для каждого " +"Один заказ снабжения для каждой позиции заказа продаж и для каждого " "компонента." #. module: sale_stock @@ -455,6 +462,7 @@ msgid "" "Number of days between the order confirmation and the shipping of the " "products to the customer" msgstr "" +"Количество дней между подтверждением заказа и отгрузкой продукции заказчику" #. module: sale_stock #: help:sale.config.settings,default_picking_policy:0 @@ -467,7 +475,7 @@ msgstr "" #. module: sale_stock #: selection:sale.config.settings,default_order_policy:0 msgid "Invoice based on sales orders" -msgstr "" +msgstr "Счет основан на заказах продаж" #. module: sale_stock #: model:process.node,name:sale_stock.process_node_invoiceafterdelivery0 @@ -487,6 +495,9 @@ msgid "" "In order to delete a confirmed sales order, you must cancel it.\n" "To do so, you must first cancel related picking for delivery orders." msgstr "" +"Для того, чтобы удалить подтвержденный заказ, вы должны отменить его.\n" +"Чтобы сделать это, Вы должны сначала отменить комплектование для заказов " +"доставки." #. module: sale_stock #: field:sale.order.line,number_packages:0 @@ -506,7 +517,7 @@ msgstr "Создать счет" #. module: sale_stock #: field:sale.config.settings,task_work:0 msgid "Prepare invoices based on task's activities" -msgstr "" +msgstr "Подготовка счетов основанных на действиях по задачам" #. module: sale_stock #: model:ir.model,name:sale_stock.model_sale_advance_payment_inv @@ -519,7 +530,7 @@ msgstr "Счет на авансовый платеж" msgid "You must first cancel stock moves attached to this sales order line." msgstr "" "Сначала вы должны отменить перемещения ТМЦ связанные с этой позицией заказа " -"на продажу." +"продаж." #. module: sale_stock #: code:addons/sale_stock/sale_stock.py:535 @@ -536,7 +547,7 @@ msgstr "Инкотерм" #: code:addons/sale_stock/sale_stock.py:496 #, python-format msgid "Cannot cancel sales order line!" -msgstr "" +msgstr "Нельзя отменить позицию заказа продаж!" #. module: sale_stock #: model:process.transition.action,name:sale_stock.process_transition_action_cancelassignation0 @@ -551,7 +562,7 @@ msgstr "На основании отгруженного или заказанн #. module: sale_stock #: selection:sale.order,picking_policy:0 msgid "Deliver all products at once" -msgstr "Отгрузка всех товаров за раз" +msgstr "Доставка всех товаров за раз" #. module: sale_stock #: field:sale.order,picking_ids:0 @@ -561,7 +572,7 @@ msgstr "Связанное комплектование" #. module: sale_stock #: model:ir.model,name:sale_stock.model_sale_config_settings msgid "sale.config.settings" -msgstr "" +msgstr "sale.config.settings" #. module: sale_stock #: help:sale.order,picking_ids:0 @@ -569,21 +580,22 @@ msgid "" "This is a list of delivery orders that has been generated for this sales " "order." msgstr "" +"Это список заказов доставки который был создан для этого заказа продажи." #. module: sale_stock #: model:process.node,name:sale_stock.process_node_saleorderprocurement0 msgid "Sales Order Requisition" -msgstr "Запрос заказа на продажу" +msgstr "Запрос заказа продаж" #. module: sale_stock #: model:process.transition,name:sale_stock.process_transition_deliver0 msgid "Create Delivery Order" -msgstr "Создать заказ на доставку" +msgstr "Создать заказ доставки" #. module: sale_stock #: view:sale.order:0 msgid "Ignore Exception" -msgstr "Игнорировать исключение" +msgstr "Игнорировать исключительную ситуацию" #. module: sale_stock #: code:addons/sale_stock/sale_stock.py:588 @@ -598,12 +610,12 @@ msgstr "" #. module: sale_stock #: view:sale.order:0 msgid "Recreate Delivery Order" -msgstr "" +msgstr "Воссоздать заказ доставки" #. module: sale_stock #: help:sale.config.settings,group_multiple_shops:0 msgid "This allows to configure and use multiple shops." -msgstr "" +msgstr "Это позволяет настроить и использовать несколько магазинов." #. module: sale_stock #: field:sale.order,picked_rate:0 @@ -628,5 +640,5 @@ msgid "" "automatically." msgstr "" "В зависимости от настройки исходящего места хранения, перемещение между " -"зоной отгрузки и заказчиком выполняется с помощью заказа на доставку вручную " +"зоной отгрузки и заказчиком выполняется с помощью заказа доставки вручную " "или автоматически." diff --git a/addons/sale_stock/test/cancel_order_sale_stock.yml b/addons/sale_stock/test/cancel_order_sale_stock.yml index 9081cac9fa3..d970e0c9cad 100644 --- a/addons/sale_stock/test/cancel_order_sale_stock.yml +++ b/addons/sale_stock/test/cancel_order_sale_stock.yml @@ -8,7 +8,7 @@ - !python {model: stock.picking}: | delivery_orders = self.search(cr, uid, [('sale_id','=',ref("sale.sale_order_8"))]) - first_picking = self.browse(cr, uid, delivery_orders[0], context=context) + first_picking = self.browse(cr, uid, delivery_orders[-1], context=context) if first_picking.force_assign(cr, uid, first_picking): first_move = first_picking.move_lines[0] values = {'move%s'%(first_move.id): {'product_qty': 2, 'product_uom':ref('product.product_uom_unit')}} @@ -18,7 +18,7 @@ - !python {model: stock.picking}: | delivery_orders = self.search(cr, uid, [('sale_id','=',ref("sale.sale_order_8"))]) - last_delivery_order_id = delivery_orders[0] + last_delivery_order_id = delivery_orders[-1] self.pool.get('stock.picking').signal_button_cancel(cr, uid, [last_delivery_order_id]) - I run the scheduler. diff --git a/addons/share/wizard/share_wizard.py b/addons/share/wizard/share_wizard.py index 3a26dcb9e6b..22ed7c3e39c 100644 --- a/addons/share/wizard/share_wizard.py +++ b/addons/share/wizard/share_wizard.py @@ -230,6 +230,7 @@ class share_wizard(osv.TransientModel): current_user = user_obj.browse(cr, UID_ROOT, uid, context=context) # modify context to disable shortcuts when creating share users context['noshortcut'] = True + context['no_reset_password'] = True created_ids = [] existing_ids = [] if wizard_data.user_type == 'emails': @@ -413,7 +414,8 @@ class share_wizard(osv.TransientModel): relation_model_id = model_obj.search(cr, UID_ROOT, [('model','=',coldef._obj)])[0] relation_model_browse = model_obj.browse(cr, UID_ROOT, relation_model_id, context=context) relation_osv = self.pool[coldef._obj] - if coltype == 'one2many': + #skip virtual one2many fields (related, ...) as there is no reverse relationship + if coltype == 'one2many' and hasattr(coldef, '_fields_id'): # don't record reverse path if it's not a real m2o (that happens, but rarely) dest_model_ci = relation_osv._all_columns reverse_rel = coldef._fields_id @@ -831,7 +833,7 @@ class share_wizard(osv.TransientModel): notification_obj = self.pool.get('mail.notification') user = self.pool.get('res.users').browse(cr, UID_ROOT, uid) if not user.email: - raise osv.except_osv(_('Email required'), _('The current user must have an email address configured in User Preferences to be able to send outgoing emails.')) + raise osv.except_osv(_('Email Required'), _('The current user must have an email address configured in User Preferences to be able to send outgoing emails.')) # TODO: also send an HTML version of this mail for result_line in wizard_data.result_line_ids: @@ -862,7 +864,7 @@ class share_wizard(osv.TransientModel): mail_mail = self.pool.get('mail.mail') user = self.pool.get('res.users').browse(cr, UID_ROOT, uid) if not user.email: - raise osv.except_osv(_('Email required'), _('The current user must have an email address configured in User Preferences to be able to send outgoing emails.')) + raise osv.except_osv(_('Email Required'), _('The current user must have an email address configured in User Preferences to be able to send outgoing emails.')) # TODO: also send an HTML version of this mail mail_ids = [] diff --git a/addons/stock/i18n/ru.po b/addons/stock/i18n/ru.po index d0d34b32191..817b8aceaa5 100644 --- a/addons/stock/i18n/ru.po +++ b/addons/stock/i18n/ru.po @@ -7,13 +7,13 @@ msgstr "" "Project-Id-Version: OpenERP Server 6.0dev\n" "Report-Msgid-Bugs-To: support@openerp.com\n" "POT-Creation-Date: 2012-12-21 17:04+0000\n" -"PO-Revision-Date: 2013-06-03 12:48+0000\n" +"PO-Revision-Date: 2013-06-04 12:52+0000\n" "Last-Translator: Chertykov Denis <chertykov@gmail.com>\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: 2013-06-04 05:20+0000\n" +"X-Launchpad-Export-Date: 2013-06-05 05:32+0000\n" "X-Generator: Launchpad (build 16660)\n" #. module: stock @@ -1977,7 +1977,7 @@ msgstr "Полка 2" #: code:addons/stock/stock.py:529 #, python-format msgid "You cannot remove a lot line." -msgstr "" +msgstr "Нельзя удалить позицию партии" #. module: stock #: help:stock.location,posx:0 @@ -2406,7 +2406,7 @@ msgstr "Место хранения поставщика" #. module: stock #: view:stock.location.product:0 msgid "View Products Inventory" -msgstr "" +msgstr "Новая инвентаризация продукции" #. module: stock #: view:stock.move:0 @@ -2539,6 +2539,7 @@ msgid "" "Current quantity of products with this Serial Number available in company " "warehouses" msgstr "" +"Текущее количество продукции с этим серийный номером на складах компании" #. module: stock #: view:stock.inventory:0 diff --git a/addons/stock/stock.py b/addons/stock/stock.py index db73bae3b6c..d5fb48a60f0 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -543,6 +543,7 @@ class stock_picking(osv.osv): _name = "stock.picking" _inherit = ['mail.thread'] _description = "Picking List" + _order = "id desc" def _set_maximum_date(self, cr, uid, ids, name, value, arg, context=None): """ Calculates planned date if it is greater than 'value'. @@ -1109,7 +1110,7 @@ class stock_picking(osv.osv): if isinstance(partner, int): partner = partner_obj.browse(cr, uid, [partner], context=context)[0] if not partner: - raise osv.except_osv(_('Error, no partner !'), + raise osv.except_osv(_('Error, no partner!'), _('Please put a partner on the picking list if you want to generate invoice.')) if not inv_type: @@ -1763,7 +1764,7 @@ class stock_move(osv.osv): for move in self.browse(cr, uid, ids, context=context): if move.state == 'done': if frozen_fields.intersection(vals): - raise osv.except_osv(_('Operation forbidden !'), + raise osv.except_osv(_('Operation Forbidden!'), _('Quantities, Units of Measure, Products and Locations cannot be modified on stock moves that have already been processed (except by the Administrator).')) return super(stock_move, self).write(cr, uid, ids, vals, context=context) diff --git a/addons/stock/wizard/stock_partial_picking.py b/addons/stock/wizard/stock_partial_picking.py index 47599d5f99e..8c2c5839989 100644 --- a/addons/stock/wizard/stock_partial_picking.py +++ b/addons/stock/wizard/stock_partial_picking.py @@ -144,7 +144,7 @@ class stock_partial_picking(osv.osv_memory): def _partial_move_for(self, cr, uid, move): partial_move = { 'product_id' : move.product_id.id, - 'quantity' : move.product_qty if move.state in ('assigned','draft','confirmed') else 0, + 'quantity' : move.product_qty if move.state == 'assigned' else 0, 'product_uom' : move.product_uom.id, 'prodlot_id' : move.prodlot_id.id, 'move_id' : move.id, @@ -178,7 +178,7 @@ class stock_partial_picking(osv.osv_memory): if line_uom.factor and line_uom.factor <> 0: if float_compare(qty_in_line_uom, wizard_line.quantity, precision_rounding=line_uom.rounding) != 0: - raise osv.except_osv(_('Warning!'), _('The unit of measure rounding does not allow you to ship "%s %s", only roundings of "%s %s" is accepted by the Unit of Measure.') % (wizard_line.quantity, line_uom.name, line_uom.rounding, line_uom.name)) + raise osv.except_osv(_('Warning!'), _('The unit of measure rounding does not allow you to ship "%s %s", only rounding of "%s %s" is accepted by the Unit of Measure.') % (wizard_line.quantity, line_uom.name, line_uom.rounding, line_uom.name)) if move_id: #Check rounding Quantity.ex. #picking: 1kg, uom kg rounding = 0.01 (rounding to 10g), @@ -189,7 +189,7 @@ class stock_partial_picking(osv.osv_memory): qty_in_initial_uom = uom_obj._compute_qty(cr, uid, line_uom.id, wizard_line.quantity, initial_uom.id) without_rounding_qty = (wizard_line.quantity / line_uom.factor) * initial_uom.factor if float_compare(qty_in_initial_uom, without_rounding_qty, precision_rounding=initial_uom.rounding) != 0: - raise osv.except_osv(_('Warning!'), _('The rounding of the initial uom does not allow you to ship "%s %s", as it would let a quantity of "%s %s" to ship and only roundings of "%s %s" is accepted by the uom.') % (wizard_line.quantity, line_uom.name, wizard_line.move_id.product_qty - without_rounding_qty, initial_uom.name, initial_uom.rounding, initial_uom.name)) + raise osv.except_osv(_('Warning!'), _('The rounding of the initial uom does not allow you to ship "%s %s", as it would let a quantity of "%s %s" to ship and only rounding of "%s %s" is accepted by the uom.') % (wizard_line.quantity, line_uom.name, wizard_line.move_id.product_qty - without_rounding_qty, initial_uom.name, initial_uom.rounding, initial_uom.name)) else: seq_obj_name = 'stock.picking.' + picking_type move_id = stock_move.create(cr,uid,{'name' : self.pool.get('ir.sequence').get(cr, uid, seq_obj_name), diff --git a/addons/subscription/subscription.py b/addons/subscription/subscription.py index b7ae720c187..98e1d78b3be 100644 --- a/addons/subscription/subscription.py +++ b/addons/subscription/subscription.py @@ -115,7 +115,7 @@ class subscription_subscription(osv.osv): id = int(id) model = self.pool[model_name] except: - raise osv.except_osv(_('Wrong Source Document !'), _('Please provide another source document.\nThis one does not exist !')) + raise osv.except_osv(_('Wrong Source Document!'), _('Please provide another source document.\nThis one does not exist!')) default = {'state':'draft'} doc_obj = self.pool.get('subscription.document') @@ -142,7 +142,7 @@ class subscription_subscription(osv.osv): def unlink(self, cr, uid, ids, context=None): for record in self.browse(cr, uid, ids, context or {}): if record.state=="running": - raise osv.except_osv(_('Error!'),_('You cannot delete an active subscription !')) + raise osv.except_osv(_('Error!'),_('You cannot delete an active subscription!')) return super(subscription_subscription, self).unlink(cr, uid, ids, context) def set_done(self, cr, uid, ids, context=None): diff --git a/addons/survey/wizard/survey_send_invitation.py b/addons/survey/wizard/survey_send_invitation.py index ca6a8e4b15d..44d3bec7f6e 100644 --- a/addons/survey/wizard/survey_send_invitation.py +++ b/addons/survey/wizard/survey_send_invitation.py @@ -191,7 +191,8 @@ Thanks,''') % (name, self.pool.get('ir.config_parameter').get_param(cr, uid, 'we 'action_id': act_id[0], 'survey_id': [[6, 0, survey_ids]] } - user = user_ref.create(cr, uid, res_data) + create_ctx = dict(context, no_reset_password=True) + user = user_ref.create(cr, uid, res_data, context=create_ctx) if user not in new_user: new_user.append(user) created+= "- %s (Login: %s, Password: %s)\n" % (partner.name or _('Unknown'),\ diff --git a/addons/warning/warning.py b/addons/warning/warning.py index e9e9161bacb..8e1168e5d35 100644 --- a/addons/warning/warning.py +++ b/addons/warning/warning.py @@ -63,7 +63,7 @@ class sale_order(osv.osv): partner = self.pool.get('res.partner').browse(cr, uid, part, context=context) if partner.sale_warn != 'no-message': if partner.sale_warn == 'block': - raise osv.except_osv(_('Alert for %s !') % (partner.name), partner.sale_warn_msg) + raise osv.except_osv(_('Alert for %s!') % (partner.name), partner.sale_warn_msg) title = _("Warning for %s") % partner.name message = partner.sale_warn_msg warning = { @@ -91,7 +91,7 @@ class purchase_order(osv.osv): partner = self.pool.get('res.partner').browse(cr, uid, part) if partner.purchase_warn != 'no-message': if partner.purchase_warn == 'block': - raise osv.except_osv(_('Alert for %s !') % (partner.name), partner.purchase_warn_msg) + raise osv.except_osv(_('Alert for %s!') % (partner.name), partner.purchase_warn_msg) title = _("Warning for %s") % partner.name message = partner.purchase_warn_msg warning = { @@ -124,7 +124,7 @@ class account_invoice(osv.osv): partner = self.pool.get('res.partner').browse(cr, uid, partner_id) if partner.invoice_warn != 'no-message': if partner.invoice_warn == 'block': - raise osv.except_osv(_('Alert for %s !') % (partner.name), partner.invoice_warn_msg) + raise osv.except_osv(_('Alert for %s!') % (partner.name), partner.invoice_warn_msg) title = _("Warning for %s") % partner.name message = partner.invoice_warn_msg @@ -155,7 +155,7 @@ class stock_picking(osv.osv): message = False if partner.picking_warn != 'no-message': if partner.picking_warn == 'block': - raise osv.except_osv(_('Alert for %s !') % (partner.name), partner.picking_warn_msg) + raise osv.except_osv(_('Alert for %s!') % (partner.name), partner.picking_warn_msg) title = _("Warning for %s") % partner.name message = partner.picking_warn_msg warning = { @@ -184,7 +184,7 @@ class stock_picking_in(osv.osv): message = False if partner.picking_warn != 'no-message': if partner.picking_warn == 'block': - raise osv.except_osv(_('Alert for %s !') % (partner.name), partner.picking_warn_msg) + raise osv.except_osv(_('Alert for %s!') % (partner.name), partner.picking_warn_msg) title = _("Warning for %s") % partner.name message = partner.picking_warn_msg warning = { @@ -210,7 +210,7 @@ class stock_picking_out(osv.osv): message = False if partner.picking_warn != 'no-message': if partner.picking_warn == 'block': - raise osv.except_osv(_('Alert for %s !') % (partner.name), partner.picking_warn_msg) + raise osv.except_osv(_('Alert for %s!') % (partner.name), partner.picking_warn_msg) title = _("Warning for %s") % partner.name message = partner.picking_warn_msg warning = { @@ -257,7 +257,7 @@ class sale_order_line(osv.osv): if product_info.sale_line_warn != 'no-message': if product_info.sale_line_warn == 'block': - raise osv.except_osv(_('Alert for %s !') % (product_info.name), product_info.sale_line_warn_msg) + raise osv.except_osv(_('Alert for %s!') % (product_info.name), product_info.sale_line_warn_msg) title = _("Warning for %s") % product_info.name message = product_info.sale_line_warn_msg warning['title'] = title @@ -289,7 +289,7 @@ class purchase_order_line(osv.osv): if product_info.purchase_line_warn != 'no-message': if product_info.purchase_line_warn == 'block': - raise osv.except_osv(_('Alert for %s !') % (product_info.name), product_info.purchase_line_warn_msg) + raise osv.except_osv(_('Alert for %s!') % (product_info.name), product_info.purchase_line_warn_msg) title = _("Warning for %s") % product_info.name message = product_info.purchase_line_warn_msg warning['title'] = title |
