diff options
| author | Christophe Simonis <chs@odoo.com> | 2018-04-05 14:39:37 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2018-04-05 14:39:37 +0200 |
| commit | f4326b4dab3097e699114759da6ed6f24e04896d (patch) | |
| tree | b5781a1c689766f4e76c4e23cfee991d8b1f8573 /addons | |
| parent | e05b2d01d125051b6ef18fd7c5277e77bc3fd150 (diff) | |
| parent | eaf54656fcc1f50d76c4476f8a80856b0ef6da5a (diff) | |
[MERGE] forward port branch 9.0 up to eaf54656fcc
Diffstat (limited to 'addons')
10 files changed, 80 insertions, 13 deletions
diff --git a/addons/account_cash_basis_base_account/__init__.py b/addons/account_cash_basis_base_account/__init__.py new file mode 100644 index 00000000000..2971a2d9b7f --- /dev/null +++ b/addons/account_cash_basis_base_account/__init__.py @@ -0,0 +1,5 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +import account_tax +import account_partial_reconcile diff --git a/addons/account_cash_basis_base_account/__openerp__.py b/addons/account_cash_basis_base_account/__openerp__.py new file mode 100644 index 00000000000..1b012f8c7a0 --- /dev/null +++ b/addons/account_cash_basis_base_account/__openerp__.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. +{ + 'name' : 'Tax Cash Basis Edit Base Account', + 'version' : '1.0', + 'summary': 'Add a custom account to handle base amount lines', + 'sequence': 5, + 'description': """ +Move the cash basis lines to another account. + """, + 'category': 'Accounting', + 'depends': ['account_tax_cash_basis'], + 'data': [ + 'views/account_tax_views.xml', + ], + 'installable': True, + 'auto_install': True, +} diff --git a/addons/account_cash_basis_base_account/account_partial_reconcile.py b/addons/account_cash_basis_base_account/account_partial_reconcile.py new file mode 100644 index 00000000000..6e51ac61e7a --- /dev/null +++ b/addons/account_cash_basis_base_account/account_partial_reconcile.py @@ -0,0 +1,13 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from openerp import api, models + + +class AccountPartialReconcileCashBasis(models.Model): + _inherit = 'account.partial.reconcile' + + def _get_tax_cash_basis_base_account(self, line, tax): + if tax.cash_basis_base_account_id: + return tax.cash_basis_base_account_id + return super(AccountPartialReconcileCashBasis, self)._get_tax_cash_basis_base_account(line, tax) diff --git a/addons/account_cash_basis_base_account/account_tax.py b/addons/account_cash_basis_base_account/account_tax.py new file mode 100644 index 00000000000..d8b6c4ca87f --- /dev/null +++ b/addons/account_cash_basis_base_account/account_tax.py @@ -0,0 +1,11 @@ +# -*- coding: utf-8 -*- + +from openerp import api, fields, models + + +class AccountTax(models.Model): + _inherit = 'account.tax' + + cash_basis_base_account_id = fields.Many2one('account.account', domain=[('deprecated', '=', False)], + string='Base Tax Received Account', + help='Account that will be set on lines created in cash basis journal entry and used to keep track of the tax base amount.') diff --git a/addons/account_cash_basis_base_account/views/account_tax_views.xml b/addons/account_cash_basis_base_account/views/account_tax_views.xml new file mode 100644 index 00000000000..68b076bf853 --- /dev/null +++ b/addons/account_cash_basis_base_account/views/account_tax_views.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="utf-8"?> +<openerp> + <data> + <record id="view_tax_form_cash_basis_inherit" model="ir.ui.view"> + <field name="name">tax.form.cash.basis.base.account.inherit</field> + <field name="model">account.tax</field> + <field name="inherit_id" ref="account_tax_cash_basis.view_tax_form_cash_basis_inherit"/> + <field name="arch" type="xml"> + <xpath expr="//field[@name='cash_basis_account']" position="after"> + <field name="cash_basis_base_account_id" attrs="{'invisible': [('use_cash_basis', '=', False)]}"/> + </xpath> + </field> + </record> + </data> +</openerp> diff --git a/addons/account_voucher/models/account_voucher.py b/addons/account_voucher/models/account_voucher.py index 2dfcd06835a..b9dce93cdc9 100644 --- a/addons/account_voucher/models/account_voucher.py +++ b/addons/account_voucher/models/account_voucher.py @@ -286,6 +286,9 @@ class AccountVoucher(models.Model): #create one move line per voucher line where amount is not 0.0 if not line.price_subtotal: continue + line_subtotal = line.price_subtotal + if self.voucher_type == 'sale': + line_subtotal = -1 * line.price_subtotal # convert the amount set on the voucher line into the currency of the voucher's company # this calls res_curreny.compute() with the right context, # so that it will take either the rate on the voucher if it is relevant or will use the default behaviour @@ -302,7 +305,7 @@ class AccountVoucher(models.Model): 'debit': abs(amount) if self.voucher_type == 'purchase' else 0.0, 'date': self.account_date, 'tax_ids': [(4,t.id) for t in line.tax_ids], - 'amount_currency': line.price_subtotal if current_currency != company_currency else 0.0, + 'amount_currency': line_subtotal if current_currency != company_currency else 0.0, 'currency_id': company_currency != current_currency and current_currency or False, 'payment_id': self._context.get('payment_id'), } diff --git a/addons/l10n_ca/data/l10n_ca_chart_data.xml b/addons/l10n_ca/data/l10n_ca_chart_data.xml index 8610079a78f..64b7849d9f2 100644 --- a/addons/l10n_ca/data/l10n_ca_chart_data.xml +++ b/addons/l10n_ca/data/l10n_ca_chart_data.xml @@ -29,7 +29,7 @@ <record id="chart1181_en" model="account.account.template"> <field name="code">1181</field> - <field name="user_type_id" ref="account.data_account_type_current_liabilities"/> + <field name="user_type_id" ref="account.data_account_type_current_assets"/> <field name="reconcile" eval="False"/> <field name="name">GST receivable</field> <field name="chart_template_id" ref="ca_en_chart_template_en"/> @@ -37,7 +37,7 @@ <record id="chart1182_en" model="account.account.template"> <field name="code">1182</field> - <field name="user_type_id" ref="account.data_account_type_current_liabilities"/> + <field name="user_type_id" ref="account.data_account_type_current_assets"/> <field name="reconcile" eval="False"/> <field name="name">PST/QST receivable</field> <field name="chart_template_id" ref="ca_en_chart_template_en"/> @@ -45,7 +45,7 @@ <record id="chart11831_en" model="account.account.template"> <field name="code">11831</field> - <field name="user_type_id" ref="account.data_account_type_current_liabilities"/> + <field name="user_type_id" ref="account.data_account_type_current_assets"/> <field name="reconcile" eval="False"/> <field name="name">HST receivable - 13%</field> <field name="chart_template_id" ref="ca_en_chart_template_en"/> @@ -53,7 +53,7 @@ <record id="chart11832_en" model="account.account.template"> <field name="code">11832</field> - <field name="user_type_id" ref="account.data_account_type_current_liabilities"/> + <field name="user_type_id" ref="account.data_account_type_current_assets"/> <field name="reconcile" eval="False"/> <field name="name">HST receivable - 14%</field> <field name="chart_template_id" ref="ca_en_chart_template_en"/> @@ -61,7 +61,7 @@ <record id="chart11833_en" model="account.account.template"> <field name="code">11833</field> - <field name="user_type_id" ref="account.data_account_type_current_liabilities"/> + <field name="user_type_id" ref="account.data_account_type_current_assets"/> <field name="reconcile" eval="False"/> <field name="name">HST receivable - 15%</field> <field name="chart_template_id" ref="ca_en_chart_template_en"/> @@ -79,7 +79,7 @@ <record id="chart2131_en" model="account.account.template"> <field name="code">2131</field> - <field name="user_type_id" ref="account.data_account_type_current_assets"/> + <field name="user_type_id" ref="account.data_account_type_current_liabilities"/> <field name="reconcile" eval="False"/> <field name="name">GST to pay</field> <field name="chart_template_id" ref="ca_en_chart_template_en"/> @@ -87,7 +87,7 @@ <record id="chart2132_en" model="account.account.template"> <field name="code">2132</field> - <field name="user_type_id" ref="account.data_account_type_current_assets"/> + <field name="user_type_id" ref="account.data_account_type_current_liabilities"/> <field name="reconcile" eval="False"/> <field name="name">PST/QST to pay</field> <field name="chart_template_id" ref="ca_en_chart_template_en"/> @@ -95,7 +95,7 @@ <record id="chart21331_en" model="account.account.template"> <field name="code">21331</field> - <field name="user_type_id" ref="account.data_account_type_current_assets"/> + <field name="user_type_id" ref="account.data_account_type_current_liabilities"/> <field name="reconcile" eval="False"/> <field name="name">HST to pay - 13%</field> <field name="chart_template_id" ref="ca_en_chart_template_en"/> @@ -103,7 +103,7 @@ <record id="chart21332_en" model="account.account.template"> <field name="code">21332</field> - <field name="user_type_id" ref="account.data_account_type_current_assets"/> + <field name="user_type_id" ref="account.data_account_type_current_liabilities"/> <field name="reconcile" eval="False"/> <field name="name">HST to pay - 14%</field> <field name="chart_template_id" ref="ca_en_chart_template_en"/> @@ -111,7 +111,7 @@ <record id="chart21333_en" model="account.account.template"> <field name="code">21333</field> - <field name="user_type_id" ref="account.data_account_type_current_assets"/> + <field name="user_type_id" ref="account.data_account_type_current_liabilities"/> <field name="reconcile" eval="False"/> <field name="name">HST to pay - 15%</field> <field name="chart_template_id" ref="ca_en_chart_template_en"/> diff --git a/addons/l10n_fr_pos_cert/models/account_bank_statement.py b/addons/l10n_fr_pos_cert/models/account_bank_statement.py index 28afbf0d549..f0753885bc1 100644 --- a/addons/l10n_fr_pos_cert/models/account_bank_statement.py +++ b/addons/l10n_fr_pos_cert/models/account_bank_statement.py @@ -6,6 +6,7 @@ from openerp.exceptions import UserError class AccountBankStatement(models.Model): _inherit = 'account.bank.statement' + @api.multi def unlink(self): for statement in self.filtered(lambda s: s.company_id._is_accounting_unalterable() and s.journal_id.journal_user): raise UserError(_('You cannot modify anything on a bank statement (name: %s) that was created by point of sale operations.') % (statement.name,)) @@ -15,6 +16,7 @@ class AccountBankStatement(models.Model): class AccountBankStatementLine(models.Model): _inherit = 'account.bank.statement.line' + @api.multi def unlink(self): for line in self.filtered(lambda s: s.company_id._is_accounting_unalterable() and s.journal_id.journal_user): raise UserError(_('You cannot modify anything on a bank statement line (name: %s) that was created by point of sale operations.') % (line.name,)) diff --git a/addons/purchase/test/fifo_price.yml b/addons/purchase/test/fifo_price.yml index 29a6fea4e08..b6b1f8b26bc 100644 --- a/addons/purchase/test/fifo_price.yml +++ b/addons/purchase/test/fifo_price.yml @@ -3,7 +3,7 @@ - !python {model: res.company}: | company = self.env.ref('base.main_company') - company.currency_id = self.env.ref('base.EUR') + cr.execute("UPDATE res_company SET currency_id = %s WHERE id = %s", [ref('base.EUR'), company.id]) - Set a product as using fifo price - diff --git a/addons/stock_dropshipping/test/lifo_price.yml b/addons/stock_dropshipping/test/lifo_price.yml index 3cff45c24fa..6928d4854c0 100644 --- a/addons/stock_dropshipping/test/lifo_price.yml +++ b/addons/stock_dropshipping/test/lifo_price.yml @@ -2,7 +2,7 @@ Set the company currency as EURO for the sake of repeatibility - !python {model: res.company, id: base.main_company}: | - self.write({'currency_id':ref('base.EUR')}) + cr.execute("UPDATE res_company SET currency_id = %s WHERE id = %s", [ref('base.EUR'), ref('base.main_company')]) - Set product category removal strategy as LIFO |
