[ADD] Account: wizard convert to osv memory(Total:2) => Create subcription entries and analytic entry by lines
bzr revid: tiny@tiny-desktop-20100402122232-2lizazewbp8bn2v1
This commit is contained in:
parent
4b61fc1a7d
commit
163246cf7d
|
@ -55,7 +55,8 @@ module named account_voucherss
|
||||||
'wizard/account_move_journal_view.xml',
|
'wizard/account_move_journal_view.xml',
|
||||||
'account_wizard.xml',
|
'account_wizard.xml',
|
||||||
'wizard/account_move_line_unreconcile_select_view.xml',
|
'wizard/account_move_line_unreconcile_select_view.xml',
|
||||||
|
'wizard/account_subscription_generate_view.xml',
|
||||||
|
'project/wizard/project_account_analytic_line_view.xml',
|
||||||
'account_view.xml',
|
'account_view.xml',
|
||||||
'account_end_fy.xml',
|
'account_end_fy.xml',
|
||||||
'account_invoice_view.xml',
|
'account_invoice_view.xml',
|
||||||
|
|
|
@ -86,8 +86,10 @@
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<!-- subscriptions -->
|
<!-- subscriptions -->
|
||||||
|
<!--
|
||||||
<wizard id="wizard_generate_subscription" menu="False" model="account.subscription" name="account.subscription.generate" string="Create subscription entries"/>
|
<wizard id="wizard_generate_subscription" menu="False" model="account.subscription" name="account.subscription.generate" string="Create subscription entries"/>
|
||||||
<menuitem action="wizard_generate_subscription" id="menu_generate_subscription" parent="account.menu_finance_periodical_processing" type="wizard"/>
|
<menuitem action="wizard_generate_subscription" id="menu_generate_subscription" parent="account.menu_finance_periodical_processing" type="wizard"/>
|
||||||
|
-->
|
||||||
<!-- Aged partner balance -->
|
<!-- Aged partner balance -->
|
||||||
<wizard id="wizard_aged_trial_balance" menu="False" model="res.partner" name="account.aged.trial.balance" string="Aged Partner Balance"/>
|
<wizard id="wizard_aged_trial_balance" menu="False" model="res.partner" name="account.aged.trial.balance" string="Aged Partner Balance"/>
|
||||||
<menuitem id="next_id_22" name="Partner Accounts" parent="menu_finance_generic_reporting" sequence="1"/>
|
<menuitem id="next_id_22" name="Partner Accounts" parent="menu_finance_generic_reporting" sequence="1"/>
|
||||||
|
|
|
@ -204,10 +204,14 @@
|
||||||
<field name="view_type">form</field>
|
<field name="view_type">form</field>
|
||||||
<field name="view_id" ref="view_account_analytic_line_tree"/>
|
<field name="view_id" ref="view_account_analytic_line_tree"/>
|
||||||
</record>
|
</record>
|
||||||
<wizard id="action_account_analytic_line" menu="False" model="account.analytic.line" name="account.analytic.line" string="Entries by Line"/>
|
<wizard id="action_account_analytic_line" menu="False" model="account.analytic.line" name="account.analytic.line" string="Entries by Line"/>
|
||||||
<menuitem id="next_id_41" name="Analytic Entries" parent="account.menu_finance_entries"/>
|
<menuitem id="next_id_41" name="Analytic Entries" parent="account.menu_finance_entries"/>
|
||||||
<menuitem type="wizard" icon="STOCK_JUSTIFY_FILL" action="action_account_analytic_line" id="account_entries_analytic_entries" parent="next_id_41"/>
|
<!-- Entries by Line -->
|
||||||
|
|
||||||
|
<menuitem icon="STOCK_JUSTIFY_FILL"
|
||||||
|
action="action_project_account_analytic_line_form"
|
||||||
|
id="account_entries_analytic_entries"
|
||||||
|
parent="next_id_41"/>
|
||||||
|
|
||||||
<record id="action_account_tree1" model="ir.actions.act_window">
|
<record id="action_account_tree1" model="ir.actions.act_window">
|
||||||
<field name="name">Analytic Entries</field>
|
<field name="name">Analytic Entries</field>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
##############################################################################
|
##############################################################################
|
||||||
#
|
#
|
||||||
# OpenERP, Open Source Management Solution
|
# OpenERP, Open Source Management Solution
|
||||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||||
#
|
#
|
||||||
|
@ -15,7 +15,7 @@
|
||||||
# GNU Affero General Public License for more details.
|
# GNU Affero General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU Affero General Public License
|
# 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/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ import wizard_account_analytic_inverted_balance_report
|
||||||
import wizard_account_analytic_cost_ledger_report
|
import wizard_account_analytic_cost_ledger_report
|
||||||
import wizard_account_analytic_cost_ledger_for_journal_report
|
import wizard_account_analytic_cost_ledger_for_journal_report
|
||||||
import wizard_account_analytic_analytic_check
|
import wizard_account_analytic_analytic_check
|
||||||
import wizard_account_analytic_line
|
import project_account_analytic_line
|
||||||
import wizard_analytic_account_chart
|
import wizard_analytic_account_chart
|
||||||
|
|
||||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
|
@ -0,0 +1,58 @@
|
||||||
|
# -*- 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
|
||||||
|
from tools.translate import _
|
||||||
|
|
||||||
|
class project_account_analytic_line(osv.osv_memory):
|
||||||
|
_name = "project.account.analytic.line"
|
||||||
|
_description = "Analytic Entries by line"
|
||||||
|
_columns = {
|
||||||
|
'from_date': fields.date('From'),
|
||||||
|
'to_date': fields.date('To'),
|
||||||
|
}
|
||||||
|
|
||||||
|
def action_open_window(self, cr, uid, ids, context={}):
|
||||||
|
mod_obj =self.pool.get('ir.model.data')
|
||||||
|
domain = []
|
||||||
|
for data in self.read(cr, uid, ids,context=context):
|
||||||
|
from_date =data['from_date']
|
||||||
|
to_date =data['to_date']
|
||||||
|
if from_date and to_date:
|
||||||
|
domain = [('date','>=',from_date), ('date','<=',to_date)]
|
||||||
|
elif from_date:
|
||||||
|
domain = [('date','>=',from_date)]
|
||||||
|
elif to_date:
|
||||||
|
domain = [('date','<=',to_date)]
|
||||||
|
result = mod_obj._get_id(cr, uid, 'account', 'view_account_analytic_line_filter')
|
||||||
|
id = mod_obj.read(cr, uid, result, ['res_id'], context=context)
|
||||||
|
return {
|
||||||
|
'name': _('Analytic Entries by line'),
|
||||||
|
'view_type': 'form',
|
||||||
|
"view_mode": 'tree,form',
|
||||||
|
'res_model': 'account.analytic.line',
|
||||||
|
'type': 'ir.actions.act_window',
|
||||||
|
'domain': domain,
|
||||||
|
'search_view_id': id['res_id'],}
|
||||||
|
|
||||||
|
project_account_analytic_line()
|
||||||
|
|
||||||
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -0,0 +1,36 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<openerp>
|
||||||
|
<data>
|
||||||
|
|
||||||
|
<record id="view_project_account_analytic_line_form" model="ir.ui.view">
|
||||||
|
<field name="name">project.account.analytic.line.form</field>
|
||||||
|
<field name="model">project.account.analytic.line</field>
|
||||||
|
<field name="type">form</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<form string="View Account Analytic Lines">
|
||||||
|
<group colspan="4" >
|
||||||
|
<field name="from_date"/>
|
||||||
|
<newline/>
|
||||||
|
<field name="to_date" />
|
||||||
|
</group>
|
||||||
|
<label string ="(Keep empty to open the current situation)" />
|
||||||
|
<separator string="" colspan="4" />
|
||||||
|
<group colspan="4" col="6">
|
||||||
|
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
|
||||||
|
<button icon="gtk-execute" string="Open Entries" name="action_open_window" type="object"/>
|
||||||
|
</group>
|
||||||
|
</form>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="action_project_account_analytic_line_form" model="ir.actions.act_window">
|
||||||
|
<field name="name">Entries by Line</field>
|
||||||
|
<field name="res_model">project.account.analytic.line</field>
|
||||||
|
<field name="view_type">form</field>
|
||||||
|
<field name="view_mode">tree,form</field>
|
||||||
|
<field name="view_id" ref="view_project_account_analytic_line_form"/>
|
||||||
|
<field name="target">new</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
</data>
|
||||||
|
</openerp>
|
|
@ -1,84 +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 wizard
|
|
||||||
import pooler
|
|
||||||
import time
|
|
||||||
from tools.translate import _
|
|
||||||
|
|
||||||
def _action_open_window(self, cr, uid, data, context):
|
|
||||||
domain = []
|
|
||||||
from_date = data['form']['from_date']
|
|
||||||
to_date = data['form']['to_date']
|
|
||||||
if from_date and to_date:
|
|
||||||
domain = [('date','>=',from_date),('date','<=',to_date)]
|
|
||||||
elif from_date:
|
|
||||||
domain = [('date','>=',from_date)]
|
|
||||||
elif to_date:
|
|
||||||
domain = [('date','<=',to_date)]
|
|
||||||
mod_obj = pooler.get_pool(cr.dbname).get('ir.model.data')
|
|
||||||
result = mod_obj._get_id(cr, uid, 'account', 'view_account_analytic_line_filter')
|
|
||||||
id = mod_obj.read(cr, uid, result, ['res_id'])
|
|
||||||
|
|
||||||
return {
|
|
||||||
'name': _('Analytic Entries by line'),
|
|
||||||
'view_type': 'form',
|
|
||||||
"view_mode": 'tree,form',
|
|
||||||
'res_model': 'account.analytic.line',
|
|
||||||
'type': 'ir.actions.act_window',
|
|
||||||
'domain': domain,
|
|
||||||
'search_view_id': id['res_id'],}
|
|
||||||
|
|
||||||
|
|
||||||
class account_analytic_line(wizard.interface):
|
|
||||||
form1 = '''<?xml version="1.0"?>
|
|
||||||
<form string="View Account Analytic Lines">
|
|
||||||
<separator string="Account Analytic Lines Analysis" colspan="4"/>
|
|
||||||
<field name="from_date"/>
|
|
||||||
<newline/>
|
|
||||||
<field name="to_date"/>
|
|
||||||
<newline/>
|
|
||||||
<label string=""/>
|
|
||||||
<label string="(Keep empty to open the current situation)" align="0.0" colspan="3"/>
|
|
||||||
</form>'''
|
|
||||||
form1_fields = {
|
|
||||||
'from_date': {
|
|
||||||
'string': 'From',
|
|
||||||
'type': 'date',
|
|
||||||
},
|
|
||||||
'to_date': {
|
|
||||||
'string': 'To',
|
|
||||||
'type': 'date',
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
states = {
|
|
||||||
'init': {
|
|
||||||
'actions': [],
|
|
||||||
'result': {'type': 'form', 'arch':form1, 'fields':form1_fields, 'state': [('end', 'Cancel','gtk-cancel'),('open', 'Open Entries','gtk-ok')]}
|
|
||||||
},
|
|
||||||
'open': {
|
|
||||||
'actions': [],
|
|
||||||
'result': {'type': 'action', 'action': _action_open_window, 'state':'end'}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
account_analytic_line('account.analytic.line')
|
|
||||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
|
@ -29,7 +29,7 @@ import wizard_pay_invoice
|
||||||
import account_move_journal
|
import account_move_journal
|
||||||
import wizard_journal_select
|
import wizard_journal_select
|
||||||
import account_move_bank_reconcile
|
import account_move_bank_reconcile
|
||||||
import wizard_subscription_generate
|
import account_subscription_generate
|
||||||
import wizard_aged_trial_balance
|
import wizard_aged_trial_balance
|
||||||
import wizard_general_ledger_report
|
import wizard_general_ledger_report
|
||||||
import wizard_third_party_ledger
|
import wizard_third_party_ledger
|
||||||
|
|
|
@ -0,0 +1,44 @@
|
||||||
|
# -*- 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
|
||||||
|
|
||||||
|
from osv import fields, osv
|
||||||
|
|
||||||
|
class account_subscription_generate(osv.osv_memory):
|
||||||
|
|
||||||
|
_name = "account.subscription.generate"
|
||||||
|
_description = "Subscription Compute"
|
||||||
|
_columns = {
|
||||||
|
'date': fields.date('Date', required=True),
|
||||||
|
}
|
||||||
|
_defaults = {
|
||||||
|
'date': lambda *a: time.strftime('%Y-%m-%d'),
|
||||||
|
}
|
||||||
|
def action_generate(self, cr, uid, ids, context={}):
|
||||||
|
for data in self.read(cr, uid, ids,context=context):
|
||||||
|
cr.execute('select id from account_subscription_line where date<%s and move_id is null', (data['date'],))
|
||||||
|
ids = map(lambda x: x[0], cr.fetchall())
|
||||||
|
self.pool.get('account.subscription.line').move_create(cr, uid, ids)
|
||||||
|
return {}
|
||||||
|
|
||||||
|
account_subscription_generate()
|
||||||
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<openerp>
|
||||||
|
<data>
|
||||||
|
|
||||||
|
<record id="view_account_subscription_generate" model="ir.ui.view">
|
||||||
|
<field name="name">account.subscription.generate.form</field>
|
||||||
|
<field name="model">account.subscription.generate</field>
|
||||||
|
<field name="type">form</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<form string="Subscription Compute">
|
||||||
|
<group colspan="4" >
|
||||||
|
<separator string="Generate entries before:" colspan="4"/>
|
||||||
|
<field name="date"/>
|
||||||
|
</group>
|
||||||
|
<separator string="" colspan="4" />
|
||||||
|
<group colspan="4" col="6">
|
||||||
|
<label string ="" colspan="2"/>
|
||||||
|
<button icon="gtk-cancel" special="cancel" string="Cancel" />
|
||||||
|
<button icon="gtk-execute" string="Compute Entry Dates"
|
||||||
|
name="action_generate" type="object" />
|
||||||
|
</group>
|
||||||
|
</form>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="action_account_subscription_generate" model="ir.actions.act_window">
|
||||||
|
<field name="name">Create subscription entries</field>
|
||||||
|
<field name="res_model">account.subscription.generate</field>
|
||||||
|
<field name="view_type">form</field>
|
||||||
|
<field name="view_mode">tree,form</field>
|
||||||
|
<field name="view_id" ref="view_account_subscription_generate"/>
|
||||||
|
<field name="target">new</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<menuitem action="action_account_subscription_generate" id="menu_generate_subscription" parent="account.menu_finance_periodical_processing" />
|
||||||
|
|
||||||
|
</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/>.
|
|
||||||
#
|
|
||||||
##############################################################################
|
|
||||||
|
|
||||||
import time
|
|
||||||
import wizard
|
|
||||||
import pooler
|
|
||||||
|
|
||||||
#
|
|
||||||
# TODO: add an intermediate screen for checks
|
|
||||||
#
|
|
||||||
|
|
||||||
_subscription_form = '''<?xml version="1.0"?>
|
|
||||||
<form string="%s">
|
|
||||||
<separator string="Generate entries before:" colspan="4"/>
|
|
||||||
<field name="date"/>
|
|
||||||
</form>''' % ('Subscription Compute',)
|
|
||||||
|
|
||||||
_subscription_fields = {
|
|
||||||
'date': {'string':'Date', 'type':'date', 'default':lambda *a: time.strftime('%Y-%m-%d'), 'required':True},
|
|
||||||
}
|
|
||||||
|
|
||||||
class wiz_subscription(wizard.interface):
|
|
||||||
def _action_generate(self, cr, uid, data, context={}):
|
|
||||||
cr.execute('select id from account_subscription_line where date<%s and move_id is null', (data['form']['date'],))
|
|
||||||
ids = map(lambda x: x[0], cr.fetchall())
|
|
||||||
pooler.get_pool(cr.dbname).get('account.subscription.line').move_create(cr, uid, ids)
|
|
||||||
return {}
|
|
||||||
|
|
||||||
states = {
|
|
||||||
'init': {
|
|
||||||
'actions': [],
|
|
||||||
'result': {'type': 'form', 'arch':_subscription_form, 'fields':_subscription_fields, 'state':[('end','Cancel', 'gtk-cancel'),('generate','Compute', 'gtk-ok')]}
|
|
||||||
},
|
|
||||||
'generate': {
|
|
||||||
'actions': [_action_generate],
|
|
||||||
'result': {'type': 'state', 'state':'end'}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
wiz_subscription('account.subscription.generate')
|
|
||||||
|
|
||||||
|
|
||||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
||||||
|
|
Loading…
Reference in New Issue