diff --git a/addons/account/account.py b/addons/account/account.py
index c2e6f3d1221..bf072507aa0 100644
--- a/addons/account/account.py
+++ b/addons/account/account.py
@@ -31,7 +31,7 @@ import decimal_precision as dp
from tools.translate import _
from tools.float_utils import float_round
from openerp import SUPERUSER_ID
-
+import tools
_logger = logging.getLogger(__name__)
@@ -227,7 +227,7 @@ class account_account(osv.osv):
while pos < len(args):
if args[pos][0] == 'code' and args[pos][1] in ('like', 'ilike') and args[pos][2]:
- args[pos] = ('code', '=like', str(args[pos][2].replace('%', ''))+'%')
+ args[pos] = ('code', '=like', tools.ustr(args[pos][2].replace('%', ''))+'%')
if args[pos][0] == 'journal_id':
if not args[pos][2]:
del args[pos]
@@ -595,12 +595,15 @@ class account_account(osv.osv):
res.append((record['id'], name))
return res
- def copy(self, cr, uid, id, default={}, context=None, done_list=[], local=False):
+ def copy(self, cr, uid, id, default=None, context=None, done_list=None, local=False):
+ if default is None:
+ default = {}
+ else:
+ default = default.copy()
+ if done_list is None:
+ done_list = []
account = self.browse(cr, uid, id, context=context)
new_child_ids = []
- if not default:
- default = {}
- default = default.copy()
default.update(code=_("%s (copy)") % (account['code'] or ''))
if not local:
done_list = []
@@ -682,7 +685,7 @@ class account_journal_view(osv.osv):
_name = "account.journal.view"
_description = "Journal View"
_columns = {
- 'name': fields.char('Journal View', size=64, required=True),
+ 'name': fields.char('Journal View', size=64, required=True, translate=True),
'columns_id': fields.one2many('account.journal.column', 'view_id', 'Columns')
}
_order = "name"
@@ -777,11 +780,14 @@ class account_journal(osv.osv):
(_check_currency, 'Configuration error!\nThe currency chosen should be shared by the default accounts too.', ['currency','default_debit_account_id','default_credit_account_id']),
]
- def copy(self, cr, uid, id, default={}, context=None, done_list=[], local=False):
- journal = self.browse(cr, uid, id, context=context)
- if not default:
+ def copy(self, cr, uid, id, default=None, context=None, done_list=None, local=False):
+ if default is None:
default = {}
- default = default.copy()
+ else:
+ default = default.copy()
+ if done_list is None:
+ done_list = []
+ journal = self.browse(cr, uid, id, context=context)
default.update(
code=_("%s (copy)") % (journal['code'] or ''),
name=_("%s (copy)") % (journal['name'] or ''),
@@ -1178,7 +1184,7 @@ class account_fiscalyear(osv.osv):
'end_journal_period_id':fields.many2one('account.journal.period','End of Year Entries Journal', readonly=True),
}
- def copy(self, cr, uid, id, default={}, context=None):
+ def copy(self, cr, uid, id, default=None, context=None):
default.update({
'period_ids': [],
'end_journal_period_id': False
@@ -1437,9 +1443,15 @@ class account_move(osv.osv):
result = super(account_move, self).create(cr, uid, vals, context)
return result
- def copy(self, cr, uid, id, default={}, context=None):
+ def copy(self, cr, uid, id, default=None, context=None):
+ if context is None:
+ default = {}
+ else:
+ default = default.copy()
if context is None:
context = {}
+ else:
+ context = context.copy()
default.update({
'state':'draft',
'name':'/',
@@ -1908,7 +1920,7 @@ class account_tax(osv.osv):
'ref_tax_sign': fields.float('Tax Code Sign', help="Usually 1 or -1."),
'include_base_amount': fields.boolean('Included in base amount', help="Indicates if the amount of tax must be included in the base amount for the computation of the next taxes"),
'company_id': fields.many2one('res.company', 'Company', required=True),
- 'description': fields.char('Tax Code',size=32),
+ 'description': fields.char('Tax Code'),
'price_include': fields.boolean('Tax Included in Price', help="Check this if the price you use on the product and invoices includes this tax."),
'type_tax_use': fields.selection([('sale','Sale'),('purchase','Purchase'),('all','All')], 'Tax Application', required=True)
@@ -2269,7 +2281,10 @@ class account_model(osv.osv):
_defaults = {
'legend': lambda self, cr, uid, context:_('You can specify year, month and date in the name of the model using the following labels:\n\n%(year)s: To Specify Year \n%(month)s: To Specify Month \n%(date)s: Current Date\n\ne.g. My model on %(date)s'),
}
- def generate(self, cr, uid, ids, datas={}, context=None):
+
+ def generate(self, cr, uid, ids, data=None, context=None):
+ if data is None:
+ data = {}
move_ids = []
entry = {}
account_move_obj = self.pool.get('account.move')
@@ -2280,8 +2295,8 @@ class account_model(osv.osv):
if context is None:
context = {}
- if datas.get('date', False):
- context.update({'date': datas['date']})
+ if data.get('date', False):
+ context.update({'date': data['date']})
move_date = context.get('date', time.strftime('%Y-%m-%d'))
move_date = datetime.strptime(move_date,"%Y-%m-%d")
@@ -2467,10 +2482,10 @@ class account_subscription_line(osv.osv):
all_moves = []
obj_model = self.pool.get('account.model')
for line in self.browse(cr, uid, ids, context=context):
- datas = {
+ data = {
'date': line.date,
}
- move_ids = obj_model.generate(cr, uid, [line.subscription_id.model_id.id], datas, context)
+ move_ids = obj_model.generate(cr, uid, [line.subscription_id.model_id.id], data, context)
tocheck[line.subscription_id.id] = True
self.write(cr, uid, [line.id], {'move_id':move_ids[0]})
all_moves.extend(move_ids)
@@ -2518,7 +2533,7 @@ class account_account_template(osv.osv):
'reconcile': fields.boolean('Allow Reconciliation', help="Check this option if you want the user to reconcile entries in this account."),
'shortcut': fields.char('Shortcut', size=12),
'note': fields.text('Note'),
- 'parent_id': fields.many2one('account.account.template', 'Parent Account Template', ondelete='cascade'),
+ 'parent_id': fields.many2one('account.account.template', 'Parent Account Template', ondelete='cascade', domain=[('type','=','view')]),
'child_parent_ids':fields.one2many('account.account.template', 'parent_id', 'Children'),
'tax_ids': fields.many2many('account.tax.template', 'account_account_template_tax_rel', 'account_id', 'tax_id', 'Default Taxes'),
'nocreate': fields.boolean('Optional create', help="If checked, the new chart of accounts will not contain this by default."),
@@ -2536,20 +2551,6 @@ class account_account_template(osv.osv):
(_check_recursion, 'Error!\nYou cannot create recursive account templates.', ['parent_id']),
]
- def create(self, cr, uid, vals, context=None):
- if 'parent_id' in vals:
- parent = self.read(cr, uid, [vals['parent_id']], ['type'])
- if parent and parent[0]['type'] != 'view':
- raise osv.except_osv(_('Warning!'), _("You may only select a parent account of type 'View'."))
- return super(account_account_template, self).create(cr, uid, vals, context=context)
-
- def write(self, cr, uid, ids, vals, context=None):
- if 'parent_id' in vals:
- parent = self.read(cr, uid, [vals['parent_id']], ['type'])
- if parent and parent[0]['type'] != 'view':
- raise osv.except_osv(_('Warning!'), _("You may only select a parent account of type 'View'."))
- return super(account_account_template, self).write(cr, uid, ids, vals, context=context)
-
def name_get(self, cr, uid, ids, context=None):
if not ids:
return []
@@ -2828,7 +2829,7 @@ class account_tax_template(osv.osv):
'ref_base_sign': fields.float('Base Code Sign', help="Usually 1 or -1."),
'ref_tax_sign': fields.float('Tax Code Sign', help="Usually 1 or -1."),
'include_base_amount': fields.boolean('Include in Base Amount', help="Set if the amount of tax must be included in the base amount before computing the next taxes."),
- 'description': fields.char('Internal Name', size=32),
+ 'description': fields.char('Internal Name'),
'type_tax_use': fields.selection([('sale','Sale'),('purchase','Purchase'),('all','All')], 'Tax Use In', required=True,),
'price_include': fields.boolean('Tax Included in Price', help="Check this if the price you use on the product and invoices includes this tax."),
}
@@ -3250,7 +3251,7 @@ class wizard_multi_charts_accounts(osv.osv_memory):
property_obj.create(cr, uid, vals, context=context)
return True
- def _install_template(self, cr, uid, template_id, company_id, code_digits=None, obj_wizard=None, acc_ref={}, taxes_ref={}, tax_code_ref={}, context=None):
+ def _install_template(self, cr, uid, template_id, company_id, code_digits=None, obj_wizard=None, acc_ref=None, taxes_ref=None, tax_code_ref=None, context=None):
'''
This function recursively loads the template objects and create the real objects from them.
@@ -3268,6 +3269,12 @@ class wizard_multi_charts_accounts(osv.osv_memory):
* a last identical containing the mapping of tax code templates and tax codes
:rtype: tuple(dict, dict, dict)
'''
+ if acc_ref is None:
+ acc_ref = {}
+ if taxes_ref is None:
+ taxes_ref = {}
+ if tax_code_ref is None:
+ tax_code_ref = {}
template = self.pool.get('account.chart.template').browse(cr, uid, template_id, context=context)
if template.parent_id:
tmp1, tmp2, tmp3 = self._install_template(cr, uid, template.parent_id.id, company_id, code_digits=code_digits, acc_ref=acc_ref, taxes_ref=taxes_ref, tax_code_ref=tax_code_ref, context=context)
@@ -3280,7 +3287,7 @@ class wizard_multi_charts_accounts(osv.osv_memory):
tax_code_ref.update(tmp3)
return acc_ref, taxes_ref, tax_code_ref
- def _load_template(self, cr, uid, template_id, company_id, code_digits=None, obj_wizard=None, account_ref={}, taxes_ref={}, tax_code_ref={}, context=None):
+ def _load_template(self, cr, uid, template_id, company_id, code_digits=None, obj_wizard=None, account_ref=None, taxes_ref=None, tax_code_ref=None, context=None):
'''
This function generates all the objects from the templates
@@ -3298,6 +3305,12 @@ class wizard_multi_charts_accounts(osv.osv_memory):
* a last identical containing the mapping of tax code templates and tax codes
:rtype: tuple(dict, dict, dict)
'''
+ if account_ref is None:
+ account_ref = {}
+ if taxes_ref is None:
+ taxes_ref = {}
+ if tax_code_ref is None:
+ tax_code_ref = {}
template = self.pool.get('account.chart.template').browse(cr, uid, template_id, context=context)
obj_tax_code_template = self.pool.get('account.tax.code.template')
obj_acc_tax = self.pool.get('account.tax')
diff --git a/addons/account/account_bank.py b/addons/account/account_bank.py
index e44d2acd163..2323f8aaa8a 100644
--- a/addons/account/account_bank.py
+++ b/addons/account/account_bank.py
@@ -29,12 +29,12 @@ class bank(osv.osv):
'currency_id': fields.related('journal_id', 'currency', type="many2one", relation='res.currency', readonly=True,
string="Currency", help="Currency of the related account journal."),
}
- def create(self, cr, uid, data, context={}):
+ def create(self, cr, uid, data, context=None):
result = super(bank, self).create(cr, uid, data, context=context)
self.post_write(cr, uid, [result], context=context)
return result
- def write(self, cr, uid, ids, data, context={}):
+ def write(self, cr, uid, ids, data, context=None):
result = super(bank, self).write(cr, uid, ids, data, context=context)
self.post_write(cr, uid, ids, context=context)
return result
@@ -53,7 +53,7 @@ class bank(osv.osv):
data['currency_name'] = data['currency_id'] and currency_name[data['currency_id'][0]] or ''
return super(bank, self)._prepare_name_get(cr, uid, bank_dicts, context=context)
- def post_write(self, cr, uid, ids, context={}):
+ def post_write(self, cr, uid, ids, context=None):
if isinstance(ids, (int, long)):
ids = [ids]
diff --git a/addons/account/account_bank_statement.py b/addons/account/account_bank_statement.py
index 9889eadf387..b4fc2388a68 100644
--- a/addons/account/account_bank_statement.py
+++ b/addons/account/account_bank_statement.py
@@ -457,6 +457,8 @@ class account_bank_statement(osv.osv):
return res and res[0] or 0.0
def onchange_journal_id(self, cr, uid, statement_id, journal_id, context=None):
+ if not journal_id:
+ return {}
balance_start = self._compute_balance_end_real(cr, uid, journal_id, context=context)
journal_data = self.pool.get('account.journal').read(cr, uid, journal_id, ['default_debit_account_id', 'company_id'], context=context)
diff --git a/addons/account/account_invoice.py b/addons/account/account_invoice.py
index aff38d71cfe..c543b493831 100644
--- a/addons/account/account_invoice.py
+++ b/addons/account/account_invoice.py
@@ -508,8 +508,10 @@ class account_invoice(osv.osv):
if journal_id:
journal = self.pool.get('account.journal').browse(cr, uid, journal_id, context=context)
currency_id = journal.currency and journal.currency.id or journal.company_id.currency_id.id
+ company_id = journal.company_id.id
result = {'value': {
'currency_id': currency_id,
+ 'company_id': company_id,
}
}
return result
@@ -1306,17 +1308,19 @@ class account_invoice(osv.osv):
def create_send_note(self, cr, uid, ids, context=None):
for obj in self.browse(cr, uid, ids, context=context):
- self.message_post(cr, uid, [obj.id], body=_("%s created.") % (_(self._get_document_type(obj.type))), context=context)
+ self.message_post(cr, uid, [obj.id], body=_("%s created.") % (self._get_document_type(obj.type)),
+ subtype="account.mt_invoice_new", context=context)
def confirm_paid_send_note(self, cr, uid, ids, context=None):
- for obj in self.browse(cr, uid, ids, context=context):
- self.message_post(cr, uid, [obj.id], body=_("%s paid.") % (_(self._get_document_type(obj.type))), context=context)
+ for obj in self.browse(cr, uid, ids, context=context):
+ self.message_post(cr, uid, [obj.id], body=_("%s paid.") % (self._get_document_type(obj.type)),
+ subtype="account.mt_invoice_paid", context=context)
def invoice_cancel_send_note(self, cr, uid, ids, context=None):
for obj in self.browse(cr, uid, ids, context=context):
- self.message_post(cr, uid, [obj.id], body=_("%s cancelled.") % (_(self._get_document_type(obj.type))), context=context)
+ self.message_post(cr, uid, [obj.id], body=_("%s cancelled.") % (self._get_document_type(obj.type)),
+ context=context)
-account_invoice()
class account_invoice_line(osv.osv):
@@ -1371,7 +1375,10 @@ class account_invoice_line(osv.osv):
'partner_id': fields.related('invoice_id','partner_id',type='many2one',relation='res.partner',string='Partner',store=True)
}
- def _default_account_id(self, cr, uid, ids, context=None):
+ def _default_account_id(self, cr, uid, context=None):
+ # XXX this gets the default account for the user's company,
+ # it should get the default account for the invoice's company
+ # however, the invoice's company does not reach this point
prop = self.pool.get('ir.property').get(cr, uid, 'property_account_income_categ', 'product.category', context=context)
return prop and prop.id or False
@@ -1401,7 +1408,7 @@ class account_invoice_line(osv.osv):
context = {}
company_id = company_id if company_id != None else context.get('company_id',False)
context = dict(context)
- context.update({'company_id': company_id})
+ 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 !") )
if not product:
@@ -1556,16 +1563,19 @@ class account_invoice_line(osv.osv):
def onchange_account_id(self, cr, uid, ids, product_id, partner_id, inv_type, fposition_id, account_id):
if not account_id:
return {}
- taxes = self.pool.get('account.account').browse(cr, uid, account_id).tax_ids
+ unique_tax_ids = []
fpos = fposition_id and self.pool.get('account.fiscal.position').browse(cr, uid, fposition_id) or False
- tax_ids = self.pool.get('account.fiscal.position').map_tax(cr, uid, fpos, taxes)
-
- product_change_result = self.product_id_change(cr, uid, ids, product_id, False, type=inv_type,
- partner_id=partner_id, fposition_id=fposition_id)
- unique_tax_ids = set(tax_ids)
- if product_change_result and 'value' in product_change_result and 'invoice_line_tax_id' in product_change_result['value']:
- unique_tax_ids |= set(product_change_result['value']['invoice_line_tax_id'])
- return {'value':{'invoice_line_tax_id': list(unique_tax_ids)}}
+ account = self.pool.get('account.account').browse(cr, uid, account_id)
+ if not product_id:
+ taxes = account.tax_ids
+ unique_tax_ids = self.pool.get('account.fiscal.position').map_tax(cr, uid, fpos, taxes)
+ else:
+ product_change_result = self.product_id_change(cr, uid, ids, product_id, False, type=inv_type,
+ partner_id=partner_id, fposition_id=fposition_id,
+ company_id=account.company_id.id)
+ if product_change_result and 'value' in product_change_result and 'invoice_line_tax_id' in product_change_result['value']:
+ unique_tax_ids = product_change_result['value']['invoice_line_tax_id']
+ return {'value':{'invoice_line_tax_id': unique_tax_ids}}
account_invoice_line()
@@ -1650,14 +1660,13 @@ class account_invoice_tax(osv.osv):
for line in inv.invoice_line:
for tax in tax_obj.compute_all(cr, uid, line.invoice_line_tax_id, (line.price_unit* (1-(line.discount or 0.0)/100.0)), line.quantity, line.product_id, inv.partner_id)['taxes']:
- tax['price_unit'] = cur_obj.round(cr, uid, cur, tax['price_unit'])
val={}
val['invoice_id'] = inv.id
val['name'] = tax['name']
val['amount'] = tax['amount']
val['manual'] = False
val['sequence'] = tax['sequence']
- val['base'] = tax['price_unit'] * line['quantity']
+ val['base'] = cur_obj.round(cr, uid, cur, tax['price_unit'] * line['quantity'])
if inv.type in ('out_invoice','in_invoice'):
val['base_code_id'] = tax['base_code_id']
diff --git a/addons/account/account_invoice_view.xml b/addons/account/account_invoice_view.xml
index 1c4d83106ca..17ebfe1f744 100644
--- a/addons/account/account_invoice_view.xml
+++ b/addons/account/account_invoice_view.xml
@@ -299,8 +299,8 @@
-
-
+
+
diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py
index 5ddbbee74f2..b111cf2b771 100644
--- a/addons/account/account_move_line.py
+++ b/addons/account/account_move_line.py
@@ -562,6 +562,7 @@ class account_move_line(osv.osv):
'journal_id': lambda self, cr, uid, c: c.get('journal_id', False),
'credit': 0.0,
'debit': 0.0,
+ 'amount_currency': 0.0,
'account_id': lambda self, cr, uid, c: c.get('account_id', False),
'period_id': lambda self, cr, uid, c: c.get('period_id', False),
'company_id': lambda self, cr, uid, c: self.pool.get('res.company')._company_default_get(cr, uid, 'account.move.line', context=c)
@@ -1104,7 +1105,7 @@ class account_move_line(osv.osv):
'has been confirmed.') % res[2])
return res
- def _remove_move_reconcile(self, cr, uid, move_ids=[], context=None):
+ def _remove_move_reconcile(self, cr, uid, move_ids=None, context=None):
# Function remove move rencocile ids related with moves
obj_move_line = self.pool.get('account.move.line')
obj_move_rec = self.pool.get('account.move.reconcile')
@@ -1193,12 +1194,12 @@ class account_move_line(osv.osv):
jour_period_obj = self.pool.get('account.journal.period')
cr.execute('SELECT state FROM account_journal_period WHERE journal_id = %s AND period_id = %s', (journal_id, period_id))
result = cr.fetchall()
+ journal = journal_obj.browse(cr, uid, journal_id, context=context)
+ period = period_obj.browse(cr, uid, period_id, context=context)
for (state,) in result:
if state == 'done':
- raise osv.except_osv(_('Error!'), _('You cannot add/modify entries in a closed journal.'))
+ 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:
- journal = journal_obj.browse(cr, uid, journal_id, context=context)
- period = period_obj.browse(cr, uid, period_id, context=context)
jour_period_obj.create(cr, uid, {
'name': (journal.code or journal.name)+':'+(period.name or ''),
'journal_id': journal.id,
diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml
index 2c204fdf707..1fbda80a0fe 100644
--- a/addons/account/account_view.xml
+++ b/addons/account/account_view.xml
@@ -1305,16 +1305,6 @@
Account.Entry Edition
-->
-
- account.move.graph
- account.move
-
-
-
-
-
-
- account.move.treeaccount.move
@@ -1338,8 +1328,8 @@
-
-
+
+
+ created
+ account.invoice
+
+
+ paid
+ account.invoice
+
diff --git a/addons/account/partner.py b/addons/account/partner.py
index f2b9f79bb8a..a9b2b99588d 100644
--- a/addons/account/partner.py
+++ b/addons/account/partner.py
@@ -44,17 +44,17 @@ class account_fiscal_position(osv.osv):
return []
if not fposition_id:
return map(lambda x: x.id, taxes)
- result = []
+ result = set()
for t in taxes:
ok = False
for tax in fposition_id.tax_ids:
if tax.tax_src_id.id == t.id:
if tax.tax_dest_id:
- result.append(tax.tax_dest_id.id)
+ result.add(tax.tax_dest_id.id)
ok=True
if not ok:
- result.append(t.id)
- return result
+ result.add(t.id)
+ return list(result)
def map_account(self, cr, uid, fposition_id, account_id, context=None):
if not fposition_id:
@@ -77,6 +77,12 @@ class account_fiscal_position_tax(osv.osv):
'tax_dest_id': fields.many2one('account.tax', 'Replacement Tax')
}
+ _sql_constraints = [
+ ('tax_src_dest_uniq',
+ 'unique (position_id,tax_src_id,tax_dest_id)',
+ 'A tax fiscal position could be defined only once time on same taxes.')
+ ]
+
account_fiscal_position_tax()
class account_fiscal_position_account(osv.osv):
@@ -89,6 +95,12 @@ class account_fiscal_position_account(osv.osv):
'account_dest_id': fields.many2one('account.account', 'Account Destination', domain=[('type','<>','view')], required=True)
}
+ _sql_constraints = [
+ ('account_src_dest_uniq',
+ 'unique (position_id,account_src_id,account_dest_id)',
+ 'An account fiscal position could be defined only once time on same accounts.')
+ ]
+
account_fiscal_position_account()
class res_partner(osv.osv):
diff --git a/addons/account/partner_view.xml b/addons/account/partner_view.xml
index 7ac1efd4f9f..4bee2002ffd 100644
--- a/addons/account/partner_view.xml
+++ b/addons/account/partner_view.xml
@@ -92,34 +92,7 @@
-
-
+
@@ -141,7 +114,7 @@
context="{'search_default_partner_id':[active_id], 'default_partner_id': active_id}"
src_model="res.partner"
view_type="form"
- view_mode="tree,form,graph,calendar"/>
+ view_mode="tree,form,calendar"/>
diff --git a/addons/account/project/project_view.xml b/addons/account/project/project_view.xml
index da1a11b9cb6..70db95425b1 100644
--- a/addons/account/project/project_view.xml
+++ b/addons/account/project/project_view.xml
@@ -73,7 +73,7 @@
ir.actions.act_windowaccount.analytic.accountform
- tree,graph,form
+ tree,form
@@ -114,9 +114,6 @@
-
account.analytic.line.form
@@ -351,15 +348,6 @@
# Reporting
#
-
- Print Analytic Journals
- account.analytic.journal
- tree
- To print an analytics (or costs) journal for a given period. The report give code, move name, account number, general amount and analytic amount.
-
-
account.journal.form.1
@@ -372,16 +360,5 @@
-
- analytic.accounts.graph
- account.analytic.account
-
-
-
-
-
-
-
-
diff --git a/addons/account/project/wizard/account_analytic_chart.py b/addons/account/project/wizard/account_analytic_chart.py
index a10e938e293..92367e27da5 100644
--- a/addons/account/project/wizard/account_analytic_chart.py
+++ b/addons/account/project/wizard/account_analytic_chart.py
@@ -47,4 +47,4 @@ class account_analytic_chart(osv.osv_memory):
return result
account_analytic_chart()
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/account/project/wizard/account_analytic_inverted_balance_report.py b/addons/account/project/wizard/account_analytic_inverted_balance_report.py
index 2c9690fee50..95365716a22 100644
--- a/addons/account/project/wizard/account_analytic_inverted_balance_report.py
+++ b/addons/account/project/wizard/account_analytic_inverted_balance_report.py
@@ -52,4 +52,4 @@ class account_analytic_inverted_balance(osv.osv_memory):
}
account_analytic_inverted_balance()
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/account/project/wizard/account_analytic_journal_report.py b/addons/account/project/wizard/account_analytic_journal_report.py
index 9a2eee020b1..8148a016927 100644
--- a/addons/account/project/wizard/account_analytic_journal_report.py
+++ b/addons/account/project/wizard/account_analytic_journal_report.py
@@ -29,6 +29,7 @@ class account_analytic_journal_report(osv.osv_memory):
_columns = {
'date1': fields.date('Start of period', required=True),
'date2': fields.date('End of period', required=True),
+ 'analytic_account_journal_id': fields.many2many('account.analytic.journal', 'account_analytic_journal_name', 'journal_line_id', 'journal_print_id', 'Analytic Journals', required=True),
}
_defaults = {
@@ -40,8 +41,15 @@ class account_analytic_journal_report(osv.osv_memory):
if context is None:
context = {}
data = self.read(cr, uid, ids)[0]
+ ids_list = []
+ if context.get('active_id',False):
+ ids_list.append(context.get('active_id',False))
+ else:
+ record = self.browse(cr,uid,ids[0],context=context)
+ for analytic_record in record.analytic_account_journal_id:
+ ids_list.append(analytic_record.id)
datas = {
- 'ids': context.get('active_ids',[]),
+ 'ids': ids_list,
'model': 'account.analytic.journal',
'form': data
}
@@ -50,6 +58,14 @@ class account_analytic_journal_report(osv.osv_memory):
'report_name': 'account.analytic.journal',
'datas': datas,
}
+
+ def default_get(self, cr, uid, fields, context=None):
+ if context is None:
+ context = {}
+ res = super(account_analytic_journal_report, self).default_get(cr, uid, fields, context=context)
+ if 'analytic_account_journal_id' in fields:
+ res.update({'analytic_account_journal_id': context.get('active_ids',[])})
+ return res
account_analytic_journal_report()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/account/project/wizard/account_analytic_journal_report_view.xml b/addons/account/project/wizard/account_analytic_journal_report_view.xml
index e4c4cd314db..b0cb0293270 100644
--- a/addons/account/project/wizard/account_analytic_journal_report_view.xml
+++ b/addons/account/project/wizard/account_analytic_journal_report_view.xml
@@ -7,15 +7,16 @@
account.analytic.journal.report
@@ -38,6 +39,13 @@
actionaccount.analytic.journal
+
+
+
diff --git a/addons/account/project/wizard/project_account_analytic_line.py b/addons/account/project/wizard/project_account_analytic_line.py
index e49fbe911cb..54979d79b8a 100644
--- a/addons/account/project/wizard/project_account_analytic_line.py
+++ b/addons/account/project/wizard/project_account_analytic_line.py
@@ -55,4 +55,4 @@ class project_account_analytic_line(osv.osv_memory):
project_account_analytic_line()
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/account/report/account_balance.py b/addons/account/report/account_balance.py
index c3117e60379..fdda9cb11ce 100644
--- a/addons/account/report/account_balance.py
+++ b/addons/account/report/account_balance.py
@@ -68,7 +68,7 @@ class account_balance(report_sxw.rml_parse, common_report_header):
return self.pool.get('account.account').browse(self.cr, self.uid, data['form']['id']).company_id.name
return super(account_balance ,self)._get_account(data)
- def lines(self, form, ids=[], done=None):#, level=1):
+ def lines(self, form, ids=None, done=None):
def _process_child(accounts, disp_acc, parent):
account_rec = [acct for acct in accounts if acct['id']==parent][0]
currency_obj = self.pool.get('res.currency')
diff --git a/addons/account/report/account_central_journal.py b/addons/account/report/account_central_journal.py
index d3113b63133..a42712f40d7 100644
--- a/addons/account/report/account_central_journal.py
+++ b/addons/account/report/account_central_journal.py
@@ -105,4 +105,4 @@ class journal_print(report_sxw.rml_parse, common_report_header):
report_sxw.report_sxw('report.account.central.journal', 'account.journal.period', 'addons/account/report/account_central_journal.rml', parser=journal_print, header='internal')
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/account/report/account_general_journal.py b/addons/account/report/account_general_journal.py
index 9eb81157dba..0ffa08b31ef 100644
--- a/addons/account/report/account_general_journal.py
+++ b/addons/account/report/account_general_journal.py
@@ -158,4 +158,4 @@ class journal_print(report_sxw.rml_parse, common_report_header):
report_sxw.report_sxw('report.account.general.journal', 'account.journal.period', 'addons/account/report/general_journal.rml', parser=journal_print, header='internal')
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/account/report/account_report.py b/addons/account/report/account_report.py
index 59745355c5e..56e324bc361 100644
--- a/addons/account/report/account_report.py
+++ b/addons/account/report/account_report.py
@@ -284,4 +284,4 @@ class report_account_sales(osv.osv):
)""")
report_account_sales()
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/account/report/account_tax_report.py b/addons/account/report/account_tax_report.py
index 2a0c5987b47..cef1cf54af0 100644
--- a/addons/account/report/account_tax_report.py
+++ b/addons/account/report/account_tax_report.py
@@ -160,7 +160,7 @@ class tax_report(report_sxw.rml_parse, common_report_header):
i+=1
return res
- def _get_codes(self, based_on, company_id, parent=False, level=0, period_list=[], context=None):
+ def _get_codes(self, based_on, company_id, parent=False, level=0, period_list=None, context=None):
obj_tc = self.pool.get('account.tax.code')
ids = obj_tc.search(self.cr, self.uid, [('parent_id','=',parent),('company_id','=',company_id)], order='sequence', context=context)
@@ -171,7 +171,11 @@ class tax_report(report_sxw.rml_parse, common_report_header):
res += self._get_codes(based_on, company_id, code.id, level+1, context=context)
return res
- def _add_codes(self, based_on, account_list=[], period_list=[], context=None):
+ def _add_codes(self, based_on, account_list=None, period_list=None, context=None):
+ if account_list is None:
+ account_list = []
+ if period_list is None:
+ period_list = []
res = []
obj_tc = self.pool.get('account.tax.code')
for account in account_list:
diff --git a/addons/account/res_config.py b/addons/account/res_config.py
index ea903654a4e..17df4377548 100644
--- a/addons/account/res_config.py
+++ b/addons/account/res_config.py
@@ -117,6 +117,9 @@ class account_config_settings(osv.osv_memory):
'group_multi_currency': fields.boolean('Allow multi currencies',
implied_group='base.group_multi_currency',
help="Allows you multi currency environment"),
+ 'group_analytic_accounting': fields.boolean('Analytic accounting',
+ implied_group='analytic.group_analytic_accounting',
+ help="Allows you to use the analytic accounting."),
}
def _default_company(self, cr, uid, context=None):
diff --git a/addons/account/res_config_view.xml b/addons/account/res_config_view.xml
index d7618fbff5a..0e4b1fa64c4 100644
--- a/addons/account/res_config_view.xml
+++ b/addons/account/res_config_view.xml
@@ -129,6 +129,10 @@
+
+
+
+
diff --git a/addons/account/res_currency.py b/addons/account/res_currency.py
index 8e02836274a..ce781a1e11a 100644
--- a/addons/account/res_currency.py
+++ b/addons/account/res_currency.py
@@ -45,4 +45,3 @@ class res_currency_account(osv.osv):
res_currency_account()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/account/security/account_security.xml b/addons/account/security/account_security.xml
index 442b51466f8..4b90e0c8ad5 100644
--- a/addons/account/security/account_security.xml
+++ b/addons/account/security/account_security.xml
@@ -16,7 +16,7 @@
- Manager
+ Financial Manager
diff --git a/addons/account/wizard/account_invoice_refund.py b/addons/account/wizard/account_invoice_refund.py
index b7d278b8849..38a22baa9f1 100644
--- a/addons/account/wizard/account_invoice_refund.py
+++ b/addons/account/wizard/account_invoice_refund.py
@@ -32,11 +32,11 @@ class account_invoice_refund(osv.osv_memory):
_name = "account.invoice.refund"
_description = "Invoice Refund"
_columns = {
- 'date': fields.date('Operation Date', help='This date will be used as the invoice date for credit note and period will be chosen accordingly!'),
+ 'date': fields.date('Date', help='This date will be used as the invoice date for credit note and period will be chosen accordingly!'),
'period': fields.many2one('account.period', 'Force period'),
'journal_id': fields.many2one('account.journal', 'Refund Journal', help='You can select here the journal to use for the credit note that will be created. If you leave that field empty, it will use the same journal as the current invoice.'),
- 'description': fields.char('Description', size=128, required=True),
- 'filter_refund': fields.selection([('refund', 'Create a draft refund'), ('cancel', 'Cancel: create credit note and reconcile'),('modify', 'Modify: create credit note, reconcile and create a new draft invoice')], "Refund Method", required=True, help='Credit note base on this type. You can not Modify and Cancel if the invoice is already reconciled'),
+ 'description': fields.char('Reason', size=128, required=True),
+ 'filter_refund': fields.selection([('refund', 'Create a draft credit note'), ('cancel', 'Cancel: create credit note and reconcile'),('modify', 'Modify: create credit note, reconcile and create a new draft invoice')], "Refund Method", required=True, help='Credit note base on this type. You can not Modify and Cancel if the invoice is already reconciled'),
}
def _get_journal(self, cr, uid, context=None):
diff --git a/addons/account/wizard/account_invoice_refund_view.xml b/addons/account/wizard/account_invoice_refund_view.xml
index 78a9b085bf1..3945a6f57e6 100644
--- a/addons/account/wizard/account_invoice_refund_view.xml
+++ b/addons/account/wizard/account_invoice_refund_view.xml
@@ -7,19 +7,40 @@
account.invoice.refund
+
+
+
+ Status Change
+ account.voucher
+
+
diff --git a/addons/account_voucher/invoice.py b/addons/account_voucher/invoice.py
index 14b725cbeca..91ba438756e 100644
--- a/addons/account_voucher/invoice.py
+++ b/addons/account_voucher/invoice.py
@@ -27,11 +27,12 @@ class invoice(osv.osv):
def invoice_pay_customer(self, cr, uid, ids, context=None):
if not ids: return []
+ mod,modid = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'account_voucher', 'view_vendor_receipt_dialog_form')
inv = self.browse(cr, uid, ids[0], context=context)
return {
'name':_("Pay Invoice"),
'view_mode': 'form',
- 'view_id': False,
+ 'view_id': modid,
'view_type': 'form',
'res_model': 'account.voucher',
'type': 'ir.actions.act_window',
@@ -41,13 +42,13 @@ class invoice(osv.osv):
'context': {
'default_partner_id': inv.partner_id.id,
'default_amount': inv.type in ('out_refund', 'in_refund') and -inv.residual or inv.residual,
- 'default_name':inv.name,
+ 'default_number':inv.name,
'close_after_process': True,
- 'invoice_type':inv.type,
- 'invoice_id':inv.id,
+ 'invoice_type': inv.type,
+ 'invoice_id': inv.id,
'default_type': inv.type in ('out_invoice','out_refund') and 'receipt' or 'payment',
'type': inv.type in ('out_invoice','out_refund') and 'receipt' or 'payment'
- }
+ }
}
invoice()
diff --git a/addons/account_voucher/report/__init__.py b/addons/account_voucher/report/__init__.py
index caeb155adbe..862843352a8 100644
--- a/addons/account_voucher/report/__init__.py
+++ b/addons/account_voucher/report/__init__.py
@@ -23,4 +23,4 @@ import account_voucher
import account_voucher_print
import account_voucher_sales_receipt
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/account_voucher/voucher_payment_receipt_view.xml b/addons/account_voucher/voucher_payment_receipt_view.xml
index 65bcdad8a9b..78b76e5c9b7 100644
--- a/addons/account_voucher/voucher_payment_receipt_view.xml
+++ b/addons/account_voucher/voucher_payment_receipt_view.xml
@@ -284,6 +284,111 @@
+
+ account.voucher.receipt.dialog.form
+ account.voucher
+ 30
+
+
+
+
+
+
account.voucher.receipt.formaccount.voucher
@@ -297,7 +402,7 @@
-
+
@@ -329,7 +434,6 @@
-
diff --git a/addons/analytic/__openerp__.py b/addons/analytic/__openerp__.py
index 417d2b29b20..6227cd369d3 100644
--- a/addons/analytic/__openerp__.py
+++ b/addons/analytic/__openerp__.py
@@ -38,7 +38,8 @@ that have no counterpart in the general financial accounts.
'security/analytic_security.xml',
'security/ir.model.access.csv',
'analytic_sequence.xml',
- 'analytic_view.xml'
+ 'analytic_view.xml',
+ 'analytic_data.xml'
],
'demo': [],
'installable': True,
diff --git a/addons/analytic/analytic.py b/addons/analytic/analytic.py
index 269bf24ed61..ff09349b8a2 100644
--- a/addons/analytic/analytic.py
+++ b/addons/analytic/analytic.py
@@ -284,7 +284,8 @@ class account_analytic_account(osv.osv):
def create_send_note(self, cr, uid, ids, context=None):
for obj in self.browse(cr, uid, ids, context=context):
- self.message_post(cr, uid, [obj.id], body=_("Contract for %s has been created.") % (obj.partner_id.name), context=context)
+ self.message_post(cr, uid, [obj.id], body=_("Contract for %s has been created.") % (obj.partner_id.name),
+ subtype="analytic.mt_account_status", context=context)
account_analytic_account()
diff --git a/addons/analytic/analytic_data.xml b/addons/analytic/analytic_data.xml
new file mode 100644
index 00000000000..67940fb2063
--- /dev/null
+++ b/addons/analytic/analytic_data.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+ Status Change
+ account.analytic.account
+
+
+
+
diff --git a/addons/analytic_user_function/i18n/nl_BE.po b/addons/analytic_user_function/i18n/nl_BE.po
index 979cef10b2c..04943a48f1d 100644
--- a/addons/analytic_user_function/i18n/nl_BE.po
+++ b/addons/analytic_user_function/i18n/nl_BE.po
@@ -1,63 +1,86 @@
-# Translation of OpenERP Server.
-# This file contains the translation of the following modules:
-# * analytic_user_function
+# Dutch (Belgium) translation for openobject-addons
+# Copyright (c) 2012 Rosetta Contributors and Canonical Ltd 2012
+# This file is distributed under the same license as the openobject-addons package.
+# FIRST AUTHOR , 2012.
#
msgid ""
msgstr ""
-"Project-Id-Version: OpenERP Server 6.0dev\n"
-"Report-Msgid-Bugs-To: support@openerp.com\n"
-"POT-Creation-Date: 2009-08-28 15:34:14+0000\n"
-"PO-Revision-Date: 2009-08-28 15:34:14+0000\n"
-"Last-Translator: <>\n"
-"Language-Team: \n"
+"Project-Id-Version: openobject-addons\n"
+"Report-Msgid-Bugs-To: FULL NAME \n"
+"POT-Creation-Date: 2012-02-08 00:35+0000\n"
+"PO-Revision-Date: 2012-10-02 07:35+0000\n"
+"Last-Translator: Els Van Vossel (Agaplan) \n"
+"Language-Team: Dutch (Belgium) \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: \n"
-"Plural-Forms: \n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Launchpad-Export-Date: 2012-10-03 05:09+0000\n"
+"X-Generator: Launchpad (build 16061)\n"
#. module: analytic_user_function
-#: constraint:ir.ui.view:0
-msgid "Invalid XML for View Architecture!"
-msgstr ""
+#: field:analytic.user.funct.grid,product_id:0
+msgid "Product"
+msgstr "Product"
#. module: analytic_user_function
#: model:ir.model,name:analytic_user_function.model_analytic_user_funct_grid
msgid "Relation table between users and products on a analytic account"
msgstr ""
+"Relatietabel tussen gebruikers en producten van een analytische rekening"
#. module: analytic_user_function
-#: field:analytic_user_funct_grid,product_id:0
-msgid "Product"
-msgstr ""
+#: constraint:hr.analytic.timesheet:0
+msgid "You cannot modify an entry in a Confirmed/Done timesheet !."
+msgstr "In een bevestigde/afgesloten uurrooster kunt u geen regels wijzigen."
#. module: analytic_user_function
-#: field:analytic_user_funct_grid,account_id:0
+#: field:analytic.user.funct.grid,account_id:0
+#: model:ir.model,name:analytic_user_function.model_account_analytic_account
msgid "Analytic Account"
-msgstr ""
+msgstr "Analytische rekening"
#. module: analytic_user_function
#: view:account.analytic.account:0
#: field:account.analytic.account,user_product_ids:0
msgid "Users/Products Rel."
-msgstr ""
+msgstr "Rel. gebruikers/producten"
#. module: analytic_user_function
-#: field:analytic_user_funct_grid,user_id:0
+#: field:analytic.user.funct.grid,user_id:0
msgid "User"
+msgstr "Gebruiker"
+
+#. module: analytic_user_function
+#: code:addons/analytic_user_function/analytic_user_function.py:96
+#: code:addons/analytic_user_function/analytic_user_function.py:131
+#, python-format
+msgid "There is no expense account define for this product: \"%s\" (id:%d)"
msgstr ""
+"Er is geen kostenrekening gedefinieerd voor dit product: \"%s\" (id:%d)"
#. module: analytic_user_function
-#: constraint:ir.model:0
-msgid "The Object name must start with x_ and not contain any special character !"
-msgstr "De objectnaam moet beginnen met x_ en mag geen speciale karakters bevatten !"
+#: code:addons/analytic_user_function/analytic_user_function.py:95
+#: code:addons/analytic_user_function/analytic_user_function.py:130
+#, python-format
+msgid "Error !"
+msgstr "Fout"
#. module: analytic_user_function
-#: model:ir.module.module,shortdesc:analytic_user_function.module_meta_information
-msgid "Analytic User Function"
-msgstr ""
+#: constraint:account.analytic.account:0
+msgid "Error! You can not create recursive analytic accounts."
+msgstr "U kunt niet dezelfde analytische rekeningen maken."
#. module: analytic_user_function
-#: view:analytic_user_funct_grid:0
+#: model:ir.model,name:analytic_user_function.model_hr_analytic_timesheet
+msgid "Timesheet Line"
+msgstr "Uurroosterlijn"
+
+#. module: analytic_user_function
+#: view:analytic.user.funct.grid:0
msgid "User's Product for this Analytic Account"
-msgstr ""
+msgstr "Product van gebruiker voor deze analytische rekening"
+#~ msgid ""
+#~ "The Object name must start with x_ and not contain any special character !"
+#~ msgstr ""
+#~ "De objectnaam moet beginnen met x_ en mag geen speciale karakters bevatten !"
diff --git a/addons/anonymization/anonymization.py b/addons/anonymization/anonymization.py
index 43d198b27e2..8834645c460 100644
--- a/addons/anonymization/anonymization.py
+++ b/addons/anonymization/anonymization.py
@@ -363,7 +363,7 @@ class ir_model_fields_anonymize_wizard(osv.osv_memory):
})
raise osv.except_osv(error_type, error_msg)
- def anonymize_database(self,cr, uid, ids, context=None):
+ def anonymize_database(self, cr, uid, ids, context=None):
"""Sets the 'anonymized' state to defined fields"""
# create a new history record:
@@ -498,7 +498,7 @@ class ir_model_fields_anonymize_wizard(osv.osv_memory):
'target':'new',
}
- def reverse_anonymize_database(self,cr, uid, ids, context=None):
+ def reverse_anonymize_database(self, cr, uid, ids, context=None):
"""Set the 'clear' state to defined fields"""
ir_model_fields_anonymization_model = self.pool.get('ir.model.fields.anonymization')
diff --git a/addons/audittrail/audittrail.py b/addons/audittrail/audittrail.py
index 3dff7c1cb00..9232a696da8 100644
--- a/addons/audittrail/audittrail.py
+++ b/addons/audittrail/audittrail.py
@@ -202,7 +202,7 @@ class audittrail_objects_proxy(object_proxy):
res = value
return res
- def create_log_line(self, cr, uid, log_id, model, lines=[]):
+ def create_log_line(self, cr, uid, log_id, model, lines=None):
"""
Creates lines for changed fields with its old and new values
@@ -211,6 +211,8 @@ class audittrail_objects_proxy(object_proxy):
@param model: Object which values are being changed
@param lines: List of values for line is to be created
"""
+ if lines is None:
+ lines = []
pool = pooler.get_pool(cr.dbname)
obj_pool = pool.get(model.model)
model_pool = pool.get('ir.model')
@@ -349,9 +351,9 @@ class audittrail_objects_proxy(object_proxy):
data[(model.id, resource_id)] = {'text':values_text, 'value': values}
return data
- def prepare_audittrail_log_line(self, cr, uid, pool, model, resource_id, method, old_values, new_values, field_list=[]):
+ def prepare_audittrail_log_line(self, cr, uid, pool, model, resource_id, method, old_values, new_values, field_list=None):
"""
- This function compares the old data (i.e before the method was executed) and the new data
+ This function compares the old data (i.e before the method was executed) and the new data
(after the method was executed) and returns a structure with all the needed information to
log those differences.
@@ -375,9 +377,11 @@ class audittrail_objects_proxy(object_proxy):
(model.id, resource_id): []
}
- The reason why the structure returned is build as above is because when modifying an existing
+ The reason why the structure returned is build as above is because when modifying an existing
record, we may have to log a change done in a x2many field of that object
"""
+ if field_list is None:
+ field_list = []
key = (model.id, resource_id)
lines = {
key: []
@@ -416,7 +420,7 @@ class audittrail_objects_proxy(object_proxy):
lines[key].append(data)
return lines
- def process_data(self, cr, uid, pool, res_ids, model, method, old_values={}, new_values={}, field_list=[]):
+ def process_data(self, cr, uid, pool, res_ids, model, method, old_values=None, new_values=None, field_list=None):
"""
This function processes and iterates recursively to log the difference between the old
data (i.e before the method was executed) and the new data and creates audittrail log
@@ -435,6 +439,8 @@ class audittrail_objects_proxy(object_proxy):
on specific fields only.
:return: True
"""
+ if field_list is None:
+ field_list = []
# loop on all the given ids
for res_id in res_ids:
# compare old and new values and get audittrail log lines accordingly
@@ -442,11 +448,13 @@ class audittrail_objects_proxy(object_proxy):
# if at least one modification has been found
for model_id, resource_id in lines:
+ name = pool.get(model.model).name_get(cr, uid, [resource_id])[0][1]
vals = {
'method': method,
'object_id': model_id,
'user_id': uid,
'res_id': resource_id,
+ 'name': name,
}
if (model_id, resource_id) not in old_values and method not in ('copy', 'read'):
# the resource was not existing so we are forcing the method to 'create'
@@ -484,7 +492,7 @@ class audittrail_objects_proxy(object_proxy):
if len(rule['user_id']) == 0 or uid in rule['user_id']:
if rule.get('log_'+method,0):
return True
- elif method not in ('default_get','read','fields_view_get','fields_get','search','search_count','name_search','name_get','get','request_get', 'get_sc', 'unlink', 'write', 'create'):
+ elif method not in ('default_get','read','fields_view_get','fields_get','search','search_count','name_search','name_get','get','request_get', 'get_sc', 'unlink', 'write', 'create', 'read_group', 'import_data'):
if rule['log_action']:
return True
diff --git a/addons/auth_ldap/users_ldap.py b/addons/auth_ldap/users_ldap.py
index 47fc41c3645..c2c0ac557bf 100644
--- a/addons/auth_ldap/users_ldap.py
+++ b/addons/auth_ldap/users_ldap.py
@@ -180,8 +180,8 @@ class CompanyLDAP(osv.osv):
"""
user_id = False
- login = tools.ustr(login)
- cr.execute("SELECT id, active FROM res_users WHERE login=%s", (login,))
+ login = tools.ustr(login.lower())
+ cr.execute("SELECT id, active FROM res_users WHERE lower(login)=%s", (login,))
res = cr.fetchone()
if res:
if res[1]:
diff --git a/addons/auth_ldap/users_ldap_view.xml b/addons/auth_ldap/users_ldap_view.xml
index c4fc7cebbbe..47c15badd7c 100644
--- a/addons/auth_ldap/users_ldap_view.xml
+++ b/addons/auth_ldap/users_ldap_view.xml
@@ -14,7 +14,7 @@
-
+
diff --git a/addons/auth_oauth/__openerp__.py b/addons/auth_oauth/__openerp__.py
index d43815e8018..c8da9c65d4a 100644
--- a/addons/auth_oauth/__openerp__.py
+++ b/addons/auth_oauth/__openerp__.py
@@ -38,7 +38,10 @@ Allow users to login through Google OAuth2.
'security/ir.model.access.csv'
],
'js': ['static/src/js/auth_oauth.js'],
- 'css': ['static/lib/zocial/css/zocial.css'],
+ 'css': [
+ 'static/lib/zocial/css/zocial.css',
+ 'static/src/css/auth_oauth.css',
+ ],
'qweb': ['static/src/xml/auth_oauth.xml'],
'installable': True,
'auto_install': False,
diff --git a/addons/auth_oauth/auth_oauth_data.xml b/addons/auth_oauth/auth_oauth_data.xml
index 7bb95192e5d..83e9df2e44d 100644
--- a/addons/auth_oauth/auth_oauth_data.xml
+++ b/addons/auth_oauth/auth_oauth_data.xml
@@ -2,6 +2,15 @@
+
+ OpenERP Accounts
+ https://accounts.openerp.com/oauth2/auth
+ userinfo
+ https://accounts.openerp.com/oauth2/tokeninfo
+
+ zocial openerp
+ Sign in with OpenERP account
+ Facebook Graphhttps://www.facebook.com/dialog/oauth
diff --git a/addons/auth_oauth/controllers/main.py b/addons/auth_oauth/controllers/main.py
index 5d939f19db1..ae01df5f6f7 100644
--- a/addons/auth_oauth/controllers/main.py
+++ b/addons/auth_oauth/controllers/main.py
@@ -16,10 +16,13 @@ class OAuthController(openerpweb.Controller):
@openerpweb.jsonrequest
def list_providers(self, req, dbname):
- registry = openerp.modules.registry.RegistryManager.get(dbname)
- with registry.cursor() as cr:
- providers = registry.get('auth.oauth.provider')
- l = providers.read(cr, SUPERUSER_ID, providers.search(cr, SUPERUSER_ID, [('enabled','=',True)]))
+ try:
+ registry = openerp.modules.registry.RegistryManager.get(dbname)
+ with registry.cursor() as cr:
+ providers = registry.get('auth.oauth.provider')
+ l = providers.read(cr, SUPERUSER_ID, providers.search(cr, SUPERUSER_ID, [('enabled','=',True)]))
+ except Exception:
+ l = []
return l
@openerpweb.httprequest
diff --git a/addons/auth_oauth/res_users.py b/addons/auth_oauth/res_users.py
index b4f62612746..fd26e89c2e3 100644
--- a/addons/auth_oauth/res_users.py
+++ b/addons/auth_oauth/res_users.py
@@ -1,6 +1,7 @@
import logging
import urllib
+import urlparse
import urllib2
import simplejson
@@ -20,8 +21,11 @@ class res_users(osv.Model):
}
def auth_oauth_rpc(self, cr, uid, endpoint, access_token, context=None):
- params = urllib.urlencode({'access_token':access_token})
- url = endpoint + '?' + params
+ params = urllib.urlencode({ 'access_token': access_token })
+ if urlparse.urlparse(endpoint)[4]:
+ url = endpoint + '&' + params
+ else:
+ url = endpoint + '?' + params
f = urllib2.urlopen(url)
response = f.read()
return simplejson.loads(response)
@@ -38,26 +42,32 @@ class res_users(osv.Model):
validation = self.auth_oauth_rpc(cr, uid, p.validation_endpoint, access_token)
if validation.get("error"):
raise openerp.exceptions.AccessDenied
- login = validation['email']
+ if p.data_endpoint:
+ data = self.auth_oauth_rpc(cr, uid, p.data_endpoint, access_token)
+ validation.update(data)
+ # required
oauth_uid = validation['user_id']
- name = self.auth_oauth_rpc(cr, uid, p.data_endpoint, access_token)['name']
-
- credentials = (cr.dbname, login, access_token)
+ if not oauth_uid:
+ raise openerp.exceptions.AccessDenied
+ email = validation.get('email', 'provider_%d_user_%d' % (p.id, oauth_uid))
+ # optional
+ name = validation.get('name', email)
res = self.search(cr, uid, [("oauth_uid", "=", oauth_uid)])
if res:
- self.write(cr, uid, res[0], {'oauth_access_token':access_token})
+ self.write(cr, uid, res[0], { 'oauth_access_token': access_token })
else:
# New user
new_user = {
'name': name,
- 'login': login,
- 'user_email': login,
- 'oauth_provider_id': 1,
+ 'login': email,
+ 'user_email': email,
+ 'oauth_provider_id': p.id,
'oauth_uid': oauth_uid,
'oauth_access_token': access_token,
'active': True,
}
self.auth_signup_create(cr, uid, new_user)
+ credentials = (cr.dbname, email, access_token)
return credentials
def check_credentials(self, cr, uid, password):
diff --git a/addons/auth_oauth/static/src/css/auth_oauth.css b/addons/auth_oauth/static/src/css/auth_oauth.css
new file mode 100644
index 00000000000..ed6130e3123
--- /dev/null
+++ b/addons/auth_oauth/static/src/css/auth_oauth.css
@@ -0,0 +1,35 @@
+.openerp .oe_application .zocial {
+ font: white;
+}
+
+.openerp .zocial.openerp:before {
+ content: "\E02E";
+ font-style: italic;
+ text-shadow: 0 1px 1px black;
+}
+
+.openerp a.zocial.openerp {
+ float: right;
+ border: 1px solid #222222;
+ color: white;
+ margin: 0;
+ background-color: #b92020;
+ background-image: -webkit-gradient(linear, left top, left bottom, from(#b92020), to(#600606));
+ background-image: -webkit-linear-gradient(top, #b92020, #600606);
+ background-image: -moz-linear-gradient(top, #b92020, #600606);
+ background-image: -ms-linear-gradient(top, #b92020, #600606);
+ background-image: -o-linear-gradient(top, #b92020, #600606);
+ background-image: linear-gradient(to bottom, #b92020, #600606);
+ -moz-border-radius: 4px;
+ -webkit-border-radius: 4px;
+ border-radius: 4px;
+ -moz-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 1px rgba(155, 155, 155, 0.4) inset;
+ -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 1px rgba(155, 155, 155, 0.4) inset;
+ box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 1px rgba(155, 155, 155, 0.4) inset;
+ text-shadow: none;
+ font-weight: normal;
+}
+
+.openerp .oe_login .oe_oauth_provider_login_button {
+ margin-top: 4px;
+}
diff --git a/addons/auth_oauth/static/src/js/auth_oauth.js b/addons/auth_oauth/static/src/js/auth_oauth.js
index 4a41e720726..5c80d29f4e9 100644
--- a/addons/auth_oauth/static/src/js/auth_oauth.js
+++ b/addons/auth_oauth/static/src/js/auth_oauth.js
@@ -1,8 +1,9 @@
openerp.auth_oauth = function(instance) {
var QWeb = instance.web.qweb;
- instance.web.Login = instance.web.Login.extend({
+ instance.web.Login.include({
start: function(parent, params) {
+ var self = this;
var d = this._super.apply(this, arguments);
this.$el.on('click', 'a.zocial', this.on_oauth_sign_in);
this.oauth_providers = [];
@@ -11,7 +12,13 @@ openerp.auth_oauth = function(instance) {
} else if(this.params.oauth_error === 2) {
this.do_warn("Authentication error","");
}
- return d.then(this.do_oauth_load);
+ return d.then(this.do_oauth_load).fail(function() {
+ self.do_oauth_load([]);
+ });
+ },
+ on_db_loaded: function(result) {
+ this._super.apply(this, arguments);
+ this.$("form [name=db]").change(this.do_oauth_load);
},
do_oauth_load: function() {
var db = this.$("form [name=db]").val();
@@ -21,6 +28,7 @@ openerp.auth_oauth = function(instance) {
},
on_oauth_loaded: function(result) {
this.oauth_providers = result;
+ this.$('.oe_oauth_provider_login_button').remove();
var buttons = QWeb.render("auth_oauth.Login.button",{"widget":this});
this.$(".oe_login_pane form ul").after(buttons);
},
@@ -33,7 +41,7 @@ openerp.auth_oauth = function(instance) {
var state_object = {
d: dbname,
p: p.id
- }
+ };
var state = JSON.stringify(state_object);
var params = {
response_type: 'token',
diff --git a/addons/auth_oauth/static/src/xml/auth_oauth.xml b/addons/auth_oauth/static/src/xml/auth_oauth.xml
index c2693804e59..76c71b83f10 100644
--- a/addons/auth_oauth/static/src/xml/auth_oauth.xml
+++ b/addons/auth_oauth/static/src/xml/auth_oauth.xml
@@ -2,8 +2,7 @@
-
-
+
diff --git a/addons/base_calendar/base_calendar.py b/addons/base_calendar/base_calendar.py
index 7555621945d..5b8c41787d4 100644
--- a/addons/base_calendar/base_calendar.py
+++ b/addons/base_calendar/base_calendar.py
@@ -971,8 +971,8 @@ class calendar_event(osv.osv):
event = datas['id']
if datas.get('interval', 0) < 0:
raise osv.except_osv(_('Warning!'), _('Interval cannot be negative.'))
- if datas.get('count', 0) < 0:
- raise osv.except_osv(_('Warning!'), _('Count cannot be negative.'))
+ if datas.get('count', 0) <= 0:
+ raise osv.except_osv(_('Warning!'), _('Count cannot be negative or 0.'))
if datas['recurrency']:
result[event] = self.compute_rule_string(datas)
else:
@@ -1113,6 +1113,16 @@ rule or repeating pattern of time to exclude from the recurring rule."),
'user_id': lambda self, cr, uid, ctx: uid,
'organizer': default_organizer,
}
+
+ def _check_closing_date(self, cr, uid, ids, context=None):
+ for event in self.browse(cr, uid, ids, context=context):
+ if event.date_deadline < event.date:
+ return False
+ return True
+
+ _constraints = [
+ (_check_closing_date, 'Error ! End date cannot be set before start date.', ['date_deadline']),
+ ]
def get_recurrent_ids(self, cr, uid, select, domain, limit=100, context=None):
"""Gives virtual event ids for recurring events based on value of Recurrence Rule
diff --git a/addons/base_calendar/crm_meeting_view.xml b/addons/base_calendar/crm_meeting_view.xml
index 2da18447820..adcfc23a520 100644
--- a/addons/base_calendar/crm_meeting_view.xml
+++ b/addons/base_calendar/crm_meeting_view.xml
@@ -182,13 +182,14 @@
+ type="object" icon="gtk-apply"/>
+ type="object" icon="gtk-cancel"/>