[MERGE] forward port of branch saas-6 up to bf1e999

This commit is contained in:
Christophe Simonis
2015-05-28 14:27:38 +02:00
290 changed files with 4609 additions and 1979 deletions
+1
View File
@@ -5,6 +5,7 @@ import math
from openerp.osv import expression
from openerp.tools.float_utils import float_round as round
from openerp.tools.safe_eval import safe_eval as eval
from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT
from openerp.exceptions import UserError
from openerp import api, fields, models, _
+2
View File
@@ -2,11 +2,13 @@
from openerp import api, fields, models, _
from openerp.osv import expression
from openerp.tools import float_is_zero
from openerp.tools import float_compare, float_round
from openerp.tools.misc import formatLang
from openerp.exceptions import UserError, ValidationError
import time
import math
class AccountCashboxLine(models.Model):
""" Cash Box Details """
+1 -1
View File
@@ -95,7 +95,7 @@ class AccountInvoice(models.Model):
if line.account_id.internal_type in ('receivable', 'payable'):
residual_signed += line.amount_residual * sign
if line.currency_id == self.currency_id:
residual += line.currency_id and line.amount_residual_currency or line.amount_residual
residual += line.amount_residual_currency if line.currency_id else line.amount_residual
else:
from_currency = (line.currency_id and line.currency_id.with_context(date=line.date)) or line.company_id.currency_id.with_context(date=line.date)
residual += from_currency.compute(line.amount_residual, self.currency_id)
@@ -158,18 +158,23 @@ class AccountInvoiceReport(models.Model):
# self._table = account_invoice_report
tools.drop_view_if_exists(cr, self._table)
cr.execute("""CREATE or REPLACE VIEW %s as (
WITH currency_rate (currency_id, rate, date_start, date_end) AS (
SELECT r.currency_id, r.rate, r.name AS date_start,
(SELECT name FROM res_currency_rate r2
WHERE r2.name > r.name AND
r2.currency_id = r.currency_id
ORDER BY r2.name ASC
LIMIT 1) AS date_end
FROM res_currency_rate r
)
%s
FROM (
%s %s %s
) AS sub
JOIN res_currency_rate cr ON (cr.currency_id = sub.currency_id)
WHERE
cr.id IN (SELECT id
FROM res_currency_rate cr2
WHERE (cr2.currency_id = sub.currency_id)
AND ((sub.date IS NOT NULL AND cr2.name <= sub.date)
OR (sub.date IS NULL AND cr2.name <= NOW()))
ORDER BY name DESC LIMIT 1)
JOIN currency_rate cr ON
(cr.currency_id = sub.currency_id AND
cr.date_start <= COALESCE(sub.date, NOW()) AND
(cr.date_end IS NULL OR cr.date_end > COALESCE(sub.date, NOW())))
)""" % (
self._table,
self._select(), self._sub_select(), self._from(), self._group_by()))
+5 -3
View File
@@ -83,9 +83,11 @@ class AccountConfigSettings(models.TransientModel):
module_account_accountant = fields.Boolean(string='Full accounting features: journals, legal statements, chart of accounts, etc.',
help="""If you do not check this box, you will be able to do invoicing & payments,
but not accounting (Journal Items, Chart of Accounts, ...)""")
module_account_asset = fields.Boolean(string='Assets management',
help='This allows you to manage the assets owned by a company or a person.\n'
'It keeps track of the depreciation occurred on those assets, and creates account move for those depreciation lines.\n'
module_account_asset = fields.Boolean(string='Assets management & Revenue recognition',
help='Asset management: This allows you to manage the assets owned by a company or a person.'
'It keeps track of the depreciation occurred on those assets, and creates account move for those depreciation lines.\n\n'
'Revenue recognition: This allows you to manage the Revenue recognition on selling product.'
'It keeps track of the installment occurred on those revenue recognition, and creates account move for those installment lines.\n'
'-This installs the module account_asset. If you do not check this box, you will be able to do invoicing & payments, '
'but not accounting (Journal Items, Chart of Accounts, ...)')
module_account_budget = fields.Boolean(string='Budget management',
@@ -560,11 +560,10 @@ $aestetic_animation_speed: 300ms;
}
&.add_line_container {
&:nth-child(2n+1) {
width: 98%;
float: none;
margin: auto;
}
width: 98%;
float: none;
clear: both;
margin: auto;
td {
text-align: center;
@@ -1853,10 +1853,11 @@ var bankStatementReconciliationLine = abstractReconciliationLine.extend({
changePartnerClickHandler: function() {
var self = this;
self.$(".change_partner_container").find("input").attr("placeholder", self.st_line.partner_name);
self.$(".change_partner_container").show();
self.$(".partner_name").hide();
self.change_partner_field.$drop_down.trigger("click");
$.when(self.changePartner(false)).then(function(){
self.$(".change_partner_container").show();
self.$(".partner_name").hide();
self.change_partner_field.$drop_down.trigger("click");
})
},
+15
View File
@@ -54,3 +54,18 @@ class TestSearch(AccountTestUsers):
asale_ids = self.account_model.name_search(name='XX200', operator='ilike', args=[('id', 'in', self.all_ids)])
self.assertEqual(set([self.asale[0]]), set([a[0] for a in asale_ids]), "name_search 'ilike XX200' should have returned Product Sales account only")
def test_property_unset_search(self):
cr, uid = self.cr, self.uid
res_partner_model = self.registry('res.partner')
account_payment_term_model = self.registry('account.payment.term')
a_partner = res_partner_model.create(cr, uid, {'name': 'test partner'})
a_payment_term = account_payment_term_model.create(cr, uid, {'name': 'test payment term'})
partner_ids = res_partner_model.search(cr, uid, [('property_payment_term', '=', False), ('id', '=', a_partner)])
self.assertTrue(partner_ids, "unset property field 'propety_payment_term' should have been found")
res_partner_model.write(cr, uid, [a_partner], {'property_payment_term': a_payment_term})
partner_ids = res_partner_model.search(cr, uid, [('property_payment_term', '=', False), ('id', '=', a_partner)])
self.assertFalse(partner_ids, "set property field 'propety_payment_term' should not have been found")
@@ -545,7 +545,7 @@
<field name="view_mode">tree,form,calendar,graph</field>
<field name="view_id" ref="invoice_tree"/>
<field name="domain">[('type','in', ['out_invoice', 'out_refund']), ('state', 'not in', ['draft', 'cancel'])]</field>
<field name="context">{'type':False}</field>
<field name="context">{'default_type':'out_invoice', 'type':'out_invoice', 'journal_type': 'sale'}</field>
<field name="search_view_id" ref="view_account_invoice_filter"/>
</record>
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
from openerp import models, fields, api, _
from openerp.tools.safe_eval import safe_eval as eval
from openerp.exceptions import UserError
@@ -669,34 +669,36 @@ class account_analytic_account(osv.osv):
context = context or {}
journal_obj = self.pool.get('account.journal')
fpos_obj = self.pool['account.fiscal.position']
partner = contract.partner_id
if not contract.partner_id:
if not partner:
raise UserError(_("You must first select a Customer for Contract %s!") % contract.name )
fpos = contract.partner_id.property_account_position or False
fpos_id = fpos_obj.get_fiscal_position(cr, uid, partner.company_id.id, partner.id, context=context)
journal_ids = journal_obj.search(cr, uid, [('type', '=','sale'),('company_id', '=', contract.company_id.id or False)], limit=1)
if not journal_ids:
raise UserError(_('Please define a sale journal for the company "%s".') % (contract.company_id.name or '', ))
partner_payment_term = contract.partner_id.property_payment_term and contract.partner_id.property_payment_term.id or False
partner_payment_term = partner.property_payment_term and partner.property_payment_term.id or False
currency_id = False
if contract.pricelist_id:
currency_id = contract.pricelist_id.currency_id.id
elif contract.partner_id.property_product_pricelist:
currency_id = contract.partner_id.property_product_pricelist.currency_id.id
elif partner.property_product_pricelist:
currency_id = partner.property_product_pricelist.currency_id.id
elif contract.company_id:
currency_id = contract.company_id.currency_id.id
invoice = {
'account_id': contract.partner_id.property_account_receivable.id,
'account_id': partner.property_account_receivable.id,
'type': 'out_invoice',
'partner_id': contract.partner_id.id,
'partner_id': partner.id,
'currency_id': currency_id,
'journal_id': len(journal_ids) and journal_ids[0] or False,
'date_invoice': contract.recurring_next_date,
'origin': contract.code,
'fiscal_position_id': fpos and fpos.id,
'fiscal_position_id': fpos_id,
'payment_term_id': partner_payment_term,
'company_id': contract.company_id.id or False,
}
+1 -20
View File
@@ -1,23 +1,4 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
# -*- coding: utf-8 -*-
import account_asset
import account_asset_invoice
+22 -38
View File
@@ -1,36 +1,20 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
# -*- coding: utf-8 -*-
{
'name': 'Assets Management',
'name': 'Assets & Revenue Recognitions Management',
'version': '1.0',
'depends': ['account'],
'author': 'OpenERP S.A.',
'depends': ['account_accountant'],
'author': 'Odoo S.A.',
'description': """
Financial and accounting asset management.
==========================================
Assets management
=================
Manage assets owned by a company or a person.
Keeps track of depreciations, and creates corresponding journal entries.
This Module manages the assets owned by a company or an individual. It will keep
track of depreciation's occurred on those assets. And it allows to create Move's
of the depreciation lines.
Revenue recognition
===================
Manage revenue recognition on product sales.
Keeps track of the revenue recognition installments, and creates corresponding journal entries.
""",
'website': 'https://www.odoo.com/page/accounting',
@@ -39,23 +23,23 @@ of the depreciation lines.
'demo': [
'account_asset_demo.yml',
],
'test': [
'../account/test/account_minimal_test.xml',
'test/account_asset_demo_test.xml',
'test/account_asset_demo.yml',
'test/account_asset.yml',
'test/account_asset_wizard.yml',
],
# 'test': [
# '../account/test/account_minimal_test.xml',
# 'test/account_asset_demo_test.xml',
# ],
'data': [
'security/account_asset_security.xml',
'security/ir.model.access.csv',
'wizard/account_asset_change_duration_view.xml',
'wizard/wizard_asset_compute_view.xml',
'account_asset_view.xml',
'account_asset_invoice_view.xml',
'views/account_asset_view.xml',
'views/account_asset_invoice_view.xml',
'report/account_asset_report_view.xml',
'views/account_asset.xml',
],
'qweb': [
"static/src/xml/account_asset_template.xml",
],
'auto_install': False,
'installable': True,
'application': False,
}
+334 -336
View File
@@ -1,335 +1,313 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
# -*- coding: utf-8 -*-
import time
from datetime import datetime
from datetime import date, datetime
from dateutil.relativedelta import relativedelta
from openerp.osv import fields, osv
import openerp.addons.decimal_precision as dp
from openerp.tools.translate import _
from openerp.exceptions import UserError
from openerp import api, fields, models, _
from openerp.exceptions import UserError, ValidationError
from openerp.tools import DEFAULT_SERVER_DATE_FORMAT as DF
class account_asset_category(osv.osv):
class AccountAssetCategory(models.Model):
_name = 'account.asset.category'
_description = 'Asset category'
_columns = {
'name': fields.char('Name', required=True, select=1),
'note': fields.text('Note'),
'account_analytic_id': fields.many2one('account.analytic.account', 'Analytic account'),
'account_asset_id': fields.many2one('account.account', 'Asset Account', required=True, domain=[('internal_type','=','other'), ('deprecated', '=', False)]),
'account_depreciation_id': fields.many2one('account.account', 'Depreciation Account', required=True, domain=[('internal_type','=','other'), ('deprecated', '=', False)]),
'account_expense_depreciation_id': fields.many2one('account.account', 'Depr. Expense Account', required=True, domain=[('internal_type','=','other'), ('deprecated', '=', False)]),
'journal_id': fields.many2one('account.journal', 'Journal', required=True),
'company_id': fields.many2one('res.company', 'Company', required=True),
'method': fields.selection([('linear','Linear: Computed on basis of Gross Value / Number of Depreciations'),('degressive','Degressive: Computed on basis of Residual Value * Degressive Factor')], 'Computation Method', required=True, help="Choose the method to use to compute the amount of depreciation lines.\n"\
" * Linear: Calculated on basis of: Gross Value / Number of Depreciations\n" \
" * Degressive: Calculated on basis of: Residual Value * Degressive Factor"),
'method_number': fields.integer('Number of Depreciations', help="The number of depreciations needed to depreciate your asset"),
'method_period': fields.integer('Period Length', help="State here the time between 2 depreciations, in months", required=True),
'method_progress_factor': fields.float('Degressive Factor'),
'method_time': fields.selection([('number','Number of Depreciations'),('end','Ending Date')], 'Time Method', required=True,
help="Choose the method to use to compute the dates and number of depreciation lines.\n"\
" * Number of Depreciations: Fix the number of depreciation lines and the time between 2 depreciations.\n" \
" * Ending Date: Choose the time between 2 depreciations and the date the depreciations won't go beyond."),
'method_end': fields.date('Ending date'),
'prorata':fields.boolean('Prorata Temporis', help='Indicates that the first depreciation entry for this asset have to be done from the purchase date instead of the first January'),
'open_asset': fields.boolean('Skip Draft State', help="Check this if you want to automatically confirm the assets of this category when created by invoices."),
}
active = fields.Boolean(default=True)
name = fields.Char(required=True, index=True)
note = fields.Text()
account_analytic_id = fields.Many2one('account.analytic.account', string='Analytic Account')
account_asset_id = fields.Many2one('account.account', string='Asset Account', required=True, domain=[('internal_type','=','other'), ('deprecated', '=', False)])
account_income_recognition_id = fields.Many2one('account.account', string='Recognition Income Account', domain=[('internal_type','=','other'), ('deprecated', '=', False)], oldname='account_expense_depreciation_id')
account_depreciation_id = fields.Many2one('account.account', string='Depreciation Account', required=True, domain=[('internal_type','=','other'), ('deprecated', '=', False)])
journal_id = fields.Many2one('account.journal', string='Journal', required=True)
company_id = fields.Many2one('res.company', string='Company', required=True, default=lambda self: self.env['res.company']._company_default_get('account.asset.category'))
method = fields.Selection([('linear', 'Linear'), ('degressive', 'Degressive')], string='Computation Method', required=True, default='linear',
help="Choose the method to use to compute the amount of depreciation lines.\n"
" * Linear: Calculated on basis of: Gross Value / Number of Depreciations\n"
" * Degressive: Calculated on basis of: Residual Value * Degressive Factor")
method_number = fields.Integer(string='Number of Depreciations', default=5, help="The number of depreciations needed to depreciate your asset")
method_period = fields.Integer(string='Period Length', default=1, help="State here the time between 2 depreciations, in months", required=True)
method_progress_factor = fields.Float('Degressive Factor', default=0.3)
method_time = fields.Selection([('number', 'Number of Depreciations'), ('end', 'Ending Date')], string='Time Method', required=True, default='number',
help="Choose the method to use to compute the dates and number of depreciation lines.\n"
" * Number of Depreciations: Fix the number of depreciation lines and the time between 2 depreciations.\n"
" * Ending Date: Choose the time between 2 depreciations and the date the depreciations won't go beyond.")
method_end = fields.Date('Ending date')
prorata = fields.Boolean(string='Prorata Temporis', help='Indicates that the first depreciation entry for this asset have to be done from the purchase date instead of the first of January')
open_asset = fields.Boolean(string='Skip Draft State', help="Check this if you want to automatically confirm the assets of this category when created by invoices.")
type = fields.Selection([('sale', 'Sale: Revenue Recognition'), ('purchase', 'Purchase: Asset')], required=True, index=True, default='purchase')
_defaults = {
'company_id': lambda self, cr, uid, context: self.pool.get('res.company')._company_default_get(cr, uid, 'account.asset.category', context=context),
'method': 'linear',
'method_number': 5,
'method_time': 'number',
'method_period': 12,
'method_progress_factor': 0.3,
}
@api.onchange('account_asset_id')
def onchange_account_asset(self):
self.account_depreciation_id = self.account_asset_id
def onchange_account_asset(self, cr, uid, ids, account_asset_id, context=None):
res = {'value':{}}
if account_asset_id:
res['value'] = {'account_depreciation_id': account_asset_id}
return res
@api.onchange('type')
def onchange_type(self):
if self.type == 'sale':
self.prorata = True
self.method_period = 1
else:
self.method_period = 12
class account_asset_asset(osv.osv):
class AccountAssetAsset(models.Model):
_name = 'account.asset.asset'
_description = 'Asset'
_description = 'Asset/Revenue Recognition'
_inherit = ['mail.thread', 'ir.needaction_mixin']
def unlink(self, cr, uid, ids, context=None):
for asset in self.browse(cr, uid, ids, context=context):
if asset.account_move_line_ids:
raise UserError(_('You cannot delete an asset that contains posted depreciation lines.'))
return super(account_asset_asset, self).unlink(cr, uid, ids, context=context)
account_move_line_ids = fields.One2many('account.move.line', 'asset_id', string='Entries', readonly=True, states={'draft': [('readonly', False)]})
entry_count = fields.Integer(compute='_entry_count', string='# Asset Entries')
name = fields.Char(string='Asset/Deferred Revenue Name', required=True, readonly=True, states={'draft': [('readonly', False)]})
code = fields.Char(string='Reference', size=32, readonly=True, states={'draft': [('readonly', False)]}, default=lambda self: self.env['ir.sequence'].next_by_code('account.asset.code'))
value = fields.Float(string='Gross Value', required=True, readonly=True, digits=0, states={'draft': [('readonly', False)]}, oldname='purchase_value')
currency_id = fields.Many2one('res.currency', string='Currency', required=True, readonly=True, states={'draft': [('readonly', False)]},
default=lambda self: self.env.user.company_id.currency_id.id)
company_id = fields.Many2one('res.company', string='Company', required=True, readonly=True, states={'draft': [('readonly', False)]},
default=lambda self: self.env['res.company']._company_default_get('account.asset.asset'))
note = fields.Text()
category_id = fields.Many2one('account.asset.category', string='Category', required=True, change_default=True, readonly=True, states={'draft': [('readonly', False)]})
date = fields.Date(string='Date', required=True, readonly=True, states={'draft': [('readonly', False)]}, default=fields.Date.context_today, oldname="purchase_date")
state = fields.Selection([('draft', 'Draft'), ('open', 'Running'), ('close', 'Close')], 'Status', required=True, copy=False, default='draft',
help="When an asset is created, the status is 'Draft'.\n"
"If the asset is confirmed, the status goes in 'Running' and the depreciation lines can be posted in the accounting.\n"
"You can manually close an asset when the depreciation is over. If the last line of depreciation is posted, the asset automatically goes in that status.")
active = fields.Boolean(default=True)
partner_id = fields.Many2one('res.partner', string='Partner', readonly=True, states={'draft': [('readonly', False)]})
method = fields.Selection([('linear', 'Linear'), ('degressive', 'Degressive')], string='Computation Method', required=True, readonly=True, states={'draft': [('readonly', False)]}, default='linear',
help="Choose the method to use to compute the amount of depreciation lines.\n * Linear: Calculated on basis of: Gross Value / Number of Depreciations\n"
" * Degressive: Calculated on basis of: Residual Value * Degressive Factor")
method_number = fields.Integer(string='Number of Depreciations', readonly=True, states={'draft': [('readonly', False)]}, default=5, help="The number of depreciations needed to depreciate your asset")
method_period = fields.Integer(string='Number of Months in a Period', required=True, readonly=True, default=12, states={'draft': [('readonly', False)]},
help="The amount of time between two depreciations, in months")
method_end = fields.Date(string='Ending Date', readonly=True, states={'draft': [('readonly', False)]})
method_progress_factor = fields.Float(string='Degressive Factor', readonly=True, default=0.3, states={'draft': [('readonly', False)]})
value_residual = fields.Float(compute='_amount_residual', method=True, digits=0, string='Residual Value')
method_time = fields.Selection([('number', 'Number of Depreciations'), ('end', 'Ending Date')], string='Time Method', required=True, readonly=True, default='number', states={'draft': [('readonly', False)]},
help="Choose the method to use to compute the dates and number of depreciation lines.\n"
" * Number of Depreciations: Fix the number of depreciation lines and the time between 2 depreciations.\n"
" * Ending Date: Choose the time between 2 depreciations and the date the depreciations won't go beyond.")
prorata = fields.Boolean(string='Prorata Temporis', readonly=True, states={'draft': [('readonly', False)]},
help='Indicates that the first depreciation entry for this asset have to be done from the purchase date instead of the first January / Start date of fiscal year')
history_ids = fields.One2many('account.asset.history', 'asset_id', string='History', readonly=True)
depreciation_line_ids = fields.One2many('account.asset.depreciation.line', 'asset_id', string='Depreciation Lines', readonly=True, states={'draft': [('readonly', False)], 'open': [('readonly', False)]})
salvage_value = fields.Float(string='Salvage Value', digits=0, readonly=True, states={'draft': [('readonly', False)]},
help="It is the amount you plan to have that you cannot depreciate.")
invoice_id = fields.Many2one('account.invoice', string='Invoice', states={'draft': [('readonly', False)]}, copy=False)
type = fields.Selection(related="category_id.type", string='Type', required=True, default='purchase')
def _get_last_depreciation_date(self, cr, uid, ids, context=None):
@api.multi
def unlink(self):
for asset in self:
if asset.state in ['open', 'close']:
raise UserError(_('You cannot delete a document is in %s state.') % (asset.state,))
if asset.account_move_line_ids:
raise UserError(_('You cannot delete a document that contains posted lines.'))
return super(AccountAssetAsset, self).unlink()
@api.multi
def _get_last_depreciation_date(self):
"""
@param id: ids of a account.asset.asset objects
@return: Returns a dictionary of the effective dates of the last depreciation entry made for given asset ids. If there isn't any, return the purchase date of this asset
"""
cr.execute("""
SELECT a.id as id, COALESCE(MAX(l.date),a.purchase_date) AS date
self.env.cr.execute("""
SELECT a.id as id, COALESCE(MAX(l.date),a.date) AS date
FROM account_asset_asset a
LEFT JOIN account_move_line l ON (l.asset_id = a.id)
WHERE a.id IN %s
GROUP BY a.id, a.purchase_date """, (tuple(ids),))
return dict(cr.fetchall())
GROUP BY a.id, a.date """, (tuple(self.ids),))
result = dict(self.env.cr.fetchall())
return result
def _compute_board_amount(self, cr, uid, asset, i, residual_amount, amount_to_depr, undone_dotation_number, posted_depreciation_line_ids, total_days, depreciation_date, context=None):
#by default amount = 0
def _compute_board_amount(self, sequence, residual_amount, amount_to_depr, undone_dotation_number, posted_depreciation_line_ids, total_days, depreciation_date):
amount = 0
if i == undone_dotation_number:
if sequence == undone_dotation_number:
amount = residual_amount
else:
if asset.method == 'linear':
if self.method == 'linear':
amount = amount_to_depr / (undone_dotation_number - len(posted_depreciation_line_ids))
if asset.prorata:
amount = amount_to_depr / asset.method_number
if self.prorata and self.category_id.type == 'purchase':
amount = amount_to_depr / self.method_number
days = total_days - float(depreciation_date.strftime('%j'))
if i == 1:
amount = (amount_to_depr / asset.method_number) / total_days * days
elif i == undone_dotation_number:
amount = (amount_to_depr / asset.method_number) / total_days * (total_days - days)
elif asset.method == 'degressive':
amount = residual_amount * asset.method_progress_factor
if asset.prorata:
if sequence == 1:
amount = (amount_to_depr / self.method_number) / total_days * days
elif sequence == undone_dotation_number:
amount = (amount_to_depr / self.method_number) / total_days * (total_days - days)
elif self.method == 'degressive':
amount = residual_amount * self.method_progress_factor
if self.prorata:
days = total_days - float(depreciation_date.strftime('%j'))
if i == 1:
amount = (residual_amount * asset.method_progress_factor) / total_days * days
elif i == undone_dotation_number:
amount = (residual_amount * asset.method_progress_factor) / total_days * (total_days - days)
if sequence == 1:
amount = (residual_amount * self.method_progress_factor) / total_days * days
elif sequence == undone_dotation_number:
amount = (residual_amount * self.method_progress_factor) / total_days * (total_days - days)
return amount
def _compute_board_undone_dotation_nb(self, cr, uid, asset, depreciation_date, total_days, context=None):
undone_dotation_number = asset.method_number
if asset.method_time == 'end':
end_date = datetime.strptime(asset.method_end, '%Y-%m-%d')
def _compute_board_undone_dotation_nb(self, depreciation_date, total_days):
undone_dotation_number = self.method_number
if self.method_time == 'end':
end_date = datetime.strptime(self.method_end, DF).date()
undone_dotation_number = 0
while depreciation_date <= end_date:
depreciation_date = (datetime(depreciation_date.year, depreciation_date.month, depreciation_date.day) + relativedelta(months=+asset.method_period))
depreciation_date = date(depreciation_date.year, depreciation_date.month, depreciation_date.day) + relativedelta(months=+self.method_period)
undone_dotation_number += 1
if asset.prorata:
if self.prorata and self.category_id.type == 'purchase':
undone_dotation_number += 1
return undone_dotation_number
def compute_depreciation_board(self, cr, uid, ids, context=None):
depreciation_lin_obj = self.pool.get('account.asset.depreciation.line')
currency_obj = self.pool.get('res.currency')
for asset in self.browse(cr, uid, ids, context=context):
if asset.value_residual == 0.0:
continue
posted_depreciation_line_ids = depreciation_lin_obj.search(cr, uid, [('asset_id', '=', asset.id), ('move_check', '=', True)],order='depreciation_date desc')
old_depreciation_line_ids = depreciation_lin_obj.search(cr, uid, [('asset_id', '=', asset.id), ('move_id', '=', False)])
if old_depreciation_line_ids:
depreciation_lin_obj.unlink(cr, uid, old_depreciation_line_ids, context=context)
@api.multi
def compute_depreciation_board(self):
self.ensure_one()
amount_to_depr = residual_amount = asset.value_residual
if asset.prorata:
depreciation_date = datetime.strptime(self._get_last_depreciation_date(cr, uid, [asset.id], context)[asset.id], '%Y-%m-%d')
posted_depreciation_line_ids = self.depreciation_line_ids.filtered(lambda x: x.move_check)
unposted_depreciation_line_ids = self.depreciation_line_ids.filtered(lambda x: not x.move_check)
# Remove old unposted depreciation lines. We cannot use unlink() with One2many field
commands = [(2, line_id.id, False) for line_id in unposted_depreciation_line_ids]
if self.value != 0.0:
amount_to_depr = residual_amount = self.value_residual
if self.prorata:
depreciation_date = datetime.strptime(self._get_last_depreciation_date()[self.id], DF).date()
else:
# depreciation_date = 1st January of purchase year
purchase_date = datetime.strptime(asset.purchase_date, '%Y-%m-%d')
#if we already have some previous validated entries, starting date isn't 1st January but last entry + method period
if (len(posted_depreciation_line_ids)>0):
last_depreciation_date = datetime.strptime(depreciation_lin_obj.browse(cr,uid,posted_depreciation_line_ids[0],context=context).depreciation_date, '%Y-%m-%d')
depreciation_date = (last_depreciation_date+relativedelta(months=+asset.method_period))
# depreciation_date = 1st of January of purchase year
asset_date = datetime.strptime(self.date, DF).date()
# if we already have some previous validated entries, starting date isn't 1st January but last entry + method period
if posted_depreciation_line_ids and posted_depreciation_line_ids[0].depreciation_date:
last_depreciation_date = datetime.strptime(posted_depreciation_line_ids[0].depreciation_date, DF).date()
depreciation_date = last_depreciation_date + relativedelta(months=+self.method_period)
else:
depreciation_date = datetime(purchase_date.year, 1, 1)
depreciation_date = asset_date
day = depreciation_date.day
month = depreciation_date.month
year = depreciation_date.year
total_days = (year % 4) and 365 or 366
undone_dotation_number = self._compute_board_undone_dotation_nb(cr, uid, asset, depreciation_date, total_days, context=context)
undone_dotation_number = self._compute_board_undone_dotation_nb(depreciation_date, total_days)
for x in range(len(posted_depreciation_line_ids), undone_dotation_number):
i = x + 1
amount = self._compute_board_amount(cr, uid, asset, i, residual_amount, amount_to_depr, undone_dotation_number, posted_depreciation_line_ids, total_days, depreciation_date, context=context)
sequence = x + 1
amount = self._compute_board_amount(sequence, residual_amount, amount_to_depr, undone_dotation_number, posted_depreciation_line_ids, total_days, depreciation_date)
amount = self.currency_id.round(amount)
residual_amount -= amount
vals = {
'amount': amount,
'asset_id': asset.id,
'sequence': i,
'name': str(asset.id) +'/' + str(i),
'remaining_value': residual_amount,
'depreciated_value': (asset.purchase_value - asset.salvage_value) - (residual_amount + amount),
'depreciation_date': depreciation_date.strftime('%Y-%m-%d'),
'amount': amount,
'asset_id': self.id,
'sequence': sequence,
'name': (self.code or str(self.id)) + '/' + str(sequence),
'remaining_value': residual_amount,
'depreciated_value': (self.value - self.salvage_value) - (residual_amount + amount),
'depreciation_date': depreciation_date.strftime(DF),
}
depreciation_lin_obj.create(cr, uid, vals, context=context)
commands.append((0, False, vals))
# Considering Depr. Period as months
depreciation_date = (datetime(year, month, day) + relativedelta(months=+asset.method_period))
depreciation_date = date(year, month, day) + relativedelta(months=+self.method_period)
day = depreciation_date.day
month = depreciation_date.month
year = depreciation_date.year
self.write({'depreciation_line_ids': commands})
return True
def validate(self, cr, uid, ids, context=None):
if context is None:
context = {}
return self.write(cr, uid, ids, {
'state':'open'
}, context)
@api.multi
def validate(self):
self.write({'state': 'open'})
def set_to_close(self, cr, uid, ids, context=None):
return self.write(cr, uid, ids, {'state': 'close'}, context=context)
@api.multi
def set_to_close(self):
unposted_dep_line = self.env['account.asset.depreciation.line'].search_count(
[('asset_id', 'in', self.ids), ('move_check', '=', False)])
if unposted_dep_line:
raise UserError(_('You cannot close a document which has unposted lines.'))
self.message_post(body=_("Document closed."))
self.write({'state': 'close'})
def set_to_draft(self, cr, uid, ids, context=None):
return self.write(cr, uid, ids, {'state': 'draft'}, context=context)
@api.multi
def set_to_draft(self):
self.write({'state': 'draft'})
def _amount_residual(self, cr, uid, ids, name, args, context=None):
cr.execute("""SELECT
l.asset_id as id, SUM(abs(l.debit-l.credit)) AS amount
FROM
account_move_line l
WHERE
l.asset_id IN %s GROUP BY l.asset_id """, (tuple(ids),))
res=dict(cr.fetchall())
for asset in self.browse(cr, uid, ids, context):
company_currency = asset.company_id.currency_id.id
current_currency = asset.currency_id.id
amount = self.pool['res.currency'].compute(cr, uid, company_currency, current_currency, res.get(asset.id, 0.0), context=context)
res[asset.id] = asset.purchase_value - amount - asset.salvage_value
for id in ids:
res.setdefault(id, 0.0)
return res
@api.one
@api.depends('value', 'salvage_value', 'depreciation_line_ids')
def _amount_residual(self):
total_amount = 0.0
for line in self.depreciation_line_ids:
if line.move_check:
total_amount += line.amount
self.value_residual = self.value - total_amount - self.salvage_value
def onchange_company_id(self, cr, uid, ids, company_id=False, context=None):
val = {}
if company_id:
company = self.pool.get('res.company').browse(cr, uid, company_id, context=context)
val['currency_id'] = company.currency_id.id
return {'value': val}
def onchange_purchase_salvage_value(self, cr, uid, ids, purchase_value, salvage_value, context=None):
val = {}
for asset in self.browse(cr, uid, ids, context=context):
if purchase_value:
val['value_residual'] = purchase_value - salvage_value
if salvage_value:
val['value_residual'] = purchase_value - salvage_value
return {'value': val}
def _entry_count(self, cr, uid, ids, field_name, arg, context=None):
MoveLine = self.pool('account.move.line')
return {
asset_id: MoveLine.search_count(cr, uid, [('asset_id', '=', asset_id)], context=context)
for asset_id in ids
}
_columns = {
'account_move_line_ids': fields.one2many('account.move.line', 'asset_id', 'Entries', readonly=True, states={'draft':[('readonly',False)]}),
'entry_count': fields.function(_entry_count, string='# Asset Entries', type='integer'),
'name': fields.char('Asset Name', required=True, readonly=True, states={'draft':[('readonly',False)]}),
'code': fields.char('Reference', size=32, readonly=True, states={'draft':[('readonly',False)]}),
'purchase_value': fields.float('Gross Value', required=True, readonly=True, states={'draft':[('readonly',False)]}),
'currency_id': fields.many2one('res.currency','Currency',required=True, readonly=True, states={'draft':[('readonly',False)]}),
'company_id': fields.many2one('res.company', 'Company', required=True, readonly=True, states={'draft':[('readonly',False)]}),
'note': fields.text('Note'),
'category_id': fields.many2one('account.asset.category', 'Asset Category', required=True, change_default=True, readonly=True, states={'draft':[('readonly',False)]}),
'purchase_date': fields.date('Purchase Date', required=True, readonly=True, states={'draft':[('readonly',False)]}),
'state': fields.selection([('draft','Draft'),('open','Running'),('close','Close')], 'Status', required=True, copy=False,
help="When an asset is created, the status is 'Draft'.\n" \
"If the asset is confirmed, the status goes in 'Running' and the depreciation lines can be posted in the accounting.\n" \
"You can manually close an asset when the depreciation is over. If the last line of depreciation is posted, the asset automatically goes in that status."),
'active': fields.boolean('Active'),
'partner_id': fields.many2one('res.partner', 'Supplier', readonly=True, states={'draft':[('readonly',False)]}),
'method': fields.selection([('linear','Linear'),('degressive','Degressive')], 'Computation Method', required=True, readonly=True, states={'draft':[('readonly',False)]}, help="Choose the method to use to compute the amount of depreciation lines.\n"\
" * Linear: Calculated on basis of: Gross Value / Number of Depreciations\n" \
" * Degressive: Calculated on basis of: Residual Value * Degressive Factor"),
'method_number': fields.integer('Number of Depreciations', readonly=True, states={'draft':[('readonly',False)]}, help="The number of depreciations needed to depreciate your asset"),
'method_period': fields.integer('Number of Months in a Period', required=True, readonly=True, states={'draft':[('readonly',False)]}, help="The amount of time between two depreciations, in months"),
'method_end': fields.date('Ending Date', readonly=True, states={'draft':[('readonly',False)]}),
'method_progress_factor': fields.float('Degressive Factor', readonly=True, states={'draft':[('readonly',False)]}),
'value_residual': fields.function(_amount_residual, method=True, digits=0, string='Residual Value'),
'method_time': fields.selection([('number','Number of Depreciations'),('end','Ending Date')], 'Time Method', required=True, readonly=True, states={'draft':[('readonly',False)]},
help="Choose the method to use to compute the dates and number of depreciation lines.\n"\
" * Number of Depreciations: Fix the number of depreciation lines and the time between 2 depreciations.\n" \
" * Ending Date: Choose the time between 2 depreciations and the date the depreciations won't go beyond."),
'prorata':fields.boolean('Prorata Temporis', readonly=True, states={'draft':[('readonly',False)]}, help='Indicates that the first depreciation entry for this asset have to be done from the purchase date instead of the first January'),
'history_ids': fields.one2many('account.asset.history', 'asset_id', 'History', readonly=True),
'depreciation_line_ids': fields.one2many('account.asset.depreciation.line', 'asset_id', 'Depreciation Lines', readonly=True, states={'draft':[('readonly',False)],'open':[('readonly',False)]}),
'salvage_value': fields.float('Salvage Value', digits=0, help="It is the amount you plan to have that you cannot depreciate.", readonly=True, states={'draft':[('readonly',False)]}),
}
_defaults = {
'code': lambda obj, cr, uid, context: obj.pool.get('ir.sequence').next_by_code(cr, uid, 'account.asset.code'),
'purchase_date': lambda obj, cr, uid, context: time.strftime('%Y-%m-%d'),
'active': True,
'state': 'draft',
'method': 'linear',
'method_number': 5,
'method_time': 'number',
'method_period': 12,
'method_progress_factor': 0.3,
'currency_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.currency_id.id,
'company_id': lambda self, cr, uid, context: self.pool.get('res.company')._company_default_get(cr, uid, 'account.asset.asset',context=context),
}
@api.onchange('company_id')
def onchange_company_id(self):
self.currency_id = self.company_id.currency_id.id
def _check_recursion(self, cr, uid, ids, context=None, parent=None):
return super(account_asset_asset, self)._check_recursion(cr, uid, ids, context=context, parent=parent)
@api.multi
@api.depends('account_move_line_ids')
def _entry_count(self):
for asset in self:
asset.entry_count = self.env['account.move.line'].search_count([('asset_id', '=', asset.id)])
def _check_prorata(self, cr, uid, ids, context=None):
for asset in self.browse(cr, uid, ids, context=context):
if asset.prorata and asset.method_time != 'number':
return False
return True
@api.one
@api.constrains('prorata', 'method_time')
def _check_prorata(self):
if self.prorata and self.method_time != 'number':
raise ValidationError(_('Prorata temporis can be applied only for time method "number of depreciations".'))
_constraints = [
(_check_prorata, 'Prorata temporis can be applied only for time method "number of depreciations".', ['prorata']),
]
@api.onchange('category_id')
def onchange_category_id(self):
vals = self.onchange_category_id_values(self.category_id.id)
# We cannot use 'write' on an object that doesn't exist yet
if vals:
for k, v in vals['value'].iteritems():
setattr(self, k, v)
def onchange_category_id(self, cr, uid, ids, category_id, context=None):
res = {'value':{}}
asset_categ_obj = self.pool.get('account.asset.category')
def onchange_category_id_values(self, category_id):
if category_id:
category_obj = asset_categ_obj.browse(cr, uid, category_id, context=context)
res['value'] = {
'method': category_obj.method,
'method_number': category_obj.method_number,
'method_time': category_obj.method_time,
'method_period': category_obj.method_period,
'method_progress_factor': category_obj.method_progress_factor,
'method_end': category_obj.method_end,
'prorata': category_obj.prorata,
category = self.env['account.asset.category'].browse(category_id)
return {
'value': {
'method': category.method,
'method_number': category.method_number,
'method_time': category.method_time,
'method_period': category.method_period,
'method_progress_factor': category.method_progress_factor,
'method_end': category.method_end,
'prorata': category.prorata,
}
}
@api.onchange('method_time')
def onchange_method_time(self):
if self.method_time != 'number':
self.prorata = False
@api.multi
def copy_data(self, default=None):
if default is None:
default = {}
default['name'] = self.name + _(' (copy)')
return super(AccountAssetAsset, self).copy_data(default)[0]
@api.multi
def _compute_entries(self, date):
depreciation_ids = self.env['account.asset.depreciation.line'].search([
('asset_id', 'in', self.ids), ('depreciation_date', '<=', date),
('move_check', '=', False)])
return depreciation_ids.create_move()
@api.model
def create(self, vals):
asset = super(AccountAssetAsset, self.with_context(mail_create_nolog=True)).create(vals)
asset.compute_depreciation_board()
return asset
@api.multi
def write(self, vals):
res = super(AccountAssetAsset, self).write(vals)
if 'depreciation_line_ids' not in vals:
self.compute_depreciation_board()
return res
def onchange_method_time(self, cr, uid, ids, method_time='number', context=None):
res = {'value': {}}
if method_time != 'number':
res['value'] = {'prorata': False}
return res
def _compute_entries(self, cr, uid, ids, date, context=None):
result = []
depreciation_obj = self.pool.get('account.asset.depreciation.line')
depreciation_ids = depreciation_obj.search(cr, uid, [('asset_id', 'in', ids), ('depreciation_date', '<=', date), ('move_check', '=', False)], context=context)
context = dict(context or {}, depreciation_date=time.strftime('%Y-%m-%d'))
return depreciation_obj.create_move(cr, uid, depreciation_ids, context=context)
def create(self, cr, uid, vals, context=None):
asset_id = super(account_asset_asset, self).create(cr, uid, vals, context=context)
self.compute_depreciation_board(cr, uid, [asset_id], context=context)
return asset_id
def open_entries(self, cr, uid, ids, context=None):
context = dict(context or {}, search_default_asset_id=ids, default_asset_id=ids)
@api.multi
def open_entries(self):
return {
'name': _('Journal Items'),
'view_type': 'form',
@@ -337,78 +315,74 @@ class account_asset_asset(osv.osv):
'res_model': 'account.move.line',
'view_id': False,
'type': 'ir.actions.act_window',
'context': context,
'context': dict(self.env.context or {}, search_default_asset_id=self.id, default_asset_id=self.id),
}
class account_asset_depreciation_line(osv.osv):
class AccountAssetDepreciationLine(models.Model):
_name = 'account.asset.depreciation.line'
_description = 'Asset depreciation line'
def _get_move_check(self, cr, uid, ids, name, args, context=None):
res = {}
for line in self.browse(cr, uid, ids, context=context):
res[line.id] = bool(line.move_id)
return res
name = fields.Char(string='Depreciation Name', required=True, index=True)
sequence = fields.Integer(required=True)
asset_id = fields.Many2one('account.asset.asset', string='Asset', required=True, ondelete='cascade')
parent_state = fields.Selection(related='asset_id.state', string='State of Asset')
amount = fields.Float(string='Current Depreciation', digits=0, required=True)
remaining_value = fields.Float(string='Next Period Depreciation', digits=0, required=True)
depreciated_value = fields.Float(string='Amount Already Depreciated', required=True)
depreciation_date = fields.Date('Depreciation Date', index=True)
move_id = fields.Many2one('account.move', string='Depreciation Entry')
move_check = fields.Boolean(compute='_get_move_check', string='Posted', track_visibility='always', store=True)
_columns = {
'name': fields.char('Depreciation Name', required=True, select=1),
'sequence': fields.integer('Sequence', required=True),
'asset_id': fields.many2one('account.asset.asset', 'Asset', required=True, ondelete='cascade'),
'parent_state': fields.related('asset_id', 'state', type='char', string='State of Asset'),
'amount': fields.float('Current Depreciation', digits=0, required=True),
'remaining_value': fields.float('Next Period Depreciation', digits=0, required=True),
'depreciated_value': fields.float('Amount Already Depreciated', required=True),
'depreciation_date': fields.date('Depreciation Date', select=1),
'move_id': fields.many2one('account.move', 'Depreciation Entry'),
'move_check': fields.function(_get_move_check, method=True, type='boolean', string='Posted', store=True)
}
@api.one
@api.depends('move_id')
def _get_move_check(self):
self.move_check = bool(self.move_id)
def create_move(self, cr, uid, ids, context=None):
context = dict(context or {})
can_close = False
asset_obj = self.pool.get('account.asset.asset')
move_obj = self.pool.get('account.move')
move_line_obj = self.pool.get('account.move.line')
currency_obj = self.pool.get('res.currency')
@api.multi
def create_move(self):
created_move_ids = []
asset_ids = []
for line in self.browse(cr, uid, ids, context=context):
depreciation_date = context.get('depreciation_date') or line.depreciation_date or time.strftime('%Y-%m-%d')
company_currency = line.asset_id.company_id.currency_id.id
current_currency = line.asset_id.currency_id.id
context.update({'date': depreciation_date})
amount = currency_obj.compute(cr, uid, current_currency, company_currency, line.amount, context=context)
sign = (line.asset_id.category_id.journal_id.type == 'purchase' and 1) or -1
for line in self:
depreciation_date = self.env.context.get('depreciation_date') or line.depreciation_date or fields.Date.context_today(self)
company_currency = line.asset_id.company_id.currency_id
current_currency = line.asset_id.currency_id
amount = company_currency.compute(line.amount, current_currency)
sign = (line.asset_id.category_id.journal_id.type == 'purchase' or line.asset_id.category_id.journal_id.type == 'sale' and 1) or -1
asset_name = line.asset_id.name
reference = line.name
journal_id = line.asset_id.category_id.journal_id.id
partner_id = line.asset_id.partner_id.id
categ_type = line.asset_id.category_id.type
debit_account = line.asset_id.category_id.account_asset_id.id
credit_account = line.asset_id.category_id.account_depreciation_id.id
move_line_1 = {
'name': asset_name,
'name': asset_name or reference,
'ref': reference,
'account_id': line.asset_id.category_id.account_depreciation_id.id,
'account_id': credit_account,
'debit': 0.0,
'credit': amount,
'journal_id': journal_id,
'partner_id': partner_id,
'currency_id': company_currency != current_currency and current_currency or False,
'currency_id': company_currency != current_currency and current_currency or False,
'amount_currency': company_currency != current_currency and - sign * line.amount or 0.0,
'analytic_account_id': line.asset_id.category_id.account_analytic_id.id if categ_type == 'sale' else False,
'date': depreciation_date,
'asset_id': line.asset_id.id if categ_type == 'sale' else False,
}
move_line_2 = {
'name': asset_name,
'name': asset_name or reference,
'ref': reference,
'account_id': line.asset_id.category_id.account_expense_depreciation_id.id,
'account_id': debit_account,
'credit': 0.0,
'debit': amount,
'journal_id': journal_id,
'partner_id': partner_id,
'currency_id': company_currency != current_currency and current_currency or False,
'currency_id': company_currency != current_currency and current_currency or False,
'amount_currency': company_currency != current_currency and sign * line.amount or 0.0,
'analytic_account_id': line.asset_id.category_id.account_analytic_id.id,
'analytic_account_id': line.asset_id.category_id.account_analytic_id.id if categ_type == 'purchase' else False,
'date': depreciation_date,
'asset_id': line.asset_id.id
'asset_id': line.asset_id.id if categ_type == 'purchase' else False
}
move_vals = {
'name': asset_name,
@@ -417,43 +391,67 @@ class account_asset_depreciation_line(osv.osv):
'journal_id': line.asset_id.category_id.journal_id.id,
'line_ids': [(0, 0, move_line_1), (0, 0, move_line_2)],
}
move_id = move_obj.create(cr, uid, move_vals, context=context)
self.write(cr, uid, line.id, {'move_id': move_id}, context=context)
created_move_ids.append(move_id)
move_obj.post(cr, uid, [move_id], context=context)
asset_ids.append(line.asset_id.id)
move = self.env['account.move'].create(move_vals)
line.write({'move_id': move.id, 'move_check': True})
created_move_ids.append(move.id)
move.post()
asset_ids.append(line.asset_id)
partner_name = line.asset_id.partner_id.name
currency_name = line.asset_id.currency_id.name
def _format_message(message_description, tracked_values):
message = ''
if message_description:
message = '<span>%s</span>' % message_description
for name, values in tracked_values.iteritems():
message += '<div> &nbsp; &nbsp; &bull; <b>%s</b>: ' % name
message += '%s</div>' % values
return message
msg_values = {_('Currency'): currency_name, _('Amount'): line.amount}
if partner_name:
msg_values[_('Partner')] = partner_name
msg = _format_message(_('Depreciation line posted.'), msg_values)
line.asset_id.message_post(body=msg)
# we re-evaluate the assets to determine whether we can close them
for asset in asset_obj.browse(cr, uid, list(set(asset_ids)), context=context):
if currency_obj.is_zero(cr, uid, asset.currency_id, asset.value_residual):
for asset in asset_ids:
if asset.currency_id.is_zero(asset.value_residual):
asset.message_post(body=_("Document closed."))
asset.write({'state': 'close'})
asset.compute_depreciation_board()
return created_move_ids
@api.multi
def unlink(self):
for record in self:
if record.move_check:
if record.asset_id.category_id.type == 'purchase':
msg = _("You cannot delete posted depreciation lines.")
else:
msg = _("You cannot delete posted installment lines.")
raise UserError(msg)
return super(AccountAssetDepreciationLine, self).unlink()
class account_move_line(osv.osv):
class AccountMoveLine(models.Model):
_inherit = 'account.move.line'
_columns = {
'asset_id': fields.many2one('account.asset.asset', 'Asset', ondelete="restrict"),
}
asset_id = fields.Many2one('account.asset.asset', string='Asset', ondelete="restrict")
class account_asset_history(osv.osv):
class AccountAssetHistory(models.Model):
_name = 'account.asset.history'
_description = 'Asset history'
_columns = {
'name': fields.char('History name', select=1),
'user_id': fields.many2one('res.users', 'User', required=True),
'date': fields.date('Date', required=True),
'asset_id': fields.many2one('account.asset.asset', 'Asset', required=True),
'method_time': fields.selection([('number','Number of Depreciations'),('end','Ending Date')], 'Time Method', required=True,
help="The method to use to compute the dates and number of depreciation lines.\n"\
"Number of Depreciations: Fix the number of depreciation lines and the time between 2 depreciations.\n" \
"Ending Date: Choose the time between 2 depreciations and the date the depreciations won't go beyond."),
'method_number': fields.integer('Number of Depreciations', help="The number of depreciations needed to depreciate your asset"),
'method_period': fields.integer('Period Length', help="Time in month between two depreciations"),
'method_end': fields.date('Ending date'),
'note': fields.text('Note'),
}
_order = 'date desc'
_defaults = {
'date': lambda *args: time.strftime('%Y-%m-%d'),
'user_id': lambda self, cr, uid, ctx: uid
}
name = fields.Char(string='History name', index=True)
user_id = fields.Many2one('res.users', string='User', required=True, default=lambda self: self.env.user)
date = fields.Date(required=True, default=fields.Date.context_today)
asset_id = fields.Many2one('account.asset.asset', string='Asset', required=True)
method_time = fields.Selection([('number', 'Number of Depreciations'), ('end', 'Ending Date')], string='Time Method', required=True,
help="The method to use to compute the dates and number of depreciation lines.\n"
"Number of Depreciations: Fix the number of depreciation lines and the time between 2 depreciations.\n"
"Ending Date: Choose the time between 2 depreciations and the date the depreciations won't go beyond.")
method_number = fields.Integer(string='Number of Depreciations', help="The number of depreciations needed to depreciate your asset")
method_period = fields.Integer(string='Period Length', help="Time in months between two depreciations")
method_end = fields.Date(string='Ending date')
note = fields.Text()
+7 -7
View File
@@ -14,7 +14,7 @@
'method_number': 3,
'account_asset_id': xfa_account_id[0],
'account_depreciation_id': xfa_account_id[0],
'account_expense_depreciation_id': expense_account_id[0],
'account_income_recognition_id': expense_account_id[0],
}
self._update(cr, uid, 'account.asset.category', 'account_asset', vals, 'account_asset_category_fixedassets0')
vals = {
@@ -23,7 +23,7 @@
'method_number': 5,
'account_asset_id': xfa_account_id[0],
'account_depreciation_id': xfa_account_id[0],
'account_expense_depreciation_id': expense_account_id[0],
'account_income_recognition_id': expense_account_id[0],
}
self._update(cr, uid, 'account.asset.category', 'account_asset', vals, 'account_asset_category_fixedassets1')
vals = {
@@ -32,7 +32,7 @@
'method_period': 12,
'method_number': 5,
'name': "CEO's car",
'purchase_value': 12000.0,
'value': 12000.0,
'category_id': ref('account_asset_category_fixedassets0'),
}
self._update(cr, uid, 'account.asset.asset', 'account_asset', vals, 'account_asset_asset_vehicles0')
@@ -41,7 +41,7 @@
'salvage_value': 0.0,
'method_time': 'end',
'name': 'V6 Engine and 10 inches tires',
'purchase_value': 2800.0,
'value': 2800.0,
'category_id': ref('account_asset_category_fixedassets0'),
}
self._update(cr, uid, 'account.asset.asset', 'account_asset', vals, 'account_asset_asset_cab0')
@@ -51,9 +51,9 @@
'state': 'open',
'method_period': 12,
'method_number': 20,
'purchase_date': time.strftime('%Y-01-01'),
'date': time.strftime('%Y-01-01'),
'name': 'Office',
'purchase_value': 500000.0,
'value': 500000.0,
'category_id': ref('account_asset_category_fixedassets0'),
}
self._update(cr, uid, 'account.asset.asset', 'account_asset', vals, 'account_asset_asset_office0')
@@ -67,6 +67,6 @@
'method_number': 6,
'account_asset_id': xfa_account_id[0],
'account_depreciation_id': xfa_account_id[0],
'account_expense_depreciation_id': sale_account_id[0],
'account_income_recognition_id': sale_account_id[0],
}
self._update(cr, uid, 'account.asset.category', 'account_asset', vals, 'account_asset_category_sale')
+86 -55
View File
@@ -1,66 +1,97 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
# -*- coding: utf-8 -*-
from openerp.osv import fields, osv
from datetime import datetime
from dateutil.relativedelta import relativedelta
from openerp import api, fields, models
import openerp.addons.decimal_precision as dp
from openerp.tools import DEFAULT_SERVER_DATE_FORMAT as DF
class account_invoice(osv.osv):
class AccountInvoice(models.Model):
_inherit = 'account.invoice'
def action_number(self, cr, uid, ids, *args):
result = super(account_invoice, self).action_number(cr, uid, ids, *args)
for inv in self.browse(cr, uid, ids):
self.pool.get('account.invoice.line').asset_create(cr, uid, inv.invoice_line_ids)
@api.multi
def action_move_create(self):
result = super(AccountInvoice, self).action_move_create()
for inv in self:
inv.invoice_line_ids.asset_create()
return result
def line_get_convert(self, cr, uid, x, part, context=None):
res = super(account_invoice, self).line_get_convert(cr, uid, x, part, context=context)
res['asset_id'] = x.get('asset_id', False)
@api.model
def line_get_convert(self, line, part):
res = super(AccountInvoice, self).line_get_convert(line, part)
res['asset_id'] = line.get('asset_id', False)
return res
class account_invoice_line(osv.osv):
class AccountInvoiceLine(models.Model):
_inherit = 'account.invoice.line'
_columns = {
'asset_category_id': fields.many2one('account.asset.category', 'Asset Category'),
}
def asset_create(self, cr, uid, lines, context=None):
context = context or {}
asset_obj = self.pool.get('account.asset.asset')
for line in lines:
if line.asset_category_id:
vals = {
'name': line.name,
'code': line.invoice_id.number or False,
'category_id': line.asset_category_id.id,
'purchase_value': line.price_subtotal,
'date': line.invoice_id.date,
'partner_id': line.invoice_id.partner_id.id,
'company_id': line.invoice_id.company_id.id,
'currency_id': line.invoice_id.currency_id.id,
'purchase_date' : line.invoice_id.date_invoice,
}
changed_vals = asset_obj.onchange_category_id(cr, uid, [], vals['category_id'], context=context)
vals.update(changed_vals['value'])
asset_id = asset_obj.create(cr, uid, vals, context=context)
if line.asset_category_id.open_asset:
asset_obj.validate(cr, uid, [asset_id], context=context)
asset_category_id = fields.Many2one('account.asset.category', string='Asset Category')
asset_start_date = fields.Date(string='Asset End Date', compute='_get_asset_date', readonly=True, store=True)
asset_end_date = fields.Date(string='Asset Start Date', compute='_get_asset_date', readonly=True, store=True)
asset_mrr = fields.Float(string='Monthly Recurring Revenue', compute='_get_asset_date', readonly=True, digits=dp.get_precision('Account'), store=True)
@api.one
@api.depends('asset_category_id', 'invoice_id.date_invoice')
def _get_asset_date(self):
self.asset_mrr = 0
self.asset_start_date = False
self.asset_end_date = False
cat = self.asset_category_id
if cat:
months = cat.method_number * cat.method_period
if self.invoice_id.type in ['out_invoice', 'out_refund']:
self.asset_mrr = self.price_subtotal_signed / months
if self.invoice_id.date_invoice:
start_date = datetime.strptime(self.invoice_id.date_invoice, DF).replace(day=1)
end_date = (start_date + relativedelta(months=months, days=-1))
self.asset_start_date = start_date.strftime(DF)
self.asset_end_date = end_date.strftime(DF)
@api.one
def asset_create(self):
if self.asset_category_id and self.asset_category_id.method_number > 1:
vals = {
'name': self.name,
'code': self.invoice_id.number or False,
'category_id': self.asset_category_id.id,
'value': self.price_subtotal,
'partner_id': self.invoice_id.partner_id.id,
'company_id': self.invoice_id.company_id.id,
'currency_id': self.invoice_id.currency_id.id,
'date': self.asset_start_date or self.invoice_id.date_invoice,
'invoice_id': self.invoice_id.id,
}
changed_vals = self.env['account.asset.asset'].onchange_category_id_values(vals['category_id'])
vals.update(changed_vals['value'])
asset = self.env['account.asset.asset'].create(vals)
if self.asset_category_id.open_asset:
asset.validate()
return True
@api.multi
def product_id_change(self, product, uom_id, qty=0, name='', type='out_invoice',
partner_id=False, fposition_id=False, price_unit=False, currency_id=False,
company_id=None, date_invoice=None):
res = super(AccountInvoiceLine, self).product_id_change(
product, uom_id, qty=qty, name=name, type=type, partner_id=partner_id,
fposition_id=fposition_id, price_unit=price_unit, currency_id=currency_id,
company_id=company_id, date_invoice=date_invoice
)
if product and res['value']:
product_obj = self.env['product.product'].browse(product)
if type == 'out_invoice':
res['value']['asset_category_id'] = product_obj.product_tmpl_id.deferred_revenue_category_id
elif type == 'in_invoice':
res['value']['asset_category_id'] = product_obj.product_tmpl_id.asset_category_id
return res
class ProductTemplate(models.Model):
_inherit = 'product.template'
asset_category_id = fields.Many2one('account.asset.category', string='Asset Type', ondelete="restrict")
deferred_revenue_category_id = fields.Many2one('account.asset.category', string='Deferred Revenue Type', ondelete="restrict")
@@ -1,29 +0,0 @@
<?xml version="1.0"?>
<openerp>
<data>
<!-- Fiscal Year -->
<record model="ir.ui.view" id="view_account_invoice_asset_form">
<field name="name">account.invoice.line.form</field>
<field name="model">account.invoice.line</field>
<field name="inherit_id" ref="account.view_invoice_line_form"/>
<field name="arch" type="xml">
<field name="account_id" position="after">
<field name="asset_category_id"/>
</field>
</field>
</record>
<record model="ir.ui.view" id="view_invoice_asset_category">
<field name="name">account.invoice.supplier.form</field>
<field name="model">account.invoice</field>
<field name="inherit_id" ref="account.invoice_supplier_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='invoice_line_ids']/tree/field[@name='quantity']" position="before">
<field name="asset_category_id"/>
</xpath>
</field>
</record>
</data>
</openerp>
-19
View File
@@ -1,22 +1,3 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import account_asset_report
@@ -1,64 +1,46 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
# -*- coding: utf-8 -*-
from openerp import fields, models, tools
from openerp import tools
from openerp.osv import fields, osv
class asset_asset_report(osv.osv):
class AssetAssetReport(models.Model):
_name = "asset.asset.report"
_description = "Assets Analysis"
_auto = False
_columns = {
'name': fields.char('Year', required=False, readonly=True),
'purchase_date': fields.date('Purchase Date', readonly=True),
'depreciation_date': fields.date('Depreciation Date', readonly=True),
'asset_id': fields.many2one('account.asset.asset', string='Asset', readonly=True),
'asset_category_id': fields.many2one('account.asset.category',string='Asset category'),
'partner_id': fields.many2one('res.partner', 'Partner', readonly=True),
'state': fields.selection([('draft','Draft'),('open','Running'),('close','Close')], 'Status', readonly=True),
'depreciation_value': fields.float('Amount of Depreciation Lines', readonly=True),
'move_check': fields.boolean('Posted', readonly=True),
'nbr': fields.integer('# of Depreciation Lines', readonly=True),
'gross_value': fields.float('Gross Amount', readonly=True),
'posted_value': fields.float('Posted Amount', readonly=True),
'unposted_value': fields.float('Unposted Amount', readonly=True),
'company_id': fields.many2one('res.company', 'Company', readonly=True),
}
name = fields.Char(string='Year', required=False, readonly=True)
date = fields.Date(readonly=True)
depreciation_date = fields.Date(string='Depreciation Date', readonly=True)
asset_id = fields.Many2one('account.asset.asset', string='Asset', readonly=True)
asset_category_id = fields.Many2one('account.asset.category', string='Asset category', readonly=True)
partner_id = fields.Many2one('res.partner', string='Partner', readonly=True)
state = fields.Selection([('draft', 'Draft'), ('open', 'Running'), ('close', 'Close')], string='Status', readonly=True)
depreciation_value = fields.Float(string='Amount of Depreciation Lines', readonly=True)
installment_value = fields.Float(string='Amount of Installment Lines', readonly=True)
move_check = fields.Boolean(string='Posted', readonly=True)
installment_nbr = fields.Integer(string='# of Installment Lines', readonly=True)
depreciation_nbr = fields.Integer(string='# of Depreciation Lines', readonly=True)
gross_value = fields.Float(string='Gross Amount', readonly=True)
posted_value = fields.Float(string='Posted Amount', readonly=True)
unposted_value = fields.Float(string='Unposted Amount', readonly=True)
company_id = fields.Many2one('res.company', string='Company', readonly=True)
def init(self, cr):
tools.drop_view_if_exists(cr, 'asset_asset_report')
cr.execute("""
create or replace view asset_asset_report as (
select
tools.drop_view_if_exists(cr, 'asset_asset_report')
cr.execute("""
create or replace view asset_asset_report as (
select
min(dl.id) as id,
dl.name as name,
dl.depreciation_date as depreciation_date,
a.purchase_date as purchase_date,
a.date as date,
(CASE WHEN (select min(d.id) from account_asset_depreciation_line as d
left join account_asset_asset as ac ON (ac.id=d.asset_id)
where a.id=ac.id) = min(dl.id)
THEN a.purchase_value
THEN a.value
ELSE 0
END) as gross_value,
dl.amount as depreciation_value,
dl.amount as depreciation_value,
dl.amount as installment_value,
(CASE WHEN dl.move_check
THEN dl.amount
ELSE 0
@@ -72,13 +54,13 @@ class asset_asset_report(osv.osv):
a.category_id as asset_category_id,
a.partner_id as partner_id,
a.state as state,
count(dl.*) as nbr,
count(dl.*) as installment_nbr,
count(dl.*) as depreciation_nbr,
a.company_id as company_id
from account_asset_depreciation_line dl
left join account_asset_asset a on (dl.asset_id=a.id)
group by
group by
dl.amount,dl.asset_id,dl.depreciation_date,dl.name,
a.purchase_date, dl.move_check, a.state, a.category_id, a.partner_id, a.company_id,
a.purchase_value, a.id, a.salvage_value
a.date, dl.move_check, a.state, a.category_id, a.partner_id, a.company_id,
a.value, a.id, a.salvage_value
)""")
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<odoo>
<record model="ir.ui.view" id="action_account_asset_report_pivot">
<field name="name">asset.asset.report.pivot</field>
@@ -8,7 +7,7 @@
<field name="arch" type="xml">
<pivot string="Assets Analysis" disable_linking="True">
<field name="asset_category_id" type="row"/>
<field name="purchase_date" type="col"/>
<field name="date" type="col"/>
<field name="posted_value" type="measure"/>
<field name="gross_value" type="measure"/>
<field name="depreciation_value" type="measure"/>
@@ -21,18 +20,46 @@
<field name="arch" type="xml">
<graph string="Assets Analysis" type="pivot">
<field name="asset_category_id" type="row"/>
<field name="purchase_date" type="col"/>
<field name="date" type="col"/>
<field name="gross_value" type="measure"/>
</graph>
</field>
</record>
<!--
Asset Revenue Recognition Graph
-->
<record model="ir.ui.view" id="action_account_revenue_report_pivot">
<field name="name">asset.asset.report.pivot</field>
<field name="model">asset.asset.report</field>
<field name="arch" type="xml">
<pivot string="Deferred Revenue Analysis" disable_linking="True">
<field name="asset_category_id" type="row"/>
<field name="date" type="col"/>
<field name="gross_value" type="measure"/>
</pivot>
</field>
</record>
<record model="ir.ui.view" id="action_account_revenue_report_graph">
<field name="name">asset.revenue.report.graph</field>
<field name="model">asset.asset.report</field>
<field name="arch" type="xml">
<graph string="Deferred Revenue Analysis" type="pivot">
<field name="asset_id" type="row"/>
<field name="installment_nbr" type="measure"/>
<field name="gross_value" type="measure"/>
<field name="installment_value" type="measure"/>
<field name="posted_value" type="measure"/>
</graph>
</field>
</record>
<record id="view_asset_asset_report_search" model="ir.ui.view">
<field name="name">asset.asset.report.search</field>
<field name="model">asset.asset.report</field>
<field name="arch" type="xml">
<search string="Assets Analysis">
<field name="purchase_date"/>
<field name="date"/>
<field name="depreciation_date"/>
<filter string="Draft" domain="[('state','=','draft')]" help="Assets in draft state"/>
<filter string="Running" domain="[('state','=','open')]" help="Assets in running state"/>
@@ -50,13 +77,46 @@
<filter string="Company" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
<separator/>
<filter string="Purchase Month" help="Date of asset purchase"
context="{'group_by':'purchase_date:month'}"/>
context="{'group_by':'date:month'}"/>
<filter string="Depreciation Month" help="Date of depreciation"
context="{'group_by':'depreciation_date:month'}"/>
</group>
</search>
</field>
</record>
<!--
Asset Revenue Recognition Search
-->
<record id="view_asset_revenue_report_search" model="ir.ui.view">
<field name="name">asset.revenue.report.search</field>
<field name="model">asset.asset.report</field>
<field name="arch" type="xml">
<search string="Deferred Revenue Analysis">
<field name="date"/>
<field name="depreciation_date"/>
<filter string="Draft" domain="[('state','=','draft')]" help="Recognition in draft state"/>
<filter string="Running" domain="[('state','=','open')]" help="Assets in running state"/>
<separator/>
<filter string="Posted" name="posted" domain="[('move_check','=',True)]" help="Posted depreciation lines" context="{'unposted_value_visible': 0}"/>
<field name="asset_id"/>
<field name="asset_category_id"/>
<group expand="0" string="Extended Filters...">
<field name="partner_id" filter_domain="[('partner_id','child_of',self)]"/>
<field name="company_id" groups="base.group_multi_company"/>
</group>
<group expand="1" string="Group By...">
<filter string="Revenue Recognition" name="revenue" context="{'group_by':'asset_id'}"/>
<filter string="Category" name="category" context="{'group_by':'asset_category_id'}"/>
<filter string="Company" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
<filter string="Sales Month" domain="[('date','=',time.strftime('%%Y-%%m-%%d'))]" context="{'group_by':'date'}" help="Date of Revenue Sales"/>
<filter string="Revenue Month" name='rev_month'
context="{'group_by':'depreciation_date'}" help="Revenue Month"/>
</group>
</search>
</field>
</record>
<record model="ir.actions.act_window" id="action_asset_asset_report">
<field name="name">Assets Analysis</field>
@@ -64,18 +124,45 @@
<field name="view_type">form</field>
<field name="view_mode">pivot,graph</field>
<field name="search_view_id" ref="view_asset_asset_report_search"/>
<field name="domain">[('asset_category_id.type', '=', 'purchase')]</field>
<field name="context">{}</field> <!-- force empty -->
<field name="help" type="html">
<p>
From this report, you can have an overview on all depreciation. The
tool search can also be used to personalise your Assets reports and
so, match this analysis to your needs;
From this report, you can have an overview on all depreciations. The
search bar can also be used to personalize your assets depreciation reporting.
</p>
</field>
</record>
<!--
Asset Revenue Recognition Action
-->
<record model="ir.actions.act_window" id="action_asset_revenue_report">
<field name="name">Deferred Revenue Analysis</field>
<field name="res_model">asset.asset.report</field>
<field name="view_type">form</field>
<field name="view_mode">pivot,graph</field>
<field name="search_view_id" ref="view_asset_revenue_report_search"/>
<field name="domain">[('asset_category_id.type', '=', 'sale')]</field>
<field name="context">{}</field>
<field name="help" type="html">
<p>
From this report, you can have an overview of your deferred revenue. The
search bar can also be used to personalize your revenue recognition reporting.
</p>
</field>
</record>
<menuitem action="action_asset_asset_report"
id="menu_action_asset_asset_report"
parent="account.menu_finance_reports"/>
</data>
</openerp>
parent="account.menu_finance_reports" sequence="21"/>
<!--
Asset Revenue Recognition Menu
-->
<menuitem action="action_asset_revenue_report"
id="menu_action_asset_revenue_report"
parent="account.menu_finance_reports" sequence="20"/>
</odoo>
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<odoo>
<data noupdate="1">
<record id="account_asset_category_multi_company_rule" model="ir.rule">
<field name="name">Account Asset Category multi-company</field>
@@ -16,4 +16,4 @@
</record>
</data>
</openerp>
</odoo>
@@ -0,0 +1,39 @@
/*
Purpose : show toggle button on depreciation/installment lines for posted/unposted line.
Details : called in list view with "<button name="create_move" type="object" widget="widgetonbutton"/>",
this will call the method create_move on the object account.asset.depreciation.line
*/
odoo.define('account_asset.widget', function(require) {
"use strict";
// openerp.account_asset = function (instance) {
// var _t = instance.web._t,
// _lt = instance.web._lt;
// var QWeb = instance.web.qweb;
// instance.web.account_asset = instance.web.account_asset || {};
var core = require('web.core');
var QWeb = core.qweb;
var list_widget_registry = core.list_widget_registry;
var Column = list_widget_registry.get('field');
var WidgetOnButton = Column.extend({
format: function (row_data, options) {
this._super(row_data, options);
this.has_value = !!row_data.move_check.value;
this.parent_state = row_data.parent_state.value;
this.icon = this.has_value ? 'gtk-yes' : 'gtk-no'; // or STOCK_YES and STOCK_NO
this.string = this.has_value ? 'Posted' : 'Unposted';
var template = this.icon && 'ListView.row.buttonwidget';
return QWeb.render(template, {
widget: this,
prefix: instance.session.prefix,
disabled: this.has_value,
invisible : true ? this.parent_state !== 'open' : false
});
},
});
list_widget_registry.add("button.widgetonbutton", WidgetOnButton);
});
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates id="template">
<button t-name="ListView.row.buttonwidget" type="button"
t-att-title="widget.string" t-att-disabled="disabled || undefined"
t-att-class="disabled ? 'oe_list_button_disabled' : '',invisible ? 'oe_form_invisible' : ''"
><img t-attf-src="#{prefix}/web/static/src/img/icons/#{widget.icon}.png"
t-att-alt="widget.string"/></button>
</templates>
@@ -1,35 +0,0 @@
-
In order to test the process of Account Asset, I perform a action to confirm Account Asset.
-
!python {model: account.asset.asset}: |
self.validate(cr, uid, [ref("account_asset_asset_vehicles_test0")])
-
I check Asset is now in Open state.
-
!assert {model: account.asset.asset, id: account_asset_asset_vehicles_test0, severity: error, string: Asset should be in Open state}:
- state == 'open'
-
I compute depreciation lines for asset of CEO's Car .
-
!python {model: account.asset.asset}: |
self.compute_depreciation_board(cr, uid, [ref("account_asset_asset_vehicles_test0")])
# pressing computation button can be remove if creation of depreciation lines while asset is created
value = self.browse(cr, uid, [ref("account_asset_asset_vehicles_test0")])[0]
assert value.method_number == len(value.depreciation_line_ids), 'Depreciation lines not created correctly'
-
I create account move for all depreciation lines.
-
!python {model: account.asset.depreciation.line}: |
ids = self.search(cr, uid, [('asset_id','=',ref('account_asset_asset_vehicles_test0'))])
self.create_move(cr, uid, ids)
-
I check the move line is created.
-
!python {model: account.asset.asset}: |
asset = self.browse(cr, uid, [ref("account_asset_asset_vehicles_test0")])[0]
assert len(asset.depreciation_line_ids) == len(asset.account_move_line_ids), 'Move lines not created correctly'
-
I Check that After creating all the moves of depreciation lines the state "Close".
-
!assert {model: account.asset.asset, id: account_asset_asset_vehicles_test0}:
- state == 'close'
@@ -1,9 +0,0 @@
-
!record {model: account.asset.category, id: account_asset_category_fixedassets_test0}:
account_asset_id: xfa
-
!record {model: account.asset.asset, id: account_asset_asset_vehicles_test0}:
category_id: account_asset_category_sale_test0
-
!record {model: account.asset.asset, id: account_asset_asset_vehicles_test0}:
method_number: 5
@@ -1,36 +1,49 @@
<?xml version="1.0" ?>
<openerp>
<odoo>
<data noupdate="1">
<!--
Asset Category Demo
-->
<record id="account_asset_category_fixedassets_test0" model="account.asset.category">
<field name="account_expense_depreciation_id" ref="a_expense"/>
<field name="account_depreciation_id" ref="a_expense"/>
<field name="account_asset_id" ref="xfa"/>
<field name="account_depreciation_id" ref="xfa"/>
<field name="journal_id" ref="expenses_journal"/>
<field name="name">Hardware - 3 Years</field>
<field name="method_number">3</field>
<field name="method_period">12</field>
</record>
<record id="account_asset_category_fixedassets_test1" model="account.asset.category">
<field name="account_expense_depreciation_id" ref="a_expense"/>
<field name="account_depreciation_id" ref="a_expense"/>
<field name="account_asset_id" ref="xfa"/>
<field name="account_depreciation_id" ref="xfa"/>
<field name="journal_id" ref="expenses_journal"/>
<field name="name">Cars - 5 Years</field>
<field name="method_number">5</field>
<field name="method_period">12</field>
</record>
<record id="account_asset_category_sale_test0" model="account.asset.category">
<field name="account_expense_depreciation_id" ref="a_sale"/>
<field name="account_depreciation_id" ref="a_sale"/>
<field name="account_asset_id" ref="xfa"/>
<field name="account_depreciation_id" ref="xfa"/>
<field name="journal_id" ref="expenses_journal"/>
<field name="name">Revenue Recognition Maintenance Contract - 3 Years</field>
<field name="journal_id" ref="sales_journal"/>
<field name="name">Maintenance Contract - 3 Years</field>
<field name="method_number">3</field>
<field name="method_period">12</field>
<field name="prorata" eval="True"/>
<field name="type">sale</field>
</record>
<record id="account_asset_category_sale1" model="account.asset.category">
<field name="account_asset_id" ref="xfa"/>
<field name="account_depreciation_id" ref="a_sale"/>
<field name="journal_id" ref="sales_journal"/>
<field name="name">Maintenance Contract - 1 Year</field>
<field name="method_number">12</field>
<field name="method_period">1</field>
<field name="prorata" eval="True"/>
<field name="type">sale</field>
</record>
<!--
@@ -43,7 +56,7 @@
<field eval="12" name="method_period"/>
<field eval="5" name="method_number"/>
<field name="name">CEO's Car</field>
<field eval="12000.0" name="purchase_value"/>
<field eval="12000.0" name="value"/>
<field name="category_id" ref="account_asset_category_fixedassets_test0"/>
</record>
@@ -52,7 +65,7 @@
<field eval="0.0" name="salvage_value"/>
<field name="method_time">end</field>
<field name="name">V6 Engine and 10 inches tires</field>
<field eval="2800.0" name="purchase_value"/>
<field eval="2800.0" name="value"/>
<field name="category_id" ref="account_asset_category_fixedassets_test0"/>
</record>
@@ -61,12 +74,75 @@
<field eval="100000.0" name="salvage_value"/>
<field name="state">open</field>
<field eval="12" name="method_period"/>
<field eval="20" name="method_number"/>
<field name="purchase_date" eval="time.strftime('%Y-01-01')"/>
<field eval="3" name="method_number"/>
<field name="date" eval="time.strftime('%Y-01-01')"/>
<field name="name">Office</field>
<field eval="500000.0" name="purchase_value"/>
<field eval="500000.0" name="value"/>
<field name="category_id" ref="account_asset_category_fixedassets_test0"/>
</record>
<record id="account_asset_asset_pc" model="account.asset.asset">
<field eval="1" name="prorata"/>
<field name="state">draft</field>
<field eval="12" name="method_period"/>
<field eval="3" name="method_number"/>
<field name="date" eval="time.strftime('%Y-01-01')"/>
<field name="name">Car Maintenance</field>
<field eval="30000.0" name="value"/>
<field name="category_id" ref="account_asset_category_sale_test0"/>
</record>
<record id="account_asset_asset_a/c" model="account.asset.asset">
<field eval="1" name="prorata"/>
<field name="state">open</field>
<field eval="1" name="method_period"/>
<field eval="12" name="method_number"/>
<field name="date" eval="time.strftime('%Y-01-01')"/>
<field name="name">Air Conditioner Maintenance Contract</field>
<field eval="1000.0" name="value"/>
<field name="category_id" ref="account_asset_category_sale1"/>
</record>
<!--
Assets Tests
-->
<!--
<record id="data_fiscalyear_plus1" model="account.fiscalyear">
<field ref="base.main_company" name="company_id"/>
<field eval="'%s-01-01' %(datetime.now().year+1)" name="date_start"/>
<field eval="'%s-12-31' %(datetime.now().year+1)" name="date_stop"/>
<field name="name" eval="'Fiscal Year X %s' %(datetime.now().year+1)"/>
<field name="code" eval="'FY%s' %(datetime.now().year+1)"/>
</record>
<record id="data_fiscalyear_plus2" model="account.fiscalyear">
<field ref="base.main_company" name="company_id"/>
<field eval="'%s-01-01' %(datetime.now().year+2)" name="date_start"/>
<field eval="'%s-12-31' %(datetime.now().year+2)" name="date_stop"/>
<field name="name" eval="'Fiscal Year X %s' %(datetime.now().year+2)"/>
<field name="code" eval="'FY%s' %(datetime.now().year+2)"/>
</record>
<record id="data_fiscalyear_plus3" model="account.fiscalyear">
<field ref="base.main_company" name="company_id"/>
<field eval="'%s-01-01' %(datetime.now().year+3)" name="date_start"/>
<field eval="'%s-12-31' %(datetime.now().year+3)" name="date_stop"/>
<field name="name" eval="'Fiscal Year X %s' %(datetime.now().year+3)"/>
<field name="code" eval="'FY%s' %(datetime.now().year+3)"/>
</record>
<record id="data_fiscalyear_plus4" model="account.fiscalyear">
<field ref="base.main_company" name="company_id"/>
<field eval="'%s-01-01' %(datetime.now().year+4)" name="date_start"/>
<field eval="'%s-12-31' %(datetime.now().year+4)" name="date_stop"/>
<field name="name" eval="'Fiscal Year X %s' %(datetime.now().year+4)"/>
<field name="code" eval="'FY%s' %(datetime.now().year+4)"/>
</record>
<record id="data_fiscalyear_plus5" model="account.fiscalyear">
<field ref="base.main_company" name="company_id"/>
<field eval="'%s-01-01' %(datetime.now().year+5)" name="date_start"/>
<field eval="'%s-12-31' %(datetime.now().year+5)" name="date_stop"/>
<field name="name" eval="'Fiscal Year X %s' %(datetime.now().year+5)"/>
<field name="code" eval="'FY%s' %(datetime.now().year+5)"/>
</record>
-->
</data>
</openerp>
</odoo>
@@ -1,27 +0,0 @@
-
I create a record to change the duration of asset for calculating depreciation.
-
!record {model: asset.modify, id: asset_modify_number_0, context: "{'active_id': ref('account_asset_asset_office_test0')}"}:
method_number: 10.0
-
I change the duration.
-
!python {model: asset.modify}: |
context = {"active_id":ref('account_asset_asset_office_test0')}
self.modify(cr, uid, [ref("asset_modify_number_0")], context=context)
-
I check the proper depreciation lines created.
-
!assert {model: account.asset.asset, id: account_asset.account_asset_asset_office_test0}:
- method_number == len(depreciation_line_ids) -1
-
I create a period to compute a asset on period.
-
!record {model: asset.depreciation.confirmation.wizard, id: asset_compute_period_0}:
{}
-
I compute a asset on period.
-
!python {model: asset.depreciation.confirmation.wizard}: |
context = {"active_ids": [ref("account_asset.account_asset_asset_office_test0")], "active_id":ref('account_asset.account_asset_asset_office_test0')}
self.asset_compute(cr, uid, [ref("asset_compute_period_0")], context=context)
+5
View File
@@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
#
##############################################################################
from . import test_account_asset
@@ -0,0 +1,128 @@
# -*- coding: utf-8 -*-
from openerp import tools
from openerp.tests import common
from openerp.modules.module import get_module_resource
class TestAccountAsset(common.TransactionCase):
def _load(self, module, *args):
tools.convert_file(self.cr, 'account_asset',
get_module_resource(module, *args),
{}, 'init', False, 'test', self.registry._assertion_report)
def test_00_account_asset_asset(self):
self._load('account', 'test', 'account_minimal_test.xml')
self._load('account_asset', 'test', 'account_asset_demo_test.xml')
# self.browse_ref("account_asset.data_fiscalyear_plus1").create_period()
# self.browse_ref("account_asset.data_fiscalyear_plus2").create_period()
# self.browse_ref("account_asset.data_fiscalyear_plus3").create_period()
# self.browse_ref("account_asset.data_fiscalyear_plus4").create_period()
# self.browse_ref("account_asset.data_fiscalyear_plus5").create_period()
# In order to test the process of Account Asset, I perform a action to confirm Account Asset.
self.browse_ref("account_asset.account_asset_asset_vehicles0").validate()
# I check Asset is now in Open state.
self.assertEqual(self.browse_ref("account_asset.account_asset_asset_vehicles0").state, 'open',
'Asset should be in Open state')
# I compute depreciation lines for asset of CEOs Car.
self.browse_ref("account_asset.account_asset_asset_vehicles0").compute_depreciation_board()
value = self.browse_ref("account_asset.account_asset_asset_vehicles0")
self.assertEqual(value.method_number, len(value.depreciation_line_ids),
'Depreciation lines not created correctly')
# I create account move for all depreciation lines.
ids = self.env['account.asset.depreciation.line'].search([('asset_id', '=', self.ref('account_asset.account_asset_asset_vehicles0'))])
for line in ids:
line.create_move()
# I check the move line is created.
asset = self.env['account.asset.asset'].browse([self.ref("account_asset.account_asset_asset_vehicles0")])[0]
self.assertEqual(len(asset.depreciation_line_ids), len(asset.account_move_line_ids),
'Move lines not created correctly')
# I Check that After creating all the moves of depreciation lines the state "Close".
self.assertEqual(self.browse_ref("account_asset.account_asset_asset_vehicles0").state, 'close',
'State of asset should be close')
invoice = self.env['account.invoice'].create({
'partner_id': self.ref("base.res_partner_12"),
'account_id': self.ref("account_asset.a_sale"),
})
self.env['account.invoice.line'].create({
'invoice_id': invoice.id,
'account_id': self.ref("account_asset.a_sale"),
'name': 'Insurance claim',
'price_unit': 450,
'quantity': 1,
'asset_category_id': self.ref("account_asset.account_asset_category_sale1"),
})
invoice.signal_workflow('invoice_open')
from datetime import datetime
from dateutil.relativedelta import relativedelta
line_obj = self.env['account.asset.depreciation.line']
recognition_ids = self.env['account.asset.asset'].search([('code', '=', invoice.number)])
self.assertTrue(recognition_ids,
'Revenue recognition has been not created from invoice.')
# I confirm revenue recognition.
for asset in recognition_ids:
asset.validate()
recognition = recognition_ids[0]
first_invoice_line = invoice.invoice_line_ids[0]
self.assertTrue(recognition.state == 'open',
'Recognition should be in Open state')
self.assertEqual(recognition.value, first_invoice_line.price_subtotal,
'Recognition value is not same as invoice line.')
# I post installment lines.
line_ids = [rec for rec in recognition.depreciation_line_ids]
for line in line_ids:
line.create_move()
# I check that move line is created from posted installment lines.
self.assertEqual(len(recognition.depreciation_line_ids), len(recognition.account_move_line_ids),
'Move lines not created correctly.')
# I check data in move line and installment line.
first_installment_line = recognition.depreciation_line_ids[0]
first_move_line = recognition.account_move_line_ids[0]
self.assertEqual(first_installment_line.amount, first_move_line.credit,
'First installment line amount is incorrect.')
remaining_value = recognition.value - first_installment_line.amount
self.assertEqual(first_installment_line.remaining_value, recognition.value - first_installment_line.amount,
'Remaining value is incorrect.')
# I check next installment date.
last_installment_date = datetime.strptime(first_installment_line.depreciation_date, '%Y-%m-%d')
installment_date = (last_installment_date+relativedelta(months=+recognition.method_period))
self.assertEqual(recognition.depreciation_line_ids[1].depreciation_date, str(installment_date.date()),
'Installment date is incorrect.')
# WIZARD
# I create a record to change the duration of asset for calculating depreciation.
account_asset_asset_office0 = self.browse_ref('account_asset.account_asset_asset_office0')
asset_modify_number_0 = self.env['asset.modify'].create({
'name': 'Test reason',
'method_number': 10.0,
}).with_context({'active_id': account_asset_asset_office0.id})
# I change the duration.
asset_modify_number_0.with_context({'active_id': account_asset_asset_office0.id}).modify()
# I check the proper depreciation lines created.
self.assertEqual(account_asset_asset_office0.method_number, len(account_asset_asset_office0.depreciation_line_ids) - 1)
# I compute a asset on period.
context = {
"active_ids": [self.ref("account_asset.menu_asset_depreciation_confirmation_wizard")],
"active_id": self.ref('account_asset.menu_asset_depreciation_confirmation_wizard'),
'type': 'sale'
}
asset_compute_period_0 = self.env['asset.depreciation.confirmation.wizard'].create({})
asset_compute_period_0.with_context(context).asset_compute()
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="assets_backend" name="account assets" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<script type="text/javascript" src="/account_asset/static/src/js/account_asset.js"></script>
</xpath>
</template>
</odoo>
@@ -0,0 +1,39 @@
<?xml version="1.0"?>
<odoo>
<record model="ir.ui.view" id="view_account_invoice_asset_form">
<field name="name">account.invoice.line.form</field>
<field name="model">account.invoice.line</field>
<field name="inherit_id" ref="account.view_invoice_line_form"/>
<field name="arch" type="xml">
<field name="account_id" position="after">
<field name="asset_category_id" domain="[('type','=','sale')]" string="Revenue Recognition Category"/>
</field>
</field>
</record>
<!-- Add "Asset Category" to supplier invoices -->
<record model="ir.ui.view" id="view_invoice_asset_category">
<field name="name">account.invoice.supplier.form</field>
<field name="model">account.invoice</field>
<field name="inherit_id" ref="account.invoice_supplier_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='invoice_line_ids']/tree/field[@name='quantity']" position="before">
<field string="Asset Category" name="asset_category_id" domain="[('type','=','purchase')]" context="{'default_type':'purchase'}"/>
</xpath>
</field>
</record>
<!-- Add "Asset Category" to customer invoices -->
<record model="ir.ui.view" id="view_invoice_revenue_recognition_category">
<field name="name">account.invoice.form</field>
<field name="model">account.invoice</field>
<field name="inherit_id" ref="account.invoice_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='invoice_line_ids']/tree/field[@name='quantity']" position="before">
<field string="Deferred Revenue Category" name="asset_category_id" domain="[('type','=','sale')]" context="{'default_type':'sale'}"/>
</xpath>
</field>
</record>
</odoo>
@@ -1,5 +1,4 @@
<openerp>
<data>
<odoo>
<!--
Asset Category
@@ -13,25 +12,39 @@
<group>
<group>
<field name="name"/>
<field name="type" attrs="{'invisible': 1}"/>
<field name="company_id" options="{'no_create': True}" groups="base.group_multi_company"/>
</group>
<group>
<field name="journal_id"/>
<field name="account_asset_id" on_change="onchange_account_asset(account_asset_id)"/>
<field name="account_depreciation_id"/>
<field name="account_expense_depreciation_id"/>
<div>
<label for="account_asset_id" string="Asset Account" attrs="{'invisible': [('type','!=','purchase')]}"/>
<label for="account_asset_id" string="Deferred Revenue Account" attrs="{'invisible': [('type','!=','sale')]}"/>
</div>
<field name="account_asset_id" nolabel="1" attrs="{'invisible': [('type','=', False)]}"/>
<div>
<label for="account_depreciation_id" string="Depreciation Account" attrs="{'invisible': [('type','!=','purchase')]}"/>
<label for="account_depreciation_id" string="Income Account" attrs="{'invisible': [('type','!=','sale')]}"/>
</div>
<field name="account_depreciation_id" nolabel="1"/>
</group>
<group string="Depreciation Dates">
<field name="method_time"/>
<field name="method_number" attrs="{'invisible':[('method_time','=','end')], 'required':[('method_time','=','number')]}"/>
<field name="method_period"/>
<field name="method_end" attrs="{'required': [('method_time','=','end')], 'invisible':[('method_time','=','number')]}"/>
<group>
<separator string="Periodicity" colspan="2"/>
<field name="method_time" string="Time Method Based On" widget="radio" attrs="{'invisible': [('type','!=','purchase')]}"/>
<field name="method_number" string="Number of Entries" attrs="{'invisible':['|',('method_time','!=','number'),'&amp;',('type','=', False)], 'required':[('method_time','=','number')]}"/>
<label for="method_period" string="Every"/>
<div>
<field name="method_period" nolabel="1" attrs="{'invisible': [('type','=', False)]}" class="oe_inline"/>
months
</div>
<field name="method_end" attrs="{'required': [('method_time','=','end')], 'invisible':[('method_time','!=','end')]}"/>
<field name="open_asset"/>
</group>
<group string="Depreciation Method">
<group attrs="{'invisible': [('type','=','sale')]}">
<separator string="Depreciation Method" colspan="2"/>
<field name="method" widget="radio"/>
<field name="method_progress_factor" attrs="{'invisible':[('method','=','linear')], 'required':[('method','=','degressive')]}"/>
<field name="prorata"/>
<field name="open_asset"/>
</group>
<group groups="analytic.group_analytic_accounting" string="Analytic Information">
<field name="account_analytic_id"/>
@@ -61,25 +74,28 @@
<field name="model">account.asset.category</field>
<field name="arch" type="xml">
<search string="Search Asset Category">
<field name="name" string="Asset Category"/>
<filter string="Sales" domain="[('type','=', 'sale')]" help="Deferred Revenues"/>
<filter string="Purchase" domain="[('type','=', 'purchase')]" help="Assets"/>
<field name="name" string="Category"/>
<field name="journal_id"/>
<group expand="0" string="Group By...">
<filter string="Type" domain="[]" context="{'group_by':'type'}"/>
</group>
</search>
</field>
</record>
<!--
Asset
-->
<record model="ir.ui.view" id="view_account_asset_asset_form">
<field name="name">account.asset.asset.form</field>
<field name="model">account.asset.asset</field>
<field name="arch" type="xml">
<form string="Asset">
<header>
<button name="validate" states="draft" string="Confirm Asset" type="object" class="oe_highlight"/>
<button name="validate" states="draft" string="Confirm" type="object" class="oe_highlight"/>
<button type="object" name="compute_depreciation_board" string="Compute Depreciation" states="draft"/>
<button name="set_to_close" states="open" string="Set to Close" type="object" class="oe_highlight"/>
<button name="set_to_draft" states="open" string="Set to Draft" type="object" />
<button name="%(action_asset_modify)d" states="open" string="Modify Depreciation" type="action"/>
<field name="state" widget="statusbar" statusbar_visible="draft,open"/>
</header>
<sheet>
@@ -96,63 +112,46 @@
</div>
<group>
<group>
<field name="category_id" on_change="onchange_category_id(category_id)"/>
<field name="category_id" domain="[('type', '=', default_category_id_type)]" context="{'default_type': default_category_id_type}" help="Category of asset"/>
<field name="code"/>
<field name="date" help="Date of asset"/>
<field name="type" invisible="1"/>
</group>
<group>
<field name="purchase_date"/>
<field name="currency_id" groups="base.group_multi_currency"/>
<field name="company_id" options="{'no_create': True}" groups="base.group_multi_company" on_change="onchange_company_id(company_id)"/>
<field name="company_id" options="{'no_create': True}" groups="base.group_multi_company"/>
<field name="value" widget="monetary" options="{'currency_field': 'currency_id'}" help="Gross value of asset"/>
<field name="salvage_value" widget="monetary" options="{'currency_field': 'currency_id'}"/>
<field name="value_residual" widget="monetary" options="{'currency_field': 'currency_id'}"/>
<field name="partner_id" string="Partner"/>
<field name="invoice_id" string="Invoice" domain="[('invoice_line_ids.asset_category_id.type','=','purchase')]"/>
</group>
</group>
<notebook colspan="4">
<page string="General">
<group>
<group>
<field name="purchase_value" widget="monetary" options="{'currency_field': 'currency_id'}" on_change="onchange_purchase_salvage_value(purchase_value, salvage_value)"/>
<field name="salvage_value" widget="monetary" options="{'currency_field': 'currency_id'}" on_change="onchange_purchase_salvage_value(purchase_value, salvage_value)"/>
<field name="value_residual" widget="monetary" options="{'currency_field': 'currency_id'}"/>
<field name="partner_id"/>
</group>
<group>
<field name="method" widget="radio"/>
<field name="method_progress_factor" attrs="{'invisible':[('method','=','linear')], 'required':[('method','=','degressive')]}"/>
<label for="method_time"/>
<div>
<field name="method_time" on_change="onchange_method_time(method_time)" class="oe_inline"/>
<button name="%(action_asset_modify)d" states="open" string="Change Duration" type="action" icon="terp-stock_effects-object-colorize" class="oe_inline" colspan="1"/>
</div>
<field name="prorata" attrs="{'invisible': [('method_time','=','end')]}"/>
<field name="method_number" attrs="{'invisible':[('method_time','=','end')], 'required':[('method_time','=','number')]}"/>
<field name="method_period"/>
<field name="method_end" attrs="{'required': [('method_time','=','end')], 'invisible':[('method_time','=','number')]}"/>
</group>
</group>
</page>
<page string="Depreciation Board">
<field name="depreciation_line_ids" mode="tree">
<tree string="Depreciation Lines" colors="blue:(move_check == False);black:(move_check == True)">
<field name="depreciation_line_ids" mode="tree" options="{'reload_whole_on_button': true}">
<tree string="Depreciation Lines" colors="blue:(move_check == False);black:(move_check == True)" create="false">
<field name="sequence" string="Serial Number"/>
<field name="depreciation_date"/>
<field name="sequence" invisible="1"/>
<field name="depreciated_value" readonly="1"/>
<field name="amount" widget="monetary"/>
<field name="remaining_value" readonly="1" widget="monetary"/>
<field name="move_check"/>
<field name="move_check" invisible="1"/>
<field name="parent_state" invisible="1"/>
<button name="create_move" attrs="{'invisible':['|',('move_check','!=',False),('parent_state','!=','open')]}" icon="gtk-execute" string="Create Move" type="object"/>
<button name="create_move" type="object" widget="widgetonbutton"/>
</tree>
<form string="Depreciation Lines">
<group>
<group>
<field name="parent_state" invisible="1"/>
<field name="name"/>
<field name="amount" widget="monetary"/>
<field name="sequence"/>
<field name="move_id"/>
<field name="move_check"/>
<field name="parent_state" invisible="1"/>
</group>
<group>
<field name="sequence"/>
<field name="amount" widget="monetary"/>
<field name="depreciation_date"/>
<field name="depreciated_value"/>
<field name="remaining_value"/>
@@ -160,17 +159,33 @@
</group>
</form>
</field>
<button type="object" name="compute_depreciation_board" string="Compute" icon="terp-stock_format-scientific" colspan="2" attrs="{'invisible':[('state','=','close')]}"/>
</page>
<page string="History">
<field name="account_move_line_ids" readonly="1"/>
<field name="history_ids" readonly="1"/>
</page>
<page string="Notes">
<field name="note" placeholder="Add an internal note here..."/>
</page>
</notebook>
<separator string="Depreciation Information" colspan="4"/>
<group>
<group>
<field name="method" widget="radio" attrs="{'invisible': [('type','=','sale')]}"/>
<field name="method_progress_factor" attrs="{'invisible':[('method','=','linear')], 'required':[('method','=','degressive')]}"/>
<label for="method_time"/>
<div>
<field name="method_time"/>
</div>
<field name="prorata" attrs="{'invisible': [('method_time','=','end')]}"/>
</group>
<group>
<field name="method_number" attrs="{'invisible':[('method_time','=','end')], 'required':[('method_time','=','number')]}"/>
<field name="method_period"/>
<field name="method_end" attrs="{'required': [('method_time','=','end')], 'invisible':[('method_time','=','number')]}"/>
</group>
</group>
</sheet>
<div class="oe_chatter">
<field name="message_follower_ids" widget="mail_followers"/>
<field name="message_ids" widget="mail_thread"/>
</div>
</form>
</field>
</record>
@@ -182,27 +197,9 @@
<tree string="Assets" colors="blue:(state == 'draft');grey:(state == 'close')">
<field name="name"/>
<field name="category_id"/>
<field name="purchase_date"/>
<field name="date"/>
<field name="partner_id"/>
<field name="purchase_value"/>
<field name="value_residual" widget="monetary"/>
<field name="currency_id" groups="base.group_multi_currency"/>
<field name="company_id" groups="base.group_multi_company"/>
<field name="state"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="view_account_asset_asset_hierarchy_tree">
<field name="name">account.asset.asset.hierarchy</field>
<field name="model">account.asset.asset</field>
<field name="arch" type="xml">
<tree string="Assets">
<field name="name"/>
<field name="code"/>
<field name="category_id"/>
<field name="purchase_date"/>
<field name="purchase_value"/>
<field name="value"/>
<field name="value_residual" widget="monetary"/>
<field name="currency_id" groups="base.group_multi_currency"/>
<field name="company_id" groups="base.group_multi_company"/>
@@ -217,15 +214,34 @@
<field name="arch" type="xml">
<search string="Account Asset">
<field name="name" string="Asset"/>
<field name="purchase_date"/>
<filter icon="terp-check" string="Current" domain="[('state','in', ('draft','open'))]" help="Assets in draft and open states"/>
<filter icon="terp-dialog-close" string="Closed" domain="[('state','=', 'close')]" help="Assets in closed state"/>
<field name="date"/>
<filter string="Current" domain="[('state','in', ('draft','open'))]" help="Assets in draft and open states"/>
<filter string="Closed" domain="[('state','=', 'close')]" help="Assets in closed state"/>
<field name="category_id"/>
<field name="partner_id" filter_domain="[('partner_id','child_of',self)]"/>
<group expand="0" string="Group By...">
<filter string="Month" domain="[]" context="{'group_by':'date'}"/>
<filter string="Category" domain="[]" context="{'group_by':'category_id'}"/>
</group>
</search>
</field>
</record>
<!-- Product Template -->
<record id="view_product_template_form_inherit" model="ir.ui.view">
<field name="name">Product Template (form)</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_form_view"/>
<field name="arch" type="xml">
<xpath expr="//group[@name='properties']" position="before">
<group name="asset types">
<field name="asset_category_id" domain="[('type','=','purchase')]" context="{'default_type':'purchase'}"/>
<field name="deferred_revenue_category_id" domain="[('type','=','sale')]" context="{'default_type':'sale'}"/>
</group>
</xpath>
</field>
</record>
<!--
Asset History
-->
@@ -269,15 +285,7 @@
</tree>
</field>
</record>
<record model="ir.actions.act_window" id="action_account_asset_asset_tree">
<field name="name">Asset Hierarchy</field>
<field name="res_model">account.asset.asset</field>
<field name="view_type">tree</field>
<field name="domain">[]</field>
<field name="view_id" ref="view_account_asset_asset_hierarchy_tree"/>
</record>
<record id="view_account_move_line_form_inherit" model="ir.ui.view">
<field name="name">Journal Items (form)</field>
<field name="model">account.move.line</field>
@@ -300,26 +308,51 @@
</field>
</record>
<menuitem id="menu_finance_assets" name="Assets and Revenues" parent="account.menu_finance_entries" sequence="9" groups="account.group_account_user"/>
<record model="ir.actions.act_window" id="action_account_asset_asset_form">
<field name="name">Assets</field>
<field name="res_model">account.asset.asset</field>
<field name="view_type">form</field>
<field name="view_id" ref="view_account_asset_asset_tree"/>
<field name="search_view_id" ref="view_account_asset_search"/>
<field name="domain">[('category_id.type', '=', 'purchase')]</field>
<field name="context">{'default_type': 'purchase', 'default_category_id_type': 'purchase'}</field>
</record>
<menuitem parent="account.menu_finance_entries" id="menu_action_account_asset_asset_form" action="action_account_asset_asset_form" name="Assets" groups="account.group_account_user" sequence="50"/>
<!-- Deferred Revenues Action -->
<act_window id="act_entries_open" name="Entries" res_model="account.move.line" src_model="account.asset.asset" context="{'search_default_asset_id': [active_id], 'default_asset_id': active_id}"/>
<record model="ir.actions.act_window" id="action_account_revenue_form">
<field name="name">Deferred Revenues</field>
<field name="res_model">account.asset.asset</field>
<field name="view_type">form</field>
<field name="domain">[('category_id.type', '=', 'sale')]</field>
<field name="context">{'default_type': 'sale', 'default_category_id_type': 'sale'}</field>
</record>
<record model="ir.actions.act_window" id="action_account_asset_asset_list_normal">
<field name="name">Asset Categories</field>
<menuitem parent="menu_finance_assets" id="menu_revenue_recognition" action="action_account_revenue_form" sequence="102"/>
<menuitem parent="menu_finance_assets" id="menu_action_account_asset_asset_form" action="action_account_asset_asset_form" sequence="104"/>
<!-- Configuration -->
<menuitem id="menu_finance_config_assets" name="Assets and Revenues" parent="account.menu_finance_configuration" sequence="25"/>
<record model="ir.actions.act_window" id="action_account_asset_asset_list_normal_sale">
<field name="name">Asset Types</field>
<field name="res_model">account.asset.category</field>
<field name="domain">[('type', '=', 'purchase')]</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="context">{'default_type': 'purchase'}</field>
</record>
<record model="ir.actions.act_window" id="action_account_asset_asset_list_normal_purchase">
<field name="name">Deferred Revenues Types</field>
<field name="res_model">account.asset.category</field>
<field name="domain">[('type', '=', 'sale')]</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="context">{'default_type': 'sale'}</field>
</record>
<menuitem parent="account.account_management_menu" id="menu_action_account_asset_asset_list_normal" action="action_account_asset_asset_list_normal" sequence="2"/>
<menuitem parent="account.account_management_menu" id="menu_action_account_asset_asset_list_normal_sale" action="action_account_asset_asset_list_normal_sale" sequence="1"/>
<menuitem parent="account.account_management_menu" id="menu_action_account_asset_asset_list_normal_purchase" action="action_account_asset_asset_list_normal_purchase" sequence="2"/>
</data>
</openerp>
</odoo>
+1 -20
View File
@@ -1,23 +1,4 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
# -*- coding: utf-8 -*-
import account_asset_change_duration
import wizard_asset_compute
@@ -1,63 +1,51 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import time
# -*- coding: utf-8 -*-
from lxml import etree
from openerp.osv import fields, osv
from openerp import api, fields, models
from openerp.osv.orm import setup_modifiers
class asset_modify(osv.osv_memory):
class AssetModify(models.TransientModel):
_name = 'asset.modify'
_description = 'Modify Asset'
def _get_asset_method_time(self, cr, uid, ids, field_name, arg, context=None):
if ids and len(ids) == 1 and context.get('active_id'):
asset = self.pool['account.asset.asset'].browse(cr, uid, context.get('active_id'), context=context)
return {ids[0]: asset.method_time}
else:
return dict.fromkeys(ids, False)
name = fields.Char(string='Reason', required=True)
method_number = fields.Integer(string='Number of Depreciations', required=True)
method_period = fields.Integer(string='Period Length')
method_end = fields.Date(string='Ending date')
note = fields.Text(string='Notes')
asset_method_time = fields.Char(compute='_get_asset_method_time', string='Asset Method Time', readonly=True)
_columns = {
'name': fields.char('Reason', required=True),
'method_number': fields.integer('Number of Depreciations', required=True),
'method_period': fields.integer('Period Length'),
'method_end': fields.date('Ending date'),
'note': fields.text('Notes'),
'asset_method_time': fields.function(_get_asset_method_time, type='char', string='Asset Method Time', readonly=True),
}
@api.one
def _get_asset_method_time(self):
if self.env.context.get('active_id'):
asset = self.env['account.asset.asset'].browse(self.env.context.get('active_id'))
self.asset_method_time = asset.method_time
def default_get(self, cr, uid, fields, context=None):
""" To get default values for the object.
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param fields: List of fields for which we want default values
@param context: A standard dictionary
@return: A dictionary which of fields with values.
"""
if not context:
context = {}
asset_obj = self.pool.get('account.asset.asset')
res = super(asset_modify, self).default_get(cr, uid, fields, context=context)
asset_id = context.get('active_id', False)
asset = asset_obj.browse(cr, uid, asset_id, context=context)
@api.model
def fields_view_get(self, view_id=None, view_type='form', toolbar=False, submenu=False):
result = super(AssetModify, self).fields_view_get(view_id, view_type, toolbar=toolbar, submenu=submenu)
asset_id = self.env.context.get('active_id')
active_model = self.env.context.get('active_model')
if active_model == 'account.asset.asset' and asset_id:
asset = self.env['account.asset.asset'].browse(asset_id)
doc = etree.XML(result['arch'])
if asset.method_time == 'number' and doc.xpath("//field[@name='method_end']"):
node = doc.xpath("//field[@name='method_end']")[0]
node.set('invisible', '1')
setup_modifiers(node, result['fields']['method_end'])
elif asset.method_time == 'end' and doc.xpath("//field[@name='method_number']"):
node = doc.xpath("//field[@name='method_number']")[0]
node.set('invisible', '1')
setup_modifiers(node, result['fields']['method_number'])
result['arch'] = etree.tostring(doc)
return result
@api.model
def default_get(self, fields):
res = super(AssetModify, self).default_get(fields)
asset_id = self.env.context.get('active_id')
asset = self.env['account.asset.asset'].browse(asset_id)
if 'name' in fields:
res.update({'name': asset.name})
if 'method_number' in fields and asset.method_time == 'number':
@@ -66,44 +54,34 @@ class asset_modify(osv.osv_memory):
res.update({'method_period': asset.method_period})
if 'method_end' in fields and asset.method_time == 'end':
res.update({'method_end': asset.method_end})
if context.get('active_id'):
res['asset_method_time'] = self._get_asset_method_time(cr, uid, [0], 'asset_method_time', [], context=context)[0]
if self.env.context.get('active_id'):
res['asset_method_time'] = self._get_asset_method_time()
return res
def modify(self, cr, uid, ids, context=None):
@api.multi
def modify(self):
""" Modifies the duration of asset for calculating depreciation
and maintains the history of old values.
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param ids: List of Ids
@param context: A standard dictionary
@return: Close the wizard.
"""
if not context:
context = {}
asset_obj = self.pool.get('account.asset.asset')
history_obj = self.pool.get('account.asset.history')
asset_id = context.get('active_id', False)
asset = asset_obj.browse(cr, uid, asset_id, context=context)
data = self.browse(cr, uid, ids[0], context=context)
"""
asset_id = self.env.context.get('active_id', False)
asset = self.env['account.asset.asset'].browse(asset_id)
history_vals = {
'asset_id': asset_id,
'name': data.name,
'name': self.name,
'method_time': asset.method_time,
'method_number': asset.method_number,
'method_period': asset.method_period,
'method_end': asset.method_end,
'user_id': uid,
'date': time.strftime('%Y-%m-%d'),
'note': data.note,
'user_id': self.env.uid,
'date': fields.Date.context_today(self),
'note': self.note,
}
history_obj.create(cr, uid, history_vals, context=context)
self.env['account.asset.history'].create(history_vals)
asset_vals = {
'method_number': data.method_number,
'method_period': data.method_period,
'method_end': data.method_end,
'method_number': self.method_number,
'method_period': self.method_period,
'method_end': self.method_end,
}
asset_obj.write(cr, uid, [asset_id], asset_vals, context=context)
asset_obj.compute_depreciation_board(cr, uid, [asset_id], context=context)
asset.write(asset_vals)
asset.compute_depreciation_board()
return {'type': 'ir.actions.act_window_close'}
@@ -1,46 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<odoo>
<record model="ir.ui.view" id="asset_modify_form">
<field name="name">wizard.asset.modify.form</field>
<field name="model">asset.modify</field>
<field name="arch" type="xml">
<form string="Modify Asset">
<field name="asset_method_time" invisible="1"/>
<group string="Asset Durations to Modify" col="4">
<group colspan="2" col="2">
<field name="name"/>
<field name="method_number" attrs="{'invisible': [('asset_method_time', '=', 'end')]}"/>
</group>
<group colspan="2" col="2">
<field name="method_end" attrs="{'invisible': [('asset_method_time', '=', 'number')]}"/>
<label for="method_period"/>
<div>
<field name="method_period" class="oe_inline"/> months
</div>
</group>
<record model="ir.ui.view" id="asset_modify_form">
<field name="name">wizard.asset.modify.form</field>
<field name="model">asset.modify</field>
<field name="arch" type="xml">
<form string="Modify Asset">
<field name="asset_method_time" invisible="1"/>
<group string="Asset Durations to Modify" col="4">
<group colspan="2" col="2">
<field name="name"/>
<field name="method_number" attrs="{'invisible': [('asset_method_time', '=', 'end')]}"/>
</group>
<separator string="Notes"/>
<field name="note"/>
<footer>
<button name="modify" string="Modify" type="object" class="oe_highlight"/>
or
<button string="Cancel" class="oe_link" special="cancel"/>
</footer>
</form>
</field>
</record>
<record id="action_asset_modify" model="ir.actions.act_window">
<field name="name">Modify Asset</field>
<field name="res_model">asset.modify</field>
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="asset_modify_form"/>
<field name="target">new</field>
</record>
<group colspan="2" col="2">
<field name="method_end" attrs="{'invisible': [('asset_method_time', '=', 'number')]}"/>
<label for="method_period"/>
<div>
<field name="method_period" class="oe_inline"/> months
</div>
</group>
</group>
<separator string="Notes"/>
<field name="note"/>
<footer>
<button name="modify" string="Modify" type="object" class="oe_highlight"/>
or
<button string="Cancel" class="oe_link" special="cancel"/>
</footer>
</form>
</field>
</record>
</data>
</openerp>
<record id="action_asset_modify" model="ir.actions.act_window">
<field name="name">Modify Asset</field>
<field name="res_model">asset.modify</field>
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="asset_modify_form"/>
<field name="target">new</field>
</record>
</odoo>
@@ -1,50 +1,29 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
# -*- coding: utf-8 -*-
from openerp import api, fields, models, _
from openerp.osv import fields, osv
from openerp.tools.translate import _
class asset_depreciation_confirmation_wizard(osv.osv_memory):
class AssetDepreciationConfirmationWizard(models.TransientModel):
_name = "asset.depreciation.confirmation.wizard"
_description = "asset.depreciation.confirmation.wizard"
_columns = {
'date': fields.date('Account Date', required=True, help="Choose the period for which you want to automatically post the depreciation lines of running assets"),
}
_defaults = {
'date': fields.date.context_today,
}
def asset_compute(self, cr, uid, ids, context):
ass_obj = self.pool.get('account.asset.asset')
asset_ids = context.get('active_ids', False)
data = self.browse(cr, uid, ids, context=context)
date = data[0].date
created_move_ids = ass_obj._compute_entries(cr, uid, asset_ids, date, context=context)
date = fields.Date('Account Date', required=True, help="Choose the period for which you want to automatically post the depreciation lines of running assets", default=fields.Date.context_today)
@api.multi
def asset_compute(self):
self.ensure_one()
context = self._context
assets = self.env['account.asset.asset'].search([('state', '=', 'open'), ('category_id.type', '=', context.get('asset_type'))])
created_move_ids = assets._compute_entries(self.date)
if context.get('asset_type') == 'purchase':
title = _('Created Asset Moves')
else:
title = _('Created Revenue Moves')
return {
'name': _('Created Asset Moves'),
'name': title,
'view_type': 'form',
'view_mode': 'tree,form',
'res_model': 'account.move',
'view_id': False,
'domain': "[('id','in',["+','.join(map(str,created_move_ids))+"])]",
'domain': "[('id','in',["+','.join(map(str, created_move_ids))+"])]",
'type': 'ir.actions.act_window',
}
@@ -1,40 +1,54 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_asset_depreciation_confirmation_wizard" model="ir.ui.view">
<field name="name">asset.depreciation.confirmation.wizard</field>
<field name="model">asset.depreciation.confirmation.wizard</field>
<field name="arch" type="xml">
<form string="Compute Asset">
<group>
<field name="date"/>
</group>
<footer>
<button string="Compute" name="asset_compute" type="object" class="oe_highlight"/>
or
<button string="Cancel" class="oe_link" special="cancel"/>
</footer>
</form>
</field>
</record>
<odoo>
<record id="view_asset_depreciation_confirmation_wizard" model="ir.ui.view">
<field name="name">asset.depreciation.confirmation.wizard</field>
<field name="model">asset.depreciation.confirmation.wizard</field>
<field name="arch" type="xml">
<form string="Compute Asset">
<div>
<p>
This wizard will post installment/depreciation lines for the selected month.<br/>
This will generate journal entries for all related installment lines on this period of asset/revenue recognition as well.
</p>
</div>
<group>
<field name="date"/>
</group>
<footer>
<button string="Generate Entries" name="asset_compute" type="object" class="oe_highlight"/>
or
<button string="Cancel" class="oe_link" special="cancel"/>
</footer>
</form>
</field>
</record>
<record id="action_asset_depreciation_confirmation_wizard" model="ir.actions.act_window">
<field name="name">Generate Depreciation Entries</field>
<field name="res_model">asset.depreciation.confirmation.wizard</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="view_asset_depreciation_confirmation_wizard"/>
<field name="target">new</field>
</record>
<record id="action_asset_depreciation_confirmation_wizard" model="ir.actions.act_window">
<field name="name">Post Depreciation Lines</field>
<field name="res_model">asset.depreciation.confirmation.wizard</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="view_asset_depreciation_confirmation_wizard"/>
<field name="target">new</field>
<field name="context">{'asset_type': 'purchase'}</field>
</record>
<record model="ir.values" id="action_asset_depreciation_confirmation_wizard_multi">
<field name="model_id" ref="account_asset.model_account_asset_asset" />
<field name="name">Generate Depreciation Entries</field>
<field name="key2">client_action_multi</field>
<field name="value" eval="'ir.actions.act_window,' +str(ref('action_asset_depreciation_confirmation_wizard'))" />
<field name="key">action</field>
<field name="model">account.asset.asset</field>
</record>
<record id="action_recognition_depreciation_confirmation_wizard" model="ir.actions.act_window">
<field name="name">Post Installment Lines</field>
<field name="res_model">asset.depreciation.confirmation.wizard</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="view_asset_depreciation_confirmation_wizard"/>
<field name="target">new</field>
<field name="context">{'asset_type': 'sale'}</field>
</record>
</data>
</openerp>
<menuitem name="Deferred Revenue Entries" action="action_recognition_depreciation_confirmation_wizard"
id="menu_recognition_depreciation_confirmation_wizard"
parent="account.menu_finance_payables" sequence="2"/>
<menuitem name="Assets Entries" action="action_asset_depreciation_confirmation_wizard"
id="menu_asset_depreciation_confirmation_wizard"
parent="account.menu_finance_receivables" sequence="1"/>
</odoo>
@@ -39,6 +39,9 @@
<field name="model">account.bank.statement</field>
<field name="inherit_id" ref="account.view_bank_statement_form"/>
<field name="arch" type="xml">
<field name="line_ids" position="attributes">
<attribute name="options">{'reload_on_button': true}</attribute>
</field>
<xpath expr="//field[@name='bank_account_id']" position="after">
<button name="button_cancel_reconciliation" attrs="{'invisible': [('journal_entry_ids', '=', [])]}" string="Cancel" type="object" icon="gtk-undo"/>
</xpath>
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
import datetime
from openerp import api, models, _
from openerp.tools.safe_eval import safe_eval as eval
#
# Use period and Journal for selection or resources
#
@@ -38,7 +39,7 @@ class ReportAssertAccount(models.AbstractModel):
'result': None, # used to store the result of the test
'column_order': None, # used to choose the display order of columns (in case you are returning a list of dict)
}
exec code_exec in localdict
eval(code_exec, localdict, mode="exec", nocopy=True)
result = localdict['result']
column_order = localdict.get('column_order', None)
@@ -114,8 +114,8 @@ class account_analytic_account(osv.osv):
digits=0),
}
def on_change_template(self, cr, uid, id, template_id, date_start=False, context=None):
res = super(account_analytic_account, self).on_change_template(cr, uid, id, template_id, date_start=date_start, context=context)
def on_change_template(self, cr, uid, ids, template_id, date_start=False, context=None):
res = super(account_analytic_account, self).on_change_template(cr, uid, ids, template_id, date_start=date_start, context=context)
if template_id and 'value' in res:
template = self.browse(cr, uid, template_id, context=context)
res['value']['charge_expenses'] = template.charge_expenses
+1
View File
@@ -31,6 +31,7 @@ import random
import datetime
from openerp.osv import fields, osv
from openerp.tools.translate import _
from openerp.tools.safe_eval import safe_eval as eval
from itertools import groupby
from operator import itemgetter
+2 -2
View File
@@ -140,8 +140,8 @@ class CompanyLDAP(osv.osv):
results = []
try:
conn = self.connect(conf)
conn.simple_bind_s(conf['ldap_binddn'] or '',
conf['ldap_password'].encode('utf-8') or '')
ldap_password = conf['ldap_password'] or ''
conn.simple_bind_s(conf['ldap_binddn'] or '', ldap_password.encode('utf-8'))
results = conn.search_st(conf['ldap_base'], ldap.SCOPE_SUBTREE,
filter, retrieve_attributes, timeout=60)
conn.unbind()
@@ -158,7 +158,14 @@ var BarcodeParser = Class.extend({
.replace("\.",".");
}
match['match'] = match['base_code'].substr(0,base_pattern.length).match(base_pattern);
if (base_pattern[0] !== '^') {
base_pattern = "^" + base_pattern;
}
if (base_pattern[base_pattern.length -1] !== '$') {
base_pattern = base_pattern + ".*$";
}
match.match = match.base_code.match(base_pattern);
return match;
},
@@ -27,6 +27,7 @@ import openerp
from openerp import SUPERUSER_ID
from openerp.osv import fields, osv
from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT
from openerp.tools.safe_eval import safe_eval as eval
_logger = logging.getLogger(__name__)
+9 -2
View File
@@ -158,12 +158,19 @@ class ir_import(orm.TransientModel):
all the fields to traverse
:rtype: list(Field)
"""
string_match = None
for field in fields:
# FIXME: should match all translations & original
# TODO: use string distance (levenshtein? hamming?)
if header.lower() == field['name'].lower() \
or header.lower() == field['string'].lower():
if header.lower() == field['name'].lower():
return [field]
if header.lower() == field['string'].lower():
# matching string are not reliable way because
# strings have no unique constraint
string_match = field
if string_match:
# this behavior is only applied if there is no matching field['name']
return [string_match]
if '/' not in header:
return []
+8 -5
View File
@@ -480,13 +480,13 @@ class calendar_alarm_manager(osv.AbstractModel):
def get_next_notif(self, cr, uid, context=None):
ajax_check_every_seconds = 300
partner = self.pool.get('res.users').browse(cr, uid, uid, context=context).partner_id
partner = self.pool['res.users'].read(cr, SUPERUSER_ID, uid, ['partner_id', 'calendar_last_notif_ack'], context=context)
all_notif = []
if not partner:
return []
all_events = self.get_next_potential_limit_alarm(cr, uid, ajax_check_every_seconds, partner_id=partner.id, mail=False, context=context)
all_events = self.get_next_potential_limit_alarm(cr, uid, ajax_check_every_seconds, partner_id=partner['partner_id'][0], mail=False, context=context)
for event in all_events: # .values()
max_delta = all_events[event]['max_duration']
@@ -496,7 +496,7 @@ class calendar_alarm_manager(osv.AbstractModel):
LastFound = False
for one_date in self.pool.get("calendar.event").get_recurrent_date_by_event(cr, uid, curEvent, context=context):
in_date_format = one_date.replace(tzinfo=None)
LastFound = self.do_check_alarm_for_one_date(cr, uid, in_date_format, curEvent, max_delta, ajax_check_every_seconds, after=partner.calendar_last_notif_ack, mail=False, context=context)
LastFound = self.do_check_alarm_for_one_date(cr, uid, in_date_format, curEvent, max_delta, ajax_check_every_seconds, after=partner['calendar_last_notif_ack'], mail=False, context=context)
if LastFound:
for alert in LastFound:
all_notif.append(self.do_notif_reminder(cr, uid, alert, context=context))
@@ -506,7 +506,7 @@ class calendar_alarm_manager(osv.AbstractModel):
break
else:
in_date_format = datetime.strptime(curEvent.start, DEFAULT_SERVER_DATETIME_FORMAT)
LastFound = self.do_check_alarm_for_one_date(cr, uid, in_date_format, curEvent, max_delta, ajax_check_every_seconds, after=partner.calendar_last_notif_ack, mail=False, context=context)
LastFound = self.do_check_alarm_for_one_date(cr, uid, in_date_format, curEvent, max_delta, ajax_check_every_seconds, after=partner['calendar_last_notif_ack'], mail=False, context=context)
if LastFound:
for alert in LastFound:
all_notif.append(self.do_notif_reminder(cr, uid, alert, context=context))
@@ -586,7 +586,7 @@ class calendar_alarm(osv.Model):
def _update_cron(self, cr, uid, context=None):
try:
cron = self.pool['ir.model.data'].get_object(
cr, uid, 'calendar', 'ir_cron_scheduler_alarm', context=context)
cr, SUPERUSER_ID, 'calendar', 'ir_cron_scheduler_alarm', context=context)
except ValueError:
return False
return cron.toggle(model=self._name, domain=[('type', '=', 'email')])
@@ -702,6 +702,9 @@ class calendar_event(osv.Model):
val = pytz.UTC.localize(val)
return val.astimezone(timezone)
if context is None:
context = {}
timezone = pytz.timezone(context.get('tz') or 'UTC')
startdate = pytz.UTC.localize(datetime.strptime(event.start, DEFAULT_SERVER_DATETIME_FORMAT)) # Add "+hh:mm" timezone
if not startdate:
+11
View File
@@ -5,5 +5,16 @@
<menuitem name="Import &amp; Synchronize" id="base.menu_import_crm"
parent="base.menu_base_partner"/>
<record id="view_crm_meeting_search" model="ir.ui.view">
<field name="name">CRM - Meetings Search</field>
<field name="model">calendar.event</field>
<field name="inherit_id" ref="calendar.view_calendar_event_search"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='user_id']" position="after">
<field name="opportunity_id"/>
</xpath>
</field>
</record>
</data>
</openerp>
+5 -24
View File
@@ -82,31 +82,11 @@ class crm_lead(format_address, osv.osv):
context['empty_list_help_document_name'] = _("leads")
return super(crm_lead, self).get_empty_list_help(cr, uid, help, context=context)
def _get_default_team_id(self, cr, uid, user_id=False, context=None):
""" Gives default team by checking if present in the context """
team_id = self._resolve_team_id_from_context(cr, uid, context=context) or False
return team_id
def _get_default_stage_id(self, cr, uid, context=None):
""" Gives default stage_id """
team_id = self._get_default_team_id(cr, uid, context=context)
team_id = self.pool['crm.team']._get_default_team_id(cr, uid, context=context)
return self.stage_find(cr, uid, [], team_id, [('fold', '=', False)], context=context)
def _resolve_team_id_from_context(self, cr, uid, context=None):
""" Returns ID of team based on the value of 'team_id'
context key, or None if it cannot be resolved to a single
Sales Team.
"""
if context is None:
context = {}
if type(context.get('default_team_id')) in (int, long):
return context.get('default_team_id')
if isinstance(context.get('default_team_id'), basestring):
team_ids = self.pool.get('crm.team').name_search(cr, uid, name=context['default_team_id'], context=context)
if len(team_ids) == 1:
return int(team_ids[0][0])
return None
def _resolve_type_from_context(self, cr, uid, context=None):
""" Returns the type (lead or opportunity) from the type context
key. Returns None if it cannot be resolved.
@@ -127,7 +107,7 @@ class crm_lead(format_address, osv.osv):
# - OR ('case_default', '=', True), ('fold', '=', False): add default columns that are not folded
# - OR ('team_ids', '=', team_id), ('fold', '=', False) if team_id: add team columns that are not folded
search_domain = []
team_id = self._resolve_team_id_from_context(cr, uid, context=context)
team_id = self.pool['crm.team']._resolve_team_id_from_context(cr, uid, context=context)
if team_id:
search_domain += ['|', ('team_ids', '=', team_id)]
search_domain += [('id', 'in', ids)]
@@ -282,7 +262,7 @@ class crm_lead(format_address, osv.osv):
'type': 'lead',
'user_id': lambda s, cr, uid, c: uid,
'stage_id': lambda s, cr, uid, c: s._get_default_stage_id(cr, uid, c),
'team_id': lambda s, cr, uid, c: s._get_default_team_id(cr, uid, context=c),
'team_id': lambda s, cr, uid, c: s.pool['crm.team']._get_default_team_id(cr, uid, context=c),
'company_id': lambda s, cr, uid, c: s.pool.get('res.company')._company_default_get(cr, uid, 'crm.lead', context=c),
'priority': lambda *a: crm.AVAILABLE_PRIORITIES[0][0],
'color': 0,
@@ -329,7 +309,7 @@ class crm_lead(format_address, osv.osv):
def on_change_user(self, cr, uid, ids, user_id, context=None):
""" When changing the user, also set a team_id or restrict team id
to the ones user_id is member of. """
team_id = self._get_default_team_id(cr, uid, context=context)
team_id = self.pool['crm.team']._get_default_team_id(cr, uid, user_id=user_id, context=context)
if user_id and not team_id and self.pool['res.users'].has_group(cr, uid, 'base.group_multi_salesteams'):
team_ids = self.pool.get('crm.team').search(cr, uid, ['|', ('user_id', '=', user_id), ('member_ids', '=', user_id)], context=context)
if team_ids:
@@ -910,6 +890,7 @@ class crm_lead(format_address, osv.osv):
if lead.partner_id:
partner_ids.append(lead.partner_id.id)
res['context'] = {
'search_default_opportunity_id': lead.type == 'opportunity' and lead.id or False,
'default_opportunity_id': lead.type == 'opportunity' and lead.id or False,
'default_partner_id': lead.partner_id and lead.partner_id.id or False,
'default_partner_ids': partner_ids,
+2 -2
View File
@@ -410,8 +410,8 @@
<field name="arch" type="xml">
<form string="Opportunities">
<header>
<button name="case_mark_won" string="Mark Won" type="object" class="oe_highlight"/>
<button name="case_mark_lost" string="Mark Lost" type="object" class="oe_highlight"/>
<button name="case_mark_won" string="Mark Won" attrs="{'invisible': [('probability', '=', 100)]}" type="object" class="oe_highlight"/>
<button name="case_mark_lost" string="Mark Lost" attrs="{'invisible': [('probability', '=', 100)]}" type="object" class="oe_highlight"/>
<field name="stage_id" widget="statusbar" clickable="True"
options="{'fold_field': 'fold'}"
domain="['&amp;', ('team_ids', '=', team_id), '|', ('type', '=', type), ('type', '=', 'both')]"/>
+1
View File
@@ -77,6 +77,7 @@ class crm_phonecall(osv.osv):
'priority': '1',
'state': _get_default_state,
'user_id': lambda self, cr, uid, ctx: uid,
'team_id': lambda s, cr, uid, c: s.pool['crm.team']._get_default_team_id(cr, uid, context=c),
'active': 1
}
+2
View File
@@ -7,6 +7,8 @@ access_crm_stage,crm.stage,model_crm_stage,,1,0,0,0
access_crm_stage_manager,crm.stage,model_crm_stage,base.group_sale_manager,1,1,1,1
access_crm_phonecall_report_user,crm.phonecall.report.user,model_crm_phonecall_report,base.group_sale_salesman,1,0,0,0
access_crm_phonecall_report_manager,crm.phonecall.report,model_crm_phonecall_report,base.group_sale_manager,1,1,1,1
access_crm_opportunity_report_user,crm.opportunity.report,model_crm_opportunity_report,base.group_sale_salesman,1,0,0,0
access_crm_opportunity_report_manager,crm.opportunity.report,model_crm_opportunity_report,base.group_sale_manager,1,1,1,1
access_res_partner_manager,res.partner.crm.manager,base.model_res_partner,base.group_sale_manager,1,0,0,0
access_res_partner_category_manager,res.partner.category.crm.manager,base.model_res_partner_category,base.group_sale_manager,1,0,0,0
access_res_partner,res.partner.crm.user,base.model_res_partner,base.group_sale_salesman,1,1,1,0
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
7 access_crm_stage_manager crm.stage model_crm_stage base.group_sale_manager 1 1 1 1
8 access_crm_phonecall_report_user crm.phonecall.report.user model_crm_phonecall_report base.group_sale_salesman 1 0 0 0
9 access_crm_phonecall_report_manager crm.phonecall.report model_crm_phonecall_report base.group_sale_manager 1 1 1 1
10 access_crm_opportunity_report_user crm.opportunity.report model_crm_opportunity_report base.group_sale_salesman 1 0 0 0
11 access_crm_opportunity_report_manager crm.opportunity.report model_crm_opportunity_report base.group_sale_manager 1 1 1 1
12 access_res_partner_manager res.partner.crm.manager base.model_res_partner base.group_sale_manager 1 0 0 0
13 access_res_partner_category_manager res.partner.category.crm.manager base.model_res_partner_category base.group_sale_manager 1 0 0 0
14 access_res_partner res.partner.crm.user base.model_res_partner base.group_sale_salesman 1 1 1 0
+2 -6
View File
@@ -59,13 +59,9 @@ class crm_claim(osv.osv):
_order = "priority,date desc"
_inherit = ['mail.thread']
def _get_default_team_id(self, cr, uid, context=None):
""" Gives default team by checking if present in the context """
return self.pool.get('crm.lead')._resolve_team_id_from_context(cr, uid, context=context) or False
def _get_default_stage_id(self, cr, uid, context=None):
""" Gives default stage_id """
team_id = self._get_default_team_id(cr, uid, context=context)
team_id = self.pool['crm.team']._get_default_team_id(cr, uid, context=context)
return self.stage_find(cr, uid, [], team_id, [('sequence', '=', '1')], context=context)
_columns = {
@@ -103,7 +99,7 @@ class crm_claim(osv.osv):
_defaults = {
'user_id': lambda s, cr, uid, c: uid,
'team_id': lambda s, cr, uid, c: s._get_default_team_id(cr, uid, c),
'team_id': lambda s, cr, uid, c: s.pool['crm.team']._get_default_team_id(cr, uid, context=c),
'date': fields.datetime.now,
'company_id': lambda s, cr, uid, c: s.pool.get('res.company')._company_default_get(cr, uid, 'crm.case', context=c),
'priority': '1',
+1 -1
View File
@@ -15,7 +15,7 @@
claim_ids = self.search(cr, uid, [('email_from','=', 'Mr. John Right <info@customer.com>')])
assert claim_ids and len(claim_ids), "Claim is not created after getting request"
claim = self.browse(cr, uid, claim_ids[0], context=context)
assert claim.name == tools.ustr("demande derèglement de votre produit."), "Subject does not match"
assert claim.name == tools.ustr("demande de règlement de votre produit."), "Subject does not match"
-
I open customer claim.
-
+1
View File
@@ -81,6 +81,7 @@ class crm_helpdesk(osv.osv):
'user_id': lambda s, cr, uid, c: uid,
'state': lambda *a: 'draft',
'date': fields.datetime.now,
'team_id': lambda s, cr, uid, c: s.pool['crm.team']._get_default_team_id(cr, uid, context=c),
'company_id': lambda s, cr, uid, c: s.pool.get('res.company')._company_default_get(cr, uid, 'crm.helpdesk', context=c),
'priority': '1',
}
+1
View File
@@ -21,6 +21,7 @@
from openerp.osv import osv
from openerp.tools.translate import _
from openerp.tools.safe_eval import safe_eval as eval
from openerp.exceptions import UserError
+2 -1
View File
@@ -43,7 +43,8 @@ invoices from picking, OpenERP is able to add and compute the shipping line.
'demo': ['delivery_demo.xml'],
'test': [
'../account/test/account_minimal_test.xml',
'test/delivery_cost.yml'
'test/delivery_cost.yml',
'test/stock_move_values_with_invoice_before_delivery.yml',
],
'installable': True,
'auto_install': False,
+3
View File
@@ -24,6 +24,7 @@ import time
from openerp.osv import fields,osv
from openerp.tools.translate import _
import openerp.addons.decimal_precision as dp
from openerp.tools.safe_eval import safe_eval as eval
from openerp.exceptions import UserError
_logger = logging.getLogger(__name__)
@@ -215,6 +216,8 @@ class delivery_grid(osv.osv):
total_delivery = 0.0
product_uom_obj = self.pool.get('product.uom')
for line in order.order_line:
if line.state == 'cancel':
continue
if line.is_delivery:
total_delivery += line.price_subtotal + self.pool['sale.order']._amount_line_tax(cr, uid, line, context=context)
if not line.product_id or line.is_delivery:
+6 -1
View File
@@ -66,6 +66,7 @@ class sale_order(osv.Model):
carrier_obj = self.pool.get('delivery.carrier')
acc_fp_obj = self.pool.get('account.fiscal.position')
self._delivery_unset(cr, uid, ids, context=context)
currency_obj = self.pool.get('res.currency')
for order in self.browse(cr, uid, ids, context=context):
grid_id = carrier_obj.grid_get(cr, uid, [order.carrier_id.id], order.partner_shipping_id.id)
if not grid_id:
@@ -79,6 +80,10 @@ class sale_order(osv.Model):
taxes = grid.carrier_id.product_id.taxes_id
fpos = order.fiscal_position_id or False
taxes_ids = acc_fp_obj.map_tax(cr, uid, fpos, taxes)
price_unit = grid_obj.get_price(cr, uid, grid.id, order, time.strftime('%Y-%m-%d'), context)
if order.company_id.currency_id.id != order.pricelist_id.currency_id.id:
price_unit = currency_obj.compute(cr, uid, order.company_id.currency_id.id, order.pricelist_id.currency_id.id,
price_unit, context=dict(context or {}, date=order.date_order))
#create the sale order line
line_obj.create(cr, uid, {
'order_id': order.id,
@@ -86,7 +91,7 @@ class sale_order(osv.Model):
'product_uom_qty': 1,
'product_uom': grid.carrier_id.product_id.uom_id.id,
'product_id': grid.carrier_id.product_id.id,
'price_unit': grid_obj.get_price(cr, uid, grid.id, order, time.strftime('%Y-%m-%d'), context),
'price_unit': price_unit,
'tax_id': [(6, 0, taxes_ids)],
'is_delivery': True
}, context=context)
@@ -0,0 +1,79 @@
-
test that the store fields of stock moves are computed with invoice before delivery flow
-
set a weight on ipod 16GB
-
!python {model: product.product, id: product.product_product_11}: |
self.write({'weight': 0.25, 'weight_net': 0.2})
-
create a SO with invoice before delivery
-
!record {model: sale.order, id: sale_prepaid}:
partner_id: base.res_partner_18
partner_invoice_id: base.res_partner_18
partner_shipping_id: base.res_partner_18
pricelist_id: product.list0
order_policy: 'prepaid'
order_line:
- name: 'Ipod'
product_id: product.product_product_11
product_uom_qty: 2
product_uos_qty: 2
product_uom: product.product_uom_unit
price_unit: 750.00
carrier_id: normal_delivery_carrier
-
I add delivery cost in Sale order.
-
!python {model: sale.order, id: sale_prepaid}: |
self.delivery_set()
-
I confirm the SO.
-
!workflow {model: sale.order, action: order_confirm, ref: sale_prepaid}
-
I check that the invoice was created
-
!python {model: sale.order, id: sale_prepaid}: |
assert len(self.invoice_ids) == 1, "Invoice not created."
-
I confirm the invoice
-
!python {model: sale.order, id: sale_prepaid}: |
invoice = self.invoice_ids[0]
invoice.signal_workflow('invoice_open')
-
I pay the invoice.
-
!python {model: sale.order, id: sale_prepaid}: |
invoice = self.invoice_ids[0]
invoice.signal_workflow('invoice_open')
journal = self.env['account.journal'].search([('type', '=', 'cash'),
('company_id', '=', self.company_id.id)],
limit=1)
invoice.pay_and_reconcile(journal, invoice.amount_total)
-
Check the SO after paying the invoice
-
!python {model: sale.order, id: sale_prepaid}: |
assert self.invoice_count != 0, 'order not invoiced'
assert self.invoiced, 'order is not paid'
assert len(self.picking_ids) == 1, 'pickings not generated'
-
check the stock moves
-
!python {model: sale.order, id: sale_prepaid}: |
move = self.picking_ids.move_lines
assert move.product_qty == 2, 'wrong product_qty'
assert move.weight == 0.5, 'wrong move weight'
assert move.weight_net == 0.4, 'wrong move weight_net'
-
ship
-
!python {model: sale.order, id: sale_prepaid}: |
picking = self.picking_ids.action_done()
-
Check the SO after shipping
-
!python {model: sale.order, id: sale_prepaid}: |
assert self.state == 'done'
+5 -2
View File
@@ -115,8 +115,11 @@ class document_file(osv.osv):
ids.extend(parents[parent_id])
# sort result according to the original sort ordering
ids = [id for id in orig_ids if id in ids]
return len(ids) if count else ids
if count:
return len(ids)
else:
set_ids = set(ids)
return [id for id in orig_ids if id in set_ids]
def copy(self, cr, uid, id, default=None, context=None):
if not default:
+2 -1
View File
@@ -250,7 +250,7 @@ class event_event(models.Model):
return res
@api.one
def mail_attendees(self, template_id, force_send=False, filter_func=lambda self: True):
def mail_attendees(self, template_id, force_send=True, filter_func=lambda self: True):
for attendee in self.registration_ids.filtered(filter_func):
self.env['mail.template'].browse(template_id).send_mail(attendee.id, force_send=force_send)
@@ -336,6 +336,7 @@ class event_registration(models.Model):
body=_('New registration confirmed: %s.') % (self.name or ''),
subtype="event.mt_event_registration")
self.state = 'open'
self.env['event.mail'].run()
@api.one
def button_reg_close(self):
+1 -1
View File
@@ -235,7 +235,7 @@
<separator/>
<filter string="My Events" help="My Events" domain="[('user_id','=',uid)]"/>
<separator/>
<filter string="Upcoming" name="upcoming" domain="[('date_begin','&gt;=',datetime.datetime.now().replace(hour=0, minute=0, second=0))]" help="Upcoming events from today" />
<filter string="Upcoming" name="upcoming" domain="[('date_begin','&gt;=', datetime.datetime.combine(context_today(), datetime.time(0,0,0)))]" help="Upcoming events from today" />
<field name="type"/>
<field name="user_id"/>
<group expand="0" string="Group By">
+1 -1
View File
@@ -60,7 +60,7 @@ class TestMailSchedule(TestEventCommon):
self.assertTrue(schedulers[0].done, 'event: reminder scheduler should be done')
mails = self.env['mail.mail'].search([('subject', 'ilike', 'reminder'), ('date', '>=', datetime.datetime.strftime(now, tools.DEFAULT_SERVER_DATETIME_FORMAT))], order='date DESC', limit=3)
self.assertEqual(len(mails), 2, 'event: wrong number of reminder mail sent')
self.assertEqual(len(mails), 0, 'event: reminder to sent is not empty')
# check subscription scheduler
schedulers = self.EventMail.search([('event_id', '=', test_event.id), ('interval_type', '=', 'after_sub')])
+6 -4
View File
@@ -414,7 +414,7 @@ class google_calendar(osv.AbstractModel):
user_obj = self.pool['res.users']
myPartnerID = user_obj.browse(cr, uid, uid, context).partner_id.id
attendee_record = []
alarm_record = []
alarm_record = set()
partner_record = [(4, myPartnerID)]
result = {}
@@ -461,7 +461,7 @@ class google_calendar(osv.AbstractModel):
'name': "%s minutes - %s" % (google_alarm['minutes'], google_alarm['method'])
}
alarm_id = [calendar_alarm_obj.create(cr, uid, data, context=context)]
alarm_record.append(alarm_id[0])
alarm_record.add(alarm_id[0])
UTC = pytz.timezone('UTC')
if single_event_dict.get('start') and single_event_dict.get('end'): # If not cancelled
@@ -489,7 +489,7 @@ class google_calendar(osv.AbstractModel):
result.update({
'attendee_ids': attendee_record,
'partner_ids': list(set(partner_record)),
'alarm_ids': [(6, 0, alarm_record)],
'alarm_ids': [(6, 0, list(alarm_record))],
'name': single_event_dict.get('summary', 'Event'),
'description': single_event_dict.get('description', False),
@@ -976,7 +976,9 @@ class calendar_event(osv.Model):
_inherit = "calendar.event"
def get_fields_need_update_google(self, cr, uid, context=None):
return ['name', 'description', 'allday', 'date', 'date_end', 'stop', 'attendee_ids', 'alarm_ids', 'location', 'class', 'active']
return ['name', 'description', 'allday', 'start', 'date_end', 'stop',
'attendee_ids', 'alarm_ids', 'location', 'class', 'active',
'start_date', 'start_datetime', 'stop_date', 'stop_datetime']
def write(self, cr, uid, ids, vals, context=None):
if context is None:
+1
View File
@@ -23,6 +23,7 @@ from openerp import SUPERUSER_ID
from openerp.addons.google_account import TIMEOUT
from openerp.osv import fields, osv
from openerp.tools.translate import _
from openerp.tools.safe_eval import safe_eval as eval
from openerp.exceptions import UserError
import werkzeug.urls
+2 -2
View File
@@ -159,12 +159,12 @@ class account_analytic_account(models.Model):
@api.onchange('invoice_on_timesheets')
def onchange_invoice_on_timesheets(self):
result = {}
result = {'value': {}}
if not self.invoice_on_timesheets:
return {'value': {'to_invoice': False}}
try:
to_invoice = self.env['ir.model.data'].xmlid_to_res_id('hr_timesheet_invoice.timesheet_invoice_factor1')
result['to_invoice'] = to_invoice
result['value']['to_invoice'] = to_invoice
except ValueError:
pass
return result
@@ -314,8 +314,8 @@ class account_analytic_line(osv.osv):
res['value']['to_invoice'] = st or False
if acc.state == 'pending':
res['warning'] = {
'title': 'Warning',
'message': 'The analytic account is in pending state.\nYou should not work on this account !'
'title': _('Warning'),
'message': _('The analytic account is in pending state.\nYou should not work on this account !')
}
elif acc.state == 'close' or acc.state == 'cancelled':
raise osv.except_osv(_('Invalid Analytic Account!'), _('You cannot select a Analytic Account which is in Close or Cancelled state.'))
+2 -2
View File
@@ -192,12 +192,12 @@ class Proxy(http.Controller):
print 'print_receipt' + str(receipt)
@http.route('/hw_proxy/is_scanner_connected', type='json', auth='none', cors='*')
def print_receipt(self, receipt):
def is_scanner_connected(self, receipt):
print 'is_scanner_connected?'
return False
@http.route('/hw_proxy/scanner', type='json', auth='none', cors='*')
def print_receipt(self, receipt):
def scanner(self, receipt):
print 'scanner'
time.sleep(10)
return ''
+1
View File
@@ -37,6 +37,7 @@ such as the Mettler Toledo Ariva.
""",
'author': 'OpenERP SA',
'depends': ['hw_proxy'],
'external_dependencies': {'python': ['serial']},
'test': [
],
'installable': True,
+13 -7
View File
@@ -178,28 +178,34 @@ class Scale(Thread):
if not self.device:
time.sleep(5)
s = Scale()
hw_proxy.drivers['scale'] = s
scale_thread = None
if serial:
scale_thread = Scale()
hw_proxy.drivers['scale'] = scale_thread
class ScaleDriver(hw_proxy.Proxy):
@http.route('/hw_proxy/scale_read/', type='json', auth='none', cors='*')
def scale_read(self):
return {'weight':s.get_weight(), 'unit':'kg', 'info':s.get_weight_info()}
if scale_thread:
return {'weight': scale_thread.get_weight(), 'unit':'kg', 'info': scale_thread.get_weight_info()}
return None
@http.route('/hw_proxy/scale_zero/', type='json', auth='none', cors='*')
def scale_zero(self):
s.set_zero()
if scale_thread:
scale_thread.set_zero()
return True
@http.route('/hw_proxy/scale_tare/', type='json', auth='none', cors='*')
def scale_tare(self):
s.set_tare()
if scale_thread:
scale_thread.set_tare()
return True
@http.route('/hw_proxy/scale_clear_tare/', type='json', auth='none', cors='*')
def scale_clear_tare(self):
s.clear_tare()
if scale_thread:
scale_thread.clear_tare()
return True
+1
View File
@@ -38,6 +38,7 @@ point of sale module.
""",
'author': 'OpenERP SA',
'depends': ['hw_proxy'],
'external_dependencies': {'python': ['evdev']},
'test': [
],
'installable': True,
+5 -8
View File
@@ -111,8 +111,6 @@ class Scanner(Thread):
def get_device(self):
try:
if not evdev:
return None
devices = [ device for device in listdir(self.input_dir)]
keyboards = [ device for device in devices if ('kbd' in device) and ('keyboard' not in device.lower())]
scanners = [ device for device in devices if ('barcode' in device.lower()) or ('scanner' in device.lower())]
@@ -135,7 +133,6 @@ class Scanner(Thread):
been returned before. This is necessary to catch barcodes scanned while the POS is
busy reading another barcode
"""
self.lockedstart()
while True:
@@ -204,12 +201,12 @@ class Scanner(Thread):
except Exception as e:
self.set_status('error',str(e))
s = Scanner()
hw_proxy.drivers['scanner'] = s
scanner_thread = None
if evdev:
scanner_thread = Scanner()
hw_proxy.drivers['scanner'] = scanner_thread
class ScannerDriver(hw_proxy.Proxy):
@http.route('/hw_proxy/scanner', type='json', auth='none', cors='*')
def scanner(self):
return s.get_barcode()
return scanner_thread.get_barcode() if scanner_thread else None
+1 -1
View File
@@ -87,7 +87,7 @@
<div class="oe_im">
<div class="oe_im_frame_header">
<i class="fa fa-search oe_im_search_icon"/>
<input class="oe_im_searchbox" t-att-placeholder="_t('Search users...')"/>
<input class="oe_im_searchbox" placeholder="Search users..."/>
</div>
<div class="oe_im_users"></div>
<div class="oe_im_content"></div>
+4 -1
View File
@@ -49,8 +49,11 @@ class ImChatSession(models.Model):
"""
self.ensure_one()
users_infos = super(ImChatSession, self).session_user_info()
# identify the operator for the 'welcome message'
for user_profile in users_infos:
user_profile['is_operator'] = bool(user_profile['id'] == self.env._context.get('im_livechat_operator_id'))
if self.anonymous_name:
users_infos.append({'id': False, 'name': self.anonymous_name, 'im_status': 'online'})
users_infos.append({'id': False, 'name': self.anonymous_name, 'im_status': 'online', 'is_operator': False})
return users_infos
@api.model
@@ -171,7 +171,7 @@ class ImLivechatChannel(models.Model):
user_to_add.append((4, self.env.uid))
# create the session, and add the link with the given channel
session = self.env["im_chat.session"].sudo().create({'user_ids': user_to_add, 'channel_id': channel_id, 'anonymous_name': anonymous_name})
return session.sudo().session_info()
return session.sudo().with_context(im_livechat_operator_id=user_id).session_info()
@api.model
def get_channel_infos(self, channel_id):
@@ -203,12 +203,13 @@ var ChatButton = Widget.extend({
if(this.session.users.length > 0){
if (self.options.defaultMessage) {
setTimeout(function(){
var operator = _.last(_.filter(self.session.users, function(user){return user.is_operator}));
self.conv.message_receive({
id : 1,
type: "message",
message: self.options.defaultMessage,
create_date: time.datetime_to_str(new Date()),
from_id: [self.session.users[0].id, self.session.users[0].name],
from_id: [operator.id, operator.name],
to_id: [0, self.session.uuid]
});
}, 1000);
@@ -11,7 +11,7 @@ var Widget = require('web.Widget');
var _t = core._t;
var COOKIE_NAME = 'livechat_conversation';
var COOKIE_NAME = 'odoo_livechat_conversation';
var SERVICE_URL = 'https://services.odoo.com/';
var OdooSupport = Widget.extend({
+301 -127
View File
@@ -259,101 +259,119 @@
<field name="name">LABOUR TAXES TO PAY</field>
</record>
<record id="chart2141_en" model="account.account.template">
<field name="code">2141</field>
<field name="user_type" ref="account.data_account_type_view"/>
<field name="name">CANADIAN REVENU AGENCY</field>
</record>
<record id="chart2141_en" model="account.account.template">
<field name="code">2141</field>
<field name="user_type" ref="account.data_account_type_view"/>
<field name="name">CANADA REVENUE AGENCY</field>
</record>
<record id="chart21411_en" model="account.account.template">
<field name="code">21411</field>
<field name="user_type" ref="account.data_account_type_view"/>
<field name="name">EMPLOYMENT INSURANCE TO PAY</field>
</record>
<record id="chart21411_en" model="account.account.template">
<field name="code">21411</field>
<field name="user_type" ref="account.data_account_type_view"/>
<field name="name">EMPLOYMENT INSURANCE TO PAY</field>
</record>
<record id="chart214111_en" model="account.account.template">
<field name="code">214111</field>
<record id="chart214111_en" model="account.account.template">
<field name="code">214111</field>
<field name="user_type" ref="account.data_account_type_current_liabilities"/>
<field name="name">EI - Employees Contribution</field>
</record>
<field name="name">EI - Employees Contribution</field>
</record>
<record id="chart214112_en" model="account.account.template">
<field name="code">214112</field>
<record id="chart214112_en" model="account.account.template">
<field name="code">214112</field>
<field name="user_type" ref="account.data_account_type_current_liabilities"/>
<field name="name">EI - Employer Contribution</field>
</record>
<field name="name">EI - Employer Contribution</field>
</record>
<record id="chart21412_en" model="account.account.template">
<field name="code">21412</field>
<record id="chart21412_en" model="account.account.template">
<field name="code">21412</field>
<field name="user_type" ref="account.data_account_type_current_liabilities"/>
<field name="name">Federal Income Tax</field>
</record>
<field name="name">Federal Income Tax</field>
</record>
<record id="chart2142_en" model="account.account.template">
<field name="code">2142</field>
<field name="user_type" ref="account.data_account_type_view"/>
<field name="name">PROVINCIAL REVENU AGENCY</field>
</record>
<record id="chart21413_en" model="account.account.template">
<field name="code">21413</field>
<field name="user_type" ref="account.data_account_type_view"/>
<field name="name">CANADA PENSION PLAN TO PAY</field>
</record>
<record id="chart21421_en" model="account.account.template">
<field name="code">21421</field>
<record id="chart214131_en" model="account.account.template">
<field name="code">214131</field>
<field name="user_type" ref="account.data_account_type_current_liabilities"/>
<field name="name">CPP - Employees Contribution</field>
</record>
<record id="chart214132_en" model="account.account.template">
<field name="code">214132</field>
<field name="user_type" ref="account.data_account_type_current_liabilities"/>
<field name="name">CPP - Employer Contribution</field>
</record>
<record id="chart2142_en" model="account.account.template">
<field name="code">2142</field>
<field name="user_type" ref="account.data_account_type_view"/>
<field name="name">PROVINCIAL REVENU AGENCY</field>
</record>
<record id="chart21421_en" model="account.account.template">
<field name="code">21421</field>
<field name="user_type" ref="account.data_account_type_current_liabilities"/>
<field name="name">Health Services Fund to pay</field>
</record>
<field name="name">Health Services Fund to pay</field>
</record>
<record id="chart21422_en" model="account.account.template">
<field name="code">21422</field>
<field name="user_type" ref="account.data_account_type_view"/>
<field name="name">ANNUITIES TO PAY</field>
</record>
<record id="chart21422_en" model="account.account.template">
<field name="code">21422</field>
<field name="user_type" ref="account.data_account_type_view"/>
<field name="name">PROVINCIAL PENSION PLAN TO PAY</field>
</record>
<record id="chart214221_en" model="account.account.template">
<field name="code">214221</field>
<record id="chart214221_en" model="account.account.template">
<field name="code">214221</field>
<field name="user_type" ref="account.data_account_type_current_liabilities"/>
<field name="name">Annuities - Employees Contribution</field>
</record>
<field name="name">Provincial Pension Plan - Employees Contribution</field>
</record>
<record id="chart214222_en" model="account.account.template">
<field name="code">214222</field>
<record id="chart214222_en" model="account.account.template">
<field name="code">214222</field>
<field name="user_type" ref="account.data_account_type_current_liabilities"/>
<field name="name">Annuities - Employer Contribution</field>
</record>
<field name="name">Provincial Pension Plan - Employer Contribution</field>
</record>
<record id="chart21423_en" model="account.account.template">
<field name="code">21423</field>
<field name="user_type" ref="account.data_account_type_view"/>
<field name="name">PARENTAL INSURANCE PLAN TO PAY</field>
</record>
<record id="chart21423_en" model="account.account.template">
<field name="code">21423</field>
<field name="user_type" ref="account.data_account_type_view"/>
<field name="name">PROVINCIAL PARENTAL INSURANCE PLAN TO PAY</field>
</record>
<record id="chart214231_en" model="account.account.template">
<field name="code">214231</field>
<record id="chart214231_en" model="account.account.template">
<field name="code">214231</field>
<field name="user_type" ref="account.data_account_type_current_liabilities"/>
<field name="name">PAP - Employee Contribution</field>
</record>
<field name="name">Parental Insurance Plan - Employee Contribution</field>
</record>
<record id="chart214232_en" model="account.account.template">
<field name="code">214232</field>
<record id="chart214232_en" model="account.account.template">
<field name="code">214232</field>
<field name="user_type" ref="account.data_account_type_current_liabilities"/>
<field name="name">PAP - Employer Contribution</field>
</record>
<field name="name">Parental Insurance Plan - Employer Contribution</field>
</record>
<record id="chart21424_en" model="account.account.template">
<field name="code">21424</field>
<record id="chart21424_en" model="account.account.template">
<field name="code">21424</field>
<field name="user_type" ref="account.data_account_type_current_liabilities"/>
<field name="name">Labour Health and Safety to pay</field>
</record>
<field name="name">Labour Health and Safety to pay</field>
</record>
<record id="chart21425_en" model="account.account.template">
<field name="code">21425</field>
<record id="chart21425_en" model="account.account.template">
<field name="code">21425</field>
<field name="user_type" ref="account.data_account_type_current_liabilities"/>
<field name="name">Labour Standards to pay</field>
</record>
<field name="name">Labour Standards to pay</field>
</record>
<record id="chart21426_en" model="account.account.template">
<field name="code">21426</field>
<record id="chart21426_en" model="account.account.template">
<field name="code">21426</field>
<field name="user_type" ref="account.data_account_type_current_liabilities"/>
<field name="name">Provincial Income Tax</field>
</record>
<field name="name">Provincial Income Tax</field>
</record>
<record id="chart215_en" model="account.account.template">
<field name="code">215</field>
@@ -379,6 +397,66 @@
<field name="name">Stock Received But Not Billed</field>
</record>
<record id="chart218_en" model="account.account.template">
<field name="code">218</field>
<field name="user_type" ref="account.data_account_type_view"/>
<field name="name">CURRENT LIABILITIES RELATED TO SALARIES</field>
</record>
<record id="chart2181_en" model="account.account.template">
<field name="code">2181</field>
<field name="user_type" ref="account.data_account_type_current_liabilities"/>
<field name="name">Salaries to pay</field>
</record>
<record id="chart2183_en" model="account.account.template">
<field name="code">2183</field>
<field name="user_type" ref="account.data_account_type_current_liabilities"/>
<field name="name">Bonus to pay</field>
</record>
<record id="chart2184_en" model="account.account.template">
<field name="code">2184</field>
<field name="user_type" ref="account.data_account_type_current_liabilities"/>
<field name="name">Retroactive Payment to pay</field>
</record>
<record id="chart2185_en" model="account.account.template">
<field name="code">2185</field>
<field name="user_type" ref="account.data_account_type_view"/>
<field name="name">GROUP PENSION PLAN TO PAY</field>
</record>
<record id="chart218501_en" model="account.account.template">
<field name="code">218501</field>
<field name="user_type" ref="account.data_account_type_current_liabilities"/>
<field name="name">Group Pension Plan to pay - Employees Contribution</field>
</record>
<record id="chart218502_en" model="account.account.template">
<field name="code">218502</field>
<field name="user_type" ref="account.data_account_type_current_liabilities"/>
<field name="name">Group Pension Plan to pay - Employer Contribution</field>
</record>
<record id="chart2186_en" model="account.account.template">
<field name="code">2186</field>
<field name="user_type" ref="account.data_account_type_view"/>
<field name="name">EMPLOYEE BENEFITS</field>
</record>
<record id="chart218601_en" model="account.account.template">
<field name="code">218601</field>
<field name="user_type" ref="account.data_account_type_current_liabilities"/>
<field name="name">Employee Benefits Provision - Employees Contribution</field>
</record>
<record id="chart218602_en" model="account.account.template">
<field name="code">218602</field>
<field name="user_type" ref="account.data_account_type_current_liabilities"/>
<field name="name">Employee Benefits Provision - Employer Contribution</field>
</record>
<record id="chart25_en" model="account.account.template">
<field name="code">25</field>
<field name="user_type" ref="account.data_account_type_view"/>
@@ -387,8 +465,6 @@
<record id="chart251_en" model="account.account.template">
<field name="code">251</field>
<field name="parent_id" ref="chart25_en"/>
<field name="type">view</field>
<field name="user_type" ref="account.data_account_type_view"/>
<field name="name">NON-CURRENT FINANCIAL DEBTS</field>
</record>
@@ -399,12 +475,54 @@
<field name="name">PROVISIONS FOR PENSIONS AND OTHER POST-EMPLOYMENT ADVANTAGES</field>
</record>
<record id="chart254_en" model="account.account.template">
<field name="code">254</field>
<record id="chart2521_en" model="account.account.template">
<field name="code">2521</field>
<field name="user_type" ref="account.data_account_type_current_liabilities"/>
<field name="name">Provision for pension plans</field>
</record>
<record id="chart253_en" model="account.account.template">
<field name="code">253</field>
<field name="user_type" ref="account.data_account_type_view"/>
<field name="name">DEFERRED TAXES</field>
</record>
<record id="chart254_en" model="account.account.template">
<field name="code">254</field>
<field name="user_type" ref="account.data_account_type_view"/>
<field name="name">NON-CURRENT LIABILITIES RELATED TO SALARIES</field>
</record>
<record id="chart2541_en" model="account.account.template">
<field name="code">2541</field>
<field name="user_type" ref="account.data_account_type_view"/>
<field name="name">Leaves Accruded</field>
</record>
<record id="chart254101_en" model="account.account.template">
<field name="code">254101</field>
<field name="user_type" ref="account.data_account_type_expenses"/>
<field name="name">Vacations Accruded</field>
</record>
<record id="chart254102_en" model="account.account.template">
<field name="code">254102</field>
<field name="user_type" ref="account.data_account_type_expenses"/>
<field name="name">Compensatory Days Accruded</field>
</record>
<record id="chart254103_en" model="account.account.template">
<field name="code">254103</field>
<field name="user_type" ref="account.data_account_type_expenses"/>
<field name="name">Sick Leaves Accruded</field>
</record>
<record id="chart2542_en" model="account.account.template">
<field name="code">2542</field>
<field name="user_type" ref="account.data_account_type_current_liabilities"/>
<field name="name">Bonus Accruded</field>
</record>
<record id="chart259_en" model="account.account.template">
<field name="code">259</field>
<field name="user_type" ref="account.data_account_type_view"/>
@@ -561,71 +679,127 @@
<field name="name">International Purchases</field>
</record>
<record id="chart512_en" model="account.account.template">
<field name="code">512</field>
<field name="user_type" ref="account.data_account_type_view"/>
<field name="name">LABOUR EXPENSES</field>
</record>
<record id="chart512_en" model="account.account.template">
<field name="code">512</field>
<field name="user_type" ref="account.data_account_type_view"/>
<field name="name">LABOUR EXPENSES</field>
</record>
<record id="chart51201_en" model="account.account.template">
<field name="code">51201</field>
<field name="user_type" ref="account.data_account_type_expenses"/>
<field name="name">Salaries, wages and commissions</field>
</record>
<record id="chart5121_en" model="account.account.template">
<field name="code">5121</field>
<field name="user_type" ref="account.data_account_type_view"/>
<field name="name">Salaries</field>
</record>
<record id="chart51202_en" model="account.account.template">
<field name="code">51202</field>
<field name="user_type" ref="account.data_account_type_expenses"/>
<field name="name">Holidays</field>
</record>
<record id="chart512101_en" model="account.account.template">
<field name="code">512101</field>
<record id="chart51203_en" model="account.account.template">
<field name="code">51203</field>
<field name="user_type" ref="account.data_account_type_expenses"/>
<field name="name">Employment Insurance</field>
</record>
<field name="user_type" ref="account.data_account_type_expenses"/>
<field name="name">Regular Salaries</field>
</record>
<record id="chart51204_en" model="account.account.template">
<field name="code">51204</field>
<field name="user_type" ref="account.data_account_type_expenses"/>
<field name="name">Health Services Fund</field>
</record>
<record id="chart512102_en" model="account.account.template">
<field name="code">512102</field>
<field name="user_type" ref="account.data_account_type_expenses"/>
<field name="name">Bonus</field>
</record>
<record id="chart51205_en" model="account.account.template">
<field name="code">51205</field>
<field name="user_type" ref="account.data_account_type_expenses"/>
<field name="name">Annuities</field>
</record>
<record id="chart512103_en" model="account.account.template">
<field name="code">512103</field>
<field name="user_type" ref="account.data_account_type_expenses"/>
<field name="name">Retroactive Pay</field>
</record>
<record id="chart51206_en" model="account.account.template">
<field name="code">51206</field>
<field name="user_type" ref="account.data_account_type_expenses"/>
<field name="name">Parental Insurance</field>
</record>
<record id="chart5122_en" model="account.account.template">
<field name="code">5122</field>
<field name="user_type" ref="account.data_account_type_view"/>
<field name="name">Leaves Accruded</field>
</record>
<record id="chart51207_en" model="account.account.template">
<field name="code">51207</field>
<field name="user_type" ref="account.data_account_type_expenses"/>
<field name="name">Labour Health and Safety</field>
</record>
<record id="chart512201_en" model="account.account.template">
<field name="code">512201</field>
<field name="user_type" ref="account.data_account_type_expenses"/>
<field name="name">Vacations Accruded</field>
</record>
<record id="chart51208_en" model="account.account.template">
<field name="code">51208</field>
<field name="user_type" ref="account.data_account_type_expenses"/>
<field name="name">Labour Standards</field>
</record>
<record id="chart512202_en" model="account.account.template">
<field name="code">512202</field>
<field name="user_type" ref="account.data_account_type_expenses"/>
<record id="chart51209_en" model="account.account.template">
<field name="code">51209</field>
<field name="user_type" ref="account.data_account_type_expenses"/>
<field name="name">Federal Income Tax</field>
</record>
<field name="name">Compensatory Days Accruded</field>
</record>
<record id="chart51210_en" model="account.account.template">
<field name="code">51210</field>
<record id="chart512203_en" model="account.account.template">
<field name="code">512203</field>
<field name="user_type" ref="account.data_account_type_expenses"/>
<field name="name">Sick Leaves Accruded</field>
</record>
<record id="chart5123_en" model="account.account.template">
<field name="code">5123</field>
<field name="user_type" ref="account.data_account_type_view"/>
<field name="name">Employer Contributions</field>
</record>
<record id="chart512301_en" model="account.account.template">
<field name="code">512301</field>
<field name="user_type" ref="account.data_account_type_expenses"/>
<field name="name">Canada Pension Plan</field>
</record>
<record id="chart512302_en" model="account.account.template">
<field name="code">512302</field>
<field name="user_type" ref="account.data_account_type_expe
<field name="name">Employment Insurance</field>
</record>
<record id="chart512303_en" model="account.account.template">
<field name="code">512303</field>
<field name="user_type" ref="account.data_account_type_expenses"/>
<field name="name">Provincial Income Tax</field>
</record>
<field name="name">Group Pension Plan</field>
</record>
<record id="chart512304_en" model="account.account.template">
<field name="code">512304</field>
<field name="user_type" ref="account.data_account_type_expenses"/>
<field name="name">Employee benefits expense</field>
</record>
<record id="chart512310_en" model="account.account.template">
<field name="code">512310</field>
<field name="user_type" ref="account.data_account_type_expenses"/>
<field name="name">Provincial Pension Plan</field>
</record>
<record id="chart512311_en" model="account.account.template">
<field name="code">512311</field>
<field name="user_type" ref="account.data_account_type_expenses"/>
<field name="name">Provincial Parental Insurance Plan</field>
</record>
<record id="chart512312_en" model="account.account.template">
<field name="code">512312</field>
<field name="user_type" ref="account.data_account_type_expenses"/>
<field name="name">Labour Health and Safety</field>
</record>
<record id="chart512313_en" model="account.account.template">
<field name="code">512313</field>
<field name="user_type" ref="account.data_account_type_expenses"/>
<field name="name">Labour Standards</field>
</record>
<record id="chart512314_en" model="account.account.template">
<field name="code">512314</field>
<field name="user_type" ref="account.data_account_type_expenses"/>
<field name="name">Health Service Fund</field>
</record>
<record id="chart513_en" model="account.account.template">
<field name="code">513</field>
<field name="user_type" ref="account.data_account_type_view"/>
+315 -144
View File
@@ -253,107 +253,127 @@
<field name="name">TVH à payer - 15%</field>
</record>
<record id="chart214_fr" model="account.account.template">
<field name="code">214</field>
<field name="user_type" ref="account.data_account_type_view"/>
<field name="name">IMPÔTS LIÉS AUX SALAIRES À PAYER</field>
</record>
<record id="chart2141_fr" model="account.account.template">
<field name="code">2141</field>
<field name="user_type" ref="account.data_account_type_view"/>
<field name="name">AGENCE DU REVENU DU CANADA</field>
</record>
<record id="chart214_fr" model="account.account.template">
<field name="code">214</field>
<field name="user_type" ref="account.data_account_type_view"/>
<field name="name">DAS ET CONTRIBUTIONS DE L'EMPLOYEUR À PAYER</field>
</record>
<record id="chart21411_fr" model="account.account.template">
<field name="code">21411</field>
<field name="user_type" ref="account.data_account_type_view"/>
<field name="name">ASSURANCE EMPLOI À PAYER</field>
</record>
<record id="chart2141_fr" model="account.account.template">
<field name="code">2141</field>
<field name="user_type" ref="account.data_account_type_view"/>
<field name="name">AGENCE DU REVENU DU CANADA</field>
</record>
<record id="chart214111_fr" model="account.account.template">
<field name="code">214111</field>
<record id="chart21411_fr" model="account.account.template">
<field name="code">21411</field>
<field name="user_type" ref="account.data_account_type_view"/>
<field name="name">ASSURANCE EMPLOI À PAYER</field>
</record>
<record id="chart214111_fr" model="account.account.template">
<field name="code">214111</field>
<field name="user_type" ref="account.data_account_type_current_liabilities"/>
<field name="name">AE - Contribution des employés</field>
</record>
<field name="name">AE - Contribution des employés</field>
</record>
<record id="chart214112_fr" model="account.account.template">
<field name="code">214112</field>
<record id="chart214112_fr" model="account.account.template">
<field name="code">214112</field>
<field name="user_type" ref="account.data_account_type_current_liabilities"/>
<field name="name">AE - Contribution de l'employeur</field>
</record>
<field name="name">AE - Contribution de l'employeur</field>
</record>
<record id="chart21412_fr" model="account.account.template">
<field name="code">21412</field>
<record id="chart21412_fr" model="account.account.template">
<field name="code">21412</field>
<field name="user_type" ref="account.data_account_type_current_liabilities"/>
<field name="name">Impôt fédéral sur les revenus</field>
</record>
<field name="name">Impôt fédéral sur les revenus</field>
</record>
<record id="chart2142_fr" model="account.account.template">
<field name="code">2142</field>
<field name="user_type" ref="account.data_account_type_view"/>
<field name="name">AGENCE DU REVENU PROVINCIAL</field>
</record>
<record id="chart21413_fr" model="account.account.template">
<field name="code">21413</field>
<field name="user_type" ref="account.data_account_type_view"/>
<field name="name">RÉGIME DE PENSIONS DU CANADA À PAYER</field>
</record>
<record id="chart21421_fr" model="account.account.template">
<field name="code">21421</field>
<record id="chart214131_fr" model="account.account.template">
<field name="code">214131</field>
<field name="user_type" ref="account.data_account_type_current_liabilities"/>
<field name="name">RPC - Contribution des employés</field>
</record>
<record id="chart214132_fr" model="account.account.template">
<field name="code">214132</field>
<field name="user_type" ref="account.data_account_type_current_liabilities"/>
<field name="name">RPC - Contribution de l'employeur</field>
</record>
<record id="chart2142_fr" model="account.account.template">
<field name="code">2142</field>
<field name="user_type" ref="account.data_account_type_view"/>
<field name="name">AGENCE PROVINCIALE</field>
</record>
<record id="chart21421_fr" model="account.account.template">
<field name="code">21421</field>
<field name="user_type" ref="account.data_account_type_current_liabilities"/>
<field name="name">Fond des Services de Santé à payer</field>
</record>
<field name="name">Fond des Services de Santé à payer</field>
</record>
<record id="chart21422_fr" model="account.account.template">
<field name="code">21422</field>
<field name="user_type" ref="account.data_account_type_view"/>
<field name="name">RENTES À PAYER</field>
</record>
<record id="chart21422_fr" model="account.account.template">
<field name="code">21422</field>
<field name="user_type" ref="account.data_account_type_view"/>
<field name="name">RÉGIME DE PENSION PROVINCIAL À PAYER</field>
</record>
<record id="chart214221_fr" model="account.account.template">
<field name="code">214221</field>
<record id="chart214221_fr" model="account.account.template">
<field name="code">214221</field>
<field name="user_type" ref="account.data_account_type_current_liabilities"/>
<field name="name">Rentes - Contribution des employés</field>
</record>
<field name="name">Régime de pension provincial - Contribution des employés</field>
</record>
<record id="chart214222_fr" model="account.account.template">
<field name="code">214222</field>
<record id="chart214222_fr" model="account.account.template">
<field name="code">214222</field>
<field name="user_type" ref="account.data_account_type_current_liabilities"/>
<field name="name">Rentes - Contribution de l'employeur</field>
</record>
<field name="name">Régime de pension provincial - Contribution de l'employeur</field>
</record>
<record id="chart21423_fr" model="account.account.template">
<field name="code">21423</field>
<field name="user_type" ref="account.data_account_type_view"/>
<field name="name">ASSURANCE PARENTALE À PAYER</field>
</record>
<record id="chart214231_fr" model="account.account.template">
<field name="code">214231</field>
<field name="user_type" ref="account.data_account_type_current_liabilities"/>
<field name="name">AP - Contribution des employés</field>
</record>
<record id="chart214232_fr" model="account.account.template">
<field name="code">214232</field>
<field name="user_type" ref="account.data_account_type_current_liabilities"/>
<field name="name">AP - Contribution de l'employeur</field>
</record>
<record id="chart21423_fr" model="account.account.template">
<field name="code">21423</field>
<field name="user_type" ref="account.data_account_type_view"/>
<field name="name">RÉGIME PROVINCIAL D'ASSURANCE PARENTALE À PAYER</field>
</record>
<record id="chart21424_fr" model="account.account.template">
<field name="code">21424</field>
<record id="chart214231_fr" model="account.account.template">
<field name="code">214231</field>
<field name="user_type" ref="account.data_account_type_current_liabilities"/>
<field name="name">Santé et Sécurité au Travail à payer</field>
</record>
<field name="name">Assurance parentale - Contribution des employés</field>
</record>
<record id="chart21425_fr" model="account.account.template">
<field name="code">21425</field>
<record id="chart214232_fr" model="account.account.template">
<field name="code">214232</field>
<field name="user_type" ref="account.data_account_type_current_liabilities"/>
<field name="name">Normes du Travail à payer</field>
</record>
<field name="name">Assurance parentale - Contribution de l'employeur</field>
</record>
<record id="chart21426_fr" model="account.account.template">
<field name="code">21426</field>
<record id="chart21424_fr" model="account.account.template">
<field name="code">21424</field>
<field name="user_type" ref="account.data_account_type_current_liabilities"/>
<field name="name">Impôt provincial sur les revenus</field>
</record>
<field name="name">Santé et Sécurité au Travail à payer</field>
</record>
<record id="chart21425_fr" model="account.account.template">
<field name="code">21425</field>
<field name="user_type" ref="account.data_account_type_current_liabilities"/>
<field name="name">Normes du Travail à payer</field>
</record>
<record id="chart21426_fr" model="account.account.template">
<field name="code">21426</field>
<field name="user_type" ref="account.data_account_type_current_liabilities"/>
<field name="name">Impôt provincial sur les revenus</field>
</record>
<record id="chart215_fr" model="account.account.template">
<field name="code">215</field>
@@ -379,6 +399,67 @@
<field name="name">Stock reçu non facturé</field>
</record>
<record id="chart218_fr" model="account.account.template">
<field name="code">218</field>
<field name="user_type" ref="account.data_account_type_view"/>
<field name="name">PASSIFS COURANTS LIÉS AUX SALAIRES</field>
</record>
<record id="chart2181_fr" model="account.account.template">
<field name="code">2181</field>
<field name="user_type" ref="account.data_account_type_current_liabilities"/>
<field name="name">Salaires à payer</field>
</record>
<record id="chart2183_fr" model="account.account.template">
<field name="code">2183</field>
<field name="user_type" ref="account.data_account_type_current_liabilities"/>
<field name="name">Bonis à payer</field>
</record>
<record id="chart2184_fr" model="account.account.template">
<field name="code">2184</field>
<field name="user_type" ref="account.data_account_type_current_liabilities"/>
<field name="name">Paie Rétroactive à payer</field>
</record>
<!-- Montants à verser dans un RVER, RPA ou autre régime collectif -->
<record id="chart2185_fr" model="account.account.template">
<field name="code">2185</field>
<field name="user_type" ref="account.data_account_type_view"/>
<field name="name">RÉGIMES DE PENSION COLLECTIFS À PAYER</field>
</record>
<record id="chart218501_fr" model="account.account.template">
<field name="code">218501</field>
<field name="user_type" ref="account.data_account_type_current_liabilities"/>
<field name="name">Régimes de pension collectifs à payer - Contribution des employés</field>
</record>
<record id="chart218502_fr" model="account.account.template">
<field name="code">218502</field>
<field name="user_type" ref="account.data_account_type_current_liabilities"/>
<field name="name">Régimes de pension collectifs à payer - Contribution de l'employeur</field>
</record>
<record id="chart2186_fr" model="account.account.template">
<field name="code">2186</field>
<field name="user_type" ref="account.data_account_type_view"/>
<field name="name">PROVISION POUR AVANTAGES SOCIAUX</field>
</record>
<record id="chart218601_fr" model="account.account.template">
<field name="code">218601</field>
<field name="user_type" ref="account.data_account_type_current_liabilities"/>
<field name="name">Provision pour avantages sociaux - Contribution de l'employé</field>
</record>
<record id="chart218602_fr" model="account.account.template">
<field name="code">218602</field>
<field name="user_type" ref="account.data_account_type_current_liabilities"/>
<field name="name">Provision pour avantages sociaux - Contribution de l'employeur</field>
</record>
<record id="chart25_fr" model="account.account.template">
<field name="code">25</field>
<field name="user_type" ref="account.data_account_type_view"/>
@@ -397,17 +478,53 @@
<field name="name">PROVISIONS POUR RETRAITES ET AUTRES AVANTAGES POSTÉRIEURS À L'EMPLOI</field>
</record>
<record id="chart253_fr" model="account.account.template">
<field name="code">253</field>
<field name="user_type" ref="account.data_account_type_view"/>
<field name="name">IMPÔTS DIFFÉRÉS</field>
</record>
<record id="chart254_fr" model="account.account.template">
<field name="code">254</field>
<field name="user_type" ref="account.data_account_type_view"/>
<field name="name">AUTRES PASSIFS NON-COURANTS</field>
</record>
<record id="chart253_fr" model="account.account.template">
<field name="code">253</field>
<field name="user_type" ref="account.data_account_type_view"/>
<field name="name">IMPÔTS DIFFÉRÉS</field>
</record>
<record id="chart254_fr" model="account.account.template">
<field name="code">254</field>
<field name="user_type" ref="account.data_account_type_view"/>
<field name="name">PASSIFS NON-COURANTS LIÉS AUX SALAIRES</field>
</record>
<record id="chart2541_fr" model="account.account.template">
<field name="code">2541</field>
<field name="user_type" ref="account.data_account_type_view"/>
<field name="name">Congés Accumulés</field>
</record>
<record id="chart254101_fr" model="account.account.template">
<field name="code">254101</field>
<field name="user_type" ref="account.data_account_type_expenses"/>
<field name="name">Vacances Accumulées</field>
</record>
<record id="chart254102_fr" model="account.account.template">
<field name="code">254102</field>
<field name="user_type" ref="account.data_account_type_expenses"/>
<field name="name">Jours Compensatoires Accumulés</field>
</record>
<record id="chart254103_fr" model="account.account.template">
<field name="code">254103</field>
<field name="user_type" ref="account.data_account_type_expenses"/>
<field name="name">Congés de Maladie Accumulés</field>
</record>
<record id="chart2542_fr" model="account.account.template">
<field name="code">2542</field>
<field name="user_type" ref="account.data_account_type_current_liabilities"/>
<field name="name">Bonis Accumulés</field>
</record>
<record id="chart259_fr" model="account.account.template">
<field name="code">259</field>
<field name="user_type" ref="account.data_account_type_view"/>
<field name="name">AUTRES PASSIFS NON-COURANTS</field>
</record>
<!-- CAPITAUX PROPRES -->
@@ -565,71 +682,125 @@
<field name="name">Achats à l'étranger</field>
</record>
<record id="chart512_fr" model="account.account.template">
<field name="code">512</field>
<field name="user_type" ref="account.data_account_type_view"/>
<field name="name">SALAIRES ET CHARGES SOCIALES</field>
</record>
<record id="chart512_fr" model="account.account.template">
<field name="code">512</field>
<field name="user_type" ref="account.data_account_type_view"/>
<field name="name">SALAIRES ET CHARGES SOCIALES</field>
</record>
<record id="chart51201_fr" model="account.account.template">
<field name="code">51201</field>
<field name="user_type" ref="account.data_account_type_expenses"/>
<field name="name">Salaires</field>
</record>
<record id="chart5121_fr" model="account.account.template">
<field name="code">5121</field>
<field name="user_type" ref="account.data_account_type_view"/>
<field name="name">Salaires</field>
</record>
<record id="chart51202_fr" model="account.account.template">
<field name="code">51202</field>
<field name="user_type" ref="account.data_account_type_expenses"/>
<field name="name">Vacances</field>
</record>
<record id="chart512101_fr" model="account.account.template">
<field name="code">512101</field>
<field name="user_type" ref="account.data_account_type_expenses"/>
<field name="name">Salaires Réguliers</field>
</record>
<record id="chart51203_fr" model="account.account.template">
<field name="code">51203</field>
<field name="user_type" ref="account.data_account_type_expenses"/>
<field name="name">Assurance Emploi</field>
</record>
<record id="chart512102_fr" model="account.account.template">
<field name="code">512102</field>
<record id="chart51204_fr" model="account.account.template">
<field name="code">51204</field>
<field name="user_type" ref="account.data_account_type_expenses"/>
<field name="name">Fonds des services de santé</field>
</record>
<field name="user_type" ref="account.data_account_type_expenses"/>
<field name="name">Bonis</field>
</record>
<record id="chart51205_fr" model="account.account.template">
<field name="code">51205</field>
<field name="user_type" ref="account.data_account_type_expenses"/>
<field name="name">Rentes</field>
</record>
<record id="chart512103_fr" model="account.account.template">
<field name="code">512103</field>
<field name="user_type" ref="account.data_account_type_expenses"/>
<field name="name">Paies Rétroactives</field>
</record>
<record id="chart51206_fr" model="account.account.template">
<field name="code">51206</field>
<field name="user_type" ref="account.data_account_type_expenses"/>
<field name="name">Assurance parentale</field>
</record>
<record id="chart5122_fr" model="account.account.template">
<field name="code">5122</field>
<record id="chart51207_fr" model="account.account.template">
<field name="code">51207</field>
<field name="user_type" ref="account.data_account_type_expenses"/>
<field name="name">Santé et sécurité au travail</field>
</record>
<field name="user_type" ref="account.data_account_type_view"/>
<field name="name">Congés Accumulées</field>
</record>
<record id="chart51208_fr" model="account.account.template">
<field name="code">51208</field>
<field name="user_type" ref="account.data_account_type_expenses"/>
<field name="name">Normes du travail</field>
</record>
<record id="chart512201_fr" model="account.account.template">
<field name="code">512201</field>
<field name="user_type" ref="account.data_account_type_expenses"/>
<field name="name">Vacances Accumulées</field>
</record>
<record id="chart51209_fr" model="account.account.template">
<field name="code">51209</field>
<field name="user_type" ref="account.data_account_type_expenses"/>
<field name="name">Impôt fédéral</field>
</record>
<record id="chart512202_fr" model="account.account.template">
<field name="code">512202</field>
<record id="chart51210_fr" model="account.account.template">
<field name="code">51210</field>
<field name="user_type" ref="account.data_account_type_expenses"/>
<field name="name">Jours Compensatoires Accumulées</field>
</record>
<record id="chart512203_fr" model="account.account.template">
<field name="code">512203</field>
<field name="user_type" ref="account.data_account_type_expenses"/>
<field name="name">Congés de Maladie Accumulés</field>
</record>
<record id="chart5123_fr" model="account.account.template">
<field name="code">5123</field>
<field name="user_type" ref="account.data_account_type_view"/>
<field name="name">Contributions de l'Employeur</field>
</record>
<record id="chart512301_fr" model="account.account.template">
<field name="code">512301</field>
<field name="user_type" ref="account.data_account_type_expenses"/>
<field name="name">Régime de Pensions du Canada</field>
</record>
<record id="chart512302_fr" model="account.account.template">
<field name="code">512302</field>
<field name="user_type" ref="account.data_account_type_expenses"/>
<field name="name">Assurance Emploi</field>
</record>
<record id="chart512303_fr" model="account.account.template">
<field name="code">512303</field>
<field name="user_type" ref="account.data_account_type_expenses"/>
<field name="name">Impôt provincial</field>
</record>
<field name="name">Régimes de pension collectifs</field>
</record>
<record id="chart512304_fr" model="account.account.template">
<field name="code">512304</field>
<field name="user_type" ref="account.data_account_type_expenses"/>
<field name="name">Dépense d'avantages sociaux</field>
</record>
<record id="chart512310_fr" model="account.account.template">
<field name="code">512310</field>
<field name="user_type" ref="account.data_account_type_expenses"/>
<field name="name">Régime de pension provincial</field>
</record>
<record id="chart512311_fr" model="account.account.template">
<field name="code">512311</field>
<field name="user_type" ref="account.data_account_type_expenses"/>
<field name="name">Régime d'assurance parental provincial</field>
</record>
<record id="chart512312_fr" model="account.account.template">
<field name="code">512312</field>
<field name="user_type" ref="account.data_account_type_expenses"/>
<field name="name">Santé et sécurité au travail</field>
</record>
<record id="chart512313_fr" model="account.account.template">
<field name="code">512313</field>
<field name="user_type" ref="account.data_account_type_expenses"/>
<field name="name">Normes du travail</field>
</record>
<record id="chart512314_fr" model="account.account.template">
<field name="code">512314</field>
<field name="user_type" ref="account.data_account_type_expenses"/>
<field name="name">Fonds des services de santé</field>
</record>
<record id="chart513_fr" model="account.account.template">
<field name="code">513</field>
+64
View File
@@ -14,6 +14,8 @@
<field name="amount">1</field>
<field name="type">percent</field>
<field name="child_depend">1</field>
<field name="ref_base_sign" eval="-1"/>
<field name="ref_tax_sign" eval="-1"/>
</record>
<record id="gstpst_sale_bc_gst_en" model="account.tax.template">
@@ -28,6 +30,8 @@
<field name="account_collected_id" ref="chart2131_en"/>
<field name="account_paid_id" ref="chart2131_en"/>
<field name="parent_id" ref="gstpst_bc_sale_en"/>
<field name="ref_base_sign" eval="-1"/>
<field name="ref_tax_sign" eval="-1"/>
</record>
<record id="pst_bc_sale_en" model="account.tax.template">
@@ -41,6 +45,8 @@
<field name="account_collected_id" ref="chart2132_en"/>
<field name="account_paid_id" ref="chart2132_en"/>
<field name="parent_id" ref="gstpst_bc_sale_en"/>
<field name="ref_base_sign" eval="-1"/>
<field name="ref_tax_sign" eval="-1"/>
</record>
<!-- Manitoba PST -->
@@ -53,6 +59,8 @@
<field name="amount">1</field>
<field name="type">percent</field>
<field name="child_depend" eval="True"/>
<field name="ref_base_sign" eval="-1"/>
<field name="ref_tax_sign" eval="-1"/>
</record>
<record id="gstpst_sale_mb_gst_en" model="account.tax.template">
@@ -67,6 +75,8 @@
<field name="account_collected_id" ref="chart2131_en"/>
<field name="account_paid_id" ref="chart2131_en"/>
<field name="parent_id" ref="gstpst_mb_sale_en"/>
<field name="ref_base_sign" eval="-1"/>
<field name="ref_tax_sign" eval="-1"/>
</record>
<record id="pst_mb_sale_en" model="account.tax.template">
@@ -80,6 +90,8 @@
<field name="account_collected_id" ref="chart2132_en"/>
<field name="account_paid_id" ref="chart2132_en"/>
<field name="parent_id" ref="gstpst_mb_sale_en"/>
<field name="ref_base_sign" eval="-1"/>
<field name="ref_tax_sign" eval="-1"/>
</record>
<!-- Quebec PST -->
@@ -92,6 +104,8 @@
<field name="amount">1</field>
<field name="type">percent</field>
<field name="child_depend" eval="True"/>
<field name="ref_base_sign" eval="-1"/>
<field name="ref_tax_sign" eval="-1"/>
</record>
<record id="gstqst_sale_gst_en" model="account.tax.template">
@@ -105,6 +119,8 @@
<field name="account_collected_id" ref="chart2131_en"/>
<field name="account_paid_id" ref="chart2131_en"/>
<field name="parent_id" ref="gstqst_sale_en"/>
<field name="ref_base_sign" eval="-1"/>
<field name="ref_tax_sign" eval="-1"/>
</record>
<record id="qst_sale_en" model="account.tax.template">
@@ -118,6 +134,8 @@
<field name="account_collected_id" ref="chart2132_en"/>
<field name="account_paid_id" ref="chart2132_en"/>
<field name="parent_id" ref="gstqst_sale_en"/>
<field name="ref_base_sign" eval="-1"/>
<field name="ref_tax_sign" eval="-1"/>
</record>
<!-- Saskatchewan PST -->
@@ -130,6 +148,8 @@
<field name="amount">1</field>
<field name="type">percent</field>
<field name="child_depend" eval="True"/>
<field name="ref_base_sign" eval="-1"/>
<field name="ref_tax_sign" eval="-1"/>
</record>
<record id="gstpst_sale_sk_gst_en" model="account.tax.template">
@@ -144,6 +164,8 @@
<field name="account_collected_id" ref="chart2131_en"/>
<field name="account_paid_id" ref="chart2131_en"/>
<field name="parent_id" ref="gstpst_sk_sale_en"/>
<field name="ref_base_sign" eval="-1"/>
<field name="ref_tax_sign" eval="-1"/>
</record>
<record id="pst_sk_sale_en" model="account.tax.template">
@@ -157,6 +179,8 @@
<field name="account_collected_id" ref="chart2132_en"/>
<field name="account_paid_id" ref="chart2132_en"/>
<field name="parent_id" ref="gstpst_sk_sale_en"/>
<field name="ref_base_sign" eval="-1"/>
<field name="ref_tax_sign" eval="-1"/>
</record>
<!-- HST -->
@@ -170,6 +194,8 @@
<field name="type">percent</field>
<field name="account_collected_id" ref="chart21331_en"/>
<field name="account_paid_id" ref="chart21331_en"/>
<field name="ref_base_sign" eval="-1"/>
<field name="ref_tax_sign" eval="-1"/>
</record>
<record id="hst14_sale_en" model="account.tax.template">
@@ -181,6 +207,8 @@
<field name="type">percent</field>
<field name="account_collected_id" ref="chart21332_en"/>
<field name="account_paid_id" ref="chart21332_en"/>
<field name="ref_base_sign" eval="-1"/>
<field name="ref_tax_sign" eval="-1"/>
</record>
<record id="hst15_sale_en" model="account.tax.template">
@@ -192,6 +220,8 @@
<field name="type">percent</field>
<field name="account_collected_id" ref="chart21333_en"/>
<field name="account_paid_id" ref="chart21333_en"/>
<field name="ref_base_sign" eval="-1"/>
<field name="ref_tax_sign" eval="-1"/>
</record>
<!-- GST -->
@@ -205,6 +235,8 @@
<field name="type">percent</field>
<field name="account_collected_id" ref="chart2131_en"/>
<field name="account_paid_id" ref="chart2131_en"/>
<field name="ref_base_sign" eval="-1"/>
<field name="ref_tax_sign" eval="-1"/>
</record>
<!-- PURCHASE TAXES -->
@@ -219,6 +251,8 @@
<field name="amount">1</field>
<field name="type">percent</field>
<field name="child_depend">1</field>
<field name="base_sign" eval="-1"/>
<field name="tax_sign" eval="-1"/>
</record>
<record id="gstpst_purc_bc_gst_en" model="account.tax.template">
@@ -233,6 +267,8 @@
<field name="account_collected_id" ref="chart1181_en"/>
<field name="account_paid_id" ref="chart1181_en"/>
<field name="parent_id" ref="gstpst_bc_purc_en"/>
<field name="base_sign" eval="-1"/>
<field name="tax_sign" eval="-1"/>
</record>
<record id="pst_bc_purc_en" model="account.tax.template">
@@ -246,6 +282,8 @@
<field name="account_collected_id" ref="chart1182_en"/>
<field name="account_paid_id" ref="chart1182_en"/>
<field name="parent_id" ref="gstpst_bc_purc_en"/>
<field name="base_sign" eval="-1"/>
<field name="tax_sign" eval="-1"/>
</record>
<!-- Manitoba PST -->
@@ -258,6 +296,8 @@
<field name="amount">1</field>
<field name="type">percent</field>
<field name="child_depend" eval="True"/>
<field name="base_sign" eval="-1"/>
<field name="tax_sign" eval="-1"/>
</record>
<record id="gstpst_purc_mb_gst_en" model="account.tax.template">
@@ -272,6 +312,8 @@
<field name="account_collected_id" ref="chart1181_en"/>
<field name="account_paid_id" ref="chart1181_en"/>
<field name="parent_id" ref="gstpst_mb_purc_en"/>
<field name="base_sign" eval="-1"/>
<field name="tax_sign" eval="-1"/>
</record>
<record id="pst_mb_purc_en" model="account.tax.template">
@@ -285,6 +327,8 @@
<field name="account_collected_id" ref="chart1182_en"/>
<field name="account_paid_id" ref="chart1182_en"/>
<field name="parent_id" ref="gstpst_mb_purc_en"/>
<field name="base_sign" eval="-1"/>
<field name="tax_sign" eval="-1"/>
</record>
<!-- Quebec PST -->
@@ -297,6 +341,8 @@
<field name="amount">1</field>
<field name="type">percent</field>
<field name="child_depend" eval="True"/>
<field name="base_sign" eval="-1"/>
<field name="tax_sign" eval="-1"/>
</record>
<record id="gstqst_purc_gst_en" model="account.tax.template">
@@ -310,6 +356,8 @@
<field name="account_collected_id" ref="chart1181_en"/>
<field name="account_paid_id" ref="chart1181_en"/>
<field name="parent_id" ref="gstqst_purc_en"/>
<field name="base_sign" eval="-1"/>
<field name="tax_sign" eval="-1"/>
</record>
<record id="qst_purc_en" model="account.tax.template">
@@ -323,6 +371,8 @@
<field name="account_collected_id" ref="chart1182_en"/>
<field name="account_paid_id" ref="chart1182_en"/>
<field name="parent_id" ref="gstqst_purc_en"/>
<field name="base_sign" eval="-1"/>
<field name="tax_sign" eval="-1"/>
</record>
<!-- Saskatchewan PST -->
@@ -335,6 +385,8 @@
<field name="amount">1</field>
<field name="type">percent</field>
<field name="child_depend" eval="True"/>
<field name="base_sign" eval="-1"/>
<field name="tax_sign" eval="-1"/>
</record>
<record id="gstpst_purc_sk_gst_en" model="account.tax.template">
@@ -349,6 +401,8 @@
<field name="account_collected_id" ref="chart1181_en"/>
<field name="account_paid_id" ref="chart1181_en"/>
<field name="parent_id" ref="gstpst_sk_purc_en"/>
<field name="base_sign" eval="-1"/>
<field name="tax_sign" eval="-1"/>
</record>
<record id="pst_sk_purc_en" model="account.tax.template">
@@ -362,6 +416,8 @@
<field name="account_collected_id" ref="chart1182_en"/>
<field name="account_paid_id" ref="chart1182_en"/>
<field name="parent_id" ref="gstpst_sk_purc_en"/>
<field name="base_sign" eval="-1"/>
<field name="tax_sign" eval="-1"/>
</record>
<!-- HST -->
@@ -375,6 +431,8 @@
<field name="type">percent</field>
<field name="account_collected_id" ref="chart11831_en"/>
<field name="account_paid_id" ref="chart11831_en"/>
<field name="base_sign" eval="-1"/>
<field name="tax_sign" eval="-1"/>
</record>
<record id="hst14_purc_en" model="account.tax.template">
@@ -386,6 +444,8 @@
<field name="type">percent</field>
<field name="account_collected_id" ref="chart11832_en"/>
<field name="account_paid_id" ref="chart11832_en"/>
<field name="base_sign" eval="-1"/>
<field name="tax_sign" eval="-1"/>
</record>
<record id="hst15_purc_en" model="account.tax.template">
@@ -397,6 +457,8 @@
<field name="type">percent</field>
<field name="account_collected_id" ref="chart11833_en"/>
<field name="account_paid_id" ref="chart11833_en"/>
<field name="base_sign" eval="-1"/>
<field name="tax_sign" eval="-1"/>
</record>
<!-- GST -->
@@ -410,6 +472,8 @@
<field name="type">percent</field>
<field name="account_collected_id" ref="chart1181_en"/>
<field name="account_paid_id" ref="chart1181_en"/>
<field name="base_sign" eval="-1"/>
<field name="tax_sign" eval="-1"/>
</record>
</data>
+64
View File
@@ -14,6 +14,8 @@
<field name="amount">1</field>
<field name="child_depend">1</field>
<field name="type">percent</field>
<field name="ref_base_sign" eval="-1"/>
<field name="ref_tax_sign" eval="-1"/>
</record>
<record id="gstpst_sale_bc_gst_fr" model="account.tax.template">
@@ -28,6 +30,8 @@
<field name="account_collected_id" ref="chart2131_fr"/>
<field name="account_paid_id" ref="chart2131_fr"/>
<field name="parent_id" ref="gstpst_bc_sale_fr"/>
<field name="ref_base_sign" eval="-1"/>
<field name="ref_tax_sign" eval="-1"/>
</record>
<record id="pst_bc_sale_fr" model="account.tax.template">
@@ -41,6 +45,8 @@
<field name="account_collected_id" ref="chart2132_fr"/>
<field name="account_paid_id" ref="chart2132_fr"/>
<field name="parent_id" ref="gstpst_bc_sale_fr"/>
<field name="ref_base_sign" eval="-1"/>
<field name="ref_tax_sign" eval="-1"/>
</record>
<!-- Manitoba PST -->
@@ -53,6 +59,8 @@
<field name="amount">1</field>
<field name="type">percent</field>
<field name="child_depend" eval="True"/>
<field name="ref_base_sign" eval="-1"/>
<field name="ref_tax_sign" eval="-1"/>
</record>
<record id="gstpst_sale_mb_gst_fr" model="account.tax.template">
@@ -67,6 +75,8 @@
<field name="account_collected_id" ref="chart2131_fr"/>
<field name="account_paid_id" ref="chart2131_fr"/>
<field name="parent_id" ref="gstpst_mb_sale_fr"/>
<field name="ref_base_sign" eval="-1"/>
<field name="ref_tax_sign" eval="-1"/>
</record>
<record id="pst_mb_sale_fr" model="account.tax.template">
@@ -80,6 +90,8 @@
<field name="account_collected_id" ref="chart2132_fr"/>
<field name="account_paid_id" ref="chart2132_fr"/>
<field name="parent_id" ref="gstpst_mb_sale_fr"/>
<field name="ref_base_sign" eval="-1"/>
<field name="ref_tax_sign" eval="-1"/>
</record>
<!-- Quebec PST -->
@@ -92,6 +104,8 @@
<field name="amount">1</field>
<field name="type">percent</field>
<field name="child_depend" eval="True"/>
<field name="ref_base_sign" eval="-1"/>
<field name="ref_tax_sign" eval="-1"/>
</record>
<record id="gstqst_sale_gst_fr" model="account.tax.template">
@@ -105,6 +119,8 @@
<field name="account_collected_id" ref="chart2131_fr"/>
<field name="account_paid_id" ref="chart2131_fr"/>
<field name="parent_id" ref="gstqst_sale_fr"/>
<field name="ref_base_sign" eval="-1"/>
<field name="ref_tax_sign" eval="-1"/>
</record>
<record id="tvq_sale_fr" model="account.tax.template">
@@ -118,6 +134,8 @@
<field name="account_collected_id" ref="chart2132_fr"/>
<field name="account_paid_id" ref="chart2132_fr"/>
<field name="parent_id" ref="gstqst_sale_fr"/>
<field name="ref_base_sign" eval="-1"/>
<field name="ref_tax_sign" eval="-1"/>
</record>
<!-- Saskatchewan PST -->
@@ -130,6 +148,8 @@
<field name="amount">1</field>
<field name="type">percent</field>
<field name="child_depend" eval="True"/>
<field name="ref_base_sign" eval="-1"/>
<field name="ref_tax_sign" eval="-1"/>
</record>
<record id="gstpst_sale_sk_gst_fr" model="account.tax.template">
@@ -144,6 +164,8 @@
<field name="account_collected_id" ref="chart2131_fr"/>
<field name="account_paid_id" ref="chart2131_fr"/>
<field name="parent_id" ref="gstpst_sk_sale_fr"/>
<field name="ref_base_sign" eval="-1"/>
<field name="ref_tax_sign" eval="-1"/>
</record>
<record id="pst_sk_sale_fr" model="account.tax.template">
@@ -157,6 +179,8 @@
<field name="account_collected_id" ref="chart2132_fr"/>
<field name="account_paid_id" ref="chart2132_fr"/>
<field name="parent_id" ref="gstpst_sk_sale_fr"/>
<field name="ref_base_sign" eval="-1"/>
<field name="ref_tax_sign" eval="-1"/>
</record>
<!-- HST -->
@@ -170,6 +194,8 @@
<field name="type">percent</field>
<field name="account_collected_id" ref="chart21331_fr"/>
<field name="account_paid_id" ref="chart21331_fr"/>
<field name="ref_base_sign" eval="-1"/>
<field name="ref_tax_sign" eval="-1"/>
</record>
<record id="hst14_sale_fr" model="account.tax.template">
@@ -181,6 +207,8 @@
<field name="type">percent</field>
<field name="account_collected_id" ref="chart21332_fr"/>
<field name="account_paid_id" ref="chart21332_fr"/>
<field name="ref_base_sign" eval="-1"/>
<field name="ref_tax_sign" eval="-1"/>
</record>
<record id="hst15_sale_fr" model="account.tax.template">
@@ -192,6 +220,8 @@
<field name="type">percent</field>
<field name="account_collected_id" ref="chart21333_fr"/>
<field name="account_paid_id" ref="chart21333_fr"/>
<field name="ref_base_sign" eval="-1"/>
<field name="ref_tax_sign" eval="-1"/>
</record>
<!-- GST -->
@@ -205,6 +235,8 @@
<field name="type">percent</field>
<field name="account_collected_id" ref="chart2131_fr"/>
<field name="account_paid_id" ref="chart2131_fr"/>
<field name="ref_base_sign" eval="-1"/>
<field name="ref_tax_sign" eval="-1"/>
</record>
@@ -220,6 +252,8 @@
<field name="amount">1</field>
<field name="type">percent</field>
<field name="child_depend">1</field>
<field name="base_sign" eval="-1"/>
<field name="tax_sign" eval="-1"/>
</record>
<record id="gstpst_purc_bc_gst_fr" model="account.tax.template">
@@ -234,6 +268,8 @@
<field name="account_collected_id" ref="chart1181_fr"/>
<field name="account_paid_id" ref="chart1181_fr"/>
<field name="parent_id" ref="gstpst_bc_purc_fr"/>
<field name="base_sign" eval="-1"/>
<field name="tax_sign" eval="-1"/>
</record>
<record id="pst_bc_purc_fr" model="account.tax.template">
@@ -247,6 +283,8 @@
<field name="account_collected_id" ref="chart1182_fr"/>
<field name="account_paid_id" ref="chart1182_fr"/>
<field name="parent_id" ref="gstpst_bc_purc_fr"/>
<field name="base_sign" eval="-1"/>
<field name="tax_sign" eval="-1"/>
</record>
<!-- Manitoba PST -->
@@ -259,6 +297,8 @@
<field name="amount">1</field>
<field name="type">percent</field>
<field name="child_depend" eval="True"/>
<field name="base_sign" eval="-1"/>
<field name="tax_sign" eval="-1"/>
</record>
<record id="gstpst_purc_mb_gst_fr" model="account.tax.template">
@@ -273,6 +313,8 @@
<field name="account_collected_id" ref="chart1181_fr"/>
<field name="account_paid_id" ref="chart1181_fr"/>
<field name="parent_id" ref="gstpst_mb_purc_fr"/>
<field name="base_sign" eval="-1"/>
<field name="tax_sign" eval="-1"/>
</record>
<record id="pst_mb_purc_fr" model="account.tax.template">
@@ -286,6 +328,8 @@
<field name="account_collected_id" ref="chart1182_fr"/>
<field name="account_paid_id" ref="chart1182_fr"/>
<field name="parent_id" ref="gstpst_mb_purc_fr"/>
<field name="base_sign" eval="-1"/>
<field name="tax_sign" eval="-1"/>
</record>
<!-- Quebec PST -->
@@ -298,6 +342,8 @@
<field name="amount">1</field>
<field name="type">percent</field>
<field name="child_depend" eval="True"/>
<field name="base_sign" eval="-1"/>
<field name="tax_sign" eval="-1"/>
</record>
<record id="gstqst_purc_gst_fr" model="account.tax.template">
@@ -311,6 +357,8 @@
<field name="account_collected_id" ref="chart1181_fr"/>
<field name="account_paid_id" ref="chart1181_fr"/>
<field name="parent_id" ref="gstqst_purc_fr"/>
<field name="base_sign" eval="-1"/>
<field name="tax_sign" eval="-1"/>
</record>
<record id="tvq_purc_fr" model="account.tax.template">
@@ -324,6 +372,8 @@
<field name="account_collected_id" ref="chart1182_fr"/>
<field name="account_paid_id" ref="chart1182_fr"/>
<field name="parent_id" ref="gstqst_purc_fr"/>
<field name="base_sign" eval="-1"/>
<field name="tax_sign" eval="-1"/>
</record>
<!-- Saskatchewan PST -->
@@ -336,6 +386,8 @@
<field name="amount">1</field>
<field name="type">percent</field>
<field name="child_depend" eval="True"/>
<field name="base_sign" eval="-1"/>
<field name="tax_sign" eval="-1"/>
</record>
<record id="gstpst_purc_sk_gst_fr" model="account.tax.template">
@@ -350,6 +402,8 @@
<field name="account_collected_id" ref="chart1181_fr"/>
<field name="account_paid_id" ref="chart1181_fr"/>
<field name="parent_id" ref="gstpst_sk_purc_fr"/>
<field name="base_sign" eval="-1"/>
<field name="tax_sign" eval="-1"/>
</record>
<record id="pst_sk_purc_fr" model="account.tax.template">
@@ -363,6 +417,8 @@
<field name="account_collected_id" ref="chart1182_fr"/>
<field name="account_paid_id" ref="chart1182_fr"/>
<field name="parent_id" ref="gstpst_sk_purc_fr"/>
<field name="base_sign" eval="-1"/>
<field name="tax_sign" eval="-1"/>
</record>
<!-- HST -->
@@ -376,6 +432,8 @@
<field name="type">percent</field>
<field name="account_collected_id" ref="chart11831_fr"/>
<field name="account_paid_id" ref="chart11831_fr"/>
<field name="base_sign" eval="-1"/>
<field name="tax_sign" eval="-1"/>
</record>
<record id="hst14_purc_fr" model="account.tax.template">
@@ -387,6 +445,8 @@
<field name="type">percent</field>
<field name="account_collected_id" ref="chart11832_fr"/>
<field name="account_paid_id" ref="chart11832_fr"/>
<field name="base_sign" eval="-1"/>
<field name="tax_sign" eval="-1"/>
</record>
<record id="hst15_purc_fr" model="account.tax.template">
@@ -398,6 +458,8 @@
<field name="type">percent</field>
<field name="account_collected_id" ref="chart11833_fr"/>
<field name="account_paid_id" ref="chart11833_fr"/>
<field name="base_sign" eval="-1"/>
<field name="tax_sign" eval="-1"/>
</record>
<!-- GST -->
@@ -411,6 +473,8 @@
<field name="type">percent</field>
<field name="account_collected_id" ref="chart1181_fr"/>
<field name="account_paid_id" ref="chart1181_fr"/>
<field name="base_sign" eval="-1"/>
<field name="tax_sign" eval="-1"/>
</record>
</data>
+1
View File
@@ -28,6 +28,7 @@
import time
from openerp.report import report_sxw
from openerp.tools.safe_eval import safe_eval as eval
class base_report(report_sxw.rml_parse):
+17
View File
@@ -0,0 +1,17 @@
# -*- coding: utf-8 -*-
# Copyright (C) Rooms For (Hong Kong) Limited T/A OSCG
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+53
View File
@@ -0,0 +1,53 @@
# -*- coding: utf-8 -*-
# Copyright (C) Rooms For (Hong Kong) Limited T/A OSCG
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
{
'name': 'Japan - Accounting',
'version': '1.2',
'category': 'Localization/Account Charts',
'description': """
Overview:
---------
* Chart of Accounts and Taxes template for companies in Japan.
* This probably does not cover all the necessary accounts for a company. \
You are expected to add/delete/modify accounts based on this template.
Note:
-----
* Fiscal positions '内税' and '外税' have been added to handle special \
requirements which might arise from POS implementation. [1] You may not \
need to use these at all under normal circumstances.
[1] See https://github.com/odoo/odoo/pull/6470 for detail.
""",
'author': 'Rooms For (Hong Kong) Limited T/A OSCG',
'website': 'http://www.openerp-asia.net/',
'depends': ['account'],
'data': [
'data/account.account.template.csv',
'data/account.tax.code.template.csv',
'data/account.chart.template.csv',
'data/account.tax.template.csv',
'data/account.fiscal.position.template.csv',
],
'installable': False,
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
@@ -0,0 +1,157 @@
id,code,name,parent_id:id,type,user_type/id,tax_ids/id,reconcile,currency_id/id
COM0,0,日本勘定科目表,,View,account.data_account_type_view,,FALSE,
A,A,貸借対照表,COM0,View,account.data_account_type_view,,FALSE,
A1,A1,資産の部,A,View,account.account_type_asset_view1,,FALSE,
A11,A11,流動資産,A1,View,account.account_type_asset_view1,,FALSE,
A111,A111,現金・預金,A11,View,account.account_type_asset_view1,,FALSE,
A11101,A11101,普通預金,A111,Liquidity,account.data_account_type_cash,,FALSE,
A11102,A11102,当座預金,A111,Liquidity,account.data_account_type_cash,,FALSE,
A11103,A11103,定期預金,A111,Liquidity,account.data_account_type_cash,,FALSE,
A11105,A11105,小口現金,A111,Liquidity,account.data_account_type_cash,,FALSE,
A112,A112,売掛金等,A11,View,account.account_type_asset_view1,,FALSE,
A11211,A11211,売掛金,A112,Receivable,account.data_account_type_receivable,,TRUE,
A11212,A11212,売掛金(USD),A112,Receivable,account.data_account_type_receivable,,TRUE,base.USD
A11215,A11215,受取手形,A112,Receivable,account.data_account_type_receivable,,TRUE,
A11216,A11216,割引手形,A112,Receivable,account.data_account_type_receivable,,TRUE,
A11219,A11219,出庫請求仮,A112,Regular,account.data_account_type_receivable,,FALSE,
A11301,A11301,未収収益,A11,Regular,account.data_account_type_asset,,FALSE,
A11401,A11401,有価証券,A11,Regular,account.data_account_type_asset,,FALSE,
A115,A115,在庫,A11,View,account.account_type_asset_view1,,FALSE,
A11501,A11501,商品,A115,Regular,account.data_account_type_asset,,FALSE,
A11503,A11503,製品,A115,Regular,account.data_account_type_asset,,FALSE,
A11504,A11504,仕掛品,A115,Regular,account.data_account_type_asset,,FALSE,
A11505,A11505,原材料,A115,Regular,account.data_account_type_asset,,FALSE,
A11506,A11506,資材,A115,Regular,account.data_account_type_asset,,FALSE,
A11503,A11503,積送品,A115,Regular,account.data_account_type_asset,,FALSE,
A11601,A11601,未収金,A11,Receivable,account.data_account_type_receivable,,TRUE,
A118,A118,その他流動資産,A11,View,account.account_type_asset_view1,,FALSE,
A11802,A11802,前渡金,A118,Regular,account.data_account_type_asset,,FALSE,
A11804,A11804,前払費用,A118,Regular,account.data_account_type_asset,,FALSE,
A11805,A11805,立替金,A118,Regular,account.data_account_type_asset,,FALSE,
A11806,A11806,仮払金,A118,Regular,account.data_account_type_asset,,FALSE,
A11807,A11807,仮払消費税,A118,Regular,account.conf_account_type_tax,,FALSE,
A11901,A11901,貸倒引当金,A11,Regular,account.data_account_type_asset,,FALSE,
A12,A12,固定資産,A1,View,account.account_type_asset_view1,,FALSE,
A121,A121,有形固定資産,A12,View,account.account_type_asset_view1,,FALSE,
A1211,A1211,建物及び構築物(純額),A121,View,account.account_type_asset_view1,,FALSE,
A12111,A12111,建物及び構築物,A1211,Regular,account.data_account_type_asset,,FALSE,
A12112,A12112,建物及び構築物減償累計額,A1211,Regular,account.data_account_type_asset,,FALSE,
A1212,A1212,機械及び装置(純額),A121,View,account.account_type_asset_view1,,FALSE,
A12121,A12121,機械及び装置,A1212,Regular,account.data_account_type_asset,,FALSE,
A12122,A12122,機械及び装置物減償累計額,A1212,Regular,account.data_account_type_asset,,FALSE,
A1213,A1213,工具、機器及び備品(純額),A121,View,account.account_type_asset_view1,,FALSE,
A12131,A12131,工具、機器及び備品,A1213,Regular,account.data_account_type_asset,,FALSE,
A12132,A12132,工具、機器及び備品減償累計額,A1213,Regular,account.data_account_type_asset,,FALSE,
A12141,A12141,土地,A121,Regular,account.data_account_type_asset,,FALSE,
A122,A122,無形固定資産,A12,View,account.account_type_asset_view1,,FALSE,
A1221,A1221,ソフトウェア,A122,Regular,account.data_account_type_asset,,FALSE,
A1222,A1222,ソフトウェア仮勘定,A122,Regular,account.data_account_type_asset,,FALSE,
A1223,A1223,その他無形固定資産,A122,Regular,account.data_account_type_asset,,FALSE,
A123,A123,投資その他資産,A12,View,account.account_type_asset_view1,,FALSE,
A12301,A12301,投資有価証券,A123,Regular,account.data_account_type_asset,,FALSE,
A12302,A12302,関係会社株式,A123,Regular,account.data_account_type_asset,,FALSE,
A12303,A12303,長期貸付金,A123,Regular,account.data_account_type_asset,,FALSE,
A13,A13,繰延資産,A1,View,account.account_type_asset_view1,,FALSE,
A13001,A13001,創立費,A13,Regular,account.data_account_type_asset,,FALSE,
A2,A2,負債の部,A,View,account.account_type_liability_view1,,FALSE,
A21,A21,流動負債,A2,View,account.account_type_liability_view1,,FALSE,
A212,A212,買掛金等,A21,View,account.account_type_liability_view1,,FALSE,
A21211,A21211,買掛金,A212,Payable,account.data_account_type_payable,,TRUE,
A21212,A21212,買掛金(USD),A212,Payable,account.data_account_type_payable,,TRUE,base.USD
A21215,A21215,支払手形,A212,Payable,account.data_account_type_payable,,TRUE,
A21219,A21219,入庫請求仮,A212,Regular,account.data_account_type_payable,,FALSE,
A213,A213,短期借入金等,A212,Payable,account.data_account_type_payable,,TRUE,
A21301,A21301,短期借入金,A21,Payable,account.data_account_type_payable,,TRUE,
A21302,A21302,一年以内返済長期借入金,A21,Payable,account.data_account_type_payable,,TRUE,
A214,A214,未払金等,A21,View,account.account_type_liability_view1,,FALSE,
A21401,A21401,未払金,A214,Payable,account.data_account_type_payable,,TRUE,
A21404,A21404,未払金(クレジット),A214,Payable,account.data_account_type_payable,,TRUE,
A21407,A21407,未払配当金,A214,Payable,account.data_account_type_payable,,TRUE,
A21501,A21501,未払費用,A21,Regular,account.data_account_type_liability,,FALSE,
A21601,A21601,未払法人税等,A21,Regular,account.conf_account_type_tax,,FALSE,
A218,A218,その他流動負債,A21,View,account.account_type_liability_view1,,FALSE,
A21802,A21802,前受金,A218,Regular,account.data_account_type_liability,,FALSE,
A21803,A21803,預り金,A218,Regular,account.data_account_type_liability,,FALSE,
A21804,A21804,仮受金,A218,Regular,account.data_account_type_liability,,FALSE,
A21806,A21806,賞与引当金,A218,Regular,account.data_account_type_liability,,FALSE,
A21807,A21807,仮受消費税,A218,Regular,account.conf_account_type_tax,,FALSE,
A22,A22,固定負債,A2,View,account.account_type_liability_view1,,FALSE,
A22001,A22001,社債,A22,Regular,account.data_account_type_liability,,FALSE,
A22002,A22002,長期借入金,A22,Regular,account.data_account_type_liability,,FALSE,
A22005,A22005,退職給付引当金,A22,Regular,account.data_account_type_liability,,FALSE,
A3,A3,純資産の部,A,View,account.account_type_liability_view1,,FALSE,
A31,A31,株主資本,A3,View,account.account_type_liability_view1,,FALSE,
A31001,A31001,資本金,A31,Regular,account.conf_account_type_equity,,FALSE,
A32,A32,資本剰余金,A3,View,account.account_type_liability_view1,,FALSE,
A32101,A32101,資本準備金,A32,Regular,account.conf_account_type_equity,,FALSE,
A32109,A32109,その他資本剰余金,A32,Regular,account.conf_account_type_equity,,FALSE,
A33,A33,利益剰余金,A3,View,account.account_type_liability_view1,,FALSE,
A33101,A33101,利益準備金,A33,Regular,account.conf_account_type_equity,,FALSE,
A332,A332,その他利益剰余金,A33,View,account.account_type_liability_view1,,FALSE,
A33202,A33202,特別償却準備金,A332,Regular,account.conf_account_type_equity,,FALSE,
A33204,A33204,任意積立金,A332,Regular,account.conf_account_type_equity,,FALSE,
A33209,A33209,繰越利益剰余金,A332,Regular,account.conf_account_type_equity,,FALSE,
B,B,損益計算書,COM0,View,account.data_account_type_view,,FALSE,
B4,B4,売上総利益,B,View,account.account_type_income_view1,,FALSE,
B41001,B41001,売上高,B4,Regular,account.data_account_type_income,,FALSE,
B42001,B42001,売上原価,B4,Regular,account.data_account_type_income,,FALSE,
B42091,B42091,購買価格差異,B4,Regular,account.data_account_type_income,,FALSE,
B42092,B42092,棚卸調整,B4,Regular,account.data_account_type_income,,FALSE,
B5,B5,販売費及び一般管理費,B,View,account.account_type_expense_view1,,FALSE,
B50011,B50011,貸倒引当金繰入額,B5,Regular,account.data_account_type_expense,,FALSE,
B50041,B50041,役員報酬,B5,Regular,account.data_account_type_expense,,FALSE,
B50071,B50071,給料及び手当,B5,Regular,account.data_account_type_expense,,FALSE,
B50081,B50081,賞与,B5,Regular,account.data_account_type_expense,,FALSE,
B50091,B50091,退職金,B5,Regular,account.data_account_type_expense,,FALSE,
B50111,B50111,賞与引当金繰入,B5,Regular,account.data_account_type_expense,,FALSE,
B50131,B50131,退職給付引当金繰入,B5,Regular,account.data_account_type_expense,,FALSE,
B50151,B50151,法定福利費,B5,Regular,account.data_account_type_expense,,FALSE,
B50161,B50161,福利厚生費,B5,Regular,account.data_account_type_expense,,FALSE,
B50171,B50171,保険料,B5,Regular,account.data_account_type_expense,,FALSE,
B50191,B50191,外注費,B5,Regular,account.data_account_type_expense,,FALSE,
B50211,B50211,荷造運賃,B5,Regular,account.data_account_type_expense,,FALSE,
B50221,B50221,棚卸減耗費,B5,Regular,account.data_account_type_expense,,FALSE,
B50231,B50231,商品評価損,B5,Regular,account.data_account_type_expense,,FALSE,
B50241,B50241,地代家賃,B5,Regular,account.data_account_type_expense,,FALSE,
B50251,B50251,リース料,B5,Regular,account.data_account_type_expense,,FALSE,
B50271,B50271,広告宣伝費,B5,Regular,account.data_account_type_expense,,FALSE,
B50281,B50281,通信費,B5,Regular,account.data_account_type_expense,,FALSE,
B50311,B50311,消耗品費,B5,Regular,account.data_account_type_expense,,FALSE,
B50341,B50341,旅費交通費,B5,Regular,account.data_account_type_expense,,FALSE,
B50371,B50371,交際費,B5,Regular,account.data_account_type_expense,,FALSE,
B50401,B50401,支払手数料,B5,Regular,account.data_account_type_expense,,FALSE,
B50431,B50431,諸会費,B5,Regular,account.data_account_type_expense,,FALSE,
B50461,B50461,新聞図書費,B5,Regular,account.data_account_type_expense,,FALSE,
B50491,B50491,租税公課,B5,Regular,account.data_account_type_expense,,FALSE,
B50511,B50511,水道光熱費,B5,Regular,account.data_account_type_expense,,FALSE,
B50521,B50521,会議費,B5,Regular,account.data_account_type_expense,,FALSE,
B50551,B50551,雑費,B5,Regular,account.data_account_type_expense,,FALSE,
B61,B61,営業外収益,B,View,account.account_type_income_view1,,FALSE,
B61101,B61101,受取利息,B61,Regular,account.data_account_type_income,,FALSE,
B61201,B61201,受取配当金,B61,Regular,account.data_account_type_income,,FALSE,
B61401,B61401,未実現為替差益,B61,Regular,account.data_account_type_income,,FALSE,
B61501,B61501,実現為替差益,B61,Regular,account.data_account_type_income,,FALSE,
B61601,B61601,投資有価証券売却益(外益),B61,Regular,account.data_account_type_income,,FALSE,
B61602,B61602,投資有価証券評価益(外益),B61,Regular,account.data_account_type_income,,FALSE,
B61801,B61801,雑収入,B61,Regular,account.data_account_type_income,,FALSE,
B62,B62,営業外費用,B,View,account.account_type_expense_view1,,FALSE,
B62101,B62101,支払利息,B62,Regular,account.data_account_type_expense,,FALSE,
B62201,B62201,創立費償却,B62,Regular,account.data_account_type_expense,,FALSE,
B62401,B62401,未実現為替差損,B62,Regular,account.data_account_type_expense,,FALSE,
B62402,B62402,実現為替差損,B62,Regular,account.data_account_type_expense,,FALSE,
B62601,B62601,投資有価証券売却損(外損),B62,Regular,account.data_account_type_expense,,FALSE,
B62602,B62602,投資有価証券評価損(外損),B62,Regular,account.data_account_type_expense,,FALSE,
B62801,B62801,雑費用,B62,Regular,account.data_account_type_expense,,FALSE,
B71,B71,特別利益,B,View,account.account_type_income_view1,,FALSE,
B71101,B71101,固定資産売却益,B71,Regular,account.data_account_type_income,,FALSE,
B71102,B71102,固定資産評価益,B71,Regular,account.data_account_type_income,,FALSE,
B71201,B71201,投資有価証券売却益(特益),B71,Regular,account.data_account_type_income,,FALSE,
B71202,B71202,投資有価証券評価益(特益),B71,Regular,account.data_account_type_income,,FALSE,
B72,B72,特別損失,B,View,account.account_type_expense_view1,,FALSE,
B72101,B72101,固定資産売却損,B72,Regular,account.data_account_type_expense,,FALSE,
B72102,B72102,固定資産評価損,B72,Regular,account.data_account_type_expense,,FALSE,
B72201,B72201,投資有価証券売却損(特損),B72,Regular,account.data_account_type_expense,,FALSE,
B72202,B72202,投資有価証券評価損(特損),B72,Regular,account.data_account_type_expense,,FALSE,
B8,B8,法人税等,B,View,account.account_type_expense_view1,,FALSE,
B80101,B80101,法人税、住民税及び事業税,B8,Regular,account.data_account_type_expense,,FALSE,
B90001,B90001,期間利益,B,Regular,account.data_account_type_expense,,FALSE,
1 id code name parent_id:id type user_type/id tax_ids/id reconcile currency_id/id
2 COM0 0 日本勘定科目表 View account.data_account_type_view FALSE
3 A A 貸借対照表 COM0 View account.data_account_type_view FALSE
4 A1 A1 資産の部 A View account.account_type_asset_view1 FALSE
5 A11 A11 流動資産 A1 View account.account_type_asset_view1 FALSE
6 A111 A111 現金・預金 A11 View account.account_type_asset_view1 FALSE
7 A11101 A11101 普通預金 A111 Liquidity account.data_account_type_cash FALSE
8 A11102 A11102 当座預金 A111 Liquidity account.data_account_type_cash FALSE
9 A11103 A11103 定期預金 A111 Liquidity account.data_account_type_cash FALSE
10 A11105 A11105 小口現金 A111 Liquidity account.data_account_type_cash FALSE
11 A112 A112 売掛金等 A11 View account.account_type_asset_view1 FALSE
12 A11211 A11211 売掛金 A112 Receivable account.data_account_type_receivable TRUE
13 A11212 A11212 売掛金(USD) A112 Receivable account.data_account_type_receivable TRUE base.USD
14 A11215 A11215 受取手形 A112 Receivable account.data_account_type_receivable TRUE
15 A11216 A11216 割引手形 A112 Receivable account.data_account_type_receivable TRUE
16 A11219 A11219 出庫請求仮 A112 Regular account.data_account_type_receivable FALSE
17 A11301 A11301 未収収益 A11 Regular account.data_account_type_asset FALSE
18 A11401 A11401 有価証券 A11 Regular account.data_account_type_asset FALSE
19 A115 A115 在庫 A11 View account.account_type_asset_view1 FALSE
20 A11501 A11501 商品 A115 Regular account.data_account_type_asset FALSE
21 A11503 A11503 製品 A115 Regular account.data_account_type_asset FALSE
22 A11504 A11504 仕掛品 A115 Regular account.data_account_type_asset FALSE
23 A11505 A11505 原材料 A115 Regular account.data_account_type_asset FALSE
24 A11506 A11506 資材 A115 Regular account.data_account_type_asset FALSE
25 A11503 A11503 積送品 A115 Regular account.data_account_type_asset FALSE
26 A11601 A11601 未収金 A11 Receivable account.data_account_type_receivable TRUE
27 A118 A118 その他流動資産 A11 View account.account_type_asset_view1 FALSE
28 A11802 A11802 前渡金 A118 Regular account.data_account_type_asset FALSE
29 A11804 A11804 前払費用 A118 Regular account.data_account_type_asset FALSE
30 A11805 A11805 立替金 A118 Regular account.data_account_type_asset FALSE
31 A11806 A11806 仮払金 A118 Regular account.data_account_type_asset FALSE
32 A11807 A11807 仮払消費税 A118 Regular account.conf_account_type_tax FALSE
33 A11901 A11901 貸倒引当金 A11 Regular account.data_account_type_asset FALSE
34 A12 A12 固定資産 A1 View account.account_type_asset_view1 FALSE
35 A121 A121 有形固定資産 A12 View account.account_type_asset_view1 FALSE
36 A1211 A1211 建物及び構築物(純額) A121 View account.account_type_asset_view1 FALSE
37 A12111 A12111 建物及び構築物 A1211 Regular account.data_account_type_asset FALSE
38 A12112 A12112 建物及び構築物減償累計額 A1211 Regular account.data_account_type_asset FALSE
39 A1212 A1212 機械及び装置(純額) A121 View account.account_type_asset_view1 FALSE
40 A12121 A12121 機械及び装置 A1212 Regular account.data_account_type_asset FALSE
41 A12122 A12122 機械及び装置物減償累計額 A1212 Regular account.data_account_type_asset FALSE
42 A1213 A1213 工具、機器及び備品(純額) A121 View account.account_type_asset_view1 FALSE
43 A12131 A12131 工具、機器及び備品 A1213 Regular account.data_account_type_asset FALSE
44 A12132 A12132 工具、機器及び備品減償累計額 A1213 Regular account.data_account_type_asset FALSE
45 A12141 A12141 土地 A121 Regular account.data_account_type_asset FALSE
46 A122 A122 無形固定資産 A12 View account.account_type_asset_view1 FALSE
47 A1221 A1221 ソフトウェア A122 Regular account.data_account_type_asset FALSE
48 A1222 A1222 ソフトウェア仮勘定 A122 Regular account.data_account_type_asset FALSE
49 A1223 A1223 その他無形固定資産 A122 Regular account.data_account_type_asset FALSE
50 A123 A123 投資その他資産 A12 View account.account_type_asset_view1 FALSE
51 A12301 A12301 投資有価証券 A123 Regular account.data_account_type_asset FALSE
52 A12302 A12302 関係会社株式 A123 Regular account.data_account_type_asset FALSE
53 A12303 A12303 長期貸付金 A123 Regular account.data_account_type_asset FALSE
54 A13 A13 繰延資産 A1 View account.account_type_asset_view1 FALSE
55 A13001 A13001 創立費 A13 Regular account.data_account_type_asset FALSE
56 A2 A2 負債の部 A View account.account_type_liability_view1 FALSE
57 A21 A21 流動負債 A2 View account.account_type_liability_view1 FALSE
58 A212 A212 買掛金等 A21 View account.account_type_liability_view1 FALSE
59 A21211 A21211 買掛金 A212 Payable account.data_account_type_payable TRUE
60 A21212 A21212 買掛金(USD) A212 Payable account.data_account_type_payable TRUE base.USD
61 A21215 A21215 支払手形 A212 Payable account.data_account_type_payable TRUE
62 A21219 A21219 入庫請求仮 A212 Regular account.data_account_type_payable FALSE
63 A213 A213 短期借入金等 A212 Payable account.data_account_type_payable TRUE
64 A21301 A21301 短期借入金 A21 Payable account.data_account_type_payable TRUE
65 A21302 A21302 一年以内返済長期借入金 A21 Payable account.data_account_type_payable TRUE
66 A214 A214 未払金等 A21 View account.account_type_liability_view1 FALSE
67 A21401 A21401 未払金 A214 Payable account.data_account_type_payable TRUE
68 A21404 A21404 未払金(クレジット) A214 Payable account.data_account_type_payable TRUE
69 A21407 A21407 未払配当金 A214 Payable account.data_account_type_payable TRUE
70 A21501 A21501 未払費用 A21 Regular account.data_account_type_liability FALSE
71 A21601 A21601 未払法人税等 A21 Regular account.conf_account_type_tax FALSE
72 A218 A218 その他流動負債 A21 View account.account_type_liability_view1 FALSE
73 A21802 A21802 前受金 A218 Regular account.data_account_type_liability FALSE
74 A21803 A21803 預り金 A218 Regular account.data_account_type_liability FALSE
75 A21804 A21804 仮受金 A218 Regular account.data_account_type_liability FALSE
76 A21806 A21806 賞与引当金 A218 Regular account.data_account_type_liability FALSE
77 A21807 A21807 仮受消費税 A218 Regular account.conf_account_type_tax FALSE
78 A22 A22 固定負債 A2 View account.account_type_liability_view1 FALSE
79 A22001 A22001 社債 A22 Regular account.data_account_type_liability FALSE
80 A22002 A22002 長期借入金 A22 Regular account.data_account_type_liability FALSE
81 A22005 A22005 退職給付引当金 A22 Regular account.data_account_type_liability FALSE
82 A3 A3 純資産の部 A View account.account_type_liability_view1 FALSE
83 A31 A31 株主資本 A3 View account.account_type_liability_view1 FALSE
84 A31001 A31001 資本金 A31 Regular account.conf_account_type_equity FALSE
85 A32 A32 資本剰余金 A3 View account.account_type_liability_view1 FALSE
86 A32101 A32101 資本準備金 A32 Regular account.conf_account_type_equity FALSE
87 A32109 A32109 その他資本剰余金 A32 Regular account.conf_account_type_equity FALSE
88 A33 A33 利益剰余金 A3 View account.account_type_liability_view1 FALSE
89 A33101 A33101 利益準備金 A33 Regular account.conf_account_type_equity FALSE
90 A332 A332 その他利益剰余金 A33 View account.account_type_liability_view1 FALSE
91 A33202 A33202 特別償却準備金 A332 Regular account.conf_account_type_equity FALSE
92 A33204 A33204 任意積立金 A332 Regular account.conf_account_type_equity FALSE
93 A33209 A33209 繰越利益剰余金 A332 Regular account.conf_account_type_equity FALSE
94 B B 損益計算書 COM0 View account.data_account_type_view FALSE
95 B4 B4 売上総利益 B View account.account_type_income_view1 FALSE
96 B41001 B41001 売上高 B4 Regular account.data_account_type_income FALSE
97 B42001 B42001 売上原価 B4 Regular account.data_account_type_income FALSE
98 B42091 B42091 購買価格差異 B4 Regular account.data_account_type_income FALSE
99 B42092 B42092 棚卸調整 B4 Regular account.data_account_type_income FALSE
100 B5 B5 販売費及び一般管理費 B View account.account_type_expense_view1 FALSE
101 B50011 B50011 貸倒引当金繰入額 B5 Regular account.data_account_type_expense FALSE
102 B50041 B50041 役員報酬 B5 Regular account.data_account_type_expense FALSE
103 B50071 B50071 給料及び手当 B5 Regular account.data_account_type_expense FALSE
104 B50081 B50081 賞与 B5 Regular account.data_account_type_expense FALSE
105 B50091 B50091 退職金 B5 Regular account.data_account_type_expense FALSE
106 B50111 B50111 賞与引当金繰入 B5 Regular account.data_account_type_expense FALSE
107 B50131 B50131 退職給付引当金繰入 B5 Regular account.data_account_type_expense FALSE
108 B50151 B50151 法定福利費 B5 Regular account.data_account_type_expense FALSE
109 B50161 B50161 福利厚生費 B5 Regular account.data_account_type_expense FALSE
110 B50171 B50171 保険料 B5 Regular account.data_account_type_expense FALSE
111 B50191 B50191 外注費 B5 Regular account.data_account_type_expense FALSE
112 B50211 B50211 荷造運賃 B5 Regular account.data_account_type_expense FALSE
113 B50221 B50221 棚卸減耗費 B5 Regular account.data_account_type_expense FALSE
114 B50231 B50231 商品評価損 B5 Regular account.data_account_type_expense FALSE
115 B50241 B50241 地代家賃 B5 Regular account.data_account_type_expense FALSE
116 B50251 B50251 リース料 B5 Regular account.data_account_type_expense FALSE
117 B50271 B50271 広告宣伝費 B5 Regular account.data_account_type_expense FALSE
118 B50281 B50281 通信費 B5 Regular account.data_account_type_expense FALSE
119 B50311 B50311 消耗品費 B5 Regular account.data_account_type_expense FALSE
120 B50341 B50341 旅費交通費 B5 Regular account.data_account_type_expense FALSE
121 B50371 B50371 交際費 B5 Regular account.data_account_type_expense FALSE
122 B50401 B50401 支払手数料 B5 Regular account.data_account_type_expense FALSE
123 B50431 B50431 諸会費 B5 Regular account.data_account_type_expense FALSE
124 B50461 B50461 新聞図書費 B5 Regular account.data_account_type_expense FALSE
125 B50491 B50491 租税公課 B5 Regular account.data_account_type_expense FALSE
126 B50511 B50511 水道光熱費 B5 Regular account.data_account_type_expense FALSE
127 B50521 B50521 会議費 B5 Regular account.data_account_type_expense FALSE
128 B50551 B50551 雑費 B5 Regular account.data_account_type_expense FALSE
129 B61 B61 営業外収益 B View account.account_type_income_view1 FALSE
130 B61101 B61101 受取利息 B61 Regular account.data_account_type_income FALSE
131 B61201 B61201 受取配当金 B61 Regular account.data_account_type_income FALSE
132 B61401 B61401 未実現為替差益 B61 Regular account.data_account_type_income FALSE
133 B61501 B61501 実現為替差益 B61 Regular account.data_account_type_income FALSE
134 B61601 B61601 投資有価証券売却益(外益) B61 Regular account.data_account_type_income FALSE
135 B61602 B61602 投資有価証券評価益(外益) B61 Regular account.data_account_type_income FALSE
136 B61801 B61801 雑収入 B61 Regular account.data_account_type_income FALSE
137 B62 B62 営業外費用 B View account.account_type_expense_view1 FALSE
138 B62101 B62101 支払利息 B62 Regular account.data_account_type_expense FALSE
139 B62201 B62201 創立費償却 B62 Regular account.data_account_type_expense FALSE
140 B62401 B62401 未実現為替差損 B62 Regular account.data_account_type_expense FALSE
141 B62402 B62402 実現為替差損 B62 Regular account.data_account_type_expense FALSE
142 B62601 B62601 投資有価証券売却損(外損) B62 Regular account.data_account_type_expense FALSE
143 B62602 B62602 投資有価証券評価損(外損) B62 Regular account.data_account_type_expense FALSE
144 B62801 B62801 雑費用 B62 Regular account.data_account_type_expense FALSE
145 B71 B71 特別利益 B View account.account_type_income_view1 FALSE
146 B71101 B71101 固定資産売却益 B71 Regular account.data_account_type_income FALSE
147 B71102 B71102 固定資産評価益 B71 Regular account.data_account_type_income FALSE
148 B71201 B71201 投資有価証券売却益(特益) B71 Regular account.data_account_type_income FALSE
149 B71202 B71202 投資有価証券評価益(特益) B71 Regular account.data_account_type_income FALSE
150 B72 B72 特別損失 B View account.account_type_expense_view1 FALSE
151 B72101 B72101 固定資産売却損 B72 Regular account.data_account_type_expense FALSE
152 B72102 B72102 固定資産評価損 B72 Regular account.data_account_type_expense FALSE
153 B72201 B72201 投資有価証券売却損(特損) B72 Regular account.data_account_type_expense FALSE
154 B72202 B72202 投資有価証券評価損(特損) B72 Regular account.data_account_type_expense FALSE
155 B8 B8 法人税等 B View account.account_type_expense_view1 FALSE
156 B80101 B80101 法人税、住民税及び事業税 B8 Regular account.data_account_type_expense FALSE
157 B90001 B90001 期間利益 B Regular account.data_account_type_expense FALSE
@@ -0,0 +1,2 @@
id,name,account_root_id/id,tax_code_root_id/id,bank_account_view_id/id,property_account_receivable/id,property_account_payable/id,property_account_expense_categ/id,property_account_income_categ/id,property_account_expense/id,property_account_income/id
l10n_jp1,日本勘定設定テンプレート,COM0,jpt_root,A111,A11211,A21211,A21219,B41001,A21219,B41001
1 id name account_root_id/id tax_code_root_id/id bank_account_view_id/id property_account_receivable/id property_account_payable/id property_account_expense_categ/id property_account_income_categ/id property_account_expense/id property_account_income/id
2 l10n_jp1 日本勘定設定テンプレート COM0 jpt_root A111 A11211 A21211 A21219 B41001 A21219 B41001
@@ -0,0 +1,7 @@
id,chart_template_id/id,name,note,tax_ids/tax_src_id/id,tax_ids/tax_dest_id/id
fiscal_position_tax_inclusive_template,l10n_jp1,内税,,tax_in_e,tax_in_i
,,,,tax_out_e,tax_out_i
fiscal_position_tax_exclusive_template,l10n_jp1,外税,,tax_in_i,tax_in_e
,,,,tax_out_i,tax_out_e
fiscal_position_tax_exempt_template,l10n_jp1,海外取引先,,tax_in_e,tax_in_x
,,,,tax_out_e,tax_out_im
1 id chart_template_id/id name note tax_ids/tax_src_id/id tax_ids/tax_dest_id/id
2 fiscal_position_tax_inclusive_template l10n_jp1 内税 tax_in_e tax_in_i
3 tax_out_e tax_out_i
4 fiscal_position_tax_exclusive_template l10n_jp1 外税 tax_in_i tax_in_e
5 tax_out_i tax_out_e
6 fiscal_position_tax_exempt_template l10n_jp1 海外取引先 tax_in_e tax_in_x
7 tax_out_e tax_out_im
@@ -0,0 +1,20 @@
id,name,parent_id/id,code,notprintable,sign
jpt_root,日本税チャート,,,FALSE,1
jpt_tax_code_balance_net,支払対象税額,jpt_root,,FALSE,1
jpt_tax_code_input,仮受税額,jpt_tax_code_balance_net,,FALSE,-1
jpt_tax_code_input_A,仮受消費税(8%),jpt_tax_code_input,,FALSE,1
jpt_tax_code_input_X,免税,jpt_tax_code_input,,FALSE,1
jpt_tax_code_input_O,不課税,jpt_tax_code_input,,FALSE,1
jpt_tax_code_output,仮払税額,jpt_tax_code_balance_net,,FALSE,1
jpt_tax_code_output_A,仮払消費税(8%),jpt_tax_code_output,,FALSE,1
jpt_tax_code_output_I,輸入,jpt_tax_code_output,,FALSE,1
jpt_tax_code_output_O,不課税,jpt_tax_code_output,,FALSE,1
jpt_tax_code_base_net,税計算基準額,jpt_root,,FALSE,1
jpt_tax_code_base_sales,販売基準額,jpt_tax_code_base_net,,FALSE,1
jpt_tax_code_sales_A,課税対象売上(8%),jpt_tax_code_base_sales,,FALSE,1
jpt_tax_code_sales_X,免税売上,jpt_tax_code_base_sales,,FALSE,1
jpt_tax_code_sales_O,不課税売上,jpt_tax_code_base_sales,,FALSE,1
jpt_tax_code_base_purchases,購買基準額,jpt_tax_code_base_net,,FALSE,1
jpt_tax_code_purch_A,課税対象仕入(8%),jpt_tax_code_base_purchases,,FALSE,1
jpt_tax_code_purch_I,輸入仕入,jpt_tax_code_base_purchases,,FALSE,1
jpt_tax_code_purch_O,不課税仕入,jpt_tax_code_base_purchases,,FALSE,1
1 id name parent_id/id code notprintable sign
2 jpt_root 日本税チャート FALSE 1
3 jpt_tax_code_balance_net 支払対象税額 jpt_root FALSE 1
4 jpt_tax_code_input 仮受税額 jpt_tax_code_balance_net FALSE -1
5 jpt_tax_code_input_A 仮受消費税(8%) jpt_tax_code_input FALSE 1
6 jpt_tax_code_input_X 免税 jpt_tax_code_input FALSE 1
7 jpt_tax_code_input_O 不課税 jpt_tax_code_input FALSE 1
8 jpt_tax_code_output 仮払税額 jpt_tax_code_balance_net FALSE 1
9 jpt_tax_code_output_A 仮払消費税(8%) jpt_tax_code_output FALSE 1
10 jpt_tax_code_output_I 輸入 jpt_tax_code_output FALSE 1
11 jpt_tax_code_output_O 不課税 jpt_tax_code_output FALSE 1
12 jpt_tax_code_base_net 税計算基準額 jpt_root FALSE 1
13 jpt_tax_code_base_sales 販売基準額 jpt_tax_code_base_net FALSE 1
14 jpt_tax_code_sales_A 課税対象売上(8%) jpt_tax_code_base_sales FALSE 1
15 jpt_tax_code_sales_X 免税売上 jpt_tax_code_base_sales FALSE 1
16 jpt_tax_code_sales_O 不課税売上 jpt_tax_code_base_sales FALSE 1
17 jpt_tax_code_base_purchases 購買基準額 jpt_tax_code_base_net FALSE 1
18 jpt_tax_code_purch_A 課税対象仕入(8%) jpt_tax_code_base_purchases FALSE 1
19 jpt_tax_code_purch_I 輸入仕入 jpt_tax_code_base_purchases FALSE 1
20 jpt_tax_code_purch_O 不課税仕入 jpt_tax_code_base_purchases FALSE 1
@@ -0,0 +1,9 @@
id,name,description,chart_template_id/id,type_tax_use,type,amount,price_include,sequence,include_base_amount,account_collected_id/id,base_code_id/id,base_sign,tax_code_id/id,tax_sign,account_paid_id/id,ref_base_code_id/id,ref_base_sign,ref_tax_code_id/id,ref_tax_sign,child_depend
tax_in_e,仮受消費税(外),,l10n_jp1,sale,percent,0.08,FALSE,1,FALSE,A11807,jpt_tax_code_sales_A,1,jpt_tax_code_input_A,1,A11807,jpt_tax_code_sales_A,1,jpt_tax_code_input_A,1,FALSE
tax_in_i,仮受消費税(内),,l10n_jp1,sale,percent,0.08,TRUE,1,FALSE,A11807,jpt_tax_code_sales_A,1,jpt_tax_code_input_A,1,A11807,jpt_tax_code_sales_A,1,jpt_tax_code_input_A,1,FALSE
tax_in_x,輸出免税,,l10n_jp1,sale,percent,,FALSE,1,FALSE,,jpt_tax_code_sales_X,1,jpt_tax_code_input_X,1,,jpt_tax_code_sales_X,1,jpt_tax_code_input_X,1,FALSE
tax_in_o,非課税販売,,l10n_jp1,sale,percent,,FALSE,1,FALSE,,jpt_tax_code_sales_O,1,jpt_tax_code_input_O,1,,jpt_tax_code_sales_O,1,jpt_tax_code_input_O,1,FALSE
tax_out_e,仮払消費税(外),,l10n_jp1,purchase,percent,0.08,FALSE,1,FALSE,A21807,jpt_tax_code_purch_A,1,jpt_tax_code_output_A,1,A21807,jpt_tax_code_purch_A,1,jpt_tax_code_output_A,1,FALSE
tax_out_i,仮払消費税(内),,l10n_jp1,purchase,percent,0.08,TRUE,1,FALSE,A21807,jpt_tax_code_purch_A,1,jpt_tax_code_output_A,1,A21807,jpt_tax_code_purch_A,1,jpt_tax_code_output_A,1,FALSE
tax_out_im,海外仕入,,l10n_jp1,purchase,percent,,FALSE,1,FALSE,,jpt_tax_code_purch_I,1,jpt_tax_code_output_I,1,,jpt_tax_code_purch_I,1,jpt_tax_code_output_I,1,FALSE
tax_out_o,非課税購買,,l10n_jp1,purchase,percent,,FALSE,1,FALSE,,jpt_tax_code_purch_O,1,jpt_tax_code_output_O,1,,jpt_tax_code_purch_O,1,jpt_tax_code_output_O,1,FALSE
1 id name description chart_template_id/id type_tax_use type amount price_include sequence include_base_amount account_collected_id/id base_code_id/id base_sign tax_code_id/id tax_sign account_paid_id/id ref_base_code_id/id ref_base_sign ref_tax_code_id/id ref_tax_sign child_depend
2 tax_in_e 仮受消費税(外) l10n_jp1 sale percent 0.08 FALSE 1 FALSE A11807 jpt_tax_code_sales_A 1 jpt_tax_code_input_A 1 A11807 jpt_tax_code_sales_A 1 jpt_tax_code_input_A 1 FALSE
3 tax_in_i 仮受消費税(内) l10n_jp1 sale percent 0.08 TRUE 1 FALSE A11807 jpt_tax_code_sales_A 1 jpt_tax_code_input_A 1 A11807 jpt_tax_code_sales_A 1 jpt_tax_code_input_A 1 FALSE
4 tax_in_x 輸出免税 l10n_jp1 sale percent FALSE 1 FALSE jpt_tax_code_sales_X 1 jpt_tax_code_input_X 1 jpt_tax_code_sales_X 1 jpt_tax_code_input_X 1 FALSE
5 tax_in_o 非課税販売 l10n_jp1 sale percent FALSE 1 FALSE jpt_tax_code_sales_O 1 jpt_tax_code_input_O 1 jpt_tax_code_sales_O 1 jpt_tax_code_input_O 1 FALSE
6 tax_out_e 仮払消費税(外) l10n_jp1 purchase percent 0.08 FALSE 1 FALSE A21807 jpt_tax_code_purch_A 1 jpt_tax_code_output_A 1 A21807 jpt_tax_code_purch_A 1 jpt_tax_code_output_A 1 FALSE
7 tax_out_i 仮払消費税(内) l10n_jp1 purchase percent 0.08 TRUE 1 FALSE A21807 jpt_tax_code_purch_A 1 jpt_tax_code_output_A 1 A21807 jpt_tax_code_purch_A 1 jpt_tax_code_output_A 1 FALSE
8 tax_out_im 海外仕入 l10n_jp1 purchase percent FALSE 1 FALSE jpt_tax_code_purch_I 1 jpt_tax_code_output_I 1 jpt_tax_code_purch_I 1 jpt_tax_code_output_I 1 FALSE
9 tax_out_o 非課税購買 l10n_jp1 purchase percent FALSE 1 FALSE jpt_tax_code_purch_O 1 jpt_tax_code_output_O 1 jpt_tax_code_purch_O 1 jpt_tax_code_output_O 1 FALSE
Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

+1
View File
@@ -8,6 +8,7 @@ from openerp import _, api, fields, models, SUPERUSER_ID
from openerp.exceptions import UserError
from openerp.modules.registry import RegistryManager
from openerp.tools import ustr
from openerp.tools.safe_eval import safe_eval as eval
_logger = logging.getLogger(__name__)
+1
View File
@@ -181,6 +181,7 @@ class Notification(models.Model):
mail_values = {
'mail_message_id': message.id,
'auto_delete': self._context.get('mail_auto_delete', True),
'mail_server_id': self._context.get('mail_server_id', False),
'body_html': body_html,
'recipient_ids': [(4, id) for id in chunk],
'references': references,
+3 -1
View File
@@ -17,7 +17,9 @@ def decode(text):
# TDE proposal: move to tools ?
if text:
text = decode_header(text.replace('\r', ''))
return ''.join([tools.ustr(x[0], x[1]) for x in text])
# The joining space will not be needed as of Python 3.3
# See https://hg.python.org/cpython/rev/8c03fe231877
return ' '.join([tools.ustr(x[0], x[1]) for x in text])
class Message(models.Model):
+1 -2
View File
@@ -49,7 +49,7 @@ var TimelineRecordThread = form_common.AbstractField.extend ({
'readonly': this.node.attrs.readonly || false,
'compose_placeholder' : this.node.attrs.placeholder || false,
'display_log_button' : this.options.display_log_button || true,
'show_compose_message': this.view.is_action_enabled('edit') || false,
'show_compose_message': true,
'show_link': this.parent.is_action_enabled('edit') || true,
}, this.node.params);
},
@@ -1434,7 +1434,6 @@ var ComposeMessage = Attachment.extend ({
}
}
}
this.$(".o_timeline_msg_attachment_list").html(this.display_attachments(this));
var $input = this.$('input.oe_form_binary_file');
+2 -2
View File
@@ -216,7 +216,7 @@ class MailComposer(models.TransientModel):
if wizard.template_id:
# template user_signature is added when generating body_html
# mass mailing: use template auto_delete value -> note, for emails mass mailing only
Mail = Mail.with_context(mail_notify_user_signature=False, mail_auto_delete=wizard.template_id.auto_delete)
Mail = Mail.with_context(mail_notify_user_signature=False, mail_auto_delete=wizard.template_id.auto_delete, mail_server_id=wizard.template_id.mail_server_id.id)
if wizard.attachment_ids and wizard.composition_mode != 'mass_mail' and wizard.template_id:
new_attachment_ids = []
for attachment in wizard.attachment_ids:
@@ -285,7 +285,7 @@ class MailComposer(models.TransientModel):
# static wizard (mail.message) values
mail_values = {
'subject': self.subject,
'body': self.body,
'body': self.body or '',
'parent_id': self.parent_id and self.parent_id.id,
'partner_ids': [partner.id for partner in self.partner_ids],
'attachment_ids': [attach.id for attach in self.attachment_ids],
@@ -19,9 +19,7 @@
#
##############################################################################
import openerp
from openerp.osv import fields, osv
from openerp import models, api, _
class MailMailStats(osv.Model):
@@ -35,28 +33,27 @@ class MailMailStats(osv.Model):
_rec_name = 'message_id'
_order = 'message_id'
def _compute_state(self, cr, uid, stat_ids, field_names, arg, context=None):
stats = self.browse(cr, uid, stat_ids, context=context)
res = dict([(stat, False) for stat in stat_ids])
def _compute_state(self, cr, uid, ids, field_names, arg, context=None):
res = dict((i, {'state': 'outgoing', 'state_update': fields.datetime.now()}) for i in ids)
self.write(cr, uid, stat_ids, {'state_update': fields.datetime.now()}, context=context)
for stat in stats:
for stat in self.browse(cr, uid, ids, context=context):
if stat.exception:
res[stat.id] = 'exception'
res[stat.id]['state'] = 'exception'
if stat.sent:
res[stat.id] = 'sent'
res[stat.id]['state'] = 'sent'
if stat.opened:
res[stat.id] = 'opened'
res[stat.id]['state'] = 'opened'
if stat.replied:
res[stat.id] = 'replied'
res[stat.id]['state'] = 'replied'
if stat.bounced:
res[stat.id] = 'bounced'
res[stat.id]['state'] = 'bounced'
return res
__store = {_name: ((lambda s, c, u, i, t: i), ['exception', 'sent', 'opened', 'replied', 'bounced'], 10)}
_columns = {
'mail_mail_id': fields.many2one('mail.mail', 'Mail', ondelete='set null'),
'mail_mail_id': fields.many2one('mail.mail', 'Mail', ondelete='set null', select=True),
'mail_mail_id_int': fields.integer(
'Mail ID (tech)',
help='ID of the related mail_mail. This field is an integer field because'
@@ -86,10 +83,17 @@ class MailMailStats(osv.Model):
'replied': fields.datetime('Replied', help='Date when this email has been replied for the first time.'),
'bounced': fields.datetime('Bounced', help='Date when this email has bounced.'),
'links_click_ids': fields.one2many('website.links.click', 'mail_stat_id', 'Links click'),
'state': fields.function(_compute_state, string='State', type="selection",
selection=[('outgoing', 'Outgoing'), ('exception', 'Exception'), ('sent', 'Sent'), ('opened', 'Opened'), ('replied', 'Replied'), ('bounced', 'Bounced')],
store={'mail.mail.statistics': (lambda self, cr, uid, ids, context=None: ids, ['exception', 'sent', 'opened', 'replied', 'bounced'], 10)}),
'state_update': fields.datetime('State Update', help='Last state update of the mail'),
'state': fields.function(_compute_state, string='State', type="selection", multi="state",
selection=[('outgoing', 'Outgoing'),
('exception', 'Exception'),
('sent', 'Sent'),
('opened', 'Opened'),
('replied', 'Replied'),
('bounced', 'Bounced')],
store=__store),
'state_update': fields.function(_compute_state, string='State Update', type='datetime',
multi='state', help='Last state update of the mail',
store=__store),
}
_defaults = {
+1 -1
View File
@@ -271,7 +271,7 @@
</record>
<record model="ir.actions.act_window" id="action_view_mass_mailing_lists">
<field name="name">Contact Lists</field>
<field name="name">Mailing Lists</field>
<field name="res_model">mail.mass_mailing.list</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
+1 -1
View File
@@ -262,7 +262,7 @@
<field name="date"/>
<field name="member_price"/>
<field name="membership_id"/>
<field name="account_invoice_id"/>
<field name="account_invoice_id" context="{'form_view_ref': 'account.invoice_form'}"/>
<field name="state" colspan="4"/>
</form>
</field>
+22 -10
View File
@@ -25,7 +25,7 @@ from collections import OrderedDict
import openerp.addons.decimal_precision as dp
from openerp.osv import fields, osv
from openerp.tools import DEFAULT_SERVER_DATE_FORMAT
from openerp.tools import float_compare
from openerp.tools import float_compare, float_is_zero
from openerp.tools.translate import _
from openerp import tools, SUPERUSER_ID
from openerp.addons.product import _common
@@ -215,6 +215,8 @@ class mrp_bom(osv.osv):
@param properties: List of related properties.
@return: False or BoM id.
"""
if not context:
context = {}
if properties is None:
properties = []
if product_id:
@@ -232,19 +234,21 @@ class mrp_bom(osv.osv):
else:
# neither product nor template, makes no sense to search
return False
if context.get('company_id'):
domain = domain + [('company_id', '=', context['company_id'])]
domain = domain + [ '|', ('date_start', '=', False), ('date_start', '<=', time.strftime(DEFAULT_SERVER_DATE_FORMAT)),
'|', ('date_stop', '=', False), ('date_stop', '>=', time.strftime(DEFAULT_SERVER_DATE_FORMAT))]
# order to prioritize bom with product_id over the one without
ids = self.search(cr, uid, domain, order='product_id', context=context)
ids = self.search(cr, uid, domain, order='sequence, product_id', context=context)
# Search a BoM which has all properties specified, or if you can not find one, you could
# pass a BoM without any properties
# pass a BoM without any properties with the smallest sequence
bom_empty_prop = False
for bom in self.pool.get('mrp.bom').browse(cr, uid, ids, context=context):
if not set(map(int, bom.property_ids or [])) - set(properties or []):
if properties and not bom.property_ids:
bom_empty_prop = bom.id
else:
if not properties or bom.property_ids:
return bom.id
elif not bom_empty_prop:
bom_empty_prop = bom.id
return bom_empty_prop
def _bom_explode(self, cr, uid, bom, product, factor, properties=None, level=0, routing_id=False, previous_products=None, master_bom=None, context=None):
@@ -300,6 +304,9 @@ class mrp_bom(osv.osv):
if not product or (set(map(int,bom_line_id.attribute_value_ids or [])) - set(map(int,product.attribute_value_ids))):
continue
if set(map(int, bom_line_id.property_ids or [])) - set(properties or []):
continue
if previous_products and bom_line_id.product_id.product_tmpl_id.id in previous_products:
raise UserError(_('BoM "%s" contains a BoM line with a product recursion: "%s".') % (master_bom.name,bom_line_id.product_id.name_get()[0][1]))
@@ -421,6 +428,7 @@ class mrp_bom_line(osv.osv):
'product_rounding': lambda *a: 0.0,
'type': lambda *a: 'normal',
'product_uom': _get_uom_id,
'sequence': 1,
}
_sql_constraints = [
('bom_qty_zero', 'CHECK (product_qty>0)', 'All product quantities must be greater than 0.\n' \
@@ -602,7 +610,7 @@ class mrp_production(osv.osv):
'date_planned': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
'product_qty': lambda *a: 1.0,
'user_id': lambda self, cr, uid, c: uid,
'name': lambda x, y, z, c: x.pool.get('ir.sequence').next_by_code(y, z, 'mrp.production') or '/',
'name': lambda self, cr, uid, context: self.pool['ir.sequence'].next_by_code(cr, uid, 'mrp.production', context=context) or '/',
'company_id': lambda self, cr, uid, c: self.pool.get('res.company')._company_default_get(cr, uid, 'mrp.production', context=c),
'location_src_id': _src_id_default,
'location_dest_id': _dest_id_default
@@ -745,7 +753,7 @@ class mrp_production(osv.osv):
#reset workcenter_lines in production order
for line in results2:
line['production_id'] = production.id
workcenter_line_obj.create(cr, uid, line)
workcenter_line_obj.create(cr, uid, line, context)
return results
def action_compute(self, cr, uid, ids, properties=None, context=None):
@@ -948,6 +956,7 @@ class mrp_production(osv.osv):
uom_obj = self.pool.get("product.uom")
production = self.browse(cr, uid, production_id, context=context)
production_qty_uom = uom_obj._compute_qty(cr, uid, production.product_uom.id, production_qty, production.product_id.uom_id.id)
precision = self.pool['decimal.precision'].precision_get(cr, uid, 'Product Unit of Measure')
main_production_move = False
if production_mode == 'consume_produce':
@@ -969,7 +978,8 @@ class mrp_production(osv.osv):
location_id=produce_product.location_id.id, restrict_lot_id=lot_id, context=context)
stock_mov_obj.write(cr, uid, new_moves, {'production_id': production_id}, context=context)
remaining_qty = subproduct_factor * production_qty_uom - qty
if remaining_qty: # In case you need to make more than planned
if not float_is_zero(remaining_qty, precision_rounding=precision):
# In case you need to make more than planned
#consumed more in wizard than previously planned
extra_move_id = stock_mov_obj.copy(cr, uid, produce_product.id, default={'product_uom_qty': remaining_qty,
'production_id': production_id}, context=context)
@@ -999,7 +1009,7 @@ class mrp_production(osv.osv):
stock_mov_obj.action_consume(cr, uid, [raw_material_line.id], consumed_qty, raw_material_line.location_id.id,
restrict_lot_id=consume['lot_id'], consumed_for=main_production_move, context=context)
remaining_qty -= consumed_qty
if remaining_qty:
if not float_is_zero(remaining_qty, precision_rounding=precision):
#consumed more in wizard than previously planned
product = self.pool.get('product.product').browse(cr, uid, consume['product_id'], context=context)
extra_move_id = self._make_consume_line_from_data(cr, uid, production, product, product.uom_id.id, remaining_qty, False, 0, context=context)
@@ -1242,6 +1252,8 @@ class mrp_production(osv.osv):
""" Confirms production order.
@return: Newly generated Shipment Id.
"""
user_lang = self.pool.get('res.users').browse(cr, uid, [uid]).partner_id.lang
context = dict(context, lang=user_lang)
uncompute_ids = filter(lambda x: x, [not x.product_lines and x.id or False for x in self.browse(cr, uid, ids, context=context)])
self.action_compute(cr, uid, uncompute_ids, context=context)
for production in self.browse(cr, uid, ids, context=context):
+49 -1
View File
@@ -452,6 +452,25 @@
<field name="type">normal</field>
</record>
<record id="mrp_bom_property_0" model="mrp.bom">
<field name="name">PC Assemble + DDR 512MB</field>
<field name="product_tmpl_id" ref="product.product_product_3_product_template"/>
<field name="product_uom" ref="product.product_uom_unit"/>
<field name="sequence">5</field>
<field name="type">normal</field>
<field name="property_ids" eval="[(6,0,[ref('mrp_property_0')])]"/>
</record>
<record id="mrp_bom_property_line" model="mrp.bom">
<field name="name">RAM SR2 PLUS</field>
<field name="product_id" ref="product.product_product_14"/>
<field name="product_tmpl_id" ref="product.product_product_14_product_template"/>
<field name="product_uom" ref="product.product_uom_unit"/>
<field name="sequence">5</field>
<field name="type">phantom</field>
<field name="property_ids" eval="[(6,0,[ref('mrp_property_0')])]"/>
</record>
<record id="mrp_bom_line_17" model="mrp.bom.line">
<field name="product_id" ref="product.product_product_6"/>
<field name="product_qty">1</field>
@@ -501,7 +520,7 @@
<field name="name">PC Assemble + 512MB RAM</field>
<field name="product_tmpl_id" ref="product.product_product_3_product_template"/>
<field name="product_uom" ref="product.product_uom_unit"/>
<field name="sequence">5</field>
<field name="sequence">4</field>
<field name="routing_id" ref="mrp_routing_2"/>
<field name="type">phantom</field>
</record>
@@ -639,6 +658,35 @@
<field name="bom_id" ref="mrp_bom_11"/>
</record>
<record id="mrp_bom_line_prop_1" model="mrp.bom.line">
<field name="product_id" ref="product.product_product_13"/>
<field name="product_qty">1</field>
<field name="product_uom" ref="product.product_uom_unit"/>
<field name="sequence">1</field>
<field name="type">normal</field>
<field name="property_ids" eval="[(6,0,[ref('mrp_property_8')])]"/>
<field name="bom_id" ref="mrp_bom_property_line"/>
</record>
<record id="mrp_bom_line_prop_2" model="mrp.bom.line">
<field name="product_id" ref="product.product_product_12"/>
<field name="product_qty">1</field>
<field name="product_uom" ref="product.product_uom_unit"/>
<field name="sequence">1</field>
<field name="type">normal</field>
<field name="property_ids" eval="[(6,0,[ref('mrp_property_0')])]"/>
<field name="bom_id" ref="mrp_bom_property_line"/>
</record>
<record id="mrp_bom_line_prop_3" model="mrp.bom.line">
<field name="product_id" ref="product.product_product_11"/>
<field name="product_qty">1</field>
<field name="product_uom" ref="product.product_uom_unit"/>
<field name="sequence">1</field>
<field name="type">normal</field>
<field name="bom_id" ref="mrp_bom_property_line"/>
</record>
<record id="mrp_production_1" model="mrp.production">
<field name="product_id" ref="product.product_product_3"/>

Some files were not shown because too many files have changed in this diff Show More