diff --git a/README.md b/README.md index d76976405b3..d5570e7a028 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Build Status](http://runbot.odoo.com/runbot/badge/default/1/master.svg)](http://runbot.odoo.com/runbot) +[![Build Status](http://runbot.odoo.com/runbot/badge/default/1/8.0.svg)](http://runbot.odoo.com/runbot) Odoo ---- diff --git a/addons/account/__init__.py b/addons/account/__init__.py index bc27e14380c..3d6f6061a72 100644 --- a/addons/account/__init__.py +++ b/addons/account/__init__.py @@ -22,7 +22,6 @@ import partner import account import installer -import project import account_invoice import account_bank_statement import account_bank diff --git a/addons/account/__openerp__.py b/addons/account/__openerp__.py index b5aa1cbb20d..42cb8c89c73 100644 --- a/addons/account/__openerp__.py +++ b/addons/account/__openerp__.py @@ -97,24 +97,16 @@ for a particular financial year and for preparation of vouchers there is a modul 'wizard/account_automatic_reconcile_view.xml', 'wizard/account_financial_report_view.xml', 'wizard/pos_box.xml', - 'project/wizard/project_account_analytic_line_view.xml', 'account_end_fy.xml', 'account_invoice_view.xml', 'data/account_data.xml', 'data/data_account_type.xml', 'data/configurable_account_chart.xml', 'account_invoice_workflow.xml', - 'project/project_view.xml', - 'project/project_report.xml', - 'project/wizard/account_analytic_balance_report_view.xml', - 'project/wizard/account_analytic_cost_ledger_view.xml', - 'project/wizard/account_analytic_inverted_balance_report.xml', - 'project/wizard/account_analytic_journal_report_view.xml', - 'project/wizard/account_analytic_cost_ledger_for_journal_report_view.xml', - 'project/wizard/account_analytic_chart_view.xml', 'partner_view.xml', 'product_view.xml', 'account_assert_test.xml', + 'account_analytic_view.xml', 'ir_sequence_view.xml', 'company_view.xml', 'edi/invoice_action_data.xml', @@ -135,11 +127,6 @@ for a particular financial year and for preparation of vouchers there is a modul 'views/report_partnerledgerother.xml', 'views/report_financial.xml', 'views/report_generalledger.xml', - 'project/views/report_analyticbalance.xml', - 'project/views/report_analyticjournal.xml', - 'project/views/report_analyticcostledgerquantity.xml', - 'project/views/report_analyticcostledger.xml', - 'project/views/report_invertedanalyticbalance.xml', 'views/account.xml', ], 'qweb' : [ @@ -149,8 +136,6 @@ for a particular financial year and for preparation of vouchers there is a modul ], 'demo': [ 'demo/account_demo.xml', - 'project/project_demo.xml', - 'project/analytic_account_demo.xml', 'demo/account_minimal.xml', 'demo/account_invoice_demo.xml', 'demo/account_bank_statement.xml', diff --git a/addons/account/account.py b/addons/account/account.py index 1aa3d490f15..19576d1cf98 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -669,7 +669,7 @@ class account_account(osv.osv): # For legal reason (forbiden to modify journal entries which belongs to a closed fy or period), Forbid to modify # the code of an account if journal entries have been already posted on this account. This cannot be simply - # 'configurable' since it can lead to a lack of confidence in OpenERP and this is what we want to change. + # 'configurable' since it can lead to a lack of confidence in Odoo and this is what we want to change. def _check_allow_code_change(self, cr, uid, ids, context=None): line_obj = self.pool.get('account.move.line') for account in self.browse(cr, uid, ids, context=context): @@ -738,6 +738,7 @@ class account_journal(osv.osv): 'loss_account_id' : fields.many2one('account.account', 'Loss Account'), 'internal_account_id' : fields.many2one('account.account', 'Internal Transfers Account', select=1), 'cash_control' : fields.boolean('Cash Control', help='If you want the journal should be control at opening/closing, check this option'), + 'analytic_journal_id':fields.many2one('account.analytic.journal','Analytic Journal', help="Journal for analytic entries"), } _defaults = { @@ -2488,7 +2489,7 @@ class account_account_template(osv.osv): ('other','Regular'), ('closed','Closed'), ], 'Internal Type', required=True,help="This type is used to differentiate types with "\ - "special effects in OpenERP: view can not have entries, consolidation are accounts that "\ + "special effects in Odoo: view can not have entries, consolidation are accounts that "\ "can have children accounts for multi-company consolidations, payable/receivable are for "\ "partners accounts (for debit/credit computations), closed for depreciated accounts."), 'user_type': fields.many2one('account.account.type', 'Account Type', required=True, diff --git a/addons/account/account_analytic_line.py b/addons/account/account_analytic_line.py index d5ec3496d92..641cd5995c7 100644 --- a/addons/account/account_analytic_line.py +++ b/addons/account/account_analytic_line.py @@ -29,13 +29,14 @@ class account_analytic_line(osv.osv): _columns = { 'product_uom_id': fields.many2one('product.uom', 'Unit of Measure'), 'product_id': fields.many2one('product.product', 'Product'), - 'general_account_id': fields.many2one('account.account', 'General Account', required=True, ondelete='restrict'), + 'general_account_id': fields.many2one('account.account', 'Financial Account', required=True, ondelete='restrict'), 'move_id': fields.many2one('account.move.line', 'Move Line', ondelete='cascade', select=True), 'journal_id': fields.many2one('account.analytic.journal', 'Analytic Journal', required=True, ondelete='restrict', select=True), 'code': fields.char('Code', size=8), 'ref': fields.char('Ref.'), 'currency_id': fields.related('move_id', 'currency_id', type='many2one', relation='res.currency', string='Account Currency', store=True, help="The related account currency if not equal to the company one.", readonly=True), 'amount_currency': fields.related('move_id', 'amount_currency', type='float', string='Amount Currency', store=True, help="The amount expressed in the related account currency if not equal to the company one.", readonly=True), + 'partner_id': fields.related('account_id', 'partner_id', type='many2one', relation='res.partner', string='Partner', store=True), } _defaults = { @@ -74,13 +75,19 @@ class account_analytic_line(osv.osv): product_obj = self.pool.get('product.product') analytic_journal_obj =self.pool.get('account.analytic.journal') product_price_type_obj = self.pool.get('product.price.type') + product_uom_obj = self.pool.get('product.uom') j_id = analytic_journal_obj.browse(cr, uid, journal_id, context=context) prod = product_obj.browse(cr, uid, prod_id, context=context) result = 0.0 if prod_id: - unit = prod.uom_id.id + unit_obj = False + if unit: + unit_obj = product_uom_obj.browse(cr, uid, unit, context=context) + if not unit_obj or prod.uom_id.category_id.id != unit_obj.category_id.id: + unit = prod.uom_id.id if j_id.type == 'purchase': - unit = prod.uom_po_id.id + if not unit_obj or prod.uom_po_id.category_id.id != unit_obj.category_id.id: + unit = prod.uom_po_id.id if j_id.type <> 'sale': a = prod.property_account_expense.id if not a: diff --git a/addons/account/account_analytic_view.xml b/addons/account/account_analytic_view.xml new file mode 100644 index 00000000000..c73e0cbfd73 --- /dev/null +++ b/addons/account/account_analytic_view.xml @@ -0,0 +1,127 @@ + + + + + account.analytic.line.form.inherit.account + account.analytic.line + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + account.analytic.line.tree.inherit.account + account.analytic.line + + + + + + + + + + + + + + + + + + + + + + + + account.analytic.line.select.inherit.account + account.analytic.line + + + + + + + + + + + + + + + + + + + + + + + + + + account.journal.form.1 + account.journal + + + + + + + + + + + + + + + + diff --git a/addons/account/account_bank_statement.py b/addons/account/account_bank_statement.py index 65dae8a2cc1..4d9c3f3efbd 100644 --- a/addons/account/account_bank_statement.py +++ b/addons/account/account_bank_statement.py @@ -326,16 +326,26 @@ class account_bank_statement(osv.osv): or (not st.journal_id.default_debit_account_id): raise osv.except_osv(_('Configuration Error!'), _('Please verify that an account is defined in the journal.')) for line in st.move_line_ids: - if line.state <> 'valid': + if line.state != 'valid': raise osv.except_osv(_('Error!'), _('The account entries lines are not in valid state.')) move_ids = [] for st_line in st.line_ids: if not st_line.amount: continue - if not st_line.journal_entry_id.id: + if st_line.account_id and not st_line.journal_entry_id.id: + #make an account move as before + vals = { + 'debit': st_line.amount < 0 and -st_line.amount or 0.0, + 'credit': st_line.amount > 0 and st_line.amount or 0.0, + 'account_id': st_line.account_id.id, + 'name': st_line.name + } + self.pool.get('account.bank.statement.line').process_reconciliation(cr, uid, st_line.id, [vals], context=context) + elif not st_line.journal_entry_id.id: raise osv.except_osv(_('Error!'), _('All the account entries lines must be processed in order to close the statement.')) move_ids.append(st_line.journal_entry_id.id) - self.pool.get('account.move').post(cr, uid, move_ids, context=context) + if move_ids: + self.pool.get('account.move').post(cr, uid, move_ids, context=context) self.message_post(cr, uid, [st.id], body=_('Statement %s confirmed, journal items were created.') % (st.name,), context=context) self.link_bank_to_partner(cr, uid, ids, context=context) return self.write(cr, uid, ids, {'state': 'confirm'}, context=context) @@ -728,7 +738,12 @@ class account_bank_statement_line(osv.osv): move_id = am_obj.create(cr, uid, move_vals, context=context) # Create the move line for the statement line - amount = currency_obj.compute(cr, uid, st_line.statement_id.currency.id, company_currency.id, st_line.amount, context=context) + if st_line.statement_id.currency.id != company_currency.id: + ctx = context.copy() + ctx['date'] = st_line.date + amount = currency_obj.compute(cr, uid, st_line.statement_id.currency.id, company_currency.id, st_line.amount_currency, context=ctx) + else: + amount = st_line.amount bank_st_move_vals = bs_obj._prepare_bank_move_line(cr, uid, st_line, move_id, amount, company_currency.id, context=context) aml_obj.create(cr, uid, bank_st_move_vals, context=context) # Complete the dicts @@ -805,18 +820,19 @@ class account_bank_statement_line(osv.osv): _description = "Bank Statement Line" _inherit = ['ir.needaction_mixin'] _columns = { - 'name': fields.char('Description', required=True, copy=False), - 'date': fields.date('Date', required=True, copy=False), + 'name': fields.char('Description', required=True), + 'date': fields.date('Date', required=True), 'amount': fields.float('Amount', digits_compute=dp.get_precision('Account')), 'partner_id': fields.many2one('res.partner', 'Partner'), 'bank_account_id': fields.many2one('res.partner.bank','Bank Account'), + 'account_id': fields.many2one('account.account', 'Account', help="This technical field can be used at the statement line creation/import time in order to avoid the reconciliation process on it later on. The statement line will simply create a counterpart on this account"), 'statement_id': fields.many2one('account.bank.statement', 'Statement', select=True, required=True, ondelete='cascade'), 'journal_id': fields.related('statement_id', 'journal_id', type='many2one', relation='account.journal', string='Journal', store=True, readonly=True), 'ref': fields.char('Structured Communication'), 'note': fields.text('Notes'), 'sequence': fields.integer('Sequence', select=True, help="Gives the sequence order when displaying a list of bank statement lines."), 'company_id': fields.related('statement_id', 'company_id', type='many2one', relation='res.company', string='Company', store=True, readonly=True), - 'journal_entry_id': fields.many2one('account.move', 'Journal Entry'), + 'journal_entry_id': fields.many2one('account.move', 'Journal Entry', copy=False), 'amount_currency': fields.float('Amount Currency', help="The amount expressed in an optional other currency if it is a multi-currency entry.", digits_compute=dp.get_precision('Account')), 'currency_id': fields.many2one('res.currency', 'Currency', help="The optional other currency if it is a multi-currency entry."), } diff --git a/addons/account/account_bank_view.xml b/addons/account/account_bank_view.xml index ef793a1bef5..426309e0c34 100644 --- a/addons/account/account_bank_view.xml +++ b/addons/account/account_bank_view.xml @@ -47,7 +47,7 @@ Configure your company's bank account and select those that must appear on the report footer.

- If you use the accounting application of OpenERP, journals and + If you use the accounting application of Odoo, journals and accounts will be created automatically based on these data.

diff --git a/addons/account/account_invoice.py b/addons/account/account_invoice.py index f9e9ff2813d..a8be8375044 100644 --- a/addons/account/account_invoice.py +++ b/addons/account/account_invoice.py @@ -379,7 +379,7 @@ class account_invoice(models.Model): assert len(self) == 1, 'This option should only be used for a single id at a time.' template = self.env.ref('account.email_template_edi_invoice', False) compose_form = self.env.ref('mail.email_compose_message_wizard_form', False) - ctx = dict(self._context, + ctx = dict( default_model='account.invoice', default_res_id=self.id, default_use_template=bool(template), @@ -793,7 +793,10 @@ class account_invoice(models.Model): continue ctx = dict(self._context, lang=inv.partner_id.lang) - date_invoice = inv.date_invoice or fields.Date.context_today(self) + + if not inv.date_invoice: + inv.with_context(ctx).write({'date_invoice': fields.Date.context_today(self)}) + date_invoice = inv.date_invoice company_currency = inv.company_id.currency_id # create the analytical lines, one move line per invoice line @@ -906,7 +909,6 @@ class account_invoice(models.Model): move = account_move.with_context(ctx).create(move_vals) # make the invoice point to that move vals = { - 'date_invoice': date_invoice, 'move_id': move.id, 'period_id': period.id, 'move_name': move.name, @@ -1005,15 +1007,18 @@ class account_invoice(models.Model): #TODO: implement messages system return True - @api.one - def _compute_display_name(self): + @api.multi + def name_get(self): TYPES = { 'out_invoice': _('Invoice'), 'in_invoice': _('Supplier Invoice'), 'out_refund': _('Refund'), 'in_refund': _('Supplier Refund'), } - self.display_name = "%s %s" % (self.number or TYPES[self.type], self.name or '') + result = [] + for inv in self: + result.append((inv.id, "%s %s" % (inv.number or TYPES[inv.type], inv.name or ''))) + return result @api.model def name_search(self, name, args=None, operator='ilike', limit=100): @@ -1627,8 +1632,8 @@ class mail_compose_message(models.Model): context.get('default_res_id') and context.get('mark_invoice_as_sent'): invoice = self.env['account.invoice'].browse(context['default_res_id']) invoice = invoice.with_context(mail_post_autofollow=True) - self.write({'sent': True}) - self.message_post(body=_("Invoice sent")) + invoice.write({'sent': True}) + invoice.message_post(body=_("Invoice sent")) return super(mail_compose_message, self).send_mail() # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/account/account_invoice_view.xml b/addons/account/account_invoice_view.xml index 64159dab18d..93dd7bf2e41 100644 --- a/addons/account/account_invoice_view.xml +++ b/addons/account/account_invoice_view.xml @@ -61,7 +61,7 @@ - + @@ -95,7 +95,7 @@ - + @@ -201,7 +201,7 @@ domain="[('company_id', '=', parent.company_id), ('journal_id', '=', parent.journal_id), ('type', '=', 'other')]" on_change="onchange_account_id(product_id, parent.partner_id, parent.type, parent.fiscal_position,account_id)"/> + domain="[('type','!=','view'), ('company_id', '=', parent.company_id), ('state','not in',('close','cancelled'))]"/> @@ -358,7 +358,7 @@ domain="[('company_id', '=', parent.company_id), ('journal_id', '=', parent.journal_id), ('type', '=', 'other')]" on_change="onchange_account_id(product_id, parent.partner_id, parent.type, parent.fiscal_position,account_id)"/> + domain="[('type','!=','view'), ('company_id', '=', parent.company_id), ('state','not in',('close','cancelled'))]"/> @@ -523,7 +523,7 @@

Click to create a customer invoice.

- OpenERP's electronic invoicing allows to ease and fasten the + Odoo's electronic invoicing allows to ease and fasten the collection of customer payments. Your customer receives the invoice by email and he can pay online and/or import it in his own system. @@ -564,7 +564,7 @@ Click to record a new supplier invoice.

You can control the invoice from your supplier according to - what you purchased or received. OpenERP can also generate + what you purchased or received. Odoo can also generate draft invoices automatically from purchase orders or receipts.

diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py index 776111613ec..c513261a9cf 100644 --- a/addons/account/account_move_line.py +++ b/addons/account/account_move_line.py @@ -583,7 +583,7 @@ class account_move_line(osv.osv): def _check_no_view(self, cr, uid, ids, context=None): lines = self.browse(cr, uid, ids, context=context) for l in lines: - if l.account_id.type == 'view': + if l.account_id.type in ('view', 'consolidation'): return False return True @@ -635,7 +635,7 @@ class account_move_line(osv.osv): return True _constraints = [ - (_check_no_view, 'You cannot create journal items on an account of type view.', ['account_id']), + (_check_no_view, 'You cannot create journal items on an account of type view or consolidation.', ['account_id']), (_check_no_closed, 'You cannot create journal items on closed account.', ['account_id']), (_check_company_id, 'Account and Period must belong to the same company.', ['company_id']), (_check_date, 'The date of your Journal Entry is not in the defined period! You should change the date or remove this constraint from the journal.', ['date']), @@ -1038,6 +1038,8 @@ class account_move_line(osv.osv): all_moves = list(set(all_moves) - set(move_ids)) if unlink_ids: if opening_reconciliation: + raise osv.except_osv(_('Warning!'), + _('Opening Entries have already been generated. Please run "Cancel Closing Entries" wizard to cancel those entries and then run this wizard.')) obj_move_rec.write(cr, uid, unlink_ids, {'opening_reconciliation': False}) obj_move_rec.unlink(cr, uid, unlink_ids) if len(all_moves) >= 2: diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index d11fa30726c..47f21266c18 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -650,7 +650,7 @@ occurring over a given period of time on a bank account. You should receive this periodicaly from your bank.

- OpenERP allows you to reconcile a statement line directly with + Odoo allows you to reconcile a statement line directly with the related sale or puchase invoices.

@@ -920,7 +920,7 @@ Click to define a new tax code.

Depending on the country, a tax code is usually a cell to fill - in your legal tax statement. OpenERP allows you to define the + in your legal tax statement. Odoo allows you to define the tax structure and each tax computation will be registered in one or several tax code.

@@ -1269,8 +1269,8 @@ Select the period and the journal you want to fill.

This view can be used by accountants in order to quickly record - entries in OpenERP. If you want to record a supplier invoice, - start by recording the line of the expense account. OpenERP + entries in Odoo. If you want to record a supplier invoice, + start by recording the line of the expense account. Odoo will propose to you automatically the Tax related to this account and the counterpart "Account Payable".

@@ -1506,7 +1506,7 @@ A journal entry consists of several journal items, each of which is either a debit or a credit transaction.

- OpenERP automatically creates one journal entry per accounting + Odoo automatically creates one journal entry per accounting document: invoice, refund, supplier payment, bank statements, etc. So, you should record journal entries manually only/mainly for miscellaneous operations. @@ -1925,7 +1925,7 @@ - + diff --git a/addons/account/demo/account_minimal.xml b/addons/account/demo/account_minimal.xml index 3940c1e5357..54ced4602c8 100644 --- a/addons/account/demo/account_minimal.xml +++ b/addons/account/demo/account_minimal.xml @@ -315,7 +315,7 @@ - + @@ -325,7 +325,7 @@ - + @@ -357,7 +357,7 @@ - + @@ -367,7 +367,7 @@ - + @@ -381,13 +381,13 @@ - + @@ -395,7 +395,7 @@ TMIS general - + diff --git a/addons/account/partner.py b/addons/account/partner.py index 8c47967b44c..9c8220cbb9c 100644 --- a/addons/account/partner.py +++ b/addons/account/partner.py @@ -22,6 +22,7 @@ from operator import itemgetter import time +from openerp import SUPERUSER_ID from openerp.osv import fields, osv from openerp import api @@ -222,8 +223,9 @@ class res_partner(osv.osv): result = {} account_invoice_report = self.pool.get('account.invoice.report') for partner in self.browse(cr, uid, ids, context=context): - invoice_ids = account_invoice_report.search(cr, uid, [('partner_id','child_of',partner.id)], context=context) - invoices = account_invoice_report.browse(cr, uid, invoice_ids, context=context) + domain = [('partner_id', 'child_of', partner.id)] + invoice_ids = account_invoice_report.search(cr, SUPERUSER_ID, domain, context=context) + invoices = account_invoice_report.browse(cr, SUPERUSER_ID, invoice_ids, context=context) result[partner.id] = sum(inv.user_currency_price_total for inv in invoices) return result @@ -267,7 +269,8 @@ class res_partner(osv.osv): fnct_search=_credit_search, string='Total Receivable', multi='dc', help="Total amount this customer owes you."), 'debit': fields.function(_credit_debit_get, fnct_search=_debit_search, string='Total Payable', multi='dc', help="Total amount you have to pay to this supplier."), 'debit_limit': fields.float('Payable Limit'), - 'total_invoiced': fields.function(_invoice_total, string="Total Invoiced", type='float'), + 'total_invoiced': fields.function(_invoice_total, string="Total Invoiced", type='float', groups='account.group_account_invoice'), + 'contracts_count': fields.function(_journal_item_count, string="Contracts", type='integer', multi="invoice_journal"), 'journal_item_count': fields.function(_journal_item_count, string="Journal Items", type="integer", multi="invoice_journal"), 'property_account_payable': fields.property( diff --git a/addons/account/partner_view.xml b/addons/account/partner_view.xml index 309296c7955..679baa8ee50 100644 --- a/addons/account/partner_view.xml +++ b/addons/account/partner_view.xml @@ -62,8 +62,8 @@ {'search_default_partner_id': [active_id], 'default_partner_id': active_id} Contracts/Analytic Accounts account.analytic.account - - + + partner.view.buttons @@ -74,6 +74,7 @@ + + + + + + + + Import Bank Statements + account.bank.statement.import + 1 + + + + + + + + + + How to import your bank statement in OpenERP. + + +

+
+ +
+ + + + Import Bank Statements + ir.actions.act_window + account.bank.statement.import + form + form + new + + + + + + + diff --git a/addons/account_bank_statement_import/demo/fiscalyear_period.xml b/addons/account_bank_statement_import/demo/fiscalyear_period.xml new file mode 100644 index 00000000000..41b4be34f52 --- /dev/null +++ b/addons/account_bank_statement_import/demo/fiscalyear_period.xml @@ -0,0 +1,119 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/addons/account_bank_statement_import/demo/partner_bank.xml b/addons/account_bank_statement_import/demo/partner_bank.xml new file mode 100644 index 00000000000..47e8fa76f48 --- /dev/null +++ b/addons/account_bank_statement_import/demo/partner_bank.xml @@ -0,0 +1,38 @@ + + + + + + Agrolait + 00987654321 + + bank + + + + + China Export + 00987654322 + + bank + + + + + Delta PC + 10987654320 + + bank + + + + + Epic Technologies + 10987654322 + + bank + + + + + diff --git a/addons/account_bank_statement_import_ofx/__init__.py b/addons/account_bank_statement_import_ofx/__init__.py new file mode 100644 index 00000000000..fe838c2d20d --- /dev/null +++ b/addons/account_bank_statement_import_ofx/__init__.py @@ -0,0 +1,5 @@ +# -*- encoding: utf-8 -*- + +import account_bank_statement_import_ofx + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/account_bank_statement_import_ofx/__openerp__.py b/addons/account_bank_statement_import_ofx/__openerp__.py new file mode 100644 index 00000000000..baf0c66066f --- /dev/null +++ b/addons/account_bank_statement_import_ofx/__openerp__.py @@ -0,0 +1,25 @@ +# -*- encoding: utf-8 -*- +{ + 'name': 'Import OFX Bank Statement', + 'version': '1.0', + 'author': 'OpenERP SA', + 'depends': ['account_bank_statement_import'], + 'demo': [], + 'description' : """ +Module to import OFX bank statements. +====================================== + +This module allows you to import the machine readable OFX Files in Odoo: they are parsed and stored in human readable format in +Accounting \ Bank and Cash \ Bank Statements. + +Bank Statements may be generated containing a subset of the OFX information (only those transaction lines that are required for the +creation of the Financial Accounting records). + + """, + 'data' : [], + 'demo': [], + 'auto_install': False, + 'installable': True, +} + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/account_bank_statement_import_ofx/account_bank_statement_import_ofx.py b/addons/account_bank_statement_import_ofx/account_bank_statement_import_ofx.py new file mode 100644 index 00000000000..13966c072e6 --- /dev/null +++ b/addons/account_bank_statement_import_ofx/account_bank_statement_import_ofx.py @@ -0,0 +1,74 @@ +# -*- coding: utf-8 -*- + +import logging +import base64 +import os + +from openerp.osv import osv +from openerp.tools.translate import _ + +_logger = logging.getLogger(__name__) + +from openerp.addons.account_bank_statement_import import account_bank_statement_import as ibs +ibs.add_file_type(('ofx', 'OFX')) + +try: + from ofxparse import OfxParser as ofxparser +except ImportError: + _logger.warning("OFX parser unavailable because the `ofxparse` Python library cannot be found." + "It can be downloaded and installed from `https://pypi.python.org/pypi/ofxparse`.") + ofxparser = None + +class account_bank_statement_import(osv.TransientModel): + _inherit = 'account.bank.statement.import' + + def process_ofx(self, cr, uid, data_file, journal_id=False, context=None): + """ Import a file in the .OFX format""" + if ofxparser is None: + raise osv.except_osv(_("Error"), _("OFX parser unavailable because the `ofxparse` Python library cannot be found." + "It can be downloaded and installed from `https://pypi.python.org/pypi/ofxparse`.")) + try: + tempfile = open("temp.ofx", "w+") + tempfile.write(base64.decodestring(data_file)) + tempfile.read() + pathname = os.path.dirname('temp.ofx') + path = os.path.join(os.path.abspath(pathname), 'temp.ofx') + ofx = ofxparser.parse(file(path)) + except: + raise osv.except_osv(_('Import Error!'), _('Please check OFX file format is proper or not.')) + line_ids = [] + total_amt = 0.00 + try: + for transaction in ofx.account.statement.transactions: + bank_account_id, partner_id = self._detect_partner(cr, uid, transaction.payee, identifying_field='owner_name', context=context) + vals_line = { + 'date': transaction.date, + 'name': transaction.payee + ': ' + transaction.memo, + 'ref': transaction.id, + 'amount': transaction.amount, + 'partner_id': partner_id, + 'bank_account_id': bank_account_id, + } + total_amt += float(transaction.amount) + line_ids.append((0, 0, vals_line)) + except Exception, e: + raise osv.except_osv(_('Error!'), _("Following problem has been occurred while importing your file, Please verify the file is proper or not.\n\n %s" % e.message)) + st_start_date = ofx.account.statement.start_date or False + st_end_date = ofx.account.statement.end_date or False + period_obj = self.pool.get('account.period') + if st_end_date: + period_ids = period_obj.find(cr, uid, st_end_date, context=context) + else: + period_ids = period_obj.find(cr, uid, st_start_date, context=context) + vals_bank_statement = { + 'name': ofx.account.routing_number, + 'balance_start': ofx.account.statement.balance, + 'balance_end_real': float(ofx.account.statement.balance) + total_amt, + 'period_id': period_ids and period_ids[0] or False, + 'journal_id': journal_id + } + vals_bank_statement.update({'line_ids': line_ids}) + os.remove(path) + return [vals_bank_statement] + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/account_bank_statement_import_ofx/test_ofx_file/test_ofx.ofx b/addons/account_bank_statement_import_ofx/test_ofx_file/test_ofx.ofx new file mode 100644 index 00000000000..37df4d0c996 --- /dev/null +++ b/addons/account_bank_statement_import_ofx/test_ofx_file/test_ofx.ofx @@ -0,0 +1,100 @@ + + + + + + + 0 + INFO + + 20130831165153.000[-8:PST] + ENG + + + + + 0 + + 0 + INFO + + + USD + + 000000123 + 123456 + CHECKING + + + 20130801 + 20130831165153.000[-8:PST] + + POS + 20130824080000 + -80 + 219378 + Agrolait + + + + 20130801 + 20130831165153.000[-8:PST] + + POS + 20130824080000 + -90 + 219379 + China Export + + + + 20130801 + 20130831165153.000[-8:PST] + + POS + 20130824080000 + -100 + 219380 + Axelor Scuba + + + + 20130801 + 20130831165153.000[-8:PST] + + POS + 20130824080000 + -90 + 219381 + China Scuba + + + + 2156.56 + 20130831165153 + + + + + + + 0 + + 0 + INFO + + + USD + + 123412341234 + + + + + -562.00 + 20130831165153 + + + + + diff --git a/addons/account_bank_statement_import_ofx/tests/__init__.py b/addons/account_bank_statement_import_ofx/tests/__init__.py new file mode 100644 index 00000000000..8a5a8e9b1f7 --- /dev/null +++ b/addons/account_bank_statement_import_ofx/tests/__init__.py @@ -0,0 +1,5 @@ +from . import test_import_bank_statement + +checks = [ + test_import_bank_statement +] diff --git a/addons/account_bank_statement_import_ofx/tests/test_import_bank_statement.py b/addons/account_bank_statement_import_ofx/tests/test_import_bank_statement.py new file mode 100644 index 00000000000..967d647f124 --- /dev/null +++ b/addons/account_bank_statement_import_ofx/tests/test_import_bank_statement.py @@ -0,0 +1,30 @@ +from openerp.tests.common import TransactionCase +from openerp.modules.module import get_module_resource + +class TestOfxFile(TransactionCase): + """Tests for import bank statement ofx file format (account.bank.statement.import) + """ + + def setUp(self): + super(TestOfxFile, self).setUp() + self.statement_import_model = self.registry('account.bank.statement.import') + self.bank_statement_model = self.registry('account.bank.statement') + + def test_ofx_file_import(self): + try: + from ofxparse import OfxParser as ofxparser + except ImportError: + #the Python library isn't installed on the server, the OFX import is unavailable and the test cannot be run + return True + cr, uid = self.cr, self.uid + ofx_file_path = get_module_resource('account_bank_statement_import_ofx', 'test_ofx_file', 'test_ofx.ofx') + ofx_file = open(ofx_file_path, 'rb').read().encode('base64') + bank_statement_id = self.statement_import_model.create(cr, uid, dict( + file_type='ofx', + data_file=ofx_file, + )) + self.statement_import_model.parse_file(cr, uid, [bank_statement_id]) + statement_id = self.bank_statement_model.search(cr, uid, [('name', '=', '000000123')])[0] + bank_st_record = self.bank_statement_model.browse(cr, uid, statement_id) + self.assertEquals(bank_st_record.balance_start, 2156.56) + self.assertEquals(bank_st_record.balance_end_real, 1796.56) diff --git a/addons/account_bank_statement_import_qif/__init__.py b/addons/account_bank_statement_import_qif/__init__.py new file mode 100644 index 00000000000..befbd0e3d47 --- /dev/null +++ b/addons/account_bank_statement_import_qif/__init__.py @@ -0,0 +1,5 @@ +# -*- coding: utf-8 -*- + +import account_bank_statement_import_qif + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/account_bank_statement_import_qif/__openerp__.py b/addons/account_bank_statement_import_qif/__openerp__.py new file mode 100644 index 00000000000..dad736a059f --- /dev/null +++ b/addons/account_bank_statement_import_qif/__openerp__.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- + +{ + 'name': 'Import QIF Bank Statement', + 'version': '1.0', + 'author': 'OpenERP SA', + 'description': ''' +Module to import QIF bank statements. +====================================== + +This module allows you to import the machine readable QIF Files in Odoo: they are parsed and stored in human readable format in +Accounting \ Bank and Cash \ Bank Statements. + +Bank Statements may be generated containing a subset of the QIF information (only those transaction lines that are required for the +creation of the Financial Accounting records). +''', + 'images' : [], + 'depends': ['account_bank_statement_import'], + 'demo': [], + 'data': [], + 'auto_install': False, + 'installable': True, +} + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/account_bank_statement_import_qif/account_bank_statement_import_qif.py b/addons/account_bank_statement_import_qif/account_bank_statement_import_qif.py new file mode 100644 index 00000000000..a253cb62dd0 --- /dev/null +++ b/addons/account_bank_statement_import_qif/account_bank_statement_import_qif.py @@ -0,0 +1,75 @@ +# -*- coding: utf-8 -*- + +import dateutil.parser +import base64 +from tempfile import TemporaryFile + +from openerp.tools.translate import _ +from openerp.osv import osv + +from openerp.addons.account_bank_statement_import import account_bank_statement_import as ibs + +ibs.add_file_type(('qif', 'QIF')) + +class account_bank_statement_import(osv.TransientModel): + _inherit = "account.bank.statement.import" + + def process_qif(self, cr, uid, data_file, journal_id=False, context=None): + """ Import a file in the .QIF format""" + try: + fileobj = TemporaryFile('wb+') + fileobj.write(base64.b64decode(data_file)) + fileobj.seek(0) + file_data = "" + for line in fileobj.readlines(): + file_data += line + fileobj.close() + if '\r' in file_data: + data_list = file_data.split('\r') + else: + data_list = file_data.split('\n') + header = data_list[0].strip() + header = header.split(":")[1] + except: + raise osv.except_osv(_('Import Error!'), _('Please check QIF file format is proper or not.')) + line_ids = [] + vals_line = {} + total = 0 + if header == "Bank": + vals_bank_statement = {} + for line in data_list: + line = line.strip() + if not line: + continue + if line[0] == 'D': # date of transaction + vals_line['date'] = dateutil.parser.parse(line[1:], fuzzy=True).date() + if vals_line.get('date') and not vals_bank_statement.get('period_id'): + period_ids = self.pool.get('account.period').find(cr, uid, vals_line['date'], context=context) + vals_bank_statement.update({'period_id': period_ids and period_ids[0] or False}) + elif line[0] == 'T': # Total amount + total += float(line[1:].replace(',', '')) + vals_line['amount'] = float(line[1:].replace(',', '')) + elif line[0] == 'N': # Check number + vals_line['ref'] = line[1:] + elif line[0] == 'P': # Payee + bank_account_id, partner_id = self._detect_partner(cr, uid, line[1:], identifying_field='owner_name', context=context) + vals_line['partner_id'] = partner_id + vals_line['bank_account_id'] = bank_account_id + vals_line['name'] = 'name' in vals_line and line[1:] + ': ' + vals_line['name'] or line[1:] + elif line[0] == 'M': # Memo + vals_line['name'] = 'name' in vals_line and vals_line['name'] + ': ' + line[1:] or line[1:] + elif line[0] == '^': # end of item + line_ids.append((0, 0, vals_line)) + vals_line = {} + elif line[0] == '\n': + line_ids = [] + else: + pass + else: + raise osv.except_osv(_('Error!'), _('Cannot support this Format !Type:%s.') % (header,)) + vals_bank_statement.update({'balance_end_real': total, + 'line_ids': line_ids, + 'journal_id': journal_id}) + return [vals_bank_statement] + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/account_bank_statement_import_qif/test_qif_file/test_qif.qif b/addons/account_bank_statement_import_qif/test_qif_file/test_qif.qif new file mode 100644 index 00000000000..5388e6dae1a --- /dev/null +++ b/addons/account_bank_statement_import_qif/test_qif_file/test_qif.qif @@ -0,0 +1,21 @@ +!Type:Bank +D8/12/13 +T-1,000.00 +PDelta PC +^ +D8/15/13 +T-75.46 +PWalts Drugs +^ +D3/3/13 +T-379.00 +PEpic Technologies +^ +D3/4/13 +T-20.28 +PYOUR LOCAL SUPERMARKET +^ +D3/3/13 +T-421.35 +PSPRINGFIELD WATER UTILITY +^ diff --git a/addons/account_bank_statement_import_qif/tests/__init__.py b/addons/account_bank_statement_import_qif/tests/__init__.py new file mode 100644 index 00000000000..05b23c400e4 --- /dev/null +++ b/addons/account_bank_statement_import_qif/tests/__init__.py @@ -0,0 +1,5 @@ +from . import test_import_bank_statement +checks = [ + test_import_bank_statement +] + diff --git a/addons/account_bank_statement_import_qif/tests/test_import_bank_statement.py b/addons/account_bank_statement_import_qif/tests/test_import_bank_statement.py new file mode 100644 index 00000000000..0f9ef4d99bb --- /dev/null +++ b/addons/account_bank_statement_import_qif/tests/test_import_bank_statement.py @@ -0,0 +1,27 @@ +from openerp.tests.common import TransactionCase +from openerp.modules.module import get_module_resource + +class TestQifFile(TransactionCase): + """Tests for import bank statement qif file format (account.bank.statement.import) + """ + + def setUp(self): + super(TestQifFile, self).setUp() + self.statement_import_model = self.registry('account.bank.statement.import') + self.bank_statement_model = self.registry('account.bank.statement') + self.bank_statement_line_model = self.registry('account.bank.statement.line') + + def test_qif_file_import(self): + from openerp.tools import float_compare + cr, uid = self.cr, self.uid + qif_file_path = get_module_resource('account_bank_statement_import_qif', 'test_qif_file', 'test_qif.qif') + qif_file = open(qif_file_path, 'rb').read().encode('base64') + bank_statement_id = self.statement_import_model.create(cr, uid, dict( + file_type='qif', + data_file=qif_file, + )) + self.statement_import_model.parse_file(cr, uid, [bank_statement_id]) + line_id = self.bank_statement_line_model.search(cr, uid, [('name', '=', 'YOUR LOCAL SUPERMARKET')])[0] + statement_id = self.bank_statement_line_model.browse(cr, uid, line_id).statement_id.id + bank_st_record = self.bank_statement_model.browse(cr, uid, statement_id) + assert float_compare(bank_st_record.balance_end_real, -1896.09, 2) == 0 diff --git a/addons/account_budget/account_budget_demo.xml b/addons/account_budget/account_budget_demo.xml index d93e78e3448..f5de2cfcdc5 100644 --- a/addons/account_budget/account_budget_demo.xml +++ b/addons/account_budget/account_budget_demo.xml @@ -42,7 +42,7 @@ - + @@ -50,7 +50,7 @@ - + @@ -58,7 +58,7 @@ - + @@ -66,7 +66,7 @@ - + @@ -74,7 +74,7 @@ - + @@ -84,7 +84,7 @@ - + @@ -93,7 +93,7 @@ - + @@ -101,7 +101,7 @@ - + @@ -112,7 +112,7 @@ - + @@ -120,7 +120,7 @@ - + @@ -128,7 +128,7 @@ - + @@ -136,7 +136,7 @@ - + @@ -144,7 +144,7 @@ - + @@ -154,7 +154,7 @@ - + @@ -162,7 +162,7 @@ - + @@ -170,7 +170,7 @@ - + @@ -178,7 +178,7 @@ - + diff --git a/addons/account_budget/test/account_budget.yml b/addons/account_budget/test/account_budget.yml index f656d214405..cab07c3600e 100644 --- a/addons/account_budget/test/account_budget.yml +++ b/addons/account_budget/test/account_budget.yml @@ -16,12 +16,12 @@ - !record {model: crossovered.budget, id: crossovered_budget_budget0}: crossovered_budget_line: - - analytic_account_id: account.analytic_consultancy + - analytic_account_id: analytic.analytic_consultancy date_from: !eval "'%s-01-01' %(datetime.now().year+1)" date_to: !eval "'%s-12-31' %(datetime.now().year+1)" general_budget_id: account_budget.account_budget_post_purchase0 planned_amount: 10000.0 - - analytic_account_id: account.analytic_super_product_trainings + - analytic_account_id: analytic.analytic_super_product_trainings date_from: !eval "'%s-09-01' %(datetime.now().year+1)" date_to: !eval "'%s-09-30' %(datetime.now().year+1)" general_budget_id: account_budget.account_budget_post_sales0 diff --git a/addons/account_budget/test/account_budget_report.yml b/addons/account_budget/test/account_budget_report.yml index a36c2d87d04..4b2d9d2bbcf 100644 --- a/addons/account_budget/test/account_budget_report.yml +++ b/addons/account_budget/test/account_budget_report.yml @@ -2,7 +2,7 @@ Print the Analytic Budget Report through wizard - !python {model: account.analytic.account}: | - ctx = {'model': 'account.analytic.account','active_ids': [ref('account.analytic_root')]} + ctx = {'model': 'account.analytic.account','active_ids': [ref('analytic.analytic_root')]} from openerp.tools import test_reports test_reports.try_report_action(cr, uid, 'action_account_budget_analytic',wiz_data={}, context=ctx, our_module='account_budget') diff --git a/addons/account_check_writing/account_voucher_view.xml b/addons/account_check_writing/account_voucher_view.xml index de7ecd327a9..2201a7cd7e0 100644 --- a/addons/account_check_writing/account_voucher_view.xml +++ b/addons/account_check_writing/account_voucher_view.xml @@ -39,7 +39,7 @@

The check payment form allows you to track the payment you do to your suppliers using checks. When you select a supplier, the - payment method and an amount for the payment, OpenERP will + payment method and an amount for the payment, Odoo will propose to reconcile your payment with the open supplier invoices or bills.

diff --git a/addons/account_sequence/account_sequence_installer.py b/addons/account_sequence/account_sequence_installer.py index bcf1e14c20f..af3f5a971bf 100644 --- a/addons/account_sequence/account_sequence_installer.py +++ b/addons/account_sequence/account_sequence_installer.py @@ -31,7 +31,7 @@ class account_sequence_installer(osv.osv_memory): 'suffix': fields.char('Suffix', size=64, help="Suffix value of the record for the sequence"), 'number_next': fields.integer('Next Number', required=True, help="Next number of this sequence"), 'number_increment': fields.integer('Increment Number', required=True, help="The next number of the sequence will be incremented by this number"), - 'padding' : fields.integer('Number padding', required=True, help="OpenERP will automatically adds some '0' on the left of the 'Next Number' to get the required padding size."), + 'padding' : fields.integer('Number padding', required=True, help="Odoo will automatically adds some '0' on the left of the 'Next Number' to get the required padding size."), 'company_id': fields.many2one('res.company', 'Company'), } _defaults = { diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py index 275e002695e..6341c8b1e10 100644 --- a/addons/account_voucher/account_voucher.py +++ b/addons/account_voucher/account_voucher.py @@ -946,6 +946,8 @@ class account_voucher(osv.osv): # refresh to make sure you don't unlink an already removed move voucher.refresh() for line in voucher.move_ids: + # refresh to make sure you don't unreconcile an already unreconciled entry + line.refresh() if line.reconcile_id: move_lines = [move_line.id for move_line in line.reconcile_id.line_id] move_lines.remove(line.id) diff --git a/addons/account_voucher/account_voucher_data.xml b/addons/account_voucher/account_voucher_data.xml index 6329176c6e9..6d141869184 100644 --- a/addons/account_voucher/account_voucher_data.xml +++ b/addons/account_voucher/account_voucher_data.xml @@ -9,7 +9,7 @@ notification eInvoicing & Payments application installed! - OpenERP's electronic invoicing accelerates the creation of invoices and collection of customer payments. Invoices are created in a few clicks and your customers receive them by email. They can pay online and/or import them in their own system.

+ Odoo's electronic invoicing accelerates the creation of invoices and collection of customer payments. Invoices are created in a few clicks and your customers receive them by email. They can pay online and/or import them in their own system.

You can track customer payments easily and automate follow-ups. You get an overview of the discussion with your customers on each invoice for easier traceability. For advanced accounting features, you should install the "Accounting and Finance" module.

]]>
diff --git a/addons/account_voucher/report/account_voucher_sales_receipt.py b/addons/account_voucher/report/account_voucher_sales_receipt.py index 246cd8b47e8..b615143567d 100644 --- a/addons/account_voucher/report/account_voucher_sales_receipt.py +++ b/addons/account_voucher/report/account_voucher_sales_receipt.py @@ -28,11 +28,6 @@ class sale_receipt_report(osv.osv): _rec_name = 'date' _columns = { 'date': fields.date('Date', readonly=True), - 'year': fields.char('Year', size=4, readonly=True), - 'day': fields.char('Day', size=128, readonly=True), - 'month': fields.selection([('01','January'), ('02','February'), ('03','March'), ('04','April'), - ('05','May'), ('06','June'), ('07','July'), ('08','August'), ('09','September'), - ('10','October'), ('11','November'), ('12','December')], 'Month', readonly=True), 'currency_id': fields.many2one('res.currency', 'Currency', readonly=True), 'journal_id': fields.many2one('account.journal', 'Journal', readonly=True), 'partner_id': fields.many2one('res.partner', 'Partner', readonly=True), @@ -69,9 +64,6 @@ class sale_receipt_report(osv.osv): create or replace view sale_receipt_report as ( select min(avl.id) as id, av.date as date, - to_char(av.date, 'YYYY') as year, - to_char(av.date, 'MM') as month, - to_char(av.date, 'YYYY-MM-DD') as day, av.partner_id as partner_id, aj.currency as currency_id, av.journal_id as journal_id, @@ -107,9 +99,6 @@ class sale_receipt_report(osv.osv): group by av.date, av.id, - to_char(av.date, 'YYYY'), - to_char(av.date, 'MM'), - to_char(av.date, 'YYYY-MM-DD'), av.partner_id, aj.currency, av.journal_id, diff --git a/addons/account_voucher/report/account_voucher_sales_receipt_view.xml b/addons/account_voucher/report/account_voucher_sales_receipt_view.xml index a6e153573e7..78af9d28fc5 100644 --- a/addons/account_voucher/report/account_voucher_sales_receipt_view.xml +++ b/addons/account_voucher/report/account_voucher_sales_receipt_view.xml @@ -1,34 +1,7 @@ - - + sale.receipt.report.graph sale.receipt.report @@ -65,9 +38,7 @@ - - - +
diff --git a/addons/account_voucher/static/description/index.html b/addons/account_voucher/static/description/index.html index a363291f12e..4f149075ed8 100644 --- a/addons/account_voucher/static/description/index.html +++ b/addons/account_voucher/static/description/index.html @@ -112,7 +112,7 @@ material. Define recurrencies to produce recurring invoice automatically.
- OpenERP allowed us to automate sending 10.000 invoices per month. + Odoo allowed us to automate sending 10.000 invoices per month. @@ -124,7 +124,7 @@ material. Define recurrencies to produce recurring invoice automatically.
- We have found invoicing module of OpenERP to be user + We have found invoicing module of Odoo to be user friendly and highly customizable. diff --git a/addons/account_voucher/test/case1_usd_usd.yml b/addons/account_voucher/test/case1_usd_usd.yml index 4c19c33eb5f..bda36a5f267 100644 --- a/addons/account_voucher/test/case1_usd_usd.yml +++ b/addons/account_voucher/test/case1_usd_usd.yml @@ -60,7 +60,7 @@ name: Bank Journal(USD) code: BUSD type: bank - analytic_journal_id: account.sit + analytic_journal_id: analytic.sit sequence_id: account.sequence_bank_journal default_debit_account_id: account_cash_usd_id default_credit_account_id: account_cash_usd_id diff --git a/addons/account_voucher/test/case1_usd_usd_payment_rate.yml b/addons/account_voucher/test/case1_usd_usd_payment_rate.yml index 7f5cf15284d..9b2244ff76a 100644 --- a/addons/account_voucher/test/case1_usd_usd_payment_rate.yml +++ b/addons/account_voucher/test/case1_usd_usd_payment_rate.yml @@ -60,7 +60,7 @@ name: Bank Journal(USD) code: BUSD type: bank - analytic_journal_id: account.sit + analytic_journal_id: analytic.sit sequence_id: account.sequence_bank_journal default_debit_account_id: account_cash_usd_id default_credit_account_id: account_cash_usd_id 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 0eb71d66d4d..e679a4c631c 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 @@ -54,7 +54,7 @@ name: Bank Journal(EUR) code: BEUR type: bank - analytic_journal_id: account.sit + analytic_journal_id: analytic.sit sequence_id: account.sequence_bank_journal default_debit_account_id: account.cash default_credit_account_id: account.cash @@ -66,7 +66,7 @@ name: Bank Journal(USD) code: BUSD type: bank - analytic_journal_id: account.sit + analytic_journal_id: analytic.sit sequence_id: account.sequence_bank_journal default_debit_account_id: account_cash_usd_id default_credit_account_id: account_cash_usd_id 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 12d6f07b33a..f52fcbbaa0c 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 @@ -54,7 +54,7 @@ name: Bank Journal(EUR) code: BEUR type: bank - analytic_journal_id: account.sit + analytic_journal_id: analytic.sit sequence_id: account.sequence_bank_journal default_debit_account_id: account.cash default_credit_account_id: account.cash @@ -66,7 +66,7 @@ name: Bank Journal(USD) code: BUSD type: bank - analytic_journal_id: account.sit + analytic_journal_id: analytic.sit sequence_id: account.sequence_bank_journal default_debit_account_id: account_cash_usd_id default_credit_account_id: account_cash_usd_id diff --git a/addons/account_voucher/test/case3_eur_eur.yml b/addons/account_voucher/test/case3_eur_eur.yml index 6c48c2e2136..b2732bbce72 100644 --- a/addons/account_voucher/test/case3_eur_eur.yml +++ b/addons/account_voucher/test/case3_eur_eur.yml @@ -22,7 +22,7 @@ name: Bank Journal(EUR) code: BEUR type: bank - analytic_journal_id: account.sit + analytic_journal_id: analytic.sit sequence_id: account.sequence_bank_journal default_debit_account_id: account.cash default_credit_account_id: account.cash diff --git a/addons/account_voucher/test/case4_cad_chf.yml b/addons/account_voucher/test/case4_cad_chf.yml index e31dd5783c0..d06b851fd19 100644 --- a/addons/account_voucher/test/case4_cad_chf.yml +++ b/addons/account_voucher/test/case4_cad_chf.yml @@ -55,7 +55,7 @@ name: Bank Journal(CHF) code: BCHF type: bank - analytic_journal_id: account.sit + analytic_journal_id: analytic.sit sequence_id: account.sequence_bank_journal default_debit_account_id: account_cash_chf_id default_credit_account_id: account_cash_chf_id diff --git a/addons/account_voucher/test/case5_suppl_usd_usd.yml b/addons/account_voucher/test/case5_suppl_usd_usd.yml index 327cd9de25c..c46e3be46ec 100644 --- a/addons/account_voucher/test/case5_suppl_usd_usd.yml +++ b/addons/account_voucher/test/case5_suppl_usd_usd.yml @@ -41,7 +41,7 @@ name: Bank Journal(EUR) code: BEUR type: bank - analytic_journal_id: account.sit + analytic_journal_id: analytic.sit sequence_id: account.sequence_bank_journal default_debit_account_id: account.cash default_credit_account_id: account.cash @@ -53,7 +53,7 @@ name: Bank Journal(USD) code: BUSD type: bank - analytic_journal_id: account.sit + analytic_journal_id: analytic.sit sequence_id: account.sequence_bank_journal default_debit_account_id: account_cash_usd_id2 default_credit_account_id: account_cash_usd_id2 diff --git a/addons/account_voucher/test/case_eur_usd.yml b/addons/account_voucher/test/case_eur_usd.yml index ce2b71d7ac0..4f0c711fed1 100644 --- a/addons/account_voucher/test/case_eur_usd.yml +++ b/addons/account_voucher/test/case_eur_usd.yml @@ -39,7 +39,7 @@ name: Bank Journal Test(USD) code: BEUSD type: bank - analytic_journal_id: account.sit + analytic_journal_id: analytic.sit sequence_id: account.sequence_bank_journal default_debit_account_id: account_eur_usd_id default_credit_account_id: account_eur_usd_id diff --git a/addons/account_voucher/voucher_payment_receipt_view.xml b/addons/account_voucher/voucher_payment_receipt_view.xml index aa427bbf91e..dd316ea2600 100644 --- a/addons/account_voucher/voucher_payment_receipt_view.xml +++ b/addons/account_voucher/voucher_payment_receipt_view.xml @@ -270,7 +270,7 @@

Click to create a new supplier payment.

- OpenERP helps you easily track payments you make and the remaining balances you need to pay your suppliers. + Odoo helps you easily track payments you make and the remaining balances you need to pay your suppliers.

@@ -554,7 +554,7 @@ Click to register a new payment.

Enter the customer and the payment method and then, either - create manually a payment record or OpenERP will propose to you + create manually a payment record or Odoo will propose to you automatically the reconciliation of this payment with the open invoices or sales receipts.

diff --git a/addons/analytic/__init__.py b/addons/analytic/__init__.py index d0175cf1424..53109ee0c7e 100644 --- a/addons/analytic/__init__.py +++ b/addons/analytic/__init__.py @@ -19,7 +19,9 @@ # ############################################################################## -import analytic +import models +import report +import wizard # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/analytic/__openerp__.py b/addons/analytic/__openerp__.py index eaff26df197..79eacdd79bf 100644 --- a/addons/analytic/__openerp__.py +++ b/addons/analytic/__openerp__.py @@ -37,11 +37,26 @@ that have no counterpart in the general financial accounts. 'data': [ 'security/analytic_security.xml', 'security/ir.model.access.csv', - 'analytic_sequence.xml', - 'analytic_view.xml', - 'analytic_data.xml', + 'data/analytic_sequence.xml', + 'views/analytic_view.xml', + 'data/analytic_data.xml', + 'analytic_report.xml', + 'wizard/account_analytic_balance_report_view.xml', + 'wizard/account_analytic_cost_ledger_view.xml', + 'wizard/account_analytic_inverted_balance_report.xml', + 'wizard/account_analytic_journal_report_view.xml', + 'wizard/account_analytic_cost_ledger_for_journal_report_view.xml', + 'wizard/account_analytic_chart_view.xml', + 'views/report_analyticbalance.xml', + 'views/report_analyticjournal.xml', + 'views/report_analyticcostledgerquantity.xml', + 'views/report_analyticcostledger.xml', + 'views/report_invertedanalyticbalance.xml', + ], + 'demo': [ + 'data/analytic_demo.xml', + 'data/analytic_account_demo.xml', ], - 'demo': [], 'installable': True, 'auto_install': False, } diff --git a/addons/account/project/project_report.xml b/addons/analytic/analytic_report.xml similarity index 100% rename from addons/account/project/project_report.xml rename to addons/analytic/analytic_report.xml diff --git a/addons/analytic/analytic_view.xml b/addons/analytic/analytic_view.xml deleted file mode 100644 index 7b1b16037cf..00000000000 --- a/addons/analytic/analytic_view.xml +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - analytic.analytic.account.form - account.analytic.account - -
- -
-
- -
-
@@ -209,7 +209,7 @@ Customize your sales cycle by configuring sales stages that perfectly fit your s
- With OpenERP CRM I keep all the information about leads and customers + With Odoo CRM I keep all the information about leads and customers in a single place, and share it with my colleagues. It's great and effective. @@ -222,7 +222,7 @@ Customize your sales cycle by configuring sales stages that perfectly fit your s
- I am surprised by how good OpenERP CRM is. Awesome product. + I am surprised by how good Odoo CRM is. Awesome product. diff --git a/addons/crm_claim/report/crm_claim_report.py b/addons/crm_claim/report/crm_claim_report.py index 4323b7024d3..2855cc427a0 100644 --- a/addons/crm_claim/report/crm_claim_report.py +++ b/addons/crm_claim/report/crm_claim_report.py @@ -37,19 +37,12 @@ class crm_claim_report(osv.osv): _description = "CRM Claim Report" _columns = { - 'name': fields.char('Year', required=False, readonly=True), 'user_id':fields.many2one('res.users', 'User', readonly=True), 'section_id':fields.many2one('crm.case.section', 'Section', readonly=True), 'nbr': fields.integer('# of Cases', readonly=True), - 'month':fields.selection([('01', 'January'), ('02', 'February'), \ - ('03', 'March'), ('04', 'April'),\ - ('05', 'May'), ('06', 'June'), \ - ('07', 'July'), ('08', 'August'),\ - ('09', 'September'), ('10', 'October'),\ - ('11', 'November'), ('12', 'December')], 'Month', readonly=True), 'company_id': fields.many2one('res.company', 'Company', readonly=True), 'create_date': fields.datetime('Create Date', readonly=True, select=True), - 'day': fields.char('Day', size=128, readonly=True), + 'claim_date': fields.datetime('Claim Date', readonly=True), 'delay_close': fields.float('Delay to close', digits=(16,2),readonly=True, group_operator="avg",help="Number of Days to close the case"), 'stage_id': fields.many2one ('crm.case.stage', 'Stage', readonly=True,domain="[('section_ids','=',section_id)]"), 'categ_id': fields.many2one('crm.case.categ', 'Category',\ @@ -76,11 +69,9 @@ class crm_claim_report(osv.osv): create or replace view crm_claim_report as ( select min(c.id) as id, - to_char(c.date, 'YYYY') as name, - to_char(c.date, 'MM') as month, - to_char(c.date, 'YYYY-MM-DD') as day, - to_char(c.date_closed, 'YYYY-MM-DD') as date_closed, - to_char(c.date_deadline, 'YYYY-MM-DD') as date_deadline, + c.date as claim_date, + date(c.date_closed) as date_closed, + c.date_deadline as date_deadline, c.user_id, c.stage_id, c.section_id, @@ -90,13 +81,13 @@ class crm_claim_report(osv.osv): count(*) as nbr, c.priority as priority, c.type_action as type_action, - date_trunc('day',c.create_date) as create_date, + c.create_date as create_date, avg(extract('epoch' from (c.date_closed-c.create_date)))/(3600*24) as delay_close, (SELECT count(id) FROM mail_message WHERE model='crm.claim' AND res_id=c.id) AS email, extract('epoch' from (c.date_deadline - c.date_closed))/(3600*24) as delay_expected from crm_claim c - group by to_char(c.date, 'YYYY'), to_char(c.date, 'MM'),to_char(c.date, 'YYYY-MM-DD'),\ + group by c.date,\ c.user_id,c.section_id, c.stage_id,\ c.categ_id,c.partner_id,c.company_id,c.create_date, c.priority,c.type_action,c.date_deadline,c.date_closed,c.id diff --git a/addons/crm_claim/report/crm_claim_report_view.xml b/addons/crm_claim/report/crm_claim_report_view.xml index bc9293e7f91..cf365d06df6 100644 --- a/addons/crm_claim/report/crm_claim_report_view.xml +++ b/addons/crm_claim/report/crm_claim_report_view.xml @@ -53,9 +53,7 @@ - - - + @@ -81,13 +79,8 @@ - - - + action="action_report_crm_claim" parent="base.next_id_64" sequence="15"/> diff --git a/addons/crm_helpdesk/crm_helpdesk_demo.xml b/addons/crm_helpdesk/crm_helpdesk_demo.xml index d0c9094aa63..83b6b03f355 100644 --- a/addons/crm_helpdesk/crm_helpdesk_demo.xml +++ b/addons/crm_helpdesk/crm_helpdesk_demo.xml @@ -9,8 +9,8 @@ draft - Download old version of OpenERP? - + Download old version of Odoo? + @@ -46,7 +46,7 @@ draft How to create a new module - + diff --git a/addons/crm_helpdesk/crm_helpdesk_menu.xml b/addons/crm_helpdesk/crm_helpdesk_menu.xml index 58b522d0dee..684c278a6a2 100644 --- a/addons/crm_helpdesk/crm_helpdesk_menu.xml +++ b/addons/crm_helpdesk/crm_helpdesk_menu.xml @@ -23,7 +23,7 @@

Helpdesk and Support allow you to track your interventions.

- Use the OpenERP Issues system to manage your support + Use the Odoo Issues system to manage your support activities. Issues can be connected to the email gateway: new emails may create issues, each of them automatically gets the history of the conversation with the customer. diff --git a/addons/crm_helpdesk/report/crm_helpdesk_report.py b/addons/crm_helpdesk/report/crm_helpdesk_report.py index f7180ef0908..590cadb0fed 100644 --- a/addons/crm_helpdesk/report/crm_helpdesk_report.py +++ b/addons/crm_helpdesk/report/crm_helpdesk_report.py @@ -39,17 +39,11 @@ class crm_helpdesk_report(osv.osv): _auto = False _columns = { - 'name': fields.char('Year', required=False, readonly=True), + 'date': fields.datetime('Date', readonly=True), 'user_id':fields.many2one('res.users', 'User', readonly=True), 'section_id':fields.many2one('crm.case.section', 'Section', readonly=True), 'nbr': fields.integer('# of Cases', readonly=True), 'state': fields.selection(AVAILABLE_STATES, 'Status', readonly=True), - 'month':fields.selection([('01', 'January'), ('02', 'February'), \ - ('03', 'March'), ('04', 'April'),\ - ('05', 'May'), ('06', 'June'), \ - ('07', 'July'), ('08', 'August'),\ - ('09', 'September'), ('10', 'October'),\ - ('11', 'November'), ('12', 'December')], 'Month', readonly=True), 'delay_close': fields.float('Delay to Close',digits=(16,2),readonly=True, group_operator="avg"), 'partner_id': fields.many2one('res.partner', 'Partner' , readonly=True), 'company_id': fields.many2one('res.company', 'Company', readonly=True), @@ -64,7 +58,6 @@ class crm_helpdesk_report(osv.osv): 'create_date': fields.date('Creation Date' , readonly=True, select=True), 'date_closed': fields.date('Close Date', readonly=True, select=True), 'delay_expected': fields.float('Overpassed Deadline',digits=(16,2),readonly=True, group_operator="avg"), - 'day': fields.char('Day', size=128, readonly=True), 'email': fields.integer('# Emails', size=128, readonly=True), } @@ -80,11 +73,9 @@ class crm_helpdesk_report(osv.osv): create or replace view crm_helpdesk_report as ( select min(c.id) as id, - to_char(c.date, 'YYYY') as name, - to_char(c.date, 'MM') as month, - to_char(c.date, 'YYYY-MM-DD') as day, - to_char(c.create_date, 'YYYY-MM-DD') as create_date, - to_char(c.date_closed, 'YYYY-mm-dd') as date_closed, + c.date as date, + date(c.create_date) as create_date, + date(c.date_closed) as date_closed, c.state, c.user_id, c.section_id, @@ -102,7 +93,7 @@ class crm_helpdesk_report(osv.osv): from crm_helpdesk c where c.active = 'true' - group by to_char(c.date, 'YYYY'), to_char(c.date, 'MM'),to_char(c.date, 'YYYY-MM-DD'),\ + group by c.date,\ c.state, c.user_id,c.section_id,c.priority,\ c.partner_id,c.company_id,c.date_deadline,c.create_date,c.date,c.date_closed,\ c.categ_id,c.channel_id,c.planned_cost,c.id diff --git a/addons/crm_helpdesk/report/crm_helpdesk_report_view.xml b/addons/crm_helpdesk/report/crm_helpdesk_report_view.xml index adc788ad505..e37d9970c05 100644 --- a/addons/crm_helpdesk/report/crm_helpdesk_report_view.xml +++ b/addons/crm_helpdesk/report/crm_helpdesk_report_view.xml @@ -49,9 +49,7 @@ - - - + @@ -77,12 +75,8 @@ - - + id="menu_report_crm_helpdesks_tree" parent="base.next_id_64" sequence="20"/> diff --git a/addons/crm_partner_assign/crm_partner_assign.py b/addons/crm_partner_assign/crm_partner_assign.py index a07c730ba21..011a6ffdbf8 100644 --- a/addons/crm_partner_assign/crm_partner_assign.py +++ b/addons/crm_partner_assign/crm_partner_assign.py @@ -56,8 +56,6 @@ class res_partner(osv.osv): _columns = { 'partner_weight': fields.integer('Grade Weight', help="Gives the probability to assign a lead to this partner. (0 means no assignation.)"), - 'opportunity_assigned_ids': fields.one2many('crm.lead', 'partner_assigned_id',\ - 'Assigned Opportunities'), 'grade_id': fields.many2one('res.partner.grade', 'Grade'), 'activation' : fields.many2one('res.partner.activation', 'Activation', select=1), 'date_partnership' : fields.date('Partnership Date'), diff --git a/addons/crm_partner_assign/report/crm_lead_report.py b/addons/crm_partner_assign/report/crm_lead_report.py index af6d146e1df..58ef013d60d 100644 --- a/addons/crm_partner_assign/report/crm_lead_report.py +++ b/addons/crm_partner_assign/report/crm_lead_report.py @@ -48,7 +48,6 @@ class crm_lead_report_assign(osv.osv): 'stage_id': fields.many2one ('crm.case.stage', 'Stage', domain="[('section_ids', '=', section_id)]"), 'partner_id': fields.many2one('res.partner', 'Customer' , readonly=True), 'opening_date': fields.date('Opening Date', readonly=True), - 'creation_date': fields.date('Creation Date', readonly=True), 'date_closed': fields.date('Close Date', readonly=True), 'nbr': fields.integer('# of Cases', readonly=True), 'company_id': fields.many2one('res.company', 'Company', readonly=True), @@ -69,9 +68,8 @@ class crm_lead_report_assign(osv.osv): CREATE OR REPLACE VIEW crm_lead_report_assign AS ( SELECT c.id, - to_char(c.create_date, 'YYYY-MM-DD') as creation_date, - to_char(c.date_open, 'YYYY-MM-DD') as opening_date, - to_char(c.date_closed, 'YYYY-mm-dd') as date_closed, + date(c.date_open) as opening_date, + date(c.date_closed) as date_closed, c.date_assign, c.user_id, c.probability, @@ -89,7 +87,7 @@ class crm_lead_report_assign(osv.osv): p.date as partner_date, c.planned_revenue*(c.probability/100) as probable_revenue, 1 as nbr, - date_trunc('day',c.create_date) as create_date, + c.create_date as create_date, extract('epoch' from (c.write_date-c.create_date))/(3600*24) as delay_close, extract('epoch' from (c.date_deadline - c.date_closed))/(3600*24) as delay_expected, extract('epoch' from (c.date_open-c.create_date))/(3600*24) as delay_open diff --git a/addons/crm_partner_assign/report/crm_lead_report_view.xml b/addons/crm_partner_assign/report/crm_lead_report_view.xml index 0cbfac50f87..22897962b7b 100644 --- a/addons/crm_partner_assign/report/crm_lead_report_view.xml +++ b/addons/crm_partner_assign/report/crm_lead_report_view.xml @@ -18,7 +18,6 @@ - @@ -35,9 +34,7 @@ - - - + diff --git a/addons/crm_partner_assign/res_partner_view.xml b/addons/crm_partner_assign/res_partner_view.xml index 4d613c5ddd0..98c00a98693 100644 --- a/addons/crm_partner_assign/res_partner_view.xml +++ b/addons/crm_partner_assign/res_partner_view.xml @@ -103,60 +103,25 @@ res.partner - - - + + - - - - - - - - - - - - + + + + + - - -

-Get rid of the paper work and follow employee's expenses directly in OpenERP. Don't loose time or money by controlling the full flow: expense validation, reimbursement of employees, posting in the accounting and re-invoicing to customers. +Get rid of the paper work and follow employee's expenses directly in Odoo. Don't loose time or money by controlling the full flow: expense validation, reimbursement of employees, posting in the accounting and re-invoicing to customers.

@@ -126,7 +126,7 @@ Get rid of the paper work and follow employee's expenses directly in OpenERP. Do

Follow Periodic Appraisals

-Set-up appraisals plans and/or surveys for your employees and watch their evolution. Define steps for interviews and OpenERP will notify managers or subordinates automatically to prepare appraisals. Keep track of the progress of your staff periodically. +Set-up appraisals plans and/or surveys for your employees and watch their evolution. Define steps for interviews and Odoo will notify managers or subordinates automatically to prepare appraisals. Keep track of the progress of your staff periodically.

@@ -183,7 +183,7 @@ Inspire achievement with challenges, goals and rewards. Define clear objectives
- OpenERP helped us to effectively record our working time and invoice + Odoo helped us to effectively record our working time and invoice our customers while keeping track of our costs. @@ -195,7 +195,7 @@ Inspire achievement with challenges, goals and rewards. Define clear objectives
- Thanks to OpenERP, we have unified all our front-office and back-office + Thanks to Odoo, we have unified all our front-office and back-office HR applications for 300.000 users in a cost effective way. diff --git a/addons/hr_attendance/hr_attendance.py b/addons/hr_attendance/hr_attendance.py index a7950fef8d0..4887d41a52c 100644 --- a/addons/hr_attendance/hr_attendance.py +++ b/addons/hr_attendance/hr_attendance.py @@ -61,13 +61,16 @@ class hr_attendance(osv.osv): ('employee_id', '=', obj.employee_id.id), ('name', '<', obj.name), ('action', '=', 'sign_in') ], limit=1, order='name DESC') - last_signin = self.browse(cr, uid, last_signin_id, context=context)[0] + if last_signin_id: + last_signin = self.browse(cr, uid, last_signin_id, context=context)[0] - # Compute time elapsed between sign-in and sign-out - last_signin_datetime = datetime.strptime(last_signin.name, '%Y-%m-%d %H:%M:%S') - signout_datetime = datetime.strptime(obj.name, '%Y-%m-%d %H:%M:%S') - workedhours_datetime = (signout_datetime - last_signin_datetime) - res[obj.id] = ((workedhours_datetime.seconds) / 60) / 60 + # Compute time elapsed between sign-in and sign-out + last_signin_datetime = datetime.strptime(last_signin.name, '%Y-%m-%d %H:%M:%S') + signout_datetime = datetime.strptime(obj.name, '%Y-%m-%d %H:%M:%S') + workedhours_datetime = (signout_datetime - last_signin_datetime) + res[obj.id] = ((workedhours_datetime.seconds) / 60) / 60 + else: + res[obj.id] = False return res _columns = { diff --git a/addons/hr_attendance/hr_attendance_view.xml b/addons/hr_attendance/hr_attendance_view.xml index bd8fa81636b..1a5d010381b 100644 --- a/addons/hr_attendance/hr_attendance_view.xml +++ b/addons/hr_attendance/hr_attendance_view.xml @@ -83,7 +83,7 @@ tree,form {"search_default_today":1} - The Time Tracking functionality aims to manage employee attendances from Sign in/Sign out actions. You can also link this feature to an attendance device using OpenERP's web service features. + The Time Tracking functionality aims to manage employee attendances from Sign in/Sign out actions. You can also link this feature to an attendance device using Odoo's web service features. @@ -141,7 +141,7 @@ + sequence="35" id="hr.menu_open_view_attendance_reason_new_config" parent="hr.menu_hr_configuration" groups="base.group_hr_attendance,base.group_hr_manager" name="Attendance"/> diff --git a/addons/hr_contract/hr_contract.py b/addons/hr_contract/hr_contract.py index 8b58c3efd61..593faf3e4ad 100644 --- a/addons/hr_contract/hr_contract.py +++ b/addons/hr_contract/hr_contract.py @@ -2,7 +2,7 @@ ############################################################################## # # OpenERP, Open Source Management Solution -# Copyright (C) 2004-2010 Tiny SPRL (). +# Copyright (C) 2004-Today OpenERP S.A. (). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -18,6 +18,7 @@ # along with this program. If not, see . # ############################################################################## + import time from openerp.osv import fields, osv @@ -31,7 +32,7 @@ class hr_employee(osv.osv): res = {} obj_contract = self.pool.get('hr.contract') for emp in self.browse(cr, uid, ids, context=context): - contract_ids = obj_contract.search(cr, uid, [('employee_id','=',emp.id),], order='date_start', context=context) + contract_ids = obj_contract.search(cr, uid, [('employee_id', '=', emp.id)], order='date_start', context=context) if contract_ids: res[emp.id] = contract_ids[-1:][0] else: @@ -65,26 +66,40 @@ class hr_contract_type(osv.osv): 'name': fields.char('Contract Type', required=True), } + class hr_contract(osv.osv): _name = 'hr.contract' _description = 'Contract' + _inherit = ['mail.thread', 'ir.needaction_mixin'] + + _track = { + 'state': { + 'hr_contract.mt_contract_pending': lambda self, cr, uid, obj, ctx=None: obj.state == 'pending', + 'hr_contract.mt_contract_close': lambda self, cr, uid, obj, ctx=None: obj.state == 'close', + }, + } + _columns = { 'name': fields.char('Contract Reference', required=True), 'employee_id': fields.many2one('hr.employee', "Employee", required=True), - 'department_id': fields.related('employee_id','department_id', type='many2one', relation='hr.department', string="Department", readonly=True), + 'department_id': fields.many2one('hr.department', string="Department"), 'type_id': fields.many2one('hr.contract.type', "Contract Type", required=True), 'job_id': fields.many2one('hr.job', 'Job Title'), 'date_start': fields.date('Start Date', required=True), 'date_end': fields.date('End Date'), 'trial_date_start': fields.date('Trial Start Date'), 'trial_date_end': fields.date('Trial End Date'), - 'working_hours': fields.many2one('resource.calendar','Working Schedule'), - 'wage': fields.float('Wage', digits=(16,2), required=True, help="Basic Salary of the employee"), + 'working_hours': fields.many2one('resource.calendar', 'Working Schedule'), + 'wage': fields.float('Wage', digits=(16, 2), required=True, help="Basic Salary of the employee"), 'advantages': fields.text('Advantages'), 'notes': fields.text('Notes'), 'permit_no': fields.char('Work Permit No', required=False, readonly=False), 'visa_no': fields.char('Visa No', required=False, readonly=False), 'visa_expire': fields.date('Visa Expire Date'), + 'state': fields.selection( + [('draft', 'New'), ('open', 'Running'), ('pending', 'To Renew'), ('close', 'Expired')], + string='Status', track_visibility='onchange', + help='Status of the contract'), } def _get_type(self, cr, uid, context=None): @@ -93,26 +108,33 @@ class hr_contract(osv.osv): _defaults = { 'date_start': lambda *a: time.strftime("%Y-%m-%d"), - 'type_id': _get_type + 'type_id': _get_type, + 'state': 'draft', } def onchange_employee_id(self, cr, uid, ids, employee_id, context=None): if not employee_id: - return {'value': {'job_id': False}} + return {'value': {'job_id': False, 'department_id': False}} emp_obj = self.pool.get('hr.employee').browse(cr, uid, employee_id, context=context) - job_id = False + job_id = dept_id = False if emp_obj.job_id: job_id = emp_obj.job_id.id - return {'value': {'job_id': job_id}} + if emp_obj.department_id: + dept_id = emp_obj.department_id.id + return {'value': {'job_id': job_id, 'department_id': dept_id}} def _check_dates(self, cr, uid, ids, context=None): for contract in self.read(cr, uid, ids, ['date_start', 'date_end'], context=context): - if contract['date_start'] and contract['date_end'] and contract['date_start'] > contract['date_end']: - return False + if contract['date_start'] and contract['date_end'] and contract['date_start'] > contract['date_end']: + return False return True _constraints = [ (_check_dates, 'Error! Contract start-date must be less than contract end-date.', ['date_start', 'date_end']) ] -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: + def set_as_pending(self, cr, uid, ids, context=None): + return self.write(cr, uid, ids, {'state': 'pending'}, context=context) + + def set_as_close(self, cr, uid, ids, context=None): + return self.write(cr, uid, ids, {'state': 'close'}, context=context) diff --git a/addons/hr_contract/hr_contract_data.xml b/addons/hr_contract/hr_contract_data.xml index 97200910188..bdb344fd0ef 100644 --- a/addons/hr_contract/hr_contract_data.xml +++ b/addons/hr_contract/hr_contract_data.xml @@ -15,5 +15,95 @@ Subcontractor + + + To Renew + hr.contract + + Contract about to expire + + + Expired + hr.contract + + Contract expired + + + + Contract to Renew + hr.department + + + department_id + Contract about to expire + + + + + Open Contracts + hr.contract + [('state', '=', 'open')] + + + + HR Contract: set as pending + + True + ir.actions.server + code + object.set_as_pending() + + + HR Contract: check for pending + + 50 + on_time + + + -7 + day + + + + HR Contract: check for pending + + 51 + on_time + + + -60 + day + + + + + HR Contract: set as close + + True + ir.actions.server + code + object.set_as_close() + + + HR Contract: check for close + + 52 + on_time + + 1 + day + + + + HR Contract: check for close + + 53 + on_time + + 1 + day + + + diff --git a/addons/hr_contract/hr_contract_view.xml b/addons/hr_contract/hr_contract_view.xml index 3c06c472f1f..f0e1510c07c 100644 --- a/addons/hr_contract/hr_contract_view.xml +++ b/addons/hr_contract/hr_contract_view.xml @@ -13,7 +13,7 @@ {'search_default_employee_id': [active_id], 'default_employee_id': active_id} - + hr.hr.employee.view.form2 hr.employee @@ -57,18 +57,22 @@ hr.contract - - - - - - - - - - - - + + + + + + + + + + + + + + + + @@ -77,6 +81,9 @@ hr.contract
+
+ +