diff --git a/addons/account/__init__.py b/addons/account/__init__.py index 98f7a7d5134..90fbdb83980 100644 --- a/addons/account/__init__.py +++ b/addons/account/__init__.py @@ -37,4 +37,6 @@ import ir_sequence import company import res_currency import edi +import res_config + # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/account/__openerp__.py b/addons/account/__openerp__.py index 850a8f49842..27aca6fb9fa 100644 --- a/addons/account/__openerp__.py +++ b/addons/account/__openerp__.py @@ -106,6 +106,7 @@ module named account_voucher. 'partner_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', @@ -125,6 +126,7 @@ module named account_voucher. 'board_account_view.xml', "edi/invoice_action_data.xml", "account_bank_view.xml", + "res_config_view.xml", "account_pre_install.yml" ], 'demo_xml': [ diff --git a/addons/account/account.py b/addons/account/account.py index 75bfc891980..26af7a5f9bd 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -2905,7 +2905,7 @@ class account_fiscal_position_template(osv.osv): obj_fiscal_position = self.pool.get('account.fiscal.position') fp_ids = self.search(cr, uid, [('chart_template_id', '=', chart_temp_id)]) for position in self.browse(cr, uid, fp_ids, context=context): - new_fp = obj_fiscal_position.create(cr, uid, {'company_id': company_id, 'name': position.name}) + new_fp = obj_fiscal_position.create(cr, uid, {'company_id': company_id, 'name': position.name, 'note': position.note}) for tax in position.tax_ids: obj_tax_fp.create(cr, uid, { 'tax_src_id': tax_template_ref[tax.tax_src_id.id], diff --git a/addons/account/account_analytic_line.py b/addons/account/account_analytic_line.py index da0bc96bda9..280b813380f 100644 --- a/addons/account/account_analytic_line.py +++ b/addons/account/account_analytic_line.py @@ -27,7 +27,7 @@ class account_analytic_line(osv.osv): _inherit = 'account.analytic.line' _description = 'Analytic Line' _columns = { - 'product_uom_id': fields.many2one('product.uom', 'UoM'), + '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'), 'move_id': fields.many2one('account.move.line', 'Move Line', ondelete='cascade', select=True), diff --git a/addons/account/account_bank_view.xml b/addons/account/account_bank_view.xml index 8d0b1aa5db3..6ee69184ce1 100644 --- a/addons/account/account_bank_view.xml +++ b/addons/account/account_bank_view.xml @@ -13,7 +13,7 @@ - + @@ -50,13 +50,5 @@ id="menu_action_bank_tree" action="action_bank_tree"/> - - - - - 4 - - - diff --git a/addons/account/account_end_fy.xml b/addons/account/account_end_fy.xml index 650bffc58e9..ecfc1c813b1 100644 --- a/addons/account/account_end_fy.xml +++ b/addons/account/account_end_fy.xml @@ -14,7 +14,7 @@ action="action_account_period_tree" id="menu_action_account_period_close_tree" parent="account.menu_account_end_year_treatments" - sequence="0" groups="base.group_extended"/> + sequence="0"/> diff --git a/addons/account/account_installer.xml b/addons/account/account_installer.xml index 430d65e0bf9..8c2865ea9b9 100644 --- a/addons/account/account_installer.xml +++ b/addons/account/account_installer.xml @@ -62,48 +62,5 @@ automatic - - Review your Financial Accounts - ir.actions.act_window - account.account - form - tree,form - {'config_invisible': False} - - - - - - - - - - Review your Financial Journals - ir.actions.act_window - account.journal - form - tree,form - Setup your accounting journals. For bank accounts, it's better to use the 'Setup Your Bank Accounts' tool that will automatically create the accounts and journals for you. - - - - - - - - - Review your Payment Terms - ir.actions.act_window - account.payment.term - form - tree,form - Payment terms define the conditions to pay a customer or supplier invoice in one or several payments. Customers periodic reminders will use the payment terms for each letter. Each customer or supplier can be assigned to one of these payment terms. - - - - - - - diff --git a/addons/account/account_invoice.py b/addons/account/account_invoice.py index 700936695b8..d0f7579a86e 100644 --- a/addons/account/account_invoice.py +++ b/addons/account/account_invoice.py @@ -178,6 +178,7 @@ class account_invoice(osv.osv): return invoice_ids _name = "account.invoice" + _inherit = ['mail.thread'] _description = 'Invoice' _order = "id desc" @@ -355,12 +356,8 @@ class account_invoice(osv.osv): context = {} try: res = super(account_invoice, self).create(cr, uid, vals, context) - for inv_id, name in self.name_get(cr, uid, [res], context=context): - ctx = context.copy() - if vals.get('type', 'in_invoice') in ('out_invoice', 'out_refund'): - ctx = self.get_log_context(cr, uid, context=ctx) - message = _("Invoice '%s' is waiting for validation.") % name - self.log(cr, uid, inv_id, message, context=ctx) + if res: + self.create_send_note(cr, uid, [res], context=context) return res except Exception, e: if '"journal_id" viol' in e.args[0]: @@ -373,9 +370,7 @@ class account_invoice(osv.osv): if context is None: context = {} self.write(cr, uid, ids, {'state':'paid'}, context=context) - for inv_id, name in self.name_get(cr, uid, ids, context=context): - message = _("Invoice '%s' is paid.") % name - self.log(cr, uid, inv_id, message) + self.confirm_paid_send_note(cr, uid, ids, context=context) return True def unlink(self, cr, uid, ids, context=None): @@ -472,15 +467,12 @@ class account_invoice(osv.osv): return result def onchange_payment_term_date_invoice(self, cr, uid, ids, payment_term_id, date_invoice): - if not payment_term_id: - return {} res = {} - pt_obj = self.pool.get('account.payment.term') + if not payment_term_id: + return res if not date_invoice: date_invoice = time.strftime('%Y-%m-%d') - - pterm_list = pt_obj.compute(cr, uid, payment_term_id, value=1, date_ref=date_invoice) - + pterm_list = self.pool.get('account.payment.term').compute(cr, uid, payment_term_id, value=1, date_ref=date_invoice) if pterm_list: pterm_list = [line[0] for line in pterm_list] pterm_list.sort() @@ -943,6 +935,11 @@ class account_invoice(osv.osv): move_obj.post(cr, uid, [move_id], context=ctx) self._log_event(cr, uid, ids) return True + + def invoice_validate(self, cr, uid, ids, context=None): + self.write(cr, uid, ids, {'state':'open'}, context=context) + self.invoice_validate_send_note(cr, uid, ids, context=context) + return True def line_get_convert(self, cr, uid, x, part, date, context=None): return { @@ -1033,6 +1030,7 @@ class account_invoice(osv.osv): # will be automatically deleted too account_move_obj.unlink(cr, uid, move_ids, context=context) self._log_event(cr, uid, ids, -1.0, 'Cancel Invoice') + self.invoice_cancel_send_note(cr, uid, ids, context=context) return True ################### @@ -1240,7 +1238,36 @@ class account_invoice(osv.osv): # Update the stored value (fields.function), so we write to trigger recompute self.pool.get('account.invoice').write(cr, uid, ids, {}, context=context) return True - + + # ----------------------------------------- + # OpenChatter notifications and need_action + # ----------------------------------------- + + def _get_document_type(self, type): + type_dict = { + 'out_invoice': 'Customer invoice', + 'in_invoice': 'Supplier invoice', + 'out_refund': 'Customer Refund', + 'in_refund': 'Supplier Refund', + } + return type_dict.get(type, 'Invoice') + + def create_send_note(self, cr, uid, ids, context=None): + for obj in self.browse(cr, uid, ids, context=context): + self.message_append_note(cr, uid, [obj.id],body=_("%s created.") % (self._get_document_type(obj.type)), context=context) + + def invoice_validate_send_note(self, cr, uid, ids, context=None): + for obj in self.browse(cr, uid, ids, context=context): + self.message_append_note(cr, uid, [obj.id], body=_("%s validated.") % (self._get_document_type(obj.type)), context=context) + + def confirm_paid_send_note(self, cr, uid, ids, context=None): + for obj in self.browse(cr, uid, ids, context=context): + self.message_append_note(cr, uid, [obj.id], body=_("%s paid.") % (self._get_document_type(obj.type)), context=context) + + def invoice_cancel_send_note(self, cr, uid, ids, context=None): + for obj in self.browse(cr, uid, ids, context=context): + self.message_append_note(cr, uid, [obj.id], body=_("%s cancelled.") % (self._get_document_type(obj.type)), context=context) + account_invoice() class account_invoice_line(osv.osv): diff --git a/addons/account/account_invoice_view.xml b/addons/account/account_invoice_view.xml index 6d499b4d3ad..5a9e808bf2d 100644 --- a/addons/account/account_invoice_view.xml +++ b/addons/account/account_invoice_view.xml @@ -39,7 +39,7 @@ - + @@ -53,14 +53,14 @@
-