removed more stuff

bzr revid: nicolas.vanhoren@openerp.com-20120917151218-4k5c6pnjfxic2v2o
This commit is contained in:
niv-openerp
2012-09-17 17:12:18 +02:00
parent cd12a0faf5
commit d53b210128
4 changed files with 0 additions and 282 deletions
@@ -1,138 +0,0 @@
# -*- 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 time
import tools
from osv import fields,osv
class account_move_line(osv.osv):
_inherit = "account.move.line"
def get_unreconcile_entry(self, cr, uid, ids, context=None):
return self.search(cr, uid, [('id', 'in', ids), ('reconcile_id', '=', False)], context=context)
account_move_line();
class account_move_reconciliation(osv.osv):
_name = "account.move.reconciliation"
_description = "partner info related account move line"
_auto = False
_order = 'last_reconciliation_date'
def search(self, cr, uid, args, offset=0, limit=None, order=None,
context=None, count=False):
if context is None:
context = {}
account_type = context.get('account_type', False)
if account_type:
args += [('type','=', account_type)]
return super(account_move_reconciliation, self).search(cr, uid, args, offset, limit,
order, context=context, count=count)
def _get_to_reconcile_partners(self, cr, uid, context=None):
if context is None:
context = {}
ctx = dict(context)
ctx['next_partner_only'] = False
move_line_obj = self.pool.get("account.move.line")
to_reconcile_ids = move_line_obj.search(cr, uid, [
('reconcile_id','=',False),
('account_id.reconcile','=',True),
('state','!=', 'draft'),
('partner_id','!=', False),
'|', ('partner_id.last_reconciliation_date', '=', False),('partner_id.last_reconciliation_date','<',time.strftime('%Y-%m-%d 00:00:00')),
'|', ('debit', '>' ,0), ('credit', '>' ,0)
],
context=ctx)
partner_ids = []
for move_line in move_line_obj.browse(cr, uid, to_reconcile_ids, context=ctx):
partner = move_line.partner_id
if move_line.date > partner.last_reconciliation_date and partner.id not in partner_ids:
partner_ids.append(partner.id)
return len(partner_ids)
def _get_today_reconciled_partners(self, cr, uid, context=None):
if context is None:
context = {}
account_type = context.get("account_type", False)
supplier = False
customer = False
if account_type == 'payable':
supplier = True
else:
customer = True
today_reconciled_ids = self.pool.get('res.partner').search(cr, uid, [
('last_reconciliation_date','>=',time.strftime('%Y-%m-%d 00:00:00')),
('last_reconciliation_date','<=',time.strftime('%Y-%m-%d 23:59:59')),
'|', ('supplier','=',supplier), ('customer','=',customer)
], context=context)
return today_reconciled_ids and len(today_reconciled_ids) or 0
def _rec_progress(self, cr, uid, ids, prop, unknow_none, context=None):
res = {}
to_reconcile = self._get_to_reconcile_partners(cr, uid, context=context)
today_reconciled = self._get_today_reconciled_partners(cr, uid, context=context)
if to_reconcile < 0:
reconciliation_progress = 100
else:
reconciliation_progress = (100 / (float( to_reconcile + today_reconciled) or 1.0)) * today_reconciled
for id in ids:
res[id] = reconciliation_progress
return res
def skip_partner(self, cr, uid, ids, context):
self.pool.get('res.partner').write(cr, uid, ids ,{'last_reconciliation_date':time.strftime("%Y-%m-%d")}, context)
_columns = {
'partner_id':fields.many2one('res.partner', 'Partner'),
'last_reconciliation_date':fields.related('partner_id', 'last_reconciliation_date' ,type='datetime', relation='res.partner', string='Last Reconciliation'),
'latest_date' :fields.date('Latest Entry'),
'type': fields.char('Type', size=156),
'supplier': fields.related('partner_id', 'supplier' ,type='boolean', string='Supplier'),
'customer': fields.related('partner_id', 'customer' ,type='boolean', string='Customer'),
'reconciliation_progress': fields.function(_rec_progress, string='Progress (%)', type='float'),
}
def init(self, cr):
tools.drop_view_if_exists(cr, 'account_move_reconciliation')
cr.execute("""
CREATE or REPLACE VIEW account_move_reconciliation as (
SELECT move_line.partner_id AS id, a.type AS type, move_line.partner_id AS partner_id,
SUM(move_line.debit) AS debit,
SUM(move_line.credit) AS credit,
MAX(move_line.date) AS latest_date,
MIN(partner.last_reconciliation_date) AS last_reconciliation_date
FROM account_move_line move_line
LEFT JOIN account_account a ON (a.id = move_line.account_id)
LEFT JOIN res_partner partner ON (move_line.partner_id = partner.id)
WHERE a.reconcile IS TRUE
AND move_line.reconcile_id IS NULL
AND (partner.last_reconciliation_date IS NULL OR move_line.date > partner.last_reconciliation_date)
AND move_line.state <> 'draft'
GROUP BY move_line.partner_id, a.type
)
""")
account_move_reconciliation()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
@@ -1,66 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!-- Menu and Action -->
<record id="action_account_receivable_manual_reconcile" model="ir.actions.act_window">
<field name="name">Reconcile Customer Entries</field>
<field name="res_model">account.move.line</field>
<field name="view_type">form</field>
<field name="view_mode">account_reconciliation_list,form</field>
<field eval="True" name="auto_search"/>
<field name="context" eval="{'account_type':'receivable', 'search_default_unreconciled': 1}"></field>
</record>
<record id="action_account_payable_manual_reconcile" model="ir.actions.act_window">
<field name="name">Reconcile Supplier Entries</field>
<field name="res_model">account.move.line</field>
<field name="view_type">form</field>
<field name="view_mode">account_reconciliation_list,form</field>
<field eval="True" name="auto_search"/>
<field name="context" eval="{'account_type':'payable', 'search_default_unreconciled': 1}"></field>
</record>
<record id="view_move_line_tree_reconciliation" model="ir.ui.view">
<field name="name">account.move.line.account_reconciliation_list</field>
<field name="model">account.move.line</field>
<field eval="4" name="priority"/>
<field name="arch" type="xml">
<account_reconciliation_list version="7.0" colors="red:state == 'draft';black:state == 'valid'" string="Journal Items" editable="top" on_write="on_create_write">
<field name="date"/>
<field name="period_id" invisible="1"/>
<field name="move_id"/>
<field name="ref"/>
<field name="invoice" invisible="1"/>
<field name="name" invisible="1" />
<field name="partner_id" invisible="1" on_change="onchange_partner_id(move_id, partner_id, account_id, debit, credit, date, journal_id)"/>
<field name="account_id" domain="[('journal_id','=',journal_id), ('company_id', '=', company_id)]"/>
<field name="journal_id"/>
<field name="debit" sum="Total debit"/>
<field name="credit" sum="Total credit"/>
<field name="account_tax_id"/>
<field name="analytic_account_id" groups="analytic.group_analytic_accounting" domain="[('parent_id','!=',False)]"/>
<field name="amount_currency" attrs="{'readonly':[('state','=','valid')]}"/>
<field name="currency_id" attrs="{'readonly':[('state','=','valid')]}" groups="base.group_multi_currency"/>
<field name="reconcile_partial_id"/>
<field name="reconcile_id"/>
<field name="state"/>
</account_reconciliation_list>
</field>
</record>
<menuitem
name="Manual Reconciliation" icon="STOCK_EXECUTE"
id="menu_manual_reconcile"
parent="account.periodical_processing_reconciliation"/>
<menuitem id="receivable_manual_reconcile" name="Reconcile Customer Entries"
action="action_account_receivable_manual_reconcile"
parent="account.menu_manual_reconcile"/>
<menuitem id="payable_manual_reconcile" name="Reconcile Supplier Entries"
action="action_account_payable_manual_reconcile"
parent="account.menu_manual_reconcile"/>
</data>
</openerp>
@@ -1,61 +0,0 @@
# -*- 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/>.
#
##############################################################################
from osv import fields, osv
import tools
class account_move_reconciliation(osv.osv):
_inherit = 'account.move.reconciliation'
def _get_followup(self, cr, uid, ids, field_name, arg, context=None):
result = {}
move_obj = self.pool.get("account.move.line")
for rec in self.browse(cr, uid, ids, context=context):
move_line_ids = move_obj.search(cr, uid, [('partner_id','=',rec.partner_id.id),('followup_date','=',rec.followup_date)], context=context)
move_line = move_line_ids and move_obj.browse(cr, uid, move_line_ids[0], context=context) or False
result[rec.id] = move_line and move_line.followup_line_id.id or False
return result
_columns = {
'followup_date': fields.date('Latest Follow-up'),
'followup_id':fields.function(_get_followup, type='many2one', relation='account_followup.followup.line', string='Max Follow Up Level')
}
def init(self, cr):
tools.drop_view_if_exists(cr, 'account_move_reconciliation')
cr.execute("""
CREATE or REPLACE VIEW account_move_reconciliation as (
SELECT move_line.partner_id AS id, a.type AS type, move_line.partner_id AS partner_id,
SUM(move_line.debit) AS debit,
SUM(move_line.credit) AS credit,
MAX(move_line.date) AS latest_date,
MIN(partner.last_reconciliation_date) AS last_reconciliation_date,
MAX(move_line.followup_date) as followup_date
FROM account_move_line move_line
LEFT JOIN account_account a ON (a.id = move_line.account_id)
LEFT JOIN res_partner partner ON (move_line.partner_id = partner.id)
WHERE a.reconcile IS TRUE
AND move_line.reconcile_id IS NULL
AND (partner.last_reconciliation_date IS NULL OR move_line.date > partner.last_reconciliation_date)
AND move_line.state <> 'draft'
GROUP BY move_line.partner_id, a.type
)
""")
account_move_reconciliation()
@@ -1,17 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_move_reconciliation_followup_form" model="ir.ui.view">
<field name="name">account.move.reconciliation.followup</field>
<field name="model">account.move.reconciliation</field>
<field name="inherit_id" ref="account.view_account_move_reconciliation_form_view"/>
<field name="arch" type="xml">
<xpath expr="//div[@name='grp_followup']" position="inside">
<label for="followup_date"/>
<field name="followup_date"/>
<field name="followup_id"/>
</xpath>
</field>
</record>
</data>
</openerp>