bzr revid: fp@tinyerp.com-20111001184811-umj7qepl2ly9jh0d
This commit is contained in:
Fabien Pinckaers 2011-10-01 20:48:11 +02:00
commit 57b86a1040
58 changed files with 1456 additions and 282 deletions

View File

@ -23,7 +23,7 @@ import account
import installer
import project
import partner
import invoice
import account_invoice
import account_bank_statement
import account_bank
import account_cash_statement
@ -32,7 +32,7 @@ import account_analytic_line
import wizard
import report
import product
import sequence
import ir_sequence
import company
import res_currency

View File

@ -103,8 +103,7 @@ module named account_voucher.
'account_end_fy.xml',
'account_invoice_view.xml',
'partner_view.xml',
'data/account_invoice.xml',
'data/account_data2.xml',
'data/account_data.xml',
'account_invoice_workflow.xml',
'project/project_view.xml',
'project/project_report.xml',
@ -119,7 +118,7 @@ module named account_voucher.
'process/statement_process.xml',
'process/customer_invoice_process.xml',
'process/supplier_invoice_process.xml',
'sequence_view.xml',
'ir_sequence_view.xml',
'company_view.xml',
'board_account_view.xml',
"wizard/account_report_profit_loss_view.xml",

View File

@ -672,32 +672,22 @@ class account_journal(osv.osv):
return super(account_journal, self).write(cr, uid, ids, vals, context=context)
def create_sequence(self, cr, uid, vals, context=None):
""" Create new no_gap entry sequence for every new Joural
"""
Create new entry sequence for every new Joural
"""
seq_pool = self.pool.get('ir.sequence')
seq_typ_pool = self.pool.get('ir.sequence.type')
name = vals['name']
code = vals['code'].lower()
types = {
'name': name,
'code': code
}
seq_typ_pool.create(cr, uid, types)
# in account.journal code is actually the prefix of the sequence
# whereas ir.sequence code is a key to lookup global sequences.
prefix = vals['code'].upper()
seq = {
'name': name,
'code': code,
'active': True,
'prefix': code + "/%(year)s/",
'name': vals['name'],
'implementation':'no_gap',
'prefix': prefix + "/%(year)s/",
'padding': 4,
'number_increment': 1
}
if 'company_id' in vals:
seq['company_id'] = vals['company_id']
return seq_pool.create(cr, uid, seq)
return self.pool.get('ir.sequence').create(cr, uid, seq)
def create(self, cr, uid, vals, context=None):
if not 'sequence_id' in vals or not vals['sequence_id']:
@ -1214,7 +1204,7 @@ class account_move(osv.osv):
else:
if journal.sequence_id:
c = {'fiscalyear_id': move.period_id.fiscalyear_id.id}
new_name = obj_sequence.get_id(cr, uid, journal.sequence_id.id, context=c)
new_name = obj_sequence.next_by_id(cr, uid, journal.sequence_id.id, c)
else:
raise osv.except_osv(_('Error'), _('No sequence defined on the journal !'))

View File

@ -340,9 +340,9 @@ class account_bank_statement(osv.osv):
else:
if st.journal_id.sequence_id:
c = {'fiscalyear_id': st.period_id.fiscalyear_id.id}
st_number = obj_seq.get_id(cr, uid, st.journal_id.sequence_id.id, context=c)
st_number = obj_seq.next_by_id(cr, uid, st.journal_id.sequence_id.id, context=c)
else:
st_number = obj_seq.get(cr, uid, 'account.bank.statement')
st_number = obj_seq.next_by_code(cr, uid, 'account.bank.statement')
for line in st.move_line_ids:
if line.state <> 'valid':

View File

@ -294,9 +294,9 @@ class account_cash_statement(osv.osv):
if statement.name and statement.name == '/':
if statement.journal_id.sequence_id:
c = {'fiscalyear_id': statement.period_id.fiscalyear_id.id}
st_number = obj_seq.get_id(cr, uid, statement.journal_id.sequence_id.id, context=c)
st_number = obj_seq.next_by_id(cr, uid, statement.journal_id.sequence_id.id, context=c)
else:
st_number = obj_seq.get(cr, uid, 'account.cash.statement')
st_number = obj_seq.next_by_code(cr, uid, 'account.cash.statement')
vals.update({
'name': st_number
})

View File

@ -1221,7 +1221,7 @@ class account_move_line(osv.osv):
vals['move_id'] = res[0]
if not vals.get('move_id', False):
if journal.sequence_id:
#name = self.pool.get('ir.sequence').get_id(cr, uid, journal.sequence_id.id)
#name = self.pool.get('ir.sequence').next_by_id(cr, uid, journal.sequence_id.id)
v = {
'date': vals.get('date', time.strftime('%Y-%m-%d')),
'period_id': context['period_id'],

View File

@ -469,66 +469,48 @@
Account Journal Sequences
-->
<record id="sequence_journal_type" model="ir.sequence.type">
<field name="name">Account Journal</field>
<field name="code">account.journal</field>
</record>
<record id="sequence_journal" model="ir.sequence">
<field name="name">Account Journal</field>
<field name="code">account.journal</field>
<field name="prefix"/>
</record>
<record id="sequence_sale_journal" model="ir.sequence">
<field name="name">Sale Journal</field>
<field name="code">account.journal</field>
<field name="name">Account Default Sales Journal</field>
<field eval="3" name="padding"/>
<field name="prefix">SAJ/%(year)s/</field>
</record>
<record id="sequence_refund_sales_journal" model="ir.sequence">
<field name="name">Sales Credit Note Journal</field>
<field name="code">account.journal</field>
<field name="name">Account Default Sales Credit Note Journal</field>
<field eval="3" name="padding"/>
<field name="prefix">SCNJ/%(year)s/</field>
</record>
<record id="sequence_purchase_journal" model="ir.sequence">
<field name="name">Purchase Journal</field>
<field name="code">account.journal</field>
<field name="name">Account Default Expenses Journal</field>
<field eval="3" name="padding"/>
<field name="prefix">EXJ/%(year)s/</field>
</record>
<record id="sequence_refund_purchase_journal" model="ir.sequence">
<field name="name">Expenses Credit Notes Journal</field>
<field name="code">account.journal</field>
<field name="name">Account Default Expenses Credit Notes Journal</field>
<field eval="3" name="padding"/>
<field name="prefix">ECNJ/%(year)s/</field>
</record>
<record id="sequence_bank_journal" model="ir.sequence">
<field name="name">Bank Journal</field>
<field name="code">account.journal</field>
<field name="name">Account Default Bank Journal</field>
<field eval="3" name="padding"/>
<field name="prefix">BNK/%(year)s/</field>
</record>
<record id="sequence_check_journal" model="ir.sequence">
<field name="name">Checks Journal</field>
<field name="code">account.journal</field>
<field name="name">Account Default Checks Journal</field>
<field eval="3" name="padding"/>
<field name="prefix">CHK/%(year)s/</field>
</record>
<record id="sequence_cash_journal" model="ir.sequence">
<field name="name">Cash Journal</field>
<field name="code">account.journal</field>
<field name="name">Account Default Cash Journal</field>
<field eval="3" name="padding"/>
<field name="prefix">CSH/%(year)s/</field>
</record>
<record id="sequence_opening_journal" model="ir.sequence">
<field name="name">Opening Entries Journal</field>
<field name="code">account.journal</field>
<field name="name">Account Default Opening Entries Journal</field>
<field eval="3" name="padding"/>
<field name="prefix">OPEJ/%(year)s/</field>
</record>
<record id="sequence_miscellaneous_journal" model="ir.sequence">
<field name="name">Miscellaneous Journal</field>
<field name="code">account.journal</field>
<field name="name">Account Default Miscellaneous Journal</field>
<field eval="3" name="padding"/>
<field name="prefix">MISJ/%(year)s/</field>
</record>
@ -538,7 +520,7 @@
-->
<record id="sequence_reconcile" model="ir.sequence.type">
<field name="name">Account reconcile sequence</field>
<field name="name">Account Reconcile</field>
<field name="code">account.reconcile</field>
</record>
<record id="sequence_reconcile_seq" model="ir.sequence">
@ -550,7 +532,7 @@
</record>
<record id="sequence_statement_type" model="ir.sequence.type">
<field name="name">Bank Statement</field>
<field name="name">Account Bank Statement</field>
<field name="code">account.bank.statement</field>
</record>
<record id="sequence_statement" model="ir.sequence">
@ -562,7 +544,7 @@
</record>
<record id="cash_sequence_statement_type" model="ir.sequence.type">
<field name="name">Cash Statement</field>
<field name="name">Account Cash Statement</field>
<field name="code">account.cash.statement</field>
</record>
<record id="cash_sequence_statement" model="ir.sequence">
@ -572,5 +554,30 @@
<field eval="1" name="number_next"/>
<field eval="1" name="number_increment"/>
</record>
<!--
Sequence for analytic account
-->
<record id="seq_type_analytic_account" model="ir.sequence.type">
<field name="name">Analytic account</field>
<field name="code">account.analytic.account</field>
</record>
<record id="seq_analytic_account" model="ir.sequence">
<field name="name">Analytic account sequence</field>
<field name="code">account.analytic.account</field>
<field eval="3" name="padding"/>
<field eval="2708" name="number_next"/>
</record>
<!--
Invoice requests (deprecated)
-->
<record id="req_link_invoice" model="res.request.link">
<field name="name">Invoice</field>
<field name="object">account.invoice</field>
</record>
</data>
</openerp>

View File

@ -1,75 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data noupdate="1">
<record id="req_link_invoice" model="res.request.link">
<field name="name">Invoice</field>
<field name="object">account.invoice</field>
</record>
<!--
Sequences types for invoices
-->
<record id="seq_type_out_invoice" model="ir.sequence.type">
<field name="name">Account Invoice Out</field>
<field name="code">account.invoice.out_invoice</field>
</record>
<record id="seq_type_in_invoice" model="ir.sequence.type">
<field name="name">Account Invoice In</field>
<field name="code">account.invoice.in_invoice</field>
</record>
<record id="seq_type_out_refund" model="ir.sequence.type">
<field name="name">Account Refund Out</field>
<field name="code">account.invoice.out_refund</field>
</record>
<record id="seq_type_in_refund" model="ir.sequence.type">
<field name="name">Account Refund In</field>
<field name="code">account.invoice.in_refund</field>
</record>
<!--
Sequences for invoices
-->
<record id="seq_out_invoice" model="ir.sequence">
<field name="name">Account Invoice Out</field>
<field name="code">account.invoice.out_invoice</field>
<field eval="3" name="padding"/>
<field name="prefix">%(year)s/</field>
</record>
<record id="seq_in_invoice" model="ir.sequence">
<field name="name">Account Invoice In</field>
<field name="code">account.invoice.in_invoice</field>
<field eval="3" name="padding"/>
<field name="prefix">%(year)s/</field>
</record>
<record id="seq_out_refund" model="ir.sequence">
<field name="name">Account Refund Out</field>
<field name="code">account.invoice.out_refund</field>
<field eval="3" name="padding"/>
<field name="prefix">%(year)s/</field>
</record>
<record id="seq_in_refund" model="ir.sequence">
<field name="name">Account Refund In</field>
<field name="code">account.invoice.in_refund</field>
<field eval="3" name="padding"/>
<field name="prefix">%(year)s/</field>
</record>
<!--
Sequences types for analytic account
-->
<record id="seq_type_analytic_account" model="ir.sequence.type">
<field name="name">Analytic account</field>
<field name="code">account.analytic.account</field>
</record>
<!--
Sequence for analytic account
-->
<record id="seq_analytic_account" model="ir.sequence">
<field name="name">Analytic account sequence</field>
<field name="code">account.analytic.account</field>
<field eval="3" name="padding"/>
<field eval="2708" name="number_next"/>
</record>
</data>
</openerp>

View File

@ -7,19 +7,19 @@ msgstr ""
"Project-Id-Version: OpenERP Server 6.0dev\n"
"Report-Msgid-Bugs-To: support@openerp.com\n"
"POT-Creation-Date: 2011-01-11 11:14+0000\n"
"PO-Revision-Date: 2011-09-22 02:55+0000\n"
"PO-Revision-Date: 2011-09-30 23:12+0000\n"
"Last-Translator: Majed Majbour <Unknown>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2011-09-23 04:38+0000\n"
"X-Generator: Launchpad (build 14012)\n"
"X-Launchpad-Export-Date: 2011-10-01 05:08+0000\n"
"X-Generator: Launchpad (build 14071)\n"
#. module: account
#: model:process.transition,name:account.process_transition_supplierreconcilepaid0
msgid "System payment"
msgstr "الدفع عن طريق النظام"
msgstr "نظام الدفع"
#. module: account
#: view:account.journal:0
@ -124,6 +124,8 @@ msgid ""
"If you unreconciliate transactions, you must also verify all the actions "
"that are linked to those transactions because they will not be disabled"
msgstr ""
"إذا كنت توافق على المعاملات ، يجب عليك أيضا التحقق من كافة الإجراءات التي "
"ترتبط بتلك المعاملات لأنه لن يكونوا غير مفعّلين"
#. module: account
#: report:account.tax.code.entries:0

View File

@ -7,13 +7,13 @@ msgstr ""
"Project-Id-Version: OpenERP Server 6.0dev\n"
"Report-Msgid-Bugs-To: support@openerp.com\n"
"POT-Creation-Date: 2011-01-11 11:14+0000\n"
"PO-Revision-Date: 2011-09-28 14:57+0000\n"
"PO-Revision-Date: 2011-09-30 07:02+0000\n"
"Last-Translator: Raiko Pajur <Unknown>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2011-09-30 04:40+0000\n"
"X-Launchpad-Export-Date: 2011-10-01 05:08+0000\n"
"X-Generator: Launchpad (build 14071)\n"
#. module: account
@ -1895,12 +1895,12 @@ msgstr ""
#: field:account.installer.modules,config_logo:0
#: field:wizard.multi.charts.accounts,config_logo:0
msgid "Image"
msgstr ""
msgstr "Pilt"
#. module: account
#: report:account.move.voucher:0
msgid "Canceled"
msgstr ""
msgstr "Tühistatud"
#. module: account
#: view:account.invoice:0

View File

@ -46,23 +46,14 @@ class ir_sequence(osv.osv):
'fiscal_ids': fields.one2many('account.sequence.fiscalyear',
'sequence_main_id', 'Sequences')
}
def get_id(self, cr, uid, sequence_id, test='id', context=None):
if context is None:
context = {}
cr.execute('select id from ir_sequence where '
+ test + '=%s and active=%s', (sequence_id, True,))
res = cr.dictfetchone()
if res:
for line in self.browse(cr, uid, res['id'],
context=context).fiscal_ids:
if line.fiscalyear_id.id == context.get('fiscalyear_id', False):
return super(ir_sequence, self).get_id(cr, uid,
line.sequence_id.id,
test="id",
context=context)
return super(ir_sequence, self).get_id(cr, uid, sequence_id, test,
context=context)
def _next(self, cr, uid, seq_ids, context=None):
for seq in self.browse(cr, uid, seq_ids, context):
for line in seq.fiscal_ids:
if line.fiscalyear_id.id == context.get('fiscalyear_id'):
return super(ir_sequence, self)._next(cr, uid, [line.sequence_id.id], context)
return super(ir_sequence, self)._next(cr, uid, seq_ids, context)
ir_sequence()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -26,7 +26,6 @@
code: NEW
type: situation
analytic_journal_id: sit
sequence_id: sequence_journal
default_debit_account_id: cash
default_credit_account_id: cash
company_id: base.main_company

View File

@ -0,0 +1,529 @@
# Brazilian Portuguese translation for openobject-addons
# Copyright (c) 2011 Rosetta Contributors and Canonical Ltd 2011
# This file is distributed under the same license as the openobject-addons package.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2011.
#
msgid ""
msgstr ""
"Project-Id-Version: openobject-addons\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
"POT-Creation-Date: 2009-11-24 12:54+0000\n"
"PO-Revision-Date: 2011-09-30 14:07+0000\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: Brazilian Portuguese <pt_BR@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: 2011-10-01 05:08+0000\n"
"X-Generator: Launchpad (build 14071)\n"
#. module: account_asset
#: model:ir.actions.act_window,name:account_asset.action_account_asset_asset_list_normal
#: model:ir.ui.menu,name:account_asset.menu_action_account_asset_asset_list_normal
msgid "Open Assets"
msgstr ""
#. module: account_asset
#: field:account.asset.property,method_end:0
#: field:account.asset.property.history,method_end:0
msgid "Ending date"
msgstr ""
#. module: account_asset
#: view:account.asset.asset:0
msgid "Depreciation board"
msgstr ""
#. module: account_asset
#: view:account.asset.asset:0
#: field:account.asset.asset,name:0
#: field:account.asset.board,asset_id:0
#: field:account.asset.property,asset_id:0
#: field:account.invoice.line,asset_id:0
#: field:account.move.line,asset_id:0
#: model:ir.actions.act_window,name:account_asset.action_account_asset_asset_form
#: model:ir.model,name:account_asset.model_account_asset_asset
#: model:ir.ui.menu,name:account_asset.menu_action_account_asset_asset_form
msgid "Asset"
msgstr ""
#. module: account_asset
#: constraint:ir.actions.act_window:0
msgid "Invalid model name in the action definition."
msgstr ""
#. module: account_asset
#: selection:account.asset.property,method:0
msgid "Linear"
msgstr ""
#. module: account_asset
#: view:account.asset.asset:0
msgid "Change duration"
msgstr ""
#. module: account_asset
#: field:account.asset.asset,child_ids:0
msgid "Child assets"
msgstr ""
#. module: account_asset
#: field:account.asset.board,value_asset:0
msgid "Asset Value"
msgstr ""
#. module: account_asset
#: wizard_field:account.asset.modify,init,name:0
msgid "Reason"
msgstr ""
#. module: account_asset
#: view:account.asset.asset:0
#: field:account.asset.asset,entry_ids:0
#: wizard_field:account.asset.compute,asset_compute,move_ids:0
msgid "Entries"
msgstr ""
#. module: account_asset
#: wizard_view:account.asset.compute,asset_compute:0
msgid "Generated entries"
msgstr ""
#. module: account_asset
#: wizard_field:account.asset.modify,init,method_delay:0
#: field:account.asset.property,method_delay:0
#: field:account.asset.property.history,method_delay:0
msgid "Number of interval"
msgstr ""
#. module: account_asset
#: wizard_button:account.asset.compute,asset_compute,asset_open:0
msgid "Open entries"
msgstr ""
#. module: account_asset
#: view:account.asset.asset:0
#: model:ir.actions.act_window,name:account_asset.action_account_asset_asset_list
#: model:ir.ui.menu,name:account_asset.menu_action_account_asset_asset_list
#: model:ir.ui.menu,name:account_asset.menu_finance_Assets
#: model:ir.ui.menu,name:account_asset.menu_finance_config_Assets
msgid "Assets"
msgstr ""
#. module: account_asset
#: selection:account.asset.property,method:0
msgid "Progressive"
msgstr ""
#. module: account_asset
#: model:ir.actions.act_window,name:account_asset.action_account_asset_asset_list_draft
#: model:ir.ui.menu,name:account_asset.menu_action_account_asset_asset_list_draft
msgid "Draft Assets"
msgstr ""
#. module: account_asset
#: wizard_view:account.asset.modify,init:0
#: wizard_field:account.asset.modify,init,note:0
#: view:account.asset.property.history:0
msgid "Notes"
msgstr ""
#. module: account_asset
#: view:account.asset.asset:0
msgid "Change history"
msgstr ""
#. module: account_asset
#: view:account.asset.asset:0
msgid "Depreciation entries"
msgstr ""
#. module: account_asset
#: view:account.asset.asset:0
msgid "Methods"
msgstr ""
#. module: account_asset
#: wizard_view:account.asset.modify,init:0
msgid "Asset properties to modify"
msgstr ""
#. module: account_asset
#: field:account.asset.asset,partner_id:0
msgid "Partner"
msgstr ""
#. module: account_asset
#: wizard_field:account.asset.modify,init,method_period:0
#: field:account.asset.property,method_period:0
#: field:account.asset.property.history,method_period:0
msgid "Period per interval"
msgstr ""
#. module: account_asset
#: view:account.asset.asset:0
msgid "Depreciation duration"
msgstr ""
#. module: account_asset
#: field:account.asset.property,account_analytic_id:0
msgid "Analytic account"
msgstr ""
#. module: account_asset
#: field:account.asset.property,state:0
msgid "State"
msgstr ""
#. module: account_asset
#: view:account.asset.asset:0
msgid "Depreciation methods"
msgstr ""
#. module: account_asset
#: view:account.asset.asset:0
msgid "Other information"
msgstr ""
#. module: account_asset
#: field:account.asset.board,value_asset_cumul:0
msgid "Cumul. value"
msgstr ""
#. module: account_asset
#: view:account.asset.property:0
msgid "Assets methods"
msgstr ""
#. module: account_asset
#: constraint:ir.ui.view:0
msgid "Invalid XML for View Architecture!"
msgstr ""
#. module: account_asset
#: model:ir.model,name:account_asset.model_account_asset_property
msgid "Asset property"
msgstr ""
#. module: account_asset
#: wizard_view:account.asset.compute,asset_compute:0
#: wizard_view:account.asset.compute,init:0
#: wizard_button:account.asset.compute,init,asset_compute:0
#: model:ir.actions.wizard,name:account_asset.wizard_asset_compute
#: model:ir.ui.menu,name:account_asset.menu_wizard_asset_compute
msgid "Compute assets"
msgstr ""
#. module: account_asset
#: wizard_view:account.asset.modify,init:0
#: wizard_button:account.asset.modify,init,asset_modify:0
#: model:ir.actions.wizard,name:account_asset.wizard_asset_modify
msgid "Modify asset"
msgstr ""
#. module: account_asset
#: view:account.asset.asset:0
msgid "Confirm asset"
msgstr ""
#. module: account_asset
#: view:account.asset.property.history:0
#: model:ir.model,name:account_asset.model_account_asset_property_history
msgid "Asset history"
msgstr ""
#. module: account_asset
#: field:account.asset.property,date:0
msgid "Date created"
msgstr ""
#. module: account_asset
#: model:ir.module.module,description:account_asset.module_meta_information
msgid ""
"Financial and accounting asset management.\n"
" Allows to define\n"
" * Asset category. \n"
" * Assets.\n"
" *Asset usage period and property.\n"
" "
msgstr ""
#. module: account_asset
#: field:account.asset.board,value_gross:0
#: field:account.asset.property,value_total:0
msgid "Gross value"
msgstr ""
#. module: account_asset
#: selection:account.asset.property,method_time:0
msgid "Ending period"
msgstr ""
#. module: account_asset
#: field:account.asset.board,name:0
msgid "Asset name"
msgstr ""
#. module: account_asset
#: view:account.asset.asset:0
msgid "Accounts information"
msgstr ""
#. module: account_asset
#: field:account.asset.asset,note:0
#: field:account.asset.category,note:0
#: field:account.asset.property.history,note:0
msgid "Note"
msgstr ""
#. module: account_asset
#: selection:account.asset.asset,state:0
#: selection:account.asset.property,state:0
msgid "Draft"
msgstr ""
#. module: account_asset
#: field:account.asset.property,type:0
msgid "Depr. method type"
msgstr ""
#. module: account_asset
#: field:account.asset.property,account_asset_id:0
msgid "Asset account"
msgstr ""
#. module: account_asset
#: field:account.asset.property.history,asset_property_id:0
msgid "Method"
msgstr ""
#. module: account_asset
#: selection:account.asset.asset,state:0
msgid "Normal"
msgstr ""
#. module: account_asset
#: field:account.asset.property,method_progress_factor:0
msgid "Progressif factor"
msgstr ""
#. module: account_asset
#: field:account.asset.asset,localisation:0
msgid "Localisation"
msgstr ""
#. module: account_asset
#: field:account.asset.property,method:0
msgid "Computation method"
msgstr ""
#. module: account_asset
#: field:account.asset.property,method_time:0
msgid "Time method"
msgstr ""
#. module: account_asset
#: field:account.asset.asset,active:0
msgid "Active"
msgstr ""
#. module: account_asset
#: field:account.asset.property.history,user_id:0
msgid "User"
msgstr ""
#. module: account_asset
#: field:account.asset.asset,property_ids:0
msgid "Asset method name"
msgstr ""
#. module: account_asset
#: field:account.asset.asset,date:0
#: field:account.asset.property.history,date:0
msgid "Date"
msgstr ""
#. module: account_asset
#: field:account.asset.board,value_net:0
msgid "Net value"
msgstr ""
#. module: account_asset
#: wizard_view:account.asset.close,init:0
#: model:ir.actions.wizard,name:account_asset.wizard_asset_close
msgid "Close asset"
msgstr ""
#. module: account_asset
#: field:account.asset.property,history_ids:0
msgid "History"
msgstr ""
#. module: account_asset
#: field:account.asset.property,account_actif_id:0
msgid "Depreciation account"
msgstr ""
#. module: account_asset
#: field:account.asset.asset,period_id:0
#: wizard_field:account.asset.compute,init,period_id:0
msgid "Period"
msgstr ""
#. module: account_asset
#: model:ir.actions.act_window,name:account_asset.action_account_asset_category_form
#: model:ir.ui.menu,name:account_asset.menu_action_account_asset_category_form
msgid "Asset Category"
msgstr ""
#. module: account_asset
#: wizard_button:account.asset.close,init,end:0
#: wizard_button:account.asset.compute,init,end:0
#: wizard_button:account.asset.modify,init,end:0
msgid "Cancel"
msgstr ""
#. module: account_asset
#: selection:account.asset.asset,state:0
#: wizard_button:account.asset.compute,asset_compute,end:0
#: selection:account.asset.property,state:0
msgid "Close"
msgstr ""
#. module: account_asset
#: selection:account.asset.property,state:0
msgid "Open"
msgstr ""
#. module: account_asset
#: constraint:ir.model:0
msgid ""
"The Object name must start with x_ and not contain any special character !"
msgstr ""
#. module: account_asset
#: model:ir.module.module,shortdesc:account_asset.module_meta_information
msgid "Asset management"
msgstr ""
#. module: account_asset
#: view:account.asset.board:0
#: field:account.asset.property,board_ids:0
#: model:ir.model,name:account_asset.model_account_asset_board
msgid "Asset board"
msgstr ""
#. module: account_asset
#: field:account.asset.asset,state:0
msgid "Global state"
msgstr ""
#. module: account_asset
#: selection:account.asset.property,method_time:0
msgid "Delay"
msgstr ""
#. module: account_asset
#: wizard_view:account.asset.close,init:0
msgid "General information"
msgstr ""
#. module: account_asset
#: field:account.asset.property,journal_analytic_id:0
msgid "Analytic journal"
msgstr ""
#. module: account_asset
#: field:account.asset.property,name:0
msgid "Method name"
msgstr ""
#. module: account_asset
#: field:account.asset.property,journal_id:0
msgid "Journal"
msgstr ""
#. module: account_asset
#: field:account.asset.property.history,name:0
msgid "History name"
msgstr ""
#. module: account_asset
#: view:account.asset.asset:0
msgid "Close method"
msgstr ""
#. module: account_asset
#: field:account.asset.property,entry_asset_ids:0
msgid "Asset Entries"
msgstr ""
#. module: account_asset
#: field:account.asset.asset,category_id:0
#: view:account.asset.category:0
#: field:account.asset.category,name:0
#: model:ir.model,name:account_asset.model_account_asset_category
msgid "Asset category"
msgstr ""
#. module: account_asset
#: view:account.asset.asset:0
msgid "Depreciation"
msgstr ""
#. module: account_asset
#: field:account.asset.asset,code:0
#: field:account.asset.category,code:0
msgid "Asset code"
msgstr ""
#. module: account_asset
#: field:account.asset.asset,value_total:0
msgid "Total value"
msgstr ""
#. module: account_asset
#: selection:account.asset.asset,state:0
msgid "View"
msgstr ""
#. module: account_asset
#: view:account.asset.asset:0
msgid "General info"
msgstr ""
#. module: account_asset
#: field:account.asset.asset,sequence:0
msgid "Sequence"
msgstr ""
#. module: account_asset
#: field:account.asset.property,value_residual:0
msgid "Residual value"
msgstr ""
#. module: account_asset
#: wizard_button:account.asset.close,init,asset_close:0
msgid "End of asset"
msgstr ""
#. module: account_asset
#: selection:account.asset.property,type:0
msgid "Direct"
msgstr ""
#. module: account_asset
#: selection:account.asset.property,type:0
msgid "Indirect"
msgstr ""
#. module: account_asset
#: field:account.asset.asset,parent_id:0
msgid "Parent asset"
msgstr ""
#. module: account_asset
#: model:ir.actions.act_window,name:account_asset.action_account_asset_asset_tree
#: model:ir.ui.menu,name:account_asset.menu_action_account_asset_asset_tree
msgid "Asset Hierarchy"
msgstr ""

View File

@ -35,7 +35,7 @@ class account_move(osv.osv):
seq_no = False
for move in self.browse(cr, uid, ids, context=context):
if move.journal_id.internal_sequence_id:
seq_no = obj_sequence.get_id(cr, uid, move.journal_id.internal_sequence_id.id, context=context)
seq_no = obj_sequence.next_by_id(cr, uid, move.journal_id.internal_sequence_id.id, context=context)
if seq_no:
self.write(cr, uid, [move.id], {'internal_sequence_number': seq_no})
return res

View File

@ -674,7 +674,7 @@ class account_voucher(osv.osv):
if inv.number:
name = inv.number
elif inv.journal_id.sequence_id:
name = seq_obj.get_id(cr, uid, inv.journal_id.sequence_id.id)
name = seq_obj.next_by_id(cr, uid, inv.journal_id.sequence_id.id)
else:
raise osv.except_osv(_('Error !'), _('Please define a sequence on the journal !'))
if not inv.reference:

View File

@ -0,0 +1,26 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2010-2011 OpenERP s.a. (<http://openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import res_users
import controllers
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,47 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2010-2011 OpenERP s.a. (<http://openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
{
'name': 'OpenID',
'version': '2.0',
'category': 'Authentification',
'description': """Allow users to login through OpenID.""",
'author': 'OpenERP s.a.',
'maintainer': 'OpenERP s.a.',
'website': 'http://www.openerp.com',
'depends': ['base'],
'data': [
'res_users.xml',
],
'js': [
'static/src/js/auth_openid.js',
],
'css': [
'static/src/css/openid.css',
],
'external_dependencies': {
'python' : ['openid'],
},
'installable': True,
'active': False,
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,20 @@
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2011 OpenERP SA (<http://openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import main

View File

@ -0,0 +1,225 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2010-2011 OpenERP s.a. (<http://openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import logging
import os
import sys
import urllib
import werkzeug.urls
import werkzeug.exceptions
from openerp.modules.registry import RegistryManager
import web.common.dispatch as openerpweb
from openid import oidutil
from openid.store import memstore
#from openid.store import filestore
from openid.consumer import consumer
from openid.cryptutil import randomString
from openid.extensions import ax, sreg
from .. import utils
_logger = logging.getLogger('web.auth_openid')
oidutil.log = logging.getLogger('openid').debug
class GoogleAppsAwareConsumer(consumer.GenericConsumer):
def complete(self, message, endpoint, return_to):
if message.getOpenIDNamespace() == consumer.OPENID2_NS:
server_url = message.getArg(consumer.OPENID2_NS, 'op_endpoint', consumer.no_default)
if server_url.startswith('https://www.google.com/a/'):
# update fields
for attr in ['claimed_id', 'identity']:
value = message.getArg(consumer.OPENID2_NS, attr)
value = 'https://www.google.com/accounts/o8/user-xrds?uri=%s' % urllib.quote_plus(value)
message.setArg(consumer.OPENID2_NS, attr, value)
# now, resign the message
assoc_handle = message.getArg(consumer.OPENID_NS, 'assoc_handle')
assoc = self.store.getAssociation(server_url, assoc_handle)
message.delArg(consumer.OPENID2_NS, 'sig')
message.delArg(consumer.OPENID2_NS, 'signed')
message = assoc.signMessage(message)
return super(GoogleAppsAwareConsumer, self).complete(message, endpoint, return_to)
class OpenIDController(openerpweb.Controller):
_cp_path = '/auth_openid/login'
_store = memstore.MemoryStore() # TODO use a filestore
_REQUIRED_ATTRIBUTES = ['email']
_OPTIONAL_ATTRIBUTES = 'nickname fullname postcode country language timezone'.split()
def _add_extensions(self, request):
"""Add extensions to the request"""
sreg_request = sreg.SRegRequest(required=self._REQUIRED_ATTRIBUTES,
optional=self._OPTIONAL_ATTRIBUTES)
request.addExtension(sreg_request)
ax_request = ax.FetchRequest()
for alias in self._REQUIRED_ATTRIBUTES:
uri = utils.SREG2AX[alias]
ax_request.add(ax.AttrInfo(uri, required=True, alias=alias))
for alias in self._OPTIONAL_ATTRIBUTES:
uri = utils.SREG2AX[alias]
ax_request.add(ax.AttrInfo(uri, required=False, alias=alias))
request.addExtension(ax_request)
def _get_attributes_from_success_response(self, success_response):
attrs = {}
all_attrs = self._REQUIRED_ATTRIBUTES + self._OPTIONAL_ATTRIBUTES
sreg_resp = sreg.SRegResponse.fromSuccessResponse(success_response)
if sreg_resp:
for attr in all_attrs:
value = sreg_resp.get(attr)
if value is not None:
attrs[attr] = value
ax_resp = ax.FetchResponse.fromSuccessResponse(success_response)
if ax_resp:
for attr in all_attrs:
value = ax_resp.getSingle(utils.SREG2AX[attr])
if value is not None:
attrs[attr] = value
return attrs
def _get_realm(self, req):
return req.httprequest.host_url
@openerpweb.jsonrequest
def verify(self, req, db, url):
redirect_to = werkzeug.urls.Href(req.httprequest.host_url + 'auth_openid/login/process')(session_id=req.session_id)
realm = self._get_realm(req)
session = dict(dbname=db, openid_url=url) # TODO add origin page ?
oidconsumer = consumer.Consumer(session, self._store)
try:
request = oidconsumer.begin(url)
except consumer.DiscoveryFailure, exc:
fetch_error_string = 'Error in discovery: %s' % (str(exc[0]),)
return {'error': fetch_error_string, 'title': 'OpenID Error'}
if request is None:
return {'error': 'No OpenID services found', 'title': 'OpenID Error'}
req.session.openid_session = session
self._add_extensions(request)
if request.shouldSendRedirect():
redirect_url = request.redirectURL(realm, redirect_to)
return {'action': 'redirect', 'value': redirect_url, 'session_id': req.session_id}
else:
form_html = request.htmlMarkup(realm, redirect_to)
return {'action': 'post', 'value': form_html, 'session_id': req.session_id}
@openerpweb.httprequest
def process(self, req, **kw):
session = getattr(req.session, 'openid_session', None)
if not session:
return werkzeug.utils.redirect('/')
oidconsumer = consumer.Consumer(session, self._store, consumer_class=GoogleAppsAwareConsumer)
query = req.httprequest.args
info = oidconsumer.complete(query, req.httprequest.base_url)
display_identifier = info.getDisplayIdentifier()
session['status'] = info.status
user_id = None
if info.status == consumer.SUCCESS:
dbname = session['dbname']
with utils.cursor(dbname) as cr:
registry = RegistryManager.get(dbname)
Modules = registry.get('ir.module.module')
installed = Modules.search_count(cr, 1, ['&', ('name', '=', 'auth_openid'), ('state', '=', 'installed')]) == 1
if installed:
Users = registry.get('res.users')
#openid_url = info.endpoint.canonicalID or display_identifier
openid_url = session['openid_url']
attrs = self._get_attributes_from_success_response(info)
attrs['openid_url'] = openid_url
session['attributes'] = attrs
openid_email = attrs.get('email', False)
domain = []
if openid_email:
domain += ['|', ('openid_email', '=', False)]
domain += [('openid_email', '=', openid_email)]
domain += [
('openid_url', '=', openid_url),
('active', '=', True),
]
ids = Users.search(cr, 1, domain)
assert len(ids) < 2
if ids:
user_id = ids[0]
login = Users.browse(cr, 1, user_id).login
key = randomString(utils.KEY_LENGTH, '0123456789abcdef')
Users.write(cr, 1, [user_id], {'openid_key': key})
# TODO fill empty fields with the ones from sreg/ax
cr.commit()
u = req.session.login(dbname, login, key)
if not user_id:
session['message'] = 'This OpenID identifier is not associated to any active users'
elif info.status == consumer.SETUP_NEEDED:
session['message'] = info.setup_url
elif info.status == consumer.FAILURE and display_identifier:
fmt = "Verification of %s failed: %s"
session['message'] = fmt % (display_identifier, info.message)
else: # FAILURE
# Either we don't understand the code or there is no
# openid_url included with the error. Give a generic
# failure message. The library should supply debug
# information in a log.
session['message'] = 'Verification failed.'
fragment = '#loginerror' if not user_id else ''
return werkzeug.utils.redirect('/web/webclient/home?debug=1'+fragment)
@openerpweb.jsonrequest
def status(self, req):
session = getattr(req.session, 'openid_session', {})
return {'status': session.get('status'), 'message': session.get('message')}

View File

@ -0,0 +1,94 @@
#!/usr/bin/env python
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2010-2011 OpenERP s.a. (<http://openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from openerp.osv import osv, fields
import openerp.exceptions
import tools
import utils
class res_users(osv.osv):
_inherit = 'res.users'
# TODO create helper fields for autofill openid_url and openid_email -> http://pad.openerp.com/web-openid
_columns = {
'openid_url': fields.char('OpenID URL', size=1024),
'openid_email': fields.char('OpenID Email', size=256,
help="Used for disambiguation in case of a shared OpenID URL"),
'openid_key': fields.char('OpenID Key', size=utils.KEY_LENGTH,
readonly=True),
}
def _check_openid_url_email(self, cr, uid, ids, context=None):
return all(self.search_count(cr, uid, [('active', '=', True), ('openid_url', '=', u.openid_url), ('openid_email', '=', u.openid_email)]) == 1 \
for u in self.browse(cr, uid, ids, context) if u.active and u.openid_url)
def _check_openid_url_email_msg(self, cr, uid, ids, context):
return "There is already an active user with this OpenID Email for this OpenID URL"
_constraints = [
(_check_openid_url_email, lambda self, *a, **kw: self._check_openid_url_email_msg(*a, **kw), ['active', 'openid_url', 'openid_email']),
]
def copy(self, cr, uid, rid, defaults=None, context=None):
reset_fields = 'openid_url openid_email'.split()
reset_values = dict.fromkeys(reset_fields, False)
if defaults is None:
defaults = reset_values
else:
defaults = dict(reset_values, **defaults)
defaults['openid_key'] = False
return super(res_users, self).copy(cr, uid, rid, defaults, context)
def login(self, db, login, password):
result = super(res_users, self).login(db, login, password)
if result:
return result
else:
with utils.cursor(db) as cr:
cr.execute('UPDATE res_users SET date=now() WHERE login=%s AND openid_key=%s AND active=%s RETURNING id',
(tools.ustr(login), tools.ustr(password), True))
res = cr.fetchone()
cr.commit()
return res[0] if res else False
def check(self, db, uid, passwd):
try:
return super(res_users, self).check(db, uid, passwd)
except openerp.exceptions.AccessDenied:
if not passwd:
raise
with utils.cursor(db) as cr:
cr.execute('''SELECT COUNT(1)
FROM res_users
WHERE id=%s
AND openid_key=%s
AND active=%s''',
(int(uid), passwd, True))
if not cr.fetchone()[0]:
raise
self._uid_cache.setdefault(db, {})[uid] = passwd
res_users()

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_users_form" model="ir.ui.view">
<field name="name">res.users.form</field>
<field name="model">res.users</field>
<field name="type">form</field>
<field name="inherit_id" ref="base.view_users_form"/>
<field name="arch" type="xml">
<notebook colspan="4" position="inside">
<page string="OpenID">
<field name="openid_url"/>
<field name="openid_email"/>
</page>
</notebook>
</field>
</record>
</data>
</openerp>

View File

@ -0,0 +1,64 @@
input[name='openid_url'] {
background: #fff url(../img/login-bg.gif) no-repeat 1px;
padding-left: 20px;
}
.auth_choice {
position: static;
display: none;
}
.openerp .login .oe_forms .oe_box2 td input[name="db"], .oe_forms .oe_box2 td select[name="db"] {
width: 50%;
float: left;
margin-top: 15px;
}
.openerp .login .oe_login_right_pane {
margin-left: 525px;
}
.openerp .login form {
width: 475px;
}
.openid_providers {
padding: 0;
list-style: none;
float: right;
}
.openid_providers li {
display: block;
float: left;
margin: 0 1px 3px 2px;
}
.openid_providers a {
display: block;
width: 24px;
height: 24px;
border: 1px solid #ddd;
background: #fff url(../img/openid_16.png) no-repeat 50%;
text-indent: -9999px;
overflow: hidden;
text-align: left;
}
.openid_providers a.selected {
border-color: #9A0404;
}
.openid_providers a[title="Password"] { background-image: url(../img/textfield_key.png); }
.openid_providers a[title="AOL"] { background-image: url(../img/aol.png); }
.openid_providers a[title="ClaimID"] { background-image: url(../img/claimid.png); }
.openid_providers a[title="Google"] { background-image: url(../img/googlefav.png); }
.openid_providers a[title="Google Apps"] { background-image: url(../img/marketplace.gif); }
.openid_providers a[title="MyOpenID"] { background-image: url(../img/myopenid.png); }
.openid_providers a[title="VeriSign"] { background-image: url(../img/verisign.png); }
.openid_providers a[title="Yahoo!"] { background-image: url(../img/yahoo.png); }
.openid_providers a[title="Launchpad"] { background-image: url(../img/launchpad.png); }
tr.auth_choice.selected {
display: table-row;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 940 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 419 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 328 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 320 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 671 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 455 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 520 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@ -0,0 +1,135 @@
openerp.auth_openid = function(instance) {
var QWeb = instance.web.qweb;
QWeb.add_template('/auth_openid/static/src/xml/auth_openid.xml');
instance.web.Login = instance.web.Login.extend({
start: function() {
this._super.apply(this, arguments);
var self = this;
this.$openid_selected_button = $();
this.$openid_selected_input = $();
this.$openid_selected_provider = null;
var openIdProvider = null;
if (this.has_local_storage && this.remember_creditentials) {
openIdProvider = localStorage.getItem('openid-provider');
}
if (openIdProvider) {
$openid_selected_provider = openIdProvider;
this.do_openid_select('a[href="#' + openIdProvider + '"]', openIdProvider, true);
if (this.has_local_storage && this.remember_creditentials) {
this.$openid_selected_input.find('input').val(localStorage.getItem('openid-login'));
}
}
else {
this.do_openid_select('a[data-url=""]', 'login,password', true);
}
this.$element.find('a[data-url]').click(function (event) {
event.preventDefault();
var selected_oidh = $(this).attr('href').substr(1);
if (selected_oidh != self.$openid_selected_provider) {
self.do_openid_select(this, selected_oidh);
}
});
},
do_openid_select: function (button, provider, noautosubmit) {
var self = this;
self.$openid_selected_button.add(self.$openid_selected_input).removeClass('selected');
self.$openid_selected_button = self.$element.find(button).addClass('selected');
var input = _(provider.split(',')).map(function(p) { return 'tr[data-provider="'+p+'"]'; }).join(',');
self.$openid_selected_input = self.$element.find(input).addClass('selected');
self.$openid_selected_input.find('input:first').focus();
self.$openid_selected_provider = (self.$openid_selected_button.attr('href') || '').substr(1);
if (self.has_local_storage && self.remember_creditentials) {
localStorage.setItem('openid-provider', self.$openid_selected_provider);
}
if (!noautosubmit && self.$openid_selected_input.length == 0) {
self.$element.find('form').submit();
}
},
on_login_invalid: function() {
var self = this;
var fragment = jQuery.deparam.fragment();
if (fragment.loginerror != undefined) {
this.rpc('/auth_openid/login/status', {}, function(result) {
if (_.contains(['success', 'failure'], result.status) && result.message) {
self.notification.warn('Invalid OpenID Login', result.message);
}
if (result.status === 'setup_needed' && result.message) {
window.location.replace(result.message);
}
});
}
return this._super();
},
on_submit: function(ev) {
var dataurl = this.$openid_selected_button.attr('data-url');
if(!dataurl) {
// login-password submitted
this._super(ev);
} else {
ev.preventDefault();
var id = this.$openid_selected_input.find('input').val();
if (this.has_local_storage && this.remember_creditentials) {
localStorage.setItem('openid-login', id);
}
var db = this.$element.find("form [name=db]").val();
var openid_url = dataurl.replace('{id}', id);
this.do_openid_login(db, openid_url);
}
},
do_openid_login: function(db, openid_url) {
var self = this;
this.rpc('/auth_openid/login/verify', {'db': db, 'url': openid_url}, function(result) {
if (result.error) {
self.notification.warn(result.title, result.error);
self.on_login_invalid();
return;
}
if (result.session_id) {
self.session.session_id = result.session_id;
self.session.session_save();
}
if (result.action === 'post') {
document.open();
document.write(result.value);
document.close();
} else if (result.action === 'redirect') {
window.location.replace(result.value);
} else {
// XXX display error ?
}
});
},
});
};

View File

@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- vim:fdl=1: -->
<templates id="template" xml:space="preserve">
<t t-extend="Login">
<t t-jquery=".oe_box2 tr:first td:nth-child(2)" t-operation="append">
<ul class="openid_providers">
<li><a href="#login,password" title="Password" data-url="" id="btn_password">Password</a></li>
<li><a href="#google" title="Google" data-url="https://www.google.com/accounts/o8/id">Google</a></li>
<li><a href="#googleapps" title="Google Apps" data-url="https://www.google.com/accounts/o8/site-xrds?hd={id}">Google</a></li>
<li><a href="#launchpad" title="Launchpad" data-url="https://launchpad.net/~{id}">Launchpad</a></li>
<li><a href="#openid_url" title="OpenID" data-url="{id}">OpenID</a></li>
</ul>
</t>
</t>
<t t-extend="Login">
<t t-jquery=".oe_box2 tr:first" t-operation="after">
<tr>
<td><label for="googleapps">Google Apps Domain:</label></td>
<td><input type="text" name="googleapps" /></td>
</tr>
<tr>
<td><label for="launchpad">Username:</label></td>
<td><input type="text" name="launchpad" /></td>
</tr>
<tr>
<td><label for="openid_url">OpenID URL:</label></td>
<td><input type="text" name="openid_url" /></td>
</tr>
</t>
</t>
<t t-extend="Login">
<t t-jquery=".oe_box2 tr:has(input[name!='db'])">
//this.addClass('auth_choice'); // XXX for some reason, not all tr tags are HTMLElement's and thus, jQuery decide to not change the class...
this.attr('class', 'auth_choice');
this.each(function() {
var $i = $(this);
$i.attr('data-provider', $i.find('input').attr('name'));
});
</t>
</t>
</templates>

View File

@ -0,0 +1,46 @@
#!/usr/bin/env python
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2010-2011 OpenERP s.a. (<http://openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from contextlib import contextmanager
from openerp.modules.registry import RegistryManager
KEY_LENGTH = 16
SREG2AX = { # from http://www.axschema.org/types/#sreg
'nickname': 'http://axschema.org/namePerson/friendly',
'email': 'http://axschema.org/contact/email',
'fullname': 'http://axschema.org/namePerson',
'dob': 'http://axschema.org/birthDate',
'gender': 'http://axschema.org/person/gender',
'postcode': 'http://axschema.org/contact/postalCode/home',
'country': 'http://axschema.org/contact/country/home',
'language': 'http://axschema.org/pref/language',
'timezone': 'http://axschema.org/pref/timezone',
}
@contextmanager
def cursor(db):
cr = RegistryManager.get(db).db.cursor()
try:
yield cr
finally:
cr.close()

View File

@ -6,7 +6,6 @@
<field name="code">EXPF</field>
<field name="type">purchase</field>
<field name="view_id" ref="account.account_journal_view"/>
<field name="sequence_id" ref="account.sequence_journal"/>
<field name="user_id" ref="base.user_root"/>
<field name="update_posted" eval="True" />
<field name="entry_posted" eval="True" />
@ -17,7 +16,6 @@
<field name="code">BCHF</field>
<field name="type">cash</field>
<field name="view_id" ref="account.account_journal_bank_view"/>
<field name="sequence_id" ref="account.sequence_journal"/>
<field name="user_id" ref="base.user_root"/>
<field name="update_posted" eval="True" />
<field name="entry_posted" eval="True" />
@ -28,7 +26,6 @@
<field name="code">BEUR</field>
<field name="type">cash</field>
<field name="view_id" ref="account.account_journal_bank_view"/>
<field name="sequence_id" ref="account.sequence_journal"/>
<field name="user_id" ref="base.user_root"/>
<field name="update_posted" eval="True" />
<field name="entry_posted" eval="True" />
@ -40,7 +37,6 @@
<field name="code">CAI</field>
<field name="type">cash</field>
<field name="view_id" ref="account.account_journal_bank_view"/>
<field name="sequence_id" ref="account.sequence_journal"/>
<field name="user_id" ref="base.user_root"/>
<field name="update_posted" eval="True" />
<field name="entry_posted" eval="True" />
@ -51,7 +47,6 @@
<field name="code">OD</field>
<field name="type">general</field>
<field name="view_id" ref="account.account_journal_bank_view"/>
<field name="sequence_id" ref="account.sequence_journal"/>
<field name="user_id" ref="base.user_root"/>
<field name="update_posted" eval="True" />
<field name="entry_posted" eval="True" />
@ -63,7 +58,6 @@
<field name="type">situation</field>
<field name="centralisation">True</field>
<field name="view_id" ref="account.account_journal_view"/>
<field name="sequence_id" ref="account.sequence_journal"/>
<field name="update_posted" eval="True" />
</record>

View File

@ -53,9 +53,9 @@ class pos_open_statement(osv.osv_memory):
continue
if journal.sequence_id:
number = sequence_obj.get_id(cr, uid, journal.sequence_id.id)
number = sequence_obj.next_by_id(cr, uid, journal.sequence_id.id)
else:
number = sequence_obj.get(cr, uid, 'account.cash.statement')
number = sequence_obj.next_by_code(cr, uid, 'account.cash.statement')
data.update({
'journal_id': journal.id,

View File

@ -122,7 +122,6 @@
default_credit_account_id: account_account_purchases0
default_debit_account_id: account_account_purchases0
name: Purchase Journal - (test)
sequence_id: account.sequence_purchase_journal
type: purchase
view_id: account.account_journal_view
-
@ -134,7 +133,6 @@
default_credit_account_id: account_account_sales0
default_debit_account_id: account_account_sales0
name: Sale Journal
sequence_id: account.sequence_sale_journal
type: sale
view_id: account.account_journal_view
-
@ -146,7 +144,6 @@
default_credit_account_id: account_account_cash0
default_debit_account_id: account_account_cash0
name: Bank Journal
sequence_id: account.sequence_journal
type: cash
view_id: account.account_journal_bank_view
-

View File

@ -2,12 +2,17 @@
<openerp>
<data noupdate="1">
<record id="stock_journal_sequence" model="ir.sequence">
<field name="name">Stock Journal Sequence</field>
<field eval="3" name="padding"/>
<field name="prefix">STJ/%(year)s/</field>
</record>
<record forcecreate="1" id="stock_journal" model="account.journal">
<field name="name">Stock Journal</field>
<field name="code">STJ</field>
<field name="type">general</field>
<field name="view_id" ref="account.account_journal_view"/>
<field name="sequence_id" ref="account.sequence_journal"/>
<field name="sequence_id" ref="stock_journal_sequence"/>
<field name="user_id" ref="base.user_root"/>
</record>

View File

@ -1,5 +1,5 @@
OpenERP, Open Source Management Solution
Copyright © 2010 OpenERP SA (<http://openerp.com>).
Copyright © 2010-2011 OpenERP SA (<http://openerp.com>).
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as

View File

@ -2,7 +2,7 @@
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2010 OpenERP s.a. (<http://openerp.com>).
# Copyright (C) 2010-2011 OpenERP s.a. (<http://openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
@ -20,7 +20,7 @@
##############################################################################
{
'name': 'Live Chat Support',
'version': '1.1',
'version': '2.0',
'category': 'Tools',
'complexity': "easy",
'description': """
@ -33,9 +33,14 @@ Add "Support" button in header from where you can access OpenERP Support.
'website': 'http://openerp.com',
'depends': ['base'],
'update_xml': [],
'js' : [
'static/src/js/web_livechat.js',
],
'css' : [
'static/src/css/lc.css',
],
'installable': True,
'active': True,
'web': True,
'active': False,
'certificate': '0013762192410413',
'images': ['images/web_livechat_support.jpeg'],
'images': ['static/src/img/web_livechat_support.jpeg'],
}

