diff --git a/addons/account/__openerp__.py b/addons/account/__openerp__.py index 1a222b2f83c..59d86351cd6 100644 --- a/addons/account/__openerp__.py +++ b/addons/account/__openerp__.py @@ -49,7 +49,7 @@ for a particular financial year and for preparation of vouchers there is a modul """, 'website': 'http://www.openerp.com', 'images' : ['images/accounts.jpeg','images/bank_statement.jpeg','images/cash_register.jpeg','images/chart_of_accounts.jpeg','images/customer_invoice.jpeg','images/journal_entries.jpeg'], - 'depends' : ['base_setup', 'product', 'analytic', 'process', 'board', 'edi', 'report'], + 'depends' : ['base_setup', 'product', 'analytic', 'board', 'edi', 'report'], 'data': [ 'security/account_security.xml', 'security/ir.model.access.csv', @@ -114,17 +114,12 @@ for a particular financial year and for preparation of vouchers there is a modul 'partner_view.xml', 'product_view.xml', 'account_assert_test.xml', - 'process/statement_process.xml', - 'process/customer_invoice_process.xml', - 'process/supplier_invoice_process.xml', 'ir_sequence_view.xml', 'company_view.xml', - 'board_account_view.xml', 'edi/invoice_action_data.xml', 'account_bank_view.xml', 'res_config_view.xml', 'account_pre_install.yml', - 'views/report_vat.xml', 'views/report_invoice.xml', 'views/report_trialbalance.xml', @@ -144,20 +139,12 @@ for a particular financial year and for preparation of vouchers there is a modul 'project/views/report_analyticcostledgerquantity.xml', 'project/views/report_analyticcostledger.xml', 'project/views/report_invertedanalyticbalance.xml', - ], - 'js': [ - 'static/src/js/account_move_reconciliation.js', - 'static/src/js/account_move_line_quickadd.js', + 'views/account.xml', ], 'qweb' : [ "static/src/xml/account_move_reconciliation.xml", "static/src/xml/account_move_line_quickadd.xml", ], - 'css':[ - 'static/src/css/account_move_reconciliation.css', - 'static/src/css/account_move_line_quickadd.css', - 'static/src/css/account_bank_and_cash.css', - ], 'demo': [ 'demo/account_demo.xml', 'project/project_demo.xml', diff --git a/addons/account/account.py b/addons/account/account.py index b87caf547ab..aa5d507b3d2 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -1944,15 +1944,17 @@ class account_tax(osv.osv): return super(account_tax, self).write(cr, uid, ids, vals, context=context) def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False): + if context is None: + context = {} journal_pool = self.pool.get('account.journal') - if context and context.has_key('type'): + if context.get('type'): if context.get('type') in ('out_invoice','out_refund'): args += [('type_tax_use','in',['sale','all'])] elif context.get('type') in ('in_invoice','in_refund'): args += [('type_tax_use','in',['purchase','all'])] - if context and context.has_key('journal_id'): + if context.get('journal_id'): journal = journal_pool.browse(cr, uid, context.get('journal_id')) if journal.type in ('sale', 'purchase'): args += [('type_tax_use','in',[journal.type,'all'])] diff --git a/addons/account/account_invoice.py b/addons/account/account_invoice.py index f7e561c8e24..1b4795f02a8 100644 --- a/addons/account/account_invoice.py +++ b/addons/account/account_invoice.py @@ -409,9 +409,7 @@ class account_invoice(osv.osv): ''' assert len(ids) == 1, 'This option should only be used for a single id at a time.' self.write(cr, uid, ids, {'sent': True}, context=context) - context2 = context.copy() - context2['active_ids'] = ids - return self.pool['report'].get_action(cr, uid, [], 'account.report_invoice', context=context2) + return self.pool['report'].get_action(cr, uid, [], 'account.report_invoice', context=context) def action_invoice_sent(self, cr, uid, ids, context=None): ''' @@ -1782,7 +1780,7 @@ class res_partner(osv.osv): """ Inherits partner and adds invoice information in the partner form """ _inherit = 'res.partner' _columns = { - 'invoice_ids': fields.one2many('account.invoice.line', 'partner_id', 'Invoices', readonly=True), + 'invoice_ids': fields.one2many('account.invoice', 'partner_id', 'Invoices', readonly=True), } def _find_accounting_partner(self, partner): diff --git a/addons/account/account_invoice_view.xml b/addons/account/account_invoice_view.xml index b521f3ff48c..61c397364b9 100644 --- a/addons/account/account_invoice_view.xml +++ b/addons/account/account_invoice_view.xml @@ -457,7 +457,7 @@ - + diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py index b48e842caf5..729c9d16b7a 100644 --- a/addons/account/account_move_line.py +++ b/addons/account/account_move_line.py @@ -430,6 +430,19 @@ class account_move_line(osv.osv): elif line.reconcile_partial_id: res[line.id] = str(line.reconcile_partial_id.name) return res + + def _get_move_from_reconcile(self, cr, uid, ids, context=None): + move = {} + for r in self.pool.get('account.move.reconcile').browse(cr, uid, ids, context=context): + for line in r.line_partial_ids: + move[line.move_id.id] = True + for line in r.line_id: + move[line.move_id.id] = True + move_line_ids = [] + if move: + move_line_ids = self.pool.get('account.move.line').search(cr, uid, [('journal_id','in',move.keys())], context=context) + return move_line_ids + _columns = { 'name': fields.char('Name', size=64, required=True), @@ -445,7 +458,8 @@ class account_move_line(osv.osv): 'statement_id': fields.many2one('account.bank.statement', 'Statement', help="The bank statement used for bank reconciliation", select=1), 'reconcile_id': fields.many2one('account.move.reconcile', 'Reconcile', readonly=True, ondelete='set null', select=2), 'reconcile_partial_id': fields.many2one('account.move.reconcile', 'Partial Reconcile', readonly=True, ondelete='set null', select=2), - 'reconcile': fields.function(_get_reconcile, type='char', string='Reconcile Ref'), + 'reconcile': fields.function(_get_reconcile, type='char', string='Reconcile Ref', store={ + 'account.move.line': (lambda self, cr, uid, ids, c={}: ids, ['reconcile_id','reconcile_partial_id'], 50),'account.move.reconcile': (_get_move_from_reconcile, None, 50)}), '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')), 'amount_residual_currency': fields.function(_amount_residual, string='Residual Amount in Currency', multi="residual", help="The residual amount on a receivable or payable of a journal entry expressed in its currency (maybe different of the company currency)."), 'amount_residual': fields.function(_amount_residual, string='Residual Amount', multi="residual", help="The residual amount on a receivable or payable of a journal entry expressed in the company currency."), @@ -628,7 +642,7 @@ class account_move_line(osv.osv): (_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']), (_check_currency, 'The selected account of your Journal Entry forces to provide a secondary currency. You should remove the secondary currency on the account or select a multi-currency view on the journal.', ['currency_id']), (_check_currency_and_amount, "You cannot create journal items with a secondary currency without recording both 'currency' and 'amount currency' field.", ['currency_id','amount_currency']), - (_check_currency_amount, 'The amount expressed in the secondary currency must be positive when the journal item is a debit and negative when if it is a credit.', ['amount_currency']), + (_check_currency_amount, 'The amount expressed in the secondary currency must be positive when account is debited and negative when account is credited.', ['amount_currency']), (_check_currency_company, "You cannot provide a secondary currency if it is the same than the company one." , ['currency_id']), ] @@ -1020,10 +1034,14 @@ class account_move_line(osv.osv): part_rec_ids = [rec['reconcile_partial_id'][0] for rec in part_recs] unlink_ids += rec_ids unlink_ids += part_rec_ids + all_moves = obj_move_line.search(cr, uid, ['|',('reconcile_id', 'in', unlink_ids),('reconcile_partial_id', 'in', unlink_ids)]) + all_moves = list(set(all_moves) - set(move_ids)) if unlink_ids: if opening_reconciliation: obj_move_rec.write(cr, uid, unlink_ids, {'opening_reconciliation': False}) obj_move_rec.unlink(cr, uid, unlink_ids) + if all_moves: + obj_move_line.reconcile_partial(cr, uid, all_moves, 'auto',context=context) return True def unlink(self, cr, uid, ids, context=None, check=True): diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index c29371e4c44..8e2cc6452c0 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -384,6 +384,7 @@ + @@ -881,6 +882,7 @@ + @@ -891,6 +893,12 @@ + + + + + + diff --git a/addons/account/board_account_view.xml b/addons/account/board_account_view.xml deleted file mode 100644 index abbc81ade2b..00000000000 --- a/addons/account/board_account_view.xml +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - Company Analysis - account.entries.report - form - tree,graph - {'group_by':['user_type'], 'group_by_no_leaf':1} - - [('year','=',time.strftime('%Y'))] - - - - board.account.form - board.board - -
- - - - - -
-
-
- - - Accounting - board.board - form - form - menu - - - - - -
-
diff --git a/addons/account/partner.py b/addons/account/partner.py index f24ffcf55b4..df4c1ec4888 100644 --- a/addons/account/partner.py +++ b/addons/account/partner.py @@ -162,6 +162,29 @@ class res_partner(osv.osv): def _debit_search(self, cr, uid, obj, name, args, context=None): return self._asset_difference_search(cr, uid, obj, name, 'payable', args, context=context) + def _invoice_total(self, cr, uid, ids, field_name, arg, context=None): + 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) + result[partner.id] = sum(inv.user_currency_price_total for inv in invoices) + return result + + def _journal_item_count(self, cr, uid, ids, field_name, arg, context=None): + res = dict(map(lambda x: (x,{'journal_item_count': 0, 'contracts_count': 0 }), ids)) + + # the user may not have access rights + try: + for partner in self.browse(cr, uid, ids, context=context): + res[partner.id] = { + 'journal_item_count': len(partner.journal_item_ids), + 'contracts_count': len(partner.contract_ids) + } + except: + pass + return res + def has_something_to_reconcile(self, cr, uid, partner_id, context=None): ''' at least a debit, a credit and a line older than the last reconciliation date of the partner @@ -190,6 +213,10 @@ 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'), + 'contracts_count': fields.function(_journal_item_count, string="Contracts", type='integer', multi="invoice_journal"), + 'journal_item_ids': fields.one2many('account.move.line', 'partner_id', 'Journal Items'), + 'journal_item_count': fields.function(_journal_item_count, string="Journal Items", type="integer", multi="invoice_journal"), 'property_account_payable': fields.property( type='many2one', relation='account.account', diff --git a/addons/account/partner_view.xml b/addons/account/partner_view.xml index 6a58bc7f77e..0fa21444a09 100644 --- a/addons/account/partner_view.xml +++ b/addons/account/partner_view.xml @@ -64,12 +64,21 @@ - + + @@ -97,7 +106,7 @@ - + @@ -127,7 +136,7 @@ - +

Accounting-related settings are managed on

diff --git a/addons/account/process/customer_invoice_process.xml b/addons/account/process/customer_invoice_process.xml deleted file mode 100644 index e45f8080518..00000000000 --- a/addons/account/process/customer_invoice_process.xml +++ /dev/null @@ -1,199 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/addons/account/process/statement_process.xml b/addons/account/process/statement_process.xml deleted file mode 100644 index 81b1748a6d4..00000000000 --- a/addons/account/process/statement_process.xml +++ /dev/null @@ -1,93 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/addons/account/process/supplier_invoice_process.xml b/addons/account/process/supplier_invoice_process.xml deleted file mode 100644 index b1d9de904aa..00000000000 --- a/addons/account/process/supplier_invoice_process.xml +++ /dev/null @@ -1,168 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/addons/account/project/project_view.xml b/addons/account/project/project_view.xml index e518d8899b2..6e25c46168f 100644 --- a/addons/account/project/project_view.xml +++ b/addons/account/project/project_view.xml @@ -31,7 +31,7 @@ - + diff --git a/addons/account/res_config.py b/addons/account/res_config.py index 8980a31927e..65f38d6e26b 100644 --- a/addons/account/res_config.py +++ b/addons/account/res_config.py @@ -259,6 +259,12 @@ class account_config_settings(osv.osv_memory): def onchange_tax_rate(self, cr, uid, ids, rate, context=None): return {'value': {'purchase_tax_rate': rate or False}} + def onchange_multi_currency(self, cr, uid, ids, group_multi_currency, context=None): + res = {} + if not group_multi_currency: + res['value'] = {'income_currency_exchange_account_id': False, 'expense_currency_exchange_account_id': False} + return res + def onchange_start_date(self, cr, uid, id, start_date): if start_date: start_date = datetime.datetime.strptime(start_date, "%Y-%m-%d") diff --git a/addons/account/res_config_view.xml b/addons/account/res_config_view.xml index 8a5b1978ecb..115566e9ab5 100644 --- a/addons/account/res_config_view.xml +++ b/addons/account/res_config_view.xml @@ -122,7 +122,7 @@