Skip to content

Commit

Permalink
[MERGE] forward port branch 9.0 up to eaf5465
Browse files Browse the repository at this point in the history
  • Loading branch information
KangOl committed Apr 5, 2018
2 parents e05b2d0 + eaf5465 commit f4326b4
Show file tree
Hide file tree
Showing 11 changed files with 91 additions and 13 deletions.
5 changes: 5 additions & 0 deletions addons/account_cash_basis_base_account/__init__.py
Original file line number Diff line number Diff line change
@@ -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
18 changes: 18 additions & 0 deletions addons/account_cash_basis_base_account/__openerp__.py
Original file line number Diff line number Diff line change
@@ -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,
}
Original file line number Diff line number Diff line change
@@ -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)
11 changes: 11 additions & 0 deletions addons/account_cash_basis_base_account/account_tax.py
Original file line number Diff line number Diff line change
@@ -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.')
15 changes: 15 additions & 0 deletions addons/account_cash_basis_base_account/views/account_tax_views.xml
Original file line number Diff line number Diff line change
@@ -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>
5 changes: 4 additions & 1 deletion addons/account_voucher/models/account_voucher.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,9 @@ def voucher_move_line_create(self, line_total, move_id, company_currency, curren
#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
Expand All @@ -302,7 +305,7 @@ def voucher_move_line_create(self, line_total, move_id, company_currency, curren
'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'),
}
Expand Down
20 changes: 10 additions & 10 deletions addons/l10n_ca/data/l10n_ca_chart_data.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,39 +29,39 @@

<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"/>
</record>

<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"/>
</record>

<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"/>
</record>

<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"/>
</record>

<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"/>
Expand All @@ -79,39 +79,39 @@

<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"/>
</record>

<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"/>
</record>

<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"/>
</record>

<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"/>
</record>

<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"/>
Expand Down
2 changes: 2 additions & 0 deletions addons/l10n_fr_pos_cert/models/account_bank_statement.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
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,))
Expand All @@ -15,6 +16,7 @@ def unlink(self):
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,))
Expand Down
2 changes: 1 addition & 1 deletion addons/purchase/test/fifo_price.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
-
Expand Down
2 changes: 1 addition & 1 deletion addons/stock_dropshipping/test/lifo_price.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 11 additions & 0 deletions doc/cla/individual/thomas-tankengine.md
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit f4326b4

Please sign in to comment.