View File

@ -44,7 +44,7 @@ class publisher_warranty_contract(osv.osv):
@cache(skiparg=3)
def get_default_livechat_text(self, cr, uid):
return '<a href="http://www.openerp.com/support-or-publisher-warranty-contract" target="_blank"><img src="/web_livechat/static/images/busy.png"/>Support</a>'
return '<a href="http://www.openerp.com/support-or-publisher-warranty-contract" target="_blank"><img src="/web_livechat/static/src/img/busy.png"/>Support</a>'
publisher_warranty_contract()

View File

@ -1,7 +1,7 @@
#livechat_status a.online {
.livechat span.online {
text-shadow: 0 0 0.2em #9a0404, 0 0 0.2em #9a0404, 0 0 0.2em #9a0404, 0 0 0.2em #9a0404;
}
#livechat_status img {
.livechat img {
vertical-align: middle;
margin-right: 0.5em;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -0,0 +1,100 @@
/*############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2011 OpenERP SA (<http://openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
############################################################################*/
var __lc_buttons = [];
openerp.web_livechat = function (openerp) {
var QWeb = openerp.web.qweb;
QWeb.add_template('/web_livechat/static/src/xml/web_livechat.xml');
// tracking code from LiveChat
var license = '1035052',
params = '',
lang = 'en',
skill = '0';
__lc_load = function (p) { if (typeof __lc_loaded != 'function')
if (p) { var d = document, l = d.createElement('script'), s =
d.getElementsByTagName('script')[0], a = unescape('%26'),
h = ('https:' == d.location.protocol ? 'https://' : 'http://'); l.type = 'text/javascript'; l.async = true;
l.src = h + 'gis' + p +'.livechatinc.com/gis.cgi?serverType=control'+a+'licenseID='+license+a+'jsonp=__lc_load';
if (!(typeof p['server'] !== 'string' || typeof __lc_serv === 'string')) {
l.src = h + (__lc_serv = p['server']) + '/licence/'+license+'/script.cgi?lang='+lang+a+'groups='+skill;
l.src += (params == '') ? '' : a+'params='+encodeURIComponent(encodeURIComponent(params)); s.parentNode.insertBefore(l, s);
} else setTimeout(__lc_load, 1000); if(typeof __lc_serv != 'string'){ s.parentNode.insertBefore(l, s);}
} else __lc_load(Math.ceil(Math.random()*5)); }
__lc_load();
openerp.web_livechat.Livechat = openerp.web.Widget.extend({
template: 'Header-LiveChat',
start: function() {
this._super();
if (!this.session)
return;
var self = this;
var pwc = new openerp.web.Model(self.session, "publisher_warranty.contract");
pwc.get_func('get_default_livechat_text')().then(function(text) {
self.$element.html(text);
self.do_update();
});
openerp.webclient.header.do_update.add_last(this.do_update);
},
do_update: function() {
var self = this;
if (!this.session) {
self.$element.remove();
return;
}
var lc_id = _.uniqueId('livechat_');
this.$element.attr('id', lc_id);
var pwc = new openerp.web.Model(self.session, "publisher_warranty.contract");
pwc.get_func('is_livechat_enable')().then(function(res) {
console.log('res', res);
if(!res) {
//return;
}
__lc_buttons.push({
elementId: lc_id, //'livechat_status',
language: 'en',
skill: '0',
type: 'text',
labels: {
online: '<img src="/web_livechat/static/src/img/available.png"/>Support',
offline: '<img src="/web_livechat/static/src/img/away.png"/>Support',
}
});
});
}
});
openerp.webclient.livechat = new openerp.web_livechat.Livechat(openerp.webclient);
openerp.webclient.livechat.prependTo('div.header_corner');
};

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- vim:fdl=1:
-->
<templates id="template" xml:space="preserve">
<t t-name="Header-LiveChat">
<div class="livechat block logout"></div>
</t>
</templates>

View File

@ -1,5 +0,0 @@
##############################################################################
# This file is part of the "web-livechatinc-odoo" OpenERP module.
# See LICENCE file at the root of the module folder.
##############################################################################
import editors

View File

@ -1,93 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2010-2011 OpenERP s.a. (<http://openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import openobject.templating
class BaseTemplateEditor(openobject.templating.TemplateEditor):
templates = ['/openobject/controllers/templates/base.mako']
def edit(self, template, template_text):
output = super(BaseTemplateEditor, self).edit(template, template_text)
end_head = output.index('</head>')
output = output[:end_head] + """
<link rel="stylesheet" type="text/css" href="/web_livechat/static/css/lc.css"/>
<%
cp.session['livechat'] = rpc.RPCProxy('publisher_warranty.contract').is_livechat_enable()
%>
% if cp.session['livechat']:
<script type="text/javascript">
(function() {
var lc_params = '';
var lc_lang = 'en';
var lc_skill = '0';
var lc = document.createElement('script'); lc.type = 'text/javascript'; lc.async = true;
var lc_src = ('https:' == document.location.protocol ? 'https://' : 'http://');
lc_src += 'chat.livechatinc.net/licence/1035052/script.cgi?lang='+lc_lang+unescape('%26')+'groups='+lc_skill;
lc_src += ((lc_params == '') ? '' : unescape('%26')+'params='+encodeURIComponent(encodeURIComponent(lc_params))); lc.src = lc_src;
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(lc, s);
})();
</script>
% endif
""" + output[end_head:]
return output
class HeaderTemplateEditor(openobject.templating.TemplateEditor):
templates = ['/openerp/controllers/templates/header.mako']
def edit(self, template, template_text):
output = super(HeaderTemplateEditor, self).edit(template, template_text)
PATTERN = '<div id="corner">'
corner = output.index(PATTERN) + len(PATTERN)
output = output[:corner] + """
<p id="livechat_status" class="logout">
${ rpc.RPCProxy('publisher_warranty.contract').get_default_livechat_text() | n}
</p>
% if cp.session['livechat']:
<script type="text/javascript">
var __lc_buttons = __lc_buttons || [];
__lc_buttons.push({
elementId: 'livechat_status',
language: 'en',
skill: '0',
type: 'text',
labels: {
online: '<img src="/web_livechat/static/images/available.png"/>Support',
offline: '<img src="/web_livechat/static/images/away.png"/>Support'
}
});
</script>
% endif
""" + output[corner:]
return output

View File

@ -35,7 +35,6 @@ Invite OpenERP user feedback, powered by uservoice.
'data': [],
'installable': True,
'active': False,
'web': True,
'certificate': '0040452504963885',
'images': ['images/submit_an_idea.jpeg','images/web_uservoice_feedback.jpeg'],
}