[REF] account_voucher: remove useless and unused code (classes account.statement.from.invoice and account.voucher.unreconcile)
bzr revid: qdp-launchpad@openerp.com-20120810123525-lhijvv2khh0xqw38
This commit is contained in:
parent
29bd7ba2db
commit
766ee94872
|
@ -49,7 +49,6 @@ eInvoicing & Payments module manage all Voucher Entries such as "Reconciliation
|
|||
"account_voucher_sequence.xml",
|
||||
"account_voucher_workflow.xml",
|
||||
"account_voucher_report.xml",
|
||||
"wizard/account_voucher_unreconcile_view.xml",
|
||||
"wizard/account_statement_from_invoice_view.xml",
|
||||
"account_voucher_view.xml",
|
||||
"voucher_payment_receipt_view.xml",
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
#
|
||||
##############################################################################
|
||||
|
||||
import account_voucher_unreconcile
|
||||
import account_statement_from_invoice
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -112,81 +112,10 @@ class account_statement_from_invoice_lines(osv.osv_memory):
|
|||
'statement_id': statement_id,
|
||||
'ref': line.ref,
|
||||
'voucher_id': voucher_id,
|
||||
'date': time.strftime('%Y-%m-%d'), #time.strftime('%Y-%m-%d'), #line.date_maturity or,
|
||||
'date': time.strftime('%Y-%m-%d'),
|
||||
}, context=context)
|
||||
return {'type': 'ir.actions.act_window_close'}
|
||||
|
||||
account_statement_from_invoice_lines()
|
||||
|
||||
class account_statement_from_invoice(osv.osv_memory):
|
||||
"""
|
||||
Generate Entries by Statement from Invoices
|
||||
"""
|
||||
_name = "account.statement.from.invoice"
|
||||
_description = "Entries by Statement from Invoices"
|
||||
_columns = {
|
||||
'date': fields.date('Date payment',required=True),
|
||||
'journal_ids': fields.many2many('account.journal', 'account_journal_relation', 'account_id', 'journal_id', 'Journal'),
|
||||
'line_ids': fields.many2many('account.move.line', 'account_move_line_relation', 'move_id', 'line_id', 'Invoices'),
|
||||
}
|
||||
_defaults = {
|
||||
'date': lambda *a: time.strftime('%Y-%m-%d'),
|
||||
}
|
||||
|
||||
def search_invoices(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
line_obj = self.pool.get('account.move.line')
|
||||
statement_obj = self.pool.get('account.bank.statement')
|
||||
journal_obj = self.pool.get('account.journal')
|
||||
mod_obj = self.pool.get('ir.model.data')
|
||||
statement_id = 'statement_id' in context and context['statement_id']
|
||||
|
||||
data = self.read(cr, uid, ids, context=context)[0]
|
||||
statement = statement_obj.browse(cr, uid, statement_id, context=context)
|
||||
args_move_line = []
|
||||
repeated_move_line_ids = []
|
||||
# Creating a group that is unique for importing move lines(move lines, once imported into statement lines, should not appear again)
|
||||
for st_line in statement.line_ids:
|
||||
args_move_line = []
|
||||
args_move_line.append(('name', '=', st_line.name))
|
||||
args_move_line.append(('ref', '=', st_line.ref))
|
||||
if st_line.partner_id:
|
||||
args_move_line.append(('partner_id', '=', st_line.partner_id.id))
|
||||
args_move_line.append(('account_id', '=', st_line.account_id.id))
|
||||
|
||||
move_line_id = line_obj.search(cr, uid, args_move_line, context=context)
|
||||
if move_line_id:
|
||||
repeated_move_line_ids += move_line_id
|
||||
|
||||
journal_ids = data['journal_ids']
|
||||
if journal_ids == []:
|
||||
journal_ids = journal_obj.search(cr, uid, [('type', 'in', ('sale', 'cash', 'purchase'))], context=context)
|
||||
|
||||
args = [
|
||||
('reconcile_id', '=', False),
|
||||
('journal_id', 'in', journal_ids),
|
||||
('account_id.reconcile', '=', True)]
|
||||
|
||||
if repeated_move_line_ids:
|
||||
args.append(('id', 'not in', repeated_move_line_ids))
|
||||
|
||||
line_ids = line_obj.search(cr, uid, args,
|
||||
context=context)
|
||||
|
||||
model_data_ids = mod_obj.search(cr, uid, [('model', '=', 'ir.ui.view'), ('name', '=', 'view_account_statement_from_invoice_lines')], context=context)
|
||||
resource_id = mod_obj.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id']
|
||||
return {
|
||||
'domain': "[('id','in', ["+','.join([str(x) for x in line_ids])+"])]",
|
||||
'name': _('Import Entries'),
|
||||
'context': context,
|
||||
'view_type': 'form',
|
||||
'view_mode': 'form',
|
||||
'res_model': 'account.statement.from.invoice.lines',
|
||||
'views': [(resource_id,'form')],
|
||||
'type': 'ir.actions.act_window',
|
||||
'target': 'new',
|
||||
}
|
||||
|
||||
account_statement_from_invoice()
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -1,34 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<record id="view_account_statement_from_invoice" model="ir.ui.view">
|
||||
<field name="name">account.statement.from.invoice.form</field>
|
||||
<field name="model">account.statement.from.invoice</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Import Invoices in Statement" version="7.0">
|
||||
<group>
|
||||
<field name="date"/>
|
||||
<field name="journal_ids" domain="[('type','in',['sale','purchase','cash'])]"/>
|
||||
</group>
|
||||
<footer>
|
||||
<button string="Go" name="search_invoices" type="object" class="oe_highlight"/>
|
||||
or
|
||||
<button string="Cancel" class="oe_link" special="cancel"/>
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_view_account_statement_from_invoice" model="ir.actions.act_window">
|
||||
<field name="name">Import Invoices in Statement</field>
|
||||
<field name="res_model">account.statement.from.invoice</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_id" ref="view_account_statement_from_invoice"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<record id="view_account_statement_from_invoice_lines" model="ir.ui.view">
|
||||
<field name="name">account.statement.from.invoice.lines.form</field>
|
||||
<field name="model">account.statement.from.invoice.lines</field>
|
||||
|
|
|
@ -1,62 +0,0 @@
|
|||
# -*- 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/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from osv import osv
|
||||
from osv import fields
|
||||
|
||||
class account_voucher_unreconcile(osv.osv_memory):
|
||||
_name = "account.voucher.unreconcile"
|
||||
_description = "Account voucher unreconcile"
|
||||
|
||||
_columns = {
|
||||
'remove':fields.boolean('Want to remove accounting entries too ?', required=False),
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
'remove': True,
|
||||
}
|
||||
|
||||
def trans_unrec(self, cr, uid, ids, context=None):
|
||||
# res = self.browse(cr, uid, ids[0])
|
||||
if context is None:
|
||||
context = {}
|
||||
voucher_pool = self.pool.get('account.voucher')
|
||||
reconcile_pool = self.pool.get('account.move.reconcile')
|
||||
if context.get('active_id'):
|
||||
voucher = voucher_pool.browse(cr, uid, context.get('active_id'), context=context)
|
||||
recs = []
|
||||
for line in voucher.move_ids:
|
||||
if line.reconcile_id:
|
||||
recs += [line.reconcile_id.id]
|
||||
if line.reconcile_partial_id:
|
||||
recs += [line.reconcile_partial_id.id]
|
||||
#for rec in recs:
|
||||
reconcile_pool.unlink(cr, uid, recs)
|
||||
# if res.remove:
|
||||
voucher_pool.cancel_voucher(cr, uid, [context.get('active_id')], context)
|
||||
# wf_service = netsvc.LocalService("workflow")
|
||||
# wf_service.trg_validate(uid, 'account.voucher', context.get('active_id'), 'cancel_voucher', cr)
|
||||
|
||||
return {'type': 'ir.actions.act_window_close'}
|
||||
|
||||
account_voucher_unreconcile()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -1,31 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="view_account_voucher_unreconcile" model="ir.ui.view">
|
||||
<field name="name">Account voucher unreconcile</field>
|
||||
<field name="model">account.voucher.unreconcile</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Unreconciliation" version="7.0">
|
||||
<separator string="Unreconciliation Transactions" />
|
||||
<label string="If you unreconciliate transactions, you must also verify all the actions that are linked to those transactions because they will not be disable"/>
|
||||
<footer>
|
||||
<button name="trans_unrec" default_focus="1" string="Unreconcile" type="object" class="oe_highlight"/>
|
||||
or
|
||||
<button string="Cancel" class="oe_link" special="cancel"/>
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
<record model="ir.actions.act_window" id="action_view_account_voucher_unreconcile">
|
||||
<field name="name">Unreconcile entries</field>
|
||||
<field name="res_model">account.voucher.unreconcile</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="view_account_voucher_unreconcile"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
Loading…
Reference in New Issue