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 @@
- - + + - + - + - + @@ -122,6 +122,8 @@ + + @@ -137,15 +139,15 @@ - - + + - + @@ -186,12 +188,14 @@ - + + - + + + + - + - - - - + + + + @@ -279,19 +284,19 @@ - + + on_change="onchange_amount(amount, payment_rate, partner_id, journal_id, currency_id, type, date, context)"/> - + @@ -303,7 +308,7 @@ - + - + @@ -332,13 +337,15 @@ + + + + + + - - @@ -347,10 +354,12 @@ domain="[('type','=','other')]"/> + - - - + + + diff --git a/addons/account_voucher/voucher_sales_purchase_view.xml b/addons/account_voucher/voucher_sales_purchase_view.xml index 170f8fbcfe0..db21b4ce86a 100644 --- a/addons/account_voucher/voucher_sales_purchase_view.xml +++ b/addons/account_voucher/voucher_sales_purchase_view.xml @@ -82,9 +82,9 @@ - - - + + + @@ -209,9 +209,9 @@ - - - + + + diff --git a/addons/base_calendar/base_calendar.py b/addons/base_calendar/base_calendar.py index fc349337b5d..45624a280f1 100644 --- a/addons/base_calendar/base_calendar.py +++ b/addons/base_calendar/base_calendar.py @@ -995,15 +995,24 @@ class calendar_event(osv.osv): """ result = {} + if not isinstance(ids, list): + ids = [ids] + for datas in self.read(cr, uid, ids, ['id','byday','recurrency', 'month_list','end_date', 'rrule_type', 'select1', 'interval', 'count', 'end_type', 'mo', 'tu', 'we', 'th', 'fr', 'sa', 'su', 'exrule', 'day', 'week_list' ], context=context): 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')) - result[event] = self.compute_rule_string(datas) + if datas['recurrency']: + result[event] = self.compute_rule_string(datas) + else: + result[event] = "" return result - + + + + _columns = { 'id': fields.integer('ID', readonly=True), 'sequence': fields.integer('Sequence'), @@ -1072,6 +1081,7 @@ rule or repeating pattern of time to exclude from the recurring rule."), 'recurrency': fields.boolean('Recurrent', help="Recurrent Meeting"), 'edit_all': fields.boolean('Edit All', help="Edit all Occurrences of recurrent Meeting."), } + def default_organizer(self, cr, uid, context=None): user_pool = self.pool.get('res.users') user = user_pool.browse(cr, uid, uid, context=context) @@ -1177,7 +1187,6 @@ rule or repeating pattern of time to exclude from the recurring rule."), @param self: the object pointer @param datas: dictionary of freq and interval value. """ - def get_week_string(freq, datas): weekdays = ['mo', 'tu', 'we', 'th', 'fr', 'sa', 'su'] if freq == 'weekly': @@ -1211,9 +1220,88 @@ rule or repeating pattern of time to exclude from the recurring rule."), interval_srting = datas.get('interval') and (';INTERVAL=' + str(datas.get('interval'))) or '' return 'FREQ=' + freq.upper() + get_week_string(freq, datas) + interval_srting + get_end_date(datas) + get_month_string(freq, datas) + + def _get_empty_rrule_data(self): + return { + 'byday' : False, + 'recurrency' : False, + 'end_date' : False, + 'rrule_type' : False, + 'select1' : False, + 'interval' : 0, + 'count' : False, + 'end_type' : False, + 'mo' : False, + 'tu' : False, + 'we' : False, + 'th' : False, + 'fr' : False, + 'sa' : False, + 'su' : False, + 'exrule' : False, + 'day' : False, + 'week_list' : False + } + + def _write_rrule(self, cr, uid, ids, field_value, rule_date=False, context=None): + data = self._get_empty_rrule_data() + + if field_value: + data['recurrency'] = True + for event in self.browse(cr, uid, ids, context=context): + rdate = rule_date or event.date + update_data = self._parse_rrule(field_value, dict(data), rdate) + data.update(update_data) + #parse_rrule + self.write(cr, uid, event.id, data, context=context) + + + def _parse_rrule(self, rule, data, date_start): + day_list = ['mo', 'tu', 'we', 'th', 'fr', 'sa', 'su'] + rrule_type = ['yearly', 'monthly', 'weekly', 'daily'] + r = rrule.rrulestr(rule, dtstart=datetime.strptime(date_start, "%Y-%m-%d %H:%M:%S")) + + if r._freq > 0 and r._freq < 4: + data['rrule_type'] = rrule_type[r._freq] + + data['count'] = r._count + data['interval'] = r._interval + data['end_date'] = r._until and r._until.strftime("%Y-%m-%d %H:%M:%S") + #repeat weekly + if r._byweekday: + for i in xrange(0,7): + if i in r._byweekday: + data[day_list[i]] = True + data['rrule_type'] = 'weekly' + #repeat monthly bynweekday ((weekday, weeknumber), ) + if r._bynweekday: + data['week_list'] = day_list[r._bynweekday[0][0]].upper() + data['byday'] = r._bynweekday[0][1] + data['select1'] = 'day' + data['rrule_type'] = 'monthly' + + if r._bymonthday: + data['day'] = r._bymonthday[0] + data['select1'] = 'date' + data['rrule_type'] = 'monthly' + + #yearly but for openerp it's monthly, take same information as monthly but interval is 12 times + if r._bymonth: + data['interval'] = data['interval'] * 12 + + #FIXEME handle forever case + #end of recurrence + #in case of repeat for ever that we do not support right now + if not (data.get('count') or data.get('end_date')): + data['count'] = 100 + if data.get('count'): + data['end_type'] = 'count' + else: + data['end_type'] = 'end_date' + return data def remove_virtual_id(self, ids): - if isinstance(ids, (str, int)): + if isinstance(ids, (str, int, long)): return base_calendar_id2real_id(ids) if isinstance(ids, (list, tuple)): @@ -1243,7 +1331,6 @@ rule or repeating pattern of time to exclude from the recurring rule."), if until_date: continue until_date = arg[2] - res = super(calendar_event, self).search(cr, uid, args_without_date, \ 0, 0, order, context, count=False) res = self.get_recurrent_ids(cr, uid, res, start_date, until_date, limit, context=context) @@ -1289,6 +1376,9 @@ rule or repeating pattern of time to exclude from the recurring rule."), select = [ids] else: select = ids + + + new_ids = [] res = False for event_id in select: @@ -1339,6 +1429,13 @@ rule or repeating pattern of time to exclude from the recurring rule."), context=context) vals.update(updated_vals.get('value', {})) if new_ids: + if 'rrule' in vals.keys(): + if 'date' in vals.keys(): + date_to_write = vals['date'] + else: + date_to_write = False + self._write_rrule(cr, uid, new_ids, vals['rrule'], date_to_write, context) + res = super(calendar_event, self).write(cr, uid, new_ids, vals, context=context) if ('alarm_id' in vals or 'base_calendar_alarm_id' in vals)\ @@ -1465,6 +1562,11 @@ rule or repeating pattern of time to exclude from the recurring rule."), if vals.get('vtimezone', '') and vals.get('vtimezone', '').startswith('/freeassociation.sourceforge.net/tzfile/'): vals['vtimezone'] = vals['vtimezone'][40:] + + if 'date' in vals and 'rrule' in vals and vals['rrule']: + update_datas = self._parse_rrule(vals['rrule'], self._get_empty_rrule_data(), vals['date']) + update_datas['recurrency'] = True + vals.update(update_datas) updated_vals = self.onchange_dates(cr, uid, [], vals.get('date', False), diff --git a/addons/base_calendar/test/base_calendar_test.yml b/addons/base_calendar/test/base_calendar_test.yml index 5512839e635..e9a0f21e26e 100644 --- a/addons/base_calendar/test/base_calendar_test.yml +++ b/addons/base_calendar/test/base_calendar_test.yml @@ -15,7 +15,7 @@ Now I will set recurrence for this event to occur monday and friday of week - !python {model: calendar.event}: | - data = {'fr': 1, 'mo': 1, 'interval': 1, 'rrule_type': 'weekly', 'end_type': 'end_date', 'end_date': '2011-05-31 00:00:00'} + data = {'fr': 1, 'mo': 1, 'interval': 1, 'rrule_type': 'weekly', 'end_type': 'end_date', 'end_date': '2011-05-31 00:00:00', 'recurrency' : True} self.write(cr, uid, [ref("calendar_event_technicalpresentation0")], data) - | In order to check that recurrent events are views successfully in calendar view, diff --git a/addons/base_contact/base_contact.py b/addons/base_contact/base_contact.py index cf0bc610be8..9a4b0eace6b 100644 --- a/addons/base_contact/base_contact.py +++ b/addons/base_contact/base_contact.py @@ -143,6 +143,17 @@ class res_partner_address(osv.osv): res.append((r['id'], addr.strip() or '/')) return res + def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=100): + if not args: + args=[] + ids = self.search(cr, user, [('name',operator,name)] + args, limit=limit, context=context) + jobs = self.pool.get('res.partner.job') + if name: + job_ids = jobs.search(cr, user, [('contact_id', operator, name)] + args, limit=limit, context=context) + for job in jobs.browse(cr, user, job_ids): + ids += [job.address_id.id] + return self.name_get(cr, user, ids, context) + _name = 'res.partner.address' _inherit = 'res.partner.address' _description ='Partner Address' diff --git a/addons/board/board_data_home.xml b/addons/board/board_data_home.xml index 829aa0a816d..0c360589a92 100644 --- a/addons/board/board_data_home.xml +++ b/addons/board/board_data_home.xml @@ -53,6 +53,16 @@ +
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/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/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 @@