diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml
index e01ff58e1f7..3912f665916 100644
--- a/addons/account/account_view.xml
+++ b/addons/account/account_view.xml
@@ -1714,35 +1714,37 @@
form
@@ -1769,7 +1771,7 @@
-
+
diff --git a/addons/account_invoice_layout/account_invoice_layout_view.xml b/addons/account_invoice_layout/account_invoice_layout_view.xml
index 6bdabae9326..062349f7716 100644
--- a/addons/account_invoice_layout/account_invoice_layout_view.xml
+++ b/addons/account_invoice_layout/account_invoice_layout_view.xml
@@ -55,6 +55,18 @@
+
+ account.invoice.supplier.form.layout
+ account.invoice
+
+ form
+
+
+
+
+
+
+
notify.message.search
diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py
index 38af59009d8..03b3a75144c 100644
--- a/addons/account_voucher/account_voucher.py
+++ b/addons/account_voucher/account_voucher.py
@@ -39,8 +39,6 @@ class account_voucher(osv.osv):
res[voucher.id] = ok
return res
-
-
def _get_type(self, cr, uid, context=None):
if context is None:
context = {}
@@ -98,7 +96,6 @@ class account_voucher(osv.osv):
journal_id = context.get('journal_id', False)
if journal_id:
journal = journal_pool.browse(cr, uid, journal_id, context=context)
-# currency_id = journal.company_id.currency_id.id
if journal.currency:
return journal.currency.id
return False
@@ -182,6 +179,14 @@ class account_voucher(osv.osv):
res[voucher.id] = abs(voucher.amount - abs(credit - debit))
return res
+ def _paid_amount_in_company_currency(self, cr, uid, ids, name, args, context=None):
+ if not ids: return {}
+ res = {}
+ debit = credit = 0.0
+ for voucher in self.browse(cr, uid, ids, context=context):
+ res[voucher.id] = voucher.amount / voucher.payment_rate
+ return res
+
_name = 'account.voucher'
_description = 'Accounting Voucher'
_order = "date desc, id desc"
@@ -242,6 +247,9 @@ class account_voucher(osv.osv):
'comment': fields.char('Counterpart Comment', size=64, required=True, readonly=True, states={'draft': [('readonly', False)]}),
'analytic_id': fields.many2one('account.analytic.account','Write-Off Analytic Account', readonly=True, states={'draft': [('readonly', False)]}),
'writeoff_amount': fields.function(_get_writeoff_amount, string='Reconcile Amount', type='float', readonly=True),
+ 'payment_rate': fields.float('Payment Rate', digits=(12,6), required=True, readonly=True, states={'draft': [('readonly', False)]},
+ help='The rate between the journal currency and the company currency for this particular payment.'),
+ 'paid_amount_in_company_currency': fields.function(_paid_amount_in_company_currency, string='Paid Amount in Company Currency', type='float', readonly=True),
}
_defaults = {
'period_id': _get_period,
@@ -260,6 +268,7 @@ class account_voucher(osv.osv):
'tax_id': _get_tax,
'payment_option': 'without_writeoff',
'comment': _('Write-Off'),
+ 'payment_rate': 1.0,
}
def compute_tax(self, cr, uid, ids, context=None):
@@ -409,6 +418,19 @@ class account_voucher(osv.osv):
return default
+ def onchange_rate(self, cr, uid, ids, rate, amount, context=None):
+ res = {'value': {'paid_amount_in_company_currency': 0.0}}
+ if rate and amount:
+ res['value']['paid_amount_in_company_currency'] = amount / rate
+ return res
+
+ def onchange_amount(self, cr, uid, ids, amount, rate, partner_id, journal_id, currency_id, ttype, date, context=None):
+ res = self.onchange_partner_id(cr, uid, ids, partner_id, journal_id, amount, currency_id, ttype, date, context=context)
+ vals = self.onchange_rate(cr, uid, ids, rate, amount, context=context)
+ for key in vals.keys():
+ res[key].update(vals[key])
+ return res
+
def onchange_partner_id(self, cr, uid, ids, partner_id, journal_id, price, currency_id, ttype, date, context=None):
"""
Returns a dict that contains new values and context
@@ -421,42 +443,32 @@ class account_voucher(osv.osv):
"""
if context is None:
context = {}
- if not journal_id:
- return {}
context_multi_currency = context.copy()
if date:
context_multi_currency.update({'date': date})
- line_pool = self.pool.get('account.voucher.line')
- line_ids = ids and line_pool.search(cr, uid, [('voucher_id', '=', ids[0])]) or False
- if line_ids:
- line_pool.unlink(cr, uid, line_ids)
-
currency_pool = self.pool.get('res.currency')
move_line_pool = self.pool.get('account.move.line')
partner_pool = self.pool.get('res.partner')
journal_pool = self.pool.get('account.journal')
+ line_pool = self.pool.get('account.voucher.line')
- vals = self.onchange_journal(cr, uid, ids, journal_id, [], False, partner_id, context)
- vals = vals.get('value')
+ #set default values
+ default = {
+ 'value': {'line_ids': [] ,'line_dr_ids': [] ,'line_cr_ids': [] ,'pre_line': False,},
+ }
+
+ #drop existing lines
+ line_ids = ids and line_pool.search(cr, uid, [('voucher_id', '=', ids[0])]) or False
+ if line_ids:
+ line_pool.unlink(cr, uid, line_ids)
+
+ if not partner_id or not journal_id:
+ return default
journal = journal_pool.browse(cr, uid, journal_id, context=context)
- currency_id = vals.get('currency_id', currency_id)
- default = {
- 'value':{'line_ids':[], 'line_dr_ids':[], 'line_cr_ids':[], 'pre_line': False, 'currency_id':currency_id},
- }
- currency_id = currency_id or journal.company_id.currency_id.id
-
- if not partner_id:
- return default
-
- if not partner_id and ids:
- line_ids = line_pool.search(cr, uid, [('voucher_id', '=', ids[0])])
- if line_ids:
- line_pool.unlink(cr, uid, line_ids)
- return default
-
partner = partner_pool.browse(cr, uid, partner_id, context=context)
+ currency_id = currency_id or journal.company_id.currency_id.id
account_id = False
if journal.type in ('sale','sale_refund'):
account_id = partner.property_account_receivable.id
@@ -484,64 +496,78 @@ class account_voucher(osv.osv):
ids = move_line_pool.search(cr, uid, [('state','=','valid'), ('account_id.type', '=', account_type), ('reconcile_id', '=', False), ('partner_id', '=', partner_id)], context=context)
else:
ids = context['move_line_ids']
+ invoice_id = context.get('invoice_id', False)
+ company_currency = journal.company_id.currency_id.id
+ move_line_found = False
+
+ #order the lines by most old first
ids.reverse()
moves = move_line_pool.browse(cr, uid, ids, context=context)
- #company_currency = journal.company_id.currency_id.id
- #if company_currency != currency_id and ttype == 'payment':
- # total_debit = currency_pool.compute(cr, uid, currency_id, company_currency, total_debit, context=context_multi_currency)
- #elif company_currency != currency_id and ttype == 'receipt':
- # total_credit = currency_pool.compute(cr, uid, currency_id, company_currency, total_credit, context=context_multi_currency)
-
- company_currency = journal.company_id.currency_id.id
for line in moves:
if line.credit and line.reconcile_partial_id and ttype == 'receipt':
continue
if line.debit and line.reconcile_partial_id and ttype == 'payment':
continue
+ if invoice_id:
+ if line.invoice.id == invoice_id:
+ #if the invoice linked to the voucher line is equal to the invoice_id in context
+ #then we assign the amount on that line, whatever the other voucher lines
+ move_line_found = line.id
+ break
+ elif currency_id == company_currency:
+ #otherwise treatments is the same but with other field names
+ if line.amount_residual == price:
+ #if the amount residual is equal the amount voucher, we assign it to that voucher
+ #line, whatever the other voucher lines
+ move_line_found = line.id
+ break
+ #otherwise we will split the voucher amount on each line (by most old first)
+ total_credit += line.credit or 0.0
+ total_debit += line.debit or 0.0
+ elif currency_id == line.currency_id.id:
+ if line.amount_residual_currency == price:
+ move_line_found = line.id
+ break
+ total_credit += line.credit and line.amount_currency or 0.0
+ total_debit += line.debit and line.amount_currency or 0.0
- if line.currency_id and currency_id==line.currency_id.id:
- total_credit += line.amount_currency <0 and -line.amount_currency or 0.0
- total_debit += line.amount_currency >0 and line.amount_currency or 0.0
- else:
- total_credit += currency_pool.compute(cr, uid, company_currency, currency_id, line.credit or 0.0)
- total_debit += currency_pool.compute(cr, uid, company_currency, currency_id, line.debit or 0.0)
-
+ #voucher line creation
for line in moves:
if line.credit and line.reconcile_partial_id and ttype == 'receipt':
continue
if line.debit and line.reconcile_partial_id and ttype == 'payment':
continue
-
if line.currency_id and currency_id==line.currency_id.id:
amount_original = abs(line.amount_currency)
amount_unreconciled = abs(line.amount_residual_currency)
else:
amount_original = currency_pool.compute(cr, uid, company_currency, currency_id, line.credit or line.debit or 0.0)
amount_unreconciled = currency_pool.compute(cr, uid, company_currency, currency_id, abs(line.amount_residual))
-
- #original_amount = line.credit or line.debit or 0.0
- #amount_unreconciled = currency_pool.compute(cr, uid, line.currency_id and line.currency_id.id or company_currency, currency_id, abs(line.amount_residual_currency), context=context_multi_currency)
rs = {
'name':line.move_id.name,
'type': line.credit and 'dr' or 'cr',
'move_line_id':line.id,
'account_id':line.account_id.id,
'amount_original': amount_original,
+ 'amount': (move_line_found == line.id) and min(price, amount_unreconciled) or 0.0,
'date_original':line.date,
'date_due':line.date_maturity,
'amount_unreconciled': amount_unreconciled,
-
}
- if line.credit:
- amount = min(amount_unreconciled, total_debit)
- rs['amount'] = amount
- total_debit -= amount
- else:
- amount = min(amount_unreconciled, total_credit)
- rs['amount'] = amount
- total_credit -= amount
+ #split voucher amount by most old first, but only for lines in the same currency
+ if not move_line_found:
+ line_currency_id = line.currency_id and line.currency_id.id or company_currency
+ if currency_id == line_currency_id:
+ if line.credit:
+ amount = min(amount_unreconciled, abs(total_debit))
+ rs['amount'] = amount
+ total_debit -= amount
+ else:
+ amount = min(amount_unreconciled, abs(total_credit))
+ rs['amount'] = amount
+ total_credit -= amount
default['value']['line_ids'].append(rs)
if rs['type'] == 'cr':
@@ -556,23 +582,30 @@ class account_voucher(osv.osv):
default['value']['writeoff_amount'] = self._compute_writeoff_amount(cr, uid, default['value']['line_dr_ids'], default['value']['line_cr_ids'], price)
return default
- def onchange_date(self, cr, uid, ids, partner_id, journal_id, price, currency_id, ttype, date, context=None):
+ def onchange_date(self, cr, uid, ids, date, currency_id, amount, context=None):
"""
@param date: latest value from user input for field date
@param args: other arguments
@param context: context arguments, like lang, time zone
@return: Returns a dict which contains new values, and context
"""
+ res = {'value': {}}
+ #set the period of the voucher
period_pool = self.pool.get('account.period')
- res = self.onchange_partner_id(cr, uid, ids, partner_id, journal_id, price, currency_id, ttype, date, context=context)
pids = period_pool.search(cr, uid, [('date_start', '<=', date), ('date_stop', '>=', date)])
if pids:
- if not 'value' in res:
- res['value'] = {}
res['value'].update({'period_id':pids[0]})
+ #set the default payment rate of the voucher and compute the paid amount in company currency
+ payment_rate = 1.0
+ if currency_id:
+ payment_rate = self.pool.get('res.currency').browse(cr, uid, currency_id, context={'date': date}).rate
+ res['value'].update({'payment_rate': payment_rate})
+ vals = self.onchange_rate(cr, uid, ids, payment_rate, amount, context=context)
+ for key in vals.keys():
+ res[key].update(vals[key])
return res
- def onchange_journal(self, cr, uid, ids, journal_id, line_ids, tax_id, partner_id, context=None):
+ def onchange_journal(self, cr, uid, ids, journal_id, line_ids, tax_id, partner_id, date, amount, ttype, context=None):
if not journal_id:
return False
journal_pool = self.pool.get('account.journal')
@@ -583,11 +616,19 @@ class account_voucher(osv.osv):
tax_id = account_id.tax_ids[0].id
vals = self.onchange_price(cr, uid, ids, line_ids, tax_id, partner_id, context)
- vals['value'].update({'tax_id':tax_id})
- currency_id = False #journal.company_id.currency_id.id
+ vals['value'].update({'tax_id':tax_id,'amount': amount})
+ currency_id = False
if journal.currency:
currency_id = journal.currency.id
- vals['value'].update({'currency_id':currency_id})
+ payment_rate = self.pool.get('res.currency').browse(cr, uid, currency_id, context={'date': date}).rate
+ vals['value'].update({'payment_rate': payment_rate})
+ res = self.onchange_rate(cr, uid, ids, payment_rate, amount, context=context)
+ for key in res.keys():
+ vals[key].update(res[key])
+ vals['value'].update({'currency_id': currency_id})
+ res = self.onchange_partner_id(cr, uid, ids, partner_id, journal_id, amount, currency_id, ttype, date, context)
+ for key in res.keys():
+ vals[key].update(res[key])
return vals
def proforma_voucher(self, cr, uid, ids, context=None):
@@ -631,7 +672,6 @@ class account_voucher(osv.osv):
raise osv.except_osv(_('Invalid action !'), _('Cannot delete Voucher(s) which are already opened or paid !'))
return super(account_voucher, self).unlink(cr, uid, ids, context=context)
- # TODO: may be we can remove this method if not used anyware
def onchange_payment(self, cr, uid, ids, pay_now, journal_id, partner_id, ttype='sale'):
res = {}
if not partner_id:
@@ -690,9 +730,9 @@ class account_voucher(osv.osv):
# TODO: Make this logic available.
# -for sale, purchase we have but for the payment and receipt we do not have as based on the bank/cash journal we can not know its payment or receipt
if voucher_brw.type in ('purchase', 'payment'):
- credit = currency_obj.compute(cr, uid, current_currency, company_currency, voucher_brw.amount, context=context)
+ credit = voucher_brw.amount / voucher_brw.payment_rate
elif voucher_brw.type in ('sale', 'receipt'):
- debit = currency_obj.compute(cr, uid, current_currency, company_currency, voucher_brw.amount, context=context)
+ debit = voucher_brw.amount / voucher_brw.payment_rate
if debit < 0: credit = -debit; debit = 0.0
if credit < 0: debit = -credit; credit = 0.0
sign = debit - credit < 0 and -1 or 1
@@ -817,10 +857,10 @@ class account_voucher(osv.osv):
continue
#we check if the voucher line is fully paid or not and create a move line to balance the payment and initial invoice if needed
if line.amount == line.amount_unreconciled:
- amount = currency_obj.compute(cr, uid, current_currency, company_currency, line.untax_amount or line.amount, context=context)
+ amount = (line.untax_amount or line.amount) / voucher_brw.payment_rate
amount_residual = line.move_line_id.amount_residual - amount #residual amount in company currency
else:
- amount = currency_obj.compute(cr, uid, current_currency, company_currency, line.untax_amount or line.amount, context=context)
+ amount = (line.untax_amount or line.amount) / voucher_brw.payment_rate
amount_residual = 0.0
move_line = {
'journal_id': voucher_brw.journal_id.id,
@@ -970,9 +1010,9 @@ class account_voucher(osv.osv):
line_total = move_line_brw.debit - move_line_brw.credit
rec_list_ids = []
if voucher.type == 'sale':
- line_total = line_total - currency_pool.compute(cr, uid, current_currency, company_currency, voucher.tax_amount, context=context)
+ line_total = line_total - (voucher.tax_amount / voucher.payment_rate)
elif voucher.type == 'purchase':
- line_total = line_total + currency_pool.compute(cr, uid, current_currency, company_currency, voucher.tax_amount, context=context)
+ line_total = line_total + (voucher.tax_amount / voucher.payment_rate)
#create one move line per voucher line where amount is not 0.0
line_total, rec_list_ids = self.voucher_move_line_create(cr, uid, voucher.id, line_total, move_id, company_currency, current_currency, context)
@@ -1172,17 +1212,10 @@ class account_bank_statement_line(osv.osv):
def _amount_reconciled(self, cursor, user, ids, name, args, context=None):
if not ids:
return {}
-
res = {}
-# company_currency_id = False
for line in self.browse(cursor, user, ids, context=context):
-# if not company_currency_id:
-# company_currency_id = line.company_id.id
if line.voucher_id:
res[line.id] = line.voucher_id.amount#
-# res_currency_obj.compute(cursor, user,
-# company_currency_id, line.statement_id.currency.id,
-# line.voucher_id.amount, context=context)
else:
res[line.id] = 0.0
return res
@@ -1203,7 +1236,6 @@ class account_bank_statement_line(osv.osv):
'amount_reconciled': fields.function(_amount_reconciled,
string='Amount reconciled', type='float'),
'voucher_id': fields.many2one('account.voucher', 'Payment'),
-
}
def unlink(self, cr, uid, ids, context=None):
diff --git a/addons/account_voucher/invoice.py b/addons/account_voucher/invoice.py
index 0230cac1009..b108bc14fe3 100644
--- a/addons/account_voucher/invoice.py
+++ b/addons/account_voucher/invoice.py
@@ -45,10 +45,11 @@ class invoice(osv.osv):
'close_after_process': True,
'invoice_type':inv.type,
'invoice_id':inv.id,
- 'default_type': inv.type in ('out_invoice','out_refund') and 'receipt' or 'payment'
+ '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()
-# 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/test/case1_usd_usd.yml b/addons/account_voucher/test/case1_usd_usd.yml
index eabcec2a08c..6685e64f298 100644
--- a/addons/account_voucher/test/case1_usd_usd.yml
+++ b/addons/account_voucher/test/case1_usd_usd.yml
@@ -149,12 +149,13 @@
'partner_id': ref('res_partner_strauss0'),
'period_id': ref('account.period_3'),
'type': 'receipt',
- 'date': time.strftime("%Y-03-01"),
+ 'date': time.strftime("%Y-%m-%d"),
'payment_option': 'with_writeoff',
'writeoff_acc_id': ref('account.a_expense'),
'comment': 'Write Off',
'name': 'First payment',
}
+ vals.update(self.onchange_date(cr, uid, [], time.strftime('%Y-03-01'), ref('base.USD'), 240)['value'])
if not res['value']['line_cr_ids']:
res['value']['line_cr_ids'] = [{'type': 'cr', 'account_id': ref('account.a_recv'),}]
for item in res['value']['line_cr_ids']:
@@ -247,12 +248,13 @@
'partner_id': ref('res_partner_strauss0'),
'period_id': ref('account.period_3'),
'type': 'receipt',
- 'date': time.strftime("%Y-04-01"),
+ 'date': time.strftime("%Y-%m-%d"),
'payment_option': 'with_writeoff',
'writeoff_acc_id': ref('account.a_expense'),
'comment': 'Write Off',
'name': 'Second payment',
}
+ vals.update(self.onchange_date(cr, uid, [], time.strftime('%Y-04-01'), ref('base.USD'), 45.0)['value'])
if not res['value']['line_cr_ids']:
res['value']['line_cr_ids'] = [{'type': 'cr', 'account_id': ref('account.a_recv'),}]
for item in res['value']['line_cr_ids']:
diff --git a/addons/account_voucher/test/case2_suppl_usd_eur.yml b/addons/account_voucher/test/case2_suppl_usd_eur.yml
index 31e756d5355..424783d8a7b 100644
--- a/addons/account_voucher/test/case2_suppl_usd_eur.yml
+++ b/addons/account_voucher/test/case2_suppl_usd_eur.yml
@@ -239,12 +239,13 @@
'partner_id': ref('res_partner_clements0'),
'period_id': ref('account.period_3'),
'type': 'payment',
- 'date': time.strftime("%Y-04-01"),
+ 'date': time.strftime("%Y-%m-%d"),
'payment_option': 'with_writeoff',
'writeoff_acc_id': ref('account.a_expense'),
'comment': 'Write Off',
'name': 'Second payment',
}
+ vals.update(self.onchange_date(cr, uid, [], time.strftime('%Y-04-01'), ref('base.USD'), 45.0)['value'])
if not res['value']['line_dr_ids']:
res['value']['line_dr_ids'] = [{'type': 'dr', 'account_id': ref('account.a_pay'),}]
for item in res['value']['line_dr_ids']:
diff --git a/addons/account_voucher/test/case2_usd_eur_debtor_in_eur.yml b/addons/account_voucher/test/case2_usd_eur_debtor_in_eur.yml
index b872a54561d..e1cc87f427e 100644
--- a/addons/account_voucher/test/case2_usd_eur_debtor_in_eur.yml
+++ b/addons/account_voucher/test/case2_usd_eur_debtor_in_eur.yml
@@ -155,12 +155,12 @@
!python {model: account.voucher}: |
import netsvc, time
vals = {}
- res = self.onchange_partner_id(cr, uid, [], ref("res_partner_michael0"), ref('bank_journal_EUR'), 240.0, 2, ttype='receipt', date=False)
+ res = self.onchange_partner_id(cr, uid, [], ref("res_partner_michael0"), ref('bank_journal_EUR'), 240.0, False, ttype='receipt', date=False)
vals = {
'account_id': ref('account.cash'),
'amount': 200.0,
'company_id': ref('base.main_company'),
- 'currency_id': ref('base.EUR'),
+ 'currency_id': False,
'journal_id': ref('bank_journal_EUR'),
'partner_id': ref('res_partner_michael0'),
'period_id': ref('account.period_3'),
@@ -220,8 +220,9 @@
move_line_obj = self.pool.get('account.move.line')
move_lines = move_line_obj.search(cr, uid, [('move_id', '=', invoice_id.move_id.id), ('invoice', '=', invoice_id.id), ('account_id', '=', invoice_id.account_id.id)])
move_line = move_line_obj.browse(cr, uid, move_lines[0])
+ print move_line.amount_residual, move_line.amount_residual_currency
assert (move_line.amount_residual_currency == 55.56 and move_line.amount_residual == 20) , "Residual amount is not correct for first Invoice"
-- toto
+-
I check the residual amuont of Invoice2, should be 22.22 in residual currency and 10 in amount_residual
-
!python {model: account.invoice}: |
@@ -247,13 +248,14 @@
'partner_id': ref('res_partner_michael0'),
'period_id': ref('account.period_3'),
'type': 'receipt',
- 'date': time.strftime("%Y-04-01"),
+ 'date': time.strftime("%Y-%m-%d"),
'payment_option': 'with_writeoff',
'writeoff_acc_id': ref('account.a_expense'),
'exchange_acc_id': ref('account.o_expense'),
'comment': 'Write Off',
'name': 'Second payment',
}
+ vals.update(self.onchange_date(cr, uid, [], time.strftime('%Y-04-01'), ref('base.USD'), 80.0)['value'])
if not res['value']['line_cr_ids']:
res['value']['line_cr_ids'] = [{'type': 'cr', 'account_id': ref('account.a_recv'),}]
for item in res['value']['line_cr_ids']:
diff --git a/addons/account_voucher/test/case2_usd_eur_debtor_in_usd.yml b/addons/account_voucher/test/case2_usd_eur_debtor_in_usd.yml
index 8fc495d79c8..355098dc7d6 100644
--- a/addons/account_voucher/test/case2_usd_eur_debtor_in_usd.yml
+++ b/addons/account_voucher/test/case2_usd_eur_debtor_in_usd.yml
@@ -155,7 +155,7 @@
!python {model: account.voucher}: |
import netsvc, time
vals = {}
- res = self.onchange_partner_id(cr, uid, [], ref("res_partner_michal1"), ref('bank_journal_EUR'), 200.0, 2, ttype='receipt', date=False)
+ res = self.onchange_partner_id(cr, uid, [], ref("res_partner_michal1"), ref('bank_journal_EUR'), 200.0, False, ttype='receipt', date=False)
vals = {
'account_id': ref('account.cash'),
'amount': 200.0,
@@ -240,7 +240,7 @@
!python {model: account.voucher}: |
import netsvc, time
vals = {}
- res = self.onchange_partner_id(cr, uid, [], ref("res_partner_michal1"), ref('bank_journal_USD'), 80.0, 2, ttype='receipt', date=False)
+ res = self.onchange_partner_id(cr, uid, [], ref("res_partner_michal1"), ref('bank_journal_USD'), 80.0, ref('base.USD'), ttype='receipt', date=False)
vals = {
'account_id': ref('account.cash'),
'amount': 80.0,
@@ -250,13 +250,14 @@
'partner_id': ref('res_partner_michal1'),
'period_id': ref('account.period_3'),
'type': 'receipt',
- 'date': time.strftime("%Y-04-01"),
+ 'date': time.strftime("%Y-%m-%d"),
'payment_option': 'with_writeoff',
'writeoff_acc_id': ref('account.a_expense'),
'exchange_acc_id': ref('account.o_expense'),
'comment': 'Write Off',
'name': 'Second payment',
}
+ vals.update(self.onchange_date(cr, uid, [], time.strftime('%Y-04-01'), ref('base.USD'), 80.0)['value'])
if not res['value']['line_cr_ids']:
res['value']['line_cr_ids'] = [{'type': 'cr', 'account_id': ref('account.a_recv'),}]
for item in res['value']['line_cr_ids']:
diff --git a/addons/account_voucher/test/case3_eur_eur.yml b/addons/account_voucher/test/case3_eur_eur.yml
index 374f40607bd..9ed498442fb 100644
--- a/addons/account_voucher/test/case3_eur_eur.yml
+++ b/addons/account_voucher/test/case3_eur_eur.yml
@@ -118,7 +118,7 @@
!python {model: account.voucher}: |
import netsvc, time
vals = {}
- res = self.onchange_partner_id(cr, uid, [], ref("res_partner_peter0"), ref('bank_journal_EUR'), 120.00, 2, ttype='receipt', date=False)
+ res = self.onchange_partner_id(cr, uid, [], ref("res_partner_peter0"), ref('bank_journal_EUR'), 120.00, False, ttype='receipt', date=False)
vals = {
'account_id': ref('account.cash'),
'amount': 120.00,
@@ -210,7 +210,7 @@
!python {model: account.voucher}: |
import netsvc, time
vals = {}
- res = self.onchange_partner_id(cr, uid, [], ref("res_partner_peter0"), ref('bank_journal_EUR'), 120.00, 2, ttype='receipt', date=False)
+ res = self.onchange_partner_id(cr, uid, [], ref("res_partner_peter0"), ref('bank_journal_EUR'), 120.00, False, ttype='receipt', date=False)
vals = {
'account_id': ref('account.cash'),
'amount': 120.00,
diff --git a/addons/account_voucher/test/case4_cad_chf.yml b/addons/account_voucher/test/case4_cad_chf.yml
index deaf341d1c0..557e20dec1a 100644
--- a/addons/account_voucher/test/case4_cad_chf.yml
+++ b/addons/account_voucher/test/case4_cad_chf.yml
@@ -97,7 +97,7 @@
!python {model: account.voucher}: |
import netsvc, time
vals = {}
- res = self.onchange_partner_id(cr, uid, [], ref("res_partner_john0"), ref('bank_journal_CHF'), 200.00, 2, ttype='receipt', date=False)
+ res = self.onchange_partner_id(cr, uid, [], ref("res_partner_john0"), ref('bank_journal_CHF'), 200.00, ref('base.CHF'), ttype='receipt', date=False)
vals = {
'account_id': ref('account.cash'),
'amount': 200.00,
@@ -107,13 +107,14 @@
'partner_id': ref('res_partner_john0'),
'period_id': ref('account.period_3'),
'type': 'receipt',
- 'date': time.strftime("%Y-03-01"),
+ 'date': time.strftime("%Y-%m-%d"),
'payment_option': 'with_writeoff',
'writeoff_acc_id': ref('account.a_expense'),
'exchange_acc_id': ref('account.o_expense'),
'comment': 'Write Off',
'name': 'First payment',
}
+ vals.update(self.onchange_date(cr, uid, [], time.strftime('%Y-03-01'), ref('base.CHF'), 200.0)['value'])
if not res['value']['line_cr_ids']:
res['value']['line_cr_ids'] = [{'type': 'cr', 'account_id': ref('account.a_recv'),}]
for item in res['value']['line_cr_ids']:
diff --git a/addons/account_voucher/voucher_payment_receipt_view.xml b/addons/account_voucher/voucher_payment_receipt_view.xml
index 9c8bdffb35d..2c9b2edee6e 100644
--- a/addons/account_voucher/voucher_payment_receipt_view.xml
+++ b/addons/account_voucher/voucher_payment_receipt_view.xml
@@ -74,14 +74,14 @@
diff --git a/addons/caldav/caldav_node.py b/addons/caldav/caldav_node.py
index 5272d0fc1fd..71e9bdc2468 100644
--- a/addons/caldav/caldav_node.py
+++ b/addons/caldav/caldav_node.py
@@ -324,7 +324,6 @@ class node_calendar(nodes.node_class):
uid = self.context.uid
res = self.set_data(cr, data)
-
if res and len(res):
# We arbitrarily construct only the first node of the data
# that have been imported. ICS may have had more elements,
@@ -332,6 +331,7 @@ class node_calendar(nodes.node_class):
assert isinstance(res[0], (int, long))
fnodes = fil_obj.get_calendar_objects(cr, uid, [self.calendar_id], self,
domain=[('id','=',res[0])], context=ctx)
+
if self.context.get('DAV-client','') in ('iPhone', 'iCalendar',):
# For those buggy clients, register the alias
bca_obj = fil_obj.pool.get('basic.calendar.alias')
diff --git a/addons/caldav/calendar.py b/addons/caldav/calendar.py
index a70a31bc017..94d28e4ad37 100644
--- a/addons/caldav/calendar.py
+++ b/addons/caldav/calendar.py
@@ -121,10 +121,10 @@ def str2mailto(emailstr, multi=False):
for mas in mailz:
m = mege.match(mas.strip())
if not m:
- # one of the rare non-matching strings is "sad" :(
- # retz.append({ 'name': mas.strip() })
- # continue
- raise ValueError("Invalid email address %r" % mas)
+ #one of the rare non-matching strings is "sad" :(
+ retz.append({ 'name': mas.strip() })
+ continue
+ # raise ValueError("Invalid email address %r" % mas)
rd = { 'name': m.group(1).strip(),
'email': m.group(5), }
if m.group(2):
@@ -189,6 +189,9 @@ def map_data(cr, uid, obj, context=None):
field = obj.ical_get(map_dict, 'field')
field_type = obj.ical_get(map_dict, 'type')
if field:
+ #ignore write date, this field is resered for the orm
+ if field == 'write_date':
+ continue
if field_type == 'selection':
if not map_val:
continue
@@ -299,7 +302,6 @@ class CalDAV(object):
att_data = []
exdates = []
_server_tzinfo = pytz.timezone(tools.get_server_timezone())
-
for cal_data in child.getChildren():
if cal_data.name.lower() == 'organizer':
dmail = { 'name': cal_data.params.get('CN', ['',])[0],
@@ -552,7 +554,7 @@ class CalDAV(object):
@param data_id: Get Data’s ID or False
@param context: A standard dictionary for contextual values
"""
-
+
ical_data = content
self.__attribute__ = get_attribute_mapping(cr, uid, self._calname, context)
parsedCal = vobject.readOne(ical_data)
diff --git a/addons/caldav/wizard/caldav_browse.py b/addons/caldav/wizard/caldav_browse.py
index f6ecc5dccd5..5b78c480d07 100644
--- a/addons/caldav/wizard/caldav_browse.py
+++ b/addons/caldav/wizard/caldav_browse.py
@@ -24,6 +24,7 @@ from tools import config
import base64
import addons
from tools.translate import _
+import tools
class caldav_browse(osv.osv_memory):
@@ -176,16 +177,6 @@ configuration
pref_ids = pref_obj.browse(cr, uid ,context.get('rec_id',False), context=context)
res = {}
host = context.get('host')
- port = ''
- prefix = 'http://'
- if not config.get('xmlrpc'):
- if not config.get('netrpc'):
- prefix = 'https://'
- port = config.get('xmlrpcs_port', 8071)
- else:
- port = config.get('netrpc_port',8070)
- else:
- port = config.get('xmlrpc_port',8069)
if not config.get_misc('webdav','enable',True):
raise Exception("WebDAV is disabled, cannot continue")
user_pool = self.pool.get('res.users')
@@ -195,16 +186,16 @@ configuration
if pref_ids:
pref_ids = pref_ids[0]
if pref_ids.device == 'iphone':
- url = host + ':' + str(port) + '/'+ pref_ids.service + '/' + cr.dbname + '/'+'calendars/'
+ url = host + '/'+ pref_ids.service + '/' + cr.dbname + '/'+'calendars/'
else :
- url = host + ':' + str(port) + '/'+ pref_ids.service + '/' + cr.dbname + '/'+'calendars/'+ 'users/'+ current_user.login + '/'+ pref_ids.collection.name+ '/'+ pref_ids.calendar.name
+ url = host + '/'+ pref_ids.service + '/' + cr.dbname + '/'+'calendars/'+ 'users/'+ current_user.login + '/'+ pref_ids.collection.name+ '/'+ pref_ids.calendar.name
res['description'] = self.__doc.get(pref_ids.device , self.__doc['other'])
file = open(addons.get_module_resource('caldav','doc', 'caldav_doc.pdf'),'rb')
res['caldav_doc_file'] = base64.encodestring(file.read())
#res['doc_link'] = 'http://doc.openerp.com/'
- res['url'] = prefix+url
+ res['url'] = url
return res
def browse_caldav(self, cr, uid, ids, context):
@@ -239,12 +230,8 @@ class user_preference(osv.osv_memory):
return ids[0]
def _get_default_host(self, cr, uid, context):
- ids=self.search(cr,uid,[])
- host_name = ''
- if ids:
- ids = len(ids)> 1 and len(ids)-1 or ids[0] # Use len(ids)-1 for taking the value of last id
- host_name = self.browse(cr, uid,[ids],context=context)[0].host_name
- return host_name
+
+ return self.pool.get('ir.config_parameter').get_param(cr, uid, 'web.base.url', default='http://localhost:8069', context=context)
_defaults={
'service': 'webdav',
diff --git a/addons/crm/test/test_crm_meeting.yml b/addons/crm/test/test_crm_meeting.yml
index 8d851dd58c7..1aee11463dd 100644
--- a/addons/crm/test/test_crm_meeting.yml
+++ b/addons/crm/test/test_crm_meeting.yml
@@ -42,7 +42,7 @@
and I set the fields so that the meeting will occur weekly on Monday and Friday 10 times.
-
!python {model: crm.meeting}: |
- self.write(cr, uid, [ref("crm_meeting_regardingpresentation0")], {'fr': 1, 'mo': 1, 'th': 1, 'tu': 1, 'we':1, 'count':10, 'interval': 1, 'rrule_type': 'weekly'})
+ self.write(cr, uid, [ref("crm_meeting_regardingpresentation0")], {'fr': 1, 'mo': 1, 'th': 1, 'tu': 1, 'we':1, 'count':10, 'interval': 1, 'rrule_type': 'weekly', 'recurrency' : True})
- |
I can see from the calendar view that the meeting is scheduled on Monday and Friday
diff --git a/addons/crm_profiling/__openerp__.py b/addons/crm_profiling/__openerp__.py
index 382fbcb1b28..656f8360f0b 100644
--- a/addons/crm_profiling/__openerp__.py
+++ b/addons/crm_profiling/__openerp__.py
@@ -39,7 +39,7 @@ It also has been merged with the earlier CRM & SRM segmentation tool because the
'website': 'http://www.openerp.com',
'depends': ['base', 'crm'],
'init_xml': [],
- 'update_xml': ['security/ir.model.access.csv', 'wizard/open_questionnaire_view.xml', 'crm_profiling_view.xml'],
+ 'update_xml': ['security/ir.model.access.csv', 'crm_profiling_view.xml'],
'demo_xml': ['crm_profiling_demo.xml'],
'test': ['test/test_crm_profiling.yml'],
'installable': True,
diff --git a/addons/crm_profiling/crm_profiling.py b/addons/crm_profiling/crm_profiling.py
index 17cc04bc1d9..59137966da0 100644
--- a/addons/crm_profiling/crm_profiling.py
+++ b/addons/crm_profiling/crm_profiling.py
@@ -159,19 +159,19 @@ class questionnaire(osv.osv):
_name="crm_profiling.questionnaire"
_description= "Questionnaire"
- def build_form(self, cr, uid, questionnaire_id, context=None):
+ def build_form(self, cr, uid, data, context=None):
"""
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current user’s ID for security checks,
@param data: Get Data
@param context: A standard dictionary for contextual values """
-
+
query = """
select name, id
from crm_profiling_question
where id in ( select question from profile_questionnaire_quest_rel where questionnaire = %s)"""
- res = cr.execute(query, (questionnaire_id,))
+ res = cr.execute(query, (data['form']['questionnaire_name'],))
result = cr.fetchall()
quest_fields={}
quest_form='''
@@ -180,6 +180,7 @@ class questionnaire(osv.osv):
quest_form = quest_form + '' % (oid,)
quest_fields['quest_form%d' % (oid,)] = {'string': name, 'type': 'many2one', \
'relation': 'crm_profiling.answer', 'domain': [('question_id','=',oid)] }
+ quest_form = quest_form + ''''''
return quest_form, quest_fields
_columns = {
@@ -218,16 +219,16 @@ class partner(osv.osv):
@param context: A standard dictionary for contextual values """
temp = []
- for x in context.get('fields'):
- if x.startswith("quest_form") and data[x] != 0 :
- if data[x] and data[x][0]:
- temp.append(data[x][0])
- partner_id = context.get('active_id')
+ for x in data['form']:
+ if x.startswith("quest_form") and data['form'][x] != 0 :
+ temp.append(data['form'][x])
+
query = "select answer from partner_question_rel where partner=%s"
- cr.execute(query, (partner_id,))
+ cr.execute(query, (data['id'],))
for x in cr.fetchall():
temp.append(x[0])
- self.write(cr, uid, [partner_id], {'answers_ids':[[6, 0, temp]]}, context=context)
+
+ self.write(cr, uid, [data['id']], {'answers_ids':[[6, 0, temp]]}, context=context)
return {}
diff --git a/addons/crm_profiling/crm_profiling_view.xml b/addons/crm_profiling/crm_profiling_view.xml
index a54d3d4b0a9..258de2e4e2d 100644
--- a/addons/crm_profiling/crm_profiling_view.xml
+++ b/addons/crm_profiling/crm_profiling_view.xml
@@ -2,6 +2,13 @@
+
+
Questionnaires
crm_profiling.questionnaire
@@ -133,7 +140,7 @@
diff --git a/addons/crm_profiling/crm_profiling_wizard.xml b/addons/crm_profiling/crm_profiling_wizard.xml
new file mode 100644
index 00000000000..39d436a6bd9
--- /dev/null
+++ b/addons/crm_profiling/crm_profiling_wizard.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/addons/crm_profiling/wizard/open_questionnaire.py b/addons/crm_profiling/wizard/open_questionnaire.py
index 2dc357cbc46..91b82a02d1a 100644
--- a/addons/crm_profiling/wizard/open_questionnaire.py
+++ b/addons/crm_profiling/wizard/open_questionnaire.py
@@ -18,72 +18,50 @@
# along with this program. If not, see .
#
##############################################################################
+import pooler
+import wizard
+from tools import UpdateableStr, UpdateableDict
-from osv import osv, fields
-from tools.translate import _
+_QUEST_FORM = UpdateableStr()
+_QUEST_FIELDS=UpdateableDict()
-class open_questionnaire(osv.osv_memory):
- _name = 'open.questionnaire'
- _columns = {
- 'questionnaire_id': fields.many2one('crm_profiling.questionnaire', 'Questionnaire name', required=True),
+class open_questionnaire(wizard.interface):
+
+ def _questionnaire_compute(self, cr, uid, data, context):
+ pooler.get_pool(cr.dbname).get(data['model'])._questionnaire_compute(cr, uid, data, context)
+ return {}
+
+
+ def build_form(self, cr, uid, data, context):
+ quest_form, quest_fields = pooler.get_pool(cr.dbname).get('crm_profiling.questionnaire').build_form(cr, uid, data, context)
+ _QUEST_FORM. __init__(quest_form)
+ _QUEST_FIELDS.__init__(quest_fields)
+ return{}
+
+ _questionnaire_choice_arch = '''
+ '''
+
+ _questionnaire_choice_fields = {
+ 'questionnaire_name': {'string': 'Questionnaire name', 'type': 'many2one', 'relation': 'crm_profiling.questionnaire', 'required': True },
}
- def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
- res = super(open_questionnaire, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar,submenu=False)
- if context.has_key('form') and context.has_key('fields'):
- field = {}
- form = context.get('form')
- form += """
-
-
-
-
-
-
-
-
- """
- res['fields'] = context.get('fields')
- for key, value in res['fields'].items():
- field[key] = fields.many2one('crm_profiling.answer', value['string'])
- self._columns.update(field)
- res['arch'] = form
- return res
-
-
- def questionnaire_compute(self, cr, uid, ids, context=None):
- """ Adds selected answers in partner form """
- model = context.get('active_model')
- if model == 'res.partner':
- data = self.read(cr, uid, ids, context.get('fields').keys(), context=context)[0]
- self.pool.get(model)._questionnaire_compute(cr, uid, data, context=context)
- return {'type': 'ir.actions.act_window_close'}
-
-
- def build_form(self, cr, uid, ids, context=None):
- """ Dynamically generates form according to selected questionnaire """
- models_data = self.pool.get('ir.model.data')
- questionnaire_id = self.browse(cr, uid, ids, context=context)[0].questionnaire_id.id
- quest_form, quest_fields = self.pool.get('crm_profiling.questionnaire').build_form(cr, uid, questionnaire_id, context=context)
- context.update({
- 'form': quest_form,
- 'fields': quest_fields
- })
-
- result = models_data._get_id(cr, uid, 'crm_profiling', 'view_open_questionnaire_form')
- res_id = models_data.browse(cr, uid, result, context=context).res_id
-
- return {
- 'name': _('Questionnaire'),
- 'view_type': 'form',
- 'view_mode': 'form',
- 'res_model': 'open.questionnaire',
- 'type': 'ir.actions.act_window',
- 'views': [(res_id,'form')],
- 'target': 'new',
- 'context': context
+ states = {
+ 'init': {
+ 'actions': [],
+ 'result': {'type': 'form', 'arch': _questionnaire_choice_arch, 'fields': _questionnaire_choice_fields, 'state':[('end', 'Cancel','gtk-cancel'), ('open', 'Open Questionnaire','terp-camera_test')]}
+ },
+ 'open': {
+ 'actions': [build_form],
+ 'result': {'type': 'form', 'arch':_QUEST_FORM, 'fields': _QUEST_FIELDS, 'state':[('end', 'Cancel','gtk-cancel'), ('compute', 'Save Data','terp-stock_format-scientific')]}
+ },
+ 'compute': {
+ 'actions': [],
+ 'result': {'type': 'action', 'action': _questionnaire_compute, 'state':'end'}
}
+ }
-open_questionnaire()
+open_questionnaire('open_questionnaire')
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/crm_profiling/wizard/open_questionnaire_view.xml b/addons/crm_profiling/wizard/open_questionnaire_view.xml
deleted file mode 100644
index 8c17bd3b8c4..00000000000
--- a/addons/crm_profiling/wizard/open_questionnaire_view.xml
+++ /dev/null
@@ -1,44 +0,0 @@
-
-
-
-
-
- Open Questionnaires
- open.questionnaire
- form
-
-
-
-
-
-
- Open Questionnaire
- open.questionnaire
- form
- form
- new
-
-
-
-
-
-
-
-
diff --git a/addons/document_ftp/i18n/sl.po b/addons/document_ftp/i18n/sl.po
new file mode 100644
index 00000000000..88cbc9acec0
--- /dev/null
+++ b/addons/document_ftp/i18n/sl.po
@@ -0,0 +1,137 @@
+# Slovenian 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 , 2011.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: openobject-addons\n"
+"Report-Msgid-Bugs-To: FULL NAME \n"
+"POT-Creation-Date: 2011-01-11 11:15+0000\n"
+"PO-Revision-Date: 2011-10-19 07:34+0000\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: Slovenian \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-21 04:55+0000\n"
+"X-Generator: Launchpad (build 14165)\n"
+
+#. module: document_ftp
+#: model:ir.model,name:document_ftp.model_document_ftp_configuration
+msgid "Auto Directory Configuration"
+msgstr "Avto konfiguracija map"
+
+#. module: document_ftp
+#: view:document.ftp.configuration:0
+msgid ""
+"Indicate the network address on which your OpenERP server should be "
+"reachable for end-users. This depends on your network topology and "
+"configuration, and will only affect the links displayed to the users. The "
+"format is HOST:PORT and the default host (localhost) is only suitable for "
+"access from the server machine itself.."
+msgstr ""
+
+#. module: document_ftp
+#: field:document.ftp.configuration,progress:0
+msgid "Configuration Progress"
+msgstr ""
+
+#. module: document_ftp
+#: model:ir.actions.url,name:document_ftp.action_document_browse
+msgid "Browse Files"
+msgstr "Brskanje Datoteke"
+
+#. module: document_ftp
+#: field:document.ftp.configuration,config_logo:0
+msgid "Image"
+msgstr "Slika"
+
+#. module: document_ftp
+#: field:document.ftp.configuration,host:0
+msgid "Address"
+msgstr "Naslov"
+
+#. module: document_ftp
+#: field:document.ftp.browse,url:0
+msgid "FTP Server"
+msgstr "Strežnik FTP"
+
+#. module: document_ftp
+#: model:ir.actions.act_window,name:document_ftp.action_config_auto_directory
+msgid "FTP Server Configuration"
+msgstr "Konfiguracija FTP strežnika"
+
+#. module: document_ftp
+#: model:ir.module.module,description:document_ftp.module_meta_information
+msgid ""
+"This is a support FTP Interface with document management system.\n"
+" With this module you would not only be able to access documents through "
+"OpenERP\n"
+" but you would also be able to connect with them through the file system "
+"using the\n"
+" FTP client.\n"
+msgstr ""
+
+#. module: document_ftp
+#: view:document.ftp.browse:0
+msgid "_Browse"
+msgstr "_Prebrskaj"
+
+#. module: document_ftp
+#: help:document.ftp.configuration,host:0
+msgid ""
+"Server address or IP and port to which users should connect to for DMS access"
+msgstr ""
+"Naslov strežnika ali IP in vrata, na katerega se bodo uporabniki povezali za "
+"DMS dostop"
+
+#. module: document_ftp
+#: model:ir.ui.menu,name:document_ftp.menu_document_browse
+msgid "Shared Repository (FTP)"
+msgstr ""
+
+#. module: document_ftp
+#: view:document.ftp.browse:0
+msgid "_Cancel"
+msgstr "_Prekliči"
+
+#. module: document_ftp
+#: view:document.ftp.configuration:0
+msgid "Configure FTP Server"
+msgstr "Konfiguriraj FTP strežnik"
+
+#. module: document_ftp
+#: model:ir.module.module,shortdesc:document_ftp.module_meta_information
+msgid "Integrated FTP Server with Document Management System"
+msgstr ""
+
+#. module: document_ftp
+#: view:document.ftp.configuration:0
+msgid "title"
+msgstr "naslov"
+
+#. module: document_ftp
+#: model:ir.model,name:document_ftp.model_document_ftp_browse
+msgid "Document FTP Browse"
+msgstr ""
+
+#. module: document_ftp
+#: view:document.ftp.configuration:0
+msgid "Knowledge Application Configuration"
+msgstr ""
+
+#. module: document_ftp
+#: model:ir.actions.act_window,name:document_ftp.action_ftp_browse
+msgid "Document Browse"
+msgstr ""
+
+#. module: document_ftp
+#: view:document.ftp.browse:0
+msgid "Browse Document"
+msgstr ""
+
+#. module: document_ftp
+#: view:document.ftp.configuration:0
+msgid "res_config_contents"
+msgstr "res_config_contents"
diff --git a/addons/hr_expense/hr_expense.py b/addons/hr_expense/hr_expense.py
index 2dc6ad090ac..201c70c642c 100644
--- a/addons/hr_expense/hr_expense.py
+++ b/addons/hr_expense/hr_expense.py
@@ -131,16 +131,14 @@ class hr_expense_expense(osv.osv):
wf_service = netsvc.LocalService("workflow")
mod_obj = self.pool.get('ir.model.data')
res = mod_obj.get_object_reference(cr, uid, 'account', 'invoice_supplier_form')
- res_id = res and res[1] or False,
inv_ids = []
for id in ids:
wf_service.trg_validate(uid, 'hr.expense.expense', id, 'invoice', cr)
inv_ids.append(self.browse(cr, uid, id).invoice_id.id)
return {
'name': _('Supplier Invoices'),
- 'view_type': 'form',
- 'view_mode': 'form,tree',
- 'view_id': [res_id],
+ 'view_mode': 'form',
+ 'view_id': [res[1] if res else False],
'res_model': 'account.invoice',
'context': "{'type':'out_invoice', 'journal_type': 'purchase'}",
'type': 'ir.actions.act_window',
diff --git a/addons/import_base/import_framework.py b/addons/import_base/import_framework.py
index b558b24696f..1f627d2ad58 100644
--- a/addons/import_base/import_framework.py
+++ b/addons/import_base/import_framework.py
@@ -60,7 +60,7 @@ class import_framework(Thread):
self.context = context or {}
self.email = email_to_notify
self.table_list = []
- self.logger = logging.getLogger('import_framework')
+ self.logger = logging.getLogger(module_name)
self.initialize()
"""
@@ -165,6 +165,7 @@ class import_framework(Thread):
data_i is a map external field_name => value
and each data_i have a external id => in data_id['id']
"""
+ self.logger.info(' Importing %s into %s' % (table, model))
if not datas:
return (0, 'No data found')
mapping['id'] = 'id_new'
@@ -187,8 +188,7 @@ class import_framework(Thread):
model_obj = self.obj.pool.get(model)
if not model_obj:
raise ValueError(_("%s is not a valid model name") % model)
- self.logger.debug(_("fields imported : "))
- self.logger.debug(fields)
+ self.logger.debug(_(" fields imported : ") + str(fields))
(p, r, warning, s) = model_obj.import_data(self.cr, self.uid, fields, res, mode='update', current_module=self.module_name, noupdate=True, context=self.context)
for (field, field_name) in self_dependencies:
self._import_self_dependencies(model_obj, field, datas)
@@ -330,7 +330,6 @@ class import_framework(Thread):
xml_ref = self.mapped_id_if_exist(model, domain_search, table, name)
fields.append('id')
data.append(xml_id)
-
obj.import_data(self.cr, self.uid, fields, [data], mode='update', current_module=self.module_name, noupdate=True, context=self.context)
return xml_ref or xml_id
@@ -385,7 +384,6 @@ class import_framework(Thread):
res = self._resolve_dependencies(self.get_mapping()[table].get('dependencies', []), imported)
result.extend(res)
if to_import:
- self.logger.debug(_("import : ") + table )
(position, warning) = self._import_table(table)
result.append((table, position, warning))
imported.add(table)
@@ -396,12 +394,13 @@ class import_framework(Thread):
traceback.print_exc(file=sh)
error = sh.getvalue()
print error
- finally:
- self.cr.close()
+
self.date_ended = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
self._send_notification_email(result, error)
+ self.cr.close()
+
def _resolve_dependencies(self, dep, imported):
"""
import dependencies recursively
@@ -414,7 +413,6 @@ class import_framework(Thread):
res = self._resolve_dependencies(self.get_mapping()[dependency].get('dependencies', []), imported)
result.extend(res)
if to_import:
- self.logger.debug("import dependency : " + dependency)
r = self._import_table(dependency)
(position, warning) = r
result.append((dependency, position, warning))
@@ -422,15 +420,16 @@ class import_framework(Thread):
return result
def _send_notification_email(self, result, error):
- if not self.email or not self.email[0]:
+ if not self.email:
return False
-
- tools.email_send(
- 'import@module.openerp',
- self.email,
- self.get_email_subject(result, error),
- self.get_email_body(result, error),
- )
+ email_obj = self.obj.pool.get('mail.message')
+ email_id = email_obj.create(self.cr, self.uid, {
+ 'email_from' : 'import@module.openerp',
+ 'email_to' : self.email,
+ 'body_text' : self.get_email_body(result, error),
+ 'subject' : self.get_email_subject(result, error),
+ 'auto_delete' : True})
+ email_obj.send(self.cr, self.uid, [email_id])
if error:
self.logger.error(_("Import failed due to an unexpected error"))
else:
diff --git a/addons/import_sugarcrm/import_sugarcrm.py b/addons/import_sugarcrm/import_sugarcrm.py
index b27748d48be..d5f487c5377 100644
--- a/addons/import_sugarcrm/import_sugarcrm.py
+++ b/addons/import_sugarcrm/import_sugarcrm.py
@@ -210,12 +210,12 @@ class sugar_import(import_framework):
def get_email_mapping(self):
return {
- 'model' : 'mailgate.message',
+ 'model' : 'mail.message',
'dependencies' : [self.TABLE_USER, self.TABLE_ACCOUNT, self.TABLE_CONTACT, self.TABLE_LEAD, self.TABLE_OPPORTUNITY, self.TABLE_MEETING, self.TABLE_CALL],
'hook' : self.import_email,
'map' : {
- 'name':'name',
- 'history' : const("1"),
+ 'subject':'name',
+ 'state' : const('received'),
'date':'date_sent',
'email_from': 'from_addr_name',
'email_to': 'to_addrs_names',
@@ -226,7 +226,9 @@ class sugar_import(import_framework):
'model': 'model',
'partner_id/.id': 'partner_id/.id',
'user_id/id': ref(self.TABLE_USER, 'assigned_user_id'),
- 'description': ppconcat('description', 'description_html'),
+ 'body_text': 'description',
+ 'body_html' : 'description_html',
+
}
}
@@ -575,10 +577,10 @@ class sugar_import(import_framework):
}
def get_opportunity_status(self, sugar_val):
- fields = ['name', 'type']
+ fields = ['name', 'case_default']
name = 'Opportunity_' + sugar_val['sales_stage']
- data = [sugar_val['sales_stage'], 'Opportunity']
- return self.import_object(fields, data, 'crm.case.stage', self.TABLE_STAGE, name, [('type', '=', 'opportunity'), ('name', 'ilike', sugar_val['sales_stage'])])
+ data = [sugar_val['sales_stage'], '1']
+ return self.import_object(fields, data, 'crm.case.stage', self.TABLE_STAGE, name, [('name', 'ilike', sugar_val['sales_stage'])])
def import_opportunity_contact(self, val):
sugar_opportunities_contact = set(sugar.relation_search(self.context.get('port'), self.context.get('session_id'), 'Opportunities', module_id=val.get('id'), related_module='Contacts', query=None, deleted=None))
@@ -647,11 +649,11 @@ class sugar_import(import_framework):
import lead
"""
def get_lead_status(self, sugar_val):
- fields = ['name', 'type']
+ fields = ['name', 'case_default']
name = 'lead_' + sugar_val.get('status', '')
- data = [sugar_val.get('status', ''), 'lead']
- return self.import_object(fields, data, 'crm.case.stage', self.TABLE_STAGE, name, [('type', '=', 'lead'), ('name', 'ilike', sugar_val.get('status', ''))])
-
+ data = [sugar_val.get('status', ''), '1']
+ return self.import_object(fields, data, 'crm.case.stage', self.TABLE_STAGE, name, [('name', 'ilike', sugar_val.get('status', ''))])
+
lead_state = {
'New' : 'draft',
'Assigned':'open',
@@ -1085,7 +1087,7 @@ class import_sugarcrm(osv.osv):
scheduler Method
"""
context = {'username': args[4], 'password': args[5], 'url': args[3], 'instance_name': args[3]}
- imp = sugar_import(self, cr, uid, args[2], "import_sugarcrm", [args[1]], context)
+ imp = sugar_import(self, cr, uid, args[2], "import_sugarcrm", args[1], context)
imp.set_table_list(args[0])
imp.start()
return True
@@ -1129,7 +1131,7 @@ class import_sugarcrm(osv.osv):
raise osv.except_osv(_('Error !!'), _("%s data required %s Module to be installed, Please install %s module") %(keys,module,module))
url = self.parse_valid_url(context)
context.update({'url': url})
- imp = sugar_import(self, cr, uid, context.get('instance_name'), "import_sugarcrm", [context.get('email_user')], context)
+ imp = sugar_import(self, cr, uid, context.get('instance_name'), "import_sugarcrm", context.get('email_user'), context)
imp.set_table_list(keys)
imp.start()
obj_model = self.pool.get('ir.model.data')
diff --git a/addons/import_sugarcrm/sugar.py b/addons/import_sugarcrm/sugar.py
index 783878723e9..4ce5e0048ea 100644
--- a/addons/import_sugarcrm/sugar.py
+++ b/addons/import_sugarcrm/sugar.py
@@ -32,13 +32,21 @@ import import_sugarcrm
import logging
+import sys
+
+
+debug = False
+
class LoginError(Exception): pass
def login(username, password, url):
setURL(url)
loc = sugarsoapLocator()
- portType = loc.getsugarsoapPortType(url)
+ if debug:
+ portType = loc.getsugarsoapPortType(url, tracefile=sys.stdout)
+ else:
+ portType = loc.getsugarsoapPortType(url)
request = loginRequest()
uauth = ns0.user_auth_Def(request)
request._user_auth = uauth
diff --git a/addons/point_of_sale/wizard/pos_payment_report_date.py b/addons/point_of_sale/wizard/pos_payment_report_date.py
index e498eef6697..f97391c7f7d 100644
--- a/addons/point_of_sale/wizard/pos_payment_report_date.py
+++ b/addons/point_of_sale/wizard/pos_payment_report_date.py
@@ -55,7 +55,7 @@ class pos_payment_report_date(osv.osv_memory):
_columns = {
'date_start': fields.date('Start Date', required=True),
'date_end': fields.date('End Date', required=True),
- 'user_id': fields.many2many('res.users', 'res_user_sale', 'user_id', 'sale_id', 'Salesman')
+ 'user_id': fields.many2many('res.users', 'res_user_sale_date', 'user_id', 'sale_id', 'Salesman')
}
_defaults = {
'date_start': lambda *a: time.strftime('%Y-%m-%d'),
diff --git a/addons/project/project_view.xml b/addons/project/project_view.xml
index f8eec371d48..94724993a9d 100644
--- a/addons/project/project_view.xml
+++ b/addons/project/project_view.xml
@@ -321,6 +321,10 @@
kanban
+
+
+
+
diff --git a/addons/project_caldav/project_caldav.py b/addons/project_caldav/project_caldav.py
index ada89d35e69..782f167d69b 100644
--- a/addons/project_caldav/project_caldav.py
+++ b/addons/project_caldav/project_caldav.py
@@ -28,7 +28,7 @@ from project.project import task as base_project_task
class project_task(osv.osv):
_name = "project.task"
- _inherit = ["calendar.todo", "project.task"]
+ _inherit = ["project.task", "calendar.todo"]
_columns = {
# force inherit from project.project_task so that
# calendar.todo.active is masked oute
@@ -42,11 +42,11 @@ class project_task(osv.osv):
help='If the task is created the state is \'Draft\'.\n If the task is started, the state becomes \'In Progress\'.\n If review is needed the task is in \'Pending\' state.\
\n If the task is over, the states is set to \'Done\'.'),
}
+
_defaults = {
'state': 'draft',
}
-
def open_task(self, cr, uid, ids, context=None):
"""
Open Task Form for Project Task.
@@ -109,6 +109,8 @@ class project_task(osv.osv):
self.write(cr, uid, [exists], val)
ids.append(exists)
else:
+ #set user_id with id, needed later
+ val.update({'user_id' : uid})
task_id = self.create(cr, uid, val)
ids.append(task_id)
return ids
diff --git a/addons/project_caldav/project_caldav_view.xml b/addons/project_caldav/project_caldav_view.xml
index d27a4474fc9..0d566be4619 100644
--- a/addons/project_caldav/project_caldav_view.xml
+++ b/addons/project_caldav/project_caldav_view.xml
@@ -65,9 +65,9 @@
form
-
-
+
+
+
@@ -79,46 +79,57 @@
form
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
-
-
+
+
-
+
+
-
+
-
-
+
+
-
-
-
-
-
-
+
+
+
+
diff --git a/addons/project_issue/project_issue_view.xml b/addons/project_issue/project_issue_view.xml
index 916c67b15d4..00e6a00c163 100644
--- a/addons/project_issue/project_issue_view.xml
+++ b/addons/project_issue/project_issue_view.xml
@@ -188,7 +188,7 @@
-
+
diff --git a/addons/stock/stock_view.xml b/addons/stock/stock_view.xml
index 8b96a613f6d..6452960c2cd 100644
--- a/addons/stock/stock_view.xml
+++ b/addons/stock/stock_view.xml
@@ -1384,7 +1384,6 @@