diff --git a/addons/account/account.py b/addons/account/account.py index a0afbea6c08..6d6abd9226d 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -87,6 +87,13 @@ class AccountAccount(models.Model): # if res[account.id]: # account.has_unreconciled_entries = True + @api.multi + @api.constrains('internal_type', 'reconcile') + def _check_reconcile(self): + for account in self: + if account.internal_type in ('receivable', 'payable') and account.reconcile == False: + raise ValueError(_('You cannot have a receivable/payable account that is not reconciliable. (account code: %s)') % account.code) + name = fields.Char(required=True, index=True) currency_id = fields.Many2one('res.currency', string='Secondary Currency', help="Forces all moves for this account to have this secondary currency.") @@ -124,6 +131,11 @@ class AccountAccount(models.Model): accounts = self.search(domain + args, limit=limit) return accounts.name_get() + @api.onchange('internal_type') + def onchange_internal_type(self): + if self.internal_type in ('receivable', 'payable'): + self.reconcile = True + @api.multi @api.depends('name', 'code') def name_get(self): diff --git a/addons/account/account_bank_statement.py b/addons/account/account_bank_statement.py index 18d6098ebe2..866ad49c01d 100644 --- a/addons/account/account_bank_statement.py +++ b/addons/account/account_bank_statement.py @@ -21,8 +21,8 @@ class AccountCashboxLine(models.Model): """ Calculates Sub total""" self.subtotal = self.coin_value * self.number - coin_value = fields.Float(string='Unit of Currency', required=True, digits=0) - number = fields.Integer(string='Opening Number of Units', help='Opening Unit Numbers') + coin_value = fields.Float(string='Coin/Bill Value', required=True, digits=0) + number = fields.Integer(string='Number of Coins/Bills', help='Opening Unit Numbers') subtotal = fields.Float(compute='_sub_total', string='Subtotal', digits=0, readonly=True) cashbox_id = fields.Many2one('account.bank.statement.cashbox') @@ -178,7 +178,7 @@ class AccountBankStatement(models.Model): if context.get('cashbox_id'): context['active_id'] = self.id return { - 'name': _('Cashbox Entries'), + 'name': _('Cash Control'), 'view_type': 'form', 'view_mode': 'form', 'res_model': 'account.bank.statement.cashbox', diff --git a/addons/account/account_invoice.py b/addons/account/account_invoice.py index 7fc3ada5a9e..852965f40bc 100644 --- a/addons/account/account_invoice.py +++ b/addons/account/account_invoice.py @@ -195,7 +195,7 @@ class AccountInvoice(models.Model): move_name = fields.Char(string='Journal Entry', readonly=True, default=False, copy=False, help="Technical field holding the number given to the invoice, automatically set when the invoice is validated then stored to set the same number again if the invoice is cancelled, set to draft and re-validated.") - reference = fields.Char(string='Partner\'s Invoice Reference', + reference = fields.Char(string='Supplier Reference', help="The partner reference of this invoice.") reference_type = fields.Selection('_get_reference_type', string='Payment Reference', required=True, readonly=True, states={'draft': [('readonly', False)]}, diff --git a/addons/account/account_move.py b/addons/account/account_move.py index 47e9db39d74..aef371027a2 100644 --- a/addons/account/account_move.py +++ b/addons/account/account_move.py @@ -293,7 +293,7 @@ class AccountMoveLine(models.Model): counterpart = counterpart[0:2] + ["..."] self.counterpart = ",".join(counterpart) - name = fields.Char(required=True) + name = fields.Char(required=True, string="Label") quantity = fields.Float(digits=(16, 2), help="The optional quantity expressed by this line, eg: number of product sold. The quantity is not a legal requirement but is very useful for some reports.") product_uom_id = fields.Many2one('product.uom', string='Unit of Measure') @@ -333,7 +333,7 @@ class AccountMoveLine(models.Model): help="You can check this box to mark this journal item as a litigation with the associated partner") date_maturity = fields.Date(string='Due date', index=True, required=True, help="This field is used for payable and receivable journal entries. You can put the limit date for the payment of this line.") - date = fields.Date(related='move_id.date', string='Effective date', required=True, index=True, default=fields.Date.context_today, store=True, copy=False) + date = fields.Date(related='move_id.date', string='Date', required=True, index=True, default=fields.Date.context_today, store=True, copy=False) analytic_lines = fields.One2many('account.analytic.line', 'move_id', string='Analytic lines') tax_ids = fields.Many2many('account.tax', string='Taxes', copy=False, readonly=True) tax_line_id = fields.Many2one('account.tax', string='Originator tax', copy=False, readonly=True) diff --git a/addons/account/account_payment.py b/addons/account/account_payment.py index 7200708702c..7201e3a9bce 100644 --- a/addons/account/account_payment.py +++ b/addons/account/account_payment.py @@ -39,8 +39,8 @@ class account_abstract_payment(models.AbstractModel): amount = fields.Monetary(string='Payment Amount', required=True) currency_id = fields.Many2one('res.currency', string='Currency', required=True, default=lambda self: self.env.user.company_id.currency_id) payment_date = fields.Date(string='Payment Date', default=fields.Date.context_today, required=True, copy=False) - communication = fields.Char() - journal_id = fields.Many2one('account.journal', string='Bank Journal', required=True, domain=[('type', 'in', ('bank', 'cash'))]) + communication = fields.Char(string='Memo') + journal_id = fields.Many2one('account.journal', string='Payment Mode', required=True, domain=[('type', 'in', ('bank', 'cash'))]) company_id = fields.Many2one('res.company', related='journal_id.company_id', string='Company', readonly=True) hide_payment_method = fields.Boolean(compute='_compute_hide_payment_method', @@ -214,8 +214,8 @@ class account_payment(models.Model): invoice_ids = fields.Many2many('account.invoice', 'account_invoice_payment_rel', 'payment_id', 'invoice_id', string="Invoices", copy=False, readonly=True) has_invoices = fields.Boolean(compute="_get_has_invoices", help="Technical field used for usablity purposes") - payment_difference = fields.Float(compute='_compute_payment_difference', readonly=True) - payment_difference_handling = fields.Selection([('open', 'Keep Open'), ('reconcile', 'Reconcile Payment Balance')], default='open', string="Payment Difference", copy=False) + payment_difference = fields.Monetary(compute='_compute_payment_difference', readonly=True) + payment_difference_handling = fields.Selection([('open', 'Partial payment'), ('reconcile', 'Mark invoice as fully paid')], default='open', string="Payment Difference", copy=False) writeoff_account = fields.Many2one('account.account', string="Counterpart Account", domain=[('deprecated', '=', False)], copy=False) # FIXME: ondelete='restrict' not working (eg. cancel a bank statement reconciliation with a payment) diff --git a/addons/account/res_config.py b/addons/account/res_config.py index 6d539551744..8c229f21523 100644 --- a/addons/account/res_config.py +++ b/addons/account/res_config.py @@ -53,6 +53,7 @@ class AccountConfigSettings(models.TransientModel): sale_tax_rate = fields.Float(string='Sales tax (%)') purchase_tax_rate = fields.Float(string='Purchase tax (%)') bank_account_code_char = fields.Char(string='Bank Accounts Code', related='company_id.bank_account_code_char', help='Define the code for the bank account') + template_transfer_account_id = fields.Many2one('account.account.template', help="Intermediary account used when moving money from a liquidity account to another") transfer_account_id = fields.Many2one('account.account', related='company_id.transfer_account_id', domain=lambda self: [('reconcile', '=', True), ('user_type.id', '=', self.env.ref('account.data_account_type_current_assets').id)], @@ -212,7 +213,7 @@ class AccountConfigSettings(models.TransientModel): if self.chart_template_id.code_digits: self.code_digits = self.chart_template_id.code_digits if self.chart_template_id.transfer_account_id: - self.transfer_account_id = self.chart_template_id.transfer_account_id.id + self.template_transfer_account_id = self.chart_template_id.transfer_account_id.id if self.chart_template_id.bank_account_code_char: self.bank_account_code_char = self.chart_template_id.bank_account_code_char return {} @@ -246,6 +247,11 @@ class AccountConfigSettings(models.TransientModel): 'view_mode': 'form', } + @api.multi + def set_transfer_account(self): + if self.transfer_account_id and self.transfer_account_id != self.company_id.transfer_account_id: + self.company_id.write({'transfer_account_id': self.transfer_account_id.id}) + @api.multi def set_product_taxes(self): """ Set the product taxes if they have changed """ @@ -264,7 +270,7 @@ class AccountConfigSettings(models.TransientModel): wizard = self.env['wizard.multi.charts.accounts'].create({ 'company_id': self.company_id.id, 'chart_template_id': self.chart_template_id.id, - 'transfer_account_id': self.transfer_account_id.id, + 'transfer_account_id': self.template_transfer_account_id.id, 'code_digits': self.code_digits or 6, 'sale_tax': self.sale_tax.id, 'purchase_tax': self.purchase_tax.id, diff --git a/addons/account/static/src/xml/account_payment.xml b/addons/account/static/src/xml/account_payment.xml index 2f7d4f6e3be..3160f5018b7 100644 --- a/addons/account/static/src/xml/account_payment.xml +++ b/addons/account/static/src/xml/account_payment.xml @@ -22,7 +22,7 @@ - Paid on + Payment on diff --git a/addons/account/tests/test_search.py b/addons/account/tests/test_search.py index bea786cf521..7a8ceaef362 100644 --- a/addons/account/tests/test_search.py +++ b/addons/account/tests/test_search.py @@ -15,18 +15,21 @@ class TestSearch(AccountTestUsers): name="Tax Received", code="X121", user_type=ac_ids.id, + reconcile=True, )).id, "X121 Tax Received" self.apurchase = self.account_model.create(dict( name="Purchased Stocks", code="X1101", user_type=ac_ids.id, + reconcile=True, )).id, "X1101 Purchased Stocks" self.asale = self.account_model.create(dict( name="Product Sales", code="XX200", user_type=ac_ids.id, + reconcile=True, )).id, "XX200 Product Sales" self.all_ids = [self.atax[0], self.apurchase[0], self.asale[0]] diff --git a/addons/account/views/account_invoice_view.xml b/addons/account/views/account_invoice_view.xml index a2c3ef61854..97b32069818 100644 --- a/addons/account/views/account_invoice_view.xml +++ b/addons/account/views/account_invoice_view.xml @@ -122,9 +122,9 @@ account.invoice + - @@ -186,9 +186,9 @@ account.invoice + - @@ -223,7 +223,7 @@ @@ -364,7 +364,7 @@ diff --git a/addons/account/views/account_payment_view.xml b/addons/account/views/account_payment_view.xml index bb049f9bead..cd14deef6b7 100644 --- a/addons/account/views/account_payment_view.xml +++ b/addons/account/views/account_payment_view.xml @@ -90,7 +90,7 @@ - + @@ -111,6 +111,22 @@ + Payments + account.payment + form + tree,form,graph + {'default_payment_type': 'inbound'} + +

