[MERGE] forward port branch 9.0 up to eaf54656fc

This commit is contained in:
Christophe Simonis
2018-04-05 14:39:37 +02:00
11 changed files with 91 additions and 13 deletions
@@ -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
@@ -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,
}
@@ -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)
@@ -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.')
@@ -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>
@@ -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'),
}
+10 -10
View File
@@ -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"/>
@@ -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,))
+1 -1
View File
@@ -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
-
@@ -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
+11
View File
@@ -0,0 +1,11 @@
France, 2018-04-04,
I hereby agree to the terms of the Odoo Individual Contributor License
Agreement v1.0.
I declare that I am authorized and able to make this agreement and sign this
declaration.
Signed,
Thomas Lemaire thomas.lemaire@ndp-systemes.fr https://github.com/thomas-tankengine