From 2989d843975472c19cc7c596dd3275f2e20e7e6a Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Wed, 22 Jul 2015 16:16:04 +0200 Subject: [PATCH 1/2] [FIX] website_sale: 'website_sale_options.website_sale' module name is use twice --- addons/website_sale_options/static/src/js/website_sale.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/website_sale_options/static/src/js/website_sale.js b/addons/website_sale_options/static/src/js/website_sale.js index 9e93f126366..4eb44603284 100644 --- a/addons/website_sale_options/static/src/js/website_sale.js +++ b/addons/website_sale_options/static/src/js/website_sale.js @@ -109,7 +109,7 @@ $('.oe_website_sale #add_to_cart, .oe_website_sale #products_grid .a-submit') }); -odoo.define('website_sale_options.website_sale', function(require) { +odoo.define('website_sale_options.cart', function(require) { "use strict"; require('website_sale.cart'); From 8ac40acb0d9a234eb59e55c3bc8f1a9a75bc4469 Mon Sep 17 00:00:00 2001 From: qdp-odoo Date: Wed, 22 Jul 2015 16:19:02 +0200 Subject: [PATCH 2/2] [IMP] account*: various usability improvements --- addons/account/models/account.py | 4 +-- .../account/models/account_bank_statement.py | 23 +++++++++++++-- addons/account/models/account_invoice.py | 29 +------------------ addons/account/models/company.py | 8 ++--- addons/account/models/res_config.py | 13 +++------ addons/account/security/account_security.xml | 4 --- addons/account/views/account_invoice_view.xml | 7 ++--- .../views/account_journal_dashboard_view.xml | 8 ++--- addons/account/views/account_view.xml | 20 +++++-------- addons/account/views/res_config_view.xml | 12 -------- .../account/wizard/account_invoice_refund.py | 11 +++++++ .../wizard/account_invoice_refund_view.xml | 9 +++--- .../wizard/account_validate_move_view.xml | 5 ++-- .../views/account_asset_view.xml | 12 ++++---- addons/account_budget/account_budget.py | 1 - addons/account_budget/account_budget_demo.yml | 2 -- addons/account_budget/account_budget_view.xml | 11 ++++--- .../tests/test_theoreticalamount.py | 1 - .../account_tax_python/account_tax_python.xml | 2 +- addons/payment/views/res_config_view.xml | 4 +++ .../payment_paypal/views/res_config_view.xml | 7 ++--- addons/portal_sale/res_config_view.xml | 13 +++++++-- .../pos_mercury/views/pos_mercury_views.xml | 13 --------- 23 files changed, 96 insertions(+), 123 deletions(-) diff --git a/addons/account/models/account.py b/addons/account/models/account.py index b66adefb388..611437a76c8 100644 --- a/addons/account/models/account.py +++ b/addons/account/models/account.py @@ -621,7 +621,7 @@ class AccountOperationTemplate(models.Model): name = fields.Char(string='Button Label', required=True) sequence = fields.Integer(required=True, default=10) - has_second_line = fields.Boolean(string='Second line', default=False) + has_second_line = fields.Boolean(string='Add a second line', default=False) company_id = fields.Many2one('res.company', string='Company', required=True, default=lambda self: self.env.user.company_id) account_id = fields.Many2one('account.account', string='Account', ondelete='cascade', domain=[('deprecated', '=', False)]) @@ -629,7 +629,7 @@ class AccountOperationTemplate(models.Model): label = fields.Char(string='Journal Item Label') amount_type = fields.Selection([ ('fixed', 'Fixed'), - ('percentage', 'Percentage of amount') + ('percentage', 'Percentage of balance') ], required=True, default='percentage') amount = fields.Float(digits=0, required=True, default=100.0, help="Fixed amount will count as a debit if it is negative, as a credit if it is positive.") tax_id = fields.Many2one('account.tax', string='Tax', ondelete='restrict', domain=[('type_tax_use', '=', 'purchase')]) diff --git a/addons/account/models/account_bank_statement.py b/addons/account/models/account_bank_statement.py index c568601370e..712efad80d7 100644 --- a/addons/account/models/account_bank_statement.py +++ b/addons/account/models/account_bank_statement.py @@ -98,6 +98,22 @@ class AccountBankStatement(models.Model): return journals[0] return False + @api.multi + def _set_opening_balance(self, journal_id): + last_bnk_stmt = self.search([('journal_id', '=', journal_id), ('state', '=', 'confirm')], order="date desc", limit=1) + for bank_stmt in self: + if last_bnk_stmt: + bank_stmt.balance_start = last_bnk_stmt.balance_end + else: + bank_stmt.balance_start = 0 + + @api.model + def _default_opening_balance(self): + #Search last bank statement and set current opening balance as closing balance of previous one + journal_id = self._context.get('default_journal_id', False) or self._context.get('journal_id', False) + if journal_id: + self._set_opening_balance(journal_id) + _name = "account.bank.statement" _description = "Bank Statement" _order = "date desc, id desc" @@ -106,7 +122,7 @@ class AccountBankStatement(models.Model): name = fields.Char(string='Reference', states={'open': [('readonly', False)]}, copy=False, readonly=True) date = fields.Date(required=True, states={'confirm': [('readonly', True)]}, select=True, copy=False, default=fields.Date.context_today) date_done = fields.Datetime(string="Closed On") - balance_start = fields.Monetary(string='Starting Balance', states={'confirm': [('readonly', True)]}) + balance_start = fields.Monetary(string='Starting Balance', states={'confirm': [('readonly', True)]}, default=_default_opening_balance) balance_end_real = fields.Monetary('Ending Balance', states={'confirm': [('readonly', True)]}) state = fields.Selection([('open', 'New'), ('confirm', 'Validated')], string='Status', required=True, readonly=True, copy=False, default='open') currency_id = fields.Many2one('res.currency', compute='_compute_currency', oldname='currency') @@ -127,6 +143,9 @@ class AccountBankStatement(models.Model): cashbox_end_id = fields.Many2one('account.bank.statement.cashbox') + @api.onchange('journal_id') + def onchange_journal_id(self): + self._set_opening_balance(self.journal_id.id) @api.multi def _balance_check(self): @@ -334,7 +353,7 @@ class AccountBankStatementLine(models.Model): name = fields.Char(string='Memo', required=True) date = fields.Date(required=True, default=lambda self: self._context.get('date', fields.Date.context_today(self))) amount = fields.Monetary(digits=0, currency_field='journal_currency_id') - journal_currency_id = fields.Many2one('res.currency', related='journal_id.currency_id', + journal_currency_id = fields.Many2one('res.currency', related='statement_id.currency_id', help='Utility field to express amount currency', readonly=True) partner_id = fields.Many2one('res.partner', string='Partner') bank_account_id = fields.Many2one('res.partner.bank', string='Bank Account') diff --git a/addons/account/models/account_invoice.py b/addons/account/models/account_invoice.py index a613adafbdf..bb86222a378 100644 --- a/addons/account/models/account_invoice.py +++ b/addons/account/models/account_invoice.py @@ -275,8 +275,6 @@ class AccountInvoice(models.Model): company_id = fields.Many2one('res.company', string='Company', change_default=True, required=True, readonly=True, states={'draft': [('readonly', False)]}, default=lambda self: self.env['res.company']._company_default_get('account.invoice')) - check_total = fields.Monetary(string='Verification Total', - readonly=True, states={'draft': [('readonly', False)]}, default=0.0) reconciled = fields.Boolean(string='Paid/Reconciled', store=True, readonly=True, compute='_compute_residual', help="It indicates that the invoice has been paid and the journal entry of the invoice has been reconciled with one or several journal entries of payment.") @@ -674,11 +672,6 @@ class AccountInvoice(models.Model): iml = inv.invoice_line_move_line_get() iml += inv.tax_line_move_line_get() - # I disabled the check_total feature - if self.env['res.users'].has_group('account.group_supplier_inv_check_total'): - if inv.type in ('in_invoice', 'in_refund') and abs(inv.check_total - inv.amount_total) >= (inv.currency_id.rounding / 2.0): - raise UserError(_('Please verify the price of the invoice!\nThe encoded total does not match the computed total.')) - diff_currency = inv.currency_id != company_currency # create one move line for the total and possibly adjust the other lines amount total, total_currency, iml = inv.with_context(ctx).compute_invoice_totals(company_currency, iml) @@ -993,25 +986,6 @@ class AccountInvoiceLine(models.Model): sign = self.invoice_id.type in ['in_refund', 'out_refund'] and -1 or 1 self.price_subtotal_signed = price_subtotal_signed * sign - @api.model - def _default_price_unit(self): - if not self._context.get('check_total'): - return 0 - currency = self.invoice_id and self.invoice_id.currency_id or None - total = self._context['check_total'] - for l in self._context.get('invoice_line_ids', []): - if isinstance(l, (list, tuple)) and len(l) >= 3 and l[2]: - vals = l[2] - price = vals.get('price_unit', 0) * (1 - vals.get('discount', 0) / 100.0) - total = total - (price * vals.get('quantity')) - taxes = vals.get('invoice_line_tax_ids') - if taxes and len(taxes[0]) >= 3 and taxes[0][2]: - taxes = self.env['account.tax'].browse(taxes[0][2]) - tax_res = taxes.compute_all(price, currency, vals.get('quantity'), vals.get('product_id'), self._context.get('partner_id')) - for tax in tax_res['taxes']: - total = total - tax['amount'] - return total - @api.model def _default_account(self): if self._context.get('journal_id'): @@ -1035,8 +1009,7 @@ class AccountInvoiceLine(models.Model): required=True, domain=[('deprecated', '=', False)], default=_default_account, help="The income or expense account related to the selected product.") - price_unit = fields.Monetary(string='Unit Price', required=True, - default=_default_price_unit) + price_unit = fields.Monetary(string='Unit Price', required=True) price_subtotal = fields.Monetary(string='Amount', store=True, readonly=True, compute='_compute_price') price_subtotal_signed = fields.Monetary(string='Amount Signed', currency_field='company_currency_id', diff --git a/addons/account/models/company.py b/addons/account/models/company.py index 99d6a7da4d4..1d10af65b34 100644 --- a/addons/account/models/company.py +++ b/addons/account/models/company.py @@ -10,10 +10,10 @@ class ResCompany(models.Model): #TODO check all the options/fields are in the views (settings + company form view) fiscalyear_last_day = fields.Integer(default=31, required=True) fiscalyear_last_month = fields.Selection([(1, 'January'), (2, 'February'), (3, 'March'), (4, 'April'), (5, 'May'), (6, 'June'), (7, 'July'), (8, 'August'), (9, 'September'), (10, 'October'), (11, 'November'), (12, 'December')], default=12, required=True) - period_lock_date = fields.Date(help="Only users with the 'Adviser' role can edit accounts prior to and inclusive of this date") - fiscalyear_lock_date = fields.Date(string="Fiscal Year lock date", help="No users, including Advisers, can edit accounts prior to and inclusive of this date") + period_lock_date = fields.Date(string="Lock Date for Non-Advisers", help="Only users with the 'Adviser' role can edit accounts prior to and inclusive of this date. Use it for period locking inside an open fiscal year, for example.") + fiscalyear_lock_date = fields.Date(string="Lock Date", help="No users, including Advisers, can edit accounts prior to and inclusive of this date. Use it for fiscal year locking for example.") transfer_account_id = fields.Many2one('account.account', - domain=lambda self: [('reconcile', '=', True), ('user_type_id.id', '=', self.env.ref('account.data_account_type_current_assets').id), ('deprecated', '=', False)], string="Transfer Account", help="Intermediary account used when moving money from a liquidity account to another") + domain=lambda self: [('reconcile', '=', True), ('user_type_id.id', '=', self.env.ref('account.data_account_type_current_assets').id), ('deprecated', '=', False)], string="Inter-Banks Transfer Account", help="Intermediary account used when moving money from a liquidity account to another") expects_chart_of_accounts = fields.Boolean(string='Expects a Chart of Accounts', default=True) chart_template_id = fields.Many2one('account.chart.template', help='The chart template for the company (if any)') bank_account_code_prefix = fields.Char(string='Prefix of the bank accounts', oldname="bank_account_code_char") @@ -25,7 +25,7 @@ class ResCompany(models.Model): ], default='round_per_line', string='Tax Calculation Rounding Method', help="If you select 'Round per Line' : for each tax, the tax amount will first be computed and rounded for each PO/SO/invoice line and then these rounded amounts will be summed, leading to the total amount for that tax. If you select 'Round Globally': for each tax, the tax amount will be computed for each PO/SO/invoice line, then these amounts will be summed and eventually this total tax amount will be rounded. If you sell with tax included, you should choose 'Round per line' because you certainly want the sum of your tax-included line subtotals to be equal to the total amount with taxes.") paypal_account = fields.Char(string='Paypal Account', size=128, help="Paypal username (usually email) for receiving online payments.") - currency_exchange_journal_id = fields.Many2one('account.journal', string="Currency Adjustments Journal", domain=[('type', '=', 'general')]) + currency_exchange_journal_id = fields.Many2one('account.journal', string="Exchange Gain or Loss Journal", domain=[('type', '=', 'general')]) income_currency_exchange_account_id = fields.Many2one('account.account', related='currency_exchange_journal_id.default_credit_account_id', string="Gain Exchange Rate Account", domain="[('internal_type', '=', 'other'), ('deprecated', '=', False), ('company_id', '=', id)]") expense_currency_exchange_account_id = fields.Many2one('account.account', related='currency_exchange_journal_id.default_debit_account_id', diff --git a/addons/account/models/res_config.py b/addons/account/models/res_config.py index be8fdfa3cf3..4de26a02943 100644 --- a/addons/account/models/res_config.py +++ b/addons/account/models/res_config.py @@ -66,8 +66,8 @@ class AccountConfigSettings(models.TransientModel): fiscalyear_last_day = fields.Integer(related='company_id.fiscalyear_last_day', default=31) fiscalyear_last_month = fields.Selection([(1, 'January'), (2, 'February'), (3, 'March'), (4, 'April'), (5, 'May'), (6, 'June'), (7, 'July'), (8, 'August'), (9, 'September'), (10, 'October'), (11, 'November'), (12, 'December')], related='company_id.fiscalyear_last_month', default=12) - period_lock_date = fields.Date(related='company_id.period_lock_date', help="Only users with the 'Adviser' role can edit accounts prior to and inclusive of this date") - fiscalyear_lock_date = fields.Date(string="Fiscal Year lock date", related='company_id.fiscalyear_lock_date', help="No users, including Advisers, can edit accounts prior to and inclusive of this date") + period_lock_date = fields.Date(string="Lock Date for Non-Advisers", related='company_id.period_lock_date', help="Only users with the 'Adviser' role can edit accounts prior to and inclusive of this date. Use it for period locking inside an open fiscal year, for example.") + fiscalyear_lock_date = fields.Date(string="Lock Date", related='company_id.fiscalyear_lock_date', help="No users, including Advisers, can edit accounts prior to and inclusive of this date. Use it for fiscal year locking for example.") module_account_check_writing = fields.Boolean(string='Pay your vendors by check', help='This allows you to check writing and printing.\n' @@ -87,9 +87,6 @@ class AccountConfigSettings(models.TransientModel): 'Once the master budgets and the budgets are defined, ' 'the project managers can set the planned amount on each analytic account.\n' '-This installs the module account_budget.') - module_product_email_template = fields.Boolean(string='Send products tools and information at the invoice confirmation', - help='With this module, link your products to a template to send complete information and tools to your customer.\n' - 'For instance when invoicing a training, the training agenda and materials will automatically be send to your customers.') module_account_bank_statement_import_ofx = fields.Boolean(string='Import of Bank Statements in .OFX Format', help='Get your bank statements from you bank and import them in Odoo in .OFX format.\n' '-that installs the module account_bank_statement_import.') @@ -99,16 +96,14 @@ class AccountConfigSettings(models.TransientModel): group_proforma_invoices = fields.Boolean(string='Allow pro-forma invoices', implied_group='account.group_proforma_invoices', help="Allows you to put invoices in pro-forma state.") - default_sale_tax_id = fields.Many2one('account.tax', help="This sale tax will be assigned by default on new products.", oldname="default_sale_tax") - default_purchase_tax_id = fields.Many2one('account.tax', help="This purchase tax will be assigned by default on new products.", oldname="default_purchase_tax") + default_sale_tax_id = fields.Many2one('account.tax', string="Default Sale Tax", help="This sale tax will be assigned by default on new products.", oldname="default_sale_tax") + default_purchase_tax_id = fields.Many2one('account.tax', string="Default Purchase Tax", help="This purchase tax will be assigned by default on new products.", oldname="default_purchase_tax") group_multi_currency = fields.Boolean(string='Allow multi currencies', implied_group='base.group_multi_currency', help="Allows you multi currency environment") group_analytic_accounting = fields.Boolean(string='Analytic accounting', implied_group='analytic.group_analytic_accounting', help="Allows you to use the analytic accounting.") - group_check_supplier_invoice_total = fields.Boolean(string='Check the total of vendor bills', - implied_group="account.group_supplier_inv_check_total") currency_exchange_journal_id = fields.Many2one('account.journal', related='company_id.currency_exchange_journal_id', string="Rate Difference Journal",) diff --git a/addons/account/security/account_security.xml b/addons/account/security/account_security.xml index f58c77bb71d..5547e561cac 100644 --- a/addons/account/security/account_security.xml +++ b/addons/account/security/account_security.xml @@ -26,10 +26,6 @@ - - Check Total on supplier bills - - diff --git a/addons/account/views/account_invoice_view.xml b/addons/account/views/account_invoice_view.xml index 7a7a0ad9a4f..a8d0e24675a 100644 --- a/addons/account/views/account_invoice_view.xml +++ b/addons/account/views/account_invoice_view.xml @@ -247,7 +247,6 @@ - @@ -317,7 +316,7 @@ - + @@ -351,7 +350,7 @@