+ Click to register a payment +

+ Payments are used to register liquidity movements (send, collect or transfer money). + You can then process those payments by your own means or by using installed facilities. +

+
+
+ + Payments account.payment form @@ -125,8 +141,9 @@

+ - + account.payment.invoice.form @@ -155,14 +172,17 @@ +
-
@@ -206,7 +226,7 @@
-
diff --git a/addons/account/views/account_view.xml b/addons/account/views/account_view.xml index d77b19da961..fe689729957 100644 --- a/addons/account/views/account_view.xml +++ b/addons/account/views/account_view.xml @@ -333,7 +333,7 @@ - +
@@ -347,7 +347,7 @@ - Cashbox Entries + Cash Control account.bank.statement.cashbox form tree,form @@ -1061,6 +1061,7 @@ + @@ -1068,7 +1069,6 @@ - @@ -1230,13 +1230,13 @@ - - + + @@ -1816,7 +1816,6 @@ - @@ -1891,10 +1890,10 @@ account.financial.report.line + - diff --git a/addons/account/views/res_config_view.xml b/addons/account/views/res_config_view.xml index 04b906fe2eb..113c605fcbb 100644 --- a/addons/account/views/res_config_view.xml +++ b/addons/account/views/res_config_view.xml @@ -83,6 +83,10 